import"../chunks/DsnmJJEf.js";import{o as pa}from"../chunks/DukJHxi2.js";import{I as ha,J as va,b3 as ma,H as _a,p as wn,i as F,m as Ct,u as ft,g as e,j as n,d as o,r as s,s as c,t as Y,a as E,b as An,h as S,c as P,v as Lt,f as Ie,k as ba,o as ya,$ as xa,n as dr,e as cr,am as Sn,l as Ea}from"../chunks/krC2xWPP.js";import{d as Nn,a as ve,e as Ta,s as A}from"../chunks/CddAxf8c.js";import{i as j}from"../chunks/DjsWWzyL.js";import{B as wa}from"../chunks/BQul9OPN.js";import{b as In,s as rt,t as he,B as qt,r as dn,e as ur,i as fr,c as Aa}from"../chunks/Lvd_r9sp.js";import{h as cn}from"../chunks/DSIsCMt7.js";import{s as Re,h as Sa}from"../chunks/j_DJpx8B.js";import{b as Na}from"../chunks/ciapVzar.js";import{i as v,b as ze,c as St,a as Ia}from"../chunks/Cu5ilWky.js";import{p as Pa}from"../chunks/euuZp6ft.js";import{g as kt}from"../chunks/BVTiZ3e2.js";import{b as Gt}from"../chunks/BSopV7IU.js";import{g as _r,p as Or,d as un,u as Da,m as fn,e as Ma,f as La}from"../chunks/CuL3Sd6G.js";import{s as Oa,b as ka,c as Ga}from"../chunks/9iSIvZKf.js";import{i as Qt}from"../chunks/Lyt-zgeV.js";import{O as Ca,H as $a,J as br,K as Pn,M as Ht,P as Dn,Q as jt,R as Mn,S as Ln,T as On,U as kn,V as Gn,W as Cr,Y as Zt,X as gr,Z as Ra,_ as pr,$ as gn,a0 as Ua,a1 as hr,v as Ha,c as ja,s as Xa,h as Fa,a2 as Ba,a3 as pn,a4 as za,a5 as Va,B as Ja,a6 as hn,a7 as vn}from"../chunks/D7PIEGLR.js";import{B as Ya}from"../chunks/CkCDfBZD.js";import{L as Wa}from"../chunks/CB8cbqvK.js";import{C as Ka,a as qa,D as Qa}from"../chunks/nlum2O0L.js";import{c as x}from"../chunks/YfSC2Q4o.js";import{b as Za,M as es}from"../chunks/Dnp5jjtA.js";import{C as Cn}from"../chunks/ZWbUro-G.js";import{p as X}from"../chunks/BzvfRedh.js";import{c as ts}from"../chunks/CJohx04Q.js";import{c as rs,U as ns}from"../chunks/Cp407y3V.js";import{C as vr}from"../chunks/CqW2kplp.js";import{c as as}from"../chunks/CU9nfEd1.js";import{T as ss}from"../chunks/BXuqUDBl.js";import{S as os}from"../chunks/K87jKp17.js";import{C as is}from"../chunks/D8myH9Bl.js";import{c as ls}from"../chunks/CuDfWLaU.js";import{A as ds}from"../chunks/CsG_FdPZ.js";import{p as er}from"../chunks/DtMVEuno.js";import{a as cs}from"../chunks/DKn7_j4m.js";import{U as us,C as fs}from"../chunks/mRQytvOt.js";import{L as mn}from"../chunks/C_E2vM9U.js";import{C as gs}from"../chunks/Cv606Ht4.js";import{T as ps}from"../chunks/CSNyvbvN.js";import{L as kr}from"../chunks/DRNDWW4W.js";import{S as hs}from"../chunks/CV_JZMCk.js";import{E as vs}from"../chunks/CYnWUDOj.js";import{X as ms}from"../chunks/CiIMiELt.js";import{C as _s}from"../chunks/CurHnm4X.js";const bs=Symbol("NaN");function ys(p,t,d){ha&&va();var l=new wa(p),h=!ma();_a(()=>{var _=t();_!==_&&(_=bs),h&&_!==null&&typeof _=="object"&&(_={}),l.ensure(_,d)})}var xs=P('
');function Es(p,t){wn(t,!0);let d=F(Ct([])),l=F(!0);const h=S(()=>()=>{const B=t.route.split("/").filter(Boolean);return B.length<=1?"/":"/"+B.slice(0,-1).join("/")}),_=S(()=>e(d).findIndex(B=>B.route===t.route)),C=S(()=>e(_)>0?e(d)[e(_)-1]:null),a=S(()=>e(_)>=0&&e(_)e(h)()!=="/"),J=S(()=>t.hasChildren),ne=S(()=>v.dir==="rtl"?e(a):e(C)),oe=S(()=>v.dir==="rtl"?e(C):e(a)),Pe=S(()=>e(ne)!==null),Ae=S(()=>e(oe)!==null),De=S(()=>v.dir==="rtl"?"Next":"Previous"),Ve=S(()=>v.dir==="rtl"?"Previous":"Next");ft(()=>{const B=e(h)();n(l,!0),_r(B,"default","asc",x.activeLang||void 0).then(Ye=>{n(d,Ye,!0),n(l,!1)}).catch(()=>{n(d,[],!0),n(l,!1)})});function Je(B){kt(`${Gt}/pages/edit${B}`)}async function gt(){if(t.hasChildren)try{const B=await _r(t.route,"default","asc",x.activeLang||void 0);B.length>0&&Je(Or(B[0]))}catch{}}const te="grav_admin_navigator_pos";let U=F(!1),W=F(Ct(m())),K={x:0,y:0,px:0,py:0};function m(){try{const B=localStorage.getItem(te);return B?JSON.parse(B):{x:0,y:0}}catch{return{x:0,y:0}}}function L(){localStorage.setItem(te,JSON.stringify(e(W)))}function D(B){B.target.closest("button")||(n(U,!0),K={x:B.clientX,y:B.clientY,px:e(W).x,py:e(W).y},B.target.setPointerCapture(B.pointerId))}function M(B){e(U)&&n(W,{x:K.px+(B.clientX-K.x),y:K.py+(B.clientY-K.y)},!0)}function O(){n(U,!1),L()}var I=xs(),q=o(I),fe=o(q),_t=o(fe);Za(_t,{size:22,strokeWidth:2.5}),s(fe);var xe=c(fe,2),ie=o(xe);Cn(ie,{size:22,strokeWidth:2.5}),s(xe);var me=c(xe,2),Me=o(me);Ka(Me,{size:22,strokeWidth:2.5}),s(me);var Ee=c(me,2),rr=o(Ee);qa(rr,{size:22,strokeWidth:2.5}),s(Ee);var nt=c(Ee,4);s(q),s(I),Y((B,Ye,bt)=>{In(I,`bottom: ${80-e(W).y}px; inset-inline-end: ${80-e(W).x}px;`),Re(fe,1,`nav-quadrant nav-up ${e(T)?"":"nav-disabled"}`,"svelte-8lc2nr"),fe.disabled=!e(T),rt(fe,"title",B),Re(xe,1,`nav-quadrant nav-down ${e(J)?"":"nav-disabled"}`,"svelte-8lc2nr"),xe.disabled=!e(J),rt(xe,"title",e(J)?"First child":"No children"),Re(me,1,`nav-quadrant nav-left ${e(Pe)?"":"nav-disabled"}`,"svelte-8lc2nr"),me.disabled=!e(Pe),rt(me,"title",Ye),Re(Ee,1,`nav-quadrant nav-right ${e(Ae)?"":"nav-disabled"}`,"svelte-8lc2nr"),Ee.disabled=!e(Ae),rt(Ee,"title",bt),Re(nt,1,`absolute left-1/2 top-1/2 z-10 h-8 w-8 -translate-x-1/2 -translate-y-1/2 rounded-full border border-border bg-card
${e(U)?"cursor-grabbing":"cursor-grab"}`)},[()=>e(T)?`Parent: ${e(h)()}`:"No parent",()=>e(Pe)?`${e(De)}: ${e(ne)?.menu||e(ne)?.title}`:`No ${e(De).toLowerCase()} sibling`,()=>e(Ae)?`${e(Ve)}: ${e(oe)?.menu||e(oe)?.title}`:`No ${e(Ve).toLowerCase()} sibling`]),ve("click",fe,()=>Je(e(h)())),ve("click",xe,gt),ve("click",me,()=>e(ne)&&Je(Or(e(ne)))),ve("click",Ee,()=>e(oe)&&Je(Or(e(oe)))),ve("pointerdown",nt,D),ve("pointermove",nt,M),ve("pointerup",nt,O),E(p,I),An()}Nn(["click","pointerdown","pointermove","pointerup"]);const mr=3e4;let Rr=class extends Ca{constructor(t){super(),this.doc=t,this.clientID=t.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const d=br();this.getLocalState()!==null&&mr/2<=d-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const l=[];this.meta.forEach((h,_)=>{_!==this.clientID&&mr<=d-h.lastUpdated&&this.states.has(_)&&l.push(_)}),l.length>0&&$n(this,l,"timeout")},$a(mr/10)),t.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(t){const d=this.clientID,l=this.meta.get(d),h=l===void 0?0:l.clock+1,_=this.states.get(d);t===null?this.states.delete(d):this.states.set(d,t),this.meta.set(d,{clock:h,lastUpdated:br()});const C=[],a=[],T=[],J=[];t===null?J.push(d):_==null?t!=null&&C.push(d):(a.push(d),Pn(_,t)||T.push(d)),(C.length>0||T.length>0||J.length>0)&&this.emit("change",[{added:C,updated:T,removed:J},"local"]),this.emit("update",[{added:C,updated:a,removed:J},"local"])}setLocalStateField(t,d){const l=this.getLocalState();l!==null&&this.setLocalState({...l,[t]:d})}getStates(){return this.states}};const $n=(p,t,d)=>{const l=[];for(let h=0;h0&&(p.emit("change",[{added:[],updated:[],removed:l},d]),p.emit("update",[{added:[],updated:[],removed:l},d]))},Ur=(p,t,d=p.states)=>{const l=t.length,h=On();jt(h,l);for(let _=0;_{const d=kn(p),l=On(),h=Ht(d);jt(l,h);for(let _=0;_{const l=kn(t),h=br(),_=[],C=[],a=[],T=[],J=Ht(l);for(let ne=0;ne0||a.length>0||T.length>0)&&p.emit("change",[{added:_,updated:a,removed:T},d]),(_.length>0||C.length>0||T.length>0)&&p.emit("update",[{added:_,updated:C,removed:T},d])},ws=Object.freeze(Object.defineProperty({__proto__:null,Awareness:Rr,applyAwarenessUpdate:tr,encodeAwarenessUpdate:Ur,modifyAwarenessUpdate:Ts,outdatedTimeout:mr,removeAwarenessStates:$n},Symbol.toStringTag,{value:"Module"}));function _n(p){const t=atob(p),d=new Uint8Array(t.length);for(let l=0;l"u"||this.unloadHandler)return;const t=()=>{this.disposed||ze.beaconPost(this.presencePath(),{clientId:this.clientId,leave:!0,lang:this.lang})};this.unloadHandler=t,window.addEventListener("pagehide",t),window.addEventListener("beforeunload",t)}uninstallUnloadHandler(){typeof window>"u"||!this.unloadHandler||(window.removeEventListener("pagehide",this.unloadHandler),window.removeEventListener("beforeunload",this.unloadHandler),this.unloadHandler=null)}async push(t){if(!this.disposed)try{await ze.post(this.pushPath(),{clientId:this.clientId,update:bn(t),lang:this.lang}),this.pullSoon()}catch(d){this.setStatus("error",d.message)}}updateAwareness(t){this.awarenessMeta=t}setAwareness(t){this.awareness=t}onRemoteUpdate(t){this.remoteUpdateHandlers.add(t)}onPeers(t){this.peerHandlers.add(t)}onStatus(t){this.statusHandlers.add(t),t(this.status)}pullPath(){return`/sync/pages${this.route}/pull`}pushPath(){return`/sync/pages${this.route}/push`}presencePath(){return`/sync/pages${this.route}/presence`}get pullIntervalMs(){return this.hasOtherPeers()?this.activeMs:this.idleMs}get presenceIntervalMs(){return this.hasOtherPeers()?this.presenceActiveMs:this.presenceIdleMs}hasOtherPeers(){return this.peers.some(t=>t.clientId!==this.clientId)}schedulePull(){this.disposed||(this.pullTimer&&clearTimeout(this.pullTimer),this.pullTimer=setTimeout(()=>this.pullLoop(),this.pullIntervalMs))}pullSoon(){this.disposed||(this.pullTimer&&clearTimeout(this.pullTimer),this.pullTimer=setTimeout(()=>this.pullLoop(),0))}schedulePresence(){this.disposed||(this.presenceTimer&&clearTimeout(this.presenceTimer),this.presenceTimer=setTimeout(()=>this.heartbeatLoop(),this.presenceIntervalMs))}async pullLoop(){if(!this.disposed){try{await this.pullOnce(),this.setStatus("connected")}catch(t){this.setStatus("error",t.message)}this.schedulePull()}}async heartbeatLoop(){if(!this.disposed){try{await this.heartbeatOnce()}catch(t){this.setStatus("error",t.message)}this.schedulePresence()}}async pullOnce(){const{updates:t,offset:d,peers:l}=await ze.post(this.pullPath(),{since:this.offset,clientId:this.clientId,lang:this.lang});if(this.offset=d,this.emitPeers(l),t.length>0)for(const h of t){const _=_n(h);for(const C of this.remoteUpdateHandlers)C(_)}}async heartbeatOnce(){const t={...this.awarenessMeta??{}};if(this.editorType&&(t.editorType=this.editorType),this.awareness)try{const l=Ur(this.awareness,[this.awareness.clientID]);t.awarenessUpdate=bn(l),t.awarenessClientId=this.awareness.clientID}catch{}const{peers:d}=await ze.post(this.presencePath(),{clientId:this.clientId,user:this.user,meta:t,lang:this.lang});if(this.awareness)for(const l of d){if(l.clientId===this.clientId)continue;const h=l.meta?.awarenessUpdate;if(!(typeof h!="string"||h.length===0))try{tr(this.awareness,_n(h),l.clientId)}catch{}}this.emitPeers(d)}emitPeers(t){this.peers=t;for(const d of this.peerHandlers)d(t)}setStatus(t,d){if(this.status!==t){this.status=t;for(const l of this.statusHandlers)l(t,d)}}}function Gr(p){const t=atob(p),d=new Uint8Array(t.length);for(let l=0;l"u"||this.unloadHandler)return;const t=()=>{this.disposed||ze.beaconPost(this.presencePath(),{clientId:this.clientId,leave:!0,lang:this.lang})};this.unloadHandler=t,window.addEventListener("pagehide",t),window.addEventListener("beforeunload",t)}uninstallUnloadHandler(){typeof window>"u"||!this.unloadHandler||(window.removeEventListener("pagehide",this.unloadHandler),window.removeEventListener("beforeunload",this.unloadHandler),this.unloadHandler=null)}async push(t){if(!this.disposed)try{await ze.post(this.pushPath(),{clientId:this.clientId,update:yn(t),lang:this.lang})}catch(d){this.setStatus("error",d.message)}}updateAwareness(t){this.awarenessMeta=t}setAwareness(t){if(this.awareness=t,this.pendingAwUpdates.length){for(const d of this.pendingAwUpdates)try{tr(t,d,"mercure")}catch{}this.pendingAwUpdates=[]}}onRemoteUpdate(t){this.remoteUpdateHandlers.add(t)}onPeers(t){this.peerHandlers.add(t)}onStatus(t){this.statusHandlers.add(t),t(this.status)}pullPath(){return`/sync/pages${this.route}/pull`}pushPath(){return`/sync/pages${this.route}/push`}presencePath(){return`/sync/pages${this.route}/presence`}async pullOnce(){const{updates:t,offset:d,peers:l}=await ze.post(this.pullPath(),{since:this.offset,clientId:this.clientId,lang:this.lang});if(this.offset=d,t.length>0)for(const h of t){const _=Gr(h);for(const C of this.remoteUpdateHandlers)C(_)}this.consumePeerAwareness(l),this.emitPeers(l)}consumePeerAwareness(t){for(const d of t){if(d.clientId===this.clientId)continue;const l=d.meta?.awarenessUpdate;if(typeof l!="string"||l.length===0)continue;const h=Gr(l);if(this.awareness)try{tr(this.awareness,h,"mercure")}catch{}else this.pendingAwUpdates.push(h)}}async heartbeatOnce(){const t={...this.awarenessMeta??{}};if(this.editorType&&(t.editorType=this.editorType),this.awareness)try{const l=Ur(this.awareness,[this.awareness.clientID]);t.awarenessUpdate=yn(l),t.awarenessClientId=this.awareness.clientID}catch{}const{peers:d}=await ze.post(this.presencePath(),{clientId:this.clientId,user:this.user,meta:t,lang:this.lang});this.consumePeerAwareness(d),this.emitPeers(d)}schedulePresence(){this.disposed||(this.presenceTimer&&clearTimeout(this.presenceTimer),this.presenceTimer=setTimeout(()=>this.presenceLoop(),Ss))}async presenceLoop(){if(!this.disposed){try{await this.heartbeatOnce()}catch(t){this.setStatus("error",t.message)}this.schedulePresence()}}openStream(t,d){const l=d==="doc"?t.topic_doc:t.topic_aw,h=new URL(t.hub);h.searchParams.append("topic",l),h.searchParams.set("authorization",t.jwt);const _=new EventSource(h.toString());_.onmessage=C=>{let a;try{a=JSON.parse(C.data)}catch{return}if(typeof a.bytes!="string"||a.bytes==="")return;const T=Gr(a.bytes);if(a.channel==="doc")for(const J of this.remoteUpdateHandlers)J(T);else if(a.channel==="aw")if(this.awareness)try{tr(this.awareness,T,"mercure")}catch{}else this.pendingAwUpdates.push(T)},_.onerror=()=>{this.disposed||(this.setStatus("connecting","mercure stream reconnecting"),_.readyState===EventSource.CLOSED&&this.refreshToken())},_.onopen=()=>{this.disposed||this.setStatus("connected")},d==="doc"?this.docSource=_:this.awSource=_}emitPeers(t){this.peers=t;for(const d of this.peerHandlers)d(t)}async refreshToken(){if(!(this.disposed||this.refreshingToken)){this.refreshingToken=!0;try{const t=await ze.post("/sync/mercure/token",{route:this.route,lang:this.lang});if(this.disposed)return;this.docSource?.close(),this.awSource?.close(),this.docSource=this.awSource=null,this.openStream(t,"doc"),this.openStream(t,"aw"),this.scheduleTokenRefresh(t.expires_in)}catch(t){this.disposed||this.setStatus("error",t.message)}finally{this.refreshingToken=!1}}}scheduleTokenRefresh(t){if(this.tokenRefreshTimer&&clearTimeout(this.tokenRefreshTimer),this.tokenRefreshTimer=null,this.disposed)return;const d=typeof t=="number"&&t>0?t*1e3:6e5,l=Math.max(3e4,Math.min(d*.8,d-3e4));this.tokenRefreshTimer=setTimeout(()=>{this.refreshToken()},l)}setStatus(t,d){if(this.status!==t){this.status=t;for(const l of this.statusHandlers)l(t,d)}}}class Is{constructor(t){this.clientId=t}#e=[];#r={};#t=new Set;get peers(){return this.#e}get others(){return this.#e.filter(t=>t.clientId!==this.clientId)}get localMeta(){return this.#r}setLocal(t){this.#r=t}updateFromProvider(t){this.#e=t;for(const d of this.#t)d(t)}on(t){return this.#t.add(t),()=>this.#t.delete(t)}}const Ps=Symbol("ydoc:local"),$r=Symbol("ydoc:remote");class Ds{doc;content;awareness;roomId;provider;disposed=!1;updateHandler;constructor(t){this.roomId=t.roomId,this.doc=new Gn,this.content=this.doc.getText("content"),this.awareness=new Is(t.clientId),this.provider=t.provider,this.updateHandler=(d,l)=>{l===$r||this.disposed||this.provider.push(d)},this.doc.on("update",this.updateHandler),this.provider.onRemoteUpdate(d=>{this.disposed||Cr(this.doc,d,$r)}),this.provider.onPeers(d=>{this.disposed||this.awareness.updateFromProvider(d)})}async connect(){await this.provider.connect()}async dispose(){this.disposed=!0,this.doc.off("update",this.updateHandler);try{await this.provider.disconnect()}finally{this.doc.destroy()}}get localOrigin(){return Ps}}const Ms=new Set(["markdown","editor","textarea","yaml","html","frontmatter"]);function Rn(p,t,d){if(p)for(const l of p){const h=l.name??"",_=t&&h?`${t}.${h}`:h||t;if(l.fields&&l.fields.length>0){Rn(l.fields,_,d);continue}_&&d.set(_,Ms.has(l.type)?"ytext":"scalar")}}function xn(p){const{doc:t,blueprint:d,extraRichTextPaths:l=[],localOrigin:h,remoteOrigin:_}=p,C=t.getMap("form"),a=new Map;Rn(d?.fields,"",a);for(const m of l)a.set(m,"ytext");const T=new Set;function J(m){return a.get(m)==="ytext"}function ne(m){if(!m)return null;const L=m.split("."),D=L.pop();let M=C;for(const O of L){const I=M.get(O);if(I instanceof pr)M=I;else{const q=new pr;M.set(O,q),M=q}}return{parent:M,key:D,fullPath:m}}function oe(m,L){const D=m.toString();if(D===L)return;let M=0;const O=Math.min(D.length,L.length);for(;M0&&m.delete(M,q),fe.length>0&&m.insert(M,fe)}function Pe(m,L){const D=ne(m);if(!D)return;const{parent:M,key:O}=D;t.transact(()=>{if(J(m)&&typeof L=="string"){let I=M.get(O);I instanceof Zt||(I=new Zt,M.set(O,I)),oe(I,L)}else if(Array.isArray(L)){let I=M.get(O);if(!(I instanceof gr)){I=new gr,M.set(O,I),L.length>0&&I.push(L.map(Ot));return}Ae(I,L)}else{const I=M.get(O);if(!(I instanceof Ra)&&En(I,L))return;M.set(O,Ot(L))}},h)}function Ae(m,L){const D=m.toArray();if(D.length===L.length){let I=!0;for(let q=0;qI===null||typeof I!="object";if(D.every(M)&&L.every(M)){const I=L.map(ie=>JSON.stringify(ie)),q=D.map(ie=>JSON.stringify(ie));if(q.length===I.length){const ie=[...q].sort(),me=[...I].sort();let Me=!0;for(let Ee=0;Ee0&&m.push(L.map(Ot));return}}const fe=I.slice(),_t="\0:taken:\0";for(let ie=D.length-1;ie>=0;ie--){const me=q[ie],Me=fe.indexOf(me);Me>=0?fe[Me]=_t:m.delete(ie,1)}const xe=[];for(let ie=0;ie0&&m.push(xe);return}m.delete(0,m.length),L.length>0&&m.push(L.map(Ot))}function De(m){if(m instanceof Zt)return m.toString();if(m instanceof pr){const L={};return m.forEach((D,M)=>{L[M]=De(D)}),L}return m instanceof gr?m.toArray().map(De):m}function Ve(){return De(C)}function Je(m){C.size>0||t.transact(()=>{gt(C,m,"")},h)}function gt(m,L,D){for(const[M,O]of Object.entries(L)){const I=D?`${D}.${M}`:M;if(J(I)&&typeof O=="string"){const q=new Zt;q.insert(0,O),m.set(M,q)}else if(Array.isArray(O)){const q=new gr;m.set(M,q),O.length>0&&q.push(O.map(Ot))}else if(O&&typeof O=="object"){const q=new pr;m.set(M,q),gt(q,O,I)}else m.set(M,Ot(O))}}const te=(m,L)=>{if(L.origin===h)return;const D=Ve();for(const M of T)M(D)};C.observeDeep(te);function U(m){return T.add(m),()=>T.delete(m)}function W(m){if(!J(m))return null;const L=ne(m);if(!L)return null;const D=L.parent.get(L.key);return D instanceof Zt?D:null}function K(){C.unobserveDeep(te),T.clear()}return{pushLocal:Pe,seed:Je,getValue:Ve,onRemote:U,map:C,isText:J,getText:W,dispose:K}}function Ot(p){if(p===null||typeof p!="object")return p;try{return structuredClone(p)}catch{return JSON.parse(JSON.stringify(p))}}function En(p,t){if(p===t)return!0;if(p===null||t===null||typeof p!=typeof t||typeof p!="object")return!1;try{return JSON.stringify(p)===JSON.stringify(t)}catch{return!1}}if(typeof window<"u"){const p=window;p.__GRAV_YJS__||(p.__GRAV_YJS__={yjs:gn,awareness:ws,Y:gn,Awareness:Rr})}function Tn(p){let t=0;for(let d=0;d{l=!0,h&&(clearTimeout(h),h=null)}}}var $s=P(''),Rs=P('