payload-live-preview 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/astro/index.cjs +2 -2
- package/dist/adapters/astro/index.cjs.map +1 -1
- package/dist/adapters/astro/index.js +2 -2
- package/dist/adapters/astro/index.js.map +1 -1
- package/dist/adapters/astro/middleware-entry.cjs +2 -2
- package/dist/adapters/astro/middleware-entry.cjs.map +1 -1
- package/dist/adapters/astro/middleware-entry.js +2 -2
- package/dist/adapters/astro/middleware-entry.js.map +1 -1
- package/dist/adapters/nextjs/index.cjs +2 -2
- package/dist/adapters/nextjs/index.cjs.map +1 -1
- package/dist/adapters/nextjs/index.js +2 -2
- package/dist/adapters/nextjs/index.js.map +1 -1
- package/dist/adapters/nuxt/index.cjs +2 -2
- package/dist/adapters/nuxt/index.cjs.map +1 -1
- package/dist/adapters/nuxt/index.js +2 -2
- package/dist/adapters/nuxt/index.js.map +1 -1
- package/dist/adapters/sveltekit/index.cjs +2 -2
- package/dist/adapters/sveltekit/index.cjs.map +1 -1
- package/dist/adapters/sveltekit/index.js +2 -2
- package/dist/adapters/sveltekit/index.js.map +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// src/inline/runtime.generated.ts
|
|
4
|
-
var RUNTIME_SOURCE = '"use strict";(()=>{var Jr=Object.defineProperty;var Dn=t=>{throw TypeError(t)};var Zr=(t,e,n)=>e in t?Jr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var $n=(t,e,n)=>Zr(t,typeof e!="symbol"?e+"":e,n),Ot=(t,e,n)=>e.has(t)||Dn("Cannot "+n);var i=(t,e,n)=>(Ot(t,e,"read from private field"),n?n.call(t):e.get(t)),l=(t,e,n)=>e.has(t)?Dn("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),d=(t,e,n,r)=>(Ot(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),f=(t,e,n)=>(Ot(t,e,"access private method"),n);var F,_,te,Pt,Ft,bt=class{constructor(){l(this,te);l(this,F,new Map);l(this,_,new Map)}on(e,n){return f(this,te,Pt).call(this,i(this,F),e,n)}once(e,n){return f(this,te,Pt).call(this,i(this,_),e,n)}off(e,n){i(this,F).get(e)?.delete(n),i(this,_).get(e)?.delete(n)}async emit(e,n){let r=i(this,F).get(e);if(r)for(let s of[...r])await f(this,te,Ft).call(this,s,n,e);let o=i(this,_).get(e);if(o&&o.size>0){let s=[...o];i(this,_).delete(e);for(let a of s)await f(this,te,Ft).call(this,a,n,e)}}listenerCount(e){return(i(this,F).get(e)?.size??0)+(i(this,_).get(e)?.size??0)}removeAllListeners(e){if(e===void 0){i(this,F).clear(),i(this,_).clear();return}i(this,F).delete(e),i(this,_).delete(e)}eventNames(){let e=new Set;for(let n of i(this,F).keys())e.add(n);for(let n of i(this,_).keys())e.add(n);return[...e]}};F=new WeakMap,_=new WeakMap,te=new WeakSet,Pt=function(e,n,r){let o=e.get(n);return o||(o=new Set,e.set(n,o)),o.add(r),()=>{e.get(n)?.delete(r)}},Ft=async function(e,n,r){try{await e(n)}catch(o){let s=typeof r=="string"||typeof r=="number"?String(r):"<event>";console.error(`[live-preview] handler for "${s}" threw:`,o)}};var le="data-payload-field",Un="data-payload-type",Qr="data-payload-attribute",ei="data-payload-href",ti="data-payload-src",ni="data-payload-alt",ri="data-payload-array-template",ii="data-payload-array-separator",oi="data-payload-locale",si=`[${le}]`,Hn=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"]),k,W,Te,ne,Dt,$t,Rt=class{constructor(e={}){l(this,ne);l(this,k,new Map);l(this,W,new WeakMap);l(this,Te);d(this,Te,e.filter??di)}buildFromRoot(e){let n=performance.now();i(this,k).clear();let r=e.querySelectorAll(si),o=0;for(let s of r){if(!i(this,Te).call(this,s))continue;let a=f(this,ne,$t).call(this,s);a&&(f(this,ne,Dt).call(this,a),i(this,W).set(s,a),o+=1)}return{elementCount:o,fieldCount:i(this,k).size,durationMs:performance.now()-n}}add(e){if(!i(this,Te).call(this,e))return;let n=f(this,ne,$t).call(this,e);if(n)return f(this,ne,Dt).call(this,n),i(this,W).set(e,n),n}remove(e){let n=i(this,W).get(e);if(!n)return!1;i(this,W).delete(e);let r=i(this,k).get(n.fieldName);if(!r)return!1;let o=r.indexOf(n);return o<0?!1:(r.splice(o,1),r.length===0&&i(this,k).delete(n.fieldName),!0)}get(e){return i(this,k).get(e)}getByElement(e){return i(this,W).get(e)}get fieldCount(){return i(this,k).size}get elementCount(){let e=0;for(let n of i(this,k).values())e+=n.length;return e}entries(){return i(this,k).entries()}*values(){for(let e of i(this,k).values())yield*e}has(e){return i(this,W).has(e)}clear(){i(this,k).clear()}};k=new WeakMap,W=new WeakMap,Te=new WeakMap,ne=new WeakSet,Dt=function(e){let n=i(this,k).get(e.fieldName);if(n){n.push(e);return}i(this,k).set(e.fieldName,[e])},$t=function(e){let n=e.getAttribute(le);if(n===null||n.length===0)return;let r=e.getAttribute(Un),o=ai(e),s=e.getAttribute(Qr),a=e.getAttribute(ei),u=e.getAttribute(ti),m=e.getAttribute(ni),w=e.getAttribute(ri),c=e.getAttribute(ii),b=e.getAttribute(oi);return{element:e,fieldName:n,fieldType:o,explicitFieldType:r!==null&&Hn.has(r),...s!==null&&s.length>0?{targetAttribute:s}:{},...a!==null?{hrefField:a}:{},...u!==null?{srcField:u}:{},...m!==null?{altField:m}:{},...w!==null?{arrayTemplate:w}:{},...c!==null?{arraySeparator:c}:{},...b!==null?{locale:b}:{}}};function ai(t){let e=t.getAttribute(Un);if(e!==null&&Hn.has(e))return e;if(t.hasAttribute("data-payload-richtext"))return"richText";if(t.hasAttribute("data-payload-html"))return"html";if(t.hasAttribute("data-payload-structural"))return"structural-array";if(t.hasAttribute("data-payload-array"))return"array";if(t.tagName==="IMG")return"image";if(t.tagName==="A")return"url";if(t.tagName==="TIME")return"date";if(t.tagName==="INPUT"){let n=t.type;if(n==="checkbox")return"checkbox";if(n==="number")return"number";if(n==="date"||n==="datetime-local")return"date"}return"text"}function di(){return!0}var li=100,ui="200px",ue,De,$e,M,ce,re,D,we,jn,Vn,Tt=class{constructor(e,n={}){l(this,we);l(this,ue);l(this,De);l(this,$e);l(this,M,new Set);l(this,ce,null);l(this,re,null);l(this,D,null);d(this,ue,e),d(this,De,n.mutationDebounceMs??li),d(this,$e,n.intersectionRootMargin??ui)}start(e){d(this,ce,new MutationObserver(n=>{f(this,we,jn).call(this,n)})),i(this,ce).observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[le]}),d(this,re,new IntersectionObserver(n=>{f(this,we,Vn).call(this,n)},{rootMargin:i(this,$e),threshold:0}))}observeElement(e){i(this,re)?.observe(e)}unobserveElement(e){i(this,re)?.unobserve(e),i(this,M).delete(e)}markVisible(e,n){n?i(this,M).add(e):i(this,M).delete(e)}isVisible(e){return i(this,M).has(e)}stop(){i(this,D)!==null&&(clearTimeout(i(this,D)),d(this,D,null)),i(this,ce)?.disconnect(),i(this,re)?.disconnect(),d(this,ce,null),d(this,re,null),i(this,M).clear()}};ue=new WeakMap,De=new WeakMap,$e=new WeakMap,M=new WeakMap,ce=new WeakMap,re=new WeakMap,D=new WeakMap,we=new WeakSet,jn=function(e){ci(e)&&(i(this,D)!==null&&clearTimeout(i(this,D)),d(this,D,setTimeout(()=>{d(this,D,null),i(this,ue).onStructuralChange()},i(this,De))))},Vn=function(e){for(let n of e){let r=n.target;n.isIntersecting?i(this,M).has(r)||(i(this,M).add(r),i(this,ue).onVisibilityChange(r,!0)):i(this,M).has(r)&&(i(this,M).delete(r),i(this,ue).onVisibilityChange(r,!1))}};function ci(t){for(let e of t){if(e.type==="attributes"&&e.attributeName===le)return!0;for(let n of e.addedNodes)if(Bn(n))return!0;for(let n of e.removedNodes)if(Bn(n))return!0}return!1}function Bn(t){if(t.nodeType!==Node.ELEMENT_NODE)return!1;let e=t;return e.hasAttribute(le)?!0:e.querySelector(`[${le}]`)!==null}var fi={basic:1,"schema-json":2,"preview-token":3,"nested-arrays":4,"recursive-diffs":4};function Ut(t){let e=typeof t=="number"&&Number.isFinite(t)&&t>=1?Math.floor(t):void 0,r=Math.min(4,e??1),o=new Set;for(let[s,a]of Object.entries(fi))r>=a&&o.add(s);return{ours:4,...e!==void 0?{theirs:e}:{theirs:void 0},negotiated:r,capabilities:o}}var He,v,xe,fe,ve,Gn,Wn,Ue=class{constructor(e,n){l(this,ve);l(this,He);l(this,v);l(this,xe);l(this,fe,!1);d(this,He,e),d(this,v,n),d(this,xe,r=>{f(this,ve,Gn).call(this,r)})}attach(e=window){i(this,fe)||(e.addEventListener("message",i(this,xe)),d(this,fe,!0))}detach(e=window){i(this,fe)&&(e.removeEventListener("message",i(this,xe)),d(this,fe,!1))}static sendReady(e,n){if(e.length===0||n.length===0)return;let r={type:"payload-live-preview",ready:!0,protocolVersion:4};for(let o of e)for(let s of n)try{o.postMessage(r,s)}catch{}}};He=new WeakMap,v=new WeakMap,xe=new WeakMap,fe=new WeakMap,ve=new WeakSet,Gn=function(e){let n=e.origin;if(!i(this,He).call(this,n)){i(this,v).onInvalid?.("origin",n);return}let r=e.data;if(!pi(r)){i(this,v).onInvalid?.("shape",n);return}switch(r.type){case"payload-live-preview":f(this,ve,Wn).call(this,r,n);return;case"payload-document-event":i(this,v).onDocumentEvent(r,n);return;default:i(this,v).onInvalid?.("type",n)}},Wn=function(e,n){let r=i(this,v).validateToken;if(r===void 0){i(this,v).onUpdate(e,n);return}if(e.ready===!0&&e.data===void 0){i(this,v).onUpdate(e,n);return}let o;try{o=r(e.previewToken,n)}catch{i(this,v).onInvalid?.("token",n);return}if(typeof o=="boolean"){o?i(this,v).onUpdate(e,n):i(this,v).onInvalid?.("token",n);return}o.then(s=>{s?i(this,v).onUpdate(e,n):i(this,v).onInvalid?.("token",n)},()=>{i(this,v).onInvalid?.("token",n)})};function pi(t){return typeof t!="object"||t===null||!("type"in t)?!1:typeof t.type=="string"}var Ee,Be,C,je,xt=class{constructor(e){l(this,Ee);l(this,Be);l(this,C,null);l(this,je,0);d(this,Ee,e.timeoutMs??0),d(this,Be,e.onTimeout)}kick(){d(this,je,Date.now()),!(i(this,Ee)<=0)&&(i(this,C)!==null&&clearTimeout(i(this,C)),d(this,C,setTimeout(()=>{d(this,C,null),i(this,Be).call(this)},i(this,Ee))))}stop(){i(this,C)!==null&&(clearTimeout(i(this,C)),d(this,C,null))}get lastKickAt(){return i(this,je)}get pending(){return i(this,C)!==null}};Ee=new WeakMap,Be=new WeakMap,C=new WeakMap,je=new WeakMap;var pe,Ve,ke,wt,vt=class{constructor(e){l(this,ke);l(this,pe,"disconnected");l(this,Ve);d(this,Ve,e)}get status(){return i(this,pe)}markConnected(){return f(this,ke,wt).call(this,"connected")}markConnecting(){return f(this,ke,wt).call(this,"connecting")}markDisconnected(){return f(this,ke,wt).call(this,"disconnected")}};pe=new WeakMap,Ve=new WeakMap,ke=new WeakSet,wt=function(e){if(i(this,pe)===e)return!1;let n=i(this,pe);return d(this,pe,e),i(this,Ve).call(this,e,n),!0};var mi=()=>{},ze,Ge,We,Ye,me,Y,Et=class{constructor(e){l(this,ze);l(this,Ge);l(this,We);l(this,Ye);l(this,me);l(this,Y,null);d(this,ze,e.serverURL.replace(/\\/+$/,""));let n=e.apiRoute??"/api";d(this,Ge,n.startsWith("/")?n:`/${n}`),d(this,We,e.depth??1),d(this,Ye,e.fetchFn),d(this,me,e.log??mi)}canMerge(e){if(e.globalSlug!==void 0&&e.globalSlug!=="")return!0;if(e.collectionSlug===void 0||e.collectionSlug==="")return!1;let n=e.data.id;return typeof n=="string"||typeof n=="number"}async merge(e){if(!this.canMerge(e))return{status:"unavailable"};let n=i(this,Ye)??(typeof fetch=="function"?fetch:void 0);if(n===void 0)return{status:"unavailable"};i(this,Y)?.abort();let r=new AbortController;d(this,Y,r);let o=e.globalSlug!==void 0&&e.globalSlug!==""?`globals/${e.globalSlug}`:`${e.collectionSlug}/${String(e.data.id)}`,s=`${i(this,ze)}${i(this,Ge)}/${encodeURI(o)}`;try{let a=await n(s,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","X-Payload-HTTP-Method-Override":"GET"},body:JSON.stringify({data:e.data,depth:i(this,We),flattenLocales:!1,...e.locale!==void 0?{locale:e.locale}:{}}),signal:r.signal});if(!a.ok)return i(this,me).call(this,"merge fetch failed",a.status,s),{status:"unavailable"};let u=await a.json();return u===null||typeof u!="object"||Array.isArray(u)?(i(this,me).call(this,"merge fetch returned non-object",s),{status:"unavailable"}):{status:"merged",doc:u}}catch(a){return r.signal.aborted?{status:"superseded"}:(i(this,me).call(this,"merge fetch error",a),{status:"unavailable"})}finally{i(this,Y)===r&&d(this,Y,null)}}destroy(){i(this,Y)?.abort(),d(this,Y,null)}};ze=new WeakMap,Ge=new WeakMap,We=new WeakMap,Ye=new WeakMap,me=new WeakMap,Y=new WeakMap;var hi=new Set(["http:","https:","mailto:","tel:"]),yi=/^\\s*(?:javascript|data|vbscript|file|blob|about)\\s*:/i,gi=/^(?:\\.{1,2}\\/|[a-zA-Z0-9_-]+\\/?)/;function R(t){if(typeof t!="string"||t.length===0)return!1;let e=t.trim();if(e.length===0||yi.test(e))return!1;if(e.startsWith("#")||e.startsWith("?")||e.startsWith("//")||e.startsWith("/"))return!0;try{let n=new URL(e);return hi.has(n.protocol)}catch{return gi.test(e)}}function kt(t){if(!R(t))return!1;let e=t.trim();return/^https?:\\/\\//i.test(e)||/^\\/\\/[^/]/.test(e)}var bi=new Set(["style","srcdoc","formaction","form","id","name","is","srcset","imagesrcset"]),Ri=new Set(["href","src","poster","cite","action","xlink:href","data"]);function Yn(t,e,n){let r=e.toLowerCase().trim();if(r.length===0||r.startsWith("on")||bi.has(r))return"blocked";if(n==null)return t.removeAttribute(r),"applied";if(typeof n!="string"&&typeof n!="number"&&typeof n!="boolean")return"blocked";let o=String(n);return Ri.has(r)&&!R(o)?"blocked":(t.setAttribute(r,o),"applied")}var Se,qe,Ke,Xe,Je,Ze,Qe,et,Ae,$,q,S,U,K,qn,Kn,Ht,St=class{constructor(e,n){l(this,K);l(this,Se);l(this,qe);l(this,Ke);l(this,Xe);l(this,Je);l(this,Ze);l(this,Qe);l(this,et);l(this,Ae);l(this,$,new Map);l(this,q,new Map);l(this,S,null);l(this,U,null);d(this,Se,e),d(this,qe,n.debounceMs??50),d(this,Ke,n.isVisible),d(this,Xe,n.visibilityGateThreshold??50),d(this,Je,n.disableVisibilityGate??!1),d(this,Ze,n.getCacheSize),d(this,Qe,n.onFlush),d(this,et,n.scheduleFrame??(typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(globalThis):r=>setTimeout(()=>{r(performance.now())},0))),d(this,Ae,n.cancelFrame??(typeof cancelAnimationFrame=="function"?cancelAnimationFrame.bind(globalThis):r=>{clearTimeout(r)}))}schedule(e){let n=i(this,$).get(e.target.element);n?(n.value=e.value,n.allFields=e.allFields):i(this,$).set(e.target.element,{target:e.target,value:e.value,allFields:e.allFields}),f(this,K,qn).call(this)}flushNow(){return i(this,S)!==null&&(clearTimeout(i(this,S)),d(this,S,null)),f(this,K,Ht).call(this)}notifyVisible(e){let n=i(this,q).get(e);n&&(i(this,q).delete(e),i(this,Se).call(this,n))}forget(e){i(this,$).delete(e),i(this,q).delete(e)}destroy(){i(this,S)!==null&&(clearTimeout(i(this,S)),d(this,S,null)),i(this,U)!==null&&(i(this,Ae).call(this,i(this,U)),d(this,U,null)),i(this,$).clear(),i(this,q).clear()}get pendingCount(){return i(this,$).size}get replayCount(){return i(this,q).size}};Se=new WeakMap,qe=new WeakMap,Ke=new WeakMap,Xe=new WeakMap,Je=new WeakMap,Ze=new WeakMap,Qe=new WeakMap,et=new WeakMap,Ae=new WeakMap,$=new WeakMap,q=new WeakMap,S=new WeakMap,U=new WeakMap,K=new WeakSet,qn=function(){i(this,S)!==null&&clearTimeout(i(this,S)),d(this,S,setTimeout(()=>{d(this,S,null),f(this,K,Kn).call(this)},i(this,qe)))},Kn=function(){i(this,U)!==null&&i(this,Ae).call(this,i(this,U)),d(this,U,i(this,et).call(this,()=>{d(this,U,null),f(this,K,Ht).call(this)}))},Ht=function(){var u;let e=performance.now(),n=!i(this,Je)&&i(this,Ze).call(this)>i(this,Xe),r=i(this,$);d(this,$,new Map);let o=0,s=0;for(let m of r.values()){if(n&&!i(this,Ke).call(this,m.target.element)){i(this,q).set(m.target.element,m),s+=1;continue}i(this,Se).call(this,m),o+=1}let a={applied:o,deferred:s,durationMs:performance.now()-e};return(u=i(this,Qe))==null||u.call(this,a),a};function Le(){let t=Ti();if(t!==void 0)return t;let e=wi();return e!==void 0?e:"en"}function Ti(){if(typeof document>"u")return;let t=document.documentElement.getAttribute("lang");return t===null||t.length===0?void 0:t}function wi(){if(typeof navigator>"u")return;let t=navigator.language;return typeof t=="string"&&t.length>0?t:void 0}var Xn="payload-live-preview-a11y",xi=1500,vi=["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"].join(";"),Jn={connected:"Live preview connected",disconnected:"Live preview disconnected",updated:t=>`${String(t)} ${t===1?"change":"changes"} applied`},Ei={en:Jn,de:{connected:"Vorschau verbunden",disconnected:"Vorschau getrennt",updated:t=>`${String(t)} ${t===1?"\\xC4nderung":"\\xC4nderungen"} angewendet`}};function ki(t){let e=t.split(/[-_]/)[0]?.toLowerCase()??"en";return Ei[e]??Jn}var I,he,H,ie,Zn,At,tt=class{constructor(e=Le()){l(this,ie);l(this,I,null);l(this,he);l(this,H,null);d(this,he,ki(e))}announceConnected(){f(this,ie,At).call(this,i(this,he).connected)}announceDisconnected(){f(this,ie,At).call(this,i(this,he).disconnected)}announceUpdate(e){e<=0||f(this,ie,At).call(this,i(this,he).updated(e))}detach(){i(this,H)!==null&&(clearTimeout(i(this,H)),d(this,H,null)),i(this,I)?.parentNode&&i(this,I).parentNode.removeChild(i(this,I))}};I=new WeakMap,he=new WeakMap,H=new WeakMap,ie=new WeakSet,Zn=function(){if(i(this,I)!==null&&i(this,I).isConnected)return i(this,I);if(typeof document>"u"||document.body===null)return null;let e=document.getElementById(Xn);return e||(e=document.createElement("div"),e.id=Xn,e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.setAttribute("style",vi),document.body.appendChild(e)),d(this,I,e),e},At=function(e){let n=f(this,ie,Zn).call(this);n&&(n.textContent=e,i(this,H)!==null&&clearTimeout(i(this,H)),d(this,H,setTimeout(()=>{d(this,H,null),i(this,I)&&(i(this,I).textContent="")},xi)))};var Si=new Set(["tabs","row","collapsible"]);function Bt(t,e=""){let n=new Map;return nt(t,e,n),n}function nt(t,e,n){for(let r of t){if(Si.has(r.type)){r.fields&&nt(r.fields,e,n);continue}if(r.type==="group"){let s=e===""?r.name:`${e}.${r.name}`;n.set(s,r),r.fields&&nt(r.fields,s,n);continue}let o=e===""?r.name:`${e}.${r.name}`;if(n.set(o,r),r.type==="array"&&r.fields)nt(r.fields,`${o}.*`,n);else if(r.type==="blocks"&&r.blocks)for(let s of r.blocks)nt(s.fields,`${o}.*.${s.slug}`,n)}}function jt(t,e){if(t.has(e))return t.get(e);let n=e.replace(/\\.\\d+(?=\\.|$)/g,".*");if(t.has(n))return t.get(n)}function Vt(t){if(typeof t!="object"||t===null)return;let e=t.id;if(typeof e=="string"||typeof e=="number")return e}function Qn(t){if(typeof t!="object"||t===null)return;let e=t.blockType;return typeof e=="string"?e:void 0}function rt(t,e){return e.every(r=>Vt(r)!==void 0)?Ai(t,e):Li(t,e)}function Ai(t,e){let n=[],r=new Map;for(let s=0;s<t.length;s+=1){let a=Vt(t[s]);a!==void 0&&r.set(a,s)}let o=new Set;for(let s=0;s<e.length;s+=1){let a=e[s],u=Vt(a);if(u===void 0){n.push({kind:"insert",index:s,value:a});continue}let m=r.get(u);if(m===void 0){n.push({kind:"insert",index:s,value:a});continue}o.add(m);let w=t[m];if(Qn(w)!==Qn(a)){n.push({kind:"replace",index:s,oldValue:w,value:a});continue}m!==s&&n.push({kind:"move",from:m,to:s,value:a}),er(w,a)||n.push({kind:"update",index:s,value:a})}for(let s=0;s<t.length;s+=1)o.has(s)||n.push({kind:"remove",index:s,value:t[s]});return n}function Li(t,e){let n=[],r=Math.min(t.length,e.length);for(let o=0;o<r;o+=1)er(t[o],e[o])||n.push({kind:"update",index:o,value:e[o]});if(e.length>t.length)for(let o=t.length;o<e.length;o+=1)n.push({kind:"insert",index:o,value:e[o]});if(t.length>e.length)for(let o=e.length;o<t.length;o+=1)n.push({kind:"remove",index:o,value:t[o]});return n}function er(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||typeof e!="object"||t===null||e===null)return!1;let n=t,r=e,o=Object.keys(n),s=Object.keys(r);if(o.length!==s.length)return!1;for(let a of o)if(!Object.is(n[a],r[a]))return!1;return!0}var tr={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"};function zt(t){if(Object.prototype.hasOwnProperty.call(tr,t))return tr[t]}var Mi=[0,500,1e3,2e3],E,A,X,oe,Me,J,Ie,it,B,ye,ge,ot,O,Ne,_e,Z,be,N,Ce,Oe,Pe,Re,se,st,at,h,Gt,Wt,Yt,rr,ir,or,sr,ar,dr,lr,ur,cr,fr,pr,Lt=class{constructor(e){l(this,h);l(this,E);l(this,A);l(this,X);l(this,oe);l(this,Me);l(this,J);l(this,Ie);l(this,it);l(this,B);l(this,ye);l(this,ge);l(this,ot);l(this,O);l(this,Ne);l(this,_e,[]);l(this,Z);l(this,be);l(this,N);l(this,Ce);l(this,Oe);l(this,Pe,Ut(void 0));l(this,Re,!1);l(this,se,null);l(this,st,0);l(this,at,new Set);d(this,E,e.emitter),d(this,it,e.renderers),d(this,B,e.root??(typeof document<"u"?document:null)),d(this,ye,e.readyTargets),d(this,ge,e.sendReady??Oi),d(this,ot,e.onHeartbeatTimeout),d(this,O,e.log??Ni),d(this,Ne,e.warn??Ci),d(this,Z,Ii(e)),d(this,be,e.dataMerge!==void 0?new Et({serverURL:e.dataMerge.serverURL,...e.dataMerge.apiRoute!==void 0?{apiRoute:e.dataMerge.apiRoute}:{},...e.dataMerge.depth!==void 0?{depth:e.dataMerge.depth}:{},...e.dataMerge.fetchFn!==void 0?{fetchFn:e.dataMerge.fetchFn}:{},log:(...n)=>{i(this,O).call(this,...n)}}):null),d(this,A,new Rt),d(this,X,new Tt({onStructuralChange:()=>{f(this,h,Yt).call(this)},onVisibilityChange:(n,r)=>{r&&i(this,oe).notifyVisible(n)}},{...e.intersectionRootMargin!==void 0?{intersectionRootMargin:e.intersectionRootMargin}:{}})),d(this,oe,new St(n=>{f(this,h,ur).call(this,n)},{...e.debounceMs!==void 0?{debounceMs:e.debounceMs}:{},...e.disableVisibilityGate!==void 0?{disableVisibilityGate:e.disableVisibilityGate}:{},...e.visibilityGateThreshold!==void 0?{visibilityGateThreshold:e.visibilityGateThreshold}:{},isVisible:n=>i(this,X).isVisible(n),getCacheSize:()=>i(this,A).elementCount,onFlush:n=>{f(this,h,fr).call(this,n)}})),d(this,Me,new Ue(e.originMatcher,{onUpdate:(n,r)=>{f(this,h,or).call(this,n,r)},onDocumentEvent:(n,r)=>{f(this,h,ar).call(this,n,r)},onInvalid:(n,r)=>{if(n==="token"){let o=new Error(`Preview token rejected (origin: ${r})`);i(this,E).emit("error",{error:o,context:"token"})}i(this,O).call(this,"message rejected:",n,r)},...e.validateToken!==void 0?{validateToken:e.validateToken}:{}})),d(this,J,new vt((n,r)=>{i(this,O).call(this,"connection",r,"\\u2192",n)})),d(this,Ie,new xt({...e.heartbeatMs!==void 0?{timeoutMs:e.heartbeatMs}:{},onTimeout:()=>{f(this,h,pr).call(this)}}))}start(){if(i(this,Re))return!1;d(this,Re,!0);let e=i(this,B);if(e instanceof Document&&e.readyState==="loading"){let n=()=>{d(this,se,null),f(this,h,Gt).call(this)};return d(this,se,n),e.addEventListener("DOMContentLoaded",n,{once:!0}),!0}return f(this,h,Gt).call(this),!0}destroy(){if(!i(this,Re))return;if(d(this,Re,!1),i(this,se)!==null){let n=i(this,B);n instanceof Document&&n.removeEventListener("DOMContentLoaded",i(this,se)),d(this,se,null),i(this,E).emit("destroy",{timestamp:Date.now()});return}for(let n of i(this,_e))clearTimeout(n);i(this,_e).length=0,i(this,Ie).stop(),i(this,Me).detach(),i(this,X).stop(),i(this,oe).destroy(),i(this,be)?.destroy(),i(this,A).clear();let e=i(this,J).status==="connected";i(this,J).markDisconnected(),e&&(i(this,Z)?.announceDisconnected(),i(this,E).emit("disconnect",{reason:"destroy",timestamp:Date.now()})),i(this,Z)?.detach(),i(this,E).emit("destroy",{timestamp:Date.now()})}refreshCache(){f(this,h,Yt).call(this)}get status(){return i(this,J).status}get cache(){return i(this,A)}get updateCount(){return i(this,st)}get protocol(){return i(this,Pe)}};E=new WeakMap,A=new WeakMap,X=new WeakMap,oe=new WeakMap,Me=new WeakMap,J=new WeakMap,Ie=new WeakMap,it=new WeakMap,B=new WeakMap,ye=new WeakMap,ge=new WeakMap,ot=new WeakMap,O=new WeakMap,Ne=new WeakMap,_e=new WeakMap,Z=new WeakMap,be=new WeakMap,N=new WeakMap,Ce=new WeakMap,Oe=new WeakMap,Pe=new WeakMap,Re=new WeakMap,se=new WeakMap,st=new WeakMap,at=new WeakMap,h=new WeakSet,Gt=function(){f(this,h,Wt).call(this),i(this,X).start(i(this,B)instanceof Document?i(this,B).body:i(this,B)),i(this,Me).attach(),f(this,h,rr).call(this);for(let e of Mi)if(e===0)i(this,ge).call(this,i(this,ye));else{let n=setTimeout(()=>{i(this,ge).call(this,i(this,ye))},e);i(this,_e).push(n)}},Wt=function(){let e=i(this,A).buildFromRoot(i(this,B));i(this,O).call(this,"cache built",e),i(this,E).emit("cacheRefresh",e);for(let n of i(this,A).values())i(this,X).observeElement(n.element)},Yt=function(){for(let e of i(this,A).values())i(this,X).unobserveElement(e.element),i(this,oe).forget(e.element);f(this,h,Wt).call(this)},rr=function(){i(this,E).emit("init",{timestamp:Date.now()})},ir=function(e){let n=Ut(e);n.negotiated!==i(this,Pe).negotiated&&(d(this,Pe,n),i(this,O).call(this,"protocol negotiated",`ours=${4}`,`theirs=${e}`,`negotiated=${n.negotiated}`))},or=function(e,n){i(this,Ie).kick(),e.protocolVersion!==void 0&&f(this,h,ir).call(this,e.protocolVersion),e.data!==void 0&&(i(this,J).markConnected()&&(i(this,Z)?.announceConnected(),i(this,E).emit("connect",{origin:n,timestamp:Date.now()})),d(this,st,i(this,st)+1),e.locale!==void 0&&d(this,N,e.locale),e.fieldSchemaJSON!==void 0&&(d(this,Ce,e.fieldSchemaJSON),d(this,Oe,Bt(e.fieldSchemaJSON))),f(this,h,sr).call(this,e).then(r=>{if(r===null)return;let o={fields:r,...i(this,Ce)!==void 0?{schema:i(this,Ce)}:{},...e.globalSlug!==void 0?{globalSlug:e.globalSlug}:{},...e.collectionSlug!==void 0?{collectionSlug:e.collectionSlug}:{},...i(this,N)!==void 0?{locale:i(this,N)}:{}},s=!1;i(this,E).emit("beforeUpdate",{data:o,cancel:()=>{s=!0}}).then(()=>{s||f(this,h,dr).call(this,o)})}))},sr=async function(e){let n=e.data??{};if(i(this,be)===null)return n;let r=await i(this,be).merge({collectionSlug:e.collectionSlug,globalSlug:e.globalSlug,data:n,locale:i(this,N)});return r.status==="merged"?r.doc:r.status==="superseded"?null:n},ar=function(e,n){i(this,E).emit("documentSave",{timestamp:Date.now()})},dr=function(e){for(let[n,r]of i(this,A).entries()){let o=$i(e.fields,n,i(this,N));if(o!==void 0)for(let s of r){let a={target:s,value:o,allFields:e.fields};i(this,oe).schedule(a)}}f(this,h,lr).call(this,e.fields)},lr=function(e){if(i(this,A).elementCount===0)return;let n=new Set;for(let[r]of i(this,A).entries())n.add(r);for(let[r,o]of Object.entries(e)){if(i(this,at).has(r)||Pi.has(r)||!Fi(o))continue;let s=Di(r,i(this,N));n.has(r)||n.has(s)||(i(this,at).add(r),i(this,Ne).call(this,`[live-preview] update arrived for field "${r}" but no <\\u2026 data-payload-field="${s}"> element exists on this page. Render the binding anchor unconditionally in your template so live edits to an initially-empty field have somewhere to land.`))}},ur=function(e){let n=i(this,Oe)!==void 0?jt(i(this,Oe),e.target.fieldName):void 0,r=f(this,h,cr).call(this,e.target,n?.type);r==="text"&&e.target.explicitFieldType!==!0&&_i(e.value)&&(r="richText");let o=i(this,it)[r],s=Ui(e.target.element),a={allFields:e.allFields,locale:i(this,N),schema:n};try{e.target.targetAttribute!==void 0?Yn(e.target.element,e.target.targetAttribute,e.value)==="blocked"&&i(this,Ne).call(this,`[live-preview] refused to write field "${e.target.fieldName}" into attribute "${e.target.targetAttribute}" (unsafe attribute or value)`):o?o.render(e.target,e.value,a):i(this,O).call(this,"no renderer for",r)}catch(u){let m=u instanceof Error?u:new Error(String(u));i(this,E).emit("error",{error:m,context:"renderer"});return}i(this,E).emit("elementUpdate",{element:e.target.element,fieldName:e.target.fieldName,previousValue:s,nextValue:e.value})},cr=function(e,n){if(e.explicitFieldType)return e.fieldType;if(n!==void 0){let r=zt(n);if(r!==void 0)return r}return e.fieldType},fr=function(e){e.applied===0&&e.deferred===0||(e.applied>0&&i(this,Z)?.announceUpdate(e.applied),i(this,E).emit("afterUpdate",{data:{fields:{},...i(this,N)!==void 0?{locale:i(this,N)}:{}},updatedCount:e.applied,durationMs:e.durationMs}))},pr=function(){var e;i(this,J).markDisconnected()&&(i(this,Z)?.announceDisconnected(),i(this,E).emit("disconnect",{reason:"timeout",timestamp:Date.now()}));try{(e=i(this,ot))==null||e.call(this)}catch(n){i(this,O).call(this,"onHeartbeatTimeout hook threw:",n)}i(this,ge).call(this,i(this,ye))};function Ii(t){return t.enableA11y===!1?null:t.a11yLocale!==void 0?new tt(t.a11yLocale):new tt}function Ni(){}function _i(t){if(typeof t!="object"||t===null||!("root"in t))return!1;let e=t.root;return typeof e!="object"||e===null?!1:Array.isArray(e.children)}function Ci(...t){typeof console<"u"&&typeof console.warn=="function"&&console.warn(...t)}function Oi(t){if(typeof window>"u")return;let e=[];window.parent!==window&&e.push(window.parent),window.opener instanceof Window&&e.push(window.opener),Ue.sendReady(e,t)}var mr=new Set(["__proto__","prototype","constructor"]),Pi=new Set(["id","_id","createdAt","updatedAt","createdBy","updatedBy","_status","globalType","collection","locale","localized"]);function Fi(t){return t==null?!1:typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"}function Di(t,e){if(!e)return t;let n=`_${e}`;return t.endsWith(n)?t.slice(0,-n.length):t}function $i(t,e,n){let r=nr(t,e);if(r!==void 0)return r;if(e.includes(".")){let o=e.split("."),s=t;for(let a of o){if(mr.has(a)||s===null||typeof s!="object")return;s=s[a]}if(s!==void 0)return s}if(n!==void 0){let o=nr(t,`${e}_${n}`);if(o!==void 0)return o}}function nr(t,e){if(!mr.has(e)&&Object.prototype.hasOwnProperty.call(t,e))return t[e]}function Ui(t){return t.tagName==="INPUT"||t.tagName==="TEXTAREA"?t.value:t.tagName==="IMG"?t.src:t.textContent}function dt(){if(typeof window>"u")return!1;try{return window.self!==window.top}catch{return!0}}function qt(){return typeof window>"u"?!1:window.opener!=null}function Kt(){return dt()||qt()}function hr(){let t=Hi();if(t!==void 0)return t!=="production";let e=Bi();if(e!==void 0)return e;if(typeof window<"u"){let n=window.location.hostname;if(n==="localhost"||n==="127.0.0.1")return!0}return!1}function yr(t){if(typeof process<"u"){let n=process.env[t];if(typeof n=="string"&&n.length>0)return n}let e=void 0;if(e){let n=e[t];if(typeof n=="string"&&n.length>0)return n}}function Hi(){if(typeof process>"u")return;let t="production";return typeof t=="string"?t:void 0}function Bi(){let t=void 0;if(!t)return;let e=t.DEV;return typeof e=="boolean"?e:void 0}var ji=/^https?:\\/\\/(localhost|127\\.0\\.0\\.1)(?::\\d+)?$/i,Vi=/^https?:\\/\\/[^/?#\\s]+$/i,zi=["PAYLOAD_ADMIN_ORIGIN","PUBLIC_PAYLOAD_ADMIN_ORIGIN","NEXT_PUBLIC_PAYLOAD_ADMIN_ORIGIN"],j,V,ae,lt,P,Mt=class{constructor(e={}){l(this,j);l(this,V);l(this,ae);l(this,lt);l(this,P);let n=new Set;for(let a of e.additionalOrigins??[]){let u=gr(a);u!==void 0&&n.add(u)}for(let a of zi){let u=yr(a);if(u!==void 0)for(let m of u.split(",")){let w=gr(m);w!==void 0&&n.add(w)}}d(this,j,n);let r=e.enableReferrerDetection??!0,o;if(r){let a=e.referrer??(typeof document<"u"?document.referrer:"");if(a.length>0)try{let u=new URL(a).origin;u&&u!=="null"&&(o=u)}catch{}}d(this,V,o),d(this,lt,o!==void 0);let s=(e.enableLocalhostMatching??!0)&&(e.forceDevMode??hr());d(this,ae,s)}matches(e){return e.length===0||e==="null"?!1:i(this,P)!==void 0?e===i(this,P):!!(i(this,j).has(e)||i(this,j).size===0&&i(this,V)!==void 0&&e===i(this,V)||i(this,ae)&&ji.test(e))}lockOrigin(e){return this.matches(e)?(d(this,P,e),!0):!1}unlockOrigin(){let e=i(this,P);return d(this,P,void 0),e}get lockedOrigin(){return i(this,P)}enumerate(){if(i(this,P)!==void 0)return[i(this,P)];let e=new Set(i(this,j));if(i(this,j).size===0&&i(this,V)!==void 0&&e.add(i(this,V)),i(this,ae))for(let n of Gi)e.add(`http://localhost:${String(n)}`),e.add(`http://127.0.0.1:${String(n)}`);return[...e]}get referrerWasAvailable(){return i(this,lt)}get isProductionUnconfigured(){return!(!dt()||i(this,j).size>0||i(this,ae)||i(this,V)!==void 0)}get isReferrerOnlyTrust(){return i(this,j).size>0||i(this,ae)?!1:i(this,V)!==void 0}};j=new WeakMap,V=new WeakMap,ae=new WeakMap,lt=new WeakMap,P=new WeakMap;var Gi=[3e3,3001,3333,4e3,4321,5e3,5173,5174,8e3,8080,8888,9e3];function gr(t){let e=t.trim();if(e.length!==0)try{let n=new URL(e);return n.protocol!=="http:"&&n.protocol!=="https:"||!Vi.test(n.origin)?void 0:n.origin}catch{return}}var br={name:"payload-live-preview",version:"1.0.0",description:"Framework-agnostic live preview for Payload CMS \\u2014 Astro-first; works with Next.js, SvelteKit, Nuxt, and plain HTML.",author:"relative23",license:"MIT",type:"module",main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{import:{types:"./dist/index.d.ts",default:"./dist/index.js"},require:{types:"./dist/index.d.cts",default:"./dist/index.cjs"}},"./core":{import:{types:"./dist/core.d.ts",default:"./dist/core.js"},require:{types:"./dist/core.d.cts",default:"./dist/core.cjs"}},"./astro":{import:{types:"./dist/adapters/astro/index.d.ts",default:"./dist/adapters/astro/index.js"}},"./nextjs":{import:{types:"./dist/adapters/nextjs/index.d.ts",default:"./dist/adapters/nextjs/index.js"}},"./sveltekit":{import:{types:"./dist/adapters/sveltekit/index.d.ts",default:"./dist/adapters/sveltekit/index.js"}},"./nuxt":{import:{types:"./dist/adapters/nuxt/index.d.ts",default:"./dist/adapters/nuxt/index.js"}},"./codegen":{import:{types:"./dist/codegen.d.ts",default:"./dist/codegen.js"},require:{types:"./dist/codegen.d.cts",default:"./dist/codegen.cjs"}},"./codegen/astro":{import:{types:"./dist/codegen-astro.d.ts",default:"./dist/codegen-astro.js"}},"./payload":{import:{types:"./dist/payload.d.ts",default:"./dist/payload.js"},require:{types:"./dist/payload.d.cts",default:"./dist/payload.cjs"}},"./astro/RichText.astro":"./dist/adapters/astro/RichText.astro","./astro/middleware-entry":{import:{types:"./dist/adapters/astro/middleware-entry.d.ts",default:"./dist/adapters/astro/middleware-entry.js"}}},bin:{"pll-codegen":"./dist/codegen-cli.js"},files:["dist","README.md","LICENSE"],sideEffects:!1,scripts:{prepare:"npm run build:runtime","build:runtime":"tsx scripts/build-runtime.ts",build:"npm run build:runtime && tsup && npm run build:assets","build:assets":`node -e "require(\'node:fs\').copyFileSync(\'src/adapters/astro/RichText.astro\',\'dist/adapters/astro/RichText.astro\')"`,dev:"tsup --watch",test:"vitest run","test:watch":"vitest","test:unit":"vitest run tests/unit","test:integration":"vitest run tests/integration","test:e2e":"playwright test","test:bench":"vitest bench tests/benchmarks","test:coverage":"vitest run --coverage",typecheck:"tsc --noEmit",lint:"eslint .","lint:fix":"eslint . --fix",format:\'prettier --write "src/**/*.ts" "tests/**/*.ts"\',"format:check":\'prettier --check "src/**/*.ts" "tests/**/*.ts"\',check:"npm run typecheck && npm run lint && npm run test",prepublishOnly:"npm run check && npm run build",changeset:"changeset",version:"changeset version",release:"npm run build && changeset publish"},devDependencies:{"@changesets/cli":"^2.31.0","@eslint/js":"^10.0.1","@playwright/test":"^1.61.1","@types/node":"^22.20.1","@vitest/coverage-v8":"^4.1.10",esbuild:"^0.28.1",eslint:"^10.7.0",globals:"^17.7.0",jsdom:"^29.1.1",prettier:"^3.9.5","ts-morph":"^28.0.0",tsup:"^8.5.1",tsx:"^4.23.0",typescript:"^5.9.3","typescript-eslint":"^8.63.0",vitest:"^4.1.10"},keywords:["payload","payload-cms","payload-live-preview","live-preview","cms","headless","astro","nextjs","sveltekit","nuxt","vue","svelte","schema-driven","lexical","csp-safe","framework-agnostic"],peerDependencies:{astro:">=4.0.0 <8.0.0","ts-morph":"^28.0.0"},peerDependenciesMeta:{astro:{optional:!0},"ts-morph":{optional:!0}},engines:{node:">=20.19.0"},publishConfig:{access:"public",provenance:!0},repository:{type:"git",url:"https://github.com/relative23/payload-live-preview.git"},bugs:{url:"https://github.com/relative23/payload-live-preview/issues"},homepage:"https://github.com/relative23/payload-live-preview#readme"};var Rr=br.version;var Xt=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"]),wr=new Set(["script","style","iframe","object","embed","link","meta","base","form","input","button","select","textarea","svg","math","template","frame","frameset","noframes","noscript"]),xr=new Set(["id","class","lang","dir","title","role","tabindex"]),Yi="aria-",qi="data-",Jt={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"])},vr=new Set(["href","src","cite","poster"]),Zt=class extends Error{constructor(){super(...arguments);$n(this,"name","SanitizerEnvironmentError")}};function Ki(t){if(!t){let r=new Map;for(let[o,s]of Object.entries(Jt))r.set(o,s);return{allowedTags:Xt,attrByTag:r}}let e=new Set(Xt);for(let r of t.additionalAllowedTags??[])e.add(r);let n=new Map;for(let[r,o]of Object.entries(Jt))n.set(r,o);for(let[r,o]of Object.entries(t.additionalAllowedAttributes??{})){let s=n.get(r),a=new Set(s??[]);for(let u of o)a.add(u);n.set(r,a)}return{allowedTags:e,attrByTag:n}}var Tr;function z(t,e){let n=Er();if(!n)throw new Zt("sanitizeHtml requires a DOM. Inject one via setSanitizerDocument() for SSR (linkedom, jsdom, happy-dom, \\u2026) or use the plain-text path on the server.");if(t==="")return"";let r=Ki(e),o=n.createElement("template");return o.innerHTML=t,Qt(o.content,r),o.innerHTML}function Er(){if(Tr)return Tr;if(!(typeof document>"u"))return document}function kr(){return Er()!==void 0}function Qt(t,e){for(let n of Array.from(t.childNodes))n.nodeType===Node.ELEMENT_NODE?Xi(n,e):n.nodeType===Node.COMMENT_NODE&&n.remove()}function Xi(t,e){let n=t.tagName.toLowerCase();if(wr.has(n)){t.remove();return}if(!e.allowedTags.has(n)){Qt(t,e);let r=t.parentNode;if(r){for(;t.firstChild;)r.insertBefore(t.firstChild,t);t.remove()}return}Ji(t,n,e),n==="a"&&Qi(t),Qt(t,e)}function Ji(t,e,n){let r=n.attrByTag.get(e);for(let o of Array.from(t.attributes)){let s=o.name.toLowerCase();if(s.startsWith("on")){t.removeAttribute(o.name);continue}if(s==="style"){t.removeAttribute(o.name);continue}if(!(xr.has(s)||s.startsWith(Yi)||s.startsWith(qi))){if(r?.has(s)){(vr.has(s)&&!R(o.value)||s==="srcset"&&!Zi(o.value))&&t.removeAttribute(o.name);continue}t.removeAttribute(o.name)}}}function Zi(t){let e=t.split(",");for(let n of e){let r=n.trim();if(r.length===0)continue;let o=r.split(/\\s+/,1)[0];if(o===void 0||o.length===0||!R(o))return!1}return!0}function Qi(t){let e=t.getAttribute("href");e&&kt(e)&&(t.setAttribute("rel","noopener noreferrer"),t.hasAttribute("target")||t.setAttribute("target","_blank"))}var Ws=Object.freeze({allowedTags:Xt,removeCompletely:wr,globalAttributes:xr,attributesByTag:Jt,urlAttributes:vr});var Sr=new Map;function p(t,e){Sr.set(t,e)}function Ar(t){return Sr.get(t)}var eo={1:"left",2:"center",3:"right",4:"justify"},to=new Set(["left","center","right","justify","start","end"]);function en(t){let e=t.format;if(typeof e=="string"&&to.has(e))return e;if(typeof e=="number"){let n=eo[e];if(n!==void 0)return n}}function tn(t){let e=t.indent;return typeof e=="number"&&e>0?e:0}function Q(t){return t.direction==="rtl"?\' dir="rtl"\':t.direction==="ltr"?\' dir="ltr"\':""}function G(t){let e=en(t),n=tn(t),r=[];return e!==void 0&&r.push(`text-align:${e}`),n>0&&r.push(`padding-inline-start:${String(n*40)}px`),r.length===0?"":` style="${r.join(";")}"`}var no=Object.freeze({"&":"&","<":"<",">":">",\'"\':""","\'":"'","/":"/","`":"`","=":"="}),ro=/[&<>"\'/`=]/g;function g(t){return t===""?"":t.replace(ro,e=>no[e])}function Lr(t){return t.replace(/[\'"()\\\\]/g,"\\\\$&")}var io=Object.freeze({"&":"&","<":"<",">":">",\'"\':""","\'":"'"}),oo=/[&<>"\']/g;function L(t){return t===""?"":t.replace(oo,e=>io[e])}function It(t){return g(t).replace(/\\r\\n|\\r|\\n/g,"<br>")}var ee={BOLD:1,ITALIC:2,STRIKETHROUGH:4,UNDERLINE:8,CODE:16,SUBSCRIPT:32,SUPERSCRIPT:64,HIGHLIGHT:128};var nn=t=>{let e=typeof t.text=="string"?t.text:"",n=g(e),r=typeof t.format=="number"?t.format:0;return(r&ee.CODE)!==0&&(n=`<code>${n}</code>`),(r&ee.BOLD)!==0&&(n=`<strong>${n}</strong>`),(r&ee.ITALIC)!==0&&(n=`<em>${n}</em>`),(r&ee.UNDERLINE)!==0&&(n=`<u>${n}</u>`),(r&ee.STRIKETHROUGH)!==0&&(n=`<s>${n}</s>`),(r&ee.SUBSCRIPT)!==0&&(n=`<sub>${n}</sub>`),(r&ee.SUPERSCRIPT)!==0&&(n=`<sup>${n}</sup>`),(r&ee.HIGHLIGHT)!==0&&(n=`<mark>${n}</mark>`),n};p("text",nn);var rn=(t,e)=>{let n=e.renderChildren(t.children??[]);return`<p${Q(t)}${G(t)}>${n}</p>`};p("paragraph",rn);var so=new Set(["h1","h2","h3","h4","h5","h6"]),on=(t,e)=>{let n=typeof t.tag=="string"?t.tag.toLowerCase():"h2",r=so.has(n)?n:"h2",o=e.renderChildren(t.children??[]);return`<${r}${Q(t)}${G(t)}>${o}</${r}>`};p("heading",on);var sn=(t,e)=>{let n=typeof t.listType=="string"?t.listType:"bullet",r=n==="number"?"ol":"ul",o=n==="number"&&typeof t.start=="number"&&t.start>1?` start="${String(t.start)}"`:"",s=n==="check"?\' role="list"\':"",a=e.renderChildren(t.children??[]);return`<${r}${Q(t)}${G(t)}${o}${s}>${a}</${r}>`},an=(t,e)=>{let n=e.renderChildren(t.children??[]);if(typeof t.checked=="boolean")return`<li role="checkbox" aria-checked="${t.checked?"true":"false"}"${G(t)}>${n}</li>`;let r=typeof t.value=="number"?` value="${g(String(t.value))}"`:"";return`<li${Q(t)}${G(t)}${r}>${n}</li>`};p("list",sn);p("listitem",an);var ut=(t,e)=>{let n=typeof t.url=="string"?t.url:"",r=e.renderChildren(t.children??[]);if(n.length===0||!R(n))return r;let o=kt(n)?\' target="_blank" rel="noopener noreferrer"\':ao(t),s=typeof t.title=="string"?` title="${g(t.title)}"`:"";return`<a href="${L(n)}"${o}${s}>${r}</a>`};function ao(t){let e=typeof t.target=="string"?t.target:"";if(e.length===0)return"";let n=g(e);return e==="_blank"?\' target="_blank" rel="noopener noreferrer"\':` target="${n}"`}p("link",ut);p("autolink",ut);var dn=(t,e)=>{let n=e.renderChildren(t.children??[]);return`<blockquote${Q(t)}${G(t)}>${n}</blockquote>`};p("quote",dn);var ln=t=>{let e=Ir(typeof t.language=="string"?t.language:""),n=Mr(t);return`<pre><code${e===""?"":` class="language-${e}"`}>${g(n)}</code></pre>`},un=t=>{let e=typeof t.text=="string"?t.text:"";return`<span${typeof t.highlightType=="string"?` class="token-${Ir(t.highlightType)}"`:""}>${g(e)}</span>`};p("code",ln);p("code-highlight",un);function Mr(t){if(typeof t.text=="string")return t.text;if(!t.children)return"";let e="";for(let n of t.children)e+=Mr(n);return e}function Ir(t){return t.replace(/[^a-zA-Z0-9_-]/g,"")}var cn=()=>"<br>",fn=()=>"<hr>",pn=()=>" ";p("linebreak",cn);p("horizontalrule",fn);p("tab",pn);var mn=t=>{let e=lo(t);if(e===void 0)return"";let n=e.url;if(typeof n!="string"||!R(n))return"";let r=typeof e.mimeType=="string"?e.mimeType:"";return r.startsWith("video/")?co(e,n):r.startsWith("audio/")?fo(e,n):r===""||r.startsWith("image/")?uo(e,n):po(e,n)};p("upload",mn);function lo(t){let e=t.value;if(!(typeof e!="object"||e===null))return e}function uo(t,e){let n=typeof t.alt=="string"?g(t.alt):"",r=typeof t.width=="number"?` width="${String(t.width)}"`:"",o=typeof t.height=="number"?` height="${String(t.height)}"`:"";return`<img src="${L(e)}" alt="${n}"${r}${o} loading="lazy" decoding="async">`}function co(t,e){let n=typeof t.width=="number"?` width="${String(t.width)}"`:"",r=typeof t.height=="number"?` height="${String(t.height)}"`:"",o=typeof t.mimeType=="string"?` type="${L(t.mimeType)}"`:"";return`<video controls${n}${r}><source src="${L(e)}"${o}></video>`}function fo(t,e){let n=typeof t.mimeType=="string"?` type="${L(t.mimeType)}"`:"";return`<audio controls><source src="${L(e)}"${n}></audio>`}function po(t,e){let n=typeof t.filename=="string"?g(t.filename):g(e);return`<a href="${L(e)}" target="_blank" rel="noopener noreferrer">${n}</a>`}var hn=t=>{let e=typeof t.relationTo=="string"?t.relationTo:"",n=mo(t),r=ho(n,e),o=g(r),s=e===""?"":` data-relation-to="${g(e)}"`,a=n?.url;return typeof a=="string"&&R(a)?`<a href="${L(a)}"${s}>${o}</a>`:`<span${s}>${o}</span>`};p("relationship",hn);function mo(t){let e=t.value;if(!(typeof e!="object"||e===null))return e}function ho(t,e){return t===void 0?e===""?"#":`#${e}`:typeof t.title=="string"&&t.title.length>0?t.title:typeof t.name=="string"&&t.name.length>0?t.name:typeof t.slug=="string"&&t.slug.length>0?t.slug:t.id!==void 0?String(t.id):e===""?"#":`#${e}`}var yo=new Map;function yn(t){return yo.get(t)}var gn=(t,e)=>{let n=go(t),r=typeof n.blockType=="string"?n.blockType:"",o=Nr(r);if(r!==""){let u=yn(r)??yn(o);if(u)return u(n,{renderChildren:e.renderChildren})}let s=[];o!==""&&s.push(`data-block-type="${g(o)}"`);for(let[u,m]of Object.entries(n)){if(u==="blockType"||u==="id"||m==null)continue;let w=typeof m=="string"||typeof m=="number"||typeof m=="boolean"?String(m):JSON.stringify(m);s.push(`data-block-${Nr(u)}="${g(w)}"`)}return`<div${s.length===0?"":` ${s.join(" ")}`}></div>`};p("block",gn);function go(t){let e=t.fields;return typeof e!="object"||e===null?{}:e}function Nr(t){return t.replace(/[^a-zA-Z0-9_-]/g,"-").toLowerCase()}p("text",nn);p("paragraph",rn);p("heading",on);p("list",sn);p("listitem",an);p("link",ut);p("autolink",ut);p("quote",dn);p("code",ln);p("code-highlight",un);p("linebreak",cn);p("horizontalrule",fn);p("tab",pn);p("upload",mn);p("relationship",hn);p("block",gn);var bo={renderChildren:bn,resolveAlignment:en,resolveIndent:tn};function de(t){if(typeof t!="object"||t===null||!("root"in t))return!1;let e=t.root;return typeof e!="object"||e===null||!("children"in e)?!1:Array.isArray(e.children)}function _r(t,e={}){if(!de(t))return"";let n=bn(t.root.children);return e.sanitize===!1||!kr()?n:z(n)}function Nt(t){return de(t)?t.root.children.map(Cr).join(`\n`).trim():""}function bn(t){let e="";for(let n of t)e+=Ro(n);return e}function Ro(t){let e=Ar(t.type);return e?e(t,bo):t.children!==void 0?bn(t.children):""}function Cr(t){if(typeof t.text=="string")return t.text;if(t.type==="linebreak")return`\n`;if(t.children===void 0)return"";let e="";for(let n of t.children)e+=Cr(n);return e}var Rn=new Map;function Or(t=[]){for(let n of t)Rn.set(n.name,n);let e={};for(let[n,r]of Rn)e[n]=r;return Object.freeze(e)}function y(t){Rn.set(t.name,t)}var To="data-payload-text",Pr=new WeakSet,Tn={name:"text",render(t,e){let n=t.element,r=vo(e);if(n.tagName==="INPUT"||n.tagName==="TEXTAREA"){n.value=r;return}if(wo(n)&&!n.hasAttribute(To)){xo(n,t.fieldName);return}if(r.includes(`\n`)||r.includes("\\r")){n.innerHTML=It(r);return}n.textContent=r}};function wo(t){return t.firstElementChild!==null}function xo(t,e){Pr.has(t)||(Pr.add(t),console.warn(`[live-preview] Skipping text update for "${e}" \\u2014 the bound <${t.tagName.toLowerCase()}> has structured child elements. Either move data-payload-field to the element whose textContent is the field value, or opt in with data-payload-text to replace the structure.`))}function vo(t){return t==null?"":de(t)?Nt(t):typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):JSON.stringify(t)}y(Tn);function T(t){if(t==null)return"";if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint")return String(t);try{return JSON.stringify(t)}catch{return""}}var wn={name:"textarea",render(t,e){let n=t.element,r=de(e)?Nt(e):T(e);if(n.tagName==="INPUT"||n.tagName==="TEXTAREA"){n.value=r;return}n.innerHTML=It(r)}};y(wn);var xn={name:"richText",render(t,e){if(de(e)){t.element.innerHTML=_r(e);return}typeof e=="string"&&(t.element.innerHTML=z(e))}};y(xn);var vn={name:"html",render(t,e){if(e==null){t.element.textContent="";return}let n=typeof e=="string"?e:T(e);t.element.innerHTML=z(n)}};y(vn);var ct={name:"url",render(t,e,n){let r=t.element,o=T(e);if(r.tagName==="A"){let s=r,a=t.hrefField,u=a?n.allFields[a]:e;typeof u=="string"&&R(u)&&(s.href=u),s.textContent=o;return}if(r.tagName==="INPUT"||r.tagName==="TEXTAREA"){r.value=o;return}r.textContent=o}};y(ct);y({...ct,name:"email"});var En={name:"image",render(t,e,n){let r=t.element,o=Eo(e),s=ko(o,e);if(s!==void 0){if(r.tagName==="IMG"){let a=r;a.src=s;let u=So(o,t.altField,n.allFields);u!==void 0&&(a.alt=u);return}r.style.backgroundImage=`url(\'${Lr(s)}\')`}}};function Eo(t){if(!(typeof t!="object"||t===null))return t}function ko(t,e){if(t?.url!==void 0&&R(t.url))return t.url;if(typeof e=="string"&&R(e))return e}function So(t,e,n){if(t?.alt!==void 0)return t.alt;if(e!==void 0){let r=n[e];if(typeof r=="string")return r}}y(En);var kn={name:"upload",render(t,e){let n=t.element,r=Ao(e);if(r===void 0)return;let o=r.url;if(typeof o!="string"||!R(o))return;if(n.tagName==="IMG"){let a=n;a.src=o,r.alt!==void 0&&(a.alt=r.alt);return}if(n.tagName==="A"){let a=n;a.href=o,a.textContent=r.filename??o;return}let s=r.filename!==void 0?g(r.filename):g(o);n.innerHTML=`<a href="${L(o)}">${s}</a>`}};function Ao(t){if(!(typeof t!="object"||t===null))return t}y(kn);var Sn={name:"relationship",render(t,e){let n=t.element,o=Lo(e).join(", ");if(n.tagName==="A"&&!Array.isArray(e)){let s=n,a=e?.url;typeof a=="string"&&R(a)&&(s.href=a),s.textContent=o;return}n.textContent=o}};function Lo(t){return t==null?[""]:Array.isArray(t)?t.map(Fr):[Fr(t)]}function Fr(t){if(typeof t=="object"&&t!==null){let e=t;return typeof e.title=="string"&&e.title.length>0?e.title:typeof e.name=="string"&&e.name.length>0?e.name:typeof e.slug=="string"&&e.slug.length>0?e.slug:e.id!==void 0?String(e.id):""}return T(t)}y(Sn);var ft={name:"select",render(t,e){let n=t.element,r=Dr(e);if(n.tagName==="SELECT"){n.value=r;return}if(n.tagName==="INPUT"&&n.type==="radio"){let o=n;o.checked=o.value===r;return}n.textContent=r}};function Dr(t){return Array.isArray(t)?t.map(e=>Dr(e)).join(", "):T(t)}y(ft);y({...ft,name:"radio"});var An={name:"checkbox",render(t,e){let n=t.element,r=!!e;if(n.tagName==="INPUT"&&n.type==="checkbox"){n.checked=r;return}if(n.hasAttribute("aria-checked")){n.setAttribute("aria-checked",r?"true":"false");return}n.textContent=r?"true":"false"}};y(An);var pt=new Map,mt=new Map,Mo=64,Io=Mo;function $r(t,e){let n=Hr(t,e),r=pt.get(n);if(r!==void 0)return pt.delete(n),pt.set(n,r),r;let o=new Intl.NumberFormat(t,e);return pt.set(n,o),Br(pt),o}function Ur(t,e){let n=Hr(t,e),r=mt.get(n);if(r!==void 0)return mt.delete(n),mt.set(n,r),r;let o=new Intl.DateTimeFormat(t,e);return mt.set(n,o),Br(mt),o}function Hr(t,e){let n=t??"";if(e==null)return n;let r=Ln(e);return r==="{}"?n:`${n}|${r}`}function Ln(t){if(t===null||typeof t!="object")return JSON.stringify(t);if(Array.isArray(t))return`[${t.map(o=>Ln(o)).join(",")}]`;let e=t,n=Object.keys(e).sort(),r=[];for(let o of n){let s=e[o];s!==void 0&&r.push(`${JSON.stringify(o)}:${Ln(s)}`)}return`{${r.join(",")}}`}function Br(t){for(;t.size>Io;){let e=t.keys().next().value;if(e===void 0)break;t.delete(e)}}var Mn={name:"date",render(t,e,n){let r=t.element;if(e==null||e===""){r.tagName==="INPUT"?r.value="":(r.tagName==="TIME"&&r.removeAttribute("datetime"),r.textContent="");return}let o=typeof e=="string"?e:T(e),s=new Date(o),a=!Number.isNaN(s.getTime());if(r.tagName==="INPUT"){r.value=a?No(r.type,s):o;return}if(r.tagName==="TIME"){r.setAttribute("datetime",a?s.toISOString():o),r.textContent=a?jr(s,n):o;return}r.textContent=a?jr(s,n):o}};function jr(t,e){let n=e.locale??Le();try{return Ur(n,{dateStyle:"medium",timeStyle:"short"}).format(t)}catch{return t.toISOString()}}function No(t,e){return t==="date"?e.toISOString().slice(0,10):t==="datetime-local"?e.toISOString().slice(0,16):e.toISOString()}y(Mn);var In={name:"number",render(t,e,n){let r=t.element;if(e==null||e===""){r.tagName==="INPUT"?r.value="":r.textContent="";return}let o=typeof e=="number"?e:Number(T(e));if(Number.isNaN(o)){r.textContent=T(e);return}if(r.tagName==="INPUT"){r.value=String(o);return}r.textContent=_o(o,n)}};function _o(t,e){let n=e.locale??Le();try{return $r(n).format(t)}catch{return String(t)}}y(In);var ht={name:"array",render(t,e){let n=t.element;if(!Array.isArray(e))return;let r=t.arrayTemplate;if(r!==void 0&&r.length>0){let s=Co(r,e);n.innerHTML=z(s);return}let o=t.arraySeparator??", ";n.textContent=e.map(Fo).join(o)}};function Co(t,e){let n="";for(let r=0;r<e.length;r+=1)n+=Oo(t,e[r],r);return n}function Oo(t,e,n){let r=t;if(typeof e=="object"&&e!==null)for(let[o,s]of Object.entries(e)){let a=new RegExp(`\\\\{\\\\{${Po(o)}\\\\}\\\\}`,"g");r=r.replace(a,g(T(s)))}else r=r.replace(/\\{\\{value\\}\\}/g,g(T(e)));return r=r.replace(/\\{\\{index\\}\\}/g,String(n)),r}function Po(t){return t.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function Fo(t){return T(t)}y(ht);y({...ht,name:"blocks"});function Do(){return typeof document>"u"?!1:typeof document.startViewTransition=="function"}async function Vr(t){if(!Do()){t();return}let n=document.startViewTransition.call(document,t);try{await n.finished}catch{}}var Yr="data-payload-key",yt="data-payload-nested-key",Cn="data-payload-nested-template",zr=new WeakMap;function Ct(t){let{template:e,container:n,patches:r}=t,o=Uo(n),s=[],a=[],u=[],m=[],w=[];for(let c of r)c.kind==="remove"?s.push(c):c.kind==="insert"?a.push(c):c.kind==="move"?u.push(c):c.kind==="update"?m.push(c):w.push(c);s.sort((c,b)=>_t(b)-_t(c));for(let c of s){if(c.kind!=="remove")continue;n.children[c.index]?.remove(),Ho(o,c.value)}for(let c of w){if(c.kind!=="replace")continue;let b=n.children[c.index],x=_n(e,c.value,c.index);!b||!x||(Gr(x,c.value),n.replaceChild(x,b),Nn(o,c.value))}for(let c of m){if(c.kind!=="update")continue;let b=n.children[c.index],x=_n(e,c.value,c.index);!b||!x||($o(b,x,c.value,o),n.replaceChild(x,b),Nn(o,c.value))}a.sort((c,b)=>_t(c)-_t(b));for(let c of a){if(c.kind!=="insert")continue;let b=n.children[c.index]??null,x=_n(e,c.value,c.index);x&&(Gr(x,c.value),n.insertBefore(x,b),Nn(o,c.value))}for(let c of u){if(c.kind!=="move")continue;let b=gt(c.value),x=b!==void 0?Bo(n,b):null;if(!x)continue;let Fe=n.children[c.to]??null;x!==Fe&&n.insertBefore(x,Fe)}}function Gr(t,e){let n=t.querySelectorAll(`[${yt}]`);for(let r of Array.from(n)){let o=r.getAttribute(yt);if(o===null)continue;let s=r.getAttribute(Cn);if(!s)continue;let a=On(e,o);if(a===void 0)continue;let u=rt([],a);u.length!==0&&Ct({template:s,container:r,patches:u,nextItems:a})}}function $o(t,e,n,r){let o=t.querySelectorAll(`[${yt}]`);if(o.length===0)return;let s=gt(n),a=s!==void 0?r.get(s):void 0;for(let u of Array.from(o)){let m=u.getAttribute(yt);if(m===null)continue;let w=e.querySelector(`[${yt}="${qr(m)}"]`);if(!w)continue;w.replaceWith(u);let c=u.getAttribute(Cn)??w.getAttribute(Cn);if(!c)continue;let b=On(n,m)??[],x=On(a,m)??[],Fe=rt(x,b);Fe.length!==0&&Ct({template:c,container:u,patches:Fe,nextItems:b})}}function On(t,e){if(typeof t!="object"||t===null)return;let n=t[e];if(Array.isArray(n))return n}function Uo(t){let e=zr.get(t);return e||(e=new Map,zr.set(t,e)),e}function Nn(t,e){let n=gt(e);n!==void 0&&t.set(n,e)}function Ho(t,e){let n=gt(e);n!==void 0&&t.delete(n)}function _t(t){return t.kind==="move"?t.to:t.index}function gt(t){if(typeof t!="object"||t===null)return;let e=t.id;if(typeof e=="string"||typeof e=="number")return String(e)}function Bo(t,e){return t.querySelector(`[${Yr}="${qr(e)}"]`)}function qr(t){let e=globalThis.CSS;return e?.escape?e.escape(t):t.replace(/[^a-zA-Z0-9_-]/g,"\\\\$&")}function _n(t,e,n){if(typeof document>"u")return null;let r=jo(t,e,n),o=z(r),s=document.createElement("template");s.innerHTML=o;let a=s.content.firstElementChild;if(!a)return null;let u=gt(e);return u!==void 0&&a.setAttribute(Yr,u),a}function jo(t,e,n){let r=t;if(typeof e=="object"&&e!==null)for(let[o,s]of Object.entries(e)){let a=new RegExp(`\\\\{\\\\{${Vo(o)}\\\\}\\\\}`,"g"),u=g(Wr(s));r=r.replace(a,()=>u)}else{let o=g(Wr(e));r=r.replace(/\\{\\{value\\}\\}/g,()=>o)}return r.replace(/\\{\\{index\\}\\}/g,String(n))}function Wr(t){return t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):JSON.stringify(t)}function Vo(t){return t.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}var Pn=new WeakMap,Kr=new WeakSet,Fn={name:"structural-array",render(t,e){if(!Array.isArray(e))return;let n=t.element,r=t.arrayTemplate;if(r===void 0||r.length===0){zo(n,t.fieldName);return}let o=Pn.get(n)??[],s=rt(o,e);if(s.length===0){Pn.set(n,e.slice());return}Vr(()=>{Ct({template:r,container:n,patches:s,nextItems:e})}),Pn.set(n,e.slice())}};function zo(t,e){Kr.has(t)||(Kr.add(t),console.warn(`[live-preview] Skipping structural update for "${e}" \\u2014 the <${t.tagName.toLowerCase()}> with data-payload-structural is missing data-payload-array-template. Add an inline template (e.g., data-payload-array-template="<li>{{label}}</li>") so the renderer can materialise new items.`))}y(Fn);var Go=[Tn,wn,xn,vn,ct,{...ct,name:"email"},En,kn,Sn,ft,{...ft,name:"radio"},An,Mn,In,ht,{...ht,name:"blocks"},Fn];function Xr(){return Or(Go)}function Wo(){if(typeof window>"u"||!Kt())return;let t=window.__livePreview;if(t!==void 0)return t;let e=Yo(),n=new Mt({additionalOrigins:e.additionalOrigins,enableReferrerDetection:!e.disableReferrerDetection,enableLocalhostMatching:!e.disableLocalhostMatching});n.isProductionUnconfigured?console.warn("[live-preview] No trusted origin could be detected. Set the PAYLOAD_ADMIN_ORIGIN env var or pass `allowedOrigins` to generateInlineScript()."):n.isReferrerOnlyTrust&&console.warn("[live-preview] Trusting the embedding page via document.referrer only \\u2014 any site that frames this page could post preview updates. Pass explicit `allowedOrigins` and serve a `frame-ancestors` CSP for production.");let r=new bt,o=Xr(),s=new Lt({renderers:o,originMatcher:u=>n.matches(u),readyTargets:n.enumerate(),emitter:r,...typeof e.serverURL=="string"&&e.serverURL!==""?{dataMerge:{serverURL:e.serverURL,...typeof e.apiRoute=="string"?{apiRoute:e.apiRoute}:{},...typeof e.mergeDepth=="number"?{depth:e.mergeDepth}:{}}}:{},debounceMs:e.debounceMs,heartbeatMs:e.heartbeatMs,intersectionRootMargin:e.intersectionRootMargin,disableVisibilityGate:e.disableVisibilityGate,visibilityGateThreshold:e.visibilityGateThreshold,enableA11y:e.enableA11y,onHeartbeatTimeout:()=>{n.unlockOrigin()},...e.debug?{log:(...u)=>{console.debug("[live-preview]",...u)}}:{}});r.on("connect",u=>{n.lockOrigin(u.origin)}),s.start();let a=Object.freeze({version:Rr,destroy:()=>{s.destroy()},refresh:()=>{s.refreshCache()},enumerateOrigins:()=>n.enumerate()});return Object.defineProperty(window,"__livePreview",{value:a,writable:!1,configurable:!0}),a}function Yo(){let t=typeof __LIVE_PREVIEW_CONFIG__>"u"?void 0:__LIVE_PREVIEW_CONFIG__;return t!==void 0?t:{additionalOrigins:[],serverURL:"",apiRoute:"/api",mergeDepth:1,debug:!1,debounceMs:50,enableA11y:!0,heartbeatMs:0,disableVisibilityGate:!1,visibilityGateThreshold:50,intersectionRootMargin:"200px",disableReferrerDetection:!1,disableLocalhostMatching:!1}}var qo=typeof __INLINE_BUILD__>"u"?!1:__INLINE_BUILD__;qo&&Wo();var Ol={isInIframe:dt,isInPopup:qt,isInPreviewContext:Kt};})();\n';
|
|
5
|
-
var RUNTIME_BUILD_INFO = { generatedAt: "2026-07-
|
|
4
|
+
var RUNTIME_SOURCE = '"use strict";(()=>{var Jr=Object.defineProperty;var Dn=t=>{throw TypeError(t)};var Zr=(t,e,n)=>e in t?Jr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var $n=(t,e,n)=>Zr(t,typeof e!="symbol"?e+"":e,n),Ot=(t,e,n)=>e.has(t)||Dn("Cannot "+n);var i=(t,e,n)=>(Ot(t,e,"read from private field"),n?n.call(t):e.get(t)),l=(t,e,n)=>e.has(t)?Dn("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),d=(t,e,n,r)=>(Ot(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),f=(t,e,n)=>(Ot(t,e,"access private method"),n);var F,_,te,Pt,Ft,bt=class{constructor(){l(this,te);l(this,F,new Map);l(this,_,new Map)}on(e,n){return f(this,te,Pt).call(this,i(this,F),e,n)}once(e,n){return f(this,te,Pt).call(this,i(this,_),e,n)}off(e,n){i(this,F).get(e)?.delete(n),i(this,_).get(e)?.delete(n)}async emit(e,n){let r=i(this,F).get(e);if(r)for(let s of[...r])await f(this,te,Ft).call(this,s,n,e);let o=i(this,_).get(e);if(o&&o.size>0){let s=[...o];i(this,_).delete(e);for(let a of s)await f(this,te,Ft).call(this,a,n,e)}}listenerCount(e){return(i(this,F).get(e)?.size??0)+(i(this,_).get(e)?.size??0)}removeAllListeners(e){if(e===void 0){i(this,F).clear(),i(this,_).clear();return}i(this,F).delete(e),i(this,_).delete(e)}eventNames(){let e=new Set;for(let n of i(this,F).keys())e.add(n);for(let n of i(this,_).keys())e.add(n);return[...e]}};F=new WeakMap,_=new WeakMap,te=new WeakSet,Pt=function(e,n,r){let o=e.get(n);return o||(o=new Set,e.set(n,o)),o.add(r),()=>{e.get(n)?.delete(r)}},Ft=async function(e,n,r){try{await e(n)}catch(o){let s=typeof r=="string"||typeof r=="number"?String(r):"<event>";console.error(`[live-preview] handler for "${s}" threw:`,o)}};var le="data-payload-field",Un="data-payload-type",Qr="data-payload-attribute",ei="data-payload-href",ti="data-payload-src",ni="data-payload-alt",ri="data-payload-array-template",ii="data-payload-array-separator",oi="data-payload-locale",si=`[${le}]`,Hn=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"]),k,W,Te,ne,Dt,$t,Rt=class{constructor(e={}){l(this,ne);l(this,k,new Map);l(this,W,new WeakMap);l(this,Te);d(this,Te,e.filter??di)}buildFromRoot(e){let n=performance.now();i(this,k).clear();let r=e.querySelectorAll(si),o=0;for(let s of r){if(!i(this,Te).call(this,s))continue;let a=f(this,ne,$t).call(this,s);a&&(f(this,ne,Dt).call(this,a),i(this,W).set(s,a),o+=1)}return{elementCount:o,fieldCount:i(this,k).size,durationMs:performance.now()-n}}add(e){if(!i(this,Te).call(this,e))return;let n=f(this,ne,$t).call(this,e);if(n)return f(this,ne,Dt).call(this,n),i(this,W).set(e,n),n}remove(e){let n=i(this,W).get(e);if(!n)return!1;i(this,W).delete(e);let r=i(this,k).get(n.fieldName);if(!r)return!1;let o=r.indexOf(n);return o<0?!1:(r.splice(o,1),r.length===0&&i(this,k).delete(n.fieldName),!0)}get(e){return i(this,k).get(e)}getByElement(e){return i(this,W).get(e)}get fieldCount(){return i(this,k).size}get elementCount(){let e=0;for(let n of i(this,k).values())e+=n.length;return e}entries(){return i(this,k).entries()}*values(){for(let e of i(this,k).values())yield*e}has(e){return i(this,W).has(e)}clear(){i(this,k).clear()}};k=new WeakMap,W=new WeakMap,Te=new WeakMap,ne=new WeakSet,Dt=function(e){let n=i(this,k).get(e.fieldName);if(n){n.push(e);return}i(this,k).set(e.fieldName,[e])},$t=function(e){let n=e.getAttribute(le);if(n===null||n.length===0)return;let r=e.getAttribute(Un),o=ai(e),s=e.getAttribute(Qr),a=e.getAttribute(ei),u=e.getAttribute(ti),m=e.getAttribute(ni),w=e.getAttribute(ri),c=e.getAttribute(ii),b=e.getAttribute(oi);return{element:e,fieldName:n,fieldType:o,explicitFieldType:r!==null&&Hn.has(r),...s!==null&&s.length>0?{targetAttribute:s}:{},...a!==null?{hrefField:a}:{},...u!==null?{srcField:u}:{},...m!==null?{altField:m}:{},...w!==null?{arrayTemplate:w}:{},...c!==null?{arraySeparator:c}:{},...b!==null?{locale:b}:{}}};function ai(t){let e=t.getAttribute(Un);if(e!==null&&Hn.has(e))return e;if(t.hasAttribute("data-payload-richtext"))return"richText";if(t.hasAttribute("data-payload-html"))return"html";if(t.hasAttribute("data-payload-structural"))return"structural-array";if(t.hasAttribute("data-payload-array"))return"array";if(t.tagName==="IMG")return"image";if(t.tagName==="A")return"url";if(t.tagName==="TIME")return"date";if(t.tagName==="INPUT"){let n=t.type;if(n==="checkbox")return"checkbox";if(n==="number")return"number";if(n==="date"||n==="datetime-local")return"date"}return"text"}function di(){return!0}var li=100,ui="200px",ue,De,$e,M,ce,re,D,we,jn,Vn,Tt=class{constructor(e,n={}){l(this,we);l(this,ue);l(this,De);l(this,$e);l(this,M,new Set);l(this,ce,null);l(this,re,null);l(this,D,null);d(this,ue,e),d(this,De,n.mutationDebounceMs??li),d(this,$e,n.intersectionRootMargin??ui)}start(e){d(this,ce,new MutationObserver(n=>{f(this,we,jn).call(this,n)})),i(this,ce).observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[le]}),d(this,re,new IntersectionObserver(n=>{f(this,we,Vn).call(this,n)},{rootMargin:i(this,$e),threshold:0}))}observeElement(e){i(this,re)?.observe(e)}unobserveElement(e){i(this,re)?.unobserve(e),i(this,M).delete(e)}markVisible(e,n){n?i(this,M).add(e):i(this,M).delete(e)}isVisible(e){return i(this,M).has(e)}stop(){i(this,D)!==null&&(clearTimeout(i(this,D)),d(this,D,null)),i(this,ce)?.disconnect(),i(this,re)?.disconnect(),d(this,ce,null),d(this,re,null),i(this,M).clear()}};ue=new WeakMap,De=new WeakMap,$e=new WeakMap,M=new WeakMap,ce=new WeakMap,re=new WeakMap,D=new WeakMap,we=new WeakSet,jn=function(e){ci(e)&&(i(this,D)!==null&&clearTimeout(i(this,D)),d(this,D,setTimeout(()=>{d(this,D,null),i(this,ue).onStructuralChange()},i(this,De))))},Vn=function(e){for(let n of e){let r=n.target;n.isIntersecting?i(this,M).has(r)||(i(this,M).add(r),i(this,ue).onVisibilityChange(r,!0)):i(this,M).has(r)&&(i(this,M).delete(r),i(this,ue).onVisibilityChange(r,!1))}};function ci(t){for(let e of t){if(e.type==="attributes"&&e.attributeName===le)return!0;for(let n of e.addedNodes)if(Bn(n))return!0;for(let n of e.removedNodes)if(Bn(n))return!0}return!1}function Bn(t){if(t.nodeType!==Node.ELEMENT_NODE)return!1;let e=t;return e.hasAttribute(le)?!0:e.querySelector(`[${le}]`)!==null}var fi={basic:1,"schema-json":2,"preview-token":3,"nested-arrays":4,"recursive-diffs":4};function Ut(t){let e=typeof t=="number"&&Number.isFinite(t)&&t>=1?Math.floor(t):void 0,r=Math.min(4,e??1),o=new Set;for(let[s,a]of Object.entries(fi))r>=a&&o.add(s);return{ours:4,...e!==void 0?{theirs:e}:{theirs:void 0},negotiated:r,capabilities:o}}var He,v,xe,fe,ve,Gn,Wn,Ue=class{constructor(e,n){l(this,ve);l(this,He);l(this,v);l(this,xe);l(this,fe,!1);d(this,He,e),d(this,v,n),d(this,xe,r=>{f(this,ve,Gn).call(this,r)})}attach(e=window){i(this,fe)||(e.addEventListener("message",i(this,xe)),d(this,fe,!0))}detach(e=window){i(this,fe)&&(e.removeEventListener("message",i(this,xe)),d(this,fe,!1))}static sendReady(e,n){if(e.length===0||n.length===0)return;let r={type:"payload-live-preview",ready:!0,protocolVersion:4};for(let o of e)for(let s of n)try{o.postMessage(r,s)}catch{}}};He=new WeakMap,v=new WeakMap,xe=new WeakMap,fe=new WeakMap,ve=new WeakSet,Gn=function(e){let n=e.origin;if(!i(this,He).call(this,n)){i(this,v).onInvalid?.("origin",n);return}let r=e.data;if(!pi(r)){i(this,v).onInvalid?.("shape",n);return}switch(r.type){case"payload-live-preview":f(this,ve,Wn).call(this,r,n);return;case"payload-document-event":i(this,v).onDocumentEvent(r,n);return;default:i(this,v).onInvalid?.("type",n)}},Wn=function(e,n){let r=i(this,v).validateToken;if(r===void 0){i(this,v).onUpdate(e,n);return}if(e.ready===!0&&e.data===void 0){i(this,v).onUpdate(e,n);return}let o;try{o=r(e.previewToken,n)}catch{i(this,v).onInvalid?.("token",n);return}if(typeof o=="boolean"){o?i(this,v).onUpdate(e,n):i(this,v).onInvalid?.("token",n);return}o.then(s=>{s?i(this,v).onUpdate(e,n):i(this,v).onInvalid?.("token",n)},()=>{i(this,v).onInvalid?.("token",n)})};function pi(t){return typeof t!="object"||t===null||!("type"in t)?!1:typeof t.type=="string"}var Ee,Be,C,je,xt=class{constructor(e){l(this,Ee);l(this,Be);l(this,C,null);l(this,je,0);d(this,Ee,e.timeoutMs??0),d(this,Be,e.onTimeout)}kick(){d(this,je,Date.now()),!(i(this,Ee)<=0)&&(i(this,C)!==null&&clearTimeout(i(this,C)),d(this,C,setTimeout(()=>{d(this,C,null),i(this,Be).call(this)},i(this,Ee))))}stop(){i(this,C)!==null&&(clearTimeout(i(this,C)),d(this,C,null))}get lastKickAt(){return i(this,je)}get pending(){return i(this,C)!==null}};Ee=new WeakMap,Be=new WeakMap,C=new WeakMap,je=new WeakMap;var pe,Ve,ke,wt,vt=class{constructor(e){l(this,ke);l(this,pe,"disconnected");l(this,Ve);d(this,Ve,e)}get status(){return i(this,pe)}markConnected(){return f(this,ke,wt).call(this,"connected")}markConnecting(){return f(this,ke,wt).call(this,"connecting")}markDisconnected(){return f(this,ke,wt).call(this,"disconnected")}};pe=new WeakMap,Ve=new WeakMap,ke=new WeakSet,wt=function(e){if(i(this,pe)===e)return!1;let n=i(this,pe);return d(this,pe,e),i(this,Ve).call(this,e,n),!0};var mi=()=>{},ze,Ge,We,Ye,me,Y,Et=class{constructor(e){l(this,ze);l(this,Ge);l(this,We);l(this,Ye);l(this,me);l(this,Y,null);d(this,ze,e.serverURL.replace(/\\/+$/,""));let n=e.apiRoute??"/api";d(this,Ge,n.startsWith("/")?n:`/${n}`),d(this,We,e.depth??1),d(this,Ye,e.fetchFn),d(this,me,e.log??mi)}canMerge(e){if(e.globalSlug!==void 0&&e.globalSlug!=="")return!0;if(e.collectionSlug===void 0||e.collectionSlug==="")return!1;let n=e.data.id;return typeof n=="string"||typeof n=="number"}async merge(e){if(!this.canMerge(e))return{status:"unavailable"};let n=i(this,Ye)??(typeof fetch=="function"?fetch:void 0);if(n===void 0)return{status:"unavailable"};i(this,Y)?.abort();let r=new AbortController;d(this,Y,r);let o=e.globalSlug!==void 0&&e.globalSlug!==""?`globals/${e.globalSlug}`:`${e.collectionSlug}/${String(e.data.id)}`,s=`${i(this,ze)}${i(this,Ge)}/${encodeURI(o)}`;try{let a=await n(s,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","X-Payload-HTTP-Method-Override":"GET"},body:JSON.stringify({data:e.data,depth:i(this,We),flattenLocales:!1,...e.locale!==void 0?{locale:e.locale}:{}}),signal:r.signal});if(!a.ok)return i(this,me).call(this,"merge fetch failed",a.status,s),{status:"unavailable"};let u=await a.json();return u===null||typeof u!="object"||Array.isArray(u)?(i(this,me).call(this,"merge fetch returned non-object",s),{status:"unavailable"}):{status:"merged",doc:u}}catch(a){return r.signal.aborted?{status:"superseded"}:(i(this,me).call(this,"merge fetch error",a),{status:"unavailable"})}finally{i(this,Y)===r&&d(this,Y,null)}}destroy(){i(this,Y)?.abort(),d(this,Y,null)}};ze=new WeakMap,Ge=new WeakMap,We=new WeakMap,Ye=new WeakMap,me=new WeakMap,Y=new WeakMap;var hi=new Set(["http:","https:","mailto:","tel:"]),yi=/^\\s*(?:javascript|data|vbscript|file|blob|about)\\s*:/i,gi=/^(?:\\.{1,2}\\/|[a-zA-Z0-9_-]+\\/?)/;function R(t){if(typeof t!="string"||t.length===0)return!1;let e=t.trim();if(e.length===0||yi.test(e))return!1;if(e.startsWith("#")||e.startsWith("?")||e.startsWith("//")||e.startsWith("/"))return!0;try{let n=new URL(e);return hi.has(n.protocol)}catch{return gi.test(e)}}function kt(t){if(!R(t))return!1;let e=t.trim();return/^https?:\\/\\//i.test(e)||/^\\/\\/[^/]/.test(e)}var bi=new Set(["style","srcdoc","formaction","form","id","name","is","srcset","imagesrcset"]),Ri=new Set(["href","src","poster","cite","action","xlink:href","data"]);function Yn(t,e,n){let r=e.toLowerCase().trim();if(r.length===0||r.startsWith("on")||bi.has(r))return"blocked";if(n==null)return t.removeAttribute(r),"applied";if(typeof n!="string"&&typeof n!="number"&&typeof n!="boolean")return"blocked";let o=String(n);return Ri.has(r)&&!R(o)?"blocked":(t.setAttribute(r,o),"applied")}var Se,qe,Ke,Xe,Je,Ze,Qe,et,Ae,$,q,S,U,K,qn,Kn,Ht,St=class{constructor(e,n){l(this,K);l(this,Se);l(this,qe);l(this,Ke);l(this,Xe);l(this,Je);l(this,Ze);l(this,Qe);l(this,et);l(this,Ae);l(this,$,new Map);l(this,q,new Map);l(this,S,null);l(this,U,null);d(this,Se,e),d(this,qe,n.debounceMs??50),d(this,Ke,n.isVisible),d(this,Xe,n.visibilityGateThreshold??50),d(this,Je,n.disableVisibilityGate??!1),d(this,Ze,n.getCacheSize),d(this,Qe,n.onFlush),d(this,et,n.scheduleFrame??(typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(globalThis):r=>setTimeout(()=>{r(performance.now())},0))),d(this,Ae,n.cancelFrame??(typeof cancelAnimationFrame=="function"?cancelAnimationFrame.bind(globalThis):r=>{clearTimeout(r)}))}schedule(e){let n=i(this,$).get(e.target.element);n?(n.value=e.value,n.allFields=e.allFields):i(this,$).set(e.target.element,{target:e.target,value:e.value,allFields:e.allFields}),f(this,K,qn).call(this)}flushNow(){return i(this,S)!==null&&(clearTimeout(i(this,S)),d(this,S,null)),f(this,K,Ht).call(this)}notifyVisible(e){let n=i(this,q).get(e);n&&(i(this,q).delete(e),i(this,Se).call(this,n))}forget(e){i(this,$).delete(e),i(this,q).delete(e)}destroy(){i(this,S)!==null&&(clearTimeout(i(this,S)),d(this,S,null)),i(this,U)!==null&&(i(this,Ae).call(this,i(this,U)),d(this,U,null)),i(this,$).clear(),i(this,q).clear()}get pendingCount(){return i(this,$).size}get replayCount(){return i(this,q).size}};Se=new WeakMap,qe=new WeakMap,Ke=new WeakMap,Xe=new WeakMap,Je=new WeakMap,Ze=new WeakMap,Qe=new WeakMap,et=new WeakMap,Ae=new WeakMap,$=new WeakMap,q=new WeakMap,S=new WeakMap,U=new WeakMap,K=new WeakSet,qn=function(){i(this,S)!==null&&clearTimeout(i(this,S)),d(this,S,setTimeout(()=>{d(this,S,null),f(this,K,Kn).call(this)},i(this,qe)))},Kn=function(){i(this,U)!==null&&i(this,Ae).call(this,i(this,U)),d(this,U,i(this,et).call(this,()=>{d(this,U,null),f(this,K,Ht).call(this)}))},Ht=function(){var u;let e=performance.now(),n=!i(this,Je)&&i(this,Ze).call(this)>i(this,Xe),r=i(this,$);d(this,$,new Map);let o=0,s=0;for(let m of r.values()){if(n&&!i(this,Ke).call(this,m.target.element)){i(this,q).set(m.target.element,m),s+=1;continue}i(this,Se).call(this,m),o+=1}let a={applied:o,deferred:s,durationMs:performance.now()-e};return(u=i(this,Qe))==null||u.call(this,a),a};function Le(){let t=Ti();if(t!==void 0)return t;let e=wi();return e!==void 0?e:"en"}function Ti(){if(typeof document>"u")return;let t=document.documentElement.getAttribute("lang");return t===null||t.length===0?void 0:t}function wi(){if(typeof navigator>"u")return;let t=navigator.language;return typeof t=="string"&&t.length>0?t:void 0}var Xn="payload-live-preview-a11y",xi=1500,vi=["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"].join(";"),Jn={connected:"Live preview connected",disconnected:"Live preview disconnected",updated:t=>`${String(t)} ${t===1?"change":"changes"} applied`},Ei={en:Jn,de:{connected:"Vorschau verbunden",disconnected:"Vorschau getrennt",updated:t=>`${String(t)} ${t===1?"\\xC4nderung":"\\xC4nderungen"} angewendet`}};function ki(t){let e=t.split(/[-_]/)[0]?.toLowerCase()??"en";return Ei[e]??Jn}var I,he,H,ie,Zn,At,tt=class{constructor(e=Le()){l(this,ie);l(this,I,null);l(this,he);l(this,H,null);d(this,he,ki(e))}announceConnected(){f(this,ie,At).call(this,i(this,he).connected)}announceDisconnected(){f(this,ie,At).call(this,i(this,he).disconnected)}announceUpdate(e){e<=0||f(this,ie,At).call(this,i(this,he).updated(e))}detach(){i(this,H)!==null&&(clearTimeout(i(this,H)),d(this,H,null)),i(this,I)?.parentNode&&i(this,I).parentNode.removeChild(i(this,I))}};I=new WeakMap,he=new WeakMap,H=new WeakMap,ie=new WeakSet,Zn=function(){if(i(this,I)!==null&&i(this,I).isConnected)return i(this,I);if(typeof document>"u"||document.body===null)return null;let e=document.getElementById(Xn);return e||(e=document.createElement("div"),e.id=Xn,e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.setAttribute("style",vi),document.body.appendChild(e)),d(this,I,e),e},At=function(e){let n=f(this,ie,Zn).call(this);n&&(n.textContent=e,i(this,H)!==null&&clearTimeout(i(this,H)),d(this,H,setTimeout(()=>{d(this,H,null),i(this,I)&&(i(this,I).textContent="")},xi)))};var Si=new Set(["tabs","row","collapsible"]);function Bt(t,e=""){let n=new Map;return nt(t,e,n),n}function nt(t,e,n){for(let r of t){if(Si.has(r.type)){r.fields&&nt(r.fields,e,n);continue}if(r.type==="group"){let s=e===""?r.name:`${e}.${r.name}`;n.set(s,r),r.fields&&nt(r.fields,s,n);continue}let o=e===""?r.name:`${e}.${r.name}`;if(n.set(o,r),r.type==="array"&&r.fields)nt(r.fields,`${o}.*`,n);else if(r.type==="blocks"&&r.blocks)for(let s of r.blocks)nt(s.fields,`${o}.*.${s.slug}`,n)}}function jt(t,e){if(t.has(e))return t.get(e);let n=e.replace(/\\.\\d+(?=\\.|$)/g,".*");if(t.has(n))return t.get(n)}function Vt(t){if(typeof t!="object"||t===null)return;let e=t.id;if(typeof e=="string"||typeof e=="number")return e}function Qn(t){if(typeof t!="object"||t===null)return;let e=t.blockType;return typeof e=="string"?e:void 0}function rt(t,e){return e.every(r=>Vt(r)!==void 0)?Ai(t,e):Li(t,e)}function Ai(t,e){let n=[],r=new Map;for(let s=0;s<t.length;s+=1){let a=Vt(t[s]);a!==void 0&&r.set(a,s)}let o=new Set;for(let s=0;s<e.length;s+=1){let a=e[s],u=Vt(a);if(u===void 0){n.push({kind:"insert",index:s,value:a});continue}let m=r.get(u);if(m===void 0){n.push({kind:"insert",index:s,value:a});continue}o.add(m);let w=t[m];if(Qn(w)!==Qn(a)){n.push({kind:"replace",index:s,oldValue:w,value:a});continue}m!==s&&n.push({kind:"move",from:m,to:s,value:a}),er(w,a)||n.push({kind:"update",index:s,value:a})}for(let s=0;s<t.length;s+=1)o.has(s)||n.push({kind:"remove",index:s,value:t[s]});return n}function Li(t,e){let n=[],r=Math.min(t.length,e.length);for(let o=0;o<r;o+=1)er(t[o],e[o])||n.push({kind:"update",index:o,value:e[o]});if(e.length>t.length)for(let o=t.length;o<e.length;o+=1)n.push({kind:"insert",index:o,value:e[o]});if(t.length>e.length)for(let o=e.length;o<t.length;o+=1)n.push({kind:"remove",index:o,value:t[o]});return n}function er(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||typeof e!="object"||t===null||e===null)return!1;let n=t,r=e,o=Object.keys(n),s=Object.keys(r);if(o.length!==s.length)return!1;for(let a of o)if(!Object.is(n[a],r[a]))return!1;return!0}var tr={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"};function zt(t){if(Object.prototype.hasOwnProperty.call(tr,t))return tr[t]}var Mi=[0,500,1e3,2e3],E,A,X,oe,Me,J,Ie,it,B,ye,ge,ot,O,Ne,_e,Z,be,N,Ce,Oe,Pe,Re,se,st,at,h,Gt,Wt,Yt,rr,ir,or,sr,ar,dr,lr,ur,cr,fr,pr,Lt=class{constructor(e){l(this,h);l(this,E);l(this,A);l(this,X);l(this,oe);l(this,Me);l(this,J);l(this,Ie);l(this,it);l(this,B);l(this,ye);l(this,ge);l(this,ot);l(this,O);l(this,Ne);l(this,_e,[]);l(this,Z);l(this,be);l(this,N);l(this,Ce);l(this,Oe);l(this,Pe,Ut(void 0));l(this,Re,!1);l(this,se,null);l(this,st,0);l(this,at,new Set);d(this,E,e.emitter),d(this,it,e.renderers),d(this,B,e.root??(typeof document<"u"?document:null)),d(this,ye,e.readyTargets),d(this,ge,e.sendReady??Oi),d(this,ot,e.onHeartbeatTimeout),d(this,O,e.log??Ni),d(this,Ne,e.warn??Ci),d(this,Z,Ii(e)),d(this,be,e.dataMerge!==void 0?new Et({serverURL:e.dataMerge.serverURL,...e.dataMerge.apiRoute!==void 0?{apiRoute:e.dataMerge.apiRoute}:{},...e.dataMerge.depth!==void 0?{depth:e.dataMerge.depth}:{},...e.dataMerge.fetchFn!==void 0?{fetchFn:e.dataMerge.fetchFn}:{},log:(...n)=>{i(this,O).call(this,...n)}}):null),d(this,A,new Rt),d(this,X,new Tt({onStructuralChange:()=>{f(this,h,Yt).call(this)},onVisibilityChange:(n,r)=>{r&&i(this,oe).notifyVisible(n)}},{...e.intersectionRootMargin!==void 0?{intersectionRootMargin:e.intersectionRootMargin}:{}})),d(this,oe,new St(n=>{f(this,h,ur).call(this,n)},{...e.debounceMs!==void 0?{debounceMs:e.debounceMs}:{},...e.disableVisibilityGate!==void 0?{disableVisibilityGate:e.disableVisibilityGate}:{},...e.visibilityGateThreshold!==void 0?{visibilityGateThreshold:e.visibilityGateThreshold}:{},isVisible:n=>i(this,X).isVisible(n),getCacheSize:()=>i(this,A).elementCount,onFlush:n=>{f(this,h,fr).call(this,n)}})),d(this,Me,new Ue(e.originMatcher,{onUpdate:(n,r)=>{f(this,h,or).call(this,n,r)},onDocumentEvent:(n,r)=>{f(this,h,ar).call(this,n,r)},onInvalid:(n,r)=>{if(n==="token"){let o=new Error(`Preview token rejected (origin: ${r})`);i(this,E).emit("error",{error:o,context:"token"})}i(this,O).call(this,"message rejected:",n,r)},...e.validateToken!==void 0?{validateToken:e.validateToken}:{}})),d(this,J,new vt((n,r)=>{i(this,O).call(this,"connection",r,"\\u2192",n)})),d(this,Ie,new xt({...e.heartbeatMs!==void 0?{timeoutMs:e.heartbeatMs}:{},onTimeout:()=>{f(this,h,pr).call(this)}}))}start(){if(i(this,Re))return!1;d(this,Re,!0);let e=i(this,B);if(e instanceof Document&&e.readyState==="loading"){let n=()=>{d(this,se,null),f(this,h,Gt).call(this)};return d(this,se,n),e.addEventListener("DOMContentLoaded",n,{once:!0}),!0}return f(this,h,Gt).call(this),!0}destroy(){if(!i(this,Re))return;if(d(this,Re,!1),i(this,se)!==null){let n=i(this,B);n instanceof Document&&n.removeEventListener("DOMContentLoaded",i(this,se)),d(this,se,null),i(this,E).emit("destroy",{timestamp:Date.now()});return}for(let n of i(this,_e))clearTimeout(n);i(this,_e).length=0,i(this,Ie).stop(),i(this,Me).detach(),i(this,X).stop(),i(this,oe).destroy(),i(this,be)?.destroy(),i(this,A).clear();let e=i(this,J).status==="connected";i(this,J).markDisconnected(),e&&(i(this,Z)?.announceDisconnected(),i(this,E).emit("disconnect",{reason:"destroy",timestamp:Date.now()})),i(this,Z)?.detach(),i(this,E).emit("destroy",{timestamp:Date.now()})}refreshCache(){f(this,h,Yt).call(this)}get status(){return i(this,J).status}get cache(){return i(this,A)}get updateCount(){return i(this,st)}get protocol(){return i(this,Pe)}};E=new WeakMap,A=new WeakMap,X=new WeakMap,oe=new WeakMap,Me=new WeakMap,J=new WeakMap,Ie=new WeakMap,it=new WeakMap,B=new WeakMap,ye=new WeakMap,ge=new WeakMap,ot=new WeakMap,O=new WeakMap,Ne=new WeakMap,_e=new WeakMap,Z=new WeakMap,be=new WeakMap,N=new WeakMap,Ce=new WeakMap,Oe=new WeakMap,Pe=new WeakMap,Re=new WeakMap,se=new WeakMap,st=new WeakMap,at=new WeakMap,h=new WeakSet,Gt=function(){f(this,h,Wt).call(this),i(this,X).start(i(this,B)instanceof Document?i(this,B).body:i(this,B)),i(this,Me).attach(),f(this,h,rr).call(this);for(let e of Mi)if(e===0)i(this,ge).call(this,i(this,ye));else{let n=setTimeout(()=>{i(this,ge).call(this,i(this,ye))},e);i(this,_e).push(n)}},Wt=function(){let e=i(this,A).buildFromRoot(i(this,B));i(this,O).call(this,"cache built",e),i(this,E).emit("cacheRefresh",e);for(let n of i(this,A).values())i(this,X).observeElement(n.element)},Yt=function(){for(let e of i(this,A).values())i(this,X).unobserveElement(e.element),i(this,oe).forget(e.element);f(this,h,Wt).call(this)},rr=function(){i(this,E).emit("init",{timestamp:Date.now()})},ir=function(e){let n=Ut(e);n.negotiated!==i(this,Pe).negotiated&&(d(this,Pe,n),i(this,O).call(this,"protocol negotiated",`ours=${4}`,`theirs=${e}`,`negotiated=${n.negotiated}`))},or=function(e,n){i(this,Ie).kick(),e.protocolVersion!==void 0&&f(this,h,ir).call(this,e.protocolVersion),e.data!==void 0&&(i(this,J).markConnected()&&(i(this,Z)?.announceConnected(),i(this,E).emit("connect",{origin:n,timestamp:Date.now()})),d(this,st,i(this,st)+1),e.locale!==void 0&&d(this,N,e.locale),e.fieldSchemaJSON!==void 0&&(d(this,Ce,e.fieldSchemaJSON),d(this,Oe,Bt(e.fieldSchemaJSON))),f(this,h,sr).call(this,e).then(r=>{if(r===null)return;let o={fields:r,...i(this,Ce)!==void 0?{schema:i(this,Ce)}:{},...e.globalSlug!==void 0?{globalSlug:e.globalSlug}:{},...e.collectionSlug!==void 0?{collectionSlug:e.collectionSlug}:{},...i(this,N)!==void 0?{locale:i(this,N)}:{}},s=!1;i(this,E).emit("beforeUpdate",{data:o,cancel:()=>{s=!0}}).then(()=>{s||f(this,h,dr).call(this,o)})}))},sr=async function(e){let n=e.data??{};if(i(this,be)===null)return n;let r=await i(this,be).merge({collectionSlug:e.collectionSlug,globalSlug:e.globalSlug,data:n,locale:i(this,N)});return r.status==="merged"?r.doc:r.status==="superseded"?null:n},ar=function(e,n){i(this,E).emit("documentSave",{timestamp:Date.now()})},dr=function(e){for(let[n,r]of i(this,A).entries()){let o=$i(e.fields,n,i(this,N));if(o!==void 0)for(let s of r){let a={target:s,value:o,allFields:e.fields};i(this,oe).schedule(a)}}f(this,h,lr).call(this,e.fields)},lr=function(e){if(i(this,A).elementCount===0)return;let n=new Set;for(let[r]of i(this,A).entries())n.add(r);for(let[r,o]of Object.entries(e)){if(i(this,at).has(r)||Pi.has(r)||!Fi(o))continue;let s=Di(r,i(this,N));n.has(r)||n.has(s)||(i(this,at).add(r),i(this,Ne).call(this,`[live-preview] update arrived for field "${r}" but no <\\u2026 data-payload-field="${s}"> element exists on this page. Render the binding anchor unconditionally in your template so live edits to an initially-empty field have somewhere to land.`))}},ur=function(e){let n=i(this,Oe)!==void 0?jt(i(this,Oe),e.target.fieldName):void 0,r=f(this,h,cr).call(this,e.target,n?.type);r==="text"&&e.target.explicitFieldType!==!0&&_i(e.value)&&(r="richText");let o=i(this,it)[r],s=Ui(e.target.element),a={allFields:e.allFields,locale:i(this,N),schema:n};try{e.target.targetAttribute!==void 0?Yn(e.target.element,e.target.targetAttribute,e.value)==="blocked"&&i(this,Ne).call(this,`[live-preview] refused to write field "${e.target.fieldName}" into attribute "${e.target.targetAttribute}" (unsafe attribute or value)`):o?o.render(e.target,e.value,a):i(this,O).call(this,"no renderer for",r)}catch(u){let m=u instanceof Error?u:new Error(String(u));i(this,E).emit("error",{error:m,context:"renderer"});return}i(this,E).emit("elementUpdate",{element:e.target.element,fieldName:e.target.fieldName,previousValue:s,nextValue:e.value})},cr=function(e,n){if(e.explicitFieldType)return e.fieldType;if(n!==void 0){let r=zt(n);if(r!==void 0)return r}return e.fieldType},fr=function(e){e.applied===0&&e.deferred===0||(e.applied>0&&i(this,Z)?.announceUpdate(e.applied),i(this,E).emit("afterUpdate",{data:{fields:{},...i(this,N)!==void 0?{locale:i(this,N)}:{}},updatedCount:e.applied,durationMs:e.durationMs}))},pr=function(){var e;i(this,J).markDisconnected()&&(i(this,Z)?.announceDisconnected(),i(this,E).emit("disconnect",{reason:"timeout",timestamp:Date.now()}));try{(e=i(this,ot))==null||e.call(this)}catch(n){i(this,O).call(this,"onHeartbeatTimeout hook threw:",n)}i(this,ge).call(this,i(this,ye))};function Ii(t){return t.enableA11y===!1?null:t.a11yLocale!==void 0?new tt(t.a11yLocale):new tt}function Ni(){}function _i(t){if(typeof t!="object"||t===null||!("root"in t))return!1;let e=t.root;return typeof e!="object"||e===null?!1:Array.isArray(e.children)}function Ci(...t){typeof console<"u"&&typeof console.warn=="function"&&console.warn(...t)}function Oi(t){if(typeof window>"u")return;let e=[];window.parent!==window&&e.push(window.parent),window.opener instanceof Window&&e.push(window.opener),Ue.sendReady(e,t)}var mr=new Set(["__proto__","prototype","constructor"]),Pi=new Set(["id","_id","createdAt","updatedAt","createdBy","updatedBy","_status","globalType","collection","locale","localized"]);function Fi(t){return t==null?!1:typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"}function Di(t,e){if(!e)return t;let n=`_${e}`;return t.endsWith(n)?t.slice(0,-n.length):t}function $i(t,e,n){let r=nr(t,e);if(r!==void 0)return r;if(e.includes(".")){let o=e.split("."),s=t;for(let a of o){if(mr.has(a)||s===null||typeof s!="object")return;s=s[a]}if(s!==void 0)return s}if(n!==void 0){let o=nr(t,`${e}_${n}`);if(o!==void 0)return o}}function nr(t,e){if(!mr.has(e)&&Object.prototype.hasOwnProperty.call(t,e))return t[e]}function Ui(t){return t.tagName==="INPUT"||t.tagName==="TEXTAREA"?t.value:t.tagName==="IMG"?t.src:t.textContent}function dt(){if(typeof window>"u")return!1;try{return window.self!==window.top}catch{return!0}}function qt(){return typeof window>"u"?!1:window.opener!=null}function Kt(){return dt()||qt()}function hr(){let t=Hi();if(t!==void 0)return t!=="production";let e=Bi();if(e!==void 0)return e;if(typeof window<"u"){let n=window.location.hostname;if(n==="localhost"||n==="127.0.0.1")return!0}return!1}function yr(t){if(typeof process<"u"){let n=process.env[t];if(typeof n=="string"&&n.length>0)return n}let e=void 0;if(e){let n=e[t];if(typeof n=="string"&&n.length>0)return n}}function Hi(){if(typeof process>"u")return;let t="production";return typeof t=="string"?t:void 0}function Bi(){let t=void 0;if(!t)return;let e=t.DEV;return typeof e=="boolean"?e:void 0}var ji=/^https?:\\/\\/(localhost|127\\.0\\.0\\.1)(?::\\d+)?$/i,Vi=/^https?:\\/\\/[^/?#\\s]+$/i,zi=["PAYLOAD_ADMIN_ORIGIN","PUBLIC_PAYLOAD_ADMIN_ORIGIN","NEXT_PUBLIC_PAYLOAD_ADMIN_ORIGIN"],j,V,ae,lt,P,Mt=class{constructor(e={}){l(this,j);l(this,V);l(this,ae);l(this,lt);l(this,P);let n=new Set;for(let a of e.additionalOrigins??[]){let u=gr(a);u!==void 0&&n.add(u)}for(let a of zi){let u=yr(a);if(u!==void 0)for(let m of u.split(",")){let w=gr(m);w!==void 0&&n.add(w)}}d(this,j,n);let r=e.enableReferrerDetection??!0,o;if(r){let a=e.referrer??(typeof document<"u"?document.referrer:"");if(a.length>0)try{let u=new URL(a).origin;u&&u!=="null"&&(o=u)}catch{}}d(this,V,o),d(this,lt,o!==void 0);let s=(e.enableLocalhostMatching??!0)&&(e.forceDevMode??hr());d(this,ae,s)}matches(e){return e.length===0||e==="null"?!1:i(this,P)!==void 0?e===i(this,P):!!(i(this,j).has(e)||i(this,j).size===0&&i(this,V)!==void 0&&e===i(this,V)||i(this,ae)&&ji.test(e))}lockOrigin(e){return this.matches(e)?(d(this,P,e),!0):!1}unlockOrigin(){let e=i(this,P);return d(this,P,void 0),e}get lockedOrigin(){return i(this,P)}enumerate(){if(i(this,P)!==void 0)return[i(this,P)];let e=new Set(i(this,j));if(i(this,j).size===0&&i(this,V)!==void 0&&e.add(i(this,V)),i(this,ae))for(let n of Gi)e.add(`http://localhost:${String(n)}`),e.add(`http://127.0.0.1:${String(n)}`);return[...e]}get referrerWasAvailable(){return i(this,lt)}get isProductionUnconfigured(){return!(!dt()||i(this,j).size>0||i(this,ae)||i(this,V)!==void 0)}get isReferrerOnlyTrust(){return i(this,j).size>0||i(this,ae)?!1:i(this,V)!==void 0}};j=new WeakMap,V=new WeakMap,ae=new WeakMap,lt=new WeakMap,P=new WeakMap;var Gi=[3e3,3001,3333,4e3,4321,5e3,5173,5174,8e3,8080,8888,9e3];function gr(t){let e=t.trim();if(e.length!==0)try{let n=new URL(e);return n.protocol!=="http:"&&n.protocol!=="https:"||!Vi.test(n.origin)?void 0:n.origin}catch{return}}var br={name:"payload-live-preview",version:"1.0.1",description:"Framework-agnostic live preview for Payload CMS \\u2014 Astro-first; works with Next.js, SvelteKit, Nuxt, and plain HTML.",author:"relative23",license:"MIT",type:"module",main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{import:{types:"./dist/index.d.ts",default:"./dist/index.js"},require:{types:"./dist/index.d.cts",default:"./dist/index.cjs"}},"./core":{import:{types:"./dist/core.d.ts",default:"./dist/core.js"},require:{types:"./dist/core.d.cts",default:"./dist/core.cjs"}},"./astro":{import:{types:"./dist/adapters/astro/index.d.ts",default:"./dist/adapters/astro/index.js"}},"./nextjs":{import:{types:"./dist/adapters/nextjs/index.d.ts",default:"./dist/adapters/nextjs/index.js"}},"./sveltekit":{import:{types:"./dist/adapters/sveltekit/index.d.ts",default:"./dist/adapters/sveltekit/index.js"}},"./nuxt":{import:{types:"./dist/adapters/nuxt/index.d.ts",default:"./dist/adapters/nuxt/index.js"}},"./codegen":{import:{types:"./dist/codegen.d.ts",default:"./dist/codegen.js"},require:{types:"./dist/codegen.d.cts",default:"./dist/codegen.cjs"}},"./codegen/astro":{import:{types:"./dist/codegen-astro.d.ts",default:"./dist/codegen-astro.js"}},"./payload":{import:{types:"./dist/payload.d.ts",default:"./dist/payload.js"},require:{types:"./dist/payload.d.cts",default:"./dist/payload.cjs"}},"./astro/RichText.astro":"./dist/adapters/astro/RichText.astro","./astro/middleware-entry":{import:{types:"./dist/adapters/astro/middleware-entry.d.ts",default:"./dist/adapters/astro/middleware-entry.js"}}},bin:{"pll-codegen":"./dist/codegen-cli.js"},files:["dist","README.md","LICENSE"],sideEffects:!1,scripts:{prepare:"npm run build:runtime","build:runtime":"tsx scripts/build-runtime.ts",build:"npm run build:runtime && tsup && npm run build:assets","build:assets":`node -e "require(\'node:fs\').copyFileSync(\'src/adapters/astro/RichText.astro\',\'dist/adapters/astro/RichText.astro\')"`,dev:"tsup --watch",test:"vitest run","test:watch":"vitest","test:unit":"vitest run tests/unit","test:integration":"vitest run tests/integration","test:e2e":"playwright test","test:bench":"vitest bench tests/benchmarks","test:coverage":"vitest run --coverage",typecheck:"tsc --noEmit",lint:"eslint .","lint:fix":"eslint . --fix",format:\'prettier --write "src/**/*.ts" "tests/**/*.ts"\',"format:check":\'prettier --check "src/**/*.ts" "tests/**/*.ts"\',check:"npm run typecheck && npm run lint && npm run test",prepublishOnly:"npm run check && npm run build",changeset:"changeset",version:"changeset version",release:"npm run build && changeset publish"},devDependencies:{"@changesets/cli":"^2.31.0","@eslint/js":"^10.0.1","@playwright/test":"^1.61.1","@types/node":"^22.20.1","@vitest/coverage-v8":"^4.1.10",esbuild:"^0.28.1",eslint:"^10.7.0",globals:"^17.7.0",jsdom:"^29.1.1",prettier:"^3.9.5","ts-morph":"^28.0.0",tsup:"^8.5.1",tsx:"^4.23.0",typescript:"^5.9.3","typescript-eslint":"^8.63.0",vitest:"^4.1.10"},keywords:["payload","payload-cms","payload-live-preview","live-preview","cms","headless","astro","nextjs","sveltekit","nuxt","vue","svelte","schema-driven","lexical","csp-safe","framework-agnostic"],peerDependencies:{astro:">=4.0.0 <8.0.0","ts-morph":"^28.0.0"},peerDependenciesMeta:{astro:{optional:!0},"ts-morph":{optional:!0}},engines:{node:">=20.19.0"},publishConfig:{access:"public",provenance:!0},repository:{type:"git",url:"https://github.com/relative23/payload-live-preview.git"},bugs:{url:"https://github.com/relative23/payload-live-preview/issues"},homepage:"https://github.com/relative23/payload-live-preview#readme"};var Rr=br.version;var Xt=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"]),wr=new Set(["script","style","iframe","object","embed","link","meta","base","form","input","button","select","textarea","svg","math","template","frame","frameset","noframes","noscript"]),xr=new Set(["id","class","lang","dir","title","role","tabindex"]),Yi="aria-",qi="data-",Jt={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"])},vr=new Set(["href","src","cite","poster"]),Zt=class extends Error{constructor(){super(...arguments);$n(this,"name","SanitizerEnvironmentError")}};function Ki(t){if(!t){let r=new Map;for(let[o,s]of Object.entries(Jt))r.set(o,s);return{allowedTags:Xt,attrByTag:r}}let e=new Set(Xt);for(let r of t.additionalAllowedTags??[])e.add(r);let n=new Map;for(let[r,o]of Object.entries(Jt))n.set(r,o);for(let[r,o]of Object.entries(t.additionalAllowedAttributes??{})){let s=n.get(r),a=new Set(s??[]);for(let u of o)a.add(u);n.set(r,a)}return{allowedTags:e,attrByTag:n}}var Tr;function z(t,e){let n=Er();if(!n)throw new Zt("sanitizeHtml requires a DOM. Inject one via setSanitizerDocument() for SSR (linkedom, jsdom, happy-dom, \\u2026) or use the plain-text path on the server.");if(t==="")return"";let r=Ki(e),o=n.createElement("template");return o.innerHTML=t,Qt(o.content,r),o.innerHTML}function Er(){if(Tr)return Tr;if(!(typeof document>"u"))return document}function kr(){return Er()!==void 0}function Qt(t,e){for(let n of Array.from(t.childNodes))n.nodeType===Node.ELEMENT_NODE?Xi(n,e):n.nodeType===Node.COMMENT_NODE&&n.remove()}function Xi(t,e){let n=t.tagName.toLowerCase();if(wr.has(n)){t.remove();return}if(!e.allowedTags.has(n)){Qt(t,e);let r=t.parentNode;if(r){for(;t.firstChild;)r.insertBefore(t.firstChild,t);t.remove()}return}Ji(t,n,e),n==="a"&&Qi(t),Qt(t,e)}function Ji(t,e,n){let r=n.attrByTag.get(e);for(let o of Array.from(t.attributes)){let s=o.name.toLowerCase();if(s.startsWith("on")){t.removeAttribute(o.name);continue}if(s==="style"){t.removeAttribute(o.name);continue}if(!(xr.has(s)||s.startsWith(Yi)||s.startsWith(qi))){if(r?.has(s)){(vr.has(s)&&!R(o.value)||s==="srcset"&&!Zi(o.value))&&t.removeAttribute(o.name);continue}t.removeAttribute(o.name)}}}function Zi(t){let e=t.split(",");for(let n of e){let r=n.trim();if(r.length===0)continue;let o=r.split(/\\s+/,1)[0];if(o===void 0||o.length===0||!R(o))return!1}return!0}function Qi(t){let e=t.getAttribute("href");e&&kt(e)&&(t.setAttribute("rel","noopener noreferrer"),t.hasAttribute("target")||t.setAttribute("target","_blank"))}var Ws=Object.freeze({allowedTags:Xt,removeCompletely:wr,globalAttributes:xr,attributesByTag:Jt,urlAttributes:vr});var Sr=new Map;function p(t,e){Sr.set(t,e)}function Ar(t){return Sr.get(t)}var eo={1:"left",2:"center",3:"right",4:"justify"},to=new Set(["left","center","right","justify","start","end"]);function en(t){let e=t.format;if(typeof e=="string"&&to.has(e))return e;if(typeof e=="number"){let n=eo[e];if(n!==void 0)return n}}function tn(t){let e=t.indent;return typeof e=="number"&&e>0?e:0}function Q(t){return t.direction==="rtl"?\' dir="rtl"\':t.direction==="ltr"?\' dir="ltr"\':""}function G(t){let e=en(t),n=tn(t),r=[];return e!==void 0&&r.push(`text-align:${e}`),n>0&&r.push(`padding-inline-start:${String(n*40)}px`),r.length===0?"":` style="${r.join(";")}"`}var no=Object.freeze({"&":"&","<":"<",">":">",\'"\':""","\'":"'","/":"/","`":"`","=":"="}),ro=/[&<>"\'/`=]/g;function g(t){return t===""?"":t.replace(ro,e=>no[e])}function Lr(t){return t.replace(/[\'"()\\\\]/g,"\\\\$&")}var io=Object.freeze({"&":"&","<":"<",">":">",\'"\':""","\'":"'"}),oo=/[&<>"\']/g;function L(t){return t===""?"":t.replace(oo,e=>io[e])}function It(t){return g(t).replace(/\\r\\n|\\r|\\n/g,"<br>")}var ee={BOLD:1,ITALIC:2,STRIKETHROUGH:4,UNDERLINE:8,CODE:16,SUBSCRIPT:32,SUPERSCRIPT:64,HIGHLIGHT:128};var nn=t=>{let e=typeof t.text=="string"?t.text:"",n=g(e),r=typeof t.format=="number"?t.format:0;return(r&ee.CODE)!==0&&(n=`<code>${n}</code>`),(r&ee.BOLD)!==0&&(n=`<strong>${n}</strong>`),(r&ee.ITALIC)!==0&&(n=`<em>${n}</em>`),(r&ee.UNDERLINE)!==0&&(n=`<u>${n}</u>`),(r&ee.STRIKETHROUGH)!==0&&(n=`<s>${n}</s>`),(r&ee.SUBSCRIPT)!==0&&(n=`<sub>${n}</sub>`),(r&ee.SUPERSCRIPT)!==0&&(n=`<sup>${n}</sup>`),(r&ee.HIGHLIGHT)!==0&&(n=`<mark>${n}</mark>`),n};p("text",nn);var rn=(t,e)=>{let n=e.renderChildren(t.children??[]);return`<p${Q(t)}${G(t)}>${n}</p>`};p("paragraph",rn);var so=new Set(["h1","h2","h3","h4","h5","h6"]),on=(t,e)=>{let n=typeof t.tag=="string"?t.tag.toLowerCase():"h2",r=so.has(n)?n:"h2",o=e.renderChildren(t.children??[]);return`<${r}${Q(t)}${G(t)}>${o}</${r}>`};p("heading",on);var sn=(t,e)=>{let n=typeof t.listType=="string"?t.listType:"bullet",r=n==="number"?"ol":"ul",o=n==="number"&&typeof t.start=="number"&&t.start>1?` start="${String(t.start)}"`:"",s=n==="check"?\' role="list"\':"",a=e.renderChildren(t.children??[]);return`<${r}${Q(t)}${G(t)}${o}${s}>${a}</${r}>`},an=(t,e)=>{let n=e.renderChildren(t.children??[]);if(typeof t.checked=="boolean")return`<li role="checkbox" aria-checked="${t.checked?"true":"false"}"${G(t)}>${n}</li>`;let r=typeof t.value=="number"?` value="${g(String(t.value))}"`:"";return`<li${Q(t)}${G(t)}${r}>${n}</li>`};p("list",sn);p("listitem",an);var ut=(t,e)=>{let n=typeof t.url=="string"?t.url:"",r=e.renderChildren(t.children??[]);if(n.length===0||!R(n))return r;let o=kt(n)?\' target="_blank" rel="noopener noreferrer"\':ao(t),s=typeof t.title=="string"?` title="${g(t.title)}"`:"";return`<a href="${L(n)}"${o}${s}>${r}</a>`};function ao(t){let e=typeof t.target=="string"?t.target:"";if(e.length===0)return"";let n=g(e);return e==="_blank"?\' target="_blank" rel="noopener noreferrer"\':` target="${n}"`}p("link",ut);p("autolink",ut);var dn=(t,e)=>{let n=e.renderChildren(t.children??[]);return`<blockquote${Q(t)}${G(t)}>${n}</blockquote>`};p("quote",dn);var ln=t=>{let e=Ir(typeof t.language=="string"?t.language:""),n=Mr(t);return`<pre><code${e===""?"":` class="language-${e}"`}>${g(n)}</code></pre>`},un=t=>{let e=typeof t.text=="string"?t.text:"";return`<span${typeof t.highlightType=="string"?` class="token-${Ir(t.highlightType)}"`:""}>${g(e)}</span>`};p("code",ln);p("code-highlight",un);function Mr(t){if(typeof t.text=="string")return t.text;if(!t.children)return"";let e="";for(let n of t.children)e+=Mr(n);return e}function Ir(t){return t.replace(/[^a-zA-Z0-9_-]/g,"")}var cn=()=>"<br>",fn=()=>"<hr>",pn=()=>" ";p("linebreak",cn);p("horizontalrule",fn);p("tab",pn);var mn=t=>{let e=lo(t);if(e===void 0)return"";let n=e.url;if(typeof n!="string"||!R(n))return"";let r=typeof e.mimeType=="string"?e.mimeType:"";return r.startsWith("video/")?co(e,n):r.startsWith("audio/")?fo(e,n):r===""||r.startsWith("image/")?uo(e,n):po(e,n)};p("upload",mn);function lo(t){let e=t.value;if(!(typeof e!="object"||e===null))return e}function uo(t,e){let n=typeof t.alt=="string"?g(t.alt):"",r=typeof t.width=="number"?` width="${String(t.width)}"`:"",o=typeof t.height=="number"?` height="${String(t.height)}"`:"";return`<img src="${L(e)}" alt="${n}"${r}${o} loading="lazy" decoding="async">`}function co(t,e){let n=typeof t.width=="number"?` width="${String(t.width)}"`:"",r=typeof t.height=="number"?` height="${String(t.height)}"`:"",o=typeof t.mimeType=="string"?` type="${L(t.mimeType)}"`:"";return`<video controls${n}${r}><source src="${L(e)}"${o}></video>`}function fo(t,e){let n=typeof t.mimeType=="string"?` type="${L(t.mimeType)}"`:"";return`<audio controls><source src="${L(e)}"${n}></audio>`}function po(t,e){let n=typeof t.filename=="string"?g(t.filename):g(e);return`<a href="${L(e)}" target="_blank" rel="noopener noreferrer">${n}</a>`}var hn=t=>{let e=typeof t.relationTo=="string"?t.relationTo:"",n=mo(t),r=ho(n,e),o=g(r),s=e===""?"":` data-relation-to="${g(e)}"`,a=n?.url;return typeof a=="string"&&R(a)?`<a href="${L(a)}"${s}>${o}</a>`:`<span${s}>${o}</span>`};p("relationship",hn);function mo(t){let e=t.value;if(!(typeof e!="object"||e===null))return e}function ho(t,e){return t===void 0?e===""?"#":`#${e}`:typeof t.title=="string"&&t.title.length>0?t.title:typeof t.name=="string"&&t.name.length>0?t.name:typeof t.slug=="string"&&t.slug.length>0?t.slug:t.id!==void 0?String(t.id):e===""?"#":`#${e}`}var yo=new Map;function yn(t){return yo.get(t)}var gn=(t,e)=>{let n=go(t),r=typeof n.blockType=="string"?n.blockType:"",o=Nr(r);if(r!==""){let u=yn(r)??yn(o);if(u)return u(n,{renderChildren:e.renderChildren})}let s=[];o!==""&&s.push(`data-block-type="${g(o)}"`);for(let[u,m]of Object.entries(n)){if(u==="blockType"||u==="id"||m==null)continue;let w=typeof m=="string"||typeof m=="number"||typeof m=="boolean"?String(m):JSON.stringify(m);s.push(`data-block-${Nr(u)}="${g(w)}"`)}return`<div${s.length===0?"":` ${s.join(" ")}`}></div>`};p("block",gn);function go(t){let e=t.fields;return typeof e!="object"||e===null?{}:e}function Nr(t){return t.replace(/[^a-zA-Z0-9_-]/g,"-").toLowerCase()}p("text",nn);p("paragraph",rn);p("heading",on);p("list",sn);p("listitem",an);p("link",ut);p("autolink",ut);p("quote",dn);p("code",ln);p("code-highlight",un);p("linebreak",cn);p("horizontalrule",fn);p("tab",pn);p("upload",mn);p("relationship",hn);p("block",gn);var bo={renderChildren:bn,resolveAlignment:en,resolveIndent:tn};function de(t){if(typeof t!="object"||t===null||!("root"in t))return!1;let e=t.root;return typeof e!="object"||e===null||!("children"in e)?!1:Array.isArray(e.children)}function _r(t,e={}){if(!de(t))return"";let n=bn(t.root.children);return e.sanitize===!1||!kr()?n:z(n)}function Nt(t){return de(t)?t.root.children.map(Cr).join(`\n`).trim():""}function bn(t){let e="";for(let n of t)e+=Ro(n);return e}function Ro(t){let e=Ar(t.type);return e?e(t,bo):t.children!==void 0?bn(t.children):""}function Cr(t){if(typeof t.text=="string")return t.text;if(t.type==="linebreak")return`\n`;if(t.children===void 0)return"";let e="";for(let n of t.children)e+=Cr(n);return e}var Rn=new Map;function Or(t=[]){for(let n of t)Rn.set(n.name,n);let e={};for(let[n,r]of Rn)e[n]=r;return Object.freeze(e)}function y(t){Rn.set(t.name,t)}var To="data-payload-text",Pr=new WeakSet,Tn={name:"text",render(t,e){let n=t.element,r=vo(e);if(n.tagName==="INPUT"||n.tagName==="TEXTAREA"){n.value=r;return}if(wo(n)&&!n.hasAttribute(To)){xo(n,t.fieldName);return}if(r.includes(`\n`)||r.includes("\\r")){n.innerHTML=It(r);return}n.textContent=r}};function wo(t){return t.firstElementChild!==null}function xo(t,e){Pr.has(t)||(Pr.add(t),console.warn(`[live-preview] Skipping text update for "${e}" \\u2014 the bound <${t.tagName.toLowerCase()}> has structured child elements. Either move data-payload-field to the element whose textContent is the field value, or opt in with data-payload-text to replace the structure.`))}function vo(t){return t==null?"":de(t)?Nt(t):typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):JSON.stringify(t)}y(Tn);function T(t){if(t==null)return"";if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint")return String(t);try{return JSON.stringify(t)}catch{return""}}var wn={name:"textarea",render(t,e){let n=t.element,r=de(e)?Nt(e):T(e);if(n.tagName==="INPUT"||n.tagName==="TEXTAREA"){n.value=r;return}n.innerHTML=It(r)}};y(wn);var xn={name:"richText",render(t,e){if(de(e)){t.element.innerHTML=_r(e);return}typeof e=="string"&&(t.element.innerHTML=z(e))}};y(xn);var vn={name:"html",render(t,e){if(e==null){t.element.textContent="";return}let n=typeof e=="string"?e:T(e);t.element.innerHTML=z(n)}};y(vn);var ct={name:"url",render(t,e,n){let r=t.element,o=T(e);if(r.tagName==="A"){let s=r,a=t.hrefField,u=a?n.allFields[a]:e;typeof u=="string"&&R(u)&&(s.href=u),s.textContent=o;return}if(r.tagName==="INPUT"||r.tagName==="TEXTAREA"){r.value=o;return}r.textContent=o}};y(ct);y({...ct,name:"email"});var En={name:"image",render(t,e,n){let r=t.element,o=Eo(e),s=ko(o,e);if(s!==void 0){if(r.tagName==="IMG"){let a=r;a.src=s;let u=So(o,t.altField,n.allFields);u!==void 0&&(a.alt=u);return}r.style.backgroundImage=`url(\'${Lr(s)}\')`}}};function Eo(t){if(!(typeof t!="object"||t===null))return t}function ko(t,e){if(t?.url!==void 0&&R(t.url))return t.url;if(typeof e=="string"&&R(e))return e}function So(t,e,n){if(t?.alt!==void 0)return t.alt;if(e!==void 0){let r=n[e];if(typeof r=="string")return r}}y(En);var kn={name:"upload",render(t,e){let n=t.element,r=Ao(e);if(r===void 0)return;let o=r.url;if(typeof o!="string"||!R(o))return;if(n.tagName==="IMG"){let a=n;a.src=o,r.alt!==void 0&&(a.alt=r.alt);return}if(n.tagName==="A"){let a=n;a.href=o,a.textContent=r.filename??o;return}let s=r.filename!==void 0?g(r.filename):g(o);n.innerHTML=`<a href="${L(o)}">${s}</a>`}};function Ao(t){if(!(typeof t!="object"||t===null))return t}y(kn);var Sn={name:"relationship",render(t,e){let n=t.element,o=Lo(e).join(", ");if(n.tagName==="A"&&!Array.isArray(e)){let s=n,a=e?.url;typeof a=="string"&&R(a)&&(s.href=a),s.textContent=o;return}n.textContent=o}};function Lo(t){return t==null?[""]:Array.isArray(t)?t.map(Fr):[Fr(t)]}function Fr(t){if(typeof t=="object"&&t!==null){let e=t;return typeof e.title=="string"&&e.title.length>0?e.title:typeof e.name=="string"&&e.name.length>0?e.name:typeof e.slug=="string"&&e.slug.length>0?e.slug:e.id!==void 0?String(e.id):""}return T(t)}y(Sn);var ft={name:"select",render(t,e){let n=t.element,r=Dr(e);if(n.tagName==="SELECT"){n.value=r;return}if(n.tagName==="INPUT"&&n.type==="radio"){let o=n;o.checked=o.value===r;return}n.textContent=r}};function Dr(t){return Array.isArray(t)?t.map(e=>Dr(e)).join(", "):T(t)}y(ft);y({...ft,name:"radio"});var An={name:"checkbox",render(t,e){let n=t.element,r=!!e;if(n.tagName==="INPUT"&&n.type==="checkbox"){n.checked=r;return}if(n.hasAttribute("aria-checked")){n.setAttribute("aria-checked",r?"true":"false");return}n.textContent=r?"true":"false"}};y(An);var pt=new Map,mt=new Map,Mo=64,Io=Mo;function $r(t,e){let n=Hr(t,e),r=pt.get(n);if(r!==void 0)return pt.delete(n),pt.set(n,r),r;let o=new Intl.NumberFormat(t,e);return pt.set(n,o),Br(pt),o}function Ur(t,e){let n=Hr(t,e),r=mt.get(n);if(r!==void 0)return mt.delete(n),mt.set(n,r),r;let o=new Intl.DateTimeFormat(t,e);return mt.set(n,o),Br(mt),o}function Hr(t,e){let n=t??"";if(e==null)return n;let r=Ln(e);return r==="{}"?n:`${n}|${r}`}function Ln(t){if(t===null||typeof t!="object")return JSON.stringify(t);if(Array.isArray(t))return`[${t.map(o=>Ln(o)).join(",")}]`;let e=t,n=Object.keys(e).sort(),r=[];for(let o of n){let s=e[o];s!==void 0&&r.push(`${JSON.stringify(o)}:${Ln(s)}`)}return`{${r.join(",")}}`}function Br(t){for(;t.size>Io;){let e=t.keys().next().value;if(e===void 0)break;t.delete(e)}}var Mn={name:"date",render(t,e,n){let r=t.element;if(e==null||e===""){r.tagName==="INPUT"?r.value="":(r.tagName==="TIME"&&r.removeAttribute("datetime"),r.textContent="");return}let o=typeof e=="string"?e:T(e),s=new Date(o),a=!Number.isNaN(s.getTime());if(r.tagName==="INPUT"){r.value=a?No(r.type,s):o;return}if(r.tagName==="TIME"){r.setAttribute("datetime",a?s.toISOString():o),r.textContent=a?jr(s,n):o;return}r.textContent=a?jr(s,n):o}};function jr(t,e){let n=e.locale??Le();try{return Ur(n,{dateStyle:"medium",timeStyle:"short"}).format(t)}catch{return t.toISOString()}}function No(t,e){return t==="date"?e.toISOString().slice(0,10):t==="datetime-local"?e.toISOString().slice(0,16):e.toISOString()}y(Mn);var In={name:"number",render(t,e,n){let r=t.element;if(e==null||e===""){r.tagName==="INPUT"?r.value="":r.textContent="";return}let o=typeof e=="number"?e:Number(T(e));if(Number.isNaN(o)){r.textContent=T(e);return}if(r.tagName==="INPUT"){r.value=String(o);return}r.textContent=_o(o,n)}};function _o(t,e){let n=e.locale??Le();try{return $r(n).format(t)}catch{return String(t)}}y(In);var ht={name:"array",render(t,e){let n=t.element;if(!Array.isArray(e))return;let r=t.arrayTemplate;if(r!==void 0&&r.length>0){let s=Co(r,e);n.innerHTML=z(s);return}let o=t.arraySeparator??", ";n.textContent=e.map(Fo).join(o)}};function Co(t,e){let n="";for(let r=0;r<e.length;r+=1)n+=Oo(t,e[r],r);return n}function Oo(t,e,n){let r=t;if(typeof e=="object"&&e!==null)for(let[o,s]of Object.entries(e)){let a=new RegExp(`\\\\{\\\\{${Po(o)}\\\\}\\\\}`,"g");r=r.replace(a,g(T(s)))}else r=r.replace(/\\{\\{value\\}\\}/g,g(T(e)));return r=r.replace(/\\{\\{index\\}\\}/g,String(n)),r}function Po(t){return t.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function Fo(t){return T(t)}y(ht);y({...ht,name:"blocks"});function Do(){return typeof document>"u"?!1:typeof document.startViewTransition=="function"}async function Vr(t){if(!Do()){t();return}let n=document.startViewTransition.call(document,t);try{await n.finished}catch{}}var Yr="data-payload-key",yt="data-payload-nested-key",Cn="data-payload-nested-template",zr=new WeakMap;function Ct(t){let{template:e,container:n,patches:r}=t,o=Uo(n),s=[],a=[],u=[],m=[],w=[];for(let c of r)c.kind==="remove"?s.push(c):c.kind==="insert"?a.push(c):c.kind==="move"?u.push(c):c.kind==="update"?m.push(c):w.push(c);s.sort((c,b)=>_t(b)-_t(c));for(let c of s){if(c.kind!=="remove")continue;n.children[c.index]?.remove(),Ho(o,c.value)}for(let c of w){if(c.kind!=="replace")continue;let b=n.children[c.index],x=_n(e,c.value,c.index);!b||!x||(Gr(x,c.value),n.replaceChild(x,b),Nn(o,c.value))}for(let c of m){if(c.kind!=="update")continue;let b=n.children[c.index],x=_n(e,c.value,c.index);!b||!x||($o(b,x,c.value,o),n.replaceChild(x,b),Nn(o,c.value))}a.sort((c,b)=>_t(c)-_t(b));for(let c of a){if(c.kind!=="insert")continue;let b=n.children[c.index]??null,x=_n(e,c.value,c.index);x&&(Gr(x,c.value),n.insertBefore(x,b),Nn(o,c.value))}for(let c of u){if(c.kind!=="move")continue;let b=gt(c.value),x=b!==void 0?Bo(n,b):null;if(!x)continue;let Fe=n.children[c.to]??null;x!==Fe&&n.insertBefore(x,Fe)}}function Gr(t,e){let n=t.querySelectorAll(`[${yt}]`);for(let r of Array.from(n)){let o=r.getAttribute(yt);if(o===null)continue;let s=r.getAttribute(Cn);if(!s)continue;let a=On(e,o);if(a===void 0)continue;let u=rt([],a);u.length!==0&&Ct({template:s,container:r,patches:u,nextItems:a})}}function $o(t,e,n,r){let o=t.querySelectorAll(`[${yt}]`);if(o.length===0)return;let s=gt(n),a=s!==void 0?r.get(s):void 0;for(let u of Array.from(o)){let m=u.getAttribute(yt);if(m===null)continue;let w=e.querySelector(`[${yt}="${qr(m)}"]`);if(!w)continue;w.replaceWith(u);let c=u.getAttribute(Cn)??w.getAttribute(Cn);if(!c)continue;let b=On(n,m)??[],x=On(a,m)??[],Fe=rt(x,b);Fe.length!==0&&Ct({template:c,container:u,patches:Fe,nextItems:b})}}function On(t,e){if(typeof t!="object"||t===null)return;let n=t[e];if(Array.isArray(n))return n}function Uo(t){let e=zr.get(t);return e||(e=new Map,zr.set(t,e)),e}function Nn(t,e){let n=gt(e);n!==void 0&&t.set(n,e)}function Ho(t,e){let n=gt(e);n!==void 0&&t.delete(n)}function _t(t){return t.kind==="move"?t.to:t.index}function gt(t){if(typeof t!="object"||t===null)return;let e=t.id;if(typeof e=="string"||typeof e=="number")return String(e)}function Bo(t,e){return t.querySelector(`[${Yr}="${qr(e)}"]`)}function qr(t){let e=globalThis.CSS;return e?.escape?e.escape(t):t.replace(/[^a-zA-Z0-9_-]/g,"\\\\$&")}function _n(t,e,n){if(typeof document>"u")return null;let r=jo(t,e,n),o=z(r),s=document.createElement("template");s.innerHTML=o;let a=s.content.firstElementChild;if(!a)return null;let u=gt(e);return u!==void 0&&a.setAttribute(Yr,u),a}function jo(t,e,n){let r=t;if(typeof e=="object"&&e!==null)for(let[o,s]of Object.entries(e)){let a=new RegExp(`\\\\{\\\\{${Vo(o)}\\\\}\\\\}`,"g"),u=g(Wr(s));r=r.replace(a,()=>u)}else{let o=g(Wr(e));r=r.replace(/\\{\\{value\\}\\}/g,()=>o)}return r.replace(/\\{\\{index\\}\\}/g,String(n))}function Wr(t){return t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):JSON.stringify(t)}function Vo(t){return t.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}var Pn=new WeakMap,Kr=new WeakSet,Fn={name:"structural-array",render(t,e){if(!Array.isArray(e))return;let n=t.element,r=t.arrayTemplate;if(r===void 0||r.length===0){zo(n,t.fieldName);return}let o=Pn.get(n)??[],s=rt(o,e);if(s.length===0){Pn.set(n,e.slice());return}Vr(()=>{Ct({template:r,container:n,patches:s,nextItems:e})}),Pn.set(n,e.slice())}};function zo(t,e){Kr.has(t)||(Kr.add(t),console.warn(`[live-preview] Skipping structural update for "${e}" \\u2014 the <${t.tagName.toLowerCase()}> with data-payload-structural is missing data-payload-array-template. Add an inline template (e.g., data-payload-array-template="<li>{{label}}</li>") so the renderer can materialise new items.`))}y(Fn);var Go=[Tn,wn,xn,vn,ct,{...ct,name:"email"},En,kn,Sn,ft,{...ft,name:"radio"},An,Mn,In,ht,{...ht,name:"blocks"},Fn];function Xr(){return Or(Go)}function Wo(){if(typeof window>"u"||!Kt())return;let t=window.__livePreview;if(t!==void 0)return t;let e=Yo(),n=new Mt({additionalOrigins:e.additionalOrigins,enableReferrerDetection:!e.disableReferrerDetection,enableLocalhostMatching:!e.disableLocalhostMatching});n.isProductionUnconfigured?console.warn("[live-preview] No trusted origin could be detected. Set the PAYLOAD_ADMIN_ORIGIN env var or pass `allowedOrigins` to generateInlineScript()."):n.isReferrerOnlyTrust&&console.warn("[live-preview] Trusting the embedding page via document.referrer only \\u2014 any site that frames this page could post preview updates. Pass explicit `allowedOrigins` and serve a `frame-ancestors` CSP for production.");let r=new bt,o=Xr(),s=new Lt({renderers:o,originMatcher:u=>n.matches(u),readyTargets:n.enumerate(),emitter:r,...typeof e.serverURL=="string"&&e.serverURL!==""?{dataMerge:{serverURL:e.serverURL,...typeof e.apiRoute=="string"?{apiRoute:e.apiRoute}:{},...typeof e.mergeDepth=="number"?{depth:e.mergeDepth}:{}}}:{},debounceMs:e.debounceMs,heartbeatMs:e.heartbeatMs,intersectionRootMargin:e.intersectionRootMargin,disableVisibilityGate:e.disableVisibilityGate,visibilityGateThreshold:e.visibilityGateThreshold,enableA11y:e.enableA11y,onHeartbeatTimeout:()=>{n.unlockOrigin()},...e.debug?{log:(...u)=>{console.debug("[live-preview]",...u)}}:{}});r.on("connect",u=>{n.lockOrigin(u.origin)}),s.start();let a=Object.freeze({version:Rr,destroy:()=>{s.destroy()},refresh:()=>{s.refreshCache()},enumerateOrigins:()=>n.enumerate()});return Object.defineProperty(window,"__livePreview",{value:a,writable:!1,configurable:!0}),a}function Yo(){let t=typeof __LIVE_PREVIEW_CONFIG__>"u"?void 0:__LIVE_PREVIEW_CONFIG__;return t!==void 0?t:{additionalOrigins:[],serverURL:"",apiRoute:"/api",mergeDepth:1,debug:!1,debounceMs:50,enableA11y:!0,heartbeatMs:0,disableVisibilityGate:!1,visibilityGateThreshold:50,intersectionRootMargin:"200px",disableReferrerDetection:!1,disableLocalhostMatching:!1}}var qo=typeof __INLINE_BUILD__>"u"?!1:__INLINE_BUILD__;qo&&Wo();var Ol={isInIframe:dt,isInPopup:qt,isInPreviewContext:Kt};})();\n';
|
|
5
|
+
var RUNTIME_BUILD_INFO = { generatedAt: "2026-07-11T17:42:37.001Z"};
|
|
6
6
|
|
|
7
7
|
// src/inline/generator.ts
|
|
8
8
|
var DEFAULT_DEBOUNCE_MS = 50;
|