diff --git a/app/srv/core/main.js b/app/srv/core/main.js index d5e9858a..88c25945 100644 --- a/app/srv/core/main.js +++ b/app/srv/core/main.js @@ -35,7 +35,7 @@ ${d}`),f.pop(),`{${k}}`}case"number":return isFinite(u)?String(u):t?t(u):"null"; transform: translate(${-100+o.value*200}%); `)})}),r]})})]})};var ct=null;var Uu=class extends Error{constructor(t){super(t),this.name="DecompressionError"}},An=0,Su=null,gI=null;function Rp(e,t,A){let i;if(A){let r=t;i=e.malloc_u8(r);let o=new Uint8Array(e.memory.buffer,i,r);try{A(o)}catch(s){throw e.free_u8(i,r),s}return An=r,i}if(typeof t=="string"){let r=An=function(s){let a=0,c=0,I=0,l=s.length;for(;a>>0;ct.free_u8(A,An);let n=ct.buffer()>>>0;return new Uint8Array(ct.memory.buffer,n,i)}function Et(e,t){Jp(ct);let A=Rp(ct,e,t),i=ct.gzip_decompress(A,An)>>>0;if(ct.free_u8(A,An),i===4294967295){let r=ct.error_message(),o=ct.error_message_len(),s=new Uint8Array(ct.memory.buffer,r,o),a=new TextDecoder().decode(s);throw new Uu(a)}let n=ct.buffer()>>>0;return new Uint8Array(ct.memory.buffer,n,i)}function Jp(e){if(!e)throw new Error("WASM not initialized")}var lt=()=>new Map,uI=e=>{let t=lt();return e.forEach((A,i)=>{t.set(i,A)}),t},hA=(e,t,A)=>{let i=e.get(t);return i===void 0&&e.set(t,i=A()),i},qp=(e,t)=>{let A=[];for(let[i,n]of e)A.push(t(n,i));return A},Kp=(e,t)=>{for(let[A,i]of e)if(t(i,A))return!0;return!1};var PA=()=>new Set;var fI=e=>e[e.length-1];var bp=(e,t)=>{for(let A=0;A{this.off(t,i),A(...n)};this.on(t,i)}off(t,A){let i=this._observers.get(t);i!==void 0&&(i.delete(A),i.size===0&&this._observers.delete(t))}emit(t,A){return pA((this._observers.get(t)||lt()).values()).forEach(i=>i(...A))}destroy(){this._observers=lt()}};var Yt=Math.floor;var or=Math.abs;var dI=(e,t)=>ee>t?e:t,pM=Number.isNaN;var CI=e=>e!==0?e<0:1/e<0;var Hu=Number.MAX_SAFE_INTEGER,EM=Number.MIN_SAFE_INTEGER,mM=1<<31;var Op=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&Yt(e)===e),yM=Number.isNaN,wM=Number.parseInt;var AS=String.fromCharCode,FM=String.fromCodePoint,DM=AS(65535),iS=e=>e.toLowerCase(),nS=/^\s*/g,rS=e=>e.replace(nS,""),oS=/([A-Z])/g,Mu=(e,t)=>rS(e.replace(oS,A=>`${t}${iS(A)}`));var sS=e=>{let t=unescape(encodeURIComponent(e)),A=t.length,i=new Uint8Array(A);for(let n=0;nar.encode(e),Yp=ar?aS:sS;var sr=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});sr&&sr.decode(new Uint8Array).length===1&&(sr=null);var nn=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},Po=()=>new nn;var IS=e=>{let t=e.cpos;for(let A=0;A{let t=new Uint8Array(IS(e)),A=0;for(let i=0;i{let A=e.cbuf.length;A-e.cpos{let A=e.cbuf.length;e.cpos===A&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(A*2),e.cpos=0),e.cbuf[e.cpos++]=t};var pI=Oe;var W=(e,t)=>{for(;t>127;)Oe(e,128|127&t),t=Yt(t/128);Oe(e,127&t)},EI=(e,t)=>{let A=CI(t);for(A&&(t=-t),Oe(e,(t>63?128:0)|(A?64:0)|63&t),t=Yt(t/64);t>0;)Oe(e,(t>127?128:0)|127&t),t=Yt(t/128)},Ru=new Uint8Array(3e4),lS=Ru.length/3,gS=(e,t)=>{if(t.length{let A=unescape(encodeURIComponent(t)),i=A.length;W(e,i);for(let n=0;n{let A=e.cbuf.length,i=e.cpos,n=dI(A-i,t.length),r=t.length-n;e.cbuf.set(t.subarray(0,n),i),e.cpos+=n,r>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(VA(A*2,r)),e.cbuf.set(t.subarray(n)),e.cpos=r)},mt=(e,t)=>{W(e,t.byteLength),Vo(e,t)},Ju=(e,t)=>{cS(e,t);let A=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,A},fS=(e,t)=>Ju(e,4).setFloat32(0,t,!1),BS=(e,t)=>Ju(e,8).setFloat64(0,t,!1),dS=(e,t)=>Ju(e,8).setBigInt64(0,t,!1);var Vp=new DataView(new ArrayBuffer(4)),CS=e=>(Vp.setFloat32(0,e),Vp.getFloat32(0)===e),cr=(e,t)=>{switch(typeof t){case"string":Oe(e,119),rn(e,t);break;case"number":Op(t)&&or(t)<=2147483647?(Oe(e,125),EI(e,t)):CS(t)?(Oe(e,124),fS(e,t)):(Oe(e,123),BS(e,t));break;case"bigint":Oe(e,122),dS(e,t);break;case"object":if(t===null)Oe(e,126);else if(xu(t)){Oe(e,117),W(e,t.length);for(let A=0;A0&&W(this,this.count-1),this.count=1,this.w(this,t),this.s=t)}};var zp=e=>{e.count>0&&(EI(e.encoder,e.count===1?e.s:-e.s),e.count>1&&W(e.encoder,e.count-2))},on=class{constructor(){this.encoder=new nn,this.s=0,this.count=0}write(t){this.s===t?this.count++:(zp(this),this.count=1,this.s=t)}toUint8Array(){return zp(this),oA(this.encoder)}};var _p=e=>{if(e.count>0){let t=e.diff*2+(e.count===1?0:1);EI(e.encoder,t),e.count>1&&W(e.encoder,e.count-2)}},lr=class{constructor(){this.encoder=new nn,this.s=0,this.count=0,this.diff=0}write(t){this.diff===t-this.s?(this.s=t,this.count++):(_p(this),this.count=1,this.diff=t-this.s,this.s=t)}toUint8Array(){return _p(this),oA(this.encoder)}},hI=class{constructor(){this.sarr=[],this.s="",this.lensE=new on}write(t){this.s+=t,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(t.length)}toUint8Array(){let t=new nn;return this.sarr.push(this.s),this.s="",rn(t,this.sarr.join("")),Vo(t,this.lensE.toUint8Array()),oA(t)}};var EA=e=>new Error(e),sA=()=>{throw EA("Method unimplemented")},aA=()=>{throw EA("Unexpected case")};var Xp=EA("Unexpected end of array"),Zp=EA("Integer out of Range"),gr=class{constructor(t){this.arr=t,this.pos=0}},cn=e=>new gr(e),Wp=e=>e.pos!==e.arr.length;var hS=(e,t)=>{let A=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,A},yt=e=>hS(e,X(e));var sn=e=>e.arr[e.pos++];var X=e=>{let t=0,A=1,i=e.arr.length;for(;e.posHu)throw Zp}throw Xp},yI=e=>{let t=e.arr[e.pos++],A=t&63,i=64,n=(t&64)>0?-1:1;if(!(t&128))return n*A;let r=e.arr.length;for(;e.posHu)throw Zp}throw Xp};var pS=e=>{let t=X(e);if(t===0)return"";{let A=String.fromCodePoint(sn(e));if(--t<100)for(;t--;)A+=String.fromCodePoint(sn(e));else for(;t>0;){let i=t<1e4?t:1e4,n=e.arr.subarray(e.pos,e.pos+i);e.pos+=i,A+=String.fromCodePoint.apply(null,n),t-=i}return decodeURIComponent(escape(A))}},ES=e=>sr.decode(yt(e)),an=sr?ES:pS;var qu=(e,t)=>{let A=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,A},mS=e=>qu(e,4).getFloat32(0,!1),yS=e=>qu(e,8).getFloat64(0,!1),wS=e=>qu(e,8).getBigInt64(0,!1);var FS=[e=>{},e=>null,yI,mS,yS,wS,e=>!1,e=>!0,an,e=>{let t=X(e),A={};for(let i=0;i{let t=X(e),A=[];for(let i=0;iFS[127-sn(e)](e),zo=class extends gr{constructor(t,A){super(t),this.reader=A,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),Wp(this)?this.count=X(this)+1:this.count=-1),this.count--,this.s}};var In=class extends gr{constructor(t){super(t),this.s=0,this.count=0}read(){if(this.count===0){this.s=yI(this);let t=CI(this.s);this.count=1,t&&(this.s=-this.s,this.count=X(this)+2)}return this.count--,this.s}};var fr=class extends gr{constructor(t){super(t),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){let t=yI(this),A=t&1;this.diff=Yt(t/2),this.count=1,A&&(this.count=X(this)+2)}return this.s+=this.diff,this.count--,this.s}},mI=class{constructor(t){this.decoder=new In(t),this.str=an(this.decoder),this.spos=0}read(){let t=this.spos+this.decoder.read(),A=this.str.slice(this.spos,t);return this.spos=t,A}};var UM=crypto.subtle,jp=crypto.getRandomValues.bind(crypto);var Ku=()=>jp(new Uint32Array(1))[0];var kS="10000000-1000-4000-8000"+-1e11,$p=()=>kS.replace(/[018]/g,e=>(e^Ku()&15>>e/4).toString(16));var eE=Date.now;var bu=e=>new Promise(e);var GM=Promise.all.bind(Promise);var Ou=e=>e===void 0?null:e;var Lu=class{constructor(){this.map=new Map}setItem(t,A){this.map.set(t,A)}getItem(t){return this.map.get(t)}},tE=new Lu,GS=!0;try{typeof localStorage<"u"&&localStorage&&(tE=localStorage,GS=!1)}catch{}var AE=tE;var nE=Object.assign,MS=Object.keys,rE=(e,t)=>{for(let A in e)t(e[A],A)};var iE=e=>MS(e).length;var oE=e=>{for(let t in e)return!1;return!0},vS=(e,t)=>{for(let A in e)if(!t(e[A],A))return!1;return!0},RS=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),sE=(e,t)=>e===t||iE(e)===iE(t)&&vS(e,(A,i)=>(A!==void 0||RS(t,i))&&t[i]===A);var _o=(e,t,A=0)=>{try{for(;Ae;var IE=(e,t)=>t.includes(e);var To=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";var HM=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,mA,qS=[],KS=()=>{if(mA===void 0)if(To){mA=lt();let e=process.argv,t=null;for(let A=0;A{if(e.length!==0){let[t,A]=e.split("=");mA.set(`--${Mu(t,"-")}`,A),mA.set(`-${Mu(t,"-")}`,A)}})):mA=lt();return mA},Yu=e=>KS().has(e);var Pu=e=>To?Ou(process.env[e.toUpperCase()]):Ou(AE.getItem(e));var bS=e=>Yu("--"+e)||Pu(e)!==null,MM=bS("production"),lE=To&&IE(process.env.FORCE_COLOR,["true","1","2"]),gE=!Yu("no-colors")&&(!To||process.stdout.isTTY||lE)&&(!To||Yu("color")||lE||Pu("COLORTERM")!==null||(Pu("TERM")||"").includes("color"));var LS=e=>new Uint8Array(e);var uE=e=>{let t=LS(e.byteLength);return t.set(e),t};var Vu=class{constructor(t,A){this.left=t,this.right=A}},yA=(e,t)=>new Vu(e,t);var ln=typeof document<"u"?document:{};var vM=typeof DOMParser<"u"?new DOMParser:null;var fE=e=>qp(e,(t,A)=>`${A}:${t};`).join("");var RM=ln.ELEMENT_NODE,JM=ln.TEXT_NODE,qM=ln.CDATA_SECTION_NODE,KM=ln.COMMENT_NODE,bM=ln.DOCUMENT_NODE,OM=ln.DOCUMENT_TYPE_NODE,LM=ln.DOCUMENT_FRAGMENT_NODE;var wA=Symbol;var Xo=wA(),Zo=wA(),zu=wA(),_u=wA(),Tu=wA(),Wo=wA(),Xu=wA(),jo=wA(),Zu=wA(),BE=e=>{let t=[],A=[],i=0;for(;i{let t=[],A=[],i=lt(),n=[],r=0;for(;r0||a.length>0?(t.push("%c"+o),A.push(a)):t.push(o)}else break}for(r>0&&(n=A,n.unshift(t.join("")));r{console.log(...ZS(e)),WS.forEach(t=>t.print(e))};var WS=PA();var CE=e=>({[Symbol.iterator](){return this},next:e}),QE=(e,t)=>CE(()=>{let A;do A=e.next();while(!A.done&&!t(A.value));return A}),wI=(e,t)=>CE(()=>{let{done:A,value:i}=e.next();return{done:A,value:A?void 0:t(i)}});var es=class{constructor(t,A){this.clock=t,this.len=A}},gn=class{constructor(){this.clients=new Map}},GE=(e,t,A)=>t.clients.forEach((i,n)=>{let r=e.doc.store.clients.get(n);for(let o=0;o{let A=0,i=e.length-1;for(;A<=i;){let n=Yt((A+i)/2),r=e[n],o=r.clock;if(o<=t){if(t{let A=e.clients.get(t.client);return A!==void 0&&AU(A,t.clock)!==null},Bf=e=>{e.clients.forEach(t=>{t.sort((n,r)=>n.clock-r.clock);let A,i;for(A=1,i=1;A=r.clock?n.len=VA(n.len,r.clock+r.len-n.clock):(i{let t=new gn;for(let A=0;A{if(!t.clients.has(n)){let r=i.slice();for(let o=A+1;o{hA(e.clients,t,()=>[]).push(new es(A,i))},ME=()=>new gn,nU=e=>{let t=ME();return e.clients.forEach((A,i)=>{let n=[];for(let r=0;r0&&t.clients.set(i,n)}),t},hr=(e,t)=>{W(e.restEncoder,t.clients.size),pA(t.clients.entries()).sort((A,i)=>i[0]-A[0]).forEach(([A,i])=>{e.resetDsCurVal(),W(e.restEncoder,A);let n=i.length;W(e.restEncoder,n);for(let r=0;r{let t=new gn,A=X(e.restDecoder);for(let i=0;i0){let o=hA(t.clients,n,()=>[]);for(let s=0;s{let i=new gn,n=X(e.restDecoder);for(let r=0;r0){let r=new zA;return W(r.restEncoder,0),hr(r,i),r.toUint8Array()}return null};var vE=Ku,ts=class e extends BI{constructor({guid:t=$p(),collectionid:A=null,gc:i=!0,gcFilter:n=()=>!0,meta:r=null,autoLoad:o=!1,shouldLoad:s=!0}={}){super(),this.gc=i,this.gcFilter=n,this.clientID=vE(),this.guid=t,this.collectionid=A,this.share=new Map,this.store=new vI,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=s,this.autoLoad=o,this.meta=r,this.isLoaded=!1,this.isSynced=!1,this.whenLoaded=bu(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});let a=()=>bu(c=>{let I=l=>{(l===void 0||l===!0)&&(this.off("sync",I),c())};this.on("sync",I)});this.on("sync",c=>{c===!1&&this.isSynced&&(this.whenSynced=a()),this.isSynced=c===void 0||c===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[])}),this.whenSynced=a()}load(){let t=this._item;t!==null&&!this.shouldLoad&&de(t.parent.doc,A=>{A.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(pA(this.subdocs).map(t=>t.guid))}transact(t,A=null){return de(this,t,A)}get(t,A=Re){let i=hA(this.share,t,()=>{let r=new A;return r._integrate(this,null),r}),n=i.constructor;if(A!==Re&&n!==A)if(n===Re){let r=new A;r._map=i._map,i._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=r}),r._start=i._start;for(let o=r._start;o!==null;o=o.right)o.parent=r;return r._length=i._length,this.share.set(t,r),r._integrate(this,null),r}else throw new Error(`Type with the name ${t} has already been defined with a different constructor`);return i}getArray(t=""){return this.get(t,KI)}getText(t=""){return this.get(t,as)}getMap(t=""){return this.get(t,os)}getXmlFragment(t=""){return this.get(t,Cr)}toJSON(){let t={};return this.share.forEach((A,i)=>{t[i]=A.toJSON()}),t}destroy(){pA(this.subdocs).forEach(A=>A.destroy());let t=this._item;if(t!==null){this._item=null;let A=t.content;A.doc=new e({guid:this.guid,...A.opts,shouldLoad:!1}),A.doc._item=t,de(t.parent.doc,i=>{let n=A.doc;t.deleted||i.subdocsAdded.add(n),i.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}on(t,A){super.on(t,A)}off(t,A){super.off(t,A)}},xI=class{constructor(t){this.restDecoder=t}resetDsCurVal(){}readDsClock(){return X(this.restDecoder)}readDsLen(){return X(this.restDecoder)}},GI=class extends xI{readLeftID(){return Ae(X(this.restDecoder),X(this.restDecoder))}readRightID(){return Ae(X(this.restDecoder),X(this.restDecoder))}readClient(){return X(this.restDecoder)}readInfo(){return sn(this.restDecoder)}readString(){return an(this.restDecoder)}readParentInfo(){return X(this.restDecoder)===1}readTypeRef(){return X(this.restDecoder)}readLen(){return X(this.restDecoder)}readAny(){return ur(this.restDecoder)}readBuf(){return uE(yt(this.restDecoder))}readJSON(){return JSON.parse(an(this.restDecoder))}readKey(){return an(this.restDecoder)}},$u=class{constructor(t){this.dsCurrVal=0,this.restDecoder=t}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=X(this.restDecoder),this.dsCurrVal}readDsLen(){let t=X(this.restDecoder)+1;return this.dsCurrVal+=t,t}},Ui=class extends $u{constructor(t){super(t),this.keys=[],X(t),this.keyClockDecoder=new fr(yt(t)),this.clientDecoder=new In(yt(t)),this.leftClockDecoder=new fr(yt(t)),this.rightClockDecoder=new fr(yt(t)),this.infoDecoder=new zo(yt(t),sn),this.stringDecoder=new mI(yt(t)),this.parentInfoDecoder=new zo(yt(t),sn),this.typeRefDecoder=new In(yt(t)),this.lenDecoder=new In(yt(t))}readLeftID(){return new Si(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new Si(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return ur(this.restDecoder)}readBuf(){return yt(this.restDecoder)}readJSON(){return ur(this.restDecoder)}readKey(){let t=this.keyClockDecoder.read();if(t{i=VA(i,t[0].id.clock);let n=FA(t,i);W(e.restEncoder,t.length-n),e.writeClient(A),W(e.restEncoder,i);let r=t[n];r.write(e,i-r.id.clock);for(let o=n+1;o{let i=new Map;A.forEach((n,r)=>{Le(t,r)>n&&i.set(r,n)}),YI(t).forEach((n,r)=>{A.has(r)||i.set(r,0)}),W(e.restEncoder,i.size),pA(i.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{rU(e,t.clients.get(n),n,r)})},oU=(e,t)=>{let A=lt(),i=X(e.restDecoder);for(let n=0;n{let i=[],n=pA(A.keys()).sort((u,f)=>u-f);if(n.length===0)return null;let r=()=>{if(n.length===0)return null;let u=A.get(n[n.length-1]);for(;u.refs.length===u.i;)if(n.pop(),n.length>0)u=A.get(n[n.length-1]);else return null;return u},o=r();if(o===null)return null;let s=new vI,a=new Map,c=(u,f)=>{let C=a.get(u);(C==null||C>f)&&a.set(u,f)},I=o.refs[o.i++],l=new Map,g=()=>{for(let u of i){let f=u.id.client,C=A.get(f);C?(C.i--,s.clients.set(f,C.refs.slice(C.i)),A.delete(f),C.i=0,C.refs=[]):s.clients.set(f,[u]),n=n.filter(F=>F!==f)}i.length=0};for(;;){if(I.constructor!==Ft){let f=hA(l,I.id.client,()=>Le(t,I.id.client))-I.id.clock;if(f<0)i.push(I),c(I.id.client,I.id.clock-1),g();else{let C=I.getMissing(e,t);if(C!==null){i.push(I);let F=A.get(C)||{refs:[],i:0};if(F.refs.length===F.i)c(C,Le(t,C)),g();else{I=F.refs[F.i++];continue}}else(f===0||f0)I=i.pop();else if(o!==null&&o.i0){let u=new zA;return Cf(u,s,new Map),W(u.restEncoder,0),{missing:a,update:u.toUint8Array()}}return null},aU=(e,t)=>Cf(e,t.doc.store,t.beforeState),IU=(e,t,A,i=new Ui(e))=>de(t,n=>{n.local=!1;let r=!1,o=n.doc,s=o.store,a=oU(i,o),c=sU(n,s,a),I=s.pendingStructs;if(I){for(let[g,u]of I.missing)if(uu)&&I.missing.set(g,u)}I.update=RI([I.update,c.update])}}else s.pendingStructs=c;let l=EE(i,n,s);if(s.pendingDs){let g=new Ui(cn(s.pendingDs));X(g.restDecoder);let u=EE(g,n,s);l&&u?s.pendingDs=RI([l,u]):s.pendingDs=l||u}else s.pendingDs=l;if(r){let g=s.pendingStructs.update;s.pendingStructs=null,RE(n.doc,g)}},A,!1);var RE=(e,t,A,i=Ui)=>{let n=cn(t);IU(n,e,A,new i(n))},JE=(e,t,A)=>RE(e,t,A,GI),cU=(e,t,A=new Map)=>{Cf(e,t.store,A),hr(e,nU(t.store))},lU=(e,t=new Uint8Array([0]),A=new zA)=>{let i=KE(t);cU(A,e,i);let n=[A.toUint8Array()];if(e.store.pendingDs&&n.push(e.store.pendingDs),e.store.pendingStructs&&n.push(wU(e.store.pendingStructs.update,t)),n.length>1){if(A.constructor===un)return mU(n.map((r,o)=>o===0?r:DU(r)));if(A.constructor===zA)return RI(n)}return n[0]},qE=(e,t)=>lU(e,t,new un),gU=e=>{let t=new Map,A=X(e.restDecoder);for(let i=0;igU(new xI(cn(e))),bE=(e,t)=>(W(e.restEncoder,t.size),pA(t.entries()).sort((A,i)=>i[0]-A[0]).forEach(([A,i])=>{W(e.restEncoder,A),W(e.restEncoder,i)}),e),uU=(e,t)=>bE(e,YI(t.store)),fU=(e,t=new MI)=>(e instanceof Map?bE(t,e):uU(t,e),t.toUint8Array()),OE=e=>fU(e,new HI),ef=class{constructor(){this.l=[]}},mE=()=>new ef,yE=(e,t)=>e.l.push(t),wE=(e,t)=>{let A=e.l,i=A.length;e.l=A.filter(n=>t!==n),i===e.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},LE=(e,t,A)=>_o(e.l,[t,A]),Si=class{constructor(t,A){this.client=t,this.clock=A}},FI=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,Ae=(e,t)=>new Si(e,t);var BU=e=>{for(let[t,A]of e.doc.share.entries())if(A===e)return t;throw aA()};var tf=class{constructor(t,A){this.ds=t,this.sv=A}};var dU=(e,t)=>new tf(e,t),Av=dU(ME(),new Map);var Br=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!HE(t.ds,e.id),Af=(e,t)=>{let A=hA(e.meta,Af,PA),i=e.doc.store;A.has(t)||(t.sv.forEach((n,r)=>{n{}),A.add(t))};var vI=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},YI=e=>{let t=new Map;return e.clients.forEach((A,i)=>{let n=A[A.length-1];t.set(i,n.id.clock+n.length)}),t},Le=(e,t)=>{let A=e.clients.get(t);if(A===void 0)return 0;let i=A[A.length-1];return i.id.clock+i.length},YE=(e,t)=>{let A=e.clients.get(t.id.client);if(A===void 0)A=[],e.clients.set(t.id.client,A);else{let i=A[A.length-1];if(i.id.clock+i.length!==t.id.clock)throw aA()}A.push(t)},FA=(e,t)=>{let A=0,i=e.length-1,n=e[i],r=n.id.clock;if(r===t)return i;let o=Yt(t/(r+n.length-1)*i);for(;A<=i;){if(n=e[o],r=n.id.clock,r<=t){if(t{let A=e.clients.get(t.client);return A[FA(A,t.clock)]},Wu=CU,nf=(e,t,A)=>{let i=FA(t,A),n=t[i];return n.id.clock{let A=e.doc.store.clients.get(t.client);return A[nf(e,A,t.clock)]},FE=(e,t,A)=>{let i=t.clients.get(A.client),n=FA(i,A.clock),r=i[n];return A.clock!==r.id.clock+r.length-1&&r.constructor!==wt&&i.splice(n+1,0,LI(e,r,A.clock-r.id.clock+1)),r},QU=(e,t,A)=>{let i=e.clients.get(t.id.client);i[FA(i,t.id.clock)]=A},PE=(e,t,A,i,n)=>{if(i===0)return;let r=A+i,o=nf(e,t,A),s;do s=t[o++],rt.deleteSet.clients.size===0&&!Kp(t.afterState,(A,i)=>t.beforeState.get(i)!==A)?!1:(Bf(t.deleteSet),aU(e,t),hr(e,t.deleteSet),!0),kE=(e,t,A)=>{let i=t._item;(i===null||i.id.clock<(e.beforeState.get(i.id.client)||0)&&!i.deleted)&&hA(e.changed,t,PA).add(A)},SI=(e,t)=>{let A=e[t],i=e[t-1],n=t;for(;n>0;A=i,i=e[--n-1]){if(i.deleted===A.deleted&&i.constructor===A.constructor&&i.mergeWith(A)){A instanceof Ye&&A.parentSub!==null&&A.parent._map.get(A.parentSub)===A&&A.parent._map.set(A.parentSub,i);continue}break}let r=t-n;return r&&e.splice(t+1-r,r),r},hU=(e,t,A)=>{for(let[i,n]of e.clients.entries()){let r=t.clients.get(i);for(let o=n.length-1;o>=0;o--){let s=n[o],a=s.clock+s.len;for(let c=FA(r,s.clock),I=r[c];c{e.clients.forEach((A,i)=>{let n=t.clients.get(i);for(let r=A.length-1;r>=0;r--){let o=A[r],s=dI(n.length-1,1+FA(n,o.clock+o.len-1));for(let a=s,c=n[a];a>0&&c.id.clock>=o.clock;c=n[a])a-=1+SI(n,a)}})};var VE=(e,t)=>{if(ts.push(()=>{(c._item===null||!c._item.deleted)&&c._callObserver(A,a)})),s.push(()=>{A.changedParentTypes.forEach((a,c)=>{c._dEH.l.length>0&&(c._item===null||!c._item.deleted)&&(a=a.filter(I=>I.target._item===null||!I.target._item.deleted),a.forEach(I=>{I.currentTarget=c,I._path=null}),a.sort((I,l)=>I.path.length-l.path.length),LE(c._dEH,a,A))})}),s.push(()=>i.emit("afterTransaction",[A,i])),_o(s,[]),A._needFormattingCleanup&&JU(A)}finally{i.gc&&hU(r,n,i.gcFilter),pU(r,n),A.afterState.forEach((I,l)=>{let g=A.beforeState.get(l)||0;if(g!==I){let u=n.clients.get(l),f=VA(FA(u,g),1);for(let C=u.length-1;C>=f;)C-=1+SI(u,C)}});for(let I=o.length-1;I>=0;I--){let{client:l,clock:g}=o[I].id,u=n.clients.get(l),f=FA(u,g);f+11||f>0&&SI(u,f)}if(!A.local&&A.afterState.get(i.clientID)!==A.beforeState.get(i.clientID)&&(dE(jo,Xo,"[yjs] ",Zo,Wo,"Changed the client-id because another client seems to be using it."),i.clientID=vE()),i.emit("afterTransactionCleanup",[A,i]),i._observers.has("update")){let I=new un;DE(I,A)&&i.emit("update",[I.toUint8Array(),A.origin,i,A])}if(i._observers.has("updateV2")){let I=new zA;DE(I,A)&&i.emit("updateV2",[I.toUint8Array(),A.origin,i,A])}let{subdocsAdded:s,subdocsLoaded:a,subdocsRemoved:c}=A;(s.size>0||c.size>0||a.size>0)&&(s.forEach(I=>{I.clientID=i.clientID,I.collectionid==null&&(I.collectionid=i.collectionid),i.subdocs.add(I)}),c.forEach(I=>i.subdocs.delete(I)),i.emit("subdocs",[{loaded:a,added:s,removed:c},i,A]),c.forEach(I=>I.destroy())),e.length<=t+1?(i._transactionCleanups=[],i.emit("afterAllTransactions",[i,e])):VE(e,t+1)}}},de=(e,t,A=null,i=!0)=>{let n=e._transactionCleanups,r=!1,o=null;e._transaction===null&&(r=!0,e._transaction=new rf(e,A,i),n.push(e._transaction),n.length===1&&e.emit("beforeAllTransactions",[e]),e.emit("beforeTransaction",[e._transaction,e]));try{o=t(e._transaction)}finally{if(r){let s=e._transaction===n[0];e._transaction=null,s&&VE(n,0)}}return o};function*EU(e){let t=X(e.restDecoder);for(let A=0;ARI(e,GI,un);var yU=(e,t)=>{if(e.constructor===wt){let{client:A,clock:i}=e.id;return new wt(Ae(A,i+t),e.length-t)}else if(e.constructor===Ft){let{client:A,clock:i}=e.id;return new Ft(Ae(A,i+t),e.length-t)}else{let A=e,{client:i,clock:n}=A.id;return new Ye(Ae(i,n+t),null,Ae(i,n+t-1),null,A.rightOrigin,A.parent,A.parentSub,A.content.splice(t))}},RI=(e,t=Ui,A=zA)=>{if(e.length===1)return e[0];let i=e.map(I=>new t(cn(I))),n=i.map(I=>new As(I,!0)),r=null,o=new A,s=new is(o);for(;n=n.filter(g=>g.curr!==null),n.sort((g,u)=>{if(g.curr.id.client===u.curr.id.client){let f=g.curr.id.clock-u.curr.id.clock;return f===0?g.curr.constructor===u.curr.constructor?0:g.curr.constructor===Ft?1:-1:f}else return u.curr.id.client-g.curr.id.client}),n.length!==0;){let I=n[0],l=I.curr.id.client;if(r!==null){let g=I.curr,u=!1;for(;g!==null&&g.id.clock+g.length<=r.struct.id.clock+r.struct.length&&g.id.client>=r.struct.id.client;)g=I.next(),u=!0;if(g===null||g.id.client!==l||u&&g.id.clock>r.struct.id.clock+r.struct.length)continue;if(l!==r.struct.id.client)Di(s,r.struct,r.offset),r={struct:g,offset:0},I.next();else if(r.struct.id.clock+r.struct.length0&&(r.struct.constructor===Ft?r.struct.length-=f:g=yU(g,f)),r.struct.mergeWith(g)||(Di(s,r.struct,r.offset),r={struct:g,offset:0},I.next())}}else r={struct:I.curr,offset:0},I.next();for(let g=I.curr;g!==null&&g.id.client===l&&g.id.clock===r.struct.id.clock+r.struct.length&&g.constructor!==Ft;g=I.next())Di(s,r.struct,r.offset),r={struct:g,offset:0}}r!==null&&(Di(s,r.struct,r.offset),r=null),Qf(s);let a=i.map(I=>df(I)),c=iU(a);return hr(o,c),o.toUint8Array()},wU=(e,t,A=Ui,i=zA)=>{let n=KE(t),r=new i,o=new is(r),s=new A(cn(e)),a=new As(s,!1);for(;a.curr;){let I=a.curr,l=I.id.client,g=n.get(l)||0;if(a.curr.constructor===Ft){a.next();continue}if(I.id.clock+I.length>g)for(Di(o,I,VA(g-I.id.clock,0)),a.next();a.curr&&a.curr.id.client===l;)Di(o,a.curr,0),a.next();else for(;a.curr&&a.curr.id.client===l&&a.curr.id.clock+a.curr.length<=g;)a.next()}Qf(o);let c=df(s);return hr(r,c),r.toUint8Array()};var zE=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:oA(e.encoder.restEncoder)}),e.encoder.restEncoder=Po(),e.written=0)},Di=(e,t,A)=>{e.written>0&&e.currClient!==t.id.client&&zE(e),e.written===0&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),W(e.encoder.restEncoder,t.id.clock+A)),t.write(e.encoder,A),e.written++},Qf=e=>{zE(e);let t=e.encoder.restEncoder;W(t,e.clientStructs.length);for(let A=0;A{let n=new A(cn(e)),r=new As(n,!1),o=new i,s=new is(o);for(let c=r.curr;c!==null;c=r.next())Di(s,t(c),0);Qf(s);let a=df(n);return hr(o,a),o.toUint8Array()};var DU=e=>FU(e,aE,Ui,un),SE="You must not compute changes after the event-handler fired.",dr=class{constructor(t,A){this.target=t,this.currentTarget=t,this.transaction=A,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=kU(this.currentTarget,this.target))}deletes(t){return HE(this.transaction.deleteSet,t.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw EA(SE);let t=new Map,A=this.target;this.transaction.changed.get(A).forEach(n=>{if(n!==null){let r=A._map.get(n),o,s;if(this.adds(r)){let a=r.left;for(;a!==null&&this.adds(a);)a=a.left;if(this.deletes(r))if(a!==null&&this.deletes(a))o="delete",s=fI(a.content.getContent());else return;else a!==null&&this.deletes(a)?(o="update",s=fI(a.content.getContent())):(o="add",s=void 0)}else if(this.deletes(r))o="delete",s=fI(r.content.getContent());else return;t.set(n,{action:o,oldValue:s})}}),this._keys=t}return this._keys}get delta(){return this.changes.delta}adds(t){return t.id.clock>=(this.transaction.beforeState.get(t.id.client)||0)}get changes(){let t=this._changes;if(t===null){if(this.transaction.doc._transactionCleanups.length===0)throw EA(SE);let A=this.target,i=PA(),n=PA(),r=[];if(t={added:i,deleted:n,delta:r,keys:this.keys},this.transaction.changed.get(A).has(null)){let s=null,a=()=>{s&&r.push(s)};for(let c=A._start;c!==null;c=c.right)c.deleted?this.deletes(c)&&!this.adds(c)&&((s===null||s.delete===void 0)&&(a(),s={delete:0}),s.delete+=c.length,n.add(c)):this.adds(c)?((s===null||s.insert===void 0)&&(a(),s={insert:[]}),s.insert=s.insert.concat(c.content.getContent()),i.add(c)):((s===null||s.retain===void 0)&&(a(),s={retain:0}),s.retain+=c.length);s!==null&&s.retain===void 0&&a()}this._changes=t}return t}},kU=(e,t)=>{let A=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)A.unshift(t._item.parentSub);else{let i=0,n=t._item.parent._start;for(;n!==t._item&&n!==null;)n.deleted||i++,n=n.right;A.unshift(i)}t=t._item.parent}return A},_E=80,hf=0,of=class{constructor(t,A){t.marker=!0,this.p=t,this.index=A,this.timestamp=hf++}},SU=e=>{e.timestamp=hf++},TE=(e,t,A)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=A,e.timestamp=hf++},UU=(e,t,A)=>{if(e.length>=_E){let i=e.reduce((n,r)=>n.timestamp{if(e._start===null||t===0||e._searchMarker===null)return null;let A=e._searchMarker.length===0?null:e._searchMarker.reduce((r,o)=>or(t-r.index)t;)i=i.left,!i.deleted&&i.countable&&(n-=i.length);for(;i.left!==null&&i.left.id.client===i.id.client&&i.left.id.clock+i.left.length===i.id.clock;)i=i.left,!i.deleted&&i.countable&&(n-=i.length);return A!==null&&or(A.index-n){for(let i=e.length-1;i>=0;i--){let n=e[i];if(A>0){let r=n.p;for(r.marker=!1;r&&(r.deleted||!r.countable);)r=r.left,r&&!r.deleted&&r.countable&&(n.index-=r.length);if(r===null||r.marker===!0){e.splice(i,1);continue}n.p=r,r.marker=!0}(t0&&t===n.index)&&(n.index=VA(t,n.index+A))}};var VI=(e,t,A)=>{let i=e,n=t.changedParentTypes;for(;hA(n,e,()=>[]).push(A),e._item!==null;)e=e._item.parent;LE(i._eH,A,t)},Re=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=mE(),this._dEH=mE(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(t,A){this.doc=t,this._item=A}_copy(){throw sA()}clone(){throw sA()}_write(t){}get _first(){let t=this._start;for(;t!==null&&t.deleted;)t=t.right;return t}_callObserver(t,A){!t.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(t){yE(this._eH,t)}observeDeep(t){yE(this._dEH,t)}unobserve(t){wE(this._eH,t)}unobserveDeep(t){wE(this._dEH,t)}toJSON(){}},XE=(e,t,A)=>{t<0&&(t=e._length+t),A<0&&(A=e._length+A);let i=A-t,n=[],r=e._start;for(;r!==null&&i>0;){if(r.countable&&!r.deleted){let o=r.content.getContent();if(o.length<=t)t-=o.length;else{for(let s=t;s0;s++)n.push(o[s]),i--;t=0}}r=r.right}return n},ZE=e=>{let t=[],A=e._start;for(;A!==null;){if(A.countable&&!A.deleted){let i=A.content.getContent();for(let n=0;n{let A=0,i=e._start;for(;i!==null;){if(i.countable&&!i.deleted){let n=i.content.getContent();for(let r=0;r{let A=[];return rs(e,(i,n)=>{A.push(t(i,n,e))}),A},NU=e=>{let t=e._start,A=null,i=0;return{[Symbol.iterator](){return this},next:()=>{if(A===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};A=t.content.getContent(),i=0,t=t.right}let n=A[i++];return A.length<=i&&(A=null),{done:!1,value:n}}}},jE=(e,t)=>{let A=PI(e,t),i=e._start;for(A!==null&&(i=A.p,t-=A.index);i!==null;i=i.right)if(!i.deleted&&i.countable){if(t{let n=A,r=e.doc,o=r.clientID,s=r.store,a=A===null?t._start:A.right,c=[],I=()=>{c.length>0&&(n=new Ye(Ae(o,Le(s,o)),n,n&&n.lastId,a,a&&a.id,t,null,new Qr(c)),n.integrate(e,0),c=[])};i.forEach(l=>{if(l===null)c.push(l);else switch(l.constructor){case Number:case Object:case Boolean:case Array:case String:c.push(l);break;default:switch(I(),l.constructor){case Uint8Array:case ArrayBuffer:n=new Ye(Ae(o,Le(s,o)),n,n&&n.lastId,a,a&&a.id,t,null,new cs(new Uint8Array(l))),n.integrate(e,0);break;case ts:n=new Ye(Ae(o,Le(s,o)),n,n&&n.lastId,a,a&&a.id,t,null,new ls(l)),n.integrate(e,0);break;default:if(l instanceof Re)n=new Ye(Ae(o,Le(s,o)),n,n&&n.lastId,a,a&&a.id,t,null,new TA(l)),n.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),I()},$E=()=>EA("Length exceeded!"),em=(e,t,A,i)=>{if(A>t._length)throw $E();if(A===0)return t._searchMarker&&ns(t._searchMarker,A,i.length),JI(e,t,null,i);let n=A,r=PI(t,A),o=t._start;for(r!==null&&(o=r.p,A-=r.index,A===0&&(o=o.prev,A+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(A<=o.length){A{let n=(t._searchMarker||[]).reduce((r,o)=>o.index>r.index?o:r,{index:0,p:t._start}).p;if(n)for(;n.right;)n=n.right;return JI(e,t,n,A)},tm=(e,t,A,i)=>{if(i===0)return;let n=A,r=i,o=PI(t,A),s=t._start;for(o!==null&&(s=o.p,A-=o.index);s!==null&&A>0;s=s.right)!s.deleted&&s.countable&&(A0&&s!==null;)s.deleted||(i0)throw $E();t._searchMarker&&ns(t._searchMarker,n,-r+i)},qI=(e,t,A)=>{let i=t._map.get(A);i!==void 0&&i.delete(e)},pf=(e,t,A,i)=>{let n=t._map.get(A)||null,r=e.doc,o=r.clientID,s;if(i==null)s=new Qr([i]);else switch(i.constructor){case Number:case Object:case Boolean:case Array:case String:s=new Qr([i]);break;case Uint8Array:s=new cs(i);break;case ts:s=new ls(i);break;default:if(i instanceof Re)s=new TA(i);else throw new Error("Unexpected content type")}new Ye(Ae(o,Le(r.store,o)),n,n&&n.lastId,null,null,t,A,s).integrate(e,0)},Ef=(e,t)=>{let A=e._map.get(t);return A!==void 0&&!A.deleted?A.content.getContent()[A.length-1]:void 0},Am=e=>{let t={};return e._map.forEach((A,i)=>{A.deleted||(t[i]=A.content.getContent()[A.length-1])}),t},im=(e,t)=>{let A=e._map.get(t);return A!==void 0&&!A.deleted};var GU=(e,t)=>{let A={};return e._map.forEach((i,n)=>{let r=i;for(;r!==null&&(!t.sv.has(r.id.client)||r.id.clock>=(t.sv.get(r.id.client)||0));)r=r.left;r!==null&&Br(r,t)&&(A[n]=r.content.getContent()[r.length-1])}),A},DI=e=>QE(e.entries(),t=>!t[1].deleted),sf=class extends dr{constructor(t,A){super(t,A),this._transaction=A}},KI=class e extends Re{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){let A=new e;return A.push(t),A}_integrate(t,A){super._integrate(t,A),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(A=>A instanceof Re?A.clone():A)),t}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}_callObserver(t,A){super._callObserver(t,A),VI(this,t,new sf(this,t))}insert(t,A){this.doc!==null?de(this.doc,i=>{em(i,this,t,A)}):this._prelimContent.splice(t,0,...A)}push(t){this.doc!==null?de(this.doc,A=>{xU(A,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,A=1){this.doc!==null?de(this.doc,i=>{tm(i,this,t,A)}):this._prelimContent.splice(t,A)}get(t){return jE(this,t)}toArray(){return ZE(this)}slice(t=0,A=this.length){return XE(this,t,A)}toJSON(){return this.map(t=>t instanceof Re?t.toJSON():t)}map(t){return WE(this,t)}forEach(t){rs(this,t)}[Symbol.iterator](){return NU(this)}_write(t){t.writeTypeRef($U)}},HU=e=>new KI,af=class extends dr{constructor(t,A,i){super(t,A),this.keysChanged=i}},os=class e extends Re{constructor(t){super(),this._prelimContent=null,t===void 0?this._prelimContent=new Map:this._prelimContent=new Map(t)}_integrate(t,A){super._integrate(t,A),this._prelimContent.forEach((i,n)=>{this.set(n,i)}),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return this.forEach((A,i)=>{t.set(i,A instanceof Re?A.clone():A)}),t}_callObserver(t,A){VI(this,t,new af(this,t,A))}toJSON(){let t={};return this._map.forEach((A,i)=>{if(!A.deleted){let n=A.content.getContent()[A.length-1];t[i]=n instanceof Re?n.toJSON():n}}),t}get size(){return[...DI(this._map)].length}keys(){return wI(DI(this._map),t=>t[0])}values(){return wI(DI(this._map),t=>t[1].content.getContent()[t[1].length-1])}entries(){return wI(DI(this._map),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this._map.forEach((A,i)=>{A.deleted||t(A.content.getContent()[A.length-1],i,this)})}[Symbol.iterator](){return this.entries()}delete(t){this.doc!==null?de(this.doc,A=>{qI(A,this,t)}):this._prelimContent.delete(t)}set(t,A){return this.doc!==null?de(this.doc,i=>{pf(i,this,t,A)}):this._prelimContent.set(t,A),A}get(t){return Ef(this,t)}has(t){return im(this,t)}clear(){this.doc!==null?de(this.doc,t=>{this.forEach(function(A,i,n){qI(t,n,i)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(eN)}},MU=e=>new os,ki=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&sE(e,t),ss=class{constructor(t,A,i,n){this.left=t,this.right=A,this.index=i,this.currentAttributes=n}forward(){switch(this.right===null&&aA(),this.right.content.constructor){case Je:this.right.deleted||pr(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}},UE=(e,t,A)=>{for(;t.right!==null&&A>0;){switch(t.right.content.constructor){case Je:t.right.deleted||pr(t.currentAttributes,t.right.content);break;default:t.right.deleted||(A{let i=new Map,n=PI(t,A);if(n){let r=new ss(n.p.left,n.p,n.index,i);return UE(e,r,A-n.index)}else{let r=new ss(null,t._start,0,i);return UE(e,r,A)}},nm=(e,t,A,i)=>{for(;A.right!==null&&(A.right.deleted===!0||A.right.content.constructor===Je&&ki(i.get(A.right.content.key),A.right.content.value));)A.right.deleted||i.delete(A.right.content.key),A.forward();let n=e.doc,r=n.clientID;i.forEach((o,s)=>{let a=A.left,c=A.right,I=new Ye(Ae(r,Le(n.store,r)),a,a&&a.lastId,c,c&&c.id,t,null,new Je(s,o));I.integrate(e,0),A.right=I,A.forward()})},pr=(e,t)=>{let{key:A,value:i}=t;i===null?e.delete(A):e.set(A,i)},rm=(e,t)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===Je&&ki(t[e.right.content.key]||null,e.right.content.value)))break;e.forward()}},om=(e,t,A,i)=>{let n=e.doc,r=n.clientID,o=new Map;for(let s in i){let a=i[s],c=A.currentAttributes.get(s)||null;if(!ki(c,a)){o.set(s,c);let{left:I,right:l}=A;A.right=new Ye(Ae(r,Le(n.store,r)),I,I&&I.lastId,l,l&&l.id,t,null,new Je(s,a)),A.right.integrate(e,0),A.forward()}}return o},ju=(e,t,A,i,n)=>{A.currentAttributes.forEach((g,u)=>{n[u]===void 0&&(n[u]=null)});let r=e.doc,o=r.clientID;rm(A,n);let s=om(e,t,A,n),a=i.constructor===String?new _A(i):i instanceof Re?new TA(i):new fn(i),{left:c,right:I,index:l}=A;t._searchMarker&&ns(t._searchMarker,A.index,a.getLength()),I=new Ye(Ae(o,Le(r.store,o)),c,c&&c.lastId,I,I&&I.id,t,null,a),I.integrate(e,0),A.right=I,A.index=l,A.forward(),nm(e,t,A,s)},NE=(e,t,A,i,n)=>{let r=e.doc,o=r.clientID;rm(A,n);let s=om(e,t,A,n);e:for(;A.right!==null&&(i>0||s.size>0&&(A.right.deleted||A.right.content.constructor===Je));){if(!A.right.deleted)switch(A.right.content.constructor){case Je:{let{key:a,value:c}=A.right.content,I=n[a];if(I!==void 0){if(ki(I,c))s.delete(a);else{if(i===0)break e;s.set(a,c)}A.right.delete(e)}else A.currentAttributes.set(a,c);break}default:i0){let a="";for(;i>0;i--)a+=` `;A.right=new Ye(Ae(o,Le(r.store,o)),A.left,A.left&&A.left.lastId,A.right,A.right&&A.right.id,t,null,new _A(a)),A.right.integrate(e,0),A.forward()}nm(e,t,A,s)},sm=(e,t,A,i,n)=>{let r=t,o=lt();for(;r&&(!r.countable||r.deleted);){if(!r.deleted&&r.content.constructor===Je){let c=r.content;o.set(c.key,c)}r=r.right}let s=0,a=!1;for(;t!==r;){if(A===t&&(a=!0),!t.deleted){let c=t.content;switch(c.constructor){case Je:{let{key:I,value:l}=c,g=i.get(I)||null;(o.get(I)!==c||g===l)&&(t.delete(e),s++,!a&&(n.get(I)||null)===l&&g!==l&&(g===null?n.delete(I):n.set(I,g))),!a&&!t.deleted&&pr(n,c);break}}}t=t.right}return s},vU=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;let A=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===Je){let i=t.content.key;A.has(i)?t.delete(e):A.add(i)}t=t.left}},RU=e=>{let t=0;return de(e.doc,A=>{let i=e._start,n=e._start,r=lt(),o=uI(r);for(;n;){if(n.deleted===!1)switch(n.content.constructor){case Je:pr(o,n.content);break;default:t+=sm(A,i,n,r,o),r=uI(o),i=n;break}n=n.right}}),t},JU=e=>{let t=new Set,A=e.doc;for(let[i,n]of e.afterState.entries()){let r=e.beforeState.get(i)||0;n!==r&&PE(e,A.store.clients.get(i),r,n,o=>{!o.deleted&&o.content.constructor===Je&&o.constructor!==wt&&t.add(o.parent)})}de(A,i=>{GE(e,e.deleteSet,n=>{if(n instanceof wt||!n.parent._hasFormatting||t.has(n.parent))return;let r=n.parent;n.content.constructor===Je?t.add(r):vU(i,n)});for(let n of t)RU(n)})},xE=(e,t,A)=>{let i=A,n=uI(t.currentAttributes),r=t.right;for(;A>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case TA:case fn:case _A:A{n===null?this.childListChanged=!0:this.keysChanged.add(n)})}get changes(){if(this._changes===null){let t={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=t}return this._changes}get delta(){if(this._delta===null){let t=this.target.doc,A=[];de(t,i=>{let n=new Map,r=new Map,o=this.target._start,s=null,a={},c="",I=0,l=0,g=()=>{if(s!==null){let u=null;switch(s){case"delete":l>0&&(u={delete:l}),l=0;break;case"insert":(typeof c=="object"||c.length>0)&&(u={insert:c},n.size>0&&(u.attributes={},n.forEach((f,C)=>{f!==null&&(u.attributes[C]=f)}))),c="";break;case"retain":I>0&&(u={retain:I},oE(a)||(u.attributes=nE({},a))),I=0;break}u&&A.push(u),s=null}};for(;o!==null;){switch(o.content.constructor){case TA:case fn:this.adds(o)?this.deletes(o)||(g(),s="insert",c=o.content.getContent()[0],g()):this.deletes(o)?(s!=="delete"&&(g(),s="delete"),l+=1):o.deleted||(s!=="retain"&&(g(),s="retain"),I+=1);break;case _A:this.adds(o)?this.deletes(o)||(s!=="insert"&&(g(),s="insert"),c+=o.content.str):this.deletes(o)?(s!=="delete"&&(g(),s="delete"),l+=o.length):o.deleted||(s!=="retain"&&(g(),s="retain"),I+=o.length);break;case Je:{let{key:u,value:f}=o.content;if(this.adds(o)){if(!this.deletes(o)){let C=n.get(u)||null;ki(C,f)?f!==null&&o.delete(i):(s==="retain"&&g(),ki(f,r.get(u)||null)?delete a[u]:a[u]=f)}}else if(this.deletes(o)){r.set(u,f);let C=n.get(u)||null;ki(C,f)||(s==="retain"&&g(),a[u]=C)}else if(!o.deleted){r.set(u,f);let C=a[u];C!==void 0&&(ki(C,f)?C!==null&&o.delete(i):(s==="retain"&&g(),f===null?delete a[u]:a[u]=f))}o.deleted||(s==="insert"&&g(),pr(n,o.content));break}}o=o.right}for(g();A.length>0;){let u=A[A.length-1];if(u.retain!==void 0&&u.attributes===void 0)A.pop();else break}}),this._delta=A}return this._delta}},as=class e extends Re{constructor(t){super(),this._pending=t!==void 0?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this._length}_integrate(t,A){super._integrate(t,A);try{this._pending.forEach(i=>i())}catch(i){console.error(i)}this._pending=null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}_callObserver(t,A){super._callObserver(t,A);let i=new If(this,t,A);VI(this,t,i),!t.local&&this._hasFormatting&&(t._needFormattingCleanup=!0)}toString(){let t="",A=this._start;for(;A!==null;)!A.deleted&&A.countable&&A.content.constructor===_A&&(t+=A.content.str),A=A.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:A=!0}={}){this.doc!==null?de(this.doc,i=>{let n=new ss(null,this._start,0,new Map);for(let r=0;r0)&&ju(i,this,n,s,o.attributes||{})}else o.retain!==void 0?NE(i,this,n,o.retain,o.attributes||{}):o.delete!==void 0&&xE(i,n,o.delete)}}):this._pending.push(()=>this.applyDelta(t))}toDelta(t,A,i){let n=[],r=new Map,o=this.doc,s="",a=this._start;function c(){if(s.length>0){let l={},g=!1;r.forEach((f,C)=>{g=!0,l[C]=f});let u={insert:s};g&&(u.attributes=l),n.push(u),s=""}}let I=()=>{for(;a!==null;){if(Br(a,t)||A!==void 0&&Br(a,A))switch(a.content.constructor){case _A:{let l=r.get("ychange");t!==void 0&&!Br(a,t)?(l===void 0||l.user!==a.id.client||l.type!=="removed")&&(c(),r.set("ychange",i?i("removed",a.id):{type:"removed"})):A!==void 0&&!Br(a,A)?(l===void 0||l.user!==a.id.client||l.type!=="added")&&(c(),r.set("ychange",i?i("added",a.id):{type:"added"})):l!==void 0&&(c(),r.delete("ychange")),s+=a.content.str;break}case TA:case fn:{c();let l={insert:a.content.getContent()[0]};if(r.size>0){let g={};l.attributes=g,r.forEach((u,f)=>{g[f]=u})}n.push(l);break}case Je:Br(a,t)&&(c(),pr(r,a.content));break}a=a.right}c()};return t||A?de(o,l=>{t&&Af(l,t),A&&Af(l,A),I()},"cleanup"):I(),n}insert(t,A,i){if(A.length<=0)return;let n=this.doc;n!==null?de(n,r=>{let o=kI(r,this,t);i||(i={},o.currentAttributes.forEach((s,a)=>{i[a]=s})),ju(r,this,o,A,i)}):this._pending.push(()=>this.insert(t,A,i))}insertEmbed(t,A,i={}){let n=this.doc;n!==null?de(n,r=>{let o=kI(r,this,t);ju(r,this,o,A,i)}):this._pending.push(()=>this.insertEmbed(t,A,i))}delete(t,A){if(A===0)return;let i=this.doc;i!==null?de(i,n=>{xE(n,kI(n,this,t),A)}):this._pending.push(()=>this.delete(t,A))}format(t,A,i){if(A===0)return;let n=this.doc;n!==null?de(n,r=>{let o=kI(r,this,t);o.right!==null&&NE(r,this,o,A,i)}):this._pending.push(()=>this.format(t,A,i))}removeAttribute(t){this.doc!==null?de(this.doc,A=>{qI(A,this,t)}):this._pending.push(()=>this.removeAttribute(t))}setAttribute(t,A){this.doc!==null?de(this.doc,i=>{pf(i,this,t,A)}):this._pending.push(()=>this.setAttribute(t,A))}getAttribute(t){return Ef(this,t)}getAttributes(){return Am(this)}_write(t){t.writeTypeRef(tN)}},qU=e=>new as,$o=class{constructor(t,A=()=>!0){this._filter=A,this._root=t,this._currentNode=t._start,this._firstCall=!0}[Symbol.iterator](){return this}next(){let t=this._currentNode,A=t&&t.content&&t.content.type;if(t!==null&&(!this._firstCall||t.deleted||!this._filter(A)))do if(A=t.content.type,!t.deleted&&(A.constructor===bI||A.constructor===Cr)&&A._start!==null)t=A._start;else for(;t!==null;)if(t.right!==null){t=t.right;break}else t.parent===this._root?t=null:t=t.parent._item;while(t!==null&&(t.deleted||!this._filter(t.content.type)));return this._firstCall=!1,t===null?{value:void 0,done:!0}:(this._currentNode=t,{value:t.content.type,done:!1})}},Cr=class e extends Re{constructor(){super(),this._prelimContent=[]}get firstChild(){let t=this._first;return t?t.content.getContent()[0]:null}_integrate(t,A){super._integrate(t,A),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(A=>A instanceof Re?A.clone():A)),t}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(t){return new $o(this,t)}querySelector(t){t=t.toUpperCase();let i=new $o(this,n=>n.nodeName&&n.nodeName.toUpperCase()===t).next();return i.done?null:i.value}querySelectorAll(t){return t=t.toUpperCase(),pA(new $o(this,A=>A.nodeName&&A.nodeName.toUpperCase()===t))}_callObserver(t,A){VI(this,t,new cf(this,A,t))}toString(){return WE(this,t=>t.toString()).join("")}toJSON(){return this.toString()}toDOM(t=document,A={},i){let n=t.createDocumentFragment();return i!==void 0&&i._createAssociation(n,this),rs(this,r=>{n.insertBefore(r.toDOM(t,A,i),null)}),n}insert(t,A){this.doc!==null?de(this.doc,i=>{em(i,this,t,A)}):this._prelimContent.splice(t,0,...A)}insertAfter(t,A){if(this.doc!==null)de(this.doc,i=>{let n=t&&t instanceof Re?t._item:t;JI(i,this,n,A)});else{let i=this._prelimContent,n=t===null?0:i.findIndex(r=>r===t)+1;if(n===0&&t!==null)throw EA("Reference item not found");i.splice(n,0,...A)}}delete(t,A=1){this.doc!==null?de(this.doc,i=>{tm(i,this,t,A)}):this._prelimContent.splice(t,A)}toArray(){return ZE(this)}push(t){this.insert(this.length,t)}unshift(t){this.insert(0,t)}get(t){return jE(this,t)}slice(t=0,A=this.length){return XE(this,t,A)}forEach(t){rs(this,t)}_write(t){t.writeTypeRef(iN)}},KU=e=>new Cr,bI=class e extends Cr{constructor(t="UNDEFINED"){super(),this.nodeName=t,this._prelimAttrs=new Map}get nextSibling(){let t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){let t=this._item?this._item.prev:null;return t?t.content.type:null}_integrate(t,A){super._integrate(t,A),this._prelimAttrs.forEach((i,n)=>{this.setAttribute(n,i)}),this._prelimAttrs=null}_copy(){return new e(this.nodeName)}clone(){let t=new e(this.nodeName),A=this.getAttributes();return rE(A,(i,n)=>{typeof i=="string"&&t.setAttribute(n,i)}),t.insert(0,this.toArray().map(i=>i instanceof Re?i.clone():i)),t}toString(){let t=this.getAttributes(),A=[],i=[];for(let s in t)i.push(s);i.sort();let n=i.length;for(let s=0;s0?" "+A.join(" "):"";return`<${r}${o}>${super.toString()}`}removeAttribute(t){this.doc!==null?de(this.doc,A=>{qI(A,this,t)}):this._prelimAttrs.delete(t)}setAttribute(t,A){this.doc!==null?de(this.doc,i=>{pf(i,this,t,A)}):this._prelimAttrs.set(t,A)}getAttribute(t){return Ef(this,t)}hasAttribute(t){return im(this,t)}getAttributes(t){return t?GU(this,t):Am(this)}toDOM(t=document,A={},i){let n=t.createElement(this.nodeName),r=this.getAttributes();for(let o in r){let s=r[o];typeof s=="string"&&n.setAttribute(o,s)}return rs(this,o=>{n.appendChild(o.toDOM(t,A,i))}),i!==void 0&&i._createAssociation(n,this),n}_write(t){t.writeTypeRef(AN),t.writeKey(this.nodeName)}},bU=e=>new bI(e.readKey()),cf=class extends dr{constructor(t,A,i){super(t,i),this.childListChanged=!1,this.attributesChanged=new Set,A.forEach(n=>{n===null?this.childListChanged=!0:this.attributesChanged.add(n)})}},lf=class e extends os{constructor(t){super(),this.hookName=t}_copy(){return new e(this.hookName)}clone(){let t=new e(this.hookName);return this.forEach((A,i)=>{t.set(i,A)}),t}toDOM(t=document,A={},i){let n=A[this.hookName],r;return n!==void 0?r=n.createDom(this):r=document.createElement(this.hookName),r.setAttribute("data-yjs-hook",this.hookName),i!==void 0&&i._createAssociation(r,this),r}_write(t){t.writeTypeRef(nN),t.writeKey(this.hookName)}},OU=e=>new lf(e.readKey()),gf=class e extends as{get nextSibling(){let t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){let t=this._item?this._item.prev:null;return t?t.content.type:null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}toDOM(t=document,A,i){let n=t.createTextNode(this.toString());return i!==void 0&&i._createAssociation(n,this),n}toString(){return this.toDelta().map(t=>{let A=[];for(let n in t.attributes){let r=[];for(let o in t.attributes[n])r.push({key:o,value:t.attributes[n][o]});r.sort((o,s)=>o.keyn.nodeName=0;n--)i+=``;return i}).join("")}toJSON(){return this.toString()}_write(t){t.writeTypeRef(rN)}},LU=e=>new gf,Is=class{constructor(t,A){this.id=t,this.length=A}get deleted(){throw sA()}mergeWith(t){return!1}write(t,A,i){throw sA()}integrate(t,A){throw sA()}},YU=0,wt=class extends Is{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor!==t.constructor?!1:(this.length+=t.length,!0)}integrate(t,A){A>0&&(this.id.clock+=A,this.length-=A),YE(t.doc.store,this)}write(t,A){t.writeInfo(YU),t.writeLen(this.length-A)}getMissing(t,A){return null}},cs=class e{constructor(t){this.content=t}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new e(this.content)}splice(t){throw sA()}mergeWith(t){return!1}integrate(t,A){}delete(t){}gc(t){}write(t,A){t.writeBuf(this.content)}getRef(){return 3}},PU=e=>new cs(e.readBuf()),OI=class e{constructor(t){this.len=t}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.len)}splice(t){let A=new e(this.len-t);return this.len=t,A}mergeWith(t){return this.len+=t.len,!0}integrate(t,A){NI(t.deleteSet,A.id.client,A.id.clock,this.len),A.markDeleted()}delete(t){}gc(t){}write(t,A){t.writeLen(this.len-A)}getRef(){return 1}},VU=e=>new OI(e.readLen()),am=(e,t)=>new ts({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1}),ls=class e{constructor(t){t._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=t;let A={};this.opts=A,t.gc||(A.gc=!1),t.autoLoad&&(A.autoLoad=!0),t.meta!==null&&(A.meta=t.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new e(am(this.doc.guid,this.opts))}splice(t){throw sA()}mergeWith(t){return!1}integrate(t,A){this.doc._item=A,t.subdocsAdded.add(this.doc),this.doc.shouldLoad&&t.subdocsLoaded.add(this.doc)}delete(t){t.subdocsAdded.has(this.doc)?t.subdocsAdded.delete(this.doc):t.subdocsRemoved.add(this.doc)}gc(t){}write(t,A){t.writeString(this.doc.guid),t.writeAny(this.opts)}getRef(){return 9}},zU=e=>new ls(am(e.readString(),e.readAny())),fn=class e{constructor(t){this.embed=t}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new e(this.embed)}splice(t){throw sA()}mergeWith(t){return!1}integrate(t,A){}delete(t){}gc(t){}write(t,A){t.writeJSON(this.embed)}getRef(){return 5}},_U=e=>new fn(e.readJSON()),Je=class e{constructor(t,A){this.key=t,this.value=A}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.key,this.value)}splice(t){throw sA()}mergeWith(t){return!1}integrate(t,A){let i=A.parent;i._searchMarker=null,i._hasFormatting=!0}delete(t){}gc(t){}write(t,A){t.writeKey(this.key),t.writeJSON(this.value)}getRef(){return 6}},TU=e=>new Je(e.readKey(),e.readJSON()),uf=class e{constructor(t){this.arr=t}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let A=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),A}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,A){}delete(t){}gc(t){}write(t,A){let i=this.arr.length;t.writeLen(i-A);for(let n=A;n{let t=e.readLen(),A=[];for(let i=0;i{let t=e.readLen(),A=[];for(let i=0;i=55296&&i<=56319&&(this.str=this.str.slice(0,t-1)+"\uFFFD",A.str="\uFFFD"+A.str.slice(1)),A}mergeWith(t){return this.str+=t.str,!0}integrate(t,A){}delete(t){}gc(t){}write(t,A){t.writeString(A===0?this.str:this.str.slice(A))}getRef(){return 4}},WU=e=>new _A(e.readString()),jU=[HU,MU,qU,bU,KU,OU,LU],$U=0,eN=1,tN=2,AN=3,iN=4,nN=5,rN=6,TA=class e{constructor(t){this.type=t}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new e(this.type._copy())}splice(t){throw sA()}mergeWith(t){return!1}integrate(t,A){this.type._integrate(t.doc,A)}delete(t){let A=this.type._start;for(;A!==null;)A.deleted?A.id.clock<(t.beforeState.get(A.id.client)||0)&&t._mergeStructs.push(A):A.delete(t),A=A.right;this.type._map.forEach(i=>{i.deleted?i.id.clock<(t.beforeState.get(i.id.client)||0)&&t._mergeStructs.push(i):i.delete(t)}),t.changed.delete(this.type)}gc(t){let A=this.type._start;for(;A!==null;)A.gc(t,!0),A=A.right;this.type._start=null,this.type._map.forEach(i=>{for(;i!==null;)i.gc(t,!0),i=i.left}),this.type._map=new Map}write(t,A){this.type._write(t)}getRef(){return 7}},oN=e=>new TA(jU[e.readTypeRef()](e));var LI=(e,t,A)=>{let{client:i,clock:n}=t.id,r=new Ye(Ae(i,n+A),t,Ae(i,n+A-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(A));return t.deleted&&r.markDeleted(),t.keep&&(r.keep=!0),t.redone!==null&&(r.redone=Ae(t.redone.client,t.redone.clock+A)),t.right=r,r.right!==null&&(r.right.left=r),e._mergeStructs.push(r),r.parentSub!==null&&r.right===null&&r.parent._map.set(r.parentSub,r),t.length=A,r};var Ye=class e extends Is{constructor(t,A,i,n,r,o,s,a){super(t,a.getLength()),this.origin=i,this.left=A,this.right=n,this.rightOrigin=r,this.parent=o,this.parentSub=s,this.redone=null,this.content=a,this.info=this.content.isCountable()?2:0}set marker(t){(this.info&8)>0!==t&&(this.info^=8)}get marker(){return(this.info&8)>0}get keep(){return(this.info&1)>0}set keep(t){this.keep!==t&&(this.info^=1)}get countable(){return(this.info&2)>0}get deleted(){return(this.info&4)>0}set deleted(t){this.deleted!==t&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(t,A){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Le(A,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Le(A,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Si&&this.id.client!==this.parent.client&&this.parent.clock>=Le(A,this.parent.client))return this.parent.client;if(this.origin&&(this.left=FE(t,A,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Ni(t,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===wt||this.right&&this.right.constructor===wt)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===e&&(this.parent=this.left.parent,this.parentSub=this.left.parentSub),this.right&&this.right.constructor===e&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Si){let i=Wu(A,this.parent);i.constructor===wt?this.parent=null:this.parent=i.content.type}return null}integrate(t,A){if(A>0&&(this.id.clock+=A,this.left=FE(t,t.doc.store,Ae(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(A),this.length-=A),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let i=this.left,n;if(i!==null)n=i.right;else if(this.parentSub!==null)for(n=this.parent._map.get(this.parentSub)||null;n!==null&&n.left!==null;)n=n.left;else n=this.parent._start;let r=new Set,o=new Set;for(;n!==null&&n!==this.right;){if(o.add(n),r.add(n),FI(this.origin,n.origin)){if(n.id.client{i.p===t&&(i.p=this,!this.deleted&&this.countable&&(i.index-=this.length))}),t.keep&&(this.keep=!0),this.right=t.right,this.right!==null&&(this.right.left=this),this.length+=t.length,!0}return!1}delete(t){if(!this.deleted){let A=this.parent;this.countable&&this.parentSub===null&&(A._length-=this.length),this.markDeleted(),NI(t.deleteSet,this.id.client,this.id.clock,this.length),kE(t,A,this.parentSub),this.content.delete(t)}}gc(t,A){if(!this.deleted)throw aA();this.content.gc(t),A?QU(t,this,new wt(this.id,this.length)):this.content=new OI(this.length)}write(t,A){let i=A>0?Ae(this.id.client,this.id.clock+A-1):this.origin,n=this.rightOrigin,r=this.parentSub,o=this.content.getRef()&31|(i===null?0:128)|(n===null?0:64)|(r===null?0:32);if(t.writeInfo(o),i!==null&&t.writeLeftID(i),n!==null&&t.writeRightID(n),i===null&&n===null){let s=this.parent;if(s._item!==void 0){let a=s._item;if(a===null){let c=BU(s);t.writeParentInfo(!0),t.writeString(c)}else t.writeParentInfo(!1),t.writeLeftID(a.id)}else s.constructor===String?(t.writeParentInfo(!0),t.writeString(s)):s.constructor===Si?(t.writeParentInfo(!1),t.writeLeftID(s)):aA();r!==null&&t.writeString(r)}this.content.write(t,A)}},Im=(e,t)=>sN[t&31](e),sN=[()=>{aA()},VU,XU,PU,WU,_U,TU,oN,ZU,zU,()=>{aA()}],aN=10,Ft=class extends Is{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor!==t.constructor?!1:(this.length+=t.length,!0)}integrate(t,A){aA()}write(t,A){t.writeInfo(aN),W(t.restEncoder,this.length-A)}getMissing(t,A){return null}},cm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},lm="__ $YJS$ __";cm[lm]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");cm[lm]=!0;var zI={proxies:new WeakMap,traps:new WeakMap},gm=(e,t,A)=>e.get(t)||e.set(t,new A).get(t),um=e=>e.join(),fm=(e,t,A,i,n)=>{gm(gm(zI.traps,e,WeakMap),t,Map).set(um(A),i),zI.proxies.set(i,n)},mf=(e,t,A)=>{var i,n;return zI.proxies.get((n=(i=zI.traps.get(e))===null||i===void 0?void 0:i.get(t))===null||n===void 0?void 0:n.get(um(A)))};var cN=Symbol("default"),lN=Object.keys(Object.getOwnPropertyDescriptors(Reflect)),gN=["get","has","set","defineProperty","deleteProperty","getOwnPropertyDescriptor"],uN=(e,t)=>{let A,i,n,r,o,s,a,c;switch(e){case"get":[A,i,r]=t;break;case"set":[A,i,n,r]=t;break;case"deleteProperty":case"defineProperty":[A,s]=t;break;case"has":case"getOwnPropertyDescriptor":[A,i]=t;break;case"apply":[A,a,o]=t;break;case"construct":[A,o]=t;break;case"setPrototypeOf":[A,c]=t;break;default:[A]=t}return{target:A,name:i,receiver:r,val:n,args:o,descriptor:s,thisValue:a,prototype:c}},fN=(e,t)=>{let{trapName:A,handler:i,traps:n,root:r,path:o}=e,{target:s,name:a,val:c,receiver:I,args:l,descriptor:g,thisValue:u,prototype:f}=uN(A,t),C=gN.includes(A)?a:void 0;return{parameters:t,target:s,name:a,val:c,args:l,descriptor:g,receiver:I,thisValue:u,prototype:f,trapName:A,traps:n,path:o,handler:i,key:C,newValue:A==="set"?c:void 0,root:r,get proxy(){return mf(r,s,o)},get value(){return C&&s[C]},DEFAULT:cN,PROXY:Bm.bind({root:r,handler:i,path:[...o,C]})}},BN=function(...e){let{trapName:t,handler:A}=this,i=fN(this,e),{PROXY:n,DEFAULT:r}=i,o=A(i);return o===n?n(i.value):o===r?Reflect[t](...e):o},dN=(e,t,A)=>lN.reduce((i,n)=>(i[n]=BN.bind({trapName:n,handler:e,traps:i,root:t,path:A}),i),{}),CN=e=>{if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Deep proxy could be applied to objects and functions only")},QN=({DEFAULT:e})=>e,Bm=function(e,t,A,i){CN(e);let n=Object.assign({},this),r=t||n.handler||QN,o=A||n.path||[],s=n.root||i||e,a=mf(s,e,o);if(a)return a;let c=dN(r,s,o),I=new Proxy(e,c);return fm(s,e,o,c,I),I},dm=class{constructor(e,t,A,i){return Bm(e,t,A,i)}};function fs(e,t,A,i){function n(r){return r instanceof A?r:new A(function(o){o(r)})}return new(A||(A=Promise))(function(r,o){function s(I){try{c(i.next(I))}catch(l){o(l)}}function a(I){try{c(i.throw(I))}catch(l){o(l)}}function c(I){I.done?r(I.value):n(I.value).then(s,a)}c((i=i.apply(e,t||[])).next())})}var Ee=class{constructor(){this.mutex=Promise.resolve()}lock(){let t=()=>{};return this.mutex=this.mutex.then(()=>new Promise(t)),new Promise(A=>{t=A})}dispatch(t){return fs(this,void 0,void 0,function*(){let A=yield this.lock();try{return yield Promise.resolve(t())}finally{A()}})}},yf;function hN(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global}var Df=hN(),wf=(yf=Df.Buffer)!==null&&yf!==void 0?yf:null,pN=Df.TextEncoder?new Df.TextEncoder:null;function ym(e,t){return(e&15)+(e>>6|e>>3&8)<<4|(t&15)+(t>>6|t>>3&8)}function EN(e,t){let A=t.length>>1;for(let i=0;i>>4;e[i++]=r>9?r+Cm:r+Qm,r=t[n]&15,e[i++]=r>9?r+Cm:r+Qm}return String.fromCharCode.apply(null,e)}var pm=wf!==null?e=>{if(typeof e=="string"){let t=wf.from(e,"utf8");return new Uint8Array(t.buffer,t.byteOffset,t.length)}if(wf.isBuffer(e))return new Uint8Array(e.buffer,e.byteOffset,e.length);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Invalid data type!")}:e=>{if(typeof e=="string")return pN.encode(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Invalid data type!")},Em="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",us=new Uint8Array(256);for(let e=0;e>4,n+=1,i[n]=(s&15)<<4|a>>2,n+=1,i[n]=(a&3)<<6|c&63,n+=1}return i}var _I=16*1024,gs=4,FN=new Ee,Ff=new Map;function DN(e,t){return fs(this,void 0,void 0,function*(){let A=null,i=null,n=!1;if(typeof WebAssembly>"u")throw new Error("WebAssembly is not supported in this environment!");let r=(D,S=0)=>{i.set(D,S)},o=()=>i,s=()=>A.exports,a=D=>{A.exports.Hash_SetMemorySize(D);let S=A.exports.Hash_GetBuffer(),N=A.exports.memory.buffer;i=new Uint8Array(N,S,D)},c=()=>new DataView(A.exports.memory.buffer).getUint32(A.exports.STATE_SIZE,!0),I=FN.dispatch(()=>fs(this,void 0,void 0,function*(){if(!Ff.has(e.name)){let S=wN(e.data),N=WebAssembly.compile(S);Ff.set(e.name,N)}let D=yield Ff.get(e.name);A=yield WebAssembly.instantiate(D,{})})),l=()=>fs(this,void 0,void 0,function*(){A||(yield I);let D=A.exports.Hash_GetBuffer(),S=A.exports.memory.buffer;i=new Uint8Array(S,D,_I)}),g=(D=null)=>{n=!0,A.exports.Hash_Init(D)},u=D=>{let S=0;for(;S{if(!n)throw new Error("update() called before init()");let S=pm(D);u(S)},C=new Uint8Array(t*2),F=(D,S=null)=>{if(!n)throw new Error("digest() called before init()");return n=!1,A.exports.Hash_Final(S),D==="binary"?i.slice(0,t):hm(C,i,t)},d=()=>{if(!n)throw new Error("save() can only be called after init() and before digest()");let D=A.exports.Hash_GetState(),S=c(),N=A.exports.memory.buffer,b=new Uint8Array(N,D,S),q=new Uint8Array(gs+S);return EN(q,e.hash),q.set(b,gs),q},B=D=>{if(!(D instanceof Uint8Array))throw new Error("load() expects an Uint8Array generated by save()");let S=A.exports.Hash_GetState(),N=c(),b=gs+N,q=A.exports.memory.buffer;if(D.length!==b)throw new Error(`Bad state length (expected ${b} bytes, got ${D.length})`);if(!mN(e.hash,D.subarray(0,gs)))throw new Error("This state was written by an incompatible hash implementation");let Z=D.subarray(gs);new Uint8Array(q,S,N).set(Z),n=!0},Q=D=>typeof D=="string"?D.length<_I/4:D.byteLength<_I,y=Q;switch(e.name){case"argon2":case"scrypt":y=()=>!0;break;case"blake2b":case"blake2s":y=(D,S)=>S<=512&&Q(D);break;case"blake3":y=(D,S)=>S===0&&Q(D);break;case"xxhash64":case"xxhash3":case"xxhash128":y=()=>!1;break}let k=(D,S=null,N=null)=>{if(!y(D,S))return g(S),f(D),F("hex",N);let b=pm(D);return i.set(b),A.exports.Hash_Calculate(b.length,S,N),hm(C,i,t)};return yield l(),{getMemory:o,writeMemory:r,getExports:s,setMemorySize:a,init:g,update:f,digest:F,save:d,load:B,calculate:k,hashLength:t}})}function kN(e,t,A){return fs(this,void 0,void 0,function*(){let i=yield e.lock(),n=yield DN(t,A);return i(),n})}var cv=new Ee;var lv=new Ee;var gv=new DataView(new ArrayBuffer(4));var uv=new Ee;var fv=new Ee;var Bv=new Ee;var dv=new Ee;var Cv=new Ee;var Qv=new Ee;var hv=new Ee;var pv=new Ee;var Ev=new Ee;var mv=new Ee;var yv=new Ee;var wv=new Ee;var Fv=new Ee;var SN="xxhash32",UN="AGFzbQEAAAABEQRgAAF/YAF/AGAAAGACf38AAwcGAAEBAgADBQQBAQICBg4CfwFBsIkFC38AQYAICwdwCAZtZW1vcnkCAA5IYXNoX0dldEJ1ZmZlcgAACUhhc2hfSW5pdAABC0hhc2hfVXBkYXRlAAIKSGFzaF9GaW5hbAADDUhhc2hfR2V0U3RhdGUABA5IYXNoX0NhbGN1bGF0ZQAFClNUQVRFX1NJWkUDAQqxEAYFAEGACQtNAEEAQgA3A6iJAUEAIAA2AoiJAUEAIABBz4yijgZqNgKMiQFBACAAQfeUr694ajYChIkBQQAgAEGoiI2hAmo2AoCJAUEAQQA2AqCJAQu4CAEHfwJAIABFDQBBAEEAKQOoiQEgAK18NwOoiQECQEEAKAKgiQEiASAAakEPSw0AAkACQCAAQQNxIgINAEGACSEDIAAhBAwBCyAAQXxxIQRBgAkhAwNAQQBBACgCoIkBIgVBAWo2AqCJASAFQZCJAWogAy0AADoAACADQQFqIQMgAkF/aiICDQALCyAAQQRJDQEDQEEAQQAoAqCJASICQQFqNgKgiQEgAkGQiQFqIAMtAAA6AAAgA0EBai0AACECQQBBACgCoIkBIgVBAWo2AqCJASAFQZCJAWogAjoAACADQQJqLQAAIQJBAEEAKAKgiQEiBUEBajYCoIkBIAVBkIkBaiACOgAAIANBA2otAAAhAkEAQQAoAqCJASIFQQFqNgKgiQEgBUGQiQFqIAI6AAAgA0EEaiEDIARBfGoiBA0ADAILCyAAQfAIaiEGAkACQCABDQBBACgCjIkBIQJBACgCiIkBIQVBACgChIkBIQRBACgCgIkBIQFBgAkhAwwBC0GACSEDAkAgAUEPSw0AQYAJIQMCQAJAQQAgAWtBA3EiBA0AIAEhBQwBCyABIQIDQEEAIAJBAWoiBTYCoIkBIAJBkIkBaiADLQAAOgAAIANBAWohAyAFIQIgBEF/aiIEDQALCyABQXNqQQNJDQBBACEEA0AgAyAEaiIBLQAAIQdBACAFIARqIgJBAWo2AqCJASACQZCJAWogBzoAACABQQFqLQAAIQdBACACQQJqNgKgiQEgAkGRiQFqIAc6AAAgAUECai0AACEHQQAgAkEDajYCoIkBIAJBkokBaiAHOgAAIAFBA2otAAAhAUEAIAJBBGo2AqCJASACQZOJAWogAToAACAFIARBBGoiBGpBEEcNAAsgAyAEaiEDC0EAQQAoApCJAUH3lK+veGxBACgCgIkBakENd0Gx893xeWwiATYCgIkBQQBBACgClIkBQfeUr694bEEAKAKEiQFqQQ13QbHz3fF5bCIENgKEiQFBAEEAKAKYiQFB95Svr3hsQQAoAoiJAWpBDXdBsfPd8XlsIgU2AoiJAUEAQQAoApyJAUH3lK+veGxBACgCjIkBakENd0Gx893xeWwiAjYCjIkBCyAAQYAJaiEAAkAgAyAGSw0AA0AgAygCAEH3lK+veGwgAWpBDXdBsfPd8XlsIQEgA0EMaigCAEH3lK+veGwgAmpBDXdBsfPd8XlsIQIgA0EIaigCAEH3lK+veGwgBWpBDXdBsfPd8XlsIQUgA0EEaigCAEH3lK+veGwgBGpBDXdBsfPd8XlsIQQgA0EQaiIDIAZNDQALC0EAIAI2AoyJAUEAIAU2AoiJAUEAIAQ2AoSJAUEAIAE2AoCJAUEAIAAgA2s2AqCJASAAIANGDQBBACECA0AgAkGQiQFqIAMgAmotAAA6AAAgAkEBaiICQQAoAqCJAUkNAAsLC6QDAgF+Bn9BACkDqIkBIgCnIQECQAJAIABCEFQNAEEAKAKEiQFBB3dBACgCgIkBQQF3akEAKAKIiQFBDHdqQQAoAoyJAUESd2ohAgwBC0EAKAKIiQFBsc/ZsgFqIQILIAIgAWohAkGQiQEhAwJAQQAoAqCJASIEQZCJAWoiBUGUiQFJDQBBkIkBIQEDQCABKAIAQb3cypV8bCACakERd0Gv1tO+AmwhAiABQQhqIQYgAUEEaiIDIQEgBiAFTQ0ACwsCQCADIAVGDQAgBEGPiQFqIQYCQAJAIAQgA2tBAXENACADIQEMAQsgA0EBaiEBIAMtAABBsc/ZsgFsIAJqQQt3QbHz3fF5bCECCyAGIANGDQADQCABQQFqLQAAQbHP2bIBbCABLQAAQbHP2bIBbCACakELd0Gx893xeWxqQQt3QbHz3fF5bCECIAFBAmoiASAFRw0ACwtBACACQQ92IAJzQfeUr694bCIBQQ12IAFzQb3cypV8bCIBQRB2IAFzIgJBGHQgAkGA/gNxQQh0ciABQQh2QYD+A3EgAUEYdnJyrTcDgAkLBgBBgIkBC/MDAgF+BH9BAEIANwOoiQFBACABNgKIiQFBACABQc+Moo4GajYCjIkBQQAgAUH3lK+veGo2AoSJAUEAIAFBqIiNoQJqNgKAiQFBAEEANgKgiQEgABACQQApA6iJASICpyEBAkACQCACQhBUDQBBACgChIkBQQd3QQAoAoCJAUEBd2pBACgCiIkBQQx3akEAKAKMiQFBEndqIQAMAQtBACgCiIkBQbHP2bIBaiEACyAAIAFqIQBBkIkBIQMCQEEAKAKgiQEiBEGQiQFqIgVBlIkBSQ0AQZCJASEBA0AgASgCAEG93MqVfGwgAGpBEXdBr9bTvgJsIQAgAUEIaiEGIAFBBGoiAyEBIAYgBU0NAAsLAkAgAyAFRg0AIARBj4kBaiEGAkACQCAEIANrQQFxDQAgAyEBDAELIANBAWohASADLQAAQbHP2bIBbCAAakELd0Gx893xeWwhAAsgBiADRg0AA0AgAUEBai0AAEGxz9myAWwgAS0AAEGxz9myAWwgAGpBC3dBsfPd8XlsakELd0Gx893xeWwhACABQQJqIgEgBUcNAAsLQQAgAEEPdiAAc0H3lK+veGwiAUENdiABc0G93MqVfGwiAUEQdiABcyIAQRh0IABBgP4DcUEIdHIgAUEIdkGA/gNxIAFBGHZycq03A4AJCwsLAQBBgAgLBDAAAAA=",NN="9e3a00cd",xN={name:SN,data:UN,hash:NN},GN=new Ee,TI=null;function mm(e){return!Number.isInteger(e)||e<0||e>4294967295?new Error("Seed must be a valid 32-bit long unsigned integer."):null}function XI(e,t=0){if(mm(t))return Promise.reject(mm(t));if(TI===null)return kN(GN,xN,4).then(A=>(TI=A,TI.calculate(e,t)));try{let A=TI.calculate(e,t);return Promise.resolve(A)}catch(A){return Promise.reject(A)}}var Dv=new Ee;var kv=new ArrayBuffer(8);var Sv=new Ee;var Uv=new ArrayBuffer(8);var Nv=new Ee;var xv=new ArrayBuffer(8);var Gv=new Ee;var Hv=new Ee;var Mv=new Ee;function Sf(e){return new Promise((t,A)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>A(e.error)})}function Bs(e,t){let A=indexedDB.open(e);A.onupgradeneeded=()=>A.result.createObjectStore(t);let i=Sf(A);return(n,r)=>i.then(o=>r(o.transaction(t,n).objectStore(t)))}var kf;function wm(){return kf||(kf=Bs("keyval-store","keyval")),kf}function Er(e,t=wm()){return t("readonly",A=>Sf(A.get(e)))}function ds(e,t,A=wm()){return A("readwrite",i=>(i.put(t,e),Sf(i.transaction)))}var Nf;try{Nf=new TextDecoder}catch{}var H,zt,h=0;var Rm=[],xf=Rm,Gf=0,ye={},ie,xi,Vt=0,DA=0,Ve,XA,Dt=[],ee,Fm={useRecords:!1,mapsAsObjects:!0},Cs=class{},Mf=new Cs;Mf.name="MessagePack 0xC1";var Gi=!1,Jm=2,Dm,km,Sm;try{new Function("")}catch{Jm=1/0}var dn=class e{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=!1&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,A){if(H)return Om(()=>(WI(),this?this.unpack(t,A):e.prototype.unpack.call(Fm,t,A)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof A=="object"?(zt=A.end||t.length,h=A.start||0):(h=0,zt=A>-1?A:t.length),Gf=0,DA=0,xi=null,xf=Rm,Ve=null,H=t;try{ee=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(i){throw H=null,t instanceof Uint8Array?i:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof e){if(ye=this,this.structures)return ie=this.structures,ZI(A);(!ie||ie.length>0)&&(ie=[])}else ye=Fm,(!ie||ie.length>0)&&(ie=[]);return ZI(A)}unpackMultiple(t,A){let i,n=0;try{Gi=!0;let r=t.length,o=this?this.unpack(t,r):$I.unpack(t,r);if(A){if(A(o,n,h)===!1)return;for(;hi.slice(0)));for(let i=0,n=t.length;i=32&&(r.highByte=i-32>>5))}t.sharedLength=t.length;for(let i in A||[])if(i>=0){let n=t[i],r=A[i];r&&(n&&((t.restoreStructures||(t.restoreStructures=[]))[i]=n),t[i]=r)}return this.structures=t}decode(t,A){return this.unpack(t,A)}};function ZI(e){try{if(!ye.trusted&&!Gi){let A=ie.sharedLength||0;A=32&&Dm?(t=Dm(H,h,zt,ye),H=null,!(e&&e.lazy)&&t&&(t=t.toJSON()),h=zt):t=Ne(),Ve&&(h=Ve.postBundlePosition,Ve=null),Gi&&(ie.restoreStructures=null),h==zt)ie&&ie.restoreStructures&&Um(),ie=null,H=null,XA&&(XA=null);else{if(h>zt)throw new Error("Unexpected end of MessagePack data");if(!Gi){let A;try{A=JSON.stringify(t,(i,n)=>typeof n=="bigint"?`${n}n`:n).slice(0,100)}catch(i){A="(JSON view not available "+i+")"}throw new Error("Data read, but end of buffer not reached "+A)}}return t}catch(t){throw ie&&ie.restoreStructures&&Um(),WI(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||h>zt)&&(t.incomplete=!0),t}}function Um(){for(let e in ie.restoreStructures)ie[e]=ie.restoreStructures[e];ie.restoreStructures=null}function Ne(){let e=H[h++];if(e<160)if(e<128){if(e<64)return e;{let t=ie[e&63]||ye.getStructures&&qm()[e&63];return t?(t.read||(t.read=vf(t,e&63)),t.read()):e}}else if(e<144)if(e-=128,ye.mapsAsObjects){let t={};for(let A=0;A=h)return xi.slice(h-Vt,(h+=t)-Vt);if(DA==0&&zt<140){let A=t<16?Rf(t):Km(t);if(A!=null)return A}return Hf(t)}else{let t;switch(e){case 192:return null;case 193:return Ve?(t=Ne(),t>0?Ve[1].slice(Ve.position1,Ve.position1+=t):Ve[0].slice(Ve.position0,Ve.position0-=t)):Mf;case 194:return!1;case 195:return!0;case 196:if(t=H[h++],t===void 0)throw new Error("Unexpected end of buffer");return Uf(t);case 197:return t=ee.getUint16(h),h+=2,Uf(t);case 198:return t=ee.getUint32(h),h+=4,Uf(t);case 199:return Bn(H[h++]);case 200:return t=ee.getUint16(h),h+=2,Bn(t);case 201:return t=ee.getUint32(h),h+=4,Bn(t);case 202:if(t=ee.getFloat32(h),ye.useFloat32>2){let A=jI[(H[h]&127)<<1|H[h+1]>>7];return h+=4,(A*t+(t>0?.5:-.5)>>0)/A}return h+=4,t;case 203:return t=ee.getFloat64(h),h+=8,t;case 204:return H[h++];case 205:return t=ee.getUint16(h),h+=2,t;case 206:return t=ee.getUint32(h),h+=4,t;case 207:return ye.int64AsType==="number"?(t=ee.getUint32(h)*4294967296,t+=ee.getUint32(h+4)):ye.int64AsType==="string"?t=ee.getBigUint64(h).toString():ye.int64AsType==="auto"?(t=ee.getBigUint64(h),t<=BigInt(2)<=BigInt(-2)<=h?xi.slice(h-Vt,(h+=t)-Vt):MN(t);case 218:return t=ee.getUint16(h),h+=2,DA>=h?xi.slice(h-Vt,(h+=t)-Vt):vN(t);case 219:return t=ee.getUint32(h),h+=4,DA>=h?xi.slice(h-Vt,(h+=t)-Vt):RN(t);case 220:return t=ee.getUint16(h),h+=2,xm(t);case 221:return t=ee.getUint32(h),h+=4,xm(t);case 222:return t=ee.getUint16(h),h+=2,Gm(t);case 223:return t=ee.getUint32(h),h+=4,Gm(t);default:if(e>=224)return e-256;if(e===void 0){let A=new Error("Unexpected end of MessagePack data");throw A.incomplete=!0,A}throw new Error("Unknown MessagePack token "+e)}}}var HN=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function vf(e,t){function A(){if(A.count++>Jm){let n=e.read=new Function("r","return function(){return "+(ye.freezeData?"Object.freeze":"")+"({"+e.map(r=>r==="__proto__"?"__proto_:r()":HN.test(r)?r+":r()":"["+JSON.stringify(r)+"]:r()").join(",")+"})}")(Ne);return e.highByte===0&&(e.read=Nm(t,e.read)),n()}let i={};for(let n=0,r=e.length;nfunction(){let A=H[h++];if(A===0)return t();let i=e<32?-(e+(A<<5)):e+(A<<5),n=ie[i]||qm()[i];if(!n)throw new Error("Record id is not defined for "+i);return n.read||(n.read=vf(n,e)),n.read()};function qm(){let e=Om(()=>(H=null,ye.getStructures()));return ie=ye._mergeStructures(e,ie)}var Hf=Qs,MN=Qs,vN=Qs,RN=Qs;function Qs(e){let t;if(e<16&&(t=Rf(e)))return t;if(e>64&&Nf)return Nf.decode(H.subarray(h,h+=e));let A=h+e,i=[];for(t="";h65535&&(a-=65536,i.push(a>>>10&1023|55296),a=56320|a&1023),i.push(a)}else i.push(n);i.length>=4096&&(t+=Pe.apply(String,i),i.length=0)}return i.length>0&&(t+=Pe.apply(String,i)),t}function xm(e){let t=new Array(e);for(let A=0;A0){h=t;return}A[i]=n}return Pe.apply(String,A)}function Rf(e){if(e<4)if(e<2){if(e===0)return"";{let t=H[h++];if((t&128)>1){h-=1;return}return Pe(t)}}else{let t=H[h++],A=H[h++];if((t&128)>0||(A&128)>0){h-=2;return}if(e<3)return Pe(t,A);let i=H[h++];if((i&128)>0){h-=3;return}return Pe(t,A,i)}else{let t=H[h++],A=H[h++],i=H[h++],n=H[h++];if((t&128)>0||(A&128)>0||(i&128)>0||(n&128)>0){h-=4;return}if(e<6){if(e===4)return Pe(t,A,i,n);{let r=H[h++];if((r&128)>0){h-=5;return}return Pe(t,A,i,n,r)}}else if(e<8){let r=H[h++],o=H[h++];if((r&128)>0||(o&128)>0){h-=6;return}if(e<7)return Pe(t,A,i,n,r,o);let s=H[h++];if((s&128)>0){h-=7;return}return Pe(t,A,i,n,r,o,s)}else{let r=H[h++],o=H[h++],s=H[h++],a=H[h++];if((r&128)>0||(o&128)>0||(s&128)>0||(a&128)>0){h-=8;return}if(e<10){if(e===8)return Pe(t,A,i,n,r,o,s,a);{let c=H[h++];if((c&128)>0){h-=9;return}return Pe(t,A,i,n,r,o,s,a,c)}}else if(e<12){let c=H[h++],I=H[h++];if((c&128)>0||(I&128)>0){h-=10;return}if(e<11)return Pe(t,A,i,n,r,o,s,a,c,I);let l=H[h++];if((l&128)>0){h-=11;return}return Pe(t,A,i,n,r,o,s,a,c,I,l)}else{let c=H[h++],I=H[h++],l=H[h++],g=H[h++];if((c&128)>0||(I&128)>0||(l&128)>0||(g&128)>0){h-=12;return}if(e<14){if(e===12)return Pe(t,A,i,n,r,o,s,a,c,I,l,g);{let u=H[h++];if((u&128)>0){h-=13;return}return Pe(t,A,i,n,r,o,s,a,c,I,l,g,u)}}else{let u=H[h++],f=H[h++];if((u&128)>0||(f&128)>0){h-=14;return}if(e<15)return Pe(t,A,i,n,r,o,s,a,c,I,l,g,u,f);let C=H[h++];if((C&128)>0){h-=15;return}return Pe(t,A,i,n,r,o,s,a,c,I,l,g,u,f,C)}}}}}function Hm(){let e=H[h++],t;if(e<192)t=e-160;else switch(e){case 217:t=H[h++];break;case 218:t=ee.getUint16(h),h+=2;break;case 219:t=ee.getUint32(h),h+=4;break;default:throw new Error("Expected string")}return Qs(t)}function Uf(e){return ye.copyBuffers?Uint8Array.prototype.slice.call(H,h,h+=e):H.subarray(h,h+=e)}function Bn(e){let t=H[h++];if(Dt[t]){let A;return Dt[t](H.subarray(h,A=h+=e),i=>{h=i;try{return Ne()}finally{h=A}})}else throw new Error("Unknown extension type "+t)}var Mm=new Array(4096);function bm(){let e=H[h++];if(e>=160&&e<192){if(e=e-160,DA>=h)return xi.slice(h-Vt,(h+=e)-Vt);if(!(DA==0&&zt<180))return Hf(e)}else return h--,Ne().toString();let t=(e<<5^(e>1?ee.getUint16(h):e>0?H[h]:0))&4095,A=Mm[t],i=h,n=h+e-3,r,o=0;if(A&&A.bytes==e){for(;i{let A=Ne().map(r=>r.toString()),i=e;t!==void 0&&(e=e<32?-((t<<5)+e):(t<<5)+e,A.highByte=t);let n=ie[e];return n&&(n.isShared||Gi)&&((ie.restoreStructures||(ie.restoreStructures=[]))[e]=n),ie[e]=A,A.read=vf(A,i),A.read()};Dt[0]=()=>{};Dt[0].noBuffer=!0;Dt[66]=e=>{let t=e.length,A=BigInt(e[0]&128?e[0]-256:e[0]);for(let i=1;i{let e=Ne();return(JN[e[0]]||Error)(e[1])};Dt[105]=e=>{let t=ee.getUint32(h-4);XA||(XA=new Map);let A=H[h],i;A>=144&&A<160||A==220||A==221?i=[]:i={};let n={target:i};XA.set(t,n);let r=Ne();return n.used?Object.assign(i,r):(n.target=r,r)};Dt[112]=e=>{let t=ee.getUint32(h-4),A=XA.get(t);return A.used=!0,A.target};Dt[115]=()=>new Set(Ne());var Jf=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array"),qN=typeof globalThis=="object"?globalThis:window;Dt[116]=e=>{let t=e[0],A=Jf[t];if(!A)throw new Error("Could not find typed array for code "+t);return new qN[A](Uint8Array.prototype.slice.call(e,1).buffer)};Dt[120]=()=>{let e=Ne();return new RegExp(e[0],e[1])};var KN=[];Dt[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],A=h;return h+=t-e.length,Ve=KN,Ve=[Hm(),Hm()],Ve.position0=0,Ve.position1=0,Ve.postBundlePosition=h,h=A,Ne()};Dt[255]=e=>e.length==4?new Date((e[0]*16777216+(e[1]<<16)+(e[2]<<8)+e[3])*1e3):e.length==8?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+((e[3]&3)*4294967296+e[4]*16777216+(e[5]<<16)+(e[6]<<8)+e[7])*1e3):e.length==12?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+((e[4]&128?-281474976710656:0)+e[6]*1099511627776+e[7]*4294967296+e[8]*16777216+(e[9]<<16)+(e[10]<<8)+e[11])*1e3):new Date("invalid");function Om(e){Sm&&Sm();let t=zt,A=h,i=Gf,n=Vt,r=DA,o=xi,s=xf,a=XA,c=Ve,I=new Uint8Array(H.slice(0,zt)),l=ie,g=ie.slice(0,ie.length),u=ye,f=Gi,C=e();return zt=t,h=A,Gf=i,Vt=n,DA=r,xi=o,xf=s,XA=a,Ve=c,H=I,Gi=f,ie=l,ie.splice(0,ie.length,...g),ye=u,ee=new DataView(H.buffer,H.byteOffset,H.byteLength),C}function WI(){H=null,XA=null,ie=null}var jI=new Array(147);for(let e=0;e<256;e++)jI[e]=+("1e"+Math.floor(45.15-e*.30103));var $I=new dn({useRecords:!1}),bN=$I.unpack,ON=$I.unpackMultiple,LN=$I.unpack,ec={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4},YN=new Float32Array(1),Jv=new Uint8Array(YN.buffer,0,4);var Ac;try{Ac=new TextEncoder}catch{}var qf,zm,ic=typeof Buffer<"u",tc=ic?function(e){return Buffer.allocUnsafeSlow(e)}:Uint8Array,_m=ic?Buffer:Uint8Array,Lm=ic?4294967296:2144337920,E,hs,le,p=0,gt,ke=null,PN,VN=21760,zN=/[\u0080-\uFFFF]/,mr=Symbol("record-id"),Cn=class extends dn{constructor(t){super(t),this.offset=0;let A,i,n,r,o,s=_m.prototype.utf8Write?function(m,J){return E.utf8Write(m,J,4294967295)}:Ac&&Ac.encodeInto?function(m,J){return Ac.encodeInto(m,E.subarray(J)).written}:!1,a=this;t||(t={});let c=t&&t.sequential,I=t.structures||t.saveStructures,l=t.maxSharedStructures;if(l==null&&(l=I?32:0),l>8160)throw new Error("Maximum maxSharedStructure is 8160");t.structuredClone&&t.moreTypes==null&&(this.moreTypes=!0);let g=t.maxOwnStructures;g==null&&(g=I?32:64),!this.structures&&t.useRecords!=!1&&(this.structures=[]);let u=l>32||g+l>64,f=l+64,C=l+g+64;if(C>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let F=[],d=0,B=0;this.pack=this.encode=function(m,J){if(E||(E=new tc(8192),le=E.dataView||(E.dataView=new DataView(E.buffer,0,8192)),p=0),gt=E.length-10,gt-p<2048?(E=new tc(E.length),le=E.dataView||(E.dataView=new DataView(E.buffer,0,E.length)),gt=E.length-10,p=0):p=p+7&2147483640,i=p,J&i3&&(p+=J&255),o=a.structuredClone?new Map:null,a.bundleStrings&&typeof m!="string"?(ke=[],ke.size=1/0):ke=null,r=a.structures,r){r.uninitialized&&(r=a._mergeStructures(a.getStructures()));let U=r.sharedLength||0;if(U>l)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+r.sharedLength);if(!r.transitions){r.transitions=Object.create(null);for(let G=0;Gae.offset>ne.offset?1:-1),z=G.length,O=-1;for(;U&&z>0;){let ae=G[--z].offset+i;aeU.position+i?O>=0&&(O+=6):(O>=0&&(le.setUint32(U.position+i,le.getUint32(U.position+i)+O),O=-1),U=U.previous,z++)}O>=0&&U&&le.setUint32(U.position+i,le.getUint32(U.position+i)+O),p+=G.length*6,p>gt&&q(p),a.offset=p;let L=TN(E.subarray(i,p),G);return o=null,L}return a.offset=p,J&Xm?(E.start=i,E.end=p,E):E.subarray(i,p)}catch(U){throw M=U,U}finally{if(r&&(Q(),n&&a.saveStructures)){let U=r.sharedLength||0,G=E.subarray(i,p),z=XN(r,a);if(!M)return a.saveStructures(z,z.isCompatible)===!1?a.pack(m,J):(a.lastNamedStructuresLength=U,G)}J&A3&&(p=i)}};let Q=()=>{B<10&&B++;let m=r.sharedLength||0;if(r.length>m&&!c&&(r.length=m),d>1e4)r.transitions=null,B=0,d=0,F.length>0&&(F=[]);else if(F.length>0&&!c){for(let J=0,M=F.length;J{var J=m.length;J<16?E[p++]=144|J:J<65536?(E[p++]=220,E[p++]=J>>8,E[p++]=J&255):(E[p++]=221,le.setUint32(p,J),p+=4);for(let M=0;M{p>gt&&(E=q(p));var J=typeof m,M;if(J==="string"){let U=m.length;if(ke&&U>=4&&U<4096){if((ke.size+=U)>VN){let L,ae=(ke[0]?ke[0].length*3+ke[1].length:0)+10;p+ae>gt&&(E=q(p+ae));let ne;ke.position?(ne=ke,E[p]=200,p+=3,E[p++]=98,L=p-i,p+=4,Vm(i,k,0),le.setUint16(L+i-3,p-i-L)):(E[p++]=214,E[p++]=98,L=p-i,p+=4),ke=["",""],ke.previous=ne,ke.size=0,ke.position=L}let O=zN.test(m);ke[O?0:1]+=m,E[p++]=193,k(O?-U:U);return}let G;U<32?G=1:U<256?G=2:U<65536?G=3:G=5;let z=U*3;if(p+z>gt&&(E=q(p+z)),U<64||!s){let O,L,ae,ne=p+G;for(O=0;O>6|192,E[ne++]=L&63|128):(L&64512)===55296&&((ae=m.charCodeAt(O+1))&64512)===56320?(L=65536+((L&1023)<<10)+(ae&1023),O++,E[ne++]=L>>18|240,E[ne++]=L>>12&63|128,E[ne++]=L>>6&63|128,E[ne++]=L&63|128):(E[ne++]=L>>12|224,E[ne++]=L>>6&63|128,E[ne++]=L&63|128);M=ne-p-G}else M=s(m,p+G);M<32?E[p++]=160|M:M<256?(G<2&&E.copyWithin(p+2,p+1,p+1+M),E[p++]=217,E[p++]=M):M<65536?(G<3&&E.copyWithin(p+3,p+2,p+2+M),E[p++]=218,E[p++]=M>>8,E[p++]=M&255):(G<5&&E.copyWithin(p+5,p+3,p+3+M),E[p++]=219,le.setUint32(p,M),p+=4),p+=M}else if(J==="number")if(m>>>0===m)m<32||m<128&&this.useRecords===!1||m<64&&!this.randomAccessStructure?E[p++]=m:m<256?(E[p++]=204,E[p++]=m):m<65536?(E[p++]=205,E[p++]=m>>8,E[p++]=m&255):(E[p++]=206,le.setUint32(p,m),p+=4);else if(m>>0===m)m>=-32?E[p++]=256+m:m>=-128?(E[p++]=208,E[p++]=m+256):m>=-32768?(E[p++]=209,le.setInt16(p,m),p+=2):(E[p++]=210,le.setInt32(p,m),p+=4);else{let U;if((U=this.useFloat32)>0&&m<4294967296&&m>=-2147483648){E[p++]=202,le.setFloat32(p,m);let G;if(U<4||(G=m*jI[(E[p]&127)<<1|E[p+1]>>7])>>0===G){p+=4;return}else p--}E[p++]=203,le.setFloat64(p,m),p+=8}else if(J==="object"||J==="function")if(!m)E[p++]=192;else{if(o){let G=o.get(m);if(G){if(!G.id){let z=o.idsToInsert||(o.idsToInsert=[]);G.id=z.push(G)}E[p++]=214,E[p++]=112,le.setUint32(p,G.id),p+=4;return}else o.set(m,{offset:p-i})}let U=m.constructor;if(U===Object)b(m,!0);else if(U===Array)y(m);else if(U===Map)if(this.mapAsEmptyObject)E[p++]=128;else{M=m.size,M<16?E[p++]=128|M:M<65536?(E[p++]=222,E[p++]=M>>8,E[p++]=M&255):(E[p++]=223,le.setUint32(p,M),p+=4);for(let[G,z]of m)k(G),k(z)}else{for(let G=0,z=qf.length;G(E=ae,ae=null,p+=Zt,p>gt&&q(p),{target:E,targetView:le,position:p-Zt}),k)}finally{ae&&(E=ae,le=ne,p=We,gt=E.length-10)}Xt&&(Xt.length+p>gt&&q(Xt.length+p),p=_N(Xt,E,p,L.type));return}}if(Array.isArray(m))y(m);else{if(m.toJSON){let G=m.toJSON();if(G!==m)return k(G)}if(J==="function")return k(this.writeFunction&&this.writeFunction(m));b(m,!m.hasOwnProperty)}}}else if(J==="boolean")E[p++]=m?195:194;else if(J==="bigint"){if(m=-(BigInt(1)<0)E[p++]=207,le.setBigUint64(p,m);else if(this.largeBigIntToFloat)E[p++]=203,le.setFloat64(p,Number(m));else if(this.useBigIntExtension&&m<2n**1023n&&m>-(2n**1023n)){E[p++]=199,p++,E[p++]=66;let U=[],G;do{let z=m&0xffn;G=(z&0x80n)===(m<0n?0x80n:0n),U.push(z),m>>=8n}while(!((m===0n||m===-1n)&&G));E[p-2]=U.length;for(let z=U.length;z>0;)E[p++]=Number(U[--z]);return}else throw new RangeError(m+" was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension or set largeBigIntToFloat to convert to float-64");p+=8}else if(J==="undefined")this.encodeUndefinedAsNil?E[p++]=192:(E[p++]=212,E[p++]=0,E[p++]=0);else throw new Error("Unknown type: "+J)},D=this.variableMapSize||this.coercibleKeyAsNumber?m=>{let J=Object.keys(m),M=J.length;M<16?E[p++]=128|M:M<65536?(E[p++]=222,E[p++]=M>>8,E[p++]=M&255):(E[p++]=223,le.setUint32(p,M),p+=4);let U;if(this.coercibleKeyAsNumber)for(let G=0;G{E[p++]=222;let M=p-i;p+=2;let U=0;for(let G in m)(J||m.hasOwnProperty(G))&&(k(G),k(m[G]),U++);E[M+++i]=U>>8,E[M+i]=U&255},S=this.useRecords===!1?D:t.progressiveRecords&&!u?(m,J)=>{let M,U=r.transitions||(r.transitions=Object.create(null)),G=p++-i,z;for(let O in m)if(J||m.hasOwnProperty(O)){if(M=U[O],M)U=M;else{let L=Object.keys(m),ae=U;U=r.transitions;let ne=0;for(let We=0,Xt=L.length;We{let M,U=r.transitions||(r.transitions=Object.create(null)),G=0;for(let O in m)(J||m.hasOwnProperty(O))&&(M=U[O],M||(M=U[O]=Object.create(null),G++),U=M);let z=U[mr];z?z>=96&&u?(E[p++]=((z-=96)&31)+96,E[p++]=z>>5):E[p++]=z:Z(U,U.__keys__||Object.keys(m),G);for(let O in m)(J||m.hasOwnProperty(O))&&k(m[O])},N=typeof this.useRecords=="function"&&this.useRecords,b=N?(m,J)=>{N(m)?S(m,J):D(m,J)}:S,q=m=>{let J;if(m>16777216){if(m-i>Lm)throw new Error("Packed buffer would be larger than maximum buffer size");J=Math.min(Lm,Math.round(Math.max((m-i)*(m>67108864?1.25:2),4194304)/4096)*4096)}else J=(Math.max(m-i<<2,E.length-1)>>12)+1<<12;let M=new tc(J);return le=M.dataView||(M.dataView=new DataView(M.buffer,0,J)),m=Math.min(m,E.length),E.copy?E.copy(M,0,i,m):M.set(E.slice(i,m)),p-=i,i=0,gt=M.length-10,E=M},Z=(m,J,M)=>{let U=r.nextId;U||(U=64),U=C&&(U=f),r.nextId=U+1);let G=J.highByte=U>=96&&u?U-96>>5:-1;m[mr]=U,m.__keys__=J,r[U-64]=J,U=0?(E[p++]=(U&31)+96,E[p++]=G):E[p++]=U):(G>=0?(E[p++]=213,E[p++]=114,E[p++]=(U&31)+96,E[p++]=G):(E[p++]=212,E[p++]=114,E[p++]=U),M&&(d+=B*M),F.length>=g&&(F.shift()[mr]=0),F.push(m),k(J))},xe=(m,J,M,U)=>{let G=E,z=p,O=gt,L=i;E=hs,p=0,i=0,E||(hs=E=new tc(8192)),gt=E.length-10,Z(m,J,U),hs=E;let ae=p;if(E=G,p=z,gt=O,i=L,ae>1){let ne=p+ae-1;ne>gt&&q(ne);let We=M+i;E.copyWithin(We+ae,We+1,p),E.set(hs.slice(0,ae),We),p=ne}else E[M+i]=hs[0]},Bt=(m,J)=>{let M=PN(m,E,i,p,r,q,(U,G,z)=>{if(z)return n=!0;p=G;let O=E;return k(U),Q(),O!==E?{position:p,targetView:le,target:E}:p},this);if(M===0)return b(m,!0);p=M}}useBuffer(t){E=t,le=new DataView(E.buffer,E.byteOffset,E.byteLength),p=0}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}};zm=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,Cs];qf=[{pack(e,t,A){let i=e.getTime()/1e3;if((this.useTimestamp32||e.getMilliseconds()===0)&&i>=0&&i<4294967296){let{target:n,targetView:r,position:o}=t(6);n[o++]=214,n[o++]=255,r.setUint32(o,i)}else if(i>0&&i<4294967296){let{target:n,targetView:r,position:o}=t(10);n[o++]=215,n[o++]=255,r.setUint32(o,e.getMilliseconds()*4e6+(i/1e3/4294967296>>0)),r.setUint32(o+4,i)}else if(isNaN(i)){if(this.onInvalidDate)return t(0),A(this.onInvalidDate());let{target:n,targetView:r,position:o}=t(3);n[o++]=212,n[o++]=255,n[o++]=255}else{let{target:n,targetView:r,position:o}=t(15);n[o++]=199,n[o++]=12,n[o++]=255,r.setUint32(o,e.getMilliseconds()*1e6),r.setBigInt64(o+4,BigInt(Math.floor(i)))}}},{pack(e,t,A){if(this.setAsEmptyObject)return t(0),A({});let i=Array.from(e),{target:n,position:r}=t(this.moreTypes?3:0);this.moreTypes&&(n[r++]=212,n[r++]=115,n[r++]=0),A(i)}},{pack(e,t,A){let{target:i,position:n}=t(this.moreTypes?3:0);this.moreTypes&&(i[n++]=212,i[n++]=101,i[n++]=0),A([e.name,e.message])}},{pack(e,t,A){let{target:i,position:n}=t(this.moreTypes?3:0);this.moreTypes&&(i[n++]=212,i[n++]=120,i[n++]=0),A([e.source,e.flags])}},{pack(e,t){this.moreTypes?Ym(e,16,t):Pm(ic?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let A=e.constructor;A!==_m&&this.moreTypes?Ym(e,Jf.indexOf(A.name),t):Pm(e,t)}},{pack(e,t){let{target:A,position:i}=t(1);A[i]=193}}];function Ym(e,t,A,i){let n=e.byteLength;if(n+1<256){var{target:r,position:o}=A(4+n);r[o++]=199,r[o++]=n+1}else if(n+1<65536){var{target:r,position:o}=A(5+n);r[o++]=200,r[o++]=n+1>>8,r[o++]=n+1&255}else{var{target:r,position:o,targetView:s}=A(7+n);r[o++]=201,s.setUint32(o,n+1),o+=4}r[o++]=116,r[o++]=t,r.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),o)}function Pm(e,t){let A=e.byteLength;var i,n;if(A<256){var{target:i,position:n}=t(A+2);i[n++]=196,i[n++]=A}else if(A<65536){var{target:i,position:n}=t(A+3);i[n++]=197,i[n++]=A>>8,i[n++]=A&255}else{var{target:i,position:n,targetView:r}=t(A+5);i[n++]=198,r.setUint32(n,A),n+=4}i.set(e,n)}function _N(e,t,A,i){let n=e.length;switch(n){case 1:t[A++]=212;break;case 2:t[A++]=213;break;case 4:t[A++]=214;break;case 8:t[A++]=215;break;case 16:t[A++]=216;break;default:n<256?(t[A++]=199,t[A++]=n):n<65536?(t[A++]=200,t[A++]=n>>8,t[A++]=n&255):(t[A++]=201,t[A++]=n>>24,t[A++]=n>>16&255,t[A++]=n>>8&255,t[A++]=n&255)}return t[A++]=i,t.set(e,A),A+=n,A}function TN(e,t){let A,i=t.length*6,n=e.length-i;for(;A=t.pop();){let r=A.offset,o=A.id;e.copyWithin(r+i,r,n),i-=6;let s=r+i;e[s++]=214,e[s++]=105,e[s++]=o>>24,e[s++]=o>>16&255,e[s++]=o>>8&255,e[s++]=o&255,n=r}return e}function Vm(e,t,A){if(ke.length>0){le.setUint32(ke.position+e,p+A-ke.position-e),ke.stringsPosition=p-e;let i=ke;ke=null,t(i[0]),t(i[1])}}function XN(e,t){return e.isCompatible=A=>{let i=!A||(t.lastNamedStructuresLength||0)===A.length;return i||t._mergeStructures(A),i},e}var Tm=new Cn({useRecords:!1}),ZN=Tm.pack,WN=Tm.pack;var{NEVER:jN,ALWAYS:$N,DECIMAL_ROUND:e3,DECIMAL_FIT:t3}=ec,Xm=512,A3=1024,i3=2048;var Yf=K(ey(),1),nR=Yf.default.configure,ty=Yf.default;var Ay={site:{list:"0",group:"1",load:"2",update:"3"},comp:{new:"4",list:"5",group:"6",load:"7"},page:{list:"8",load:"9",cache:"10"},yjs:{um:"11",sv_local:"12",diff_local:"13",sv_remote:"14"},client:{info:"15"},code:{load:"16",edit:"17",action:"18"}},iy={0:"site.list",1:"site.group",2:"site.load",3:"site.update",4:"comp.new",5:"comp.list",6:"comp.group",7:"comp.load",8:"page.list",9:"page.load",10:"page.cache",11:"yjs.um",12:"yjs.sv_local",13:"yjs.diff_local",14:"yjs.sv_remote",15:"client.info",16:"code.load",17:"code.edit",18:"code.action"};var Ce=window;var ny=e=>Bs(`prasi-user-${e}`,"default");var ry=new Cn({structuredClone:!0}),ps={debug:!!localStorage.getItem("prasi-ws-debug"),reconnectTimeout:1e3};Ce.debug=new Proxy({},{get(e,t,A){if(t==="off")return ps.debug=!1,localStorage.removeItem("prasi-ws-debug"),console.clear(),["WS DEBUG: Deactivated"];if(t==="on")return ps.debug=!0,localStorage.setItem("prasi-ws-debug","1"),console.clear(),["WS DEBUG: Activated"]}});var kA={ws:null,client_id:"",idb:null,event:null},Pf={action:{pending:{}}},oy=(e,t)=>{let A=ry.pack(t);ps.debug&&console.log("%c\u2B06","color:blue",ay(A.length,0),t),e.send(A)},sy=async e=>{let{user_id:t,site_id:A,page_id:i,events:n}=e;return kA.idb=ny(t),await I3({user_id:t,site_id:A,page_id:i},n),new dm(Ay,({target:r,trapName:o,value:s,key:a,DEFAULT:c,PROXY:I})=>{if(o==="set")throw new TypeError("target is immutable");return typeof s=="string"?(...l)=>new Promise(g=>{u3({code:s,resolve:g,args:l})}):o==="get"&&typeof s=="object"&&s!==null?I:c})},I3=(e,t)=>{let{user_id:A,page_id:i,site_id:n}=e;return kA.event=t,Ce.offline?new Promise(async r=>{r();let o="editor_start",s=await g3(o);t[o]&&t[o](s)}):new Promise((r,o)=>{if(!kA.ws){let s=0,a=()=>{let c=new URL(Ce.basehost||location.href);c.pathname="/sync",c.protocol=c.protocol==="http:"?"ws:":"wss:";let I=new WebSocket(`${c.protocol}//${c.host}${c.pathname}`);I.onopen=()=>{oy(I,{type:1,user_id:A,site_id:n,page_id:i}),kA.ws=I,t.opened()},I.onclose=async()=>{t.disconnected().reconnect?setTimeout(async()=>{s++,a()},s*ps.reconnectTimeout):o()},I.onmessage=async l=>{let g=l.data,u=ry.unpack(Buffer.from(await g.arrayBuffer()));if(ps.debug&&console.log("%c\u2B07","color:red",ay(g.size,0),u),u.type===0)kA.client_id=u.client_id,t.shakehand(u.client_id),r();else if(u.type===2){let f=u.event;t[f]&&(c3.includes(f)&&l3(f,u.data),t[f](u.data))}else if(u.type===4){let f=Pf.action.pending[u.argid];if(f){f.resolve(u.val),delete Pf.action.pending[u.argid];let C=kA.idb;C&&await ds(u.argid,u.val,C)}}}};a()}})},c3=["editor_start"],l3=async(e,t)=>{let A=kA.idb;if(A){let i=await XI(`ev-${e}`);await ds(i,t,A)}},g3=async e=>{let t=kA.idb;if(t){let A=await XI(`ev-${e}`);return await Er(A,t)}},u3=async e=>{let{args:t,code:A,resolve:i}=e,n=kA.ws,r=kA.idb;if(r){let o=ty(t),s=iy[A],a=await XI(`op-${s}-${o}`);if(n&&n.readyState===n.OPEN)Pf.action.pending[a]={ts:Date.now(),resolve:i},oy(n,{type:3,code:A,args:t,argid:a});else{let c=await Er(a,r);i(c)}}};function ay(e,t){if(e==0)return"0 Bytes";var A=1024,i=t||2,n=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],r=Math.floor(Math.log(e)/Math.log(A));return parseFloat((e/Math.pow(A,r)).toFixed(i))+" "+n[r]}var yr={NORMAL:0,WILDCARD:1,PLACEHOLDER:2};function wr(e={}){let t={options:e,rootNode:cy(),staticRoutesMap:{}},A=i=>e.strictTrailingSlash?i:i.replace(/\/$/,"")||"/";if(e.routes)for(let i in e.routes)Iy(t,A(i),e.routes[i]);return{ctx:t,lookup:i=>f3(t,A(i)),insert:(i,n)=>Iy(t,A(i),n),remove:i=>B3(t,A(i))}}function f3(e,t){let A=e.staticRoutesMap[t];if(A)return A.data;let i=t.split("/"),n={},r=!1,o=null,s=e.rootNode,a=null;for(let c=0;c{},db:null,api:null,init_local_effect:{}},page:{history:{id:"",show:!1},root_id:"root",cur:C3,doc:null,list:{},building:!1,meta:{},entry:[],tree:[],render:()=>{}},comp:{doc:null,item:null,loaded:{},list:{},group:{}},code:{},global_prop:[],ui:{comp_editable:localStorage.getItem("prasi-comp-editable")==="yes",zoom:localStorage.zoom||"100%",side:{prop:!0},layout:{left:parseInt(localStorage.getItem("prasi-layout-left")||"250"),right:parseInt(localStorage.getItem("prasi-layout-right")||"250")},prevent_indent_hook:!1,syncing:!1,tree:{item_loading:[],search:"",search_ref:null,search_mode:{Name:!0,JS:!1,HTML:!1,CSS:!1},rename_id:"",open:{}},popup:{file:{enabled:!1,open:!1,picker:{value:"",on_pick:!1,multi:!1},path:"/",expanded:JSON.parse(localStorage.getItem("panel-file-expanded")||"{}"),entry:{},selected:new Set,action:null,file_renaming:"",file_ctx_menu_event:null,tree:[],tree_renaming:"",tree_ctx_path:"",tree_ctx_menu_event:null,preview:!0,upload:{started:!1,progress:{}}},code:{init:!1,open:!1,name:"site",log:"",loading:!1,startup_status:"init",error:!1,show_log:!1,list:{}},page:{open:null,form:null},script:{open:!1,mode:"js",lastMode:"js",type:"item",prop_kind:"",prop_name:"",on_close:()=>{},typings:{status:"ok",err_msg:""},wb_render:()=>{}},site:null,site_form:null,comp:{preview_id:"",open:null,import:!1},comp_group:null,api:{open:!1}}}};var hy=K(oc());var py=e=>{let{item:t,item_comp:A,ids:i}=e,n=QA(A);if(Ey(n,i),t.id&&(n.id=t.id),n.component){if(n.component.props&&t.component)for(let r of Object.keys(n.component.props)){let o=t.component.props[r],s=n.component.props[r];o&&(s.value=o.value,s.valueBuilt=o.valueBuilt,s.jsxCalledBy=o.jsxCalledBy,s.content=o.content)}n.component.instances=t.component?.instances,n.component.style=t.component?.style}for(let r of Object.keys(t))delete t[r];for(let[r,o]of Object.entries(n))t[r]=o},Ey=(e,t)=>{if(e.originalId=e.id,t[e.id]||(t[e.id]=(0,hy.createId)()),e.id=t[e.id],e.childs)for(let A of e.childs)Ey(A,t)};var my=e=>{for(let[t,A]of Object.entries(e.item_comp.component?.props||{})){let i=QA(A),n=e.item.component?.props;n&&n[t]&&(i.value=n[t].value,i.valueBuilt=n[t].valueBuilt,n[t].content&&(i.content=n[t].content)),i&&e.each(t,i)}};var sc=e=>{let t={};for(let[A,i]of Object.entries(e))if(A==="childs"){if(t.childs=[],i&&Array.isArray(i))for(let n of i)t.childs.push({id:n.id})}else t[A]=i;return t};var yy=(e,t)=>{let{item:A}=t;if(A.type==="item"&&A.component?.id&&t.parent?.item.id){let i=e.comps[A.component.id];if(e.on?.visit_component&&e.on.visit_component(A,t.root||t.item),!i)return;if(i){let n;if(e.mode==="page"?(A.component.instances||(A.component.instances={}),n=A.component.instances):n=t.parent?.root_instances,n){let o=n[A.id];n[A.id]||(n[A.id]={},o=n[A.id]),py({item:A,item_comp:i,ids:o})}let r={item:sc(A),jsx_prop:t.jsx_prop,parent:{id:t.parent.item.id,comp_id:t.parent?.comp?.component?.id,instance_id:t.parent?.instance_id},instances:n};e.on?.visit&&e.on.visit(r,A,t.root||t.item),A.id&&e.set_meta!==!1&&(e.meta[A.id]=r),my({item:A,item_comp:i,instance:n?n[A.id]:{},each(o,s){let a=A.component?.id;s.meta?.type==="content-element"&&a&&s.content&&(s.content.name=o,vt({...e,mode:"comp"},{item:s.content,root:t.root||s.content,is_root:!1,jsx_prop:{is_root:!0,comp_id:a,name:o},parent:{item:r.item,instance_id:A.id,comp:i,root_instances:n}}))}});for(let o of Object.values(A.childs))o.name.startsWith("jsx:")||vt({...e,mode:"comp"},{item:o,is_root:!1,root:t.root||t.item,parent:{item:A,instance_id:A.id,root_instances:n,comp:i}})}}};var vt=(e,t)=>{let A=t.item;if(A.type==="item"&&A.component?.id&&t.ignore_first_component!==!0){yy(e,t);return}let i={item:sc(A),parent:{id:t.parent?.item.id||"root",instance_id:t.parent?.instance_id,comp_id:t.parent?.comp?.component?.id}};if(t.jsx_prop&&(i.jsx_prop=t.jsx_prop),e.on?.visit&&e.on.visit(i,A,t.root||t.item),A.id&&e.set_meta!==!1&&(e.meta[i.item.id]=i),A.childs){for(let[n,r]of Object.entries(A.childs))if(r.id){let o={item:r,is_root:!1,root:t.root||t.item,parent:{item:i.item,instance_id:t.parent?.instance_id,comp:t.parent?.comp,root_instances:t.parent?.root_instances}};t.jsx_prop&&(o.jsx_prop={...t.jsx_prop,is_root:!1}),vt(e,o)}}};var ac=async(e,t,A,i)=>{let n=new Set,r={root:t};if(vt({...e,on:{visit_component:({component:o})=>{if(o){let{id:s}=o;if(e.comps[s]||(!i||i&&!i.has(s))&&n.add(s),o?.props)for(let[a,c]of Object.entries(o.props))c.meta?.type==="content-element"&&c.content&&vt({...e,on:{visit_component:({component:I})=>{if(I){let{id:l}=I;e.comps[l]||(!i||i&&!i.has(l))&&n.add(l)}},visit(I,l){A.visit&&A.visit(I,l,r)}},set_meta:!1,note:"init-load-comp-prop"},{item:c.content})}},visit(o,s){A.visit&&A.visit(o,s,r)}},set_meta:!1,note:"init-load-comp"},{item:t,ignore_first_component:!0}),A.done&&A.done(r),n.size>0){await A.load([...n]);let o=i;o||(o=new Set),n.forEach(s=>{o&&o.add(s)});for(let s of[...o]){let a=e.comps[s];a&&await ac(e,a,A,o)}}};var k3=Bs("prasi-cache","prasi-cache-store"),pn={timeout:null,store:k3},Ic=(e,t)=>{let A=[...wy(t,"navigate(",")"),...wy(t,"href = ",";")],i=e.page.cur.id;e.page.navs[i]||(e.page.navs[i]=new Set);for(let n of A)e.page.navs[i].add(n);clearTimeout(pn.timeout),pn.timeout=setTimeout(()=>{e.on_nav_loaded&&e.on_nav_loaded({urls:Array.from(e.page.navs[i])})},100)},wy=(e,t,A)=>{let i=0,n=0,r=[];for(;;){let o=e.indexOf(t,i);if(n=i,o>=0){let s=e[o+t.length];if(s==='"'||s==="'"||s==="`"){let a=e.indexOf(`${s}${A}`,o+t.length+1),c=e.substring(o+t.length+1,a);i=a+2+A.length,r.push(c)}}if(n===i)break}return r};var Dy=K(oc());var cc=()=>{let e=document.activeElement;return!!(e&&e.attributes.getNamedItem("contenteditable"))};var Fy=K(oc()),lc=e=>{let{m:t,root:A,mitem:i,meta:n}=e;if(t.jsx_prop&&t.parent?.instance_id){let r=n[t.parent?.instance_id];if(r&&t.jsx_prop.is_root){let o=r.item.component?.props[t.jsx_prop.name];o&&(o.content=t.item)}}if(t.parent)if(t.parent.id==="root")t.item.id===A.id&&(t.mitem=i);else{let r=n[t.parent.id];if(r.mitem)if(t.jsx_prop?.is_root===!0){let o=r.mitem.get("component")?.get("props");if(o){let s=o.get(t.jsx_prop.name);if(s){let a=s.get("content");if(!a){let c=new Y.Map;syncronize(c,{id:(0,Fy.createId)(),name:t.jsx_prop.name,type:"item",dim:{w:"full",h:"full"},childs:[],adv:{css:""}}),s.set("content",c)}a&&(t.mitem=a)}}}else r.mitem.get("childs")?.forEach(o=>{o&&o.get&&o.get("id")===t.item.id&&(t.mitem=o)});if(t.item.component?.props)for(let[o,s]of Object.entries(t.item.component.props)){let a=t.mitem?.get("component")?.get("props")?.get(o);if(!a){let c=t.mitem?.get("component")?.get("props");c&&e.new_prop_jsx(t,c,o,s)}if(s.content)if(a){let c=n[s.content.id];c&&(c.mitem=a.get("content"))}else{let c=t.mitem?.get("component")?.get("props");c&&e.new_prop_jsx(t,c,o,s)}}}};var gc=(e,t,A,i)=>{if(t.parent?.id==="root")e.page.doc?.getMap("map").get("root")?.get("childs")?.forEach(n=>{n.get("id")===t.item.id&&(t.mitem=n)});else{let n=A[t.parent?.id||""];n&&n.mitem&&n.mitem.get("childs")?.forEach(r=>{r&&r.get&&r.get("id")===t.item.id&&(t.mitem=r)})}if(!t.item||!t.item.id)return console.warn("Emptry Tree Item ",t),null;if(i.find(n=>n.id===t.item.id))console.warn("Double Tree Item: ",t.item.id,t.item.name);else if(!t.parent?.comp_id)i.push({id:t.item.id,parent:t.parent?.id||"root",text:t.item.name,data:t});else if(t.jsx_prop)if(t.jsx_prop.is_root)t.jsx_prop.name!=="child"&&i.push({id:t.item.id,parent:t.parent?.instance_id||"root",text:t.jsx_prop.name,data:t});else{if(t.jsx_prop.name==="child"&&t.parent.instance_id){let n=A[t.parent.instance_id],r=n.item.component?.props.child.content?.id;r&&n.mitem&&A[r].item.childs.find(s=>t.item.id===s.id)&&i.push({id:t.item.id,parent:t.parent?.instance_id||"root",text:t.item.name,data:t})}t.parent.id!==t.parent.instance_id&&i.push({id:t.item.id,parent:t.parent?.id||"root",text:t.item.name,data:t})}};var fc=async(e,t,A)=>{if(e.comp.list[t])return;let i=new Y.Doc;Y.applyUpdate(i,Et(A));let n=i.getMap("map").get("root");if(n){e.comp.loaded[t]=n.toJSON(),typeof e.comp.list[t]?.on_update=="function"&&i.off("update",e.comp.list[t].on_update);let r=await uc(e,i,t);if(r){let{meta:o,tree:s}=r;e.comp.list[t]?(e.comp.list[t].meta=o,e.comp.list[t].tree=s):(e.comp.list[t]={comp:{id:t,snapshot:A},doc:i,meta:o,tree:s,async on_update(a,c){if(c==="sv_remote"||c==="local")return;let I=await e.sync?.yjs.sv_local("comp",t,Buffer.from(rA(a)));if(I){let l=Y.encodeStateAsUpdate(i,Et(I.sv));Y.applyUpdate(i,Et(I.diff),"local"),await e.sync?.yjs.diff_local("comp",t,Buffer.from(rA(l)));let g=await uc(e,e.comp.list[t].doc,t);if(g&&(e.comp.list[t].meta=g.meta,e.comp.list[t].tree=g.tree),e.comp.loaded[t]=i.getMap("map").get("root")?.toJSON(),cc())return;IA(e),e.render()}}},i.on("update",e.comp.list[t].on_update))}}},uc=async(e,t,A)=>{let i=t.getMap("map").get("root");if(!i)return;let n={},r=[],o=i.toJSON();return e.comp.loaded[A]=o,await ac({comps:e.comp.loaded,meta:n,set_meta:!1,mode:"comp"},o,{load:async s=>{let a=s.filter(I=>!e.comp.loaded[I]),c=await e.sync?.comp.load(a,!0);if(c){let I=Object.entries(c);for(let[l,g]of I)g&&g.snapshot&&!e.comp.list[l]&&await fc(e,l,g.snapshot)}}}),vt({comps:e.comp.loaded,meta:n,mode:"comp",on:{async visit(s){gc(e,s,n,r),lc({m:s,root:o,mitem:i,meta:n,new_prop_jsx(a,c,I,l){_f.list.push(()=>{let g=new Y.Map;l.content&&(l.content.id=(0,Dy.createId)()),syncronize(g,l),c.set(I,g)})}})}},note:"load-comp-scan-meta"},{item:o,ignore_first_component:!0}),_f.list.length>0&&e.page.doc?.transact(()=>{for(let s of _f.list)s()}),e.comp.loaded[A]=o,{meta:n,tree:r,item:o}},_f={list:[]};var IA=async(e,t)=>{if(document.activeElement){let o=document.activeElement;if(o.tagName==="DIV"&&o.getAttribute("contenteditable")==="true")return}rc.should_render_main=!0;let A=e.site.layout&&e.site.layout.id===e.page.cur.id&&t?.note==="load-layout page-init";for(let[o,s]of Object.entries(e.comp.list))if(!e.comp.loaded[o]){let c=s.doc.getMap("map").get("root")?.toJSON();c&&(e.comp.loaded[o]=c)}let i=e.page.doc?.getMap("map").get("root"),n=[];i?.get("childs")?.forEach(o=>n.push(o));let r={};e.page.tree=[];for(let o of n){let s=o.toJSON();s&&vt({note:"tree-rebuild",comps:e.comp.loaded,meta:r,mode:"page",on:{async visit(a){A||((a.parent?.instance_id!==a.parent?.id||a.jsx_prop)&&gc(e,a,r,e.page.tree),lc({m:a,root:s,mitem:o,meta:r,new_prop_jsx(c,I,l,g){if(!I.get(l)){let u=new Y.Map;syncronize(u,g),I.set(l,u)}}}))}}},{item:s})}if(A)e.site.layout.meta=r;else{let o="root";if(e.site.layout&&e.site.layout.meta){for(let[s,a]of Object.entries(e.site.layout.meta))if(a.item.name==="content"){o=a.item.id;break}e.page.root_id=o}if(e.site.layout&&e.site.layout.id===e.page.cur.id)e.page.meta=r;else if(o!=="root"){for(let s of Object.values(r))s.parent?.id==="root"&&(s.parent.id=o);e.page.meta={...e.site.layout.meta,...r}}else e.page.meta=r}};function ys(e,t){return function(){return e.apply(t,arguments)}}var{toString:S3}=Object.prototype,{getPrototypeOf:Zf}=Object,dc=(e=>t=>{let A=S3.call(t);return e[A]||(e[A]=A.slice(8,-1).toLowerCase())})(Object.create(null)),SA=e=>(e=e.toLowerCase(),t=>dc(t)===e),Cc=e=>t=>typeof t===e,{isArray:Fr}=Array,ws=Cc("undefined");function U3(e){return e!==null&&!ws(e)&&e.constructor!==null&&!ws(e.constructor)&&_t(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var Uy=SA("ArrayBuffer");function N3(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Uy(e.buffer),t}var x3=Cc("string"),_t=Cc("function"),Ny=Cc("number"),Qc=e=>e!==null&&typeof e=="object",G3=e=>e===!0||e===!1,Bc=e=>{if(dc(e)!=="object")return!1;let t=Zf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},H3=SA("Date"),M3=SA("File"),v3=SA("Blob"),R3=SA("FileList"),J3=e=>Qc(e)&&_t(e.pipe),q3=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||_t(e.append)&&((t=dc(e))==="formdata"||t==="object"&&_t(e.toString)&&e.toString()==="[object FormData]"))},K3=SA("URLSearchParams"),b3=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Fs(e,t,{allOwnKeys:A=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),Fr(e))for(i=0,n=e.length;i0;)if(n=A[i],t===n.toLowerCase())return n;return null}var Gy=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Hy=e=>!ws(e)&&e!==Gy;function Xf(){let{caseless:e}=Hy(this)&&this||{},t={},A=(i,n)=>{let r=e&&xy(t,n)||n;Bc(t[r])&&Bc(i)?t[r]=Xf(t[r],i):Bc(i)?t[r]=Xf({},i):Fr(i)?t[r]=i.slice():t[r]=i};for(let i=0,n=arguments.length;i(Fs(t,(n,r)=>{A&&_t(n)?e[r]=ys(n,A):e[r]=n},{allOwnKeys:i}),e),L3=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Y3=(e,t,A,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),A&&Object.assign(e.prototype,A)},P3=(e,t,A,i)=>{let n,r,o,s={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),r=n.length;r-- >0;)o=n[r],(!i||i(o,e,t))&&!s[o]&&(t[o]=e[o],s[o]=!0);e=A!==!1&&Zf(e)}while(e&&(!A||A(e,t))&&e!==Object.prototype);return t},V3=(e,t,A)=>{e=String(e),(A===void 0||A>e.length)&&(A=e.length),A-=t.length;let i=e.indexOf(t,A);return i!==-1&&i===A},z3=e=>{if(!e)return null;if(Fr(e))return e;let t=e.length;if(!Ny(t))return null;let A=new Array(t);for(;t-- >0;)A[t]=e[t];return A},_3=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Zf(Uint8Array)),T3=(e,t)=>{let i=(e&&e[Symbol.iterator]).call(e),n;for(;(n=i.next())&&!n.done;){let r=n.value;t.call(e,r[0],r[1])}},X3=(e,t)=>{let A,i=[];for(;(A=e.exec(t))!==null;)i.push(A);return i},Z3=SA("HTMLFormElement"),W3=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(A,i,n){return i.toUpperCase()+n}),ky=(({hasOwnProperty:e})=>(t,A)=>e.call(t,A))(Object.prototype),j3=SA("RegExp"),My=(e,t)=>{let A=Object.getOwnPropertyDescriptors(e),i={};Fs(A,(n,r)=>{let o;(o=t(n,r,e))!==!1&&(i[r]=o||n)}),Object.defineProperties(e,i)},$3=e=>{My(e,(t,A)=>{if(_t(e)&&["arguments","caller","callee"].indexOf(A)!==-1)return!1;let i=e[A];if(_t(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+A+"'")})}})},ex=(e,t)=>{let A={},i=n=>{n.forEach(r=>{A[r]=!0})};return Fr(e)?i(e):i(String(e).split(t)),A},tx=()=>{},Ax=(e,t)=>(e=+e,Number.isFinite(e)?e:t),Tf="abcdefghijklmnopqrstuvwxyz",Sy="0123456789",vy={DIGIT:Sy,ALPHA:Tf,ALPHA_DIGIT:Tf+Tf.toUpperCase()+Sy},ix=(e=16,t=vy.ALPHA_DIGIT)=>{let A="",{length:i}=t;for(;e--;)A+=t[Math.random()*i|0];return A};function nx(e){return!!(e&&_t(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var rx=e=>{let t=new Array(10),A=(i,n)=>{if(Qc(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let r=Fr(i)?[]:{};return Fs(i,(o,s)=>{let a=A(o,n+1);!ws(a)&&(r[s]=a)}),t[n]=void 0,r}}return i};return A(e,0)},ox=SA("AsyncFunction"),sx=e=>e&&(Qc(e)||_t(e))&&_t(e.then)&&_t(e.catch),w={isArray:Fr,isArrayBuffer:Uy,isBuffer:U3,isFormData:q3,isArrayBufferView:N3,isString:x3,isNumber:Ny,isBoolean:G3,isObject:Qc,isPlainObject:Bc,isUndefined:ws,isDate:H3,isFile:M3,isBlob:v3,isRegExp:j3,isFunction:_t,isStream:J3,isURLSearchParams:K3,isTypedArray:_3,isFileList:R3,forEach:Fs,merge:Xf,extend:O3,trim:b3,stripBOM:L3,inherits:Y3,toFlatObject:P3,kindOf:dc,kindOfTest:SA,endsWith:V3,toArray:z3,forEachEntry:T3,matchAll:X3,isHTMLForm:Z3,hasOwnProperty:ky,hasOwnProp:ky,reduceDescriptors:My,freezeMethods:$3,toObjectSet:ex,toCamelCase:W3,noop:tx,toFiniteNumber:Ax,findKey:xy,global:Gy,isContextDefined:Hy,ALPHABET:vy,generateString:ix,isSpecCompliantForm:nx,toJSONObject:rx,isAsyncFn:ox,isThenable:sx};function Dr(e,t,A,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),A&&(this.config=A),i&&(this.request=i),n&&(this.response=n)}w.inherits(Dr,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:w.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var Ry=Dr.prototype,Jy={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Jy[e]={value:e}});Object.defineProperties(Dr,Jy);Object.defineProperty(Ry,"isAxiosError",{value:!0});Dr.from=(e,t,A,i,n,r)=>{let o=Object.create(Ry);return w.toFlatObject(e,o,function(a){return a!==Error.prototype},s=>s!=="isAxiosError"),Dr.call(o,e.message,t,A,i,n),o.cause=e,o.name=e.name,r&&Object.assign(o,r),o};var j=Dr;var hc=null;function Wf(e){return w.isPlainObject(e)||w.isArray(e)}function Ky(e){return w.endsWith(e,"[]")?e.slice(0,-2):e}function qy(e,t,A){return e?e.concat(t).map(function(n,r){return n=Ky(n),!A&&r?"["+n+"]":n}).join(A?".":""):t}function ax(e){return w.isArray(e)&&!e.some(Wf)}var Ix=w.toFlatObject(w,{},null,function(t){return/^is[A-Z]/.test(t)});function lx(e,t,A){if(!w.isObject(e))throw new TypeError("target must be an object");t=t||new(hc||FormData),A=w.toFlatObject(A,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,F){return!w.isUndefined(F[C])});let i=A.metaTokens,n=A.visitor||I,r=A.dots,o=A.indexes,a=(A.Blob||typeof Blob<"u"&&Blob)&&w.isSpecCompliantForm(t);if(!w.isFunction(n))throw new TypeError("visitor must be a function");function c(f){if(f===null)return"";if(w.isDate(f))return f.toISOString();if(!a&&w.isBlob(f))throw new j("Blob is not supported. Use a Buffer instead.");return w.isArrayBuffer(f)||w.isTypedArray(f)?a&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function I(f,C,F){let d=f;if(f&&!F&&typeof f=="object"){if(w.endsWith(C,"{}"))C=i?C:C.slice(0,-2),f=JSON.stringify(f);else if(w.isArray(f)&&ax(f)||(w.isFileList(f)||w.endsWith(C,"[]"))&&(d=w.toArray(f)))return C=Ky(C),d.forEach(function(Q,y){!(w.isUndefined(Q)||Q===null)&&t.append(o===!0?qy([C],y,r):o===null?C:C+"[]",c(Q))}),!1}return Wf(f)?!0:(t.append(qy(F,C,r),c(f)),!1)}let l=[],g=Object.assign(Ix,{defaultVisitor:I,convertValue:c,isVisitable:Wf});function u(f,C){if(!w.isUndefined(f)){if(l.indexOf(f)!==-1)throw Error("Circular reference detected in "+C.join("."));l.push(f),w.forEach(f,function(d,B){(!(w.isUndefined(d)||d===null)&&n.call(t,d,w.isString(B)?B.trim():B,C,g))===!0&&u(d,C?C.concat(B):[B])}),l.pop()}}if(!w.isObject(e))throw new TypeError("data must be an object");return u(e),t}var vi=lx;function by(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function Oy(e,t){this._pairs=[],e&&vi(e,this,t)}var Ly=Oy.prototype;Ly.append=function(t,A){this._pairs.push([t,A])};Ly.toString=function(t){let A=t?function(i){return t.call(this,i,by)}:by;return this._pairs.map(function(n){return A(n[0])+"="+A(n[1])},"").join("&")};var pc=Oy;function gx(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Ds(e,t,A){if(!t)return e;let i=A&&A.encode||gx,n=A&&A.serialize,r;if(n?r=n(t,A):r=w.isURLSearchParams(t)?t.toString():new pc(t,A).toString(i),r){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+r}return e}var jf=class{constructor(){this.handlers=[]}use(t,A,i){return this.handlers.push({fulfilled:t,rejected:A,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){w.forEach(this.handlers,function(i){i!==null&&t(i)})}},$f=jf;var Ec={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Yy=typeof URLSearchParams<"u"?URLSearchParams:pc;var Py=typeof FormData<"u"?FormData:null;var Vy=typeof Blob<"u"?Blob:null;var zy={isBrowser:!0,classes:{URLSearchParams:Yy,FormData:Py,Blob:Vy},protocols:["http","https","file","blob","url","data"]};var eB={};Y0(eB,{hasBrowserEnv:()=>_y,hasStandardBrowserEnv:()=>ux,hasStandardBrowserWebWorkerEnv:()=>fx});var _y=typeof window<"u"&&typeof document<"u",ux=(e=>_y&&["ReactNative","NativeScript","NS"].indexOf(e)<0)(typeof navigator<"u"&&navigator.product),fx=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function";var ut={...eB,...zy};function tB(e,t){return vi(e,new ut.classes.URLSearchParams,Object.assign({visitor:function(A,i,n,r){return ut.isNode&&w.isBuffer(A)?(this.append(i,A.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}function Bx(e){return w.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function dx(e){let t={},A=Object.keys(e),i,n=A.length,r;for(i=0;i=A.length;return o=!o&&w.isArray(n)?n.length:o,a?(w.hasOwnProp(n,o)?n[o]=[n[o],i]:n[o]=i,!s):((!n[o]||!w.isObject(n[o]))&&(n[o]=[]),t(A,i,n[o],r)&&w.isArray(n[o])&&(n[o]=dx(n[o])),!s)}if(w.isFormData(e)&&w.isFunction(e.entries)){let A={};return w.forEachEntry(e,(i,n)=>{t(Bx(i),n,A,0)}),A}return null}var mc=Cx;function Qx(e,t,A){if(w.isString(e))try{return(t||JSON.parse)(e),w.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(A||JSON.stringify)(e)}var AB={transitional:Ec,adapter:["xhr","http"],transformRequest:[function(t,A){let i=A.getContentType()||"",n=i.indexOf("application/json")>-1,r=w.isObject(t);if(r&&w.isHTMLForm(t)&&(t=new FormData(t)),w.isFormData(t))return n?JSON.stringify(mc(t)):t;if(w.isArrayBuffer(t)||w.isBuffer(t)||w.isStream(t)||w.isFile(t)||w.isBlob(t))return t;if(w.isArrayBufferView(t))return t.buffer;if(w.isURLSearchParams(t))return A.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let s;if(r){if(i.indexOf("application/x-www-form-urlencoded")>-1)return tB(t,this.formSerializer).toString();if((s=w.isFileList(t))||i.indexOf("multipart/form-data")>-1){let a=this.env&&this.env.FormData;return vi(s?{"files[]":t}:t,a&&new a,this.formSerializer)}}return r||n?(A.setContentType("application/json",!1),Qx(t)):t}],transformResponse:[function(t){let A=this.transitional||AB.transitional,i=A&&A.forcedJSONParsing,n=this.responseType==="json";if(t&&w.isString(t)&&(i&&!this.responseType||n)){let o=!(A&&A.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(s){if(o)throw s.name==="SyntaxError"?j.from(s,j.ERR_BAD_RESPONSE,this,null,this.response):s}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ut.classes.FormData,Blob:ut.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};w.forEach(["delete","get","head","post","put","patch"],e=>{AB.headers[e]={}});var kr=AB;var hx=w.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ty=e=>{let t={},A,i,n;return e&&e.split(` +`?o.insert.slice(0,-1):o.insert;(typeof s!="string"||s.length>0)&&ju(i,this,n,s,o.attributes||{})}else o.retain!==void 0?NE(i,this,n,o.retain,o.attributes||{}):o.delete!==void 0&&xE(i,n,o.delete)}}):this._pending.push(()=>this.applyDelta(t))}toDelta(t,A,i){let n=[],r=new Map,o=this.doc,s="",a=this._start;function c(){if(s.length>0){let l={},g=!1;r.forEach((f,C)=>{g=!0,l[C]=f});let u={insert:s};g&&(u.attributes=l),n.push(u),s=""}}let I=()=>{for(;a!==null;){if(Br(a,t)||A!==void 0&&Br(a,A))switch(a.content.constructor){case _A:{let l=r.get("ychange");t!==void 0&&!Br(a,t)?(l===void 0||l.user!==a.id.client||l.type!=="removed")&&(c(),r.set("ychange",i?i("removed",a.id):{type:"removed"})):A!==void 0&&!Br(a,A)?(l===void 0||l.user!==a.id.client||l.type!=="added")&&(c(),r.set("ychange",i?i("added",a.id):{type:"added"})):l!==void 0&&(c(),r.delete("ychange")),s+=a.content.str;break}case TA:case fn:{c();let l={insert:a.content.getContent()[0]};if(r.size>0){let g={};l.attributes=g,r.forEach((u,f)=>{g[f]=u})}n.push(l);break}case Je:Br(a,t)&&(c(),pr(r,a.content));break}a=a.right}c()};return t||A?de(o,l=>{t&&Af(l,t),A&&Af(l,A),I()},"cleanup"):I(),n}insert(t,A,i){if(A.length<=0)return;let n=this.doc;n!==null?de(n,r=>{let o=kI(r,this,t);i||(i={},o.currentAttributes.forEach((s,a)=>{i[a]=s})),ju(r,this,o,A,i)}):this._pending.push(()=>this.insert(t,A,i))}insertEmbed(t,A,i={}){let n=this.doc;n!==null?de(n,r=>{let o=kI(r,this,t);ju(r,this,o,A,i)}):this._pending.push(()=>this.insertEmbed(t,A,i))}delete(t,A){if(A===0)return;let i=this.doc;i!==null?de(i,n=>{xE(n,kI(n,this,t),A)}):this._pending.push(()=>this.delete(t,A))}format(t,A,i){if(A===0)return;let n=this.doc;n!==null?de(n,r=>{let o=kI(r,this,t);o.right!==null&&NE(r,this,o,A,i)}):this._pending.push(()=>this.format(t,A,i))}removeAttribute(t){this.doc!==null?de(this.doc,A=>{qI(A,this,t)}):this._pending.push(()=>this.removeAttribute(t))}setAttribute(t,A){this.doc!==null?de(this.doc,i=>{pf(i,this,t,A)}):this._pending.push(()=>this.setAttribute(t,A))}getAttribute(t){return Ef(this,t)}getAttributes(){return Am(this)}_write(t){t.writeTypeRef(tN)}},qU=e=>new as,$o=class{constructor(t,A=()=>!0){this._filter=A,this._root=t,this._currentNode=t._start,this._firstCall=!0}[Symbol.iterator](){return this}next(){let t=this._currentNode,A=t&&t.content&&t.content.type;if(t!==null&&(!this._firstCall||t.deleted||!this._filter(A)))do if(A=t.content.type,!t.deleted&&(A.constructor===bI||A.constructor===Cr)&&A._start!==null)t=A._start;else for(;t!==null;)if(t.right!==null){t=t.right;break}else t.parent===this._root?t=null:t=t.parent._item;while(t!==null&&(t.deleted||!this._filter(t.content.type)));return this._firstCall=!1,t===null?{value:void 0,done:!0}:(this._currentNode=t,{value:t.content.type,done:!1})}},Cr=class e extends Re{constructor(){super(),this._prelimContent=[]}get firstChild(){let t=this._first;return t?t.content.getContent()[0]:null}_integrate(t,A){super._integrate(t,A),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(A=>A instanceof Re?A.clone():A)),t}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(t){return new $o(this,t)}querySelector(t){t=t.toUpperCase();let i=new $o(this,n=>n.nodeName&&n.nodeName.toUpperCase()===t).next();return i.done?null:i.value}querySelectorAll(t){return t=t.toUpperCase(),pA(new $o(this,A=>A.nodeName&&A.nodeName.toUpperCase()===t))}_callObserver(t,A){VI(this,t,new cf(this,A,t))}toString(){return WE(this,t=>t.toString()).join("")}toJSON(){return this.toString()}toDOM(t=document,A={},i){let n=t.createDocumentFragment();return i!==void 0&&i._createAssociation(n,this),rs(this,r=>{n.insertBefore(r.toDOM(t,A,i),null)}),n}insert(t,A){this.doc!==null?de(this.doc,i=>{em(i,this,t,A)}):this._prelimContent.splice(t,0,...A)}insertAfter(t,A){if(this.doc!==null)de(this.doc,i=>{let n=t&&t instanceof Re?t._item:t;JI(i,this,n,A)});else{let i=this._prelimContent,n=t===null?0:i.findIndex(r=>r===t)+1;if(n===0&&t!==null)throw EA("Reference item not found");i.splice(n,0,...A)}}delete(t,A=1){this.doc!==null?de(this.doc,i=>{tm(i,this,t,A)}):this._prelimContent.splice(t,A)}toArray(){return ZE(this)}push(t){this.insert(this.length,t)}unshift(t){this.insert(0,t)}get(t){return jE(this,t)}slice(t=0,A=this.length){return XE(this,t,A)}forEach(t){rs(this,t)}_write(t){t.writeTypeRef(iN)}},KU=e=>new Cr,bI=class e extends Cr{constructor(t="UNDEFINED"){super(),this.nodeName=t,this._prelimAttrs=new Map}get nextSibling(){let t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){let t=this._item?this._item.prev:null;return t?t.content.type:null}_integrate(t,A){super._integrate(t,A),this._prelimAttrs.forEach((i,n)=>{this.setAttribute(n,i)}),this._prelimAttrs=null}_copy(){return new e(this.nodeName)}clone(){let t=new e(this.nodeName),A=this.getAttributes();return rE(A,(i,n)=>{typeof i=="string"&&t.setAttribute(n,i)}),t.insert(0,this.toArray().map(i=>i instanceof Re?i.clone():i)),t}toString(){let t=this.getAttributes(),A=[],i=[];for(let s in t)i.push(s);i.sort();let n=i.length;for(let s=0;s0?" "+A.join(" "):"";return`<${r}${o}>${super.toString()}`}removeAttribute(t){this.doc!==null?de(this.doc,A=>{qI(A,this,t)}):this._prelimAttrs.delete(t)}setAttribute(t,A){this.doc!==null?de(this.doc,i=>{pf(i,this,t,A)}):this._prelimAttrs.set(t,A)}getAttribute(t){return Ef(this,t)}hasAttribute(t){return im(this,t)}getAttributes(t){return t?GU(this,t):Am(this)}toDOM(t=document,A={},i){let n=t.createElement(this.nodeName),r=this.getAttributes();for(let o in r){let s=r[o];typeof s=="string"&&n.setAttribute(o,s)}return rs(this,o=>{n.appendChild(o.toDOM(t,A,i))}),i!==void 0&&i._createAssociation(n,this),n}_write(t){t.writeTypeRef(AN),t.writeKey(this.nodeName)}},bU=e=>new bI(e.readKey()),cf=class extends dr{constructor(t,A,i){super(t,i),this.childListChanged=!1,this.attributesChanged=new Set,A.forEach(n=>{n===null?this.childListChanged=!0:this.attributesChanged.add(n)})}},lf=class e extends os{constructor(t){super(),this.hookName=t}_copy(){return new e(this.hookName)}clone(){let t=new e(this.hookName);return this.forEach((A,i)=>{t.set(i,A)}),t}toDOM(t=document,A={},i){let n=A[this.hookName],r;return n!==void 0?r=n.createDom(this):r=document.createElement(this.hookName),r.setAttribute("data-yjs-hook",this.hookName),i!==void 0&&i._createAssociation(r,this),r}_write(t){t.writeTypeRef(nN),t.writeKey(this.hookName)}},OU=e=>new lf(e.readKey()),gf=class e extends as{get nextSibling(){let t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){let t=this._item?this._item.prev:null;return t?t.content.type:null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}toDOM(t=document,A,i){let n=t.createTextNode(this.toString());return i!==void 0&&i._createAssociation(n,this),n}toString(){return this.toDelta().map(t=>{let A=[];for(let n in t.attributes){let r=[];for(let o in t.attributes[n])r.push({key:o,value:t.attributes[n][o]});r.sort((o,s)=>o.keyn.nodeName=0;n--)i+=``;return i}).join("")}toJSON(){return this.toString()}_write(t){t.writeTypeRef(rN)}},LU=e=>new gf,Is=class{constructor(t,A){this.id=t,this.length=A}get deleted(){throw sA()}mergeWith(t){return!1}write(t,A,i){throw sA()}integrate(t,A){throw sA()}},YU=0,wt=class extends Is{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor!==t.constructor?!1:(this.length+=t.length,!0)}integrate(t,A){A>0&&(this.id.clock+=A,this.length-=A),YE(t.doc.store,this)}write(t,A){t.writeInfo(YU),t.writeLen(this.length-A)}getMissing(t,A){return null}},cs=class e{constructor(t){this.content=t}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new e(this.content)}splice(t){throw sA()}mergeWith(t){return!1}integrate(t,A){}delete(t){}gc(t){}write(t,A){t.writeBuf(this.content)}getRef(){return 3}},PU=e=>new cs(e.readBuf()),OI=class e{constructor(t){this.len=t}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.len)}splice(t){let A=new e(this.len-t);return this.len=t,A}mergeWith(t){return this.len+=t.len,!0}integrate(t,A){NI(t.deleteSet,A.id.client,A.id.clock,this.len),A.markDeleted()}delete(t){}gc(t){}write(t,A){t.writeLen(this.len-A)}getRef(){return 1}},VU=e=>new OI(e.readLen()),am=(e,t)=>new ts({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1}),ls=class e{constructor(t){t._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=t;let A={};this.opts=A,t.gc||(A.gc=!1),t.autoLoad&&(A.autoLoad=!0),t.meta!==null&&(A.meta=t.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new e(am(this.doc.guid,this.opts))}splice(t){throw sA()}mergeWith(t){return!1}integrate(t,A){this.doc._item=A,t.subdocsAdded.add(this.doc),this.doc.shouldLoad&&t.subdocsLoaded.add(this.doc)}delete(t){t.subdocsAdded.has(this.doc)?t.subdocsAdded.delete(this.doc):t.subdocsRemoved.add(this.doc)}gc(t){}write(t,A){t.writeString(this.doc.guid),t.writeAny(this.opts)}getRef(){return 9}},zU=e=>new ls(am(e.readString(),e.readAny())),fn=class e{constructor(t){this.embed=t}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new e(this.embed)}splice(t){throw sA()}mergeWith(t){return!1}integrate(t,A){}delete(t){}gc(t){}write(t,A){t.writeJSON(this.embed)}getRef(){return 5}},_U=e=>new fn(e.readJSON()),Je=class e{constructor(t,A){this.key=t,this.value=A}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.key,this.value)}splice(t){throw sA()}mergeWith(t){return!1}integrate(t,A){let i=A.parent;i._searchMarker=null,i._hasFormatting=!0}delete(t){}gc(t){}write(t,A){t.writeKey(this.key),t.writeJSON(this.value)}getRef(){return 6}},TU=e=>new Je(e.readKey(),e.readJSON()),uf=class e{constructor(t){this.arr=t}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let A=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),A}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,A){}delete(t){}gc(t){}write(t,A){let i=this.arr.length;t.writeLen(i-A);for(let n=A;n{let t=e.readLen(),A=[];for(let i=0;i{let t=e.readLen(),A=[];for(let i=0;i=55296&&i<=56319&&(this.str=this.str.slice(0,t-1)+"\uFFFD",A.str="\uFFFD"+A.str.slice(1)),A}mergeWith(t){return this.str+=t.str,!0}integrate(t,A){}delete(t){}gc(t){}write(t,A){t.writeString(A===0?this.str:this.str.slice(A))}getRef(){return 4}},WU=e=>new _A(e.readString()),jU=[HU,MU,qU,bU,KU,OU,LU],$U=0,eN=1,tN=2,AN=3,iN=4,nN=5,rN=6,TA=class e{constructor(t){this.type=t}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new e(this.type._copy())}splice(t){throw sA()}mergeWith(t){return!1}integrate(t,A){this.type._integrate(t.doc,A)}delete(t){let A=this.type._start;for(;A!==null;)A.deleted?A.id.clock<(t.beforeState.get(A.id.client)||0)&&t._mergeStructs.push(A):A.delete(t),A=A.right;this.type._map.forEach(i=>{i.deleted?i.id.clock<(t.beforeState.get(i.id.client)||0)&&t._mergeStructs.push(i):i.delete(t)}),t.changed.delete(this.type)}gc(t){let A=this.type._start;for(;A!==null;)A.gc(t,!0),A=A.right;this.type._start=null,this.type._map.forEach(i=>{for(;i!==null;)i.gc(t,!0),i=i.left}),this.type._map=new Map}write(t,A){this.type._write(t)}getRef(){return 7}},oN=e=>new TA(jU[e.readTypeRef()](e));var LI=(e,t,A)=>{let{client:i,clock:n}=t.id,r=new Ye(Ae(i,n+A),t,Ae(i,n+A-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(A));return t.deleted&&r.markDeleted(),t.keep&&(r.keep=!0),t.redone!==null&&(r.redone=Ae(t.redone.client,t.redone.clock+A)),t.right=r,r.right!==null&&(r.right.left=r),e._mergeStructs.push(r),r.parentSub!==null&&r.right===null&&r.parent._map.set(r.parentSub,r),t.length=A,r};var Ye=class e extends Is{constructor(t,A,i,n,r,o,s,a){super(t,a.getLength()),this.origin=i,this.left=A,this.right=n,this.rightOrigin=r,this.parent=o,this.parentSub=s,this.redone=null,this.content=a,this.info=this.content.isCountable()?2:0}set marker(t){(this.info&8)>0!==t&&(this.info^=8)}get marker(){return(this.info&8)>0}get keep(){return(this.info&1)>0}set keep(t){this.keep!==t&&(this.info^=1)}get countable(){return(this.info&2)>0}get deleted(){return(this.info&4)>0}set deleted(t){this.deleted!==t&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(t,A){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Le(A,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Le(A,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Si&&this.id.client!==this.parent.client&&this.parent.clock>=Le(A,this.parent.client))return this.parent.client;if(this.origin&&(this.left=FE(t,A,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Ni(t,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===wt||this.right&&this.right.constructor===wt)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===e&&(this.parent=this.left.parent,this.parentSub=this.left.parentSub),this.right&&this.right.constructor===e&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Si){let i=Wu(A,this.parent);i.constructor===wt?this.parent=null:this.parent=i.content.type}return null}integrate(t,A){if(A>0&&(this.id.clock+=A,this.left=FE(t,t.doc.store,Ae(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(A),this.length-=A),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let i=this.left,n;if(i!==null)n=i.right;else if(this.parentSub!==null)for(n=this.parent._map.get(this.parentSub)||null;n!==null&&n.left!==null;)n=n.left;else n=this.parent._start;let r=new Set,o=new Set;for(;n!==null&&n!==this.right;){if(o.add(n),r.add(n),FI(this.origin,n.origin)){if(n.id.client{i.p===t&&(i.p=this,!this.deleted&&this.countable&&(i.index-=this.length))}),t.keep&&(this.keep=!0),this.right=t.right,this.right!==null&&(this.right.left=this),this.length+=t.length,!0}return!1}delete(t){if(!this.deleted){let A=this.parent;this.countable&&this.parentSub===null&&(A._length-=this.length),this.markDeleted(),NI(t.deleteSet,this.id.client,this.id.clock,this.length),kE(t,A,this.parentSub),this.content.delete(t)}}gc(t,A){if(!this.deleted)throw aA();this.content.gc(t),A?QU(t,this,new wt(this.id,this.length)):this.content=new OI(this.length)}write(t,A){let i=A>0?Ae(this.id.client,this.id.clock+A-1):this.origin,n=this.rightOrigin,r=this.parentSub,o=this.content.getRef()&31|(i===null?0:128)|(n===null?0:64)|(r===null?0:32);if(t.writeInfo(o),i!==null&&t.writeLeftID(i),n!==null&&t.writeRightID(n),i===null&&n===null){let s=this.parent;if(s._item!==void 0){let a=s._item;if(a===null){let c=BU(s);t.writeParentInfo(!0),t.writeString(c)}else t.writeParentInfo(!1),t.writeLeftID(a.id)}else s.constructor===String?(t.writeParentInfo(!0),t.writeString(s)):s.constructor===Si?(t.writeParentInfo(!1),t.writeLeftID(s)):aA();r!==null&&t.writeString(r)}this.content.write(t,A)}},Im=(e,t)=>sN[t&31](e),sN=[()=>{aA()},VU,XU,PU,WU,_U,TU,oN,ZU,zU,()=>{aA()}],aN=10,Ft=class extends Is{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor!==t.constructor?!1:(this.length+=t.length,!0)}integrate(t,A){aA()}write(t,A){t.writeInfo(aN),W(t.restEncoder,this.length-A)}getMissing(t,A){return null}},cm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},lm="__ $YJS$ __";cm[lm]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");cm[lm]=!0;var zI={proxies:new WeakMap,traps:new WeakMap},gm=(e,t,A)=>e.get(t)||e.set(t,new A).get(t),um=e=>e.join(),fm=(e,t,A,i,n)=>{gm(gm(zI.traps,e,WeakMap),t,Map).set(um(A),i),zI.proxies.set(i,n)},mf=(e,t,A)=>{var i,n;return zI.proxies.get((n=(i=zI.traps.get(e))===null||i===void 0?void 0:i.get(t))===null||n===void 0?void 0:n.get(um(A)))};var cN=Symbol("default"),lN=Object.keys(Object.getOwnPropertyDescriptors(Reflect)),gN=["get","has","set","defineProperty","deleteProperty","getOwnPropertyDescriptor"],uN=(e,t)=>{let A,i,n,r,o,s,a,c;switch(e){case"get":[A,i,r]=t;break;case"set":[A,i,n,r]=t;break;case"deleteProperty":case"defineProperty":[A,s]=t;break;case"has":case"getOwnPropertyDescriptor":[A,i]=t;break;case"apply":[A,a,o]=t;break;case"construct":[A,o]=t;break;case"setPrototypeOf":[A,c]=t;break;default:[A]=t}return{target:A,name:i,receiver:r,val:n,args:o,descriptor:s,thisValue:a,prototype:c}},fN=(e,t)=>{let{trapName:A,handler:i,traps:n,root:r,path:o}=e,{target:s,name:a,val:c,receiver:I,args:l,descriptor:g,thisValue:u,prototype:f}=uN(A,t),C=gN.includes(A)?a:void 0;return{parameters:t,target:s,name:a,val:c,args:l,descriptor:g,receiver:I,thisValue:u,prototype:f,trapName:A,traps:n,path:o,handler:i,key:C,newValue:A==="set"?c:void 0,root:r,get proxy(){return mf(r,s,o)},get value(){return C&&s[C]},DEFAULT:cN,PROXY:Bm.bind({root:r,handler:i,path:[...o,C]})}},BN=function(...e){let{trapName:t,handler:A}=this,i=fN(this,e),{PROXY:n,DEFAULT:r}=i,o=A(i);return o===n?n(i.value):o===r?Reflect[t](...e):o},dN=(e,t,A)=>lN.reduce((i,n)=>(i[n]=BN.bind({trapName:n,handler:e,traps:i,root:t,path:A}),i),{}),CN=e=>{if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Deep proxy could be applied to objects and functions only")},QN=({DEFAULT:e})=>e,Bm=function(e,t,A,i){CN(e);let n=Object.assign({},this),r=t||n.handler||QN,o=A||n.path||[],s=n.root||i||e,a=mf(s,e,o);if(a)return a;let c=dN(r,s,o),I=new Proxy(e,c);return fm(s,e,o,c,I),I},dm=class{constructor(e,t,A,i){return Bm(e,t,A,i)}};function fs(e,t,A,i){function n(r){return r instanceof A?r:new A(function(o){o(r)})}return new(A||(A=Promise))(function(r,o){function s(I){try{c(i.next(I))}catch(l){o(l)}}function a(I){try{c(i.throw(I))}catch(l){o(l)}}function c(I){I.done?r(I.value):n(I.value).then(s,a)}c((i=i.apply(e,t||[])).next())})}var Ee=class{constructor(){this.mutex=Promise.resolve()}lock(){let t=()=>{};return this.mutex=this.mutex.then(()=>new Promise(t)),new Promise(A=>{t=A})}dispatch(t){return fs(this,void 0,void 0,function*(){let A=yield this.lock();try{return yield Promise.resolve(t())}finally{A()}})}},yf;function hN(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global}var Df=hN(),wf=(yf=Df.Buffer)!==null&&yf!==void 0?yf:null,pN=Df.TextEncoder?new Df.TextEncoder:null;function ym(e,t){return(e&15)+(e>>6|e>>3&8)<<4|(t&15)+(t>>6|t>>3&8)}function EN(e,t){let A=t.length>>1;for(let i=0;i>>4;e[i++]=r>9?r+Cm:r+Qm,r=t[n]&15,e[i++]=r>9?r+Cm:r+Qm}return String.fromCharCode.apply(null,e)}var pm=wf!==null?e=>{if(typeof e=="string"){let t=wf.from(e,"utf8");return new Uint8Array(t.buffer,t.byteOffset,t.length)}if(wf.isBuffer(e))return new Uint8Array(e.buffer,e.byteOffset,e.length);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Invalid data type!")}:e=>{if(typeof e=="string")return pN.encode(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Invalid data type!")},Em="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",us=new Uint8Array(256);for(let e=0;e>4,n+=1,i[n]=(s&15)<<4|a>>2,n+=1,i[n]=(a&3)<<6|c&63,n+=1}return i}var _I=16*1024,gs=4,FN=new Ee,Ff=new Map;function DN(e,t){return fs(this,void 0,void 0,function*(){let A=null,i=null,n=!1;if(typeof WebAssembly>"u")throw new Error("WebAssembly is not supported in this environment!");let r=(D,S=0)=>{i.set(D,S)},o=()=>i,s=()=>A.exports,a=D=>{A.exports.Hash_SetMemorySize(D);let S=A.exports.Hash_GetBuffer(),N=A.exports.memory.buffer;i=new Uint8Array(N,S,D)},c=()=>new DataView(A.exports.memory.buffer).getUint32(A.exports.STATE_SIZE,!0),I=FN.dispatch(()=>fs(this,void 0,void 0,function*(){if(!Ff.has(e.name)){let S=wN(e.data),N=WebAssembly.compile(S);Ff.set(e.name,N)}let D=yield Ff.get(e.name);A=yield WebAssembly.instantiate(D,{})})),l=()=>fs(this,void 0,void 0,function*(){A||(yield I);let D=A.exports.Hash_GetBuffer(),S=A.exports.memory.buffer;i=new Uint8Array(S,D,_I)}),g=(D=null)=>{n=!0,A.exports.Hash_Init(D)},u=D=>{let S=0;for(;S{if(!n)throw new Error("update() called before init()");let S=pm(D);u(S)},C=new Uint8Array(t*2),F=(D,S=null)=>{if(!n)throw new Error("digest() called before init()");return n=!1,A.exports.Hash_Final(S),D==="binary"?i.slice(0,t):hm(C,i,t)},d=()=>{if(!n)throw new Error("save() can only be called after init() and before digest()");let D=A.exports.Hash_GetState(),S=c(),N=A.exports.memory.buffer,b=new Uint8Array(N,D,S),q=new Uint8Array(gs+S);return EN(q,e.hash),q.set(b,gs),q},B=D=>{if(!(D instanceof Uint8Array))throw new Error("load() expects an Uint8Array generated by save()");let S=A.exports.Hash_GetState(),N=c(),b=gs+N,q=A.exports.memory.buffer;if(D.length!==b)throw new Error(`Bad state length (expected ${b} bytes, got ${D.length})`);if(!mN(e.hash,D.subarray(0,gs)))throw new Error("This state was written by an incompatible hash implementation");let Z=D.subarray(gs);new Uint8Array(q,S,N).set(Z),n=!0},Q=D=>typeof D=="string"?D.length<_I/4:D.byteLength<_I,y=Q;switch(e.name){case"argon2":case"scrypt":y=()=>!0;break;case"blake2b":case"blake2s":y=(D,S)=>S<=512&&Q(D);break;case"blake3":y=(D,S)=>S===0&&Q(D);break;case"xxhash64":case"xxhash3":case"xxhash128":y=()=>!1;break}let k=(D,S=null,N=null)=>{if(!y(D,S))return g(S),f(D),F("hex",N);let b=pm(D);return i.set(b),A.exports.Hash_Calculate(b.length,S,N),hm(C,i,t)};return yield l(),{getMemory:o,writeMemory:r,getExports:s,setMemorySize:a,init:g,update:f,digest:F,save:d,load:B,calculate:k,hashLength:t}})}function kN(e,t,A){return fs(this,void 0,void 0,function*(){let i=yield e.lock(),n=yield DN(t,A);return i(),n})}var cv=new Ee;var lv=new Ee;var gv=new DataView(new ArrayBuffer(4));var uv=new Ee;var fv=new Ee;var Bv=new Ee;var dv=new Ee;var Cv=new Ee;var Qv=new Ee;var hv=new Ee;var pv=new Ee;var Ev=new Ee;var mv=new Ee;var yv=new Ee;var wv=new Ee;var Fv=new Ee;var SN="xxhash32",UN="AGFzbQEAAAABEQRgAAF/YAF/AGAAAGACf38AAwcGAAEBAgADBQQBAQICBg4CfwFBsIkFC38AQYAICwdwCAZtZW1vcnkCAA5IYXNoX0dldEJ1ZmZlcgAACUhhc2hfSW5pdAABC0hhc2hfVXBkYXRlAAIKSGFzaF9GaW5hbAADDUhhc2hfR2V0U3RhdGUABA5IYXNoX0NhbGN1bGF0ZQAFClNUQVRFX1NJWkUDAQqxEAYFAEGACQtNAEEAQgA3A6iJAUEAIAA2AoiJAUEAIABBz4yijgZqNgKMiQFBACAAQfeUr694ajYChIkBQQAgAEGoiI2hAmo2AoCJAUEAQQA2AqCJAQu4CAEHfwJAIABFDQBBAEEAKQOoiQEgAK18NwOoiQECQEEAKAKgiQEiASAAakEPSw0AAkACQCAAQQNxIgINAEGACSEDIAAhBAwBCyAAQXxxIQRBgAkhAwNAQQBBACgCoIkBIgVBAWo2AqCJASAFQZCJAWogAy0AADoAACADQQFqIQMgAkF/aiICDQALCyAAQQRJDQEDQEEAQQAoAqCJASICQQFqNgKgiQEgAkGQiQFqIAMtAAA6AAAgA0EBai0AACECQQBBACgCoIkBIgVBAWo2AqCJASAFQZCJAWogAjoAACADQQJqLQAAIQJBAEEAKAKgiQEiBUEBajYCoIkBIAVBkIkBaiACOgAAIANBA2otAAAhAkEAQQAoAqCJASIFQQFqNgKgiQEgBUGQiQFqIAI6AAAgA0EEaiEDIARBfGoiBA0ADAILCyAAQfAIaiEGAkACQCABDQBBACgCjIkBIQJBACgCiIkBIQVBACgChIkBIQRBACgCgIkBIQFBgAkhAwwBC0GACSEDAkAgAUEPSw0AQYAJIQMCQAJAQQAgAWtBA3EiBA0AIAEhBQwBCyABIQIDQEEAIAJBAWoiBTYCoIkBIAJBkIkBaiADLQAAOgAAIANBAWohAyAFIQIgBEF/aiIEDQALCyABQXNqQQNJDQBBACEEA0AgAyAEaiIBLQAAIQdBACAFIARqIgJBAWo2AqCJASACQZCJAWogBzoAACABQQFqLQAAIQdBACACQQJqNgKgiQEgAkGRiQFqIAc6AAAgAUECai0AACEHQQAgAkEDajYCoIkBIAJBkokBaiAHOgAAIAFBA2otAAAhAUEAIAJBBGo2AqCJASACQZOJAWogAToAACAFIARBBGoiBGpBEEcNAAsgAyAEaiEDC0EAQQAoApCJAUH3lK+veGxBACgCgIkBakENd0Gx893xeWwiATYCgIkBQQBBACgClIkBQfeUr694bEEAKAKEiQFqQQ13QbHz3fF5bCIENgKEiQFBAEEAKAKYiQFB95Svr3hsQQAoAoiJAWpBDXdBsfPd8XlsIgU2AoiJAUEAQQAoApyJAUH3lK+veGxBACgCjIkBakENd0Gx893xeWwiAjYCjIkBCyAAQYAJaiEAAkAgAyAGSw0AA0AgAygCAEH3lK+veGwgAWpBDXdBsfPd8XlsIQEgA0EMaigCAEH3lK+veGwgAmpBDXdBsfPd8XlsIQIgA0EIaigCAEH3lK+veGwgBWpBDXdBsfPd8XlsIQUgA0EEaigCAEH3lK+veGwgBGpBDXdBsfPd8XlsIQQgA0EQaiIDIAZNDQALC0EAIAI2AoyJAUEAIAU2AoiJAUEAIAQ2AoSJAUEAIAE2AoCJAUEAIAAgA2s2AqCJASAAIANGDQBBACECA0AgAkGQiQFqIAMgAmotAAA6AAAgAkEBaiICQQAoAqCJAUkNAAsLC6QDAgF+Bn9BACkDqIkBIgCnIQECQAJAIABCEFQNAEEAKAKEiQFBB3dBACgCgIkBQQF3akEAKAKIiQFBDHdqQQAoAoyJAUESd2ohAgwBC0EAKAKIiQFBsc/ZsgFqIQILIAIgAWohAkGQiQEhAwJAQQAoAqCJASIEQZCJAWoiBUGUiQFJDQBBkIkBIQEDQCABKAIAQb3cypV8bCACakERd0Gv1tO+AmwhAiABQQhqIQYgAUEEaiIDIQEgBiAFTQ0ACwsCQCADIAVGDQAgBEGPiQFqIQYCQAJAIAQgA2tBAXENACADIQEMAQsgA0EBaiEBIAMtAABBsc/ZsgFsIAJqQQt3QbHz3fF5bCECCyAGIANGDQADQCABQQFqLQAAQbHP2bIBbCABLQAAQbHP2bIBbCACakELd0Gx893xeWxqQQt3QbHz3fF5bCECIAFBAmoiASAFRw0ACwtBACACQQ92IAJzQfeUr694bCIBQQ12IAFzQb3cypV8bCIBQRB2IAFzIgJBGHQgAkGA/gNxQQh0ciABQQh2QYD+A3EgAUEYdnJyrTcDgAkLBgBBgIkBC/MDAgF+BH9BAEIANwOoiQFBACABNgKIiQFBACABQc+Moo4GajYCjIkBQQAgAUH3lK+veGo2AoSJAUEAIAFBqIiNoQJqNgKAiQFBAEEANgKgiQEgABACQQApA6iJASICpyEBAkACQCACQhBUDQBBACgChIkBQQd3QQAoAoCJAUEBd2pBACgCiIkBQQx3akEAKAKMiQFBEndqIQAMAQtBACgCiIkBQbHP2bIBaiEACyAAIAFqIQBBkIkBIQMCQEEAKAKgiQEiBEGQiQFqIgVBlIkBSQ0AQZCJASEBA0AgASgCAEG93MqVfGwgAGpBEXdBr9bTvgJsIQAgAUEIaiEGIAFBBGoiAyEBIAYgBU0NAAsLAkAgAyAFRg0AIARBj4kBaiEGAkACQCAEIANrQQFxDQAgAyEBDAELIANBAWohASADLQAAQbHP2bIBbCAAakELd0Gx893xeWwhAAsgBiADRg0AA0AgAUEBai0AAEGxz9myAWwgAS0AAEGxz9myAWwgAGpBC3dBsfPd8XlsakELd0Gx893xeWwhACABQQJqIgEgBUcNAAsLQQAgAEEPdiAAc0H3lK+veGwiAUENdiABc0G93MqVfGwiAUEQdiABcyIAQRh0IABBgP4DcUEIdHIgAUEIdkGA/gNxIAFBGHZycq03A4AJCwsLAQBBgAgLBDAAAAA=",NN="9e3a00cd",xN={name:SN,data:UN,hash:NN},GN=new Ee,TI=null;function mm(e){return!Number.isInteger(e)||e<0||e>4294967295?new Error("Seed must be a valid 32-bit long unsigned integer."):null}function XI(e,t=0){if(mm(t))return Promise.reject(mm(t));if(TI===null)return kN(GN,xN,4).then(A=>(TI=A,TI.calculate(e,t)));try{let A=TI.calculate(e,t);return Promise.resolve(A)}catch(A){return Promise.reject(A)}}var Dv=new Ee;var kv=new ArrayBuffer(8);var Sv=new Ee;var Uv=new ArrayBuffer(8);var Nv=new Ee;var xv=new ArrayBuffer(8);var Gv=new Ee;var Hv=new Ee;var Mv=new Ee;function Sf(e){return new Promise((t,A)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>A(e.error)})}function Bs(e,t){let A=indexedDB.open(e);A.onupgradeneeded=()=>A.result.createObjectStore(t);let i=Sf(A);return(n,r)=>i.then(o=>r(o.transaction(t,n).objectStore(t)))}var kf;function wm(){return kf||(kf=Bs("keyval-store","keyval")),kf}function Er(e,t=wm()){return t("readonly",A=>Sf(A.get(e)))}function ds(e,t,A=wm()){return A("readwrite",i=>(i.put(t,e),Sf(i.transaction)))}var Nf;try{Nf=new TextDecoder}catch{}var H,zt,h=0;var Rm=[],xf=Rm,Gf=0,ye={},ie,xi,Vt=0,DA=0,Ve,XA,Dt=[],ee,Fm={useRecords:!1,mapsAsObjects:!0},Cs=class{},Mf=new Cs;Mf.name="MessagePack 0xC1";var Gi=!1,Jm=2,Dm,km,Sm;try{new Function("")}catch{Jm=1/0}var dn=class e{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=!1&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,A){if(H)return Om(()=>(WI(),this?this.unpack(t,A):e.prototype.unpack.call(Fm,t,A)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof A=="object"?(zt=A.end||t.length,h=A.start||0):(h=0,zt=A>-1?A:t.length),Gf=0,DA=0,xi=null,xf=Rm,Ve=null,H=t;try{ee=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(i){throw H=null,t instanceof Uint8Array?i:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof e){if(ye=this,this.structures)return ie=this.structures,ZI(A);(!ie||ie.length>0)&&(ie=[])}else ye=Fm,(!ie||ie.length>0)&&(ie=[]);return ZI(A)}unpackMultiple(t,A){let i,n=0;try{Gi=!0;let r=t.length,o=this?this.unpack(t,r):$I.unpack(t,r);if(A){if(A(o,n,h)===!1)return;for(;hi.slice(0)));for(let i=0,n=t.length;i=32&&(r.highByte=i-32>>5))}t.sharedLength=t.length;for(let i in A||[])if(i>=0){let n=t[i],r=A[i];r&&(n&&((t.restoreStructures||(t.restoreStructures=[]))[i]=n),t[i]=r)}return this.structures=t}decode(t,A){return this.unpack(t,A)}};function ZI(e){try{if(!ye.trusted&&!Gi){let A=ie.sharedLength||0;A=32&&Dm?(t=Dm(H,h,zt,ye),H=null,!(e&&e.lazy)&&t&&(t=t.toJSON()),h=zt):t=Ne(),Ve&&(h=Ve.postBundlePosition,Ve=null),Gi&&(ie.restoreStructures=null),h==zt)ie&&ie.restoreStructures&&Um(),ie=null,H=null,XA&&(XA=null);else{if(h>zt)throw new Error("Unexpected end of MessagePack data");if(!Gi){let A;try{A=JSON.stringify(t,(i,n)=>typeof n=="bigint"?`${n}n`:n).slice(0,100)}catch(i){A="(JSON view not available "+i+")"}throw new Error("Data read, but end of buffer not reached "+A)}}return t}catch(t){throw ie&&ie.restoreStructures&&Um(),WI(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||h>zt)&&(t.incomplete=!0),t}}function Um(){for(let e in ie.restoreStructures)ie[e]=ie.restoreStructures[e];ie.restoreStructures=null}function Ne(){let e=H[h++];if(e<160)if(e<128){if(e<64)return e;{let t=ie[e&63]||ye.getStructures&&qm()[e&63];return t?(t.read||(t.read=vf(t,e&63)),t.read()):e}}else if(e<144)if(e-=128,ye.mapsAsObjects){let t={};for(let A=0;A=h)return xi.slice(h-Vt,(h+=t)-Vt);if(DA==0&&zt<140){let A=t<16?Rf(t):Km(t);if(A!=null)return A}return Hf(t)}else{let t;switch(e){case 192:return null;case 193:return Ve?(t=Ne(),t>0?Ve[1].slice(Ve.position1,Ve.position1+=t):Ve[0].slice(Ve.position0,Ve.position0-=t)):Mf;case 194:return!1;case 195:return!0;case 196:if(t=H[h++],t===void 0)throw new Error("Unexpected end of buffer");return Uf(t);case 197:return t=ee.getUint16(h),h+=2,Uf(t);case 198:return t=ee.getUint32(h),h+=4,Uf(t);case 199:return Bn(H[h++]);case 200:return t=ee.getUint16(h),h+=2,Bn(t);case 201:return t=ee.getUint32(h),h+=4,Bn(t);case 202:if(t=ee.getFloat32(h),ye.useFloat32>2){let A=jI[(H[h]&127)<<1|H[h+1]>>7];return h+=4,(A*t+(t>0?.5:-.5)>>0)/A}return h+=4,t;case 203:return t=ee.getFloat64(h),h+=8,t;case 204:return H[h++];case 205:return t=ee.getUint16(h),h+=2,t;case 206:return t=ee.getUint32(h),h+=4,t;case 207:return ye.int64AsType==="number"?(t=ee.getUint32(h)*4294967296,t+=ee.getUint32(h+4)):ye.int64AsType==="string"?t=ee.getBigUint64(h).toString():ye.int64AsType==="auto"?(t=ee.getBigUint64(h),t<=BigInt(2)<=BigInt(-2)<=h?xi.slice(h-Vt,(h+=t)-Vt):MN(t);case 218:return t=ee.getUint16(h),h+=2,DA>=h?xi.slice(h-Vt,(h+=t)-Vt):vN(t);case 219:return t=ee.getUint32(h),h+=4,DA>=h?xi.slice(h-Vt,(h+=t)-Vt):RN(t);case 220:return t=ee.getUint16(h),h+=2,xm(t);case 221:return t=ee.getUint32(h),h+=4,xm(t);case 222:return t=ee.getUint16(h),h+=2,Gm(t);case 223:return t=ee.getUint32(h),h+=4,Gm(t);default:if(e>=224)return e-256;if(e===void 0){let A=new Error("Unexpected end of MessagePack data");throw A.incomplete=!0,A}throw new Error("Unknown MessagePack token "+e)}}}var HN=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function vf(e,t){function A(){if(A.count++>Jm){let n=e.read=new Function("r","return function(){return "+(ye.freezeData?"Object.freeze":"")+"({"+e.map(r=>r==="__proto__"?"__proto_:r()":HN.test(r)?r+":r()":"["+JSON.stringify(r)+"]:r()").join(",")+"})}")(Ne);return e.highByte===0&&(e.read=Nm(t,e.read)),n()}let i={};for(let n=0,r=e.length;nfunction(){let A=H[h++];if(A===0)return t();let i=e<32?-(e+(A<<5)):e+(A<<5),n=ie[i]||qm()[i];if(!n)throw new Error("Record id is not defined for "+i);return n.read||(n.read=vf(n,e)),n.read()};function qm(){let e=Om(()=>(H=null,ye.getStructures()));return ie=ye._mergeStructures(e,ie)}var Hf=Qs,MN=Qs,vN=Qs,RN=Qs;function Qs(e){let t;if(e<16&&(t=Rf(e)))return t;if(e>64&&Nf)return Nf.decode(H.subarray(h,h+=e));let A=h+e,i=[];for(t="";h65535&&(a-=65536,i.push(a>>>10&1023|55296),a=56320|a&1023),i.push(a)}else i.push(n);i.length>=4096&&(t+=Pe.apply(String,i),i.length=0)}return i.length>0&&(t+=Pe.apply(String,i)),t}function xm(e){let t=new Array(e);for(let A=0;A0){h=t;return}A[i]=n}return Pe.apply(String,A)}function Rf(e){if(e<4)if(e<2){if(e===0)return"";{let t=H[h++];if((t&128)>1){h-=1;return}return Pe(t)}}else{let t=H[h++],A=H[h++];if((t&128)>0||(A&128)>0){h-=2;return}if(e<3)return Pe(t,A);let i=H[h++];if((i&128)>0){h-=3;return}return Pe(t,A,i)}else{let t=H[h++],A=H[h++],i=H[h++],n=H[h++];if((t&128)>0||(A&128)>0||(i&128)>0||(n&128)>0){h-=4;return}if(e<6){if(e===4)return Pe(t,A,i,n);{let r=H[h++];if((r&128)>0){h-=5;return}return Pe(t,A,i,n,r)}}else if(e<8){let r=H[h++],o=H[h++];if((r&128)>0||(o&128)>0){h-=6;return}if(e<7)return Pe(t,A,i,n,r,o);let s=H[h++];if((s&128)>0){h-=7;return}return Pe(t,A,i,n,r,o,s)}else{let r=H[h++],o=H[h++],s=H[h++],a=H[h++];if((r&128)>0||(o&128)>0||(s&128)>0||(a&128)>0){h-=8;return}if(e<10){if(e===8)return Pe(t,A,i,n,r,o,s,a);{let c=H[h++];if((c&128)>0){h-=9;return}return Pe(t,A,i,n,r,o,s,a,c)}}else if(e<12){let c=H[h++],I=H[h++];if((c&128)>0||(I&128)>0){h-=10;return}if(e<11)return Pe(t,A,i,n,r,o,s,a,c,I);let l=H[h++];if((l&128)>0){h-=11;return}return Pe(t,A,i,n,r,o,s,a,c,I,l)}else{let c=H[h++],I=H[h++],l=H[h++],g=H[h++];if((c&128)>0||(I&128)>0||(l&128)>0||(g&128)>0){h-=12;return}if(e<14){if(e===12)return Pe(t,A,i,n,r,o,s,a,c,I,l,g);{let u=H[h++];if((u&128)>0){h-=13;return}return Pe(t,A,i,n,r,o,s,a,c,I,l,g,u)}}else{let u=H[h++],f=H[h++];if((u&128)>0||(f&128)>0){h-=14;return}if(e<15)return Pe(t,A,i,n,r,o,s,a,c,I,l,g,u,f);let C=H[h++];if((C&128)>0){h-=15;return}return Pe(t,A,i,n,r,o,s,a,c,I,l,g,u,f,C)}}}}}function Hm(){let e=H[h++],t;if(e<192)t=e-160;else switch(e){case 217:t=H[h++];break;case 218:t=ee.getUint16(h),h+=2;break;case 219:t=ee.getUint32(h),h+=4;break;default:throw new Error("Expected string")}return Qs(t)}function Uf(e){return ye.copyBuffers?Uint8Array.prototype.slice.call(H,h,h+=e):H.subarray(h,h+=e)}function Bn(e){let t=H[h++];if(Dt[t]){let A;return Dt[t](H.subarray(h,A=h+=e),i=>{h=i;try{return Ne()}finally{h=A}})}else throw new Error("Unknown extension type "+t)}var Mm=new Array(4096);function bm(){let e=H[h++];if(e>=160&&e<192){if(e=e-160,DA>=h)return xi.slice(h-Vt,(h+=e)-Vt);if(!(DA==0&&zt<180))return Hf(e)}else return h--,Ne().toString();let t=(e<<5^(e>1?ee.getUint16(h):e>0?H[h]:0))&4095,A=Mm[t],i=h,n=h+e-3,r,o=0;if(A&&A.bytes==e){for(;i{let A=Ne().map(r=>r.toString()),i=e;t!==void 0&&(e=e<32?-((t<<5)+e):(t<<5)+e,A.highByte=t);let n=ie[e];return n&&(n.isShared||Gi)&&((ie.restoreStructures||(ie.restoreStructures=[]))[e]=n),ie[e]=A,A.read=vf(A,i),A.read()};Dt[0]=()=>{};Dt[0].noBuffer=!0;Dt[66]=e=>{let t=e.length,A=BigInt(e[0]&128?e[0]-256:e[0]);for(let i=1;i{let e=Ne();return(JN[e[0]]||Error)(e[1])};Dt[105]=e=>{let t=ee.getUint32(h-4);XA||(XA=new Map);let A=H[h],i;A>=144&&A<160||A==220||A==221?i=[]:i={};let n={target:i};XA.set(t,n);let r=Ne();return n.used?Object.assign(i,r):(n.target=r,r)};Dt[112]=e=>{let t=ee.getUint32(h-4),A=XA.get(t);return A.used=!0,A.target};Dt[115]=()=>new Set(Ne());var Jf=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array"),qN=typeof globalThis=="object"?globalThis:window;Dt[116]=e=>{let t=e[0],A=Jf[t];if(!A)throw new Error("Could not find typed array for code "+t);return new qN[A](Uint8Array.prototype.slice.call(e,1).buffer)};Dt[120]=()=>{let e=Ne();return new RegExp(e[0],e[1])};var KN=[];Dt[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],A=h;return h+=t-e.length,Ve=KN,Ve=[Hm(),Hm()],Ve.position0=0,Ve.position1=0,Ve.postBundlePosition=h,h=A,Ne()};Dt[255]=e=>e.length==4?new Date((e[0]*16777216+(e[1]<<16)+(e[2]<<8)+e[3])*1e3):e.length==8?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+((e[3]&3)*4294967296+e[4]*16777216+(e[5]<<16)+(e[6]<<8)+e[7])*1e3):e.length==12?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+((e[4]&128?-281474976710656:0)+e[6]*1099511627776+e[7]*4294967296+e[8]*16777216+(e[9]<<16)+(e[10]<<8)+e[11])*1e3):new Date("invalid");function Om(e){Sm&&Sm();let t=zt,A=h,i=Gf,n=Vt,r=DA,o=xi,s=xf,a=XA,c=Ve,I=new Uint8Array(H.slice(0,zt)),l=ie,g=ie.slice(0,ie.length),u=ye,f=Gi,C=e();return zt=t,h=A,Gf=i,Vt=n,DA=r,xi=o,xf=s,XA=a,Ve=c,H=I,Gi=f,ie=l,ie.splice(0,ie.length,...g),ye=u,ee=new DataView(H.buffer,H.byteOffset,H.byteLength),C}function WI(){H=null,XA=null,ie=null}var jI=new Array(147);for(let e=0;e<256;e++)jI[e]=+("1e"+Math.floor(45.15-e*.30103));var $I=new dn({useRecords:!1}),bN=$I.unpack,ON=$I.unpackMultiple,LN=$I.unpack,ec={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4},YN=new Float32Array(1),Jv=new Uint8Array(YN.buffer,0,4);var Ac;try{Ac=new TextEncoder}catch{}var qf,zm,ic=typeof Buffer<"u",tc=ic?function(e){return Buffer.allocUnsafeSlow(e)}:Uint8Array,_m=ic?Buffer:Uint8Array,Lm=ic?4294967296:2144337920,E,hs,le,p=0,gt,ke=null,PN,VN=21760,zN=/[\u0080-\uFFFF]/,mr=Symbol("record-id"),Cn=class extends dn{constructor(t){super(t),this.offset=0;let A,i,n,r,o,s=_m.prototype.utf8Write?function(m,J){return E.utf8Write(m,J,4294967295)}:Ac&&Ac.encodeInto?function(m,J){return Ac.encodeInto(m,E.subarray(J)).written}:!1,a=this;t||(t={});let c=t&&t.sequential,I=t.structures||t.saveStructures,l=t.maxSharedStructures;if(l==null&&(l=I?32:0),l>8160)throw new Error("Maximum maxSharedStructure is 8160");t.structuredClone&&t.moreTypes==null&&(this.moreTypes=!0);let g=t.maxOwnStructures;g==null&&(g=I?32:64),!this.structures&&t.useRecords!=!1&&(this.structures=[]);let u=l>32||g+l>64,f=l+64,C=l+g+64;if(C>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let F=[],d=0,B=0;this.pack=this.encode=function(m,J){if(E||(E=new tc(8192),le=E.dataView||(E.dataView=new DataView(E.buffer,0,8192)),p=0),gt=E.length-10,gt-p<2048?(E=new tc(E.length),le=E.dataView||(E.dataView=new DataView(E.buffer,0,E.length)),gt=E.length-10,p=0):p=p+7&2147483640,i=p,J&i3&&(p+=J&255),o=a.structuredClone?new Map:null,a.bundleStrings&&typeof m!="string"?(ke=[],ke.size=1/0):ke=null,r=a.structures,r){r.uninitialized&&(r=a._mergeStructures(a.getStructures()));let U=r.sharedLength||0;if(U>l)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+r.sharedLength);if(!r.transitions){r.transitions=Object.create(null);for(let G=0;Gae.offset>ne.offset?1:-1),z=G.length,O=-1;for(;U&&z>0;){let ae=G[--z].offset+i;aeU.position+i?O>=0&&(O+=6):(O>=0&&(le.setUint32(U.position+i,le.getUint32(U.position+i)+O),O=-1),U=U.previous,z++)}O>=0&&U&&le.setUint32(U.position+i,le.getUint32(U.position+i)+O),p+=G.length*6,p>gt&&q(p),a.offset=p;let L=TN(E.subarray(i,p),G);return o=null,L}return a.offset=p,J&Xm?(E.start=i,E.end=p,E):E.subarray(i,p)}catch(U){throw M=U,U}finally{if(r&&(Q(),n&&a.saveStructures)){let U=r.sharedLength||0,G=E.subarray(i,p),z=XN(r,a);if(!M)return a.saveStructures(z,z.isCompatible)===!1?a.pack(m,J):(a.lastNamedStructuresLength=U,G)}J&A3&&(p=i)}};let Q=()=>{B<10&&B++;let m=r.sharedLength||0;if(r.length>m&&!c&&(r.length=m),d>1e4)r.transitions=null,B=0,d=0,F.length>0&&(F=[]);else if(F.length>0&&!c){for(let J=0,M=F.length;J{var J=m.length;J<16?E[p++]=144|J:J<65536?(E[p++]=220,E[p++]=J>>8,E[p++]=J&255):(E[p++]=221,le.setUint32(p,J),p+=4);for(let M=0;M{p>gt&&(E=q(p));var J=typeof m,M;if(J==="string"){let U=m.length;if(ke&&U>=4&&U<4096){if((ke.size+=U)>VN){let L,ae=(ke[0]?ke[0].length*3+ke[1].length:0)+10;p+ae>gt&&(E=q(p+ae));let ne;ke.position?(ne=ke,E[p]=200,p+=3,E[p++]=98,L=p-i,p+=4,Vm(i,k,0),le.setUint16(L+i-3,p-i-L)):(E[p++]=214,E[p++]=98,L=p-i,p+=4),ke=["",""],ke.previous=ne,ke.size=0,ke.position=L}let O=zN.test(m);ke[O?0:1]+=m,E[p++]=193,k(O?-U:U);return}let G;U<32?G=1:U<256?G=2:U<65536?G=3:G=5;let z=U*3;if(p+z>gt&&(E=q(p+z)),U<64||!s){let O,L,ae,ne=p+G;for(O=0;O>6|192,E[ne++]=L&63|128):(L&64512)===55296&&((ae=m.charCodeAt(O+1))&64512)===56320?(L=65536+((L&1023)<<10)+(ae&1023),O++,E[ne++]=L>>18|240,E[ne++]=L>>12&63|128,E[ne++]=L>>6&63|128,E[ne++]=L&63|128):(E[ne++]=L>>12|224,E[ne++]=L>>6&63|128,E[ne++]=L&63|128);M=ne-p-G}else M=s(m,p+G);M<32?E[p++]=160|M:M<256?(G<2&&E.copyWithin(p+2,p+1,p+1+M),E[p++]=217,E[p++]=M):M<65536?(G<3&&E.copyWithin(p+3,p+2,p+2+M),E[p++]=218,E[p++]=M>>8,E[p++]=M&255):(G<5&&E.copyWithin(p+5,p+3,p+3+M),E[p++]=219,le.setUint32(p,M),p+=4),p+=M}else if(J==="number")if(m>>>0===m)m<32||m<128&&this.useRecords===!1||m<64&&!this.randomAccessStructure?E[p++]=m:m<256?(E[p++]=204,E[p++]=m):m<65536?(E[p++]=205,E[p++]=m>>8,E[p++]=m&255):(E[p++]=206,le.setUint32(p,m),p+=4);else if(m>>0===m)m>=-32?E[p++]=256+m:m>=-128?(E[p++]=208,E[p++]=m+256):m>=-32768?(E[p++]=209,le.setInt16(p,m),p+=2):(E[p++]=210,le.setInt32(p,m),p+=4);else{let U;if((U=this.useFloat32)>0&&m<4294967296&&m>=-2147483648){E[p++]=202,le.setFloat32(p,m);let G;if(U<4||(G=m*jI[(E[p]&127)<<1|E[p+1]>>7])>>0===G){p+=4;return}else p--}E[p++]=203,le.setFloat64(p,m),p+=8}else if(J==="object"||J==="function")if(!m)E[p++]=192;else{if(o){let G=o.get(m);if(G){if(!G.id){let z=o.idsToInsert||(o.idsToInsert=[]);G.id=z.push(G)}E[p++]=214,E[p++]=112,le.setUint32(p,G.id),p+=4;return}else o.set(m,{offset:p-i})}let U=m.constructor;if(U===Object)b(m,!0);else if(U===Array)y(m);else if(U===Map)if(this.mapAsEmptyObject)E[p++]=128;else{M=m.size,M<16?E[p++]=128|M:M<65536?(E[p++]=222,E[p++]=M>>8,E[p++]=M&255):(E[p++]=223,le.setUint32(p,M),p+=4);for(let[G,z]of m)k(G),k(z)}else{for(let G=0,z=qf.length;G(E=ae,ae=null,p+=Zt,p>gt&&q(p),{target:E,targetView:le,position:p-Zt}),k)}finally{ae&&(E=ae,le=ne,p=We,gt=E.length-10)}Xt&&(Xt.length+p>gt&&q(Xt.length+p),p=_N(Xt,E,p,L.type));return}}if(Array.isArray(m))y(m);else{if(m.toJSON){let G=m.toJSON();if(G!==m)return k(G)}if(J==="function")return k(this.writeFunction&&this.writeFunction(m));b(m,!m.hasOwnProperty)}}}else if(J==="boolean")E[p++]=m?195:194;else if(J==="bigint"){if(m=-(BigInt(1)<0)E[p++]=207,le.setBigUint64(p,m);else if(this.largeBigIntToFloat)E[p++]=203,le.setFloat64(p,Number(m));else if(this.useBigIntExtension&&m<2n**1023n&&m>-(2n**1023n)){E[p++]=199,p++,E[p++]=66;let U=[],G;do{let z=m&0xffn;G=(z&0x80n)===(m<0n?0x80n:0n),U.push(z),m>>=8n}while(!((m===0n||m===-1n)&&G));E[p-2]=U.length;for(let z=U.length;z>0;)E[p++]=Number(U[--z]);return}else throw new RangeError(m+" was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension or set largeBigIntToFloat to convert to float-64");p+=8}else if(J==="undefined")this.encodeUndefinedAsNil?E[p++]=192:(E[p++]=212,E[p++]=0,E[p++]=0);else throw new Error("Unknown type: "+J)},D=this.variableMapSize||this.coercibleKeyAsNumber?m=>{let J=Object.keys(m),M=J.length;M<16?E[p++]=128|M:M<65536?(E[p++]=222,E[p++]=M>>8,E[p++]=M&255):(E[p++]=223,le.setUint32(p,M),p+=4);let U;if(this.coercibleKeyAsNumber)for(let G=0;G{E[p++]=222;let M=p-i;p+=2;let U=0;for(let G in m)(J||m.hasOwnProperty(G))&&(k(G),k(m[G]),U++);E[M+++i]=U>>8,E[M+i]=U&255},S=this.useRecords===!1?D:t.progressiveRecords&&!u?(m,J)=>{let M,U=r.transitions||(r.transitions=Object.create(null)),G=p++-i,z;for(let O in m)if(J||m.hasOwnProperty(O)){if(M=U[O],M)U=M;else{let L=Object.keys(m),ae=U;U=r.transitions;let ne=0;for(let We=0,Xt=L.length;We{let M,U=r.transitions||(r.transitions=Object.create(null)),G=0;for(let O in m)(J||m.hasOwnProperty(O))&&(M=U[O],M||(M=U[O]=Object.create(null),G++),U=M);let z=U[mr];z?z>=96&&u?(E[p++]=((z-=96)&31)+96,E[p++]=z>>5):E[p++]=z:Z(U,U.__keys__||Object.keys(m),G);for(let O in m)(J||m.hasOwnProperty(O))&&k(m[O])},N=typeof this.useRecords=="function"&&this.useRecords,b=N?(m,J)=>{N(m)?S(m,J):D(m,J)}:S,q=m=>{let J;if(m>16777216){if(m-i>Lm)throw new Error("Packed buffer would be larger than maximum buffer size");J=Math.min(Lm,Math.round(Math.max((m-i)*(m>67108864?1.25:2),4194304)/4096)*4096)}else J=(Math.max(m-i<<2,E.length-1)>>12)+1<<12;let M=new tc(J);return le=M.dataView||(M.dataView=new DataView(M.buffer,0,J)),m=Math.min(m,E.length),E.copy?E.copy(M,0,i,m):M.set(E.slice(i,m)),p-=i,i=0,gt=M.length-10,E=M},Z=(m,J,M)=>{let U=r.nextId;U||(U=64),U=C&&(U=f),r.nextId=U+1);let G=J.highByte=U>=96&&u?U-96>>5:-1;m[mr]=U,m.__keys__=J,r[U-64]=J,U=0?(E[p++]=(U&31)+96,E[p++]=G):E[p++]=U):(G>=0?(E[p++]=213,E[p++]=114,E[p++]=(U&31)+96,E[p++]=G):(E[p++]=212,E[p++]=114,E[p++]=U),M&&(d+=B*M),F.length>=g&&(F.shift()[mr]=0),F.push(m),k(J))},xe=(m,J,M,U)=>{let G=E,z=p,O=gt,L=i;E=hs,p=0,i=0,E||(hs=E=new tc(8192)),gt=E.length-10,Z(m,J,U),hs=E;let ae=p;if(E=G,p=z,gt=O,i=L,ae>1){let ne=p+ae-1;ne>gt&&q(ne);let We=M+i;E.copyWithin(We+ae,We+1,p),E.set(hs.slice(0,ae),We),p=ne}else E[M+i]=hs[0]},Bt=(m,J)=>{let M=PN(m,E,i,p,r,q,(U,G,z)=>{if(z)return n=!0;p=G;let O=E;return k(U),Q(),O!==E?{position:p,targetView:le,target:E}:p},this);if(M===0)return b(m,!0);p=M}}useBuffer(t){E=t,le=new DataView(E.buffer,E.byteOffset,E.byteLength),p=0}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}};zm=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,Cs];qf=[{pack(e,t,A){let i=e.getTime()/1e3;if((this.useTimestamp32||e.getMilliseconds()===0)&&i>=0&&i<4294967296){let{target:n,targetView:r,position:o}=t(6);n[o++]=214,n[o++]=255,r.setUint32(o,i)}else if(i>0&&i<4294967296){let{target:n,targetView:r,position:o}=t(10);n[o++]=215,n[o++]=255,r.setUint32(o,e.getMilliseconds()*4e6+(i/1e3/4294967296>>0)),r.setUint32(o+4,i)}else if(isNaN(i)){if(this.onInvalidDate)return t(0),A(this.onInvalidDate());let{target:n,targetView:r,position:o}=t(3);n[o++]=212,n[o++]=255,n[o++]=255}else{let{target:n,targetView:r,position:o}=t(15);n[o++]=199,n[o++]=12,n[o++]=255,r.setUint32(o,e.getMilliseconds()*1e6),r.setBigInt64(o+4,BigInt(Math.floor(i)))}}},{pack(e,t,A){if(this.setAsEmptyObject)return t(0),A({});let i=Array.from(e),{target:n,position:r}=t(this.moreTypes?3:0);this.moreTypes&&(n[r++]=212,n[r++]=115,n[r++]=0),A(i)}},{pack(e,t,A){let{target:i,position:n}=t(this.moreTypes?3:0);this.moreTypes&&(i[n++]=212,i[n++]=101,i[n++]=0),A([e.name,e.message])}},{pack(e,t,A){let{target:i,position:n}=t(this.moreTypes?3:0);this.moreTypes&&(i[n++]=212,i[n++]=120,i[n++]=0),A([e.source,e.flags])}},{pack(e,t){this.moreTypes?Ym(e,16,t):Pm(ic?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let A=e.constructor;A!==_m&&this.moreTypes?Ym(e,Jf.indexOf(A.name),t):Pm(e,t)}},{pack(e,t){let{target:A,position:i}=t(1);A[i]=193}}];function Ym(e,t,A,i){let n=e.byteLength;if(n+1<256){var{target:r,position:o}=A(4+n);r[o++]=199,r[o++]=n+1}else if(n+1<65536){var{target:r,position:o}=A(5+n);r[o++]=200,r[o++]=n+1>>8,r[o++]=n+1&255}else{var{target:r,position:o,targetView:s}=A(7+n);r[o++]=201,s.setUint32(o,n+1),o+=4}r[o++]=116,r[o++]=t,r.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),o)}function Pm(e,t){let A=e.byteLength;var i,n;if(A<256){var{target:i,position:n}=t(A+2);i[n++]=196,i[n++]=A}else if(A<65536){var{target:i,position:n}=t(A+3);i[n++]=197,i[n++]=A>>8,i[n++]=A&255}else{var{target:i,position:n,targetView:r}=t(A+5);i[n++]=198,r.setUint32(n,A),n+=4}i.set(e,n)}function _N(e,t,A,i){let n=e.length;switch(n){case 1:t[A++]=212;break;case 2:t[A++]=213;break;case 4:t[A++]=214;break;case 8:t[A++]=215;break;case 16:t[A++]=216;break;default:n<256?(t[A++]=199,t[A++]=n):n<65536?(t[A++]=200,t[A++]=n>>8,t[A++]=n&255):(t[A++]=201,t[A++]=n>>24,t[A++]=n>>16&255,t[A++]=n>>8&255,t[A++]=n&255)}return t[A++]=i,t.set(e,A),A+=n,A}function TN(e,t){let A,i=t.length*6,n=e.length-i;for(;A=t.pop();){let r=A.offset,o=A.id;e.copyWithin(r+i,r,n),i-=6;let s=r+i;e[s++]=214,e[s++]=105,e[s++]=o>>24,e[s++]=o>>16&255,e[s++]=o>>8&255,e[s++]=o&255,n=r}return e}function Vm(e,t,A){if(ke.length>0){le.setUint32(ke.position+e,p+A-ke.position-e),ke.stringsPosition=p-e;let i=ke;ke=null,t(i[0]),t(i[1])}}function XN(e,t){return e.isCompatible=A=>{let i=!A||(t.lastNamedStructuresLength||0)===A.length;return i||t._mergeStructures(A),i},e}var Tm=new Cn({useRecords:!1}),ZN=Tm.pack,WN=Tm.pack;var{NEVER:jN,ALWAYS:$N,DECIMAL_ROUND:e3,DECIMAL_FIT:t3}=ec,Xm=512,A3=1024,i3=2048;var Yf=K(ey(),1),nR=Yf.default.configure,ty=Yf.default;var Ay={site:{list:"0",group:"1",load:"2",update:"3"},comp:{new:"4",list:"5",group:"6",load:"7"},page:{list:"8",load:"9",cache:"10"},yjs:{um:"11",sv_local:"12",diff_local:"13",sv_remote:"14"},client:{info:"15"},code:{load:"16",edit:"17",action:"18"}},iy={0:"site.list",1:"site.group",2:"site.load",3:"site.update",4:"comp.new",5:"comp.list",6:"comp.group",7:"comp.load",8:"page.list",9:"page.load",10:"page.cache",11:"yjs.um",12:"yjs.sv_local",13:"yjs.diff_local",14:"yjs.sv_remote",15:"client.info",16:"code.load",17:"code.edit",18:"code.action"};var Ce=window;var ny=e=>Bs(`prasi-user-${e}`,"default");var ry=new Cn({structuredClone:!0}),ps={debug:!!localStorage.getItem("prasi-ws-debug"),reconnectTimeout:1e3};Ce.debug=new Proxy({},{get(e,t,A){if(t==="off")return ps.debug=!1,localStorage.removeItem("prasi-ws-debug"),console.clear(),["WS DEBUG: Deactivated"];if(t==="on")return ps.debug=!0,localStorage.setItem("prasi-ws-debug","1"),console.clear(),["WS DEBUG: Activated"]}});var kA={ws:null,client_id:"",idb:null,event:null},Pf={action:{pending:{}}},oy=(e,t)=>{let A=ry.pack(t);ps.debug&&console.log("%c\u2B06","color:blue",ay(A.length,0),t),e.send(A)},sy=async e=>{let{user_id:t,site_id:A,page_id:i,events:n}=e;return kA.idb=ny(t),await I3({user_id:t,site_id:A,page_id:i},n),new dm(Ay,({target:r,trapName:o,value:s,key:a,DEFAULT:c,PROXY:I})=>{if(o==="set")throw new TypeError("target is immutable");return typeof s=="string"?(...l)=>new Promise(g=>{u3({code:s,resolve:g,args:l})}):o==="get"&&typeof s=="object"&&s!==null?I:c})},I3=(e,t)=>{let{user_id:A,page_id:i,site_id:n}=e;return kA.event=t,Ce.offline?new Promise(async r=>{r();let o="editor_start",s=await g3(o);t[o]&&t[o](s)}):new Promise((r,o)=>{if(!kA.ws){let s=0,a=()=>{let c=new URL(Ce.basehost||location.href);c.pathname="/sync",c.protocol=c.protocol==="http:"?"ws:":"wss:";let I=new WebSocket(`${c.protocol}//${c.host}${c.pathname}`);I.onopen=()=>{oy(I,{type:1,user_id:A,site_id:n,page_id:i}),kA.ws=I,t.opened()},I.onclose=async()=>{t.disconnected().reconnect?setTimeout(async()=>{s++,a()},s*ps.reconnectTimeout):o()},I.onmessage=async l=>{let g=l.data,u=ry.unpack(Buffer.from(await g.arrayBuffer()));if(ps.debug&&console.log("%c\u2B07","color:red",ay(g.size,0),u),u.type===0)kA.client_id=u.client_id,t.shakehand(u.client_id),r();else if(u.type===2){let f=u.event;t[f]&&(c3.includes(f)&&l3(f,u.data),t[f](u.data))}else if(u.type===4){let f=Pf.action.pending[u.argid];if(f){f.resolve(u.val),delete Pf.action.pending[u.argid];let C=kA.idb;C&&await ds(u.argid,u.val,C)}}}};a()}})},c3=["editor_start"],l3=async(e,t)=>{let A=kA.idb;if(A){let i=await XI(`ev-${e}`);await ds(i,t,A)}},g3=async e=>{let t=kA.idb;if(t){let A=await XI(`ev-${e}`);return await Er(A,t)}},u3=async e=>{let{args:t,code:A,resolve:i}=e,n=kA.ws,r=kA.idb;if(r){let o=ty(t),s=iy[A],a=await XI(`op-${s}-${o}`);if(n&&n.readyState===n.OPEN)Pf.action.pending[a]={ts:Date.now(),resolve:i},oy(n,{type:3,code:A,args:t,argid:a});else{let c=await Er(a,r);i(c)}}};function ay(e,t){if(e==0)return"0 Bytes";var A=1024,i=t||2,n=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],r=Math.floor(Math.log(e)/Math.log(A));return parseFloat((e/Math.pow(A,r)).toFixed(i))+" "+n[r]}var yr={NORMAL:0,WILDCARD:1,PLACEHOLDER:2};function wr(e={}){let t={options:e,rootNode:cy(),staticRoutesMap:{}},A=i=>e.strictTrailingSlash?i:i.replace(/\/$/,"")||"/";if(e.routes)for(let i in e.routes)Iy(t,A(i),e.routes[i]);return{ctx:t,lookup:i=>f3(t,A(i)),insert:(i,n)=>Iy(t,A(i),n),remove:i=>B3(t,A(i))}}function f3(e,t){let A=e.staticRoutesMap[t];if(A)return A.data;let i=t.split("/"),n={},r=!1,o=null,s=e.rootNode,a=null;for(let c=0;c{},db:null,api:null,init_local_effect:{}},page:{history:{id:"",show:!1},root_id:"root",cur:C3,doc:null,list:{},building:!1,meta:{},entry:[],tree:[],render:()=>{}},comp:{doc:null,item:null,loaded:{},list:{},group:{}},code:{},global_prop:[],ui:{comp_editable:localStorage.getItem("prasi-comp-editable")==="yes",zoom:localStorage.zoom||"100%",side:{prop:!0},layout:{left:parseInt(localStorage.getItem("prasi-layout-left")||"250"),right:parseInt(localStorage.getItem("prasi-layout-right")||"250")},prevent_indent_hook:!1,syncing:!1,tree:{item_loading:[],search:"",search_ref:null,search_mode:{Name:!0,JS:!1,HTML:!1,CSS:!1},rename_id:"",open:{}},popup:{file:{enabled:!1,open:!1,picker:{value:"",on_pick:!1,multi:!1},path:"/",expanded:JSON.parse(localStorage.getItem("panel-file-expanded")||"{}"),entry:{},selected:new Set,action:null,file_renaming:"",file_ctx_menu_event:null,tree:[],tree_renaming:"",tree_ctx_path:"",tree_ctx_menu_event:null,preview:!0,upload:{started:!1,progress:{}}},code:{init:!1,open:!1,name:"site",log:"",loading:!1,startup_status:"init",error:!1,show_log:!1,list:{}},page:{open:null,form:null},script:{open:!1,mode:"js",lastMode:"js",type:"item",prop_kind:"",prop_name:"",on_close:()=>{},typings:{status:"ok",err_msg:""},wb_render:()=>{}},site:null,site_form:null,comp:{preview_id:"",open:null,import:!1},comp_group:null,api:{open:!1}}}};var hy=K(oc());var py=e=>{let{item:t,item_comp:A,ids:i}=e,n=QA(A);if(Ey(n,i),t.id&&(n.id=t.id),n.component){if(n.component.props&&t.component)for(let r of Object.keys(n.component.props)){let o=t.component.props[r],s=n.component.props[r];o&&(s.value=o.value,s.valueBuilt=o.valueBuilt,s.jsxCalledBy=o.jsxCalledBy,s.content=o.content)}n.component.instances=t.component?.instances,n.component.style=t.component?.style}for(let r of Object.keys(t))delete t[r];for(let[r,o]of Object.entries(n))t[r]=o},Ey=(e,t)=>{if(e.originalId=e.id,t[e.id]||(t[e.id]=(0,hy.createId)()),e.id=t[e.id],e.childs)for(let A of e.childs)Ey(A,t)};var my=e=>{for(let[t,A]of Object.entries(e.item_comp.component?.props||{})){let i=QA(A),n=e.item.component?.props;n&&n[t]&&(i.value=n[t].value,i.valueBuilt=n[t].valueBuilt,n[t].content&&(i.content=n[t].content)),i&&e.each(t,i)}};var sc=e=>{let t={};for(let[A,i]of Object.entries(e))if(A==="childs"){if(t.childs=[],i&&Array.isArray(i))for(let n of i)t.childs.push({id:n.id})}else t[A]=i;return t};var yy=(e,t)=>{let{item:A}=t;if(A.type==="item"&&A.component?.id&&t.parent?.item.id){let i=e.comps[A.component.id];if(e.on?.visit_component&&e.on.visit_component(A,t.root||t.item),!i)return;if(i){let n;if(e.mode==="page"?(A.component.instances||(A.component.instances={}),n=A.component.instances):n=t.parent?.root_instances,n){let o=n[A.id];n[A.id]||(n[A.id]={},o=n[A.id]),py({item:A,item_comp:i,ids:o})}let r={item:sc(A),jsx_prop:t.jsx_prop,parent:{id:t.parent.item.id,comp_id:t.parent?.comp?.component?.id,instance_id:t.parent?.instance_id},instances:n};e.on?.visit&&e.on.visit(r,A,t.root||t.item),A.id&&e.set_meta!==!1&&(e.meta[A.id]=r),my({item:A,item_comp:i,instance:n?n[A.id]:{},each(o,s){let a=A.component?.id;s.meta?.type==="content-element"&&a&&s.content&&(s.content.name=o,vt({...e,mode:"comp"},{item:s.content,root:t.root||s.content,is_root:!1,jsx_prop:{is_root:!0,comp_id:a,name:o},parent:{item:r.item,instance_id:A.id,comp:i,root_instances:n}}))}});for(let o of Object.values(A.childs))o.name.startsWith("jsx:")||vt({...e,mode:"comp"},{item:o,is_root:!1,root:t.root||t.item,parent:{item:A,instance_id:A.id,root_instances:n,comp:i}})}}};var vt=(e,t)=>{let A=t.item;if(A.type==="item"&&A.component?.id&&t.ignore_first_component!==!0){yy(e,t);return}let i={item:sc(A),parent:{id:t.parent?.item.id||"root",instance_id:t.parent?.instance_id,comp_id:t.parent?.comp?.component?.id}};if(t.jsx_prop&&(i.jsx_prop=t.jsx_prop),e.on?.visit&&e.on.visit(i,A,t.root||t.item),A.id&&e.set_meta!==!1&&(e.meta[i.item.id]=i),A.childs){for(let[n,r]of Object.entries(A.childs))if(r.id){let o={item:r,is_root:!1,root:t.root||t.item,parent:{item:i.item,instance_id:t.parent?.instance_id,comp:t.parent?.comp,root_instances:t.parent?.root_instances}};t.jsx_prop&&(o.jsx_prop={...t.jsx_prop,is_root:!1}),vt(e,o)}}};var ac=async(e,t,A,i)=>{let n=new Set,r={root:t};if(vt({...e,on:{visit_component:({component:o})=>{if(o){let{id:s}=o;if(e.comps[s]||(!i||i&&!i.has(s))&&n.add(s),o?.props)for(let[a,c]of Object.entries(o.props))c.meta?.type==="content-element"&&c.content&&vt({...e,on:{visit_component:({component:I})=>{if(I){let{id:l}=I;e.comps[l]||(!i||i&&!i.has(l))&&n.add(l)}},visit(I,l){A.visit&&A.visit(I,l,r)}},set_meta:!1,note:"init-load-comp-prop"},{item:c.content})}},visit(o,s){A.visit&&A.visit(o,s,r)}},set_meta:!1,note:"init-load-comp"},{item:t,ignore_first_component:!0}),A.done&&A.done(r),n.size>0){await A.load([...n]);let o=i;o||(o=new Set),n.forEach(s=>{o&&o.add(s)});for(let s of[...o]){let a=e.comps[s];a&&await ac(e,a,A,o)}}};var k3=Bs("prasi-cache","prasi-cache-store"),pn={timeout:null,store:k3},Ic=(e,t)=>{let A=[...wy(t,"navigate(",")"),...wy(t,"href = ",";")],i=e.page.cur.id;e.page.navs[i]||(e.page.navs[i]=new Set);for(let n of A)e.page.navs[i].add(n);clearTimeout(pn.timeout),pn.timeout=setTimeout(()=>{e.on_nav_loaded&&e.on_nav_loaded({urls:Array.from(e.page.navs[i])})},100)},wy=(e,t,A)=>{let i=0,n=0,r=[];for(;;){let o=e.indexOf(t,i);if(n=i,o>=0){let s=e[o+t.length];if(s==='"'||s==="'"||s==="`"){let a=e.indexOf(`${s}${A}`,o+t.length+1),c=e.substring(o+t.length+1,a);i=a+2+A.length,r.push(c)}}if(n===i)break}return r};var Dy=K(oc());var cc=()=>{let e=document.activeElement;return!!(e&&e.attributes.getNamedItem("contenteditable"))};var Fy=K(oc()),lc=e=>{let{m:t,root:A,mitem:i,meta:n}=e;if(t.jsx_prop&&t.parent?.instance_id){let r=n[t.parent?.instance_id];if(r&&t.jsx_prop.is_root){let o=r.item.component?.props[t.jsx_prop.name];o&&(o.content=t.item)}}if(t.parent)if(t.parent.id==="root")t.item.id===A.id&&(t.mitem=i);else{let r=n[t.parent.id];if(r.mitem)if(t.jsx_prop?.is_root===!0){let o=r.mitem.get("component")?.get("props");if(o){let s=o.get(t.jsx_prop.name);if(s){let a=s.get("content");if(!a){let c=new Y.Map;syncronize(c,{id:(0,Fy.createId)(),name:t.jsx_prop.name,type:"item",dim:{w:"full",h:"full"},childs:[],adv:{css:""}}),s.set("content",c)}a&&(t.mitem=a)}}}else r.mitem.get("childs")?.forEach(o=>{o&&o.get&&o.get("id")===t.item.id&&(t.mitem=o)});if(t.item.component?.props)for(let[o,s]of Object.entries(t.item.component.props)){let a=t.mitem?.get("component")?.get("props")?.get(o);if(!a){let c=t.mitem?.get("component")?.get("props");c&&e.new_prop_jsx(t,c,o,s)}if(s.content)if(a){let c=n[s.content.id];c&&(c.mitem=a.get("content"))}else{let c=t.mitem?.get("component")?.get("props");c&&e.new_prop_jsx(t,c,o,s)}}}};var gc=(e,t,A,i)=>{if(t.parent?.id==="root")e.page.doc?.getMap("map").get("root")?.get("childs")?.forEach(n=>{n.get("id")===t.item.id&&(t.mitem=n)});else{let n=A[t.parent?.id||""];n&&n.mitem&&n.mitem.get("childs")?.forEach(r=>{r&&r.get&&r.get("id")===t.item.id&&(t.mitem=r)})}if(!t.item||!t.item.id)return console.warn("Emptry Tree Item ",t),null;if(i.find(n=>n.id===t.item.id))console.warn("Double Tree Item: ",t.item.id,t.item.name);else if(!t.parent?.comp_id)i.push({id:t.item.id,parent:t.parent?.id||"root",text:t.item.name,data:t});else if(t.jsx_prop)if(t.jsx_prop.is_root)t.jsx_prop.name!=="child"&&i.push({id:t.item.id,parent:t.parent?.instance_id||"root",text:t.jsx_prop.name,data:t});else{if(t.jsx_prop.name==="child"&&t.parent.instance_id){let n=A[t.parent.instance_id],r=n.item.component?.props.child.content?.id;r&&n.mitem&&A[r].item.childs.find(s=>t.item.id===s.id)&&i.push({id:t.item.id,parent:t.parent?.instance_id||"root",text:t.item.name,data:t})}t.parent.id!==t.parent.instance_id&&i.push({id:t.item.id,parent:t.parent?.id||"root",text:t.item.name,data:t})}};var fc=async(e,t,A)=>{if(e.comp.list[t])return;let i=new Y.Doc;Y.applyUpdate(i,Et(A));let n=i.getMap("map").get("root");if(n){e.comp.loaded[t]=n.toJSON(),typeof e.comp.list[t]?.on_update=="function"&&i.off("update",e.comp.list[t].on_update);let r=await uc(e,i,t);if(r){let{meta:o,tree:s}=r;e.comp.list[t]?(e.comp.list[t].meta=o,e.comp.list[t].tree=s):(e.comp.list[t]={comp:{id:t,snapshot:A},doc:i,meta:o,tree:s,async on_update(a,c){if(c==="sv_remote"||c==="local")return;let I=await e.sync?.yjs.sv_local("comp",t,Buffer.from(rA(a)));if(I){let l=Y.encodeStateAsUpdate(i,Et(I.sv));Y.applyUpdate(i,Et(I.diff),"local"),await e.sync?.yjs.diff_local("comp",t,Buffer.from(rA(l)));let g=await uc(e,e.comp.list[t].doc,t);if(g&&(e.comp.list[t].meta=g.meta,e.comp.list[t].tree=g.tree),e.comp.loaded[t]=i.getMap("map").get("root")?.toJSON(),cc())return;IA(e),e.render()}}},i.on("update",e.comp.list[t].on_update))}}},uc=async(e,t,A)=>{let i=t.getMap("map").get("root");if(!i)return;let n={},r=[],o=i.toJSON();return e.comp.loaded[A]=o,await ac({comps:e.comp.loaded,meta:n,set_meta:!1,mode:"comp"},o,{load:async s=>{let a=s.filter(I=>!e.comp.loaded[I]),c=await e.sync?.comp.load(a,!0);if(c){let I=Object.entries(c);for(let[l,g]of I)g&&g.snapshot&&!e.comp.list[l]&&await fc(e,l,g.snapshot)}}}),vt({comps:e.comp.loaded,meta:n,mode:"comp",on:{async visit(s){gc(e,s,n,r),lc({m:s,root:o,mitem:i,meta:n,new_prop_jsx(a,c,I,l){_f.list.push(()=>{let g=new Y.Map;l.content&&(l.content.id=(0,Dy.createId)()),syncronize(g,l),c.set(I,g)})}})}},note:"load-comp-scan-meta"},{item:o,ignore_first_component:!0}),_f.list.length>0&&e.page.doc?.transact(()=>{for(let s of _f.list)s()}),e.comp.loaded[A]=o,{meta:n,tree:r,item:o}},_f={list:[]};var IA=async(e,t)=>{if(document.activeElement){let o=document.activeElement;if(o.tagName==="DIV"&&o.getAttribute("contenteditable")==="true")return}rc.should_render_main=!0;let A=e.site.layout&&e.site.layout.id===e.page.cur.id&&t?.note==="load-layout page-init";console.log("component loading",e.comp.list,e.comp.loaded);for(let[o,s]of Object.entries(e.comp.list))if(!e.comp.loaded[o]){let c=s.doc.getMap("map").get("root")?.toJSON();c&&(e.comp.loaded[o]=c)}let i=e.page.doc?.getMap("map").get("root"),n=[];i?.get("childs")?.forEach(o=>n.push(o));let r={};e.page.tree=[];for(let o of n){let s=o.toJSON();s&&vt({note:"tree-rebuild",comps:e.comp.loaded,meta:r,mode:"page",on:{async visit(a){A||((a.parent?.instance_id!==a.parent?.id||a.jsx_prop)&&gc(e,a,r,e.page.tree),lc({m:a,root:s,mitem:o,meta:r,new_prop_jsx(c,I,l,g){if(!I.get(l)){let u=new Y.Map;syncronize(u,g),I.set(l,u)}}}))}}},{item:s})}if(A)e.site.layout.meta=r;else{let o="root";if(e.site.layout&&e.site.layout.meta){for(let[s,a]of Object.entries(e.site.layout.meta))if(a.item.name==="content"){o=a.item.id;break}e.page.root_id=o}if(e.site.layout&&e.site.layout.id===e.page.cur.id)e.page.meta=r;else if(o!=="root"){for(let s of Object.values(r))s.parent?.id==="root"&&(s.parent.id=o);e.page.meta={...e.site.layout.meta,...r}}else e.page.meta=r}};function ys(e,t){return function(){return e.apply(t,arguments)}}var{toString:S3}=Object.prototype,{getPrototypeOf:Zf}=Object,dc=(e=>t=>{let A=S3.call(t);return e[A]||(e[A]=A.slice(8,-1).toLowerCase())})(Object.create(null)),SA=e=>(e=e.toLowerCase(),t=>dc(t)===e),Cc=e=>t=>typeof t===e,{isArray:Fr}=Array,ws=Cc("undefined");function U3(e){return e!==null&&!ws(e)&&e.constructor!==null&&!ws(e.constructor)&&_t(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var Uy=SA("ArrayBuffer");function N3(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Uy(e.buffer),t}var x3=Cc("string"),_t=Cc("function"),Ny=Cc("number"),Qc=e=>e!==null&&typeof e=="object",G3=e=>e===!0||e===!1,Bc=e=>{if(dc(e)!=="object")return!1;let t=Zf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},H3=SA("Date"),M3=SA("File"),v3=SA("Blob"),R3=SA("FileList"),J3=e=>Qc(e)&&_t(e.pipe),q3=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||_t(e.append)&&((t=dc(e))==="formdata"||t==="object"&&_t(e.toString)&&e.toString()==="[object FormData]"))},K3=SA("URLSearchParams"),b3=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Fs(e,t,{allOwnKeys:A=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),Fr(e))for(i=0,n=e.length;i0;)if(n=A[i],t===n.toLowerCase())return n;return null}var Gy=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Hy=e=>!ws(e)&&e!==Gy;function Xf(){let{caseless:e}=Hy(this)&&this||{},t={},A=(i,n)=>{let r=e&&xy(t,n)||n;Bc(t[r])&&Bc(i)?t[r]=Xf(t[r],i):Bc(i)?t[r]=Xf({},i):Fr(i)?t[r]=i.slice():t[r]=i};for(let i=0,n=arguments.length;i(Fs(t,(n,r)=>{A&&_t(n)?e[r]=ys(n,A):e[r]=n},{allOwnKeys:i}),e),L3=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Y3=(e,t,A,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),A&&Object.assign(e.prototype,A)},P3=(e,t,A,i)=>{let n,r,o,s={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),r=n.length;r-- >0;)o=n[r],(!i||i(o,e,t))&&!s[o]&&(t[o]=e[o],s[o]=!0);e=A!==!1&&Zf(e)}while(e&&(!A||A(e,t))&&e!==Object.prototype);return t},V3=(e,t,A)=>{e=String(e),(A===void 0||A>e.length)&&(A=e.length),A-=t.length;let i=e.indexOf(t,A);return i!==-1&&i===A},z3=e=>{if(!e)return null;if(Fr(e))return e;let t=e.length;if(!Ny(t))return null;let A=new Array(t);for(;t-- >0;)A[t]=e[t];return A},_3=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Zf(Uint8Array)),T3=(e,t)=>{let i=(e&&e[Symbol.iterator]).call(e),n;for(;(n=i.next())&&!n.done;){let r=n.value;t.call(e,r[0],r[1])}},X3=(e,t)=>{let A,i=[];for(;(A=e.exec(t))!==null;)i.push(A);return i},Z3=SA("HTMLFormElement"),W3=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(A,i,n){return i.toUpperCase()+n}),ky=(({hasOwnProperty:e})=>(t,A)=>e.call(t,A))(Object.prototype),j3=SA("RegExp"),My=(e,t)=>{let A=Object.getOwnPropertyDescriptors(e),i={};Fs(A,(n,r)=>{let o;(o=t(n,r,e))!==!1&&(i[r]=o||n)}),Object.defineProperties(e,i)},$3=e=>{My(e,(t,A)=>{if(_t(e)&&["arguments","caller","callee"].indexOf(A)!==-1)return!1;let i=e[A];if(_t(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+A+"'")})}})},ex=(e,t)=>{let A={},i=n=>{n.forEach(r=>{A[r]=!0})};return Fr(e)?i(e):i(String(e).split(t)),A},tx=()=>{},Ax=(e,t)=>(e=+e,Number.isFinite(e)?e:t),Tf="abcdefghijklmnopqrstuvwxyz",Sy="0123456789",vy={DIGIT:Sy,ALPHA:Tf,ALPHA_DIGIT:Tf+Tf.toUpperCase()+Sy},ix=(e=16,t=vy.ALPHA_DIGIT)=>{let A="",{length:i}=t;for(;e--;)A+=t[Math.random()*i|0];return A};function nx(e){return!!(e&&_t(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var rx=e=>{let t=new Array(10),A=(i,n)=>{if(Qc(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let r=Fr(i)?[]:{};return Fs(i,(o,s)=>{let a=A(o,n+1);!ws(a)&&(r[s]=a)}),t[n]=void 0,r}}return i};return A(e,0)},ox=SA("AsyncFunction"),sx=e=>e&&(Qc(e)||_t(e))&&_t(e.then)&&_t(e.catch),w={isArray:Fr,isArrayBuffer:Uy,isBuffer:U3,isFormData:q3,isArrayBufferView:N3,isString:x3,isNumber:Ny,isBoolean:G3,isObject:Qc,isPlainObject:Bc,isUndefined:ws,isDate:H3,isFile:M3,isBlob:v3,isRegExp:j3,isFunction:_t,isStream:J3,isURLSearchParams:K3,isTypedArray:_3,isFileList:R3,forEach:Fs,merge:Xf,extend:O3,trim:b3,stripBOM:L3,inherits:Y3,toFlatObject:P3,kindOf:dc,kindOfTest:SA,endsWith:V3,toArray:z3,forEachEntry:T3,matchAll:X3,isHTMLForm:Z3,hasOwnProperty:ky,hasOwnProp:ky,reduceDescriptors:My,freezeMethods:$3,toObjectSet:ex,toCamelCase:W3,noop:tx,toFiniteNumber:Ax,findKey:xy,global:Gy,isContextDefined:Hy,ALPHABET:vy,generateString:ix,isSpecCompliantForm:nx,toJSONObject:rx,isAsyncFn:ox,isThenable:sx};function Dr(e,t,A,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),A&&(this.config=A),i&&(this.request=i),n&&(this.response=n)}w.inherits(Dr,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:w.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var Ry=Dr.prototype,Jy={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Jy[e]={value:e}});Object.defineProperties(Dr,Jy);Object.defineProperty(Ry,"isAxiosError",{value:!0});Dr.from=(e,t,A,i,n,r)=>{let o=Object.create(Ry);return w.toFlatObject(e,o,function(a){return a!==Error.prototype},s=>s!=="isAxiosError"),Dr.call(o,e.message,t,A,i,n),o.cause=e,o.name=e.name,r&&Object.assign(o,r),o};var j=Dr;var hc=null;function Wf(e){return w.isPlainObject(e)||w.isArray(e)}function Ky(e){return w.endsWith(e,"[]")?e.slice(0,-2):e}function qy(e,t,A){return e?e.concat(t).map(function(n,r){return n=Ky(n),!A&&r?"["+n+"]":n}).join(A?".":""):t}function ax(e){return w.isArray(e)&&!e.some(Wf)}var Ix=w.toFlatObject(w,{},null,function(t){return/^is[A-Z]/.test(t)});function lx(e,t,A){if(!w.isObject(e))throw new TypeError("target must be an object");t=t||new(hc||FormData),A=w.toFlatObject(A,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,F){return!w.isUndefined(F[C])});let i=A.metaTokens,n=A.visitor||I,r=A.dots,o=A.indexes,a=(A.Blob||typeof Blob<"u"&&Blob)&&w.isSpecCompliantForm(t);if(!w.isFunction(n))throw new TypeError("visitor must be a function");function c(f){if(f===null)return"";if(w.isDate(f))return f.toISOString();if(!a&&w.isBlob(f))throw new j("Blob is not supported. Use a Buffer instead.");return w.isArrayBuffer(f)||w.isTypedArray(f)?a&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function I(f,C,F){let d=f;if(f&&!F&&typeof f=="object"){if(w.endsWith(C,"{}"))C=i?C:C.slice(0,-2),f=JSON.stringify(f);else if(w.isArray(f)&&ax(f)||(w.isFileList(f)||w.endsWith(C,"[]"))&&(d=w.toArray(f)))return C=Ky(C),d.forEach(function(Q,y){!(w.isUndefined(Q)||Q===null)&&t.append(o===!0?qy([C],y,r):o===null?C:C+"[]",c(Q))}),!1}return Wf(f)?!0:(t.append(qy(F,C,r),c(f)),!1)}let l=[],g=Object.assign(Ix,{defaultVisitor:I,convertValue:c,isVisitable:Wf});function u(f,C){if(!w.isUndefined(f)){if(l.indexOf(f)!==-1)throw Error("Circular reference detected in "+C.join("."));l.push(f),w.forEach(f,function(d,B){(!(w.isUndefined(d)||d===null)&&n.call(t,d,w.isString(B)?B.trim():B,C,g))===!0&&u(d,C?C.concat(B):[B])}),l.pop()}}if(!w.isObject(e))throw new TypeError("data must be an object");return u(e),t}var vi=lx;function by(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function Oy(e,t){this._pairs=[],e&&vi(e,this,t)}var Ly=Oy.prototype;Ly.append=function(t,A){this._pairs.push([t,A])};Ly.toString=function(t){let A=t?function(i){return t.call(this,i,by)}:by;return this._pairs.map(function(n){return A(n[0])+"="+A(n[1])},"").join("&")};var pc=Oy;function gx(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Ds(e,t,A){if(!t)return e;let i=A&&A.encode||gx,n=A&&A.serialize,r;if(n?r=n(t,A):r=w.isURLSearchParams(t)?t.toString():new pc(t,A).toString(i),r){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+r}return e}var jf=class{constructor(){this.handlers=[]}use(t,A,i){return this.handlers.push({fulfilled:t,rejected:A,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){w.forEach(this.handlers,function(i){i!==null&&t(i)})}},$f=jf;var Ec={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Yy=typeof URLSearchParams<"u"?URLSearchParams:pc;var Py=typeof FormData<"u"?FormData:null;var Vy=typeof Blob<"u"?Blob:null;var zy={isBrowser:!0,classes:{URLSearchParams:Yy,FormData:Py,Blob:Vy},protocols:["http","https","file","blob","url","data"]};var eB={};Y0(eB,{hasBrowserEnv:()=>_y,hasStandardBrowserEnv:()=>ux,hasStandardBrowserWebWorkerEnv:()=>fx});var _y=typeof window<"u"&&typeof document<"u",ux=(e=>_y&&["ReactNative","NativeScript","NS"].indexOf(e)<0)(typeof navigator<"u"&&navigator.product),fx=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function";var ut={...eB,...zy};function tB(e,t){return vi(e,new ut.classes.URLSearchParams,Object.assign({visitor:function(A,i,n,r){return ut.isNode&&w.isBuffer(A)?(this.append(i,A.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}function Bx(e){return w.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function dx(e){let t={},A=Object.keys(e),i,n=A.length,r;for(i=0;i=A.length;return o=!o&&w.isArray(n)?n.length:o,a?(w.hasOwnProp(n,o)?n[o]=[n[o],i]:n[o]=i,!s):((!n[o]||!w.isObject(n[o]))&&(n[o]=[]),t(A,i,n[o],r)&&w.isArray(n[o])&&(n[o]=dx(n[o])),!s)}if(w.isFormData(e)&&w.isFunction(e.entries)){let A={};return w.forEachEntry(e,(i,n)=>{t(Bx(i),n,A,0)}),A}return null}var mc=Cx;function Qx(e,t,A){if(w.isString(e))try{return(t||JSON.parse)(e),w.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(A||JSON.stringify)(e)}var AB={transitional:Ec,adapter:["xhr","http"],transformRequest:[function(t,A){let i=A.getContentType()||"",n=i.indexOf("application/json")>-1,r=w.isObject(t);if(r&&w.isHTMLForm(t)&&(t=new FormData(t)),w.isFormData(t))return n?JSON.stringify(mc(t)):t;if(w.isArrayBuffer(t)||w.isBuffer(t)||w.isStream(t)||w.isFile(t)||w.isBlob(t))return t;if(w.isArrayBufferView(t))return t.buffer;if(w.isURLSearchParams(t))return A.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let s;if(r){if(i.indexOf("application/x-www-form-urlencoded")>-1)return tB(t,this.formSerializer).toString();if((s=w.isFileList(t))||i.indexOf("multipart/form-data")>-1){let a=this.env&&this.env.FormData;return vi(s?{"files[]":t}:t,a&&new a,this.formSerializer)}}return r||n?(A.setContentType("application/json",!1),Qx(t)):t}],transformResponse:[function(t){let A=this.transitional||AB.transitional,i=A&&A.forcedJSONParsing,n=this.responseType==="json";if(t&&w.isString(t)&&(i&&!this.responseType||n)){let o=!(A&&A.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(s){if(o)throw s.name==="SyntaxError"?j.from(s,j.ERR_BAD_RESPONSE,this,null,this.response):s}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ut.classes.FormData,Blob:ut.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};w.forEach(["delete","get","head","post","put","patch"],e=>{AB.headers[e]={}});var kr=AB;var hx=w.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ty=e=>{let t={},A,i,n;return e&&e.split(` `).forEach(function(o){n=o.indexOf(":"),A=o.substring(0,n).trim().toLowerCase(),i=o.substring(n+1).trim(),!(!A||t[A]&&hx[A])&&(A==="set-cookie"?t[A]?t[A].push(i):t[A]=[i]:t[A]=t[A]?t[A]+", "+i:i)}),t};var Xy=Symbol("internals");function ks(e){return e&&String(e).trim().toLowerCase()}function yc(e){return e===!1||e==null?e:w.isArray(e)?e.map(yc):String(e)}function px(e){let t=Object.create(null),A=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,i;for(;i=A.exec(e);)t[i[1]]=i[2];return t}var Ex=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function iB(e,t,A,i,n){if(w.isFunction(i))return i.call(this,t,A);if(n&&(t=A),!!w.isString(t)){if(w.isString(i))return t.indexOf(i)!==-1;if(w.isRegExp(i))return i.test(t)}}function mx(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,A,i)=>A.toUpperCase()+i)}function yx(e,t){let A=w.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+A,{value:function(n,r,o){return this[i].call(this,t,n,r,o)},configurable:!0})})}var Sr=class{constructor(t){t&&this.set(t)}set(t,A,i){let n=this;function r(s,a,c){let I=ks(a);if(!I)throw new Error("header name must be a non-empty string");let l=w.findKey(n,I);(!l||n[l]===void 0||c===!0||c===void 0&&n[l]!==!1)&&(n[l||a]=yc(s))}let o=(s,a)=>w.forEach(s,(c,I)=>r(c,I,a));return w.isPlainObject(t)||t instanceof this.constructor?o(t,A):w.isString(t)&&(t=t.trim())&&!Ex(t)?o(Ty(t),A):t!=null&&r(A,t,i),this}get(t,A){if(t=ks(t),t){let i=w.findKey(this,t);if(i){let n=this[i];if(!A)return n;if(A===!0)return px(n);if(w.isFunction(A))return A.call(this,n,i);if(w.isRegExp(A))return A.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,A){if(t=ks(t),t){let i=w.findKey(this,t);return!!(i&&this[i]!==void 0&&(!A||iB(this,this[i],i,A)))}return!1}delete(t,A){let i=this,n=!1;function r(o){if(o=ks(o),o){let s=w.findKey(i,o);s&&(!A||iB(i,i[s],s,A))&&(delete i[s],n=!0)}}return w.isArray(t)?t.forEach(r):r(t),n}clear(t){let A=Object.keys(this),i=A.length,n=!1;for(;i--;){let r=A[i];(!t||iB(this,this[r],r,t,!0))&&(delete this[r],n=!0)}return n}normalize(t){let A=this,i={};return w.forEach(this,(n,r)=>{let o=w.findKey(i,r);if(o){A[o]=yc(n),delete A[r];return}let s=t?mx(r):String(r).trim();s!==r&&delete A[r],A[s]=yc(n),i[s]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let A=Object.create(null);return w.forEach(this,(i,n)=>{i!=null&&i!==!1&&(A[n]=t&&w.isArray(i)?i.join(", "):i)}),A}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,A])=>t+": "+A).join(` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...A){let i=new this(t);return A.forEach(n=>i.set(n)),i}static accessor(t){let i=(this[Xy]=this[Xy]={accessors:{}}).accessors,n=this.prototype;function r(o){let s=ks(o);i[s]||(yx(n,o),i[s]=!0)}return w.isArray(t)?t.forEach(r):r(t),this}};Sr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);w.reduceDescriptors(Sr.prototype,({value:e},t)=>{let A=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[A]=i}}});w.freezeMethods(Sr);var ft=Sr;function Ss(e,t){let A=this||kr,i=t||A,n=ft.from(i.headers),r=i.data;return w.forEach(e,function(s){r=s.call(A,r,n.normalize(),t?t.status:void 0)}),n.normalize(),r}function Us(e){return!!(e&&e.__CANCEL__)}function Zy(e,t,A){j.call(this,e??"canceled",j.ERR_CANCELED,t,A),this.name="CanceledError"}w.inherits(Zy,j,{__CANCEL__:!0});var Ri=Zy;function nB(e,t,A){let i=A.config.validateStatus;!A.status||!i||i(A.status)?e(A):t(new j("Request failed with status code "+A.status,[j.ERR_BAD_REQUEST,j.ERR_BAD_RESPONSE][Math.floor(A.status/100)-4],A.config,A.request,A))}var Wy=ut.hasStandardBrowserEnv?{write(e,t,A,i,n,r){let o=[e+"="+encodeURIComponent(t)];w.isNumber(A)&&o.push("expires="+new Date(A).toGMTString()),w.isString(i)&&o.push("path="+i),w.isString(n)&&o.push("domain="+n),r===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function rB(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function oB(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Ns(e,t){return e&&!rB(t)?oB(e,t):t}var jy=ut.hasStandardBrowserEnv?function(){let t=/(msie|trident)/i.test(navigator.userAgent),A=document.createElement("a"),i;function n(r){let o=r;return t&&(A.setAttribute("href",o),o=A.href),A.setAttribute("href",o),{href:A.href,protocol:A.protocol?A.protocol.replace(/:$/,""):"",host:A.host,search:A.search?A.search.replace(/^\?/,""):"",hash:A.hash?A.hash.replace(/^#/,""):"",hostname:A.hostname,port:A.port,pathname:A.pathname.charAt(0)==="/"?A.pathname:"/"+A.pathname}}return i=n(window.location.href),function(o){let s=w.isString(o)?n(o):o;return s.protocol===i.protocol&&s.host===i.host}}():function(){return function(){return!0}}();function sB(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function wx(e,t){e=e||10;let A=new Array(e),i=new Array(e),n=0,r=0,o;return t=t!==void 0?t:1e3,function(a){let c=Date.now(),I=i[r];o||(o=c),A[n]=a,i[n]=c;let l=r,g=0;for(;l!==n;)g+=A[l++],l=l%e;if(n=(n+1)%e,n===r&&(r=(r+1)%e),c-o{let r=n.loaded,o=n.lengthComputable?n.total:void 0,s=r-A,a=i(s),c=r<=o;A=r;let I={loaded:r,total:o,progress:o?r/o:void 0,bytes:s,rate:a||void 0,estimated:a&&o&&c?(o-r)/a:void 0,event:n};I[t?"download":"upload"]=!0,e(I)}}var Fx=typeof XMLHttpRequest<"u",tw=Fx&&function(e){return new Promise(function(A,i){let n=e.data,r=ft.from(e.headers).normalize(),{responseType:o,withXSRFToken:s}=e,a;function c(){e.cancelToken&&e.cancelToken.unsubscribe(a),e.signal&&e.signal.removeEventListener("abort",a)}let I;if(w.isFormData(n)){if(ut.hasStandardBrowserEnv||ut.hasStandardBrowserWebWorkerEnv)r.setContentType(!1);else if((I=r.getContentType())!==!1){let[C,...F]=I?I.split(";").map(d=>d.trim()).filter(Boolean):[];r.setContentType([C||"multipart/form-data",...F].join("; "))}}let l=new XMLHttpRequest;if(e.auth){let C=e.auth.username||"",F=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";r.set("Authorization","Basic "+btoa(C+":"+F))}let g=Ns(e.baseURL,e.url);l.open(e.method.toUpperCase(),Ds(g,e.params,e.paramsSerializer),!0),l.timeout=e.timeout;function u(){if(!l)return;let C=ft.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders()),d={data:!o||o==="text"||o==="json"?l.responseText:l.response,status:l.status,statusText:l.statusText,headers:C,config:e,request:l};nB(function(Q){A(Q),c()},function(Q){i(Q),c()},d),l=null}if("onloadend"in l?l.onloadend=u:l.onreadystatechange=function(){!l||l.readyState!==4||l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)||setTimeout(u)},l.onabort=function(){l&&(i(new j("Request aborted",j.ECONNABORTED,e,l)),l=null)},l.onerror=function(){i(new j("Network Error",j.ERR_NETWORK,e,l)),l=null},l.ontimeout=function(){let F=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",d=e.transitional||Ec;e.timeoutErrorMessage&&(F=e.timeoutErrorMessage),i(new j(F,d.clarifyTimeoutError?j.ETIMEDOUT:j.ECONNABORTED,e,l)),l=null},ut.hasStandardBrowserEnv&&(s&&w.isFunction(s)&&(s=s(e)),s||s!==!1&&jy(g))){let C=e.xsrfHeaderName&&e.xsrfCookieName&&Wy.read(e.xsrfCookieName);C&&r.set(e.xsrfHeaderName,C)}n===void 0&&r.setContentType(null),"setRequestHeader"in l&&w.forEach(r.toJSON(),function(F,d){l.setRequestHeader(d,F)}),w.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),o&&o!=="json"&&(l.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&l.addEventListener("progress",ew(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&l.upload&&l.upload.addEventListener("progress",ew(e.onUploadProgress)),(e.cancelToken||e.signal)&&(a=C=>{l&&(i(!C||C.type?new Ri(null,e,l):C),l.abort(),l=null)},e.cancelToken&&e.cancelToken.subscribe(a),e.signal&&(e.signal.aborted?a():e.signal.addEventListener("abort",a)));let f=sB(g);if(f&&ut.protocols.indexOf(f)===-1){i(new j("Unsupported protocol "+f+":",j.ERR_BAD_REQUEST,e));return}l.send(n||null)})};var aB={http:hc,xhr:tw};w.forEach(aB,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var Aw=e=>`- ${e}`,Dx=e=>w.isFunction(e)||e===null||e===!1,wc={getAdapter:e=>{e=w.isArray(e)?e:[e];let{length:t}=e,A,i,n={};for(let r=0;r`adapter ${s} `+(a===!1?"is not supported by the environment":"is not available in the build")),o=t?r.length>1?`since : `+r.map(Aw).join(` diff --git a/app/web/src/nova/ed/logic/tree/build.tsx b/app/web/src/nova/ed/logic/tree/build.tsx index 4e2952e5..32a79fbb 100644 --- a/app/web/src/nova/ed/logic/tree/build.tsx +++ b/app/web/src/nova/ed/logic/tree/build.tsx @@ -30,7 +30,7 @@ export const treeCacheBuild = async (p: PG, page_id: string) => { { async load(comp_ids) { if (!p.sync) return; - + const ids = comp_ids.filter((id) => !p.comp.loaded[id]); const comps = await p.sync.comp.load(ids, true); let result = Object.entries(comps); @@ -89,6 +89,7 @@ export const treeRebuild = async (p: PG, arg?: { note?: string }) => { p.site.layout.id === p.page.cur.id && arg?.note === "load-layout page-init"; + console.log("component loading", p.comp.list, p.comp.loaded); for (const [k, v] of Object.entries(p.comp.list)) { if (!p.comp.loaded[k]) { const mcomp = v.doc.getMap("map").get("root");