zion-mcp 2.8.5 → 2.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/{chunk-3YRJIY6Z.js → chunk-6KY3QITQ.js} +1 -1
- package/dist/{chunk-Z6O4HLQ5.js → chunk-CUEKSRNI.js} +1 -1
- package/dist/{chunk-5TW2RK7G.js → chunk-HXRQLPVQ.js} +1 -1
- package/dist/{chunk-MF4TNILC.js → chunk-VSTPZDYO.js} +1 -1
- package/dist/{chunk-CCPB2BTC.js → chunk-WRU7YLUO.js} +1 -1
- package/dist/{chunk-K7ILN5SX.js → chunk-ZGX656ZG.js} +1 -1
- package/dist/{cli-O6EFVNG4.js → cli-5M4LKU27.js} +182 -136
- package/dist/{corpus-DCO5BVFL.js → corpus-WPOJHLAU.js} +314 -4
- package/dist/{index.cjs-L7NZYXV4.js → index.cjs-G7QKQQEI.js} +1 -1
- package/dist/{json-crdt-3ENUDB3K.js → json-crdt-UTIMH7MN.js} +1 -1
- package/dist/{json-crdt-patch-JB23VTH5.js → json-crdt-patch-N5S5AUJ4.js} +1 -1
- package/dist/server.js +1 -1
- package/dist/{surface-32BFSGWV.js → surface-TGGCJZR5.js} +1 -1
- package/dist/{ztype-IGART53N.js → ztype-DHYCSI44.js} +116 -116
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Zion MCP Server 是 [FunctorZ (Zion)](https://functorz.com) 提供的官方 [Mod
|
|
|
20
20
|
4. 填写以下信息:
|
|
21
21
|
- **Name**: Zion MCP
|
|
22
22
|
- **Type**: command
|
|
23
|
-
- **Command**: `npx -y zion-mcp@2.8.
|
|
23
|
+
- **Command**: `npx -y zion-mcp@2.8.6`
|
|
24
24
|
5. 保存并重启 Cursor (如果需要)。
|
|
25
25
|
|
|
26
26
|
### 在 Claude Desktop 中使用
|
|
@@ -32,7 +32,7 @@ Zion MCP Server 是 [FunctorZ (Zion)](https://functorz.com) 提供的官方 [Mod
|
|
|
32
32
|
"mcpServers": {
|
|
33
33
|
"zion": {
|
|
34
34
|
"command": "npx",
|
|
35
|
-
"args": ["-y", "zion-mcp@2.8.
|
|
35
|
+
"args": ["-y", "zion-mcp@2.8.6"]
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __nodeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __nodeCreateRequire(import.meta.url);
|
|
3
|
-
import{d as ko,e as Un,h as Au,i as Su}from"./chunk-K7ILN5SX.js";import{c as N,d as Rs,e as Iu,g as u}from"./chunk-CCPB2BTC.js";var to=N(te=>{"use strict";u();Object.defineProperty(te,"__esModule",{value:!0});te.regexpCode=te.getEsmExportName=te.getProperty=te.safeStringify=te.stringify=te.strConcat=te.addCodeArg=te.str=te._=te.nil=te._Code=te.Name=te.IDENTIFIER=te._CodeOrName=void 0;var Qr=class{};te._CodeOrName=Qr;te.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var In=class extends Qr{constructor(e){if(super(),!te.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};te.Name=In;var tt=class extends Qr{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((n,r)=>`${n}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((n,r)=>(r instanceof In&&(n[r.str]=(n[r.str]||0)+1),n),{})}};te._Code=tt;te.nil=new tt("");function Sm(t,...e){let n=[t[0]],r=0;for(;r<e.length;)El(n,e[r]),n.push(t[++r]);return new tt(n)}te._=Sm;var yl=new tt("+");function Om(t,...e){let n=[eo(t[0])],r=0;for(;r<e.length;)n.push(yl),El(n,e[r]),n.push(yl,eo(t[++r]));return Ev(n),new tt(n)}te.str=Om;function El(t,e){e instanceof tt?t.push(...e._items):e instanceof In?t.push(e):t.push(wv(e))}te.addCodeArg=El;function Ev(t){let e=1;for(;e<t.length-1;){if(t[e]===yl){let n=Tv(t[e-1],t[e+1]);if(n!==void 0){t.splice(e-1,3,n);continue}t[e++]="+"}e++}}function Tv(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof In||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof In))return`"${t}${e.slice(1)}`}function bv(t,e){return e.emptyStr()?t:t.emptyStr()?e:Om`${t}${e}`}te.strConcat=bv;function wv(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:eo(Array.isArray(t)?t.join(","):t)}function vv(t){return new tt(eo(t))}te.stringify=vv;function eo(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}te.safeStringify=eo;function Iv(t){return typeof t=="string"&&te.IDENTIFIER.test(t)?new tt(`.${t}`):Sm`[${t}]`}te.getProperty=Iv;function Av(t){if(typeof t=="string"&&te.IDENTIFIER.test(t))return new tt(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}te.getEsmExportName=Av;function Sv(t){return new tt(t.toString())}te.regexpCode=Sv});var wl=N(Ze=>{"use strict";u();Object.defineProperty(Ze,"__esModule",{value:!0});Ze.ValueScope=Ze.ValueScopeName=Ze.Scope=Ze.varKinds=Ze.UsedValueState=void 0;var Ge=to(),Tl=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Ma;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Ma||(Ze.UsedValueState=Ma={}));Ze.varKinds={const:new Ge.Name("const"),let:new Ge.Name("let"),var:new Ge.Name("var")};var za=class{constructor({prefixes:e,parent:n}={}){this._names={},this._prefixes=e,this._parent=n}toName(e){return e instanceof Ge.Name?e:this.name(e)}name(e){return new Ge.Name(this._newName(e))}_newName(e){let n=this._names[e]||this._nameGroup(e);return`${e}${n.index++}`}_nameGroup(e){var n,r;if(!((r=(n=this._parent)===null||n===void 0?void 0:n._prefixes)===null||r===void 0)&&r.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Ze.Scope=za;var Ua=class extends Ge.Name{constructor(e,n){super(n),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,Ge._)`.${new Ge.Name(n)}[${r}]`}};Ze.ValueScopeName=Ua;var Ov=(0,Ge._)`\n`,bl=class extends za{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Ov:Ge.nil}}get(){return this._scope}name(e){return new Ua(e,this._newName(e))}value(e,n){var r;if(n.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:a}=o,s=(r=n.key)!==null&&r!==void 0?r:n.ref,i=this._values[a];if(i){let h=i.get(s);if(h)return h}else i=this._values[a]=new Map;i.set(s,o);let l=this._scope[a]||(this._scope[a]=[]),d=l.length;return l[d]=n.ref,o.setValue(n,{property:a,itemIndex:d}),o}getValue(e,n){let r=this._values[e];if(r)return r.get(n)}scopeRefs(e,n=this._values){return this._reduceValues(n,r=>{if(r.scopePath===void 0)throw new Error(`CodeGen: name "${r}" has no value`);return(0,Ge._)`${e}${r.scopePath}`})}scopeCode(e=this._values,n,r){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},n,r)}_reduceValues(e,n,r={},o){let a=Ge.nil;for(let s in e){let i=e[s];if(!i)continue;let l=r[s]=r[s]||new Map;i.forEach(d=>{if(l.has(d))return;l.set(d,Ma.Started);let h=n(d);if(h){let p=this.opts.es5?Ze.varKinds.var:Ze.varKinds.const;a=(0,Ge._)`${a}${p} ${d} = ${h};${this.opts._n}`}else if(h=o?.(d))a=(0,Ge._)`${a}${h}${this.opts._n}`;else throw new Tl(d);l.set(d,Ma.Completed)})}return a}};Ze.ValueScope=bl});var q=N(V=>{"use strict";u();Object.defineProperty(V,"__esModule",{value:!0});V.or=V.and=V.not=V.CodeGen=V.operators=V.varKinds=V.ValueScopeName=V.ValueScope=V.Scope=V.Name=V.regexpCode=V.stringify=V.getProperty=V.nil=V.strConcat=V.str=V._=void 0;var X=to(),lt=wl(),Bt=to();Object.defineProperty(V,"_",{enumerable:!0,get:function(){return Bt._}});Object.defineProperty(V,"str",{enumerable:!0,get:function(){return Bt.str}});Object.defineProperty(V,"strConcat",{enumerable:!0,get:function(){return Bt.strConcat}});Object.defineProperty(V,"nil",{enumerable:!0,get:function(){return Bt.nil}});Object.defineProperty(V,"getProperty",{enumerable:!0,get:function(){return Bt.getProperty}});Object.defineProperty(V,"stringify",{enumerable:!0,get:function(){return Bt.stringify}});Object.defineProperty(V,"regexpCode",{enumerable:!0,get:function(){return Bt.regexpCode}});Object.defineProperty(V,"Name",{enumerable:!0,get:function(){return Bt.Name}});var Za=wl();Object.defineProperty(V,"Scope",{enumerable:!0,get:function(){return Za.Scope}});Object.defineProperty(V,"ValueScope",{enumerable:!0,get:function(){return Za.ValueScope}});Object.defineProperty(V,"ValueScopeName",{enumerable:!0,get:function(){return Za.ValueScopeName}});Object.defineProperty(V,"varKinds",{enumerable:!0,get:function(){return Za.varKinds}});V.operators={GT:new X._Code(">"),GTE:new X._Code(">="),LT:new X._Code("<"),LTE:new X._Code("<="),EQ:new X._Code("==="),NEQ:new X._Code("!=="),NOT:new X._Code("!"),OR:new X._Code("||"),AND:new X._Code("&&"),ADD:new X._Code("+")};var Nt=class{optimizeNodes(){return this}optimizeNames(e,n){return this}},vl=class extends Nt{constructor(e,n,r){super(),this.varKind=e,this.name=n,this.rhs=r}render({es5:e,_n:n}){let r=e?lt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${o};`+n}optimizeNames(e,n){if(e[this.name.str])return this.rhs&&(this.rhs=ar(this.rhs,e,n)),this}get names(){return this.rhs instanceof X._CodeOrName?this.rhs.names:{}}},Fa=class extends Nt{constructor(e,n,r){super(),this.lhs=e,this.rhs=n,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof X.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=ar(this.rhs,e,n),this}get names(){let e=this.lhs instanceof X.Name?{}:{...this.lhs.names};return Ga(e,this.rhs)}},Il=class extends Fa{constructor(e,n,r,o){super(e,r,o),this.op=n}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Al=class extends Nt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Sl=class extends Nt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Ol=class extends Nt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Nl=class extends Nt{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,n){return this.code=ar(this.code,e,n),this}get names(){return this.code instanceof X._CodeOrName?this.code.names:{}}},no=class extends Nt{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((n,r)=>n+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,n=e.length;for(;n--;){let r=e[n].optimizeNodes();Array.isArray(r)?e.splice(n,1,...r):r?e[n]=r:e.splice(n,1)}return e.length>0?this:void 0}optimizeNames(e,n){let{nodes:r}=this,o=r.length;for(;o--;){let a=r[o];a.optimizeNames(e,n)||(Nv(e,a.names),r.splice(o,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,n)=>On(e,n.names),{})}},Pt=class extends no{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Pl=class extends no{},or=class extends Pt{};or.kind="else";var An=class t extends Pt{constructor(e,n){super(n),this.condition=e}render(e){let n=`if(${this.condition})`+super.render(e);return this.else&&(n+="else "+this.else.render(e)),n}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let n=this.else;if(n){let r=n.optimizeNodes();n=this.else=Array.isArray(r)?new or(r):r}if(n)return e===!1?n instanceof t?n:n.nodes:this.nodes.length?this:new t(Nm(e),n instanceof t?[n]:n.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,n){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,n),!!(super.optimizeNames(e,n)||this.else))return this.condition=ar(this.condition,e,n),this}get names(){let e=super.names;return Ga(e,this.condition),this.else&&On(e,this.else.names),e}};An.kind="if";var Sn=class extends Pt{};Sn.kind="for";var Cl=class extends Sn{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,n){if(super.optimizeNames(e,n))return this.iteration=ar(this.iteration,e,n),this}get names(){return On(super.names,this.iteration.names)}},Dl=class extends Sn{constructor(e,n,r,o){super(),this.varKind=e,this.name=n,this.from=r,this.to=o}render(e){let n=e.es5?lt.varKinds.var:this.varKind,{name:r,from:o,to:a}=this;return`for(${n} ${r}=${o}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){let e=Ga(super.names,this.from);return Ga(e,this.to)}},ja=class extends Sn{constructor(e,n,r,o){super(),this.loop=e,this.varKind=n,this.name=r,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,n){if(super.optimizeNames(e,n))return this.iterable=ar(this.iterable,e,n),this}get names(){return On(super.names,this.iterable.names)}},ro=class extends Pt{constructor(e,n,r){super(),this.name=e,this.args=n,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};ro.kind="func";var oo=class extends no{render(e){return"return "+super.render(e)}};oo.kind="return";var Rl=class extends Pt{render(e){let n="try"+super.render(e);return this.catch&&(n+=this.catch.render(e)),this.finally&&(n+=this.finally.render(e)),n}optimizeNodes(){var e,n;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(n=this.finally)===null||n===void 0||n.optimizeNodes(),this}optimizeNames(e,n){var r,o;return super.optimizeNames(e,n),(r=this.catch)===null||r===void 0||r.optimizeNames(e,n),(o=this.finally)===null||o===void 0||o.optimizeNames(e,n),this}get names(){let e=super.names;return this.catch&&On(e,this.catch.names),this.finally&&On(e,this.finally.names),e}},ao=class extends Pt{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};ao.kind="catch";var so=class extends Pt{render(e){return"finally"+super.render(e)}};so.kind="finally";var kl=class{constructor(e,n={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...n,_n:n.lines?`
|
|
3
|
+
import{d as ko,e as Un,h as Au,i as Su}from"./chunk-ZGX656ZG.js";import{c as N,d as Rs,e as Iu,g as u}from"./chunk-WRU7YLUO.js";var to=N(te=>{"use strict";u();Object.defineProperty(te,"__esModule",{value:!0});te.regexpCode=te.getEsmExportName=te.getProperty=te.safeStringify=te.stringify=te.strConcat=te.addCodeArg=te.str=te._=te.nil=te._Code=te.Name=te.IDENTIFIER=te._CodeOrName=void 0;var Qr=class{};te._CodeOrName=Qr;te.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var In=class extends Qr{constructor(e){if(super(),!te.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};te.Name=In;var tt=class extends Qr{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((n,r)=>`${n}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((n,r)=>(r instanceof In&&(n[r.str]=(n[r.str]||0)+1),n),{})}};te._Code=tt;te.nil=new tt("");function Sm(t,...e){let n=[t[0]],r=0;for(;r<e.length;)El(n,e[r]),n.push(t[++r]);return new tt(n)}te._=Sm;var yl=new tt("+");function Om(t,...e){let n=[eo(t[0])],r=0;for(;r<e.length;)n.push(yl),El(n,e[r]),n.push(yl,eo(t[++r]));return Ev(n),new tt(n)}te.str=Om;function El(t,e){e instanceof tt?t.push(...e._items):e instanceof In?t.push(e):t.push(wv(e))}te.addCodeArg=El;function Ev(t){let e=1;for(;e<t.length-1;){if(t[e]===yl){let n=Tv(t[e-1],t[e+1]);if(n!==void 0){t.splice(e-1,3,n);continue}t[e++]="+"}e++}}function Tv(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof In||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof In))return`"${t}${e.slice(1)}`}function bv(t,e){return e.emptyStr()?t:t.emptyStr()?e:Om`${t}${e}`}te.strConcat=bv;function wv(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:eo(Array.isArray(t)?t.join(","):t)}function vv(t){return new tt(eo(t))}te.stringify=vv;function eo(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}te.safeStringify=eo;function Iv(t){return typeof t=="string"&&te.IDENTIFIER.test(t)?new tt(`.${t}`):Sm`[${t}]`}te.getProperty=Iv;function Av(t){if(typeof t=="string"&&te.IDENTIFIER.test(t))return new tt(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}te.getEsmExportName=Av;function Sv(t){return new tt(t.toString())}te.regexpCode=Sv});var wl=N(Ze=>{"use strict";u();Object.defineProperty(Ze,"__esModule",{value:!0});Ze.ValueScope=Ze.ValueScopeName=Ze.Scope=Ze.varKinds=Ze.UsedValueState=void 0;var Ge=to(),Tl=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Ma;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Ma||(Ze.UsedValueState=Ma={}));Ze.varKinds={const:new Ge.Name("const"),let:new Ge.Name("let"),var:new Ge.Name("var")};var za=class{constructor({prefixes:e,parent:n}={}){this._names={},this._prefixes=e,this._parent=n}toName(e){return e instanceof Ge.Name?e:this.name(e)}name(e){return new Ge.Name(this._newName(e))}_newName(e){let n=this._names[e]||this._nameGroup(e);return`${e}${n.index++}`}_nameGroup(e){var n,r;if(!((r=(n=this._parent)===null||n===void 0?void 0:n._prefixes)===null||r===void 0)&&r.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Ze.Scope=za;var Ua=class extends Ge.Name{constructor(e,n){super(n),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,Ge._)`.${new Ge.Name(n)}[${r}]`}};Ze.ValueScopeName=Ua;var Ov=(0,Ge._)`\n`,bl=class extends za{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Ov:Ge.nil}}get(){return this._scope}name(e){return new Ua(e,this._newName(e))}value(e,n){var r;if(n.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:a}=o,s=(r=n.key)!==null&&r!==void 0?r:n.ref,i=this._values[a];if(i){let h=i.get(s);if(h)return h}else i=this._values[a]=new Map;i.set(s,o);let l=this._scope[a]||(this._scope[a]=[]),d=l.length;return l[d]=n.ref,o.setValue(n,{property:a,itemIndex:d}),o}getValue(e,n){let r=this._values[e];if(r)return r.get(n)}scopeRefs(e,n=this._values){return this._reduceValues(n,r=>{if(r.scopePath===void 0)throw new Error(`CodeGen: name "${r}" has no value`);return(0,Ge._)`${e}${r.scopePath}`})}scopeCode(e=this._values,n,r){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},n,r)}_reduceValues(e,n,r={},o){let a=Ge.nil;for(let s in e){let i=e[s];if(!i)continue;let l=r[s]=r[s]||new Map;i.forEach(d=>{if(l.has(d))return;l.set(d,Ma.Started);let h=n(d);if(h){let p=this.opts.es5?Ze.varKinds.var:Ze.varKinds.const;a=(0,Ge._)`${a}${p} ${d} = ${h};${this.opts._n}`}else if(h=o?.(d))a=(0,Ge._)`${a}${h}${this.opts._n}`;else throw new Tl(d);l.set(d,Ma.Completed)})}return a}};Ze.ValueScope=bl});var q=N(V=>{"use strict";u();Object.defineProperty(V,"__esModule",{value:!0});V.or=V.and=V.not=V.CodeGen=V.operators=V.varKinds=V.ValueScopeName=V.ValueScope=V.Scope=V.Name=V.regexpCode=V.stringify=V.getProperty=V.nil=V.strConcat=V.str=V._=void 0;var X=to(),lt=wl(),Bt=to();Object.defineProperty(V,"_",{enumerable:!0,get:function(){return Bt._}});Object.defineProperty(V,"str",{enumerable:!0,get:function(){return Bt.str}});Object.defineProperty(V,"strConcat",{enumerable:!0,get:function(){return Bt.strConcat}});Object.defineProperty(V,"nil",{enumerable:!0,get:function(){return Bt.nil}});Object.defineProperty(V,"getProperty",{enumerable:!0,get:function(){return Bt.getProperty}});Object.defineProperty(V,"stringify",{enumerable:!0,get:function(){return Bt.stringify}});Object.defineProperty(V,"regexpCode",{enumerable:!0,get:function(){return Bt.regexpCode}});Object.defineProperty(V,"Name",{enumerable:!0,get:function(){return Bt.Name}});var Za=wl();Object.defineProperty(V,"Scope",{enumerable:!0,get:function(){return Za.Scope}});Object.defineProperty(V,"ValueScope",{enumerable:!0,get:function(){return Za.ValueScope}});Object.defineProperty(V,"ValueScopeName",{enumerable:!0,get:function(){return Za.ValueScopeName}});Object.defineProperty(V,"varKinds",{enumerable:!0,get:function(){return Za.varKinds}});V.operators={GT:new X._Code(">"),GTE:new X._Code(">="),LT:new X._Code("<"),LTE:new X._Code("<="),EQ:new X._Code("==="),NEQ:new X._Code("!=="),NOT:new X._Code("!"),OR:new X._Code("||"),AND:new X._Code("&&"),ADD:new X._Code("+")};var Nt=class{optimizeNodes(){return this}optimizeNames(e,n){return this}},vl=class extends Nt{constructor(e,n,r){super(),this.varKind=e,this.name=n,this.rhs=r}render({es5:e,_n:n}){let r=e?lt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${o};`+n}optimizeNames(e,n){if(e[this.name.str])return this.rhs&&(this.rhs=ar(this.rhs,e,n)),this}get names(){return this.rhs instanceof X._CodeOrName?this.rhs.names:{}}},Fa=class extends Nt{constructor(e,n,r){super(),this.lhs=e,this.rhs=n,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof X.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=ar(this.rhs,e,n),this}get names(){let e=this.lhs instanceof X.Name?{}:{...this.lhs.names};return Ga(e,this.rhs)}},Il=class extends Fa{constructor(e,n,r,o){super(e,r,o),this.op=n}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Al=class extends Nt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Sl=class extends Nt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Ol=class extends Nt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Nl=class extends Nt{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,n){return this.code=ar(this.code,e,n),this}get names(){return this.code instanceof X._CodeOrName?this.code.names:{}}},no=class extends Nt{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((n,r)=>n+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,n=e.length;for(;n--;){let r=e[n].optimizeNodes();Array.isArray(r)?e.splice(n,1,...r):r?e[n]=r:e.splice(n,1)}return e.length>0?this:void 0}optimizeNames(e,n){let{nodes:r}=this,o=r.length;for(;o--;){let a=r[o];a.optimizeNames(e,n)||(Nv(e,a.names),r.splice(o,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,n)=>On(e,n.names),{})}},Pt=class extends no{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Pl=class extends no{},or=class extends Pt{};or.kind="else";var An=class t extends Pt{constructor(e,n){super(n),this.condition=e}render(e){let n=`if(${this.condition})`+super.render(e);return this.else&&(n+="else "+this.else.render(e)),n}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let n=this.else;if(n){let r=n.optimizeNodes();n=this.else=Array.isArray(r)?new or(r):r}if(n)return e===!1?n instanceof t?n:n.nodes:this.nodes.length?this:new t(Nm(e),n instanceof t?[n]:n.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,n){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,n),!!(super.optimizeNames(e,n)||this.else))return this.condition=ar(this.condition,e,n),this}get names(){let e=super.names;return Ga(e,this.condition),this.else&&On(e,this.else.names),e}};An.kind="if";var Sn=class extends Pt{};Sn.kind="for";var Cl=class extends Sn{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,n){if(super.optimizeNames(e,n))return this.iteration=ar(this.iteration,e,n),this}get names(){return On(super.names,this.iteration.names)}},Dl=class extends Sn{constructor(e,n,r,o){super(),this.varKind=e,this.name=n,this.from=r,this.to=o}render(e){let n=e.es5?lt.varKinds.var:this.varKind,{name:r,from:o,to:a}=this;return`for(${n} ${r}=${o}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){let e=Ga(super.names,this.from);return Ga(e,this.to)}},ja=class extends Sn{constructor(e,n,r,o){super(),this.loop=e,this.varKind=n,this.name=r,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,n){if(super.optimizeNames(e,n))return this.iterable=ar(this.iterable,e,n),this}get names(){return On(super.names,this.iterable.names)}},ro=class extends Pt{constructor(e,n,r){super(),this.name=e,this.args=n,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};ro.kind="func";var oo=class extends no{render(e){return"return "+super.render(e)}};oo.kind="return";var Rl=class extends Pt{render(e){let n="try"+super.render(e);return this.catch&&(n+=this.catch.render(e)),this.finally&&(n+=this.finally.render(e)),n}optimizeNodes(){var e,n;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(n=this.finally)===null||n===void 0||n.optimizeNodes(),this}optimizeNames(e,n){var r,o;return super.optimizeNames(e,n),(r=this.catch)===null||r===void 0||r.optimizeNames(e,n),(o=this.finally)===null||o===void 0||o.optimizeNames(e,n),this}get names(){let e=super.names;return this.catch&&On(e,this.catch.names),this.finally&&On(e,this.finally.names),e}},ao=class extends Pt{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};ao.kind="catch";var so=class extends Pt{render(e){return"finally"+super.render(e)}};so.kind="finally";var kl=class{constructor(e,n={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...n,_n:n.lines?`
|
|
4
4
|
`:""},this._extScope=e,this._scope=new lt.Scope({parent:e}),this._nodes=[new Pl]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,n){let r=this._extScope.value(e,n);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,n){return this._extScope.getValue(e,n)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,n,r,o){let a=this._scope.toName(n);return r!==void 0&&o&&(this._constants[a.str]=r),this._leafNode(new vl(e,a,r)),a}const(e,n,r){return this._def(lt.varKinds.const,e,n,r)}let(e,n,r){return this._def(lt.varKinds.let,e,n,r)}var(e,n,r){return this._def(lt.varKinds.var,e,n,r)}assign(e,n,r){return this._leafNode(new Fa(e,n,r))}add(e,n){return this._leafNode(new Il(e,V.operators.ADD,n))}code(e){return typeof e=="function"?e():e!==X.nil&&this._leafNode(new Nl(e)),this}object(...e){let n=["{"];for(let[r,o]of e)n.length>1&&n.push(","),n.push(r),(r!==o||this.opts.es5)&&(n.push(":"),(0,X.addCodeArg)(n,o));return n.push("}"),new X._Code(n)}if(e,n,r){if(this._blockNode(new An(e)),n&&r)this.code(n).else().code(r).endIf();else if(n)this.code(n).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new An(e))}else(){return this._elseNode(new or)}endIf(){return this._endBlockNode(An,or)}_for(e,n){return this._blockNode(e),n&&this.code(n).endFor(),this}for(e,n){return this._for(new Cl(e),n)}forRange(e,n,r,o,a=this.opts.es5?lt.varKinds.var:lt.varKinds.let){let s=this._scope.toName(e);return this._for(new Dl(a,s,n,r),()=>o(s))}forOf(e,n,r,o=lt.varKinds.const){let a=this._scope.toName(e);if(this.opts.es5){let s=n instanceof X.Name?n:this.var("_arr",n);return this.forRange("_i",0,(0,X._)`${s}.length`,i=>{this.var(a,(0,X._)`${s}[${i}]`),r(a)})}return this._for(new ja("of",o,a,n),()=>r(a))}forIn(e,n,r,o=this.opts.es5?lt.varKinds.var:lt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,X._)`Object.keys(${n})`,r);let a=this._scope.toName(e);return this._for(new ja("in",o,a,n),()=>r(a))}endFor(){return this._endBlockNode(Sn)}label(e){return this._leafNode(new Al(e))}break(e){return this._leafNode(new Sl(e))}return(e){let n=new oo;if(this._blockNode(n),this.code(e),n.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(oo)}try(e,n,r){if(!n&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Rl;if(this._blockNode(o),this.code(e),n){let a=this.name("e");this._currNode=o.catch=new ao(a),n(a)}return r&&(this._currNode=o.finally=new so,this.code(r)),this._endBlockNode(ao,so)}throw(e){return this._leafNode(new Ol(e))}block(e,n){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(n),this}endBlock(e){let n=this._blockStarts.pop();if(n===void 0)throw new Error("CodeGen: not in self-balancing block");let r=this._nodes.length-n;if(r<0||e!==void 0&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=n,this}func(e,n=X.nil,r,o){return this._blockNode(new ro(e,n,r)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(ro)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,n){let r=this._currNode;if(r instanceof e||n&&r instanceof n)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${n?`${e.kind}/${n.kind}`:e.kind}"`)}_elseNode(e){let n=this._currNode;if(!(n instanceof An))throw new Error('CodeGen: "else" without "if"');return this._currNode=n.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let n=this._nodes;n[n.length-1]=e}};V.CodeGen=kl;function On(t,e){for(let n in e)t[n]=(t[n]||0)+(e[n]||0);return t}function Ga(t,e){return e instanceof X._CodeOrName?On(t,e.names):t}function ar(t,e,n){if(t instanceof X.Name)return r(t);if(!o(t))return t;return new X._Code(t._items.reduce((a,s)=>(s instanceof X.Name&&(s=r(s)),s instanceof X._Code?a.push(...s._items):a.push(s),a),[]));function r(a){let s=n[a.str];return s===void 0||e[a.str]!==1?a:(delete e[a.str],s)}function o(a){return a instanceof X._Code&&a._items.some(s=>s instanceof X.Name&&e[s.str]===1&&n[s.str]!==void 0)}}function Nv(t,e){for(let n in e)t[n]=(t[n]||0)-(e[n]||0)}function Nm(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,X._)`!${xl(t)}`}V.not=Nm;var Pv=Pm(V.operators.AND);function Cv(...t){return t.reduce(Pv)}V.and=Cv;var Dv=Pm(V.operators.OR);function Rv(...t){return t.reduce(Dv)}V.or=Rv;function Pm(t){return(e,n)=>e===X.nil?n:n===X.nil?e:(0,X._)`${xl(e)} ${t} ${xl(n)}`}function xl(t){return t instanceof X.Name?t:(0,X._)`(${t})`}});var Q=N(W=>{"use strict";u();Object.defineProperty(W,"__esModule",{value:!0});W.checkStrictMode=W.getErrorPath=W.Type=W.useFunc=W.setEvaluated=W.evaluatedPropsToName=W.mergeEvaluated=W.eachItem=W.unescapeJsonPointer=W.escapeJsonPointer=W.escapeFragment=W.unescapeFragment=W.schemaRefOrVal=W.schemaHasRulesButRef=W.schemaHasRules=W.checkUnknownRules=W.alwaysValidSchema=W.toHash=void 0;var ae=q(),kv=to();function xv(t){let e={};for(let n of t)e[n]=!0;return e}W.toHash=xv;function Lv(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Rm(t,e),!km(e,t.self.RULES.all))}W.alwaysValidSchema=Lv;function Rm(t,e=t.schema){let{opts:n,self:r}=t;if(!n.strictSchema||typeof e=="boolean")return;let o=r.RULES.keywords;for(let a in e)o[a]||$m(t,`unknown keyword: "${a}"`)}W.checkUnknownRules=Rm;function km(t,e){if(typeof t=="boolean")return!t;for(let n in t)if(e[n])return!0;return!1}W.schemaHasRules=km;function $v(t,e){if(typeof t=="boolean")return!t;for(let n in t)if(n!=="$ref"&&e.all[n])return!0;return!1}W.schemaHasRulesButRef=$v;function Mv({topSchemaRef:t,schemaPath:e},n,r,o){if(!o){if(typeof n=="number"||typeof n=="boolean")return n;if(typeof n=="string")return(0,ae._)`${n}`}return(0,ae._)`${t}${e}${(0,ae.getProperty)(r)}`}W.schemaRefOrVal=Mv;function zv(t){return xm(decodeURIComponent(t))}W.unescapeFragment=zv;function Uv(t){return encodeURIComponent($l(t))}W.escapeFragment=Uv;function $l(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}W.escapeJsonPointer=$l;function xm(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}W.unescapeJsonPointer=xm;function Fv(t,e){if(Array.isArray(t))for(let n of t)e(n);else e(t)}W.eachItem=Fv;function Cm({mergeNames:t,mergeToName:e,mergeValues:n,resultToName:r}){return(o,a,s,i)=>{let l=s===void 0?a:s instanceof ae.Name?(a instanceof ae.Name?t(o,a,s):e(o,a,s),s):a instanceof ae.Name?(e(o,s,a),a):n(a,s);return i===ae.Name&&!(l instanceof ae.Name)?r(o,l):l}}W.mergeEvaluated={props:Cm({mergeNames:(t,e,n)=>t.if((0,ae._)`${n} !== true && ${e} !== undefined`,()=>{t.if((0,ae._)`${e} === true`,()=>t.assign(n,!0),()=>t.assign(n,(0,ae._)`${n} || {}`).code((0,ae._)`Object.assign(${n}, ${e})`))}),mergeToName:(t,e,n)=>t.if((0,ae._)`${n} !== true`,()=>{e===!0?t.assign(n,!0):(t.assign(n,(0,ae._)`${n} || {}`),Ml(t,n,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Lm}),items:Cm({mergeNames:(t,e,n)=>t.if((0,ae._)`${n} !== true && ${e} !== undefined`,()=>t.assign(n,(0,ae._)`${e} === true ? true : ${n} > ${e} ? ${n} : ${e}`)),mergeToName:(t,e,n)=>t.if((0,ae._)`${n} !== true`,()=>t.assign(n,e===!0?!0:(0,ae._)`${n} > ${e} ? ${n} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Lm(t,e){if(e===!0)return t.var("props",!0);let n=t.var("props",(0,ae._)`{}`);return e!==void 0&&Ml(t,n,e),n}W.evaluatedPropsToName=Lm;function Ml(t,e,n){Object.keys(n).forEach(r=>t.assign((0,ae._)`${e}${(0,ae.getProperty)(r)}`,!0))}W.setEvaluated=Ml;var Dm={};function jv(t,e){return t.scopeValue("func",{ref:e,code:Dm[e.code]||(Dm[e.code]=new kv._Code(e.code))})}W.useFunc=jv;var Ll;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Ll||(W.Type=Ll={}));function Gv(t,e,n){if(t instanceof ae.Name){let r=e===Ll.Num;return n?r?(0,ae._)`"[" + ${t} + "]"`:(0,ae._)`"['" + ${t} + "']"`:r?(0,ae._)`"/" + ${t}`:(0,ae._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,ae.getProperty)(t).toString():"/"+$l(t)}W.getErrorPath=Gv;function $m(t,e,n=t.opts.strictSchema){if(n){if(e=`strict mode: ${e}`,n===!0)throw new Error(e);t.self.logger.warn(e)}}W.checkStrictMode=$m});var Ct=N(zl=>{"use strict";u();Object.defineProperty(zl,"__esModule",{value:!0});var Ce=q(),Zv={data:new Ce.Name("data"),valCxt:new Ce.Name("valCxt"),instancePath:new Ce.Name("instancePath"),parentData:new Ce.Name("parentData"),parentDataProperty:new Ce.Name("parentDataProperty"),rootData:new Ce.Name("rootData"),dynamicAnchors:new Ce.Name("dynamicAnchors"),vErrors:new Ce.Name("vErrors"),errors:new Ce.Name("errors"),this:new Ce.Name("this"),self:new Ce.Name("self"),scope:new Ce.Name("scope"),json:new Ce.Name("json"),jsonPos:new Ce.Name("jsonPos"),jsonLen:new Ce.Name("jsonLen"),jsonPart:new Ce.Name("jsonPart")};zl.default=Zv});var io=N(De=>{"use strict";u();Object.defineProperty(De,"__esModule",{value:!0});De.extendErrors=De.resetErrorsCount=De.reportExtraError=De.reportError=De.keyword$DataError=De.keywordError=void 0;var ee=q(),Ba=Q(),$e=Ct();De.keywordError={message:({keyword:t})=>(0,ee.str)`must pass "${t}" keyword validation`};De.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,ee.str)`"${t}" keyword must be ${e} ($data)`:(0,ee.str)`"${t}" keyword is invalid ($data)`};function Bv(t,e=De.keywordError,n,r){let{it:o}=t,{gen:a,compositeRule:s,allErrors:i}=o,l=Um(t,e,n);r??(s||i)?Mm(a,l):zm(o,(0,ee._)`[${l}]`)}De.reportError=Bv;function qv(t,e=De.keywordError,n){let{it:r}=t,{gen:o,compositeRule:a,allErrors:s}=r,i=Um(t,e,n);Mm(o,i),a||s||zm(r,$e.default.vErrors)}De.reportExtraError=qv;function Vv(t,e){t.assign($e.default.errors,e),t.if((0,ee._)`${$e.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,ee._)`${$e.default.vErrors}.length`,e),()=>t.assign($e.default.vErrors,null)))}De.resetErrorsCount=Vv;function Wv({gen:t,keyword:e,schemaValue:n,data:r,errsCount:o,it:a}){if(o===void 0)throw new Error("ajv implementation error");let s=t.name("err");t.forRange("i",o,$e.default.errors,i=>{t.const(s,(0,ee._)`${$e.default.vErrors}[${i}]`),t.if((0,ee._)`${s}.instancePath === undefined`,()=>t.assign((0,ee._)`${s}.instancePath`,(0,ee.strConcat)($e.default.instancePath,a.errorPath))),t.assign((0,ee._)`${s}.schemaPath`,(0,ee.str)`${a.errSchemaPath}/${e}`),a.opts.verbose&&(t.assign((0,ee._)`${s}.schema`,n),t.assign((0,ee._)`${s}.data`,r))})}De.extendErrors=Wv;function Mm(t,e){let n=t.const("err",e);t.if((0,ee._)`${$e.default.vErrors} === null`,()=>t.assign($e.default.vErrors,(0,ee._)`[${n}]`),(0,ee._)`${$e.default.vErrors}.push(${n})`),t.code((0,ee._)`${$e.default.errors}++`)}function zm(t,e){let{gen:n,validateName:r,schemaEnv:o}=t;o.$async?n.throw((0,ee._)`new ${t.ValidationError}(${e})`):(n.assign((0,ee._)`${r}.errors`,e),n.return(!1))}var Nn={keyword:new ee.Name("keyword"),schemaPath:new ee.Name("schemaPath"),params:new ee.Name("params"),propertyName:new ee.Name("propertyName"),message:new ee.Name("message"),schema:new ee.Name("schema"),parentSchema:new ee.Name("parentSchema")};function Um(t,e,n){let{createErrors:r}=t.it;return r===!1?(0,ee._)`{}`:Hv(t,e,n)}function Hv(t,e,n={}){let{gen:r,it:o}=t,a=[Yv(o,n),Kv(t,n)];return Jv(t,e,a),r.object(...a)}function Yv({errorPath:t},{instancePath:e}){let n=e?(0,ee.str)`${t}${(0,Ba.getErrorPath)(e,Ba.Type.Str)}`:t;return[$e.default.instancePath,(0,ee.strConcat)($e.default.instancePath,n)]}function Kv({keyword:t,it:{errSchemaPath:e}},{schemaPath:n,parentSchema:r}){let o=r?e:(0,ee.str)`${e}/${t}`;return n&&(o=(0,ee.str)`${o}${(0,Ba.getErrorPath)(n,Ba.Type.Str)}`),[Nn.schemaPath,o]}function Jv(t,{params:e,message:n},r){let{keyword:o,data:a,schemaValue:s,it:i}=t,{opts:l,propertyName:d,topSchemaRef:h,schemaPath:p}=i;r.push([Nn.keyword,o],[Nn.params,typeof e=="function"?e(t):e||(0,ee._)`{}`]),l.messages&&r.push([Nn.message,typeof n=="function"?n(t):n]),l.verbose&&r.push([Nn.schema,s],[Nn.parentSchema,(0,ee._)`${h}${p}`],[$e.default.data,a]),d&&r.push([Nn.propertyName,d])}});var jm=N(sr=>{"use strict";u();Object.defineProperty(sr,"__esModule",{value:!0});sr.boolOrEmptySchema=sr.topBoolOrEmptySchema=void 0;var Xv=io(),Qv=q(),eI=Ct(),tI={message:"boolean schema is false"};function nI(t){let{gen:e,schema:n,validateName:r}=t;n===!1?Fm(t,!1):typeof n=="object"&&n.$async===!0?e.return(eI.default.data):(e.assign((0,Qv._)`${r}.errors`,null),e.return(!0))}sr.topBoolOrEmptySchema=nI;function rI(t,e){let{gen:n,schema:r}=t;r===!1?(n.var(e,!1),Fm(t)):n.var(e,!0)}sr.boolOrEmptySchema=rI;function Fm(t,e){let{gen:n,data:r}=t,o={gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Xv.reportError)(o,tI,void 0,e)}});var Ul=N(ir=>{"use strict";u();Object.defineProperty(ir,"__esModule",{value:!0});ir.getRules=ir.isJSONType=void 0;var oI=["string","number","integer","boolean","null","object","array"],aI=new Set(oI);function sI(t){return typeof t=="string"&&aI.has(t)}ir.isJSONType=sI;function iI(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}ir.getRules=iI});var Fl=N(qt=>{"use strict";u();Object.defineProperty(qt,"__esModule",{value:!0});qt.shouldUseRule=qt.shouldUseGroup=qt.schemaHasRulesForType=void 0;function cI({schema:t,self:e},n){let r=e.RULES.types[n];return r&&r!==!0&&Gm(t,r)}qt.schemaHasRulesForType=cI;function Gm(t,e){return e.rules.some(n=>Zm(t,n))}qt.shouldUseGroup=Gm;function Zm(t,e){var n;return t[e.keyword]!==void 0||((n=e.definition.implements)===null||n===void 0?void 0:n.some(r=>t[r]!==void 0))}qt.shouldUseRule=Zm});var co=N(Re=>{"use strict";u();Object.defineProperty(Re,"__esModule",{value:!0});Re.reportTypeError=Re.checkDataTypes=Re.checkDataType=Re.coerceAndCheckDataType=Re.getJSONTypes=Re.getSchemaTypes=Re.DataType=void 0;var lI=Ul(),dI=Fl(),uI=io(),Z=q(),Bm=Q(),cr;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(cr||(Re.DataType=cr={}));function hI(t){let e=qm(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}Re.getSchemaTypes=hI;function qm(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(lI.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Re.getJSONTypes=qm;function pI(t,e){let{gen:n,data:r,opts:o}=t,a=mI(e,o.coerceTypes),s=e.length>0&&!(a.length===0&&e.length===1&&(0,dI.schemaHasRulesForType)(t,e[0]));if(s){let i=Gl(e,r,o.strictNumbers,cr.Wrong);n.if(i,()=>{a.length?fI(t,e,a):Zl(t)})}return s}Re.coerceAndCheckDataType=pI;var Vm=new Set(["string","number","integer","boolean","null"]);function mI(t,e){return e?t.filter(n=>Vm.has(n)||e==="array"&&n==="array"):[]}function fI(t,e,n){let{gen:r,data:o,opts:a}=t,s=r.let("dataType",(0,Z._)`typeof ${o}`),i=r.let("coerced",(0,Z._)`undefined`);a.coerceTypes==="array"&&r.if((0,Z._)`${s} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>r.assign(o,(0,Z._)`${o}[0]`).assign(s,(0,Z._)`typeof ${o}`).if(Gl(e,o,a.strictNumbers),()=>r.assign(i,o))),r.if((0,Z._)`${i} !== undefined`);for(let d of n)(Vm.has(d)||d==="array"&&a.coerceTypes==="array")&&l(d);r.else(),Zl(t),r.endIf(),r.if((0,Z._)`${i} !== undefined`,()=>{r.assign(o,i),_I(t,i)});function l(d){switch(d){case"string":r.elseIf((0,Z._)`${s} == "number" || ${s} == "boolean"`).assign(i,(0,Z._)`"" + ${o}`).elseIf((0,Z._)`${o} === null`).assign(i,(0,Z._)`""`);return;case"number":r.elseIf((0,Z._)`${s} == "boolean" || ${o} === null
|
|
5
5
|
|| (${s} == "string" && ${o} && ${o} == +${o})`).assign(i,(0,Z._)`+${o}`);return;case"integer":r.elseIf((0,Z._)`${s} === "boolean" || ${o} === null
|
|
6
6
|
|| (${s} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(i,(0,Z._)`+${o}`);return;case"boolean":r.elseIf((0,Z._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(i,!1).elseIf((0,Z._)`${o} === "true" || ${o} === 1`).assign(i,!0);return;case"null":r.elseIf((0,Z._)`${o} === "" || ${o} === 0 || ${o} === false`),r.assign(i,null);return;case"array":r.elseIf((0,Z._)`${s} === "string" || ${s} === "number"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __nodeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __nodeCreateRequire(import.meta.url);
|
|
3
|
-
import{c as h,d as p}from"./chunk-
|
|
3
|
+
import{c as h,d as p}from"./chunk-ZGX656ZG.js";import{g as m}from"./chunk-WRU7YLUO.js";m();import{spawn as G}from"child_process";m();import{spawn as x}from"child_process";import{existsSync as S,promises as c}from"fs";import y from"os";import a from"path";m();var R=/^\d+\.\d+\.\d+$/;function f(s){return typeof s=="string"&&R.test(s)}function g(s,t){let r=s.split(".").map(n=>parseInt(n,10)||0),e=t.split(".").map(n=>parseInt(n,10)||0);for(let n=0;n<3;n+=1){let i=(r[n]??0)-(e[n]??0);if(i!==0)return i<0?-1:1}return 0}var $="preferred.json",N=3,T=300*1e3,j=30*1e3,A=3600*1e3,I=".staging-";function _(){let s=process.env.MCP_AUTO_UPGRADE?.trim().toLowerCase();return s!=="0"&&s!=="off"&&s!=="false"}var w=class{constructor(t=process.env.MCP_UPGRADE_HOME??a.join(y.homedir(),`.${p}`,"versions")){this.root=t}installs=new Map;packageDir(t){return a.join(this.root,t,"node_modules",p)}binPath(t){return a.join(this.packageDir(t),"bin",`${p}.js`)}isInstalled(t){return f(t)&&S(this.binPath(t))}async readPreferred(){try{let t=await c.readFile(a.join(this.root,$),"utf8"),r=JSON.parse(t).version;return f(r)&&this.isInstalled(r)?r:null}catch{return null}}async installFirst(t){let r=[];for(let e of t)try{return await this.install(e),e}catch(n){r.push(`${e}: ${n instanceof Error?n.message:String(n)}`)}throw new Error(r.join("; ")||"no version to install")}install(t){if(!f(t))return Promise.reject(new Error(`refusing to install "${t}"`));let r=this.installs.get(t);if(r)return r;let e=this.installLocked(t).finally(()=>{this.installs.delete(t)});return this.installs.set(t,e),e}async installLocked(t){if(!this.isInstalled(t)){await c.mkdir(this.root,{recursive:!0});let r=await c.mkdtemp(a.join(this.root,I));try{await D(["install","--prefix",r,"--no-save","--no-package-lock","--ignore-scripts","--no-audit","--no-fund","--loglevel=error",b(t)],T);let e=a.join(r,"node_modules",p),n=JSON.parse(await c.readFile(a.join(e,"package.json"),"utf8"));if(n.version!==t)throw new Error(`npm installed ${p}@${n.version} instead of ${t}`);let i=a.join(e,"bin",`${p}.js`);if(!S(i))throw new Error(`${p}@${t} has no launcher`);await k(i,t),await c.rename(r,a.join(this.root,t)).catch(o=>{if(!this.isInstalled(t))throw o})}finally{await c.rm(r,{recursive:!0,force:!0})}}await this.promote(),await this.prune()}async installedVersions(){return(await c.readdir(this.root).catch(()=>[])).filter(r=>this.isInstalled(r)).sort((r,e)=>g(e,r))}async promote(){let[t]=await this.installedVersions(),r=await this.readPreferred();if(!t||r&&g(r,t)>=0)return;let e=a.join(this.root,$),n=`${e}.${process.pid}.tmp`;await c.writeFile(n,`${JSON.stringify({version:t})}
|
|
4
4
|
`),await c.rename(n,e)}async prune(){let t=await c.readdir(this.root).catch(()=>[]),r=t.filter(f).sort((e,n)=>g(n,e)).slice(N);for(let e of t.filter(n=>n.startsWith(I))){let n=await c.stat(a.join(this.root,e)).catch(()=>null);n&&Date.now()-n.mtimeMs>A&&r.push(e)}for(let e of r)await c.rm(a.join(this.root,e),{recursive:!0,force:!0}).catch(()=>{})}};function b(s){let t=process.env.MCP_UPGRADE_SOURCE_DIR;return t?a.join(t,`${p}-${s}.tgz`):`${p}@${s}`}function k(s,t){return new Promise((r,e)=>{let n=x(process.execPath,[s,"--help"],{stdio:"ignore",env:{...process.env,MCP_AUTO_UPGRADE:"0"}}),i=setTimeout(()=>n.kill("SIGKILL"),j);n.on("error",o=>{clearTimeout(i),e(o)}),n.on("exit",(o,d)=>{if(clearTimeout(i),o===0){r();return}e(new Error(`${p}@${t} does not start on Node ${process.versions.node} (${d??`exit ${o}`})`))})})}var V=s=>/[\s"&|<>^]/.test(s)?`"${s.replace(/"/g,'""')}"`:s;function D(s,t){return new Promise((r,e)=>{let n=process.platform==="win32",i=x(n?"npm.cmd":"npm",n?s.map(V):s,{stdio:["ignore","ignore","pipe"],shell:n,env:{...process.env,npm_config_update_notifier:"false"}}),o="";i.stderr?.on("data",u=>{o=`${o}${u.toString()}`.slice(-2e3)});let d=setTimeout(()=>{i.kill("SIGTERM"),e(new Error(`npm install timed out after ${t/1e3}s`))},t);i.on("error",u=>{clearTimeout(d),e(u)}),i.on("exit",u=>{if(clearTimeout(d),u===0){r();return}let l=o.trim().split(`
|
|
5
5
|
`).slice(-3).join(" ");e(new Error(`npm install exited with ${u}${l?`: ${l}`:""}`))})})}var v=["SIGINT","SIGTERM","SIGHUP"];function M(s=h()){return _()&&f(s)}async function O(s,t=h()){if(!M(t))return null;let r=await s.readPreferred();return r&&g(r,t)>0?r:null}async function tt(s,t=new w,r=h()){if(s[0]==="daemon")return null;let e=await O(t,r);return e?U(t,e,s):null}function U(s,t,r,e=process.env){return new Promise((n,i)=>{let o=G(process.execPath,[s.binPath(t),...r],{stdio:"inherit",env:e}),d=l=>{o.kill(l)};for(let l of v)process.on(l,d);let u=()=>{for(let l of v)process.off(l,d)};o.on("error",l=>{u(),i(l)}),o.on("exit",(l,E)=>{u(),n(E?{signal:E}:{code:l??0})})})}function rt(s){if("signal"in s){process.kill(process.pid,s.signal);return}process.exitCode=s.code}export{f as a,g as b,w as c,M as d,tt as e,U as f,rt as g};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __nodeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __nodeCreateRequire(import.meta.url);
|
|
3
|
-
import{b as fs,c as p,d as ds,f as N,g as f}from"./chunk-CCPB2BTC.js";var P={};ds(P,{__addDisposableResource:()=>dr,__assign:()=>rt,__asyncDelegator:()=>ir,__asyncGenerator:()=>sr,__asyncValues:()=>nr,__await:()=>H,__awaiter:()=>Xe,__classPrivateFieldGet:()=>ur,__classPrivateFieldIn:()=>fr,__classPrivateFieldSet:()=>hr,__createBinding:()=>it,__decorate:()=>He,__disposeResources:()=>lr,__esDecorate:()=>We,__exportStar:()=>Ze,__extends:()=>De,__generator:()=>Qe,__importDefault:()=>ar,__importStar:()=>cr,__makeTemplateObject:()=>or,__metadata:()=>Ke,__param:()=>Je,__propKey:()=>Ge,__read:()=>Vt,__rest:()=>Fe,__rewriteRelativeImportExtension:()=>pr,__runInitializers:()=>Ye,__setFunctionName:()=>ze,__spread:()=>tr,__spreadArray:()=>rr,__spreadArrays:()=>er,__values:()=>st,default:()=>bs});function De(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Bt(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function Fe(i,t){var e={};for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&t.indexOf(r)<0&&(e[r]=i[r]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(i);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(i,r[s])&&(e[r[s]]=i[r[s]]);return e}function He(i,t,e,r){var s=arguments.length,n=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(i,t,e,r);else for(var c=i.length-1;c>=0;c--)(o=i[c])&&(n=(s<3?o(n):s>3?o(t,e,n):o(t,e))||n);return s>3&&n&&Object.defineProperty(t,e,n),n}function Je(i,t){return function(e,r){t(e,r,i)}}function We(i,t,e,r,s,n){function o(T){if(T!==void 0&&typeof T!="function")throw new TypeError("Function expected");return T}for(var c=r.kind,u=c==="getter"?"get":c==="setter"?"set":"value",h=!t&&i?r.static?i:i.prototype:null,a=t||(h?Object.getOwnPropertyDescriptor(h,r.name):{}),d,w=!1,l=e.length-1;l>=0;l--){var _={};for(var k in r)_[k]=k==="access"?{}:r[k];for(var k in r.access)_.access[k]=r.access[k];_.addInitializer=function(T){if(w)throw new TypeError("Cannot add initializers after decoration has completed");n.push(o(T||null))};var j=(0,e[l])(c==="accessor"?{get:a.get,set:a.set}:a[u],_);if(c==="accessor"){if(j===void 0)continue;if(j===null||typeof j!="object")throw new TypeError("Object expected");(d=o(j.get))&&(a.get=d),(d=o(j.set))&&(a.set=d),(d=o(j.init))&&s.unshift(d)}else(d=o(j))&&(c==="field"?s.unshift(d):a[u]=d)}h&&Object.defineProperty(h,r.name,a),w=!0}function Ye(i,t,e){for(var r=arguments.length>2,s=0;s<t.length;s++)e=r?t[s].call(i,e):t[s].call(i);return r?e:void 0}function Ge(i){return typeof i=="symbol"?i:"".concat(i)}function ze(i,t,e){return typeof t=="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(i,"name",{configurable:!0,value:e?"".concat(e," ",t):t})}function Ke(i,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,t)}function Xe(i,t,e,r){function s(n){return n instanceof e?n:new e(function(o){o(n)})}return new(e||(e=Promise))(function(n,o){function c(a){try{h(r.next(a))}catch(d){o(d)}}function u(a){try{h(r.throw(a))}catch(d){o(d)}}function h(a){a.done?n(a.value):s(a.value).then(c,u)}h((r=r.apply(i,t||[])).next())})}function Qe(i,t){var e={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},r,s,n,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=c(0),o.throw=c(1),o.return=c(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(h){return function(a){return u([h,a])}}function u(h){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,h[0]&&(e=0)),e;)try{if(r=1,s&&(n=h[0]&2?s.return:h[0]?s.throw||((n=s.return)&&n.call(s),0):s.next)&&!(n=n.call(s,h[1])).done)return n;switch(s=0,n&&(h=[h[0]&2,n.value]),h[0]){case 0:case 1:n=h;break;case 4:return e.label++,{value:h[1],done:!1};case 5:e.label++,s=h[1],h=[0];continue;case 7:h=e.ops.pop(),e.trys.pop();continue;default:if(n=e.trys,!(n=n.length>0&&n[n.length-1])&&(h[0]===6||h[0]===2)){e=0;continue}if(h[0]===3&&(!n||h[1]>n[0]&&h[1]<n[3])){e.label=h[1];break}if(h[0]===6&&e.label<n[1]){e.label=n[1],n=h;break}if(n&&e.label<n[2]){e.label=n[2],e.ops.push(h);break}n[2]&&e.ops.pop(),e.trys.pop();continue}h=t.call(i,e)}catch(a){h=[6,a],s=0}finally{r=n=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function Ze(i,t){for(var e in i)e!=="default"&&!Object.prototype.hasOwnProperty.call(t,e)&&it(t,i,e)}function st(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],r=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&r>=i.length&&(i=void 0),{value:i&&i[r++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Vt(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var r=e.call(i),s,n=[],o;try{for(;(t===void 0||t-- >0)&&!(s=r.next()).done;)n.push(s.value)}catch(c){o={error:c}}finally{try{s&&!s.done&&(e=r.return)&&e.call(r)}finally{if(o)throw o.error}}return n}function tr(){for(var i=[],t=0;t<arguments.length;t++)i=i.concat(Vt(arguments[t]));return i}function er(){for(var i=0,t=0,e=arguments.length;t<e;t++)i+=arguments[t].length;for(var r=Array(i),s=0,t=0;t<e;t++)for(var n=arguments[t],o=0,c=n.length;o<c;o++,s++)r[s]=n[o];return r}function rr(i,t,e){if(e||arguments.length===2)for(var r=0,s=t.length,n;r<s;r++)(n||!(r in t))&&(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return i.concat(n||Array.prototype.slice.call(t))}function H(i){return this instanceof H?(this.v=i,this):new H(i)}function sr(i,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=e.apply(i,t||[]),s,n=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(l){return function(_){return Promise.resolve(_).then(l,d)}}function c(l,_){r[l]&&(s[l]=function(k){return new Promise(function(j,T){n.push([l,k,j,T])>1||u(l,k)})},_&&(s[l]=_(s[l])))}function u(l,_){try{h(r[l](_))}catch(k){w(n[0][3],k)}}function h(l){l.value instanceof H?Promise.resolve(l.value.v).then(a,d):w(n[0][2],l)}function a(l){u("next",l)}function d(l){u("throw",l)}function w(l,_){l(_),n.shift(),n.length&&u(n[0][0],n[0][1])}}function ir(i){var t,e;return t={},r("next"),r("throw",function(s){throw s}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(s,n){t[s]=i[s]?function(o){return(e=!e)?{value:H(i[s](o)),done:!1}:n?n(o):o}:n}}function nr(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=i[Symbol.asyncIterator],e;return t?t.call(i):(i=typeof st=="function"?st(i):i[Symbol.iterator](),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=i[n]&&function(o){return new Promise(function(c,u){o=i[n](o),s(c,u,o.done,o.value)})}}function s(n,o,c,u){Promise.resolve(u).then(function(h){n({value:h,done:c})},o)}}function or(i,t){return Object.defineProperty?Object.defineProperty(i,"raw",{value:t}):i.raw=t,i}function cr(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var e=Ut(i),r=0;r<e.length;r++)e[r]!=="default"&&it(t,i,e[r]);return ls(t,i),t}function ar(i){return i&&i.__esModule?i:{default:i}}function ur(i,t,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?i!==t||!r:!t.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(i):r?r.value:t.get(i)}function hr(i,t,e,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?i!==t||!s:!t.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(i,e):s?s.value=e:t.set(i,e),e}function fr(i,t){if(t===null||typeof t!="object"&&typeof t!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof i=="function"?t===i:i.has(t)}function dr(i,t,e){if(t!=null){if(typeof t!="object"&&typeof t!="function")throw new TypeError("Object expected.");var r,s;if(e){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=t[Symbol.dispose],e&&(s=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");s&&(r=function(){try{s.call(this)}catch(n){return Promise.reject(n)}}),i.stack.push({value:t,dispose:r,async:e})}else e&&i.stack.push({async:!0});return t}function lr(i){function t(n){i.error=i.hasError?new ps(n,i.error,"An error was suppressed during disposal."):n,i.hasError=!0}var e,r=0;function s(){for(;e=i.stack.pop();)try{if(!e.async&&r===1)return r=0,i.stack.push(e),Promise.resolve().then(s);if(e.dispose){var n=e.dispose.call(e.value);if(e.async)return r|=2,Promise.resolve(n).then(s,function(o){return t(o),s()})}else r|=1}catch(o){t(o)}if(r===1)return i.hasError?Promise.reject(i.error):Promise.resolve();if(i.hasError)throw i.error}return s()}function pr(i,t){return typeof i=="string"&&/^\.\.?\//.test(i)?i.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,r,s,n,o){return r?t?".jsx":".js":s&&(!n||!o)?e:s+n+"."+o.toLowerCase()+"js"}):i}var Bt,rt,it,ls,Ut,ps,bs,C=fs(()=>{f();Bt=function(i,t){return Bt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])},Bt(i,t)};rt=function(){return rt=Object.assign||function(t){for(var e,r=1,s=arguments.length;r<s;r++){e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},rt.apply(this,arguments)};it=Object.create?(function(i,t,e,r){r===void 0&&(r=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(i,r,s)}):(function(i,t,e,r){r===void 0&&(r=e),i[r]=t[e]});ls=Object.create?(function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}):function(i,t){i.default=t},Ut=function(i){return Ut=Object.getOwnPropertyNames||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[e.length]=r);return e},Ut(i)};ps=typeof SuppressedError=="function"?SuppressedError:function(i,t,e){var r=new Error(e);return r.name="SuppressedError",r.error=i,r.suppressed=t,r};bs={__extends:De,__assign:rt,__rest:Fe,__decorate:He,__param:Je,__esDecorate:We,__runInitializers:Ye,__propKey:Ge,__setFunctionName:ze,__metadata:Ke,__awaiter:Xe,__generator:Qe,__createBinding:it,__exportStar:Ze,__values:st,__read:Vt,__spread:tr,__spreadArrays:er,__spreadArray:rr,__await:H,__asyncGenerator:sr,__asyncDelegator:ir,__asyncValues:nr,__makeTemplateObject:or,__importStar:cr,__importDefault:ar,__classPrivateFieldGet:ur,__classPrivateFieldSet:hr,__classPrivateFieldIn:fr,__addDisposableResource:dr,__disposeResources:lr,__rewriteRelativeImportExtension:pr}});var wr=p(br=>{"use strict";f();Object.defineProperty(br,"__esModule",{value:!0})});var yr=p(xr=>{"use strict";f();Object.defineProperty(xr,"__esModule",{value:!0})});var _r=p(J=>{"use strict";f();Object.defineProperty(J,"__esModule",{value:!0});J.decodeAsciiMax15=J.decodeAscii=void 0;var A=String.fromCharCode,ws=(i,t,e)=>{let r=[];for(let s=0;s<e;s++){let n=i[t++];if(n&128)return;r.push(n)}return A.apply(String,r)};J.decodeAscii=ws;var xs=(i,t,e)=>{if(e<4)if(e<2){if(e===0)return"";{let r=i[t++];if((r&128)>1){t-=1;return}return A(r)}}else{let r=i[t++],s=i[t++];if((r&128)>0||(s&128)>0){t-=2;return}if(e<3)return A(r,s);let n=i[t++];if((n&128)>0){t-=3;return}return A(r,s,n)}else{let r=i[t++],s=i[t++],n=i[t++],o=i[t++];if((r&128)>0||(s&128)>0||(n&128)>0||(o&128)>0){t-=4;return}if(e<6){if(e===4)return A(r,s,n,o);{let c=i[t++];if((c&128)>0){t-=5;return}return A(r,s,n,o,c)}}else if(e<8){let c=i[t++],u=i[t++];if((c&128)>0||(u&128)>0){t-=6;return}if(e<7)return A(r,s,n,o,c,u);let h=i[t++];if((h&128)>0){t-=7;return}return A(r,s,n,o,c,u,h)}else{let c=i[t++],u=i[t++],h=i[t++],a=i[t++];if((c&128)>0||(u&128)>0||(h&128)>0||(a&128)>0){t-=8;return}if(e<10){if(e===8)return A(r,s,n,o,c,u,h,a);{let d=i[t++];if((d&128)>0){t-=9;return}return A(r,s,n,o,c,u,h,a,d)}}else if(e<12){let d=i[t++],w=i[t++];if((d&128)>0||(w&128)>0){t-=10;return}if(e<11)return A(r,s,n,o,c,u,h,a,d,w);let l=i[t++];if((l&128)>0){t-=11;return}return A(r,s,n,o,c,u,h,a,d,w,l)}else{let d=i[t++],w=i[t++],l=i[t++],_=i[t++];if((d&128)>0||(w&128)>0||(l&128)>0||(_&128)>0){t-=12;return}if(e<14){if(e===12)return A(r,s,n,o,c,u,h,a,d,w,l,_);{let k=i[t++];if((k&128)>0){t-=13;return}return A(r,s,n,o,c,u,h,a,d,w,l,_,k)}}else{let k=i[t++],j=i[t++];if((k&128)>0||(j&128)>0){t-=14;return}if(e<15)return A(r,s,n,o,c,u,h,a,d,w,l,_,k,j);let T=i[t++];if((T&128)>0){t-=15;return}return A(r,s,n,o,c,u,h,a,d,w,l,_,k,j,T)}}}}};J.decodeAsciiMax15=xs});var vr=p(Lt=>{"use strict";f();Object.defineProperty(Lt,"__esModule",{value:!0});var ys=String.fromCharCode;Lt.default=(i,t,e)=>{let r=t,s=r+e,n=[];for(;r<s;){let o=i[r++];if((o&128)!==0){let c=i[r++]&63;if((o&224)===192)o=(o&31)<<6|c;else{let u=i[r++]&63;if((o&240)===224)o=(o&31)<<12|c<<6|u;else if((o&248)===240){let h=i[r++]&63,a=(o&7)<<18|c<<12|u<<6|h;if(a>65535){a-=65536;let d=a>>>10&1023|55296;o=56320|a&1023,n.push(d)}else o=a}}}n.push(o)}return ys.apply(String,n)}});var mr=p(Rt=>{"use strict";f();Object.defineProperty(Rt,"__esModule",{value:!0});var _s=(C(),N(P)),gr=_r(),$t=_s.__importDefault(vr()),jr=typeof Buffer<"u",kr=jr?Buffer.prototype.utf8Slice:null,Or=jr?Buffer.from:null,vs=(i,t,e)=>(0,gr.decodeAsciiMax15)(i,t,e)??(0,$t.default)(i,t,e),ks=(i,t,e)=>(0,gr.decodeAscii)(i,t,e)??(0,$t.default)(i,t,e),Os=kr?(i,t,e)=>kr.call(i,t,t+e):Or?(i,t,e)=>Or(i).subarray(t,t+e).toString("utf8"):$t.default,gs=(i,t,e)=>e<16?vs(i,t,e):e<32?ks(i,t,e):Os(i,t,e);Rt.default=gs});var Sr=p(nt=>{"use strict";f();Object.defineProperty(nt,"__esModule",{value:!0});nt.decodeUtf8=void 0;var js=(C(),N(P)),ms=js.__importDefault(mr());nt.decodeUtf8=ms.default});var Ft=p(ot=>{"use strict";f();Object.defineProperty(ot,"__esModule",{value:!0});ot.Reader=void 0;var Ss=Sr(),Dt=class i{constructor(t=new Uint8Array([]),e=new DataView(t.buffer,t.byteOffset,t.length),r=0,s=t.length){this.uint8=t,this.view=e,this.x=r,this.end=s}reset(t){this.x=0,this.uint8=t,this.view=new DataView(t.buffer,t.byteOffset,t.length)}size(){return this.end-this.x}peek(){return this.view.getUint8(this.x)}peak(){return this.peek()}skip(t){this.x+=t}buf(t=this.size()){let e=this.x,r=e+t,s=this.uint8.subarray(e,r);return this.x=r,s}subarray(t=0,e){let r=this.x,s=r+t,n=typeof e=="number"?r+e:this.end;return this.uint8.subarray(s,n)}slice(t=0,e){let r=this.x,s=r+t,n=typeof e=="number"?r+e:this.end;return new i(this.uint8,this.view,s,n)}cut(t=this.size()){let e=this.slice(0,t);return this.skip(t),e}u8(){return this.uint8[this.x++]}i8(){return this.view.getInt8(this.x++)}u16(){let t=this.x,e=(this.uint8[t++]<<8)+this.uint8[t++];return this.x=t,e}i16(){let t=this.view.getInt16(this.x);return this.x+=2,t}u32(){let t=this.view.getUint32(this.x);return this.x+=4,t}i32(){let t=this.view.getInt32(this.x);return this.x+=4,t}u64(){let t=this.view.getBigUint64(this.x);return this.x+=8,t}i64(){let t=this.view.getBigInt64(this.x);return this.x+=8,t}f32(){let t=this.x;return this.x+=4,this.view.getFloat32(t)}f64(){let t=this.x;return this.x+=8,this.view.getFloat64(t)}utf8(t){let e=this.x;return this.x+=t,(0,Ss.decodeUtf8)(this.uint8,e,t)}ascii(t){let e=this.uint8,r="",s=this.x+t;for(let n=this.x;n<s;n++)r+=String.fromCharCode(e[n]);return this.x=s,r}};ot.Reader=Dt});var Jt=p(ct=>{"use strict";f();Object.defineProperty(ct,"__esModule",{value:!0});ct.CrdtReader=void 0;var As=Ft(),Is=q(),Ht=class extends As.Reader{id(){let t=this.u8();return t<=127?[t>>>4,t&15]:(this.x--,[this.b1vu56()[1],this.vu57()])}idSkip(){this.u8()<=127||(this.x--,this.b1vu56(),this.vu57Skip())}vu57(){let t=this.u8();if(t<=127)return t;let e=this.u8();if(e<=127)return e<<7|t&127;let r=this.u8();if(r<=127)return r<<14|(e&127)<<7|t&127;let s=this.u8();if(s<=127)return s<<21|(r&127)<<14|(e&127)<<7|t&127;let n=this.u8();if(n<=127)return n*268435456+((s&127)<<21|(r&127)<<14|(e&127)<<7|t&127);let o=this.u8();if(o<=127)return o*34359738368+((n&127)*268435456+((s&127)<<21|(r&127)<<14|(e&127)<<7|t&127));let c=this.u8();return c<=127?c*4398046511104+((o&127)*34359738368+((n&127)*268435456+((s&127)<<21|(r&127)<<14|(e&127)<<7|t&127))):this.u8()*562949953421312+((c&127)*4398046511104+((o&127)*34359738368+((n&127)*268435456+((s&127)<<21|(r&127)<<14|(e&127)<<7|t&127))))}vu57Skip(){this.u8()<=127||this.u8()<=127||this.u8()<=127||this.u8()<=127||this.u8()<=127||this.u8()<=127||this.u8()<=127||this.x++}b1vu56(){let t=this.u8(),e=t&128?1:0,r=127&t;if(r<=63)return[e,r];let s=this.u8();if(s<=127)return[e,s<<6|r&63];let n=this.u8();if(n<=127)return[e,n<<13|(s&127)<<6|r&63];let o=this.u8();if(o<=127)return[e,o<<20|(n&127)<<13|(s&127)<<6|r&63];let c=this.u8();if(c<=127)return[e,c*134217728+((o&127)<<20|(n&127)<<13|(s&127)<<6|r&63)];let u=this.u8();if(u<=127)return[e,u*17179869184+((c&127)*134217728+((o&127)<<20|(n&127)<<13|(s&127)<<6|r&63))];let h=this.u8();if(h<=127)return[e,h*2199023255552+((u&127)*17179869184+((c&127)*134217728+((o&127)<<20|(n&127)<<13|(s&127)<<6|r&63)))];let a=this.u8();return[e,a*281474976710656+((h&127)*2199023255552+((u&127)*17179869184+((c&127)*134217728+((o&127)<<20|(n&127)<<13|(s&127)<<6|r&63))))]}vv(){let t=this.vu57(),e=[];for(let r=0;r<t;r++){let s=this.vu57(),n=this.vu57();e.push(new Is.Timestamp(s,n))}return e}};ct.CrdtReader=Ht});var Ar=p(at=>{"use strict";f();Object.defineProperty(at,"__esModule",{value:!0});at.Slice=void 0;var Wt=class{constructor(t,e,r,s){this.uint8=t,this.view=e,this.start=r,this.end=s}subarray(){return this.uint8.subarray(this.start,this.end)}};at.Slice=Wt});var Gt=p(ut=>{"use strict";f();Object.defineProperty(ut,"__esModule",{value:!0});ut.Writer=void 0;var Ts=Ar(),Ps=new Uint8Array([]),Cs=new DataView(Ps.buffer),Cr=typeof Buffer=="function",Ir=Cr?Buffer.prototype.utf8Write:null,Tr=Cr?Buffer.from:null,Pr=typeof TextEncoder<"u"?new TextEncoder:null,Yt=class{constructor(t=64*1024){this.allocSize=t,this.view=Cs,this.x0=0,this.x=0,this.uint8=new Uint8Array(t),this.size=t,this.view=new DataView(this.uint8.buffer)}grow(t){let e=this.x0,r=this.x,s=this.uint8,n=new Uint8Array(t),o=new DataView(n.buffer),c=s.subarray(e,r);n.set(c,0),this.x=r-e,this.x0=0,this.uint8=n,this.size=t,this.view=o}ensureCapacity(t){let e=this.size,r=e-this.x;if(r<t){let s=e-this.x0,n=t-r,o=s+n;this.grow(o<=this.allocSize?this.allocSize:o*2)}}move(t){this.ensureCapacity(t),this.x+=t}reset(){this.x0=this.x}newBuffer(t){let e=this.uint8=new Uint8Array(t);this.size=t,this.view=new DataView(e.buffer),this.x=this.x0=0}flush(){let t=this.uint8.subarray(this.x0,this.x);return this.x0=this.x,t}flushSlice(){let t=new Ts.Slice(this.uint8,this.view,this.x0,this.x);return this.x0=this.x,t}u8(t){this.ensureCapacity(1),this.uint8[this.x++]=t}u16(t){this.ensureCapacity(2),this.view.setUint16(this.x,t),this.x+=2}u32(t){this.ensureCapacity(4),this.view.setUint32(this.x,t),this.x+=4}i32(t){this.ensureCapacity(4),this.view.setInt32(this.x,t),this.x+=4}u64(t){this.ensureCapacity(8),this.view.setBigUint64(this.x,BigInt(t)),this.x+=8}f64(t){this.ensureCapacity(8),this.view.setFloat64(this.x,t),this.x+=8}u8u16(t,e){this.ensureCapacity(3);let r=this.x;this.uint8[r++]=t,this.uint8[r++]=e>>>8,this.uint8[r++]=e&255,this.x=r}u8u32(t,e){this.ensureCapacity(5);let r=this.x;this.uint8[r++]=t,this.view.setUint32(r,e),this.x=r+4}u8u64(t,e){this.ensureCapacity(9);let r=this.x;this.uint8[r++]=t,this.view.setBigUint64(r,BigInt(e)),this.x=r+8}u8f32(t,e){this.ensureCapacity(5);let r=this.x;this.uint8[r++]=t,this.view.setFloat32(r,e),this.x=r+4}u8f64(t,e){this.ensureCapacity(9);let r=this.x;this.uint8[r++]=t,this.view.setFloat64(r,e),this.x=r+8}buf(t,e){this.ensureCapacity(e);let r=this.x;this.uint8.set(t,r),this.x=r+e}utf8(t){let e=t.length*4;if(e<168)return this.utf8Native(t);this.ensureCapacity(e);let r=this.size-this.x;if(Ir){let s=Ir.call(this.uint8,t,this.x,r);return this.x+=s,s}else if(Tr){let s=this.uint8,n=s.byteOffset+this.x,c=Tr(s.buffer).subarray(n,n+r).write(t,0,r,"utf8");return this.x+=c,c}else if(e>1024&&Pr){let s=Pr.encodeInto(t,this.uint8.subarray(this.x,this.x+r)).written;return this.x+=s,s}return this.utf8Native(t)}utf8Native(t){let e=t.length,r=this.uint8,s=this.x,n=0;for(;n<e;){let c=t.charCodeAt(n++);if((c&4294967168)===0){r[s++]=c;continue}else if((c&4294965248)===0)r[s++]=c>>6&31|192;else{if(c>=55296&&c<=56319&&n<e){let u=t.charCodeAt(n);(u&64512)===56320&&(n++,c=((c&1023)<<10)+(u&1023)+65536)}(c&4294901760)===0?(r[s++]=c>>12&15|224,r[s++]=c>>6&63|128):(r[s++]=c>>18&7|240,r[s++]=c>>12&63|128,r[s++]=c>>6&63|128)}r[s++]=c&63|128}let o=s-this.x;return this.x=s,o}ascii(t){let e=t.length;this.ensureCapacity(e);let r=this.uint8,s=this.x,n=0;for(;n<e;)r[s++]=t.charCodeAt(n++);this.x=s}};ut.Writer=Yt});var ft=p(ht=>{"use strict";f();Object.defineProperty(ht,"__esModule",{value:!0});ht.CrdtWriter=void 0;var Ns=Gt(),zt=class extends Ns.Writer{id(t,e){t<=7&&e<=15?this.u8(t<<4|e):(this.b1vu56(1,t),this.vu57(e))}vu57(t){if(t<=127)this.u8(t);else if(t<=16383){this.ensureCapacity(2);let e=this.uint8;e[this.x++]=128|t&127,e[this.x++]=t>>>7}else if(t<=2097151){this.ensureCapacity(3);let e=this.uint8;e[this.x++]=128|t&127,e[this.x++]=128|t>>>7&127,e[this.x++]=t>>>14}else if(t<=268435455){this.ensureCapacity(4);let e=this.uint8;e[this.x++]=128|t&127,e[this.x++]=128|t>>>7&127,e[this.x++]=128|t>>>14&127,e[this.x++]=t>>>21}else{let e=t|0;e<0&&(e+=4294967296);let r=(t-e)/4294967296;if(t<=34359738367){this.ensureCapacity(5);let s=this.uint8;s[this.x++]=128|t&127,s[this.x++]=128|t>>>7&127,s[this.x++]=128|t>>>14&127,s[this.x++]=128|t>>>21&127,s[this.x++]=r<<4|t>>>28}else if(t<=4398046511103){this.ensureCapacity(6);let s=this.uint8;s[this.x++]=128|t&127,s[this.x++]=128|t>>>7&127,s[this.x++]=128|t>>>14&127,s[this.x++]=128|t>>>21&127,s[this.x++]=128|(r&7)<<4|t>>>28,s[this.x++]=r>>>3}else if(t<=562949953421311){this.ensureCapacity(7);let s=this.uint8;s[this.x++]=128|t&127,s[this.x++]=128|t>>>7&127,s[this.x++]=128|t>>>14&127,s[this.x++]=128|t>>>21&127,s[this.x++]=128|(r&7)<<4|t>>>28,s[this.x++]=128|(r&1016)>>>3,s[this.x++]=r>>>10}else{this.ensureCapacity(8);let s=this.uint8;s[this.x++]=128|t&127,s[this.x++]=128|t>>>7&127,s[this.x++]=128|t>>>14&127,s[this.x++]=128|t>>>21&127,s[this.x++]=128|(r&7)<<4|t>>>28,s[this.x++]=128|(r&1016)>>>3,s[this.x++]=128|(r&130048)>>>10,s[this.x++]=r>>>17}}}b1vu56(t,e){if(e<=63)this.u8(t<<7|e);else{let r=t<<7|64;if(e<=8191){this.ensureCapacity(2);let s=this.uint8;s[this.x++]=r|e&63,s[this.x++]=e>>>6}else if(e<=1048575){this.ensureCapacity(3);let s=this.uint8;s[this.x++]=r|e&63,s[this.x++]=128|e>>>6&127,s[this.x++]=e>>>13}else if(e<=134217727){this.ensureCapacity(4);let s=this.uint8;s[this.x++]=r|e&63,s[this.x++]=128|e>>>6&127,s[this.x++]=128|e>>>13&127,s[this.x++]=e>>>20}else{let s=e|0;s<0&&(s+=4294967296);let n=(e-s)/4294967296;if(e<=17179869183){this.ensureCapacity(5);let o=this.uint8;o[this.x++]=r|e&63,o[this.x++]=128|e>>>6&127,o[this.x++]=128|e>>>13&127,o[this.x++]=128|e>>>20&127,o[this.x++]=n<<5|e>>>27}else if(e<=2199023255551){this.ensureCapacity(6);let o=this.uint8;o[this.x++]=r|e&63,o[this.x++]=128|e>>>6&127,o[this.x++]=128|e>>>13&127,o[this.x++]=128|e>>>20&127,o[this.x++]=128|(n&3)<<5|e>>>27,o[this.x++]=n>>>2}else if(e<=0xffffffffffff){this.ensureCapacity(7);let o=this.uint8;o[this.x++]=r|e&63,o[this.x++]=128|e>>>6&127,o[this.x++]=128|e>>>13&127,o[this.x++]=128|e>>>20&127,o[this.x++]=128|(n&3)<<5|e>>>27,o[this.x++]=128|(n&508)>>>2,o[this.x++]=n>>>9}else{this.ensureCapacity(8);let o=this.uint8;o[this.x++]=r|e&63,o[this.x++]=128|e>>>6&127,o[this.x++]=128|e>>>13&127,o[this.x++]=128|e>>>20&127,o[this.x++]=128|(n&3)<<5|e>>>27,o[this.x++]=128|(n&508)>>>2,o[this.x++]=128|(n&65024)>>>9,o[this.x++]=n>>>16}}}}vv(t){let e=t.length;this.ensureCapacity(8+e*8*2),this.vu57(e);for(let r=0;r<e;r++){let s=t[r];this.vu57(s.sid),this.vu57(s.time)}}};ht.CrdtWriter=zt});var Nr=p(x=>{"use strict";f();Object.defineProperty(x,"__esModule",{value:!0});x.ServerClockVector=x.ClockVector=x.LogicalClock=x.interval=x.printTs=x.containsId=x.contains=x.compare=x.equal=x.tick=x.tss=x.ts=x.Timespan=x.Timestamp=void 0;var Es=Jt(),Ms=ft(),W=class{constructor(t,e){this.sid=t,this.time=e}};x.Timestamp=W;var G=class{constructor(t,e,r){this.sid=t,this.time=e,this.span=r}};x.Timespan=G;var qs=(i,t)=>new W(i,t);x.ts=qs;var Bs=(i,t,e)=>new G(i,t,e);x.tss=Bs;var Us=(i,t)=>(0,x.ts)(i.sid,i.time+t);x.tick=Us;var Vs=(i,t)=>i.time===t.time&&i.sid===t.sid;x.equal=Vs;var Ls=(i,t)=>{let e=i.time,r=t.time;if(e>r)return 1;if(e<r)return-1;let s=i.sid,n=t.sid;return s>n?1:s<n?-1:0};x.compare=Ls;var $s=(i,t,e,r)=>{if(i.sid!==e.sid)return!1;let s=i.time,n=e.time;return!(s>n||s+t<n+r)};x.contains=$s;var Rs=(i,t,e)=>{if(i.sid!==e.sid)return!1;let r=i.time,s=e.time;return!(r>s||r+t<s+1)};x.containsId=Rs;var Ds=i=>{if(i.sid===1)return"."+i.time;let t=""+i.sid;return t.length>4&&(t=".."+t.slice(t.length-4)),t+"."+i.time};x.printTs=Ds;var Fs=(i,t,e)=>new G(i.sid,i.time+t,e);x.interval=Fs;var dt=class extends W{tick(t){let e=new W(this.sid,this.time);return this.time+=t,e}};x.LogicalClock=dt;var lt=class i extends dt{constructor(){super(...arguments),this.peers=new Map}static from(t){let e=t.length;if(e===0)throw new Error("INV_VV");let r=t[0],s=new i(r.sid,r.time+1);for(let n=1;n<e;n++){let o=t[n];s.peers.set(o.sid,o)}return s}static fromU8(t){let r=new Es.CrdtReader(t).vv();return i.from(r)}vv(){let t=[(0,x.tick)(this,-1)];return this.peers.forEach(e=>t.push(e)),t}toU8(){let t=new Ms.CrdtWriter(64);return t.vv(this.vv()),t.flush()}observe(t,e){let r=t.time+e-1,s=t.sid;if(s!==this.sid){let n=this.peers.get(t.sid);n?r>n.time&&(n.time=r):this.peers.set(t.sid,(0,x.ts)(s,r))}r>=this.time&&(this.time=r+1)}has(t){let e=t.sid;if(e===this.sid)return t.time<this.time;let r=this.peers.get(e);return!!r&&t.time<=r.time}gap(t){let e=t.sid;if(e===this.sid){let n=t.time-this.time+1;return n>0?n:0}let r=this.peers.get(e);if(!r)return t.time;let s=t.time-r.time;return s>0?s:0}advanceCC(t){t.peers.forEach(r=>{this.observe(r,1)});let e=(0,x.tick)(t,-1);this.observe(e,1)}clone(){return this.fork(this.sid)}fork(t){let e=new i(t,this.time);return t!==this.sid&&e.observe((0,x.tick)(this,-1),1),this.peers.forEach(r=>{e.observe(r,1)}),e}toString(t=""){let e=this.peers.size,r=1,s="";return this.peers.forEach(n=>{s+=`
|
|
3
|
+
import{b as fs,c as p,d as ds,f as N,g as f}from"./chunk-WRU7YLUO.js";var P={};ds(P,{__addDisposableResource:()=>dr,__assign:()=>rt,__asyncDelegator:()=>ir,__asyncGenerator:()=>sr,__asyncValues:()=>nr,__await:()=>H,__awaiter:()=>Xe,__classPrivateFieldGet:()=>ur,__classPrivateFieldIn:()=>fr,__classPrivateFieldSet:()=>hr,__createBinding:()=>it,__decorate:()=>He,__disposeResources:()=>lr,__esDecorate:()=>We,__exportStar:()=>Ze,__extends:()=>De,__generator:()=>Qe,__importDefault:()=>ar,__importStar:()=>cr,__makeTemplateObject:()=>or,__metadata:()=>Ke,__param:()=>Je,__propKey:()=>Ge,__read:()=>Vt,__rest:()=>Fe,__rewriteRelativeImportExtension:()=>pr,__runInitializers:()=>Ye,__setFunctionName:()=>ze,__spread:()=>tr,__spreadArray:()=>rr,__spreadArrays:()=>er,__values:()=>st,default:()=>bs});function De(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Bt(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function Fe(i,t){var e={};for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&t.indexOf(r)<0&&(e[r]=i[r]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(i);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(i,r[s])&&(e[r[s]]=i[r[s]]);return e}function He(i,t,e,r){var s=arguments.length,n=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(i,t,e,r);else for(var c=i.length-1;c>=0;c--)(o=i[c])&&(n=(s<3?o(n):s>3?o(t,e,n):o(t,e))||n);return s>3&&n&&Object.defineProperty(t,e,n),n}function Je(i,t){return function(e,r){t(e,r,i)}}function We(i,t,e,r,s,n){function o(T){if(T!==void 0&&typeof T!="function")throw new TypeError("Function expected");return T}for(var c=r.kind,u=c==="getter"?"get":c==="setter"?"set":"value",h=!t&&i?r.static?i:i.prototype:null,a=t||(h?Object.getOwnPropertyDescriptor(h,r.name):{}),d,w=!1,l=e.length-1;l>=0;l--){var _={};for(var k in r)_[k]=k==="access"?{}:r[k];for(var k in r.access)_.access[k]=r.access[k];_.addInitializer=function(T){if(w)throw new TypeError("Cannot add initializers after decoration has completed");n.push(o(T||null))};var j=(0,e[l])(c==="accessor"?{get:a.get,set:a.set}:a[u],_);if(c==="accessor"){if(j===void 0)continue;if(j===null||typeof j!="object")throw new TypeError("Object expected");(d=o(j.get))&&(a.get=d),(d=o(j.set))&&(a.set=d),(d=o(j.init))&&s.unshift(d)}else(d=o(j))&&(c==="field"?s.unshift(d):a[u]=d)}h&&Object.defineProperty(h,r.name,a),w=!0}function Ye(i,t,e){for(var r=arguments.length>2,s=0;s<t.length;s++)e=r?t[s].call(i,e):t[s].call(i);return r?e:void 0}function Ge(i){return typeof i=="symbol"?i:"".concat(i)}function ze(i,t,e){return typeof t=="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(i,"name",{configurable:!0,value:e?"".concat(e," ",t):t})}function Ke(i,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,t)}function Xe(i,t,e,r){function s(n){return n instanceof e?n:new e(function(o){o(n)})}return new(e||(e=Promise))(function(n,o){function c(a){try{h(r.next(a))}catch(d){o(d)}}function u(a){try{h(r.throw(a))}catch(d){o(d)}}function h(a){a.done?n(a.value):s(a.value).then(c,u)}h((r=r.apply(i,t||[])).next())})}function Qe(i,t){var e={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},r,s,n,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=c(0),o.throw=c(1),o.return=c(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(h){return function(a){return u([h,a])}}function u(h){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,h[0]&&(e=0)),e;)try{if(r=1,s&&(n=h[0]&2?s.return:h[0]?s.throw||((n=s.return)&&n.call(s),0):s.next)&&!(n=n.call(s,h[1])).done)return n;switch(s=0,n&&(h=[h[0]&2,n.value]),h[0]){case 0:case 1:n=h;break;case 4:return e.label++,{value:h[1],done:!1};case 5:e.label++,s=h[1],h=[0];continue;case 7:h=e.ops.pop(),e.trys.pop();continue;default:if(n=e.trys,!(n=n.length>0&&n[n.length-1])&&(h[0]===6||h[0]===2)){e=0;continue}if(h[0]===3&&(!n||h[1]>n[0]&&h[1]<n[3])){e.label=h[1];break}if(h[0]===6&&e.label<n[1]){e.label=n[1],n=h;break}if(n&&e.label<n[2]){e.label=n[2],e.ops.push(h);break}n[2]&&e.ops.pop(),e.trys.pop();continue}h=t.call(i,e)}catch(a){h=[6,a],s=0}finally{r=n=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function Ze(i,t){for(var e in i)e!=="default"&&!Object.prototype.hasOwnProperty.call(t,e)&&it(t,i,e)}function st(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],r=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&r>=i.length&&(i=void 0),{value:i&&i[r++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Vt(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var r=e.call(i),s,n=[],o;try{for(;(t===void 0||t-- >0)&&!(s=r.next()).done;)n.push(s.value)}catch(c){o={error:c}}finally{try{s&&!s.done&&(e=r.return)&&e.call(r)}finally{if(o)throw o.error}}return n}function tr(){for(var i=[],t=0;t<arguments.length;t++)i=i.concat(Vt(arguments[t]));return i}function er(){for(var i=0,t=0,e=arguments.length;t<e;t++)i+=arguments[t].length;for(var r=Array(i),s=0,t=0;t<e;t++)for(var n=arguments[t],o=0,c=n.length;o<c;o++,s++)r[s]=n[o];return r}function rr(i,t,e){if(e||arguments.length===2)for(var r=0,s=t.length,n;r<s;r++)(n||!(r in t))&&(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return i.concat(n||Array.prototype.slice.call(t))}function H(i){return this instanceof H?(this.v=i,this):new H(i)}function sr(i,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=e.apply(i,t||[]),s,n=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(l){return function(_){return Promise.resolve(_).then(l,d)}}function c(l,_){r[l]&&(s[l]=function(k){return new Promise(function(j,T){n.push([l,k,j,T])>1||u(l,k)})},_&&(s[l]=_(s[l])))}function u(l,_){try{h(r[l](_))}catch(k){w(n[0][3],k)}}function h(l){l.value instanceof H?Promise.resolve(l.value.v).then(a,d):w(n[0][2],l)}function a(l){u("next",l)}function d(l){u("throw",l)}function w(l,_){l(_),n.shift(),n.length&&u(n[0][0],n[0][1])}}function ir(i){var t,e;return t={},r("next"),r("throw",function(s){throw s}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(s,n){t[s]=i[s]?function(o){return(e=!e)?{value:H(i[s](o)),done:!1}:n?n(o):o}:n}}function nr(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=i[Symbol.asyncIterator],e;return t?t.call(i):(i=typeof st=="function"?st(i):i[Symbol.iterator](),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=i[n]&&function(o){return new Promise(function(c,u){o=i[n](o),s(c,u,o.done,o.value)})}}function s(n,o,c,u){Promise.resolve(u).then(function(h){n({value:h,done:c})},o)}}function or(i,t){return Object.defineProperty?Object.defineProperty(i,"raw",{value:t}):i.raw=t,i}function cr(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var e=Ut(i),r=0;r<e.length;r++)e[r]!=="default"&&it(t,i,e[r]);return ls(t,i),t}function ar(i){return i&&i.__esModule?i:{default:i}}function ur(i,t,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?i!==t||!r:!t.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(i):r?r.value:t.get(i)}function hr(i,t,e,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?i!==t||!s:!t.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(i,e):s?s.value=e:t.set(i,e),e}function fr(i,t){if(t===null||typeof t!="object"&&typeof t!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof i=="function"?t===i:i.has(t)}function dr(i,t,e){if(t!=null){if(typeof t!="object"&&typeof t!="function")throw new TypeError("Object expected.");var r,s;if(e){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=t[Symbol.dispose],e&&(s=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");s&&(r=function(){try{s.call(this)}catch(n){return Promise.reject(n)}}),i.stack.push({value:t,dispose:r,async:e})}else e&&i.stack.push({async:!0});return t}function lr(i){function t(n){i.error=i.hasError?new ps(n,i.error,"An error was suppressed during disposal."):n,i.hasError=!0}var e,r=0;function s(){for(;e=i.stack.pop();)try{if(!e.async&&r===1)return r=0,i.stack.push(e),Promise.resolve().then(s);if(e.dispose){var n=e.dispose.call(e.value);if(e.async)return r|=2,Promise.resolve(n).then(s,function(o){return t(o),s()})}else r|=1}catch(o){t(o)}if(r===1)return i.hasError?Promise.reject(i.error):Promise.resolve();if(i.hasError)throw i.error}return s()}function pr(i,t){return typeof i=="string"&&/^\.\.?\//.test(i)?i.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,r,s,n,o){return r?t?".jsx":".js":s&&(!n||!o)?e:s+n+"."+o.toLowerCase()+"js"}):i}var Bt,rt,it,ls,Ut,ps,bs,C=fs(()=>{f();Bt=function(i,t){return Bt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])},Bt(i,t)};rt=function(){return rt=Object.assign||function(t){for(var e,r=1,s=arguments.length;r<s;r++){e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},rt.apply(this,arguments)};it=Object.create?(function(i,t,e,r){r===void 0&&(r=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(i,r,s)}):(function(i,t,e,r){r===void 0&&(r=e),i[r]=t[e]});ls=Object.create?(function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}):function(i,t){i.default=t},Ut=function(i){return Ut=Object.getOwnPropertyNames||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[e.length]=r);return e},Ut(i)};ps=typeof SuppressedError=="function"?SuppressedError:function(i,t,e){var r=new Error(e);return r.name="SuppressedError",r.error=i,r.suppressed=t,r};bs={__extends:De,__assign:rt,__rest:Fe,__decorate:He,__param:Je,__esDecorate:We,__runInitializers:Ye,__propKey:Ge,__setFunctionName:ze,__metadata:Ke,__awaiter:Xe,__generator:Qe,__createBinding:it,__exportStar:Ze,__values:st,__read:Vt,__spread:tr,__spreadArrays:er,__spreadArray:rr,__await:H,__asyncGenerator:sr,__asyncDelegator:ir,__asyncValues:nr,__makeTemplateObject:or,__importStar:cr,__importDefault:ar,__classPrivateFieldGet:ur,__classPrivateFieldSet:hr,__classPrivateFieldIn:fr,__addDisposableResource:dr,__disposeResources:lr,__rewriteRelativeImportExtension:pr}});var wr=p(br=>{"use strict";f();Object.defineProperty(br,"__esModule",{value:!0})});var yr=p(xr=>{"use strict";f();Object.defineProperty(xr,"__esModule",{value:!0})});var _r=p(J=>{"use strict";f();Object.defineProperty(J,"__esModule",{value:!0});J.decodeAsciiMax15=J.decodeAscii=void 0;var A=String.fromCharCode,ws=(i,t,e)=>{let r=[];for(let s=0;s<e;s++){let n=i[t++];if(n&128)return;r.push(n)}return A.apply(String,r)};J.decodeAscii=ws;var xs=(i,t,e)=>{if(e<4)if(e<2){if(e===0)return"";{let r=i[t++];if((r&128)>1){t-=1;return}return A(r)}}else{let r=i[t++],s=i[t++];if((r&128)>0||(s&128)>0){t-=2;return}if(e<3)return A(r,s);let n=i[t++];if((n&128)>0){t-=3;return}return A(r,s,n)}else{let r=i[t++],s=i[t++],n=i[t++],o=i[t++];if((r&128)>0||(s&128)>0||(n&128)>0||(o&128)>0){t-=4;return}if(e<6){if(e===4)return A(r,s,n,o);{let c=i[t++];if((c&128)>0){t-=5;return}return A(r,s,n,o,c)}}else if(e<8){let c=i[t++],u=i[t++];if((c&128)>0||(u&128)>0){t-=6;return}if(e<7)return A(r,s,n,o,c,u);let h=i[t++];if((h&128)>0){t-=7;return}return A(r,s,n,o,c,u,h)}else{let c=i[t++],u=i[t++],h=i[t++],a=i[t++];if((c&128)>0||(u&128)>0||(h&128)>0||(a&128)>0){t-=8;return}if(e<10){if(e===8)return A(r,s,n,o,c,u,h,a);{let d=i[t++];if((d&128)>0){t-=9;return}return A(r,s,n,o,c,u,h,a,d)}}else if(e<12){let d=i[t++],w=i[t++];if((d&128)>0||(w&128)>0){t-=10;return}if(e<11)return A(r,s,n,o,c,u,h,a,d,w);let l=i[t++];if((l&128)>0){t-=11;return}return A(r,s,n,o,c,u,h,a,d,w,l)}else{let d=i[t++],w=i[t++],l=i[t++],_=i[t++];if((d&128)>0||(w&128)>0||(l&128)>0||(_&128)>0){t-=12;return}if(e<14){if(e===12)return A(r,s,n,o,c,u,h,a,d,w,l,_);{let k=i[t++];if((k&128)>0){t-=13;return}return A(r,s,n,o,c,u,h,a,d,w,l,_,k)}}else{let k=i[t++],j=i[t++];if((k&128)>0||(j&128)>0){t-=14;return}if(e<15)return A(r,s,n,o,c,u,h,a,d,w,l,_,k,j);let T=i[t++];if((T&128)>0){t-=15;return}return A(r,s,n,o,c,u,h,a,d,w,l,_,k,j,T)}}}}};J.decodeAsciiMax15=xs});var vr=p(Lt=>{"use strict";f();Object.defineProperty(Lt,"__esModule",{value:!0});var ys=String.fromCharCode;Lt.default=(i,t,e)=>{let r=t,s=r+e,n=[];for(;r<s;){let o=i[r++];if((o&128)!==0){let c=i[r++]&63;if((o&224)===192)o=(o&31)<<6|c;else{let u=i[r++]&63;if((o&240)===224)o=(o&31)<<12|c<<6|u;else if((o&248)===240){let h=i[r++]&63,a=(o&7)<<18|c<<12|u<<6|h;if(a>65535){a-=65536;let d=a>>>10&1023|55296;o=56320|a&1023,n.push(d)}else o=a}}}n.push(o)}return ys.apply(String,n)}});var mr=p(Rt=>{"use strict";f();Object.defineProperty(Rt,"__esModule",{value:!0});var _s=(C(),N(P)),gr=_r(),$t=_s.__importDefault(vr()),jr=typeof Buffer<"u",kr=jr?Buffer.prototype.utf8Slice:null,Or=jr?Buffer.from:null,vs=(i,t,e)=>(0,gr.decodeAsciiMax15)(i,t,e)??(0,$t.default)(i,t,e),ks=(i,t,e)=>(0,gr.decodeAscii)(i,t,e)??(0,$t.default)(i,t,e),Os=kr?(i,t,e)=>kr.call(i,t,t+e):Or?(i,t,e)=>Or(i).subarray(t,t+e).toString("utf8"):$t.default,gs=(i,t,e)=>e<16?vs(i,t,e):e<32?ks(i,t,e):Os(i,t,e);Rt.default=gs});var Sr=p(nt=>{"use strict";f();Object.defineProperty(nt,"__esModule",{value:!0});nt.decodeUtf8=void 0;var js=(C(),N(P)),ms=js.__importDefault(mr());nt.decodeUtf8=ms.default});var Ft=p(ot=>{"use strict";f();Object.defineProperty(ot,"__esModule",{value:!0});ot.Reader=void 0;var Ss=Sr(),Dt=class i{constructor(t=new Uint8Array([]),e=new DataView(t.buffer,t.byteOffset,t.length),r=0,s=t.length){this.uint8=t,this.view=e,this.x=r,this.end=s}reset(t){this.x=0,this.uint8=t,this.view=new DataView(t.buffer,t.byteOffset,t.length)}size(){return this.end-this.x}peek(){return this.view.getUint8(this.x)}peak(){return this.peek()}skip(t){this.x+=t}buf(t=this.size()){let e=this.x,r=e+t,s=this.uint8.subarray(e,r);return this.x=r,s}subarray(t=0,e){let r=this.x,s=r+t,n=typeof e=="number"?r+e:this.end;return this.uint8.subarray(s,n)}slice(t=0,e){let r=this.x,s=r+t,n=typeof e=="number"?r+e:this.end;return new i(this.uint8,this.view,s,n)}cut(t=this.size()){let e=this.slice(0,t);return this.skip(t),e}u8(){return this.uint8[this.x++]}i8(){return this.view.getInt8(this.x++)}u16(){let t=this.x,e=(this.uint8[t++]<<8)+this.uint8[t++];return this.x=t,e}i16(){let t=this.view.getInt16(this.x);return this.x+=2,t}u32(){let t=this.view.getUint32(this.x);return this.x+=4,t}i32(){let t=this.view.getInt32(this.x);return this.x+=4,t}u64(){let t=this.view.getBigUint64(this.x);return this.x+=8,t}i64(){let t=this.view.getBigInt64(this.x);return this.x+=8,t}f32(){let t=this.x;return this.x+=4,this.view.getFloat32(t)}f64(){let t=this.x;return this.x+=8,this.view.getFloat64(t)}utf8(t){let e=this.x;return this.x+=t,(0,Ss.decodeUtf8)(this.uint8,e,t)}ascii(t){let e=this.uint8,r="",s=this.x+t;for(let n=this.x;n<s;n++)r+=String.fromCharCode(e[n]);return this.x=s,r}};ot.Reader=Dt});var Jt=p(ct=>{"use strict";f();Object.defineProperty(ct,"__esModule",{value:!0});ct.CrdtReader=void 0;var As=Ft(),Is=q(),Ht=class extends As.Reader{id(){let t=this.u8();return t<=127?[t>>>4,t&15]:(this.x--,[this.b1vu56()[1],this.vu57()])}idSkip(){this.u8()<=127||(this.x--,this.b1vu56(),this.vu57Skip())}vu57(){let t=this.u8();if(t<=127)return t;let e=this.u8();if(e<=127)return e<<7|t&127;let r=this.u8();if(r<=127)return r<<14|(e&127)<<7|t&127;let s=this.u8();if(s<=127)return s<<21|(r&127)<<14|(e&127)<<7|t&127;let n=this.u8();if(n<=127)return n*268435456+((s&127)<<21|(r&127)<<14|(e&127)<<7|t&127);let o=this.u8();if(o<=127)return o*34359738368+((n&127)*268435456+((s&127)<<21|(r&127)<<14|(e&127)<<7|t&127));let c=this.u8();return c<=127?c*4398046511104+((o&127)*34359738368+((n&127)*268435456+((s&127)<<21|(r&127)<<14|(e&127)<<7|t&127))):this.u8()*562949953421312+((c&127)*4398046511104+((o&127)*34359738368+((n&127)*268435456+((s&127)<<21|(r&127)<<14|(e&127)<<7|t&127))))}vu57Skip(){this.u8()<=127||this.u8()<=127||this.u8()<=127||this.u8()<=127||this.u8()<=127||this.u8()<=127||this.u8()<=127||this.x++}b1vu56(){let t=this.u8(),e=t&128?1:0,r=127&t;if(r<=63)return[e,r];let s=this.u8();if(s<=127)return[e,s<<6|r&63];let n=this.u8();if(n<=127)return[e,n<<13|(s&127)<<6|r&63];let o=this.u8();if(o<=127)return[e,o<<20|(n&127)<<13|(s&127)<<6|r&63];let c=this.u8();if(c<=127)return[e,c*134217728+((o&127)<<20|(n&127)<<13|(s&127)<<6|r&63)];let u=this.u8();if(u<=127)return[e,u*17179869184+((c&127)*134217728+((o&127)<<20|(n&127)<<13|(s&127)<<6|r&63))];let h=this.u8();if(h<=127)return[e,h*2199023255552+((u&127)*17179869184+((c&127)*134217728+((o&127)<<20|(n&127)<<13|(s&127)<<6|r&63)))];let a=this.u8();return[e,a*281474976710656+((h&127)*2199023255552+((u&127)*17179869184+((c&127)*134217728+((o&127)<<20|(n&127)<<13|(s&127)<<6|r&63))))]}vv(){let t=this.vu57(),e=[];for(let r=0;r<t;r++){let s=this.vu57(),n=this.vu57();e.push(new Is.Timestamp(s,n))}return e}};ct.CrdtReader=Ht});var Ar=p(at=>{"use strict";f();Object.defineProperty(at,"__esModule",{value:!0});at.Slice=void 0;var Wt=class{constructor(t,e,r,s){this.uint8=t,this.view=e,this.start=r,this.end=s}subarray(){return this.uint8.subarray(this.start,this.end)}};at.Slice=Wt});var Gt=p(ut=>{"use strict";f();Object.defineProperty(ut,"__esModule",{value:!0});ut.Writer=void 0;var Ts=Ar(),Ps=new Uint8Array([]),Cs=new DataView(Ps.buffer),Cr=typeof Buffer=="function",Ir=Cr?Buffer.prototype.utf8Write:null,Tr=Cr?Buffer.from:null,Pr=typeof TextEncoder<"u"?new TextEncoder:null,Yt=class{constructor(t=64*1024){this.allocSize=t,this.view=Cs,this.x0=0,this.x=0,this.uint8=new Uint8Array(t),this.size=t,this.view=new DataView(this.uint8.buffer)}grow(t){let e=this.x0,r=this.x,s=this.uint8,n=new Uint8Array(t),o=new DataView(n.buffer),c=s.subarray(e,r);n.set(c,0),this.x=r-e,this.x0=0,this.uint8=n,this.size=t,this.view=o}ensureCapacity(t){let e=this.size,r=e-this.x;if(r<t){let s=e-this.x0,n=t-r,o=s+n;this.grow(o<=this.allocSize?this.allocSize:o*2)}}move(t){this.ensureCapacity(t),this.x+=t}reset(){this.x0=this.x}newBuffer(t){let e=this.uint8=new Uint8Array(t);this.size=t,this.view=new DataView(e.buffer),this.x=this.x0=0}flush(){let t=this.uint8.subarray(this.x0,this.x);return this.x0=this.x,t}flushSlice(){let t=new Ts.Slice(this.uint8,this.view,this.x0,this.x);return this.x0=this.x,t}u8(t){this.ensureCapacity(1),this.uint8[this.x++]=t}u16(t){this.ensureCapacity(2),this.view.setUint16(this.x,t),this.x+=2}u32(t){this.ensureCapacity(4),this.view.setUint32(this.x,t),this.x+=4}i32(t){this.ensureCapacity(4),this.view.setInt32(this.x,t),this.x+=4}u64(t){this.ensureCapacity(8),this.view.setBigUint64(this.x,BigInt(t)),this.x+=8}f64(t){this.ensureCapacity(8),this.view.setFloat64(this.x,t),this.x+=8}u8u16(t,e){this.ensureCapacity(3);let r=this.x;this.uint8[r++]=t,this.uint8[r++]=e>>>8,this.uint8[r++]=e&255,this.x=r}u8u32(t,e){this.ensureCapacity(5);let r=this.x;this.uint8[r++]=t,this.view.setUint32(r,e),this.x=r+4}u8u64(t,e){this.ensureCapacity(9);let r=this.x;this.uint8[r++]=t,this.view.setBigUint64(r,BigInt(e)),this.x=r+8}u8f32(t,e){this.ensureCapacity(5);let r=this.x;this.uint8[r++]=t,this.view.setFloat32(r,e),this.x=r+4}u8f64(t,e){this.ensureCapacity(9);let r=this.x;this.uint8[r++]=t,this.view.setFloat64(r,e),this.x=r+8}buf(t,e){this.ensureCapacity(e);let r=this.x;this.uint8.set(t,r),this.x=r+e}utf8(t){let e=t.length*4;if(e<168)return this.utf8Native(t);this.ensureCapacity(e);let r=this.size-this.x;if(Ir){let s=Ir.call(this.uint8,t,this.x,r);return this.x+=s,s}else if(Tr){let s=this.uint8,n=s.byteOffset+this.x,c=Tr(s.buffer).subarray(n,n+r).write(t,0,r,"utf8");return this.x+=c,c}else if(e>1024&&Pr){let s=Pr.encodeInto(t,this.uint8.subarray(this.x,this.x+r)).written;return this.x+=s,s}return this.utf8Native(t)}utf8Native(t){let e=t.length,r=this.uint8,s=this.x,n=0;for(;n<e;){let c=t.charCodeAt(n++);if((c&4294967168)===0){r[s++]=c;continue}else if((c&4294965248)===0)r[s++]=c>>6&31|192;else{if(c>=55296&&c<=56319&&n<e){let u=t.charCodeAt(n);(u&64512)===56320&&(n++,c=((c&1023)<<10)+(u&1023)+65536)}(c&4294901760)===0?(r[s++]=c>>12&15|224,r[s++]=c>>6&63|128):(r[s++]=c>>18&7|240,r[s++]=c>>12&63|128,r[s++]=c>>6&63|128)}r[s++]=c&63|128}let o=s-this.x;return this.x=s,o}ascii(t){let e=t.length;this.ensureCapacity(e);let r=this.uint8,s=this.x,n=0;for(;n<e;)r[s++]=t.charCodeAt(n++);this.x=s}};ut.Writer=Yt});var ft=p(ht=>{"use strict";f();Object.defineProperty(ht,"__esModule",{value:!0});ht.CrdtWriter=void 0;var Ns=Gt(),zt=class extends Ns.Writer{id(t,e){t<=7&&e<=15?this.u8(t<<4|e):(this.b1vu56(1,t),this.vu57(e))}vu57(t){if(t<=127)this.u8(t);else if(t<=16383){this.ensureCapacity(2);let e=this.uint8;e[this.x++]=128|t&127,e[this.x++]=t>>>7}else if(t<=2097151){this.ensureCapacity(3);let e=this.uint8;e[this.x++]=128|t&127,e[this.x++]=128|t>>>7&127,e[this.x++]=t>>>14}else if(t<=268435455){this.ensureCapacity(4);let e=this.uint8;e[this.x++]=128|t&127,e[this.x++]=128|t>>>7&127,e[this.x++]=128|t>>>14&127,e[this.x++]=t>>>21}else{let e=t|0;e<0&&(e+=4294967296);let r=(t-e)/4294967296;if(t<=34359738367){this.ensureCapacity(5);let s=this.uint8;s[this.x++]=128|t&127,s[this.x++]=128|t>>>7&127,s[this.x++]=128|t>>>14&127,s[this.x++]=128|t>>>21&127,s[this.x++]=r<<4|t>>>28}else if(t<=4398046511103){this.ensureCapacity(6);let s=this.uint8;s[this.x++]=128|t&127,s[this.x++]=128|t>>>7&127,s[this.x++]=128|t>>>14&127,s[this.x++]=128|t>>>21&127,s[this.x++]=128|(r&7)<<4|t>>>28,s[this.x++]=r>>>3}else if(t<=562949953421311){this.ensureCapacity(7);let s=this.uint8;s[this.x++]=128|t&127,s[this.x++]=128|t>>>7&127,s[this.x++]=128|t>>>14&127,s[this.x++]=128|t>>>21&127,s[this.x++]=128|(r&7)<<4|t>>>28,s[this.x++]=128|(r&1016)>>>3,s[this.x++]=r>>>10}else{this.ensureCapacity(8);let s=this.uint8;s[this.x++]=128|t&127,s[this.x++]=128|t>>>7&127,s[this.x++]=128|t>>>14&127,s[this.x++]=128|t>>>21&127,s[this.x++]=128|(r&7)<<4|t>>>28,s[this.x++]=128|(r&1016)>>>3,s[this.x++]=128|(r&130048)>>>10,s[this.x++]=r>>>17}}}b1vu56(t,e){if(e<=63)this.u8(t<<7|e);else{let r=t<<7|64;if(e<=8191){this.ensureCapacity(2);let s=this.uint8;s[this.x++]=r|e&63,s[this.x++]=e>>>6}else if(e<=1048575){this.ensureCapacity(3);let s=this.uint8;s[this.x++]=r|e&63,s[this.x++]=128|e>>>6&127,s[this.x++]=e>>>13}else if(e<=134217727){this.ensureCapacity(4);let s=this.uint8;s[this.x++]=r|e&63,s[this.x++]=128|e>>>6&127,s[this.x++]=128|e>>>13&127,s[this.x++]=e>>>20}else{let s=e|0;s<0&&(s+=4294967296);let n=(e-s)/4294967296;if(e<=17179869183){this.ensureCapacity(5);let o=this.uint8;o[this.x++]=r|e&63,o[this.x++]=128|e>>>6&127,o[this.x++]=128|e>>>13&127,o[this.x++]=128|e>>>20&127,o[this.x++]=n<<5|e>>>27}else if(e<=2199023255551){this.ensureCapacity(6);let o=this.uint8;o[this.x++]=r|e&63,o[this.x++]=128|e>>>6&127,o[this.x++]=128|e>>>13&127,o[this.x++]=128|e>>>20&127,o[this.x++]=128|(n&3)<<5|e>>>27,o[this.x++]=n>>>2}else if(e<=0xffffffffffff){this.ensureCapacity(7);let o=this.uint8;o[this.x++]=r|e&63,o[this.x++]=128|e>>>6&127,o[this.x++]=128|e>>>13&127,o[this.x++]=128|e>>>20&127,o[this.x++]=128|(n&3)<<5|e>>>27,o[this.x++]=128|(n&508)>>>2,o[this.x++]=n>>>9}else{this.ensureCapacity(8);let o=this.uint8;o[this.x++]=r|e&63,o[this.x++]=128|e>>>6&127,o[this.x++]=128|e>>>13&127,o[this.x++]=128|e>>>20&127,o[this.x++]=128|(n&3)<<5|e>>>27,o[this.x++]=128|(n&508)>>>2,o[this.x++]=128|(n&65024)>>>9,o[this.x++]=n>>>16}}}}vv(t){let e=t.length;this.ensureCapacity(8+e*8*2),this.vu57(e);for(let r=0;r<e;r++){let s=t[r];this.vu57(s.sid),this.vu57(s.time)}}};ht.CrdtWriter=zt});var Nr=p(x=>{"use strict";f();Object.defineProperty(x,"__esModule",{value:!0});x.ServerClockVector=x.ClockVector=x.LogicalClock=x.interval=x.printTs=x.containsId=x.contains=x.compare=x.equal=x.tick=x.tss=x.ts=x.Timespan=x.Timestamp=void 0;var Es=Jt(),Ms=ft(),W=class{constructor(t,e){this.sid=t,this.time=e}};x.Timestamp=W;var G=class{constructor(t,e,r){this.sid=t,this.time=e,this.span=r}};x.Timespan=G;var qs=(i,t)=>new W(i,t);x.ts=qs;var Bs=(i,t,e)=>new G(i,t,e);x.tss=Bs;var Us=(i,t)=>(0,x.ts)(i.sid,i.time+t);x.tick=Us;var Vs=(i,t)=>i.time===t.time&&i.sid===t.sid;x.equal=Vs;var Ls=(i,t)=>{let e=i.time,r=t.time;if(e>r)return 1;if(e<r)return-1;let s=i.sid,n=t.sid;return s>n?1:s<n?-1:0};x.compare=Ls;var $s=(i,t,e,r)=>{if(i.sid!==e.sid)return!1;let s=i.time,n=e.time;return!(s>n||s+t<n+r)};x.contains=$s;var Rs=(i,t,e)=>{if(i.sid!==e.sid)return!1;let r=i.time,s=e.time;return!(r>s||r+t<s+1)};x.containsId=Rs;var Ds=i=>{if(i.sid===1)return"."+i.time;let t=""+i.sid;return t.length>4&&(t=".."+t.slice(t.length-4)),t+"."+i.time};x.printTs=Ds;var Fs=(i,t,e)=>new G(i.sid,i.time+t,e);x.interval=Fs;var dt=class extends W{tick(t){let e=new W(this.sid,this.time);return this.time+=t,e}};x.LogicalClock=dt;var lt=class i extends dt{constructor(){super(...arguments),this.peers=new Map}static from(t){let e=t.length;if(e===0)throw new Error("INV_VV");let r=t[0],s=new i(r.sid,r.time+1);for(let n=1;n<e;n++){let o=t[n];s.peers.set(o.sid,o)}return s}static fromU8(t){let r=new Es.CrdtReader(t).vv();return i.from(r)}vv(){let t=[(0,x.tick)(this,-1)];return this.peers.forEach(e=>t.push(e)),t}toU8(){let t=new Ms.CrdtWriter(64);return t.vv(this.vv()),t.flush()}observe(t,e){let r=t.time+e-1,s=t.sid;if(s!==this.sid){let n=this.peers.get(t.sid);n?r>n.time&&(n.time=r):this.peers.set(t.sid,(0,x.ts)(s,r))}r>=this.time&&(this.time=r+1)}has(t){let e=t.sid;if(e===this.sid)return t.time<this.time;let r=this.peers.get(e);return!!r&&t.time<=r.time}gap(t){let e=t.sid;if(e===this.sid){let n=t.time-this.time+1;return n>0?n:0}let r=this.peers.get(e);if(!r)return t.time;let s=t.time-r.time;return s>0?s:0}advanceCC(t){t.peers.forEach(r=>{this.observe(r,1)});let e=(0,x.tick)(t,-1);this.observe(e,1)}clone(){return this.fork(this.sid)}fork(t){let e=new i(t,this.time);return t!==this.sid&&e.observe((0,x.tick)(this,-1),1),this.peers.forEach(r=>{e.observe(r,1)}),e}toString(t=""){let e=this.peers.size,r=1,s="";return this.peers.forEach(n=>{s+=`
|
|
4
4
|
${t}${r===e?"\u2514\u2500":"\u251C\u2500"} ${n.sid}.${n.time}`,r++}),`clock ${this.sid}.${this.time}${s}`}};x.ClockVector=lt;var Kt=class i extends lt{constructor(){super(...arguments),this.peers=new Map}observe(t,e){if(t.sid>8)throw new Error("INV_SERVER_SESSION");if(this.time<t.time)throw new Error("TIME_TRAVEL");let r=t.time+e;r>this.time&&(this.time=r)}clone(){return this.fork()}fork(){return new i(1,this.time)}};x.ServerClockVector=Kt});var q=p(pt=>{"use strict";f();Object.defineProperty(pt,"__esModule",{value:!0});var Er=(C(),N(P));Er.__exportStar(yr(),pt);Er.__exportStar(Nr(),pt)});var wt=p(bt=>{"use strict";f();Object.defineProperty(bt,"__esModule",{value:!0});bt.printTree=void 0;var Hs=(i="",t)=>{let e="",r=t.length-1;for(;r>=0&&!t[r];r--);for(let s=0;s<=r;s++){let n=t[s];if(!n)continue;let o=s===r,c=n(i+(o?" ":"\u2502")+" "),u=c?o?"\u2514\u2500":"\u251C\u2500":"\u2502";e+=`
|
|
5
5
|
`+i+u+(c?" "+c:"")}return e};bt.printTree=Hs});var z=p(y=>{"use strict";f();Object.defineProperty(y,"__esModule",{value:!0});y.NopOp=y.DelOp=y.UpdArrOp=y.InsArrOp=y.InsBinOp=y.InsStrOp=y.InsVecOp=y.InsObjOp=y.InsValOp=y.NewArrOp=y.NewBinOp=y.NewStrOp=y.NewVecOp=y.NewObjOp=y.NewValOp=y.NewConOp=void 0;var Mr=wt(),g=q(),m=class{constructor(t){this.id=t}span(){return 1}toString(){let t=this.name()+" "+(0,g.printTs)(this.id),e=this.span();return e>1&&(t+="!"+e),t}},Xt=class extends m{constructor(t,e){super(t),this.id=t,this.val=e}name(){return"new_con"}toString(){let t=this.val,e="Uint8Array",r=t instanceof g.Timestamp?`{ ${(0,g.printTs)(t)} }`:t instanceof Uint8Array?t.length<13?`${e} { ${(""+t).replaceAll(",",", ")} }`:`${e}(${t.length})`:`{ ${JSON.stringify(t)} }`;return super.toString()+" "+r}};y.NewConOp=Xt;var Qt=class extends m{name(){return"new_val"}};y.NewValOp=Qt;var Zt=class extends m{name(){return"new_obj"}};y.NewObjOp=Zt;var te=class extends m{name(){return"new_vec"}};y.NewVecOp=te;var ee=class extends m{name(){return"new_str"}};y.NewStrOp=ee;var re=class extends m{name(){return"new_bin"}};y.NewBinOp=re;var se=class extends m{name(){return"new_arr"}};y.NewArrOp=se;var ie=class extends m{constructor(t,e,r){super(t),this.id=t,this.obj=e,this.val=r}name(){return"ins_val"}toString(){return super.toString()+`, obj = ${(0,g.printTs)(this.obj)}, val = ${(0,g.printTs)(this.val)}`}};y.InsValOp=ie;var ne=class extends m{constructor(t,e,r){super(t),this.id=t,this.obj=e,this.data=r}name(){return"ins_obj"}toString(t=""){return super.toString()+`, obj = ${(0,g.printTs)(this.obj)}`+(0,Mr.printTree)(t,this.data.map(r=>s=>`${JSON.stringify(r[0])}: ${(0,g.printTs)(r[1])}`))}};y.InsObjOp=ne;var oe=class extends m{constructor(t,e,r){super(t),this.id=t,this.obj=e,this.data=r}name(){return"ins_vec"}toString(t=""){return super.toString()+`, obj = ${(0,g.printTs)(this.obj)}`+(0,Mr.printTree)(t,this.data.map(r=>s=>`${r[0]}: ${(0,g.printTs)(r[1])}`))}};y.InsVecOp=oe;var ce=class extends m{constructor(t,e,r,s){super(t),this.id=t,this.obj=e,this.ref=r,this.data=s}span(){return this.data.length}name(){return"ins_str"}toString(){return super.toString()+`, obj = ${(0,g.printTs)(this.obj)} { ${(0,g.printTs)(this.ref)} \u2190 ${JSON.stringify(this.data)} }`}};y.InsStrOp=ce;var ae=class extends m{constructor(t,e,r,s){super(t),this.id=t,this.obj=e,this.ref=r,this.data=s}span(){return this.data.length}name(){return"ins_bin"}toString(){let t=(0,g.printTs)(this.ref);return super.toString()+`, obj = ${(0,g.printTs)(this.obj)} { ${t} \u2190 ${this.data} }`}};y.InsBinOp=ae;var ue=class extends m{constructor(t,e,r,s){super(t),this.id=t,this.obj=e,this.ref=r,this.data=s}span(){return this.data.length}name(){return"ins_arr"}toString(){let t=(0,g.printTs)(this.obj),e=(0,g.printTs)(this.ref),r=this.data.map(g.printTs).join(", ");return super.toString()+", obj = "+t+" { "+e+" \u2190 "+r+" }"}};y.InsArrOp=ue;var he=class extends m{constructor(t,e,r,s){super(t),this.id=t,this.obj=e,this.ref=r,this.val=s}name(){return"upd_arr"}toString(){let t=(0,g.printTs)(this.obj),e=(0,g.printTs)(this.ref),r=(0,g.printTs)(this.val);return super.toString()+", obj = "+t+" { "+e+": "+r+" }"}};y.UpdArrOp=he;var fe=class extends m{constructor(t,e,r){super(t),this.id=t,this.obj=e,this.what=r}name(){return"del"}toString(){let t=this.what.map(e=>(0,g.printTs)(e)+"!"+e.span).join(", ");return super.toString()+`, obj = ${(0,g.printTs)(this.obj)} { ${t} }`}};y.DelOp=fe;var de=class extends m{constructor(t,e){super(t),this.id=t,this.len=e}span(){return this.len}name(){return"nop"}};y.NopOp=de});var Br=p(xt=>{"use strict";f();Object.defineProperty(xt,"__esModule",{value:!0});xt.isFloat32=void 0;var qr=new DataView(new ArrayBuffer(4)),Js=i=>(qr.setFloat32(0,i),i===qr.getFloat32(0));xt.isFloat32=Js});var pe=p(yt=>{"use strict";f();Object.defineProperty(yt,"__esModule",{value:!0});yt.JsonPackExtension=void 0;var le=class{constructor(t,e){this.tag=t,this.val=e}};yt.JsonPackExtension=le});var Ur=p(_t=>{"use strict";f();Object.defineProperty(_t,"__esModule",{value:!0});_t.CborEncoderFast=void 0;var Ws=Gt(),Ys=Number.isSafeInteger,be=class{constructor(t=new Ws.Writer){this.writer=t}encode(t){return this.writeAny(t),this.writer.flush()}writeAny(t){switch(typeof t){case"number":return this.writeNumber(t);case"string":return this.writeStr(t);case"boolean":return this.writer.u8(244+ +t);case"object":{if(!t)return this.writer.u8(246);switch(t.constructor){case Array:return this.writeArr(t);default:return this.writeObj(t)}}}}writeCbor(){this.writer.u8u16(217,55799)}writeEnd(){this.writer.u8(255)}writeNull(){this.writer.u8(246)}writeBoolean(t){t?this.writer.u8(245):this.writer.u8(244)}writeNumber(t){Ys(t)?this.writeInteger(t):typeof t=="bigint"?this.writeBigInt(t):this.writeFloat(t)}writeBigInt(t){t>=0?this.writeBigUint(t):this.writeBigSint(t)}writeBigUint(t){if(t<=Number.MAX_SAFE_INTEGER)return this.writeUInteger(Number(t));this.writer.u8u64(27,t)}writeBigSint(t){if(t>=Number.MIN_SAFE_INTEGER)return this.encodeNint(Number(t));let e=-BigInt(1)-t;this.writer.u8u64(59,e)}writeInteger(t){t>=0?this.writeUInteger(t):this.encodeNint(t)}writeUInteger(t){let e=this.writer;e.ensureCapacity(9);let r=e.uint8,s=e.x;t<=23?r[s++]=0+t:t<=255?(r[s++]=24,r[s++]=t):t<=65535?(r[s++]=25,e.view.setUint16(s,t),s+=2):t<=4294967295?(r[s++]=26,e.view.setUint32(s,t),s+=4):(r[s++]=27,e.view.setBigUint64(s,BigInt(t)),s+=8),e.x=s}encodeNumber(t){this.writeNumber(t)}encodeInteger(t){this.writeInteger(t)}encodeUint(t){this.writeUInteger(t)}encodeNint(t){let e=-1-t,r=this.writer;r.ensureCapacity(9);let s=r.uint8,n=r.x;e<24?s[n++]=32+e:e<=255?(s[n++]=56,s[n++]=e):e<=65535?(s[n++]=57,r.view.setUint16(n,e),n+=2):e<=4294967295?(s[n++]=58,r.view.setUint32(n,e),n+=4):(s[n++]=59,r.view.setBigUint64(n,BigInt(e)),n+=8),r.x=n}writeFloat(t){this.writer.u8f64(251,t)}writeBin(t){let e=t.length;this.writeBinHdr(e),this.writer.buf(t,e)}writeBinHdr(t){let e=this.writer;t<=23?e.u8(64+t):t<=255?e.u16(22528+t):t<=65535?e.u8u16(89,t):t<=4294967295?e.u8u32(90,t):e.u8u64(91,t)}writeStr(t){let e=this.writer,s=t.length*4;e.ensureCapacity(5+s);let n=e.uint8,o=e.x;s<=23?e.x++:s<=255?(n[e.x++]=120,o=e.x,e.x++):s<=65535?(n[e.x++]=121,o=e.x,e.x+=2):(n[e.x++]=122,o=e.x,e.x+=4);let c=e.utf8(t);s<=23?n[o]=96+c:s<=255?n[o]=c:s<=65535?e.view.setUint16(o,c):e.view.setUint32(o,c)}writeStrHdr(t){let e=this.writer;t<=23?e.u8(96+t):t<=255?e.u16(30720+t):t<=65535?e.u8u16(121,t):e.u8u32(122,t)}writeAsciiStr(t){this.writeStrHdr(t.length),this.writer.ascii(t)}writeArr(t){let e=t.length;this.writeArrHdr(e);for(let r=0;r<e;r++)this.writeAny(t[r])}writeArrHdr(t){let e=this.writer;t<=23?e.u8(128+t):t<=255?e.u16(38912+t):t<=65535?e.u8u16(153,t):t<=4294967295?e.u8u32(154,t):e.u8u64(155,t)}writeObj(t){let e=Object.keys(t),r=e.length;this.writeObjHdr(r);for(let s=0;s<r;s++){let n=e[s];this.writeStr(n),this.writeAny(t[n])}}writeObjHdr(t){let e=this.writer;t<=23?e.u8(160+t):t<=255?e.u16(47104+t):t<=65535?e.u8u16(185,t):t<=4294967295?e.u8u32(186,t):e.u8u64(187,t)}writeMapHdr(t){this.writeObjHdr(t)}writeStartMap(){this.writer.u8(191)}writeTag(t,e){this.writeTagHdr(t),this.writeAny(e)}writeTagHdr(t){let e=this.writer;t<=23?e.u8(192+t):t<=255?e.u16(55296+t):t<=65535?e.u8u16(217,t):t<=4294967295?e.u8u32(218,t):e.u8u64(219,t)}writeTkn(t){let e=this.writer;t<=23?e.u8(224+t):t<=255&&e.u16(63488+t)}writeStartStr(){this.writer.u8(127)}writeStrChunk(t){throw new Error("Not implemented")}writeEndStr(){throw new Error("Not implemented")}writeStartBin(){this.writer.u8(95)}writeBinChunk(t){throw new Error("Not implemented")}writeEndBin(){throw new Error("Not implemented")}writeStartArr(){this.writer.u8(159)}writeArrChunk(t){throw new Error("Not implemented")}writeEndArr(){this.writer.u8(255)}writeStartObj(){this.writer.u8(191)}writeObjChunk(t,e){throw new Error("Not implemented")}writeEndObj(){this.writer.u8(255)}};_t.CborEncoderFast=be});var kt=p(vt=>{"use strict";f();Object.defineProperty(vt,"__esModule",{value:!0});vt.JsonPackValue=void 0;var we=class{constructor(t){this.val=t}};vt.JsonPackValue=we});var Vr=p(Ot=>{"use strict";f();Object.defineProperty(Ot,"__esModule",{value:!0});Ot.CborEncoder=void 0;var Gs=Br(),zs=pe(),Ks=Ur(),Xs=kt(),xe=class extends Ks.CborEncoderFast{writeUnknown(t){this.writeNull()}writeAny(t){switch(typeof t){case"number":return this.writeNumber(t);case"string":return this.writeStr(t);case"boolean":return this.writer.u8(244+ +t);case"object":{if(!t)return this.writer.u8(246);switch(t.constructor){case Object:case void 0:return this.writeObj(t);case Array:return this.writeArr(t);case Uint8Array:return this.writeBin(t);case Map:return this.writeMap(t);case zs.JsonPackExtension:return this.writeTag(t.tag,t.val);case Xs.JsonPackValue:{let r=t.val;return this.writer.buf(r,r.length)}default:return t instanceof Uint8Array?this.writeBin(t):Array.isArray(t)?this.writeArr(t):t instanceof Map?this.writeMap(t):this.writeUnknown(t)}}case"undefined":return this.writeUndef();case"bigint":return this.writeBigInt(t);default:return this.writeUnknown(t)}}writeFloat(t){(0,Gs.isFloat32)(t)?this.writer.u8f32(250,t):this.writer.u8f64(251,t)}writeMap(t){this.writeMapHdr(t.size),t.forEach((e,r)=>{this.writeAny(r),this.writeAny(e)})}writeUndef(){this.writer.u8(247)}};Ot.CborEncoder=xe});var _e=p(gt=>{"use strict";f();Object.defineProperty(gt,"__esModule",{value:!0});gt.Encoder=void 0;var Qs=(C(),N(P)),I=Qs.__importStar(z()),Zs=ft(),ti=q(),ei=Vr(),ye=class extends ei.CborEncoder{constructor(t=new Zs.CrdtWriter){super(t),this.writer=t,this.patchSid=0}encode(t){let e=this.writer;return e.reset(),this.writePatch(t),e.flush()}writePatch(t){let e=t.getId(),r=this.patchSid=e.sid,s=this.writer;s.vu57(r),s.vu57(e.time);let n=t.meta;n===void 0?this.writeUndef():this.writeArr([n]),this.writeOps(t)}writeOps(t){let e=t.ops,r=e.length;this.writer.vu57(r);for(let s=0;s<r;s++)this.writeOp(e[s])}encodeId(t){let e=t.sid,r=t.time,s=this.writer;e===this.patchSid?s.b1vu56(0,r):(s.b1vu56(1,r),s.vu57(e))}encodeTss(t){this.encodeId(t),this.writer.vu57(t.span)}writeInsStr(t,e,r,s){let n=this.writer;return t<=7?n.u8(96+t):(n.u8(96),n.vu57(t)),this.encodeId(e),this.encodeId(r),n.utf8(s)}writeOp(t){let e=this.writer;switch(t.constructor){case I.NewConOp:{let n=t.val;n instanceof ti.Timestamp?(e.u8(1),this.encodeId(n)):(e.u8(0),this.writeAny(n));break}case I.NewValOp:{e.u8(8);break}case I.NewObjOp:{e.u8(16);break}case I.NewVecOp:{e.u8(24);break}case I.NewStrOp:{e.u8(32);break}case I.NewBinOp:{e.u8(40);break}case I.NewArrOp:{e.u8(48);break}case I.InsValOp:{let s=t;e.u8(72),this.encodeId(s.obj),this.encodeId(s.val);break}case I.InsObjOp:{let s=t,n=s.data,o=n.length;o<=7?e.u8(80+o):(e.u8(80),e.vu57(o)),this.encodeId(s.obj);for(let c=0;c<o;c++){let u=n[c];this.writeStr(u[0]),this.encodeId(u[1])}break}case I.InsVecOp:{let s=t,n=s.data,o=n.length;o<=7?e.u8(88+o):(e.u8(88),e.vu57(o)),this.encodeId(s.obj);for(let c=0;c<o;c++){let u=n[c];e.u8(u[0]),this.encodeId(u[1])}break}case I.InsStrOp:{let s=t,n=s.obj,o=s.ref,c=s.data,u=c.length;e.ensureCapacity(24+u*4);let h=e.x,a=this.writeInsStr(u,n,o,c);u!==a&&(e.x=h,this.writeInsStr(a,n,o,c));break}case I.InsBinOp:{let s=t,n=s.data,o=n.length;o<=7?e.u8(104+o):(e.u8(104),e.vu57(o)),this.encodeId(s.obj),this.encodeId(s.ref),e.buf(n,o);break}case I.InsArrOp:{let s=t,n=s.data,o=n.length;o<=7?e.u8(112+o):(e.u8(112),e.vu57(o)),this.encodeId(s.obj),this.encodeId(s.ref);for(let c=0;c<o;c++)this.encodeId(n[c]);break}case I.UpdArrOp:{let s=t;e.u8(120),this.encodeId(s.obj),this.encodeId(s.ref),this.encodeId(s.val);break}case I.DelOp:{let s=t,n=s.what,o=n.length;o<=7?e.u8(128+o):(e.u8(128),e.vu57(o)),this.encodeId(s.obj);for(let c=0;c<o;c++)this.encodeTss(n[c]);break}case I.NopOp:{let n=t.len;n<=7?e.u8(136+n):(e.u8(136),e.vu57(n));break}default:throw new Error("UNKNOWN_OP")}}};gt.Encoder=ye});var ve=p(jt=>{"use strict";f();Object.defineProperty(jt,"__esModule",{value:!0});jt.isUint8Array=void 0;jt.isUint8Array=typeof Buffer=="function"?i=>i instanceof Uint8Array||Buffer.isBuffer(i):i=>i instanceof Uint8Array});var $r=p(Lr=>{"use strict";f();Object.defineProperty(Lr,"__esModule",{value:!0})});var Rr=p(K=>{"use strict";f();Object.defineProperty(K,"__esModule",{value:!0});K.ORIGIN=void 0;var ri=(C(),N(P)),si=q();ri.__exportStar($r(),K);K.ORIGIN=(0,si.ts)(0,0)});var Dr=p(mt=>{"use strict";f();Object.defineProperty(mt,"__esModule",{value:!0});mt.dim=void 0;var ii=i=>i;mt.dim=ii});var Fr=p(L=>{"use strict";f();Object.defineProperty(L,"__esModule",{value:!0});L.toLine=void 0;var ke=Dr(),Oe=i=>" "+(i.length?`{ ${i.toString().split(",").map(t=>Number(t).toString(16).toUpperCase().padStart(i.BYTES_PER_ELEMENT<<1,"0")).join(" ")} }`:"{}"),ni=(i,t=" ")=>{switch(i){case null:return"!n";case void 0:return"!u";case!0:return"!t";case!1:return"!f"}switch(typeof i){case"number":case"bigint":{let e=typeof i=="number"&&Math.round(i)!==i?i+"":Intl.NumberFormat("en-US").format(i)+(typeof i=="bigint"?"n":"");return e[0]==="0"&&e[1]==="."?e.slice(1):e}case"string":return i?i.split(/([\u0000-\u001F]|\n|\t)/).filter(Boolean).map(r=>r===`
|
|
6
6
|
`?"\u23CE":r===" "?"\u21E5":r.length===1&&r.charCodeAt(0)<32?"\\x"+r.charCodeAt(0).toString(16).padStart(2,"0"):(0,ke.dim)('"')+JSON.stringify(r).slice(1,-1)+(0,ke.dim)('"')).join(" "):'""';case"object":{if(Array.isArray(i))return i.length?`[${t}${i.map(r=>(0,L.toLine)(r,t)).join(","+t)}${t}]`:"[]";if(i instanceof DataView)return i.constructor.name+Oe(new Uint8Array(i.buffer,i.byteOffset,i.byteLength));if(ArrayBuffer.isView(i))return i.constructor.name+Oe(i);if(i instanceof ArrayBuffer)return"ArrayBuffer"+Oe(new Uint8Array(i));if(i instanceof Date)return"Date { "+i.getTime()+" }";if(i instanceof RegExp)return i+"";let e=Object.keys(i);return e.length?`{${t}${e.map(r=>`${r}${t}${(0,ke.dim)("=")}${t}${(0,L.toLine)(i[r],t)}`).join(","+t)}${t}}`:"{}"}case"function":return`fn ${(0,L.toLine)(i.name)} ( ${i.length} args )`;case"symbol":return`sym ( ${i.description} )`}return"?"};L.toLine=ni});var Jr=p(E=>{"use strict";f();Object.defineProperty(E,"__esModule",{value:!0});E.indent=E.bin=E.con=E.line=void 0;var oi=Fr(),Hr=Wr();E.line=oi.toLine;var ci=i=>i instanceof Uint8Array?"Uint8Array "+(0,E.bin)(i):`{ ${i instanceof Hr.Timestamp?(0,Hr.printTs)(i):(0,E.line)(i)} }`;E.con=ci;var ai=i=>"{ "+(""+i).replaceAll(",",", ")+" }";E.bin=ai;var ui=(i,t)=>String(JSON.stringify(t,null,2)).replace(/\n/g,`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __nodeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __nodeCreateRequire(import.meta.url);
|
|
3
|
-
import{a as A,b as P,c as Vs,d as Rs,e as z,f as ue,g as gn,h as Ds,i as Ur,j as ae,k as wn,l as _n,m as Fr,n as zr,o as $r,p as Hr,q as Jr,r as Us,s as Gr,t as Kr,u as G}from"./chunk-5TW2RK7G.js";import{c as g,f as j,g as h}from"./chunk-CCPB2BTC.js";var zs=g(Fs=>{"use strict";h();Object.defineProperty(Fs,"__esModule",{value:!0})});var Ye=g(lt=>{"use strict";h();Object.defineProperty(lt,"__esModule",{value:!0});lt.ConNode=void 0;var Wr=wn(),Xr=G(),Yr=z(),bn=class s{constructor(e,t){this.id=e,this.val=t,this.api=void 0,this.parent=void 0}name(){return"con"}children(){}child(){}container(){}view(){return this.val}clone(){return new s(this.id,this.val)}delta(e,t,n){let{id:i,val:r}=this;t.has(i)||n.push(new Xr.NewConOp(i,r))}toString(e){return this.name()+" "+(0,Yr.printTs)(this.id)+" "+(0,Wr.con)(this.val)}};lt.ConNode=bn});var $s=g(ut=>{"use strict";h();Object.defineProperty(ut,"__esModule",{value:!0});ut.RelativeTimestamp=void 0;var mn=class{constructor(e,t){this.sessionIndex=e,this.timeDiff=t}};ut.RelativeTimestamp=mn});var Js=g(ht=>{"use strict";h();Object.defineProperty(ht,"__esModule",{value:!0});ht.ClockEncoder=void 0;var Hs=z(),Qr=$s(),at=class{constructor(e,t){this.index=e,this.clock=t}},vn=class{constructor(){this.table=new Map,this.index=1,this.clock=null}reset(e){this.index=1,this.clock=e;let t=new at(this.index++,(0,Hs.tick)(e,-1));this.table.clear(),this.table.set(e.sid,t)}append(e){let t=e.time,n=e.sid,i=this.table.get(n);if(!i){let c=this.clock.peers.get(n);c||(c=new Hs.Timestamp(n,this.clock.time-1)),i=new at(this.index++,c),this.table.set(n,i)}let o=i.clock.time-t;if(o<0)throw new Error("TIME_TRAVEL");return new Qr.RelativeTimestamp(i.index,o)}toJson(){let e=[];return this.table.forEach(t=>{let n=t.clock;e.push(n.sid,n.time)}),e}};ht.ClockEncoder=vn});var yn=g(Be=>{"use strict";h();Object.defineProperty(Be,"__esModule",{value:!0});Be.CRDT_MAJOR_OVERLAY=Be.CRDT_MAJOR=void 0;var Gs;(function(s){s[s.CON=0]="CON",s[s.VAL=1]="VAL",s[s.OBJ=2]="OBJ",s[s.VEC=3]="VEC",s[s.STR=4]="STR",s[s.BIN=5]="BIN",s[s.ARR=6]="ARR"})(Gs||(Be.CRDT_MAJOR=Gs={}));var Ks;(function(s){s[s.CON=0]="CON",s[s.VAL=32]="VAL",s[s.VEC=96]="VEC",s[s.OBJ=64]="OBJ",s[s.STR=128]="STR",s[s.BIN=160]="BIN",s[s.ARR=192]="ARR"})(Ks||(Be.CRDT_MAJOR_OVERLAY=Ks={}))});var Ws=g(dt=>{"use strict";h();Object.defineProperty(dt,"__esModule",{value:!0});dt.Encoder=void 0;var Zr=(P(),j(A)),ve=Zr.__importStar(se()),eo=Js(),to=Rs(),no=z(),so=Ds(),Qe=yn(),On=class extends so.CborEncoder{constructor(e){super(e||new to.CrdtWriter),this.clockEncoder=new eo.ClockEncoder,this.time=0,this.cTableEntry=t=>{let n=t.clock,i=this.writer;i.vu57(n.sid),i.vu57(n.time)},this.tsLogical=t=>{let n=this.clockEncoder.append(t);this.writer.id(n.sessionIndex,n.timeDiff)},this.tsServer=t=>{this.writer.vu57(t.time)},this.ts=this.tsLogical,this.cKey=(t,n)=>{this.writeStr(n),this.cNode(this.doc.index.get(t))}}encode(e){this.doc=e;let t=this.writer;return t.reset(),e.clock.sid===1?this.encodeServer(e):this.encodeLogical(e),t.flush()}encodeLogical(e){let t=this.writer;this.ts=this.tsLogical,this.clockEncoder.reset(e.clock),t.ensureCapacity(4);let n=t.x0,i=t.x;t.x+=4,this.cRoot(e.root),this.encodeClockTable(n,i)}encodeServer(e){this.ts=this.tsServer;let t=this.writer;t.u8(128),t.vu57(this.time=e.clock.time),this.cRoot(e.root)}encodeClockTable(e,t){let n=this.writer,i=n.x0-e;n.view.setUint32(n.x0+(t-e),n.x-t-i-4);let o=this.clockEncoder.table,c=o.size;n.vu57(c),o.forEach(this.cTableEntry)}cRoot(e){e.val.sid===0?this.writer.u8(0):this.cNode(e.node())}writeTL(e,t){let n=this.writer;t<31?n.u8(e|t):(n.u8(e|31),n.vu57(t))}cNode(e){e instanceof ve.ConNode?this.cCon(e):e instanceof ve.ValNode?this.cVal(e):e instanceof ve.StrNode?this.cStr(e):e instanceof ve.ObjNode?this.cObj(e):e instanceof ve.VecNode?this.cVec(e):e instanceof ve.ArrNode?this.cArr(e):e instanceof ve.BinNode&&this.cBin(e)}cCon(e){let t=e.val;this.ts(e.id),t instanceof no.Timestamp?(this.writer.u8(1),this.ts(t)):(this.writer.u8(0),this.writeAny(t))}cVal(e){this.ts(e.id),this.writer.u8(32),this.cNode(e.node())}cObj(e){this.ts(e.id);let t=e.keys;this.writeTL(Qe.CRDT_MAJOR_OVERLAY.OBJ,t.size),t.forEach(this.cKey)}cVec(e){let t=e.elements,n=t.length;this.ts(e.id),this.writeTL(Qe.CRDT_MAJOR_OVERLAY.VEC,n);let i=this.doc.index;for(let r=0;r<n;r++){let o=t[r];o?this.cNode(i.get(o)):this.writer.u8(0)}}cStr(e){let t=this.ts;t(e.id),this.writeTL(Qe.CRDT_MAJOR_OVERLAY.STR,e.count);for(let n=e.first();n;n=e.next(n))t(n.id),n.del?this.writeUInteger(n.span):this.writeStr(n.data)}cBin(e){let t=this.ts,n=this.writer;t(e.id),this.writeTL(Qe.CRDT_MAJOR_OVERLAY.BIN,e.count);for(let i=e.first();i;i=e.next(i)){t(i.id);let r=i.span,o=i.del;n.b1vu56(~~o,r),!o&&n.buf(i.data,r)}}cArr(e){let t=this.ts,n=this.writer;t(e.id),this.writeTL(Qe.CRDT_MAJOR_OVERLAY.ARR,e.count);let i=this.doc.index;for(let r=e.first();r;r=e.next(r)){t(r.id);let o=r.span,c=r.del;if(n.b1vu56(~~c,o),c)continue;let l=r.data;for(let u=0;u<o;u++)this.cNode(i.get(l[u]))}}};dt.Encoder=On});var Xs=g(ft=>{"use strict";h();Object.defineProperty(ft,"__esModule",{value:!0});ft.ClockDecoder=void 0;var Ze=z(),Nn=class s{static fromArr(e){let t=new s(e[0],e[1]),n=e.length;for(let i=2;i<n;i+=2)t.pushTuple(e[i],e[i+1]);return t}constructor(e,t){this.table=[],this.clock=new Ze.ClockVector(e,t+1),this.table.push((0,Ze.ts)(e,t))}pushTuple(e,t){let n=(0,Ze.ts)(e,t);this.clock.observe(n,1),this.table.push(n)}decodeId(e,t){if(!e)return(0,Ze.ts)(0,t);let n=this.table[e-1];if(!n)throw new Error("INVALID_CLOCK_TABLE");return(0,Ze.ts)(n.sid,n.time-t)}};ft.ClockDecoder=Nn});var Ys=g(pt=>{"use strict";h();Object.defineProperty(pt,"__esModule",{value:!0});pt.Decoder=void 0;var io=(P(),j(A)),W=io.__importStar(se()),ro=Xs(),oo=Vs(),co=z(),xn=gt(),lo=Hr(),ye=yn(),Sn=class extends lo.CborDecoderBase{constructor(){super(new oo.CrdtReader),this.clockDecoder=void 0,this.time=-1,this.cStrChunk=()=>{let e=this.ts(),t=this.val();return typeof t=="string"?new W.StrChunk(e,t.length,t):new W.StrChunk(e,~~t,"")},this.cBinChunk=()=>{let e=this.ts(),t=this.reader,[n,i]=t.b1vu56();return n?new W.BinChunk(e,i,void 0):new W.BinChunk(e,i,t.buf(i))}}decode(e,t){this.clockDecoder=void 0,this.time=-1;let n=this.reader;if(n.reset(e),n.peak()&128){n.x++;let c=this.time=n.vu57();t||(t=xn.Model.withServerClock(void 0,c))}else if(this.decodeClockTable(),!t){let c=this.clockDecoder.clock;t=xn.Model.create(void 0,c)}this.doc=t;let r=this.cRoot(),o=t.root=new W.RootNode(this.doc,r.id);return r.parent=o,this.clockDecoder=void 0,t}decodeClockTable(){let e=this.reader,t=e.u32(),n=e.x;e.x+=t;let i=e.vu57(),r=e.vu57(),o=e.vu57();this.clockDecoder=new ro.ClockDecoder(r,o);for(let c=1;c<i;c++){let l=e.vu57(),u=e.vu57();this.clockDecoder.pushTuple(l,u)}e.x=n}ts(){if(this.time<0){let[n,i]=this.reader.id();return this.clockDecoder.decodeId(n,i)}else return new co.Timestamp(1,this.reader.vu57())}cRoot(){let e=this.reader;return e.uint8[e.x]?this.cNode():xn.UNDEFINED}cNode(){let e=this.reader,t=this.ts(),n=e.u8(),i=n>>5,r=n&31;switch(i){case ye.CRDT_MAJOR.CON:return this.cCon(t,r);case ye.CRDT_MAJOR.VAL:return this.cVal(t);case ye.CRDT_MAJOR.OBJ:return this.cObj(t,r!==31?r:e.vu57());case ye.CRDT_MAJOR.VEC:return this.cVec(t,r!==31?r:e.vu57());case ye.CRDT_MAJOR.STR:return this.cStr(t,r!==31?r:e.vu57());case ye.CRDT_MAJOR.BIN:return this.cBin(t,r!==31?r:e.vu57());case ye.CRDT_MAJOR.ARR:return this.cArr(t,r!==31?r:e.vu57())}throw new Error("UNKNOWN_NODE")}cCon(e,t){let n=this.doc,i=t?this.ts():this.val(),r=new W.ConNode(e,i);return n.index.set(e,r),r}cVal(e){let t=this.cNode(),n=this.doc,i=new W.ValNode(n,e,t.id);return t.parent=i,n.index.set(e,i),i}cObj(e,t){let n=new W.ObjNode(this.doc,e);for(let i=0;i<t;i++)this.cObjChunk(n);return this.doc.index.set(e,n),n}cObjChunk(e){let t=this.key(),n=this.cNode();n.parent=e,e.keys.set(t,n.id)}cVec(e,t){let n=this.reader,i=new W.VecNode(this.doc,e),r=i.elements;for(let o=0;o<t;o++)if(!n.peak())n.x++,r.push(void 0);else{let l=this.cNode();l.parent=i,r.push(l.id)}return this.doc.index.set(e,i),i}cStr(e,t){let n=new W.StrNode(e);return t&&n.ingest(t,this.cStrChunk),this.doc.index.set(e,n),n}cBin(e,t){let n=new W.BinNode(e);return t&&n.ingest(t,this.cBinChunk),this.doc.index.set(e,n),n}cArr(e,t){let n=new W.ArrNode(this.doc,e);return t&&n.ingest(t,()=>{let i=this.ts(),[r,o]=this.reader.b1vu56();if(r)return new W.ArrChunk(i,o,void 0);let c=[];for(let l=0;l<o;l++){let u=this.cNode();u.parent=n,c.push(u.id)}return new W.ArrChunk(i,o,c)}),this.doc.index.set(e,n),n}};pt.Decoder=Sn});var Qs=g(Le=>{"use strict";h();Object.defineProperty(Le,"__esModule",{value:!0});Le.decoder=Le.encoder=void 0;var uo=Ws(),ao=Ys();Le.encoder=new uo.Encoder;Le.decoder=new ao.Decoder});var wt=g(Cn=>{"use strict";h();Object.defineProperty(Cn,"__esModule",{value:!0});Cn.hasOwnProperty=fo;var ho=Object.prototype.hasOwnProperty;function fo(s,e){return ho.call(s,e)}});var kn=g(_t=>{"use strict";h();Object.defineProperty(_t,"__esModule",{value:!0});_t.get=void 0;var po=wt(),go=(s,e)=>{let t=e.length,n;if(!t)return s;for(let i=0;i<t;i++)if(n=e[i],s instanceof Array){if(typeof n!="number"){if(n==="-")return;let r=~~n;if(""+r!==n)return;n=r}s=s[n]}else if(typeof s=="object"){if(!s||!(0,po.hasOwnProperty)(s,n))return;s=s[n]}else return;return s};_t.get=go});var bt=g(R=>{"use strict";h();Object.defineProperty(R,"__esModule",{value:!0});R.isInteger=R.isRoot=R.toPath=void 0;R.unescapeComponent=Zs;R.escapeComponent=ei;R.parseJsonPointer=ti;R.formatJsonPointer=vo;R.isChild=Oo;R.isPathEqual=No;R.parent=So;R.isValidIndex=Co;var wo=/~1/g,_o=/~0/g,bo=/~/g,mo=/\//g;function Zs(s){return s.indexOf("~")===-1?s:s.replace(wo,"/").replace(_o,"~")}function ei(s){return s.indexOf("/")===-1&&s.indexOf("~")===-1?s:s.replace(bo,"~0").replace(mo,"~1")}function ti(s){return s?s.slice(1).split("/").map(Zs):[]}function vo(s){return(0,R.isRoot)(s)?"":"/"+s.map(e=>ei(String(e))).join("/")}var yo=s=>typeof s=="string"?ti(s):s;R.toPath=yo;function Oo(s,e){if(s.length>=e.length)return!1;for(let t=0;t<s.length;t++)if(s[t]!==e[t])return!1;return!0}function No(s,e){if(s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(s[t]!==e[t])return!1;return!0}var xo=s=>!s.length;R.isRoot=xo;function So(s){if(s.length<1)throw new Error("NO_PARENT");return s.slice(0,s.length-1)}function Co(s){if(typeof s=="number")return!0;let e=Number.parseInt(s,10);return String(e)===s&&e>=0}var ko=s=>{let e=s.length,t=0,n;for(;t<e;){if(n=s.charCodeAt(t),n>=48&&n<=57){t++;continue}return!1}return!0};R.isInteger=ko});var si=g(ni=>{"use strict";h();Object.defineProperty(ni,"__esModule",{value:!0})});var ii=g(Oe=>{"use strict";h();Object.defineProperty(Oe,"__esModule",{value:!0});Oe.validatePath=Oe.validateJsonPointer=void 0;var Io=s=>{if(typeof s=="string"){if(s){if(s[0]!=="/")throw new Error("POINTER_INVALID");if(s.length>1024)throw new Error("POINTER_TOO_LONG")}}else(0,Oe.validatePath)(s)};Oe.validateJsonPointer=Io;var{isArray:qo}=Array,To=s=>{if(!qo(s))throw new Error("Invalid path.");if(s.length>256)throw new Error("Path too long.");for(let e of s)switch(typeof e){case"string":case"number":continue;default:throw new Error("Invalid path step.")}};Oe.validatePath=To});var oi=g(ie=>{"use strict";h();Object.defineProperty(ie,"__esModule",{value:!0});ie.isObjectReference=ie.isArrayEnd=ie.isArrayReference=ie.find=void 0;var jo=wt(),{isArray:ri}=Array,Ao=(s,e)=>{let t=e.length;if(!t)return{val:s};let n,i;for(let o=0;o<t;o++)if(n=s,i=e[o],ri(n)){let c=n.length;if(i==="-")i=c;else if(typeof i=="string"){let l=~~i;if(""+l!==i)throw new Error("INVALID_INDEX");if(i=l,i<0)throw new Error("INVALID_INDEX")}s=n[i]}else if(typeof n=="object"&&n)s=(0,jo.hasOwnProperty)(n,i)?n[i]:void 0;else throw new Error("NOT_FOUND");return{val:s,obj:n,key:i}};ie.find=Ao;var Po=s=>ri(s.obj)&&typeof s.key=="number";ie.isArrayReference=Po;var Eo=s=>s.obj.length===s.key;ie.isArrayEnd=Eo;var Bo=s=>typeof s.obj=="object"&&typeof s.key=="string";ie.isObjectReference=Bo});var ci=g(mt=>{"use strict";h();Object.defineProperty(mt,"__esModule",{value:!0});mt.findByPointer=void 0;var Lo=wt(),Mo=bt(),{isArray:Vo}=Array,Ro=(s,e)=>{if(!s)return{val:e};let t,n,i=0,r=1;for(;i>-1;)if(i=s.indexOf("/",r),n=i>-1?s.substring(r,i):s.substring(r),r=i+1,t=e,Vo(t)){let o=t.length;if(n==="-")n=o;else{let c=~~n;if(""+c!==n)throw new Error("INVALID_INDEX");if(n=c,n<0)throw"INVALID_INDEX"}e=t[n]}else if(typeof t=="object"&&t)n=(0,Mo.unescapeComponent)(n),e=(0,Lo.hasOwnProperty)(t,n)?t[n]:void 0;else throw"NOT_FOUND";return{val:e,obj:t,key:n}};mt.findByPointer=Ro});var li=g(In=>{"use strict";h();Object.defineProperty(In,"__esModule",{value:!0});var Do=(P(),j(A));Do.__exportStar(ci(),In)});var ui=g(we=>{"use strict";h();Object.defineProperty(we,"__esModule",{value:!0});var Me=(P(),j(A));Me.__exportStar(si(),we);Me.__exportStar(bt(),we);Me.__exportStar(ii(),we);Me.__exportStar(kn(),we);Me.__exportStar(oi(),we);Me.__exportStar(li(),we)});var ai=g(vt=>{"use strict";h();Object.defineProperty(vt,"__esModule",{value:!0});vt.find=void 0;var Uo=ui(),qn=se(),Fo=(s,e)=>{let t=(0,Uo.toPath)(e),n=s,i=t.length;if(!i)return n;let r=0;for(;r<i&&n;){let o=t[r++];if(n=n.container(),!n)throw new Error("NOT_CONTAINER");if(n instanceof qn.ObjNode){let c=n.get(String(o));if(!c)throw new Error("NOT_FOUND");n=c}else if(n instanceof qn.ArrNode){let c=n.getNode(Number(o));if(!c)throw new Error("NOT_FOUND");n=c}else if(n instanceof qn.VecNode){let c=n.get(Number(o));if(!c)throw new Error("NOT_FOUND");n=c}}return n};vt.find=Fo});var jn=g(yt=>{"use strict";h();Object.defineProperty(yt,"__esModule",{value:!0});yt.FanOut=void 0;var Tn=class{constructor(){this.listeners=new Set}emit(e){this.listeners.forEach(t=>t(e))}listen(e){let t=this.listeners;return t.add(e),()=>t.delete(e)}};yt.FanOut=Tn});var Ln=g(re=>{"use strict";h();Object.defineProperty(re,"__esModule",{value:!0});re.OnNewFanOut=re.MapFanOut=re.MicrotaskBufferFanOut=re.MergeFanOut=void 0;var Ot=jn(),An=class extends Ot.FanOut{constructor(e,t=n=>n){super(),this.fanouts=e,this.mappper=t,this.unsubs=[]}listen(e){this.listeners.size||(this.unsubs=this.fanouts.map(n=>n.listen(i=>this.emit(this.mappper(i)))));let t=super.listen(e);return()=>{if(t(),!this.listeners.size){for(let n of this.unsubs)n();this.unsubs=[]}}}};re.MergeFanOut=An;var Pn=class extends Ot.FanOut{constructor(e){super(),this.source=e,this.buffer=[],this.unsub=void 0}listen(e){this.unsub||(this.unsub=this.source.listen(n=>{let i=this.buffer;i.length||queueMicrotask(()=>{this.emit(i),this.buffer=[]}),i.push(n)}));let t=super.listen(e);return()=>{t(),this.listeners.size||this.clear()}}clear(){this.listeners.clear(),this.buffer=[],this.unsub?.(),this.unsub=void 0}};re.MicrotaskBufferFanOut=Pn;var En=class extends Ot.FanOut{constructor(e,t){super(),this.source=e,this.mapper=t,this.unsub=void 0}listen(e){this.unsub||(this.unsub=this.source.listen(n=>this.emit(this.mapper(n))));let t=super.listen(e);return()=>{t(),this.listeners.size||this.clear()}}clear(){this.listeners.clear(),this.unsub?.(),this.unsub=void 0}};re.MapFanOut=En;var Bn=class extends Ot.FanOut{constructor(e,t=void 0){super(),this.source=e,this.last=t,this.unsub=void 0}listen(e){this.unsub||(this.unsub=this.source.listen(n=>{this.last!==n&&this.emit(this.last=n)}));let t=super.listen(e);return()=>{t(),this.listeners.size||this.clear()}}clear(){this.listeners.clear(),this.last=void 0,this.unsub?.(),this.unsub=void 0}};re.OnNewFanOut=Bn});var di=g(Nt=>{"use strict";h();Object.defineProperty(Nt,"__esModule",{value:!0});Nt.NodeEvents=void 0;var hi=Ln(),Mn=class{constructor(e){this.api=e,this.subscribe=t=>this.onViewChanges.listen(()=>t()),this.getSnapshot=()=>this.api.view(),this.onChanges=new hi.MapFanOut(this.api.api.onChanges,this.getSnapshot),this.onViewChanges=new hi.OnNewFanOut(this.onChanges,this.api.view())}onChange(e){return this.api.api.onChange.listen(n=>{e(n)})}handleDelete(){this.onViewChanges.clear(),this.onChanges.clear()}};Nt.NodeEvents=Mn});var fi=g(xt=>{"use strict";h();Object.defineProperty(xt,"__esModule",{value:!0});xt.ExtNode=void 0;var zo=z(),Vn=class{constructor(e){this.data=e,this.api=void 0,this.parent=void 0,this.id=e.id}children(e){}child(){return this.data}container(){return this.data.container()}delta(){}toString(e,t){return this.name()+(t?" "+(0,zo.printTs)(t):"")+" "+this.data.toString(e)}};xt.ExtNode=Vn});var pi=g(Ve=>{"use strict";h();Object.defineProperty(Ve,"__esModule",{value:!0});Ve.deepEqual=void 0;var Rn=Array.isArray,$o=Object.prototype,Ho=(s,e)=>{if(s===e)return!0;let t=0,n=0;if(Rn(s)){if(!Rn(e)||(t=s.length,t!==e.length))return!1;for(n=t;n--!==0;)if(!(0,Ve.deepEqual)(s[n],e[n]))return!1;return!0}if(s&&e&&typeof s=="object"&&typeof e=="object"){e:{if(s.__proto__===$o)break e;if(s instanceof Uint8Array){if(!(e instanceof Uint8Array))return!1;let r=s.length;if(r!==e.length)return!1;for(let o=0;o<r;o++)if(s[o]!==e[o])return!1;return!0}}let i=Object.keys(s);if(t=i.length,t!==Object.keys(e).length||Rn(e))return!1;for(n=t;n--!==0;){let r=i[n];if(!(0,Ve.deepEqual)(s[r],e[r]))return!1}return!0}return!1};Ve.deepEqual=Ho});var gi=g(Dn=>{"use strict";h();Object.defineProperty(Dn,"__esModule",{value:!0});var Jo=(P(),j(A));Jo.__exportStar(pi(),Dn)});var wi=g(Un=>{"use strict";h();Object.defineProperty(Un,"__esModule",{value:!0});var Go=(P(),j(A));Go.__exportStar(gi(),Un)});var _i=g(St=>{"use strict";h();Object.defineProperty(St,"__esModule",{value:!0});St.cmpUint8Array=void 0;var Ko=(s,e)=>{let t=s.length;if(t!==e.length)return!1;for(let n=0;n<t;n++)if(s[n]!==e[n])return!1;return!0};St.cmpUint8Array=Ko});var Ct=g(N=>{"use strict";h();Object.defineProperty(N,"__esModule",{value:!0});N.apply=N.invert=N.dst=N.src=N.diffEdit=N.diff=N.overlap=N.sfx=N.pfx=N.normalize=void 0;var Wo=s=>{let e=s.length;if(e<2)return s;let t=0;e:{if(!s[0][1])break e;for(t=1;t<e;t++){let i=s[t-1],r=s[t];if(!r[1]||i[0]===r[0])break e}return s}let n=[];for(let i=0;i<t;i++)n.push(s[i]);for(let i=t;i<e;i++){let r=s[i];if(!r[1])continue;let o=n.length>0?n[n.length-1]:null;o&&o[0]===r[0]?o[1]+=r[1]:n.push(r)}return n};N.normalize=Wo;var Xo=s=>{let e=s.charCodeAt(0);return e>=56320&&e<=57343},Yo=s=>{let e=s.charCodeAt(s.length-1);return e>=55296&&e<=56319},mi=(s,e)=>{s.push([0,""]);let t=0,n=0,i=0,r="",o="",c=0;for(;t<s.length;){if(t<s.length-1&&!s[t][1]){s.splice(t,1);continue}let u=s[t];switch(u[0]){case 1:i++,t++,o+=u[1];break;case-1:n++,t++,r+=u[1];break;case 0:{let a=t-i-n-1;if(e){let _=s[a];if(a>=0){let y=_[1];if(Yo(y)){let v=y.slice(-1);if(_[1]=y=y.slice(0,-1),r=v+r,o=v+o,!y){s.splice(a,1),t--;let V=a-1,J=s[V];if(J){let Q=J[0];Q===1?(i++,V--,o=J[1]+o):Q===-1&&(n++,V--,r=J[1]+r)}a=V}}}let m=s[t],b=m[1];if(Xo(b)){let y=b.charAt(0);m[1]=b.slice(1),r+=y,o+=y}}if(t<s.length-1&&!s[t][1]){s.splice(t,1);break}let d=r.length>0,f=o.length>0;if(d||f){d&&f&&(c=(0,N.pfx)(o,r),c!==0&&(a>=0?s[a][1]+=o.slice(0,c):(s.splice(0,0,[0,o.slice(0,c)]),t++),o=o.slice(c),r=r.slice(c)),c=(0,N.sfx)(o,r),c!==0&&(s[t][1]=o.slice(o.length-c)+s[t][1],o=o.slice(0,o.length-c),r=r.slice(0,r.length-c)));let _=i+n,m=r.length,b=o.length;m===0&&b===0?(s.splice(t-_,_),t=t-_):m===0?(s.splice(t-_,_,[1,o]),t=t-_+1):b===0?(s.splice(t-_,_,[-1,r]),t=t-_+1):(s.splice(t-_,_,[-1,r],[1,o]),t=t-_+2)}let p=s[t-1];t!==0&&p[0]===0?(p[1]+=s[t][1],s.splice(t,1)):t++,i=0,n=0,r="",o="";break}}}s[s.length-1][1]===""&&s.pop();let l=!1;for(t=1;t<s.length-1;){let u=s[t-1],a=s[t+1];if(u[0]===0&&a[0]===0){let d=u[1],f=s[t],p=f[1],_=a[1];p.slice(p.length-d.length)===d?(s[t][1]=d+p.slice(0,p.length-d.length),a[1]=d+_,s.splice(t-1,1),l=!0):p.slice(0,_.length)===_&&(u[1]+=a[1],f[1]=p.slice(_.length)+_,s.splice(t+1,1),l=!0)}t++}l&&mi(s,e)},bi=(s,e,t,n)=>{if(t>0&&t<s.length){let o=s.charCodeAt(t);o>=56320&&o<=57343&&t--}if(n>0&&n<e.length){let o=e.charCodeAt(n);o>=56320&&o<=57343&&n--}let i=Fn(s.slice(0,t),e.slice(0,n),!1),r=Fn(s.slice(t),e.slice(n),!1);return i.concat(r)},Qo=(s,e)=>{let t=s.length,n=e.length,i=Math.ceil((t+n)/2),r=i,o=2*i,c=new Array(o),l=new Array(o);for(let m=0;m<o;m++)c[m]=-1,l[m]=-1;c[r+1]=0,l[r+1]=0;let u=t-n,a=u%2!==0,d=0,f=0,p=0,_=0;for(let m=0;m<i;m++){for(let b=-m+d;b<=m-f;b+=2){let y=r+b,v=0,V=c[y-1],J=c[y+1];b===-m||b!==m&&V<J?v=J:v=V+1;let Q=v-b;for(;v<t&&Q<n&&s.charAt(v)===e.charAt(Q);)v++,Q++;if(c[y]=v,v>t)f+=2;else if(Q>n)d+=2;else if(a){let Xe=r+u-b,Ms=l[Xe];if(Xe>=0&&Xe<o&&Ms!==-1&&v>=t-Ms)return bi(s,e,v,Q)}}for(let b=-m+p;b<=m-_;b+=2){let y=r+b,v=b===-m||b!==m&&l[y-1]<l[y+1]?l[y+1]:l[y-1]+1,V=v-b;for(;v<t&&V<n&&s.charAt(t-v-1)===e.charAt(n-V-1);)v++,V++;if(l[y]=v,v>t)_+=2;else if(V>n)p+=2;else if(!a){let J=r+u-b,Q=c[J];if(J>=0&&J<o&&Q!==-1){let Xe=r+Q-J;if(v=t-v,Q>=v)return bi(s,e,Q,Xe)}}}}return[[-1,s],[1,e]]},Zo=(s,e)=>{if(!s)return[[1,e]];if(!e)return[[-1,s]];let t=s.length,n=e.length,i=t>n?s:e,r=t>n?e:s,o=r.length,c=i.indexOf(r);if(c>=0){let l=i.slice(0,c),u=i.slice(c+o);return t>n?[[-1,l],[0,r],[-1,u]]:[[1,l],[0,r],[1,u]]}return o===1?[[-1,s],[1,e]]:Qo(s,e)},ec=(s,e)=>{if(!s||!e||s.charAt(0)!==e.charAt(0))return 0;let t=0,n=Math.min(s.length,e.length),i=n,r=0;for(;t<i;)s.slice(r,i)===e.slice(r,i)?(t=i,r=t):n=i,i=Math.floor((n-t)/2+t);let o=s.charCodeAt(i-1);return o>=55296&&o<=56319&&i--,i};N.pfx=ec;var tc=(s,e)=>{if(!s||!e||s.slice(-1)!==e.slice(-1))return 0;let t=0,n=Math.min(s.length,e.length),i=n,r=0;for(;t<i;)s.slice(s.length-i,s.length-r)===e.slice(e.length-i,e.length-r)?(t=i,r=t):n=i,i=Math.floor((n-t)/2+t);if(i>0&&i<s.length){let o=s.length-i-1,c=s.charCodeAt(o),l=c>=55296&&c<=56319,u=c===8205||c>=65024&&c<=65039||c>=768&&c<=879;if(l||u)for(i--;i>0;){let a=s.length-i-1;if(a<0)break;let d=s.charCodeAt(a),f=d>=55296&&d<=56319,p=d===8205||d>=65024&&d<=65039||d>=768&&d<=879;if(!f&&!p)break;i--}}return i};N.sfx=tc;var nc=(s,e)=>{let t=s.length,n=e.length;if(t===0||n===0)return 0;let i=t;if(t>n?(i=n,s=s.substring(t-n)):t<n&&(e=e.substring(0,t)),s===e)return i;let r=0,o=1;for(;;){let c=s.substring(i-o),l=e.indexOf(c);if(l===-1)return r;o+=l,(l===0||s.substring(i-o)===e.substring(0,o))&&(r=o,o++)}};N.overlap=nc;var Fn=(s,e,t)=>{if(s===e)return s?[[0,s]]:[];let n=(0,N.pfx)(s,e),i=s.slice(0,n);s=s.slice(n),e=e.slice(n);let r=(0,N.sfx)(s,e),o=s.slice(s.length-r);s=s.slice(0,s.length-r),e=e.slice(0,e.length-r);let c=Zo(s,e);return i&&c.unshift([0,i]),o&&c.push([0,o]),mi(c,t),c},sc=(s,e)=>Fn(s,e,!0);N.diff=sc;var ic=(s,e,t)=>{e:{if(t<0)break e;let n=s.length,i=e.length;if(n===i)break e;let r=e.slice(t),o=r.length;if(o>n||s.slice(n-o)!==r)break e;if(i>n){let u=n-o,a=s.slice(0,u),d=e.slice(0,u);if(a!==d)break e;let f=e.slice(u,t),p=[];return a&&p.push([0,a]),f&&p.push([1,f]),r&&p.push([0,r]),p}else{let u=i-o,a=e.slice(0,u),d=s.slice(0,u);if(d!==a)break e;let f=s.slice(u,n-o),p=[];return d&&p.push([0,d]),f&&p.push([-1,f]),r&&p.push([0,r]),p}}return(0,N.diff)(s,e)};N.diffEdit=ic;var rc=s=>{let e="",t=s.length;for(let n=0;n<t;n++){let i=s[n];i[0]!==1&&(e+=i[1])}return e};N.src=rc;var oc=s=>{let e="",t=s.length;for(let n=0;n<t;n++){let i=s[n];i[0]!==-1&&(e+=i[1])}return e};N.dst=oc;var cc=s=>{let e=s[0];return e===0?s:e===1?[-1,s[1]]:[1,s[1]]},lc=s=>s.map(cc);N.invert=lc;var uc=(s,e,t,n)=>{let i=s.length,r=e;for(let o=i-1;o>=0;o--){let[c,l]=s[o];if(c===0)r-=l.length;else if(c===1)t(r,l);else{let u=l.length;r-=u,n(r,u,l)}}};N.apply=uc});var vi=g(E=>{"use strict";h();Object.defineProperty(E,"__esModule",{value:!0});E.dst=E.src=E.apply=E.diff=E.toBin=E.toStr=void 0;var ac=(P(),j(A)),kt=ac.__importStar(Ct()),hc=s=>{let e="",t=s.length;for(let n=0;n<t;n++)e+=String.fromCharCode(s[n]);return e};E.toStr=hc;var dc=s=>{let e=s.length,t=new Uint8Array(e);for(let n=0;n<e;n++)t[n]=s.charCodeAt(n);return t};E.toBin=dc;var fc=(s,e)=>{let t=(0,E.toStr)(s),n=(0,E.toStr)(e);return kt.diff(t,n)};E.diff=fc;var pc=(s,e,t,n)=>kt.apply(s,e,(i,r)=>t(i,(0,E.toBin)(r)),n);E.apply=pc;var gc=s=>(0,E.toBin)(kt.src(s));E.src=gc;var wc=s=>(0,E.toBin)(kt.dst(s));E.dst=wc});var yi=g(he=>{"use strict";h();Object.defineProperty(he,"__esModule",{value:!0});he.apply=he.diff=he.agg=void 0;var _c=(P(),j(A)),Re=_c.__importStar(Ct()),bc=s=>{let e=[],t=s.length,n=[],i=(r,o)=>{if(!o.length)return;let c=n.length;if(c){let l=n[c-1];if(l[0]===r){l[1]+=o;return}}n.push([r,o])};e:for(let r=0;r<t;r++){let o=s[r],c=o[0],l=o[1],u=l.indexOf(`
|
|
3
|
+
import{a as A,b as P,c as Vs,d as Rs,e as z,f as ue,g as gn,h as Ds,i as Ur,j as ae,k as wn,l as _n,m as Fr,n as zr,o as $r,p as Hr,q as Jr,r as Us,s as Gr,t as Kr,u as G}from"./chunk-HXRQLPVQ.js";import{c as g,f as j,g as h}from"./chunk-WRU7YLUO.js";var zs=g(Fs=>{"use strict";h();Object.defineProperty(Fs,"__esModule",{value:!0})});var Ye=g(lt=>{"use strict";h();Object.defineProperty(lt,"__esModule",{value:!0});lt.ConNode=void 0;var Wr=wn(),Xr=G(),Yr=z(),bn=class s{constructor(e,t){this.id=e,this.val=t,this.api=void 0,this.parent=void 0}name(){return"con"}children(){}child(){}container(){}view(){return this.val}clone(){return new s(this.id,this.val)}delta(e,t,n){let{id:i,val:r}=this;t.has(i)||n.push(new Xr.NewConOp(i,r))}toString(e){return this.name()+" "+(0,Yr.printTs)(this.id)+" "+(0,Wr.con)(this.val)}};lt.ConNode=bn});var $s=g(ut=>{"use strict";h();Object.defineProperty(ut,"__esModule",{value:!0});ut.RelativeTimestamp=void 0;var mn=class{constructor(e,t){this.sessionIndex=e,this.timeDiff=t}};ut.RelativeTimestamp=mn});var Js=g(ht=>{"use strict";h();Object.defineProperty(ht,"__esModule",{value:!0});ht.ClockEncoder=void 0;var Hs=z(),Qr=$s(),at=class{constructor(e,t){this.index=e,this.clock=t}},vn=class{constructor(){this.table=new Map,this.index=1,this.clock=null}reset(e){this.index=1,this.clock=e;let t=new at(this.index++,(0,Hs.tick)(e,-1));this.table.clear(),this.table.set(e.sid,t)}append(e){let t=e.time,n=e.sid,i=this.table.get(n);if(!i){let c=this.clock.peers.get(n);c||(c=new Hs.Timestamp(n,this.clock.time-1)),i=new at(this.index++,c),this.table.set(n,i)}let o=i.clock.time-t;if(o<0)throw new Error("TIME_TRAVEL");return new Qr.RelativeTimestamp(i.index,o)}toJson(){let e=[];return this.table.forEach(t=>{let n=t.clock;e.push(n.sid,n.time)}),e}};ht.ClockEncoder=vn});var yn=g(Be=>{"use strict";h();Object.defineProperty(Be,"__esModule",{value:!0});Be.CRDT_MAJOR_OVERLAY=Be.CRDT_MAJOR=void 0;var Gs;(function(s){s[s.CON=0]="CON",s[s.VAL=1]="VAL",s[s.OBJ=2]="OBJ",s[s.VEC=3]="VEC",s[s.STR=4]="STR",s[s.BIN=5]="BIN",s[s.ARR=6]="ARR"})(Gs||(Be.CRDT_MAJOR=Gs={}));var Ks;(function(s){s[s.CON=0]="CON",s[s.VAL=32]="VAL",s[s.VEC=96]="VEC",s[s.OBJ=64]="OBJ",s[s.STR=128]="STR",s[s.BIN=160]="BIN",s[s.ARR=192]="ARR"})(Ks||(Be.CRDT_MAJOR_OVERLAY=Ks={}))});var Ws=g(dt=>{"use strict";h();Object.defineProperty(dt,"__esModule",{value:!0});dt.Encoder=void 0;var Zr=(P(),j(A)),ve=Zr.__importStar(se()),eo=Js(),to=Rs(),no=z(),so=Ds(),Qe=yn(),On=class extends so.CborEncoder{constructor(e){super(e||new to.CrdtWriter),this.clockEncoder=new eo.ClockEncoder,this.time=0,this.cTableEntry=t=>{let n=t.clock,i=this.writer;i.vu57(n.sid),i.vu57(n.time)},this.tsLogical=t=>{let n=this.clockEncoder.append(t);this.writer.id(n.sessionIndex,n.timeDiff)},this.tsServer=t=>{this.writer.vu57(t.time)},this.ts=this.tsLogical,this.cKey=(t,n)=>{this.writeStr(n),this.cNode(this.doc.index.get(t))}}encode(e){this.doc=e;let t=this.writer;return t.reset(),e.clock.sid===1?this.encodeServer(e):this.encodeLogical(e),t.flush()}encodeLogical(e){let t=this.writer;this.ts=this.tsLogical,this.clockEncoder.reset(e.clock),t.ensureCapacity(4);let n=t.x0,i=t.x;t.x+=4,this.cRoot(e.root),this.encodeClockTable(n,i)}encodeServer(e){this.ts=this.tsServer;let t=this.writer;t.u8(128),t.vu57(this.time=e.clock.time),this.cRoot(e.root)}encodeClockTable(e,t){let n=this.writer,i=n.x0-e;n.view.setUint32(n.x0+(t-e),n.x-t-i-4);let o=this.clockEncoder.table,c=o.size;n.vu57(c),o.forEach(this.cTableEntry)}cRoot(e){e.val.sid===0?this.writer.u8(0):this.cNode(e.node())}writeTL(e,t){let n=this.writer;t<31?n.u8(e|t):(n.u8(e|31),n.vu57(t))}cNode(e){e instanceof ve.ConNode?this.cCon(e):e instanceof ve.ValNode?this.cVal(e):e instanceof ve.StrNode?this.cStr(e):e instanceof ve.ObjNode?this.cObj(e):e instanceof ve.VecNode?this.cVec(e):e instanceof ve.ArrNode?this.cArr(e):e instanceof ve.BinNode&&this.cBin(e)}cCon(e){let t=e.val;this.ts(e.id),t instanceof no.Timestamp?(this.writer.u8(1),this.ts(t)):(this.writer.u8(0),this.writeAny(t))}cVal(e){this.ts(e.id),this.writer.u8(32),this.cNode(e.node())}cObj(e){this.ts(e.id);let t=e.keys;this.writeTL(Qe.CRDT_MAJOR_OVERLAY.OBJ,t.size),t.forEach(this.cKey)}cVec(e){let t=e.elements,n=t.length;this.ts(e.id),this.writeTL(Qe.CRDT_MAJOR_OVERLAY.VEC,n);let i=this.doc.index;for(let r=0;r<n;r++){let o=t[r];o?this.cNode(i.get(o)):this.writer.u8(0)}}cStr(e){let t=this.ts;t(e.id),this.writeTL(Qe.CRDT_MAJOR_OVERLAY.STR,e.count);for(let n=e.first();n;n=e.next(n))t(n.id),n.del?this.writeUInteger(n.span):this.writeStr(n.data)}cBin(e){let t=this.ts,n=this.writer;t(e.id),this.writeTL(Qe.CRDT_MAJOR_OVERLAY.BIN,e.count);for(let i=e.first();i;i=e.next(i)){t(i.id);let r=i.span,o=i.del;n.b1vu56(~~o,r),!o&&n.buf(i.data,r)}}cArr(e){let t=this.ts,n=this.writer;t(e.id),this.writeTL(Qe.CRDT_MAJOR_OVERLAY.ARR,e.count);let i=this.doc.index;for(let r=e.first();r;r=e.next(r)){t(r.id);let o=r.span,c=r.del;if(n.b1vu56(~~c,o),c)continue;let l=r.data;for(let u=0;u<o;u++)this.cNode(i.get(l[u]))}}};dt.Encoder=On});var Xs=g(ft=>{"use strict";h();Object.defineProperty(ft,"__esModule",{value:!0});ft.ClockDecoder=void 0;var Ze=z(),Nn=class s{static fromArr(e){let t=new s(e[0],e[1]),n=e.length;for(let i=2;i<n;i+=2)t.pushTuple(e[i],e[i+1]);return t}constructor(e,t){this.table=[],this.clock=new Ze.ClockVector(e,t+1),this.table.push((0,Ze.ts)(e,t))}pushTuple(e,t){let n=(0,Ze.ts)(e,t);this.clock.observe(n,1),this.table.push(n)}decodeId(e,t){if(!e)return(0,Ze.ts)(0,t);let n=this.table[e-1];if(!n)throw new Error("INVALID_CLOCK_TABLE");return(0,Ze.ts)(n.sid,n.time-t)}};ft.ClockDecoder=Nn});var Ys=g(pt=>{"use strict";h();Object.defineProperty(pt,"__esModule",{value:!0});pt.Decoder=void 0;var io=(P(),j(A)),W=io.__importStar(se()),ro=Xs(),oo=Vs(),co=z(),xn=gt(),lo=Hr(),ye=yn(),Sn=class extends lo.CborDecoderBase{constructor(){super(new oo.CrdtReader),this.clockDecoder=void 0,this.time=-1,this.cStrChunk=()=>{let e=this.ts(),t=this.val();return typeof t=="string"?new W.StrChunk(e,t.length,t):new W.StrChunk(e,~~t,"")},this.cBinChunk=()=>{let e=this.ts(),t=this.reader,[n,i]=t.b1vu56();return n?new W.BinChunk(e,i,void 0):new W.BinChunk(e,i,t.buf(i))}}decode(e,t){this.clockDecoder=void 0,this.time=-1;let n=this.reader;if(n.reset(e),n.peak()&128){n.x++;let c=this.time=n.vu57();t||(t=xn.Model.withServerClock(void 0,c))}else if(this.decodeClockTable(),!t){let c=this.clockDecoder.clock;t=xn.Model.create(void 0,c)}this.doc=t;let r=this.cRoot(),o=t.root=new W.RootNode(this.doc,r.id);return r.parent=o,this.clockDecoder=void 0,t}decodeClockTable(){let e=this.reader,t=e.u32(),n=e.x;e.x+=t;let i=e.vu57(),r=e.vu57(),o=e.vu57();this.clockDecoder=new ro.ClockDecoder(r,o);for(let c=1;c<i;c++){let l=e.vu57(),u=e.vu57();this.clockDecoder.pushTuple(l,u)}e.x=n}ts(){if(this.time<0){let[n,i]=this.reader.id();return this.clockDecoder.decodeId(n,i)}else return new co.Timestamp(1,this.reader.vu57())}cRoot(){let e=this.reader;return e.uint8[e.x]?this.cNode():xn.UNDEFINED}cNode(){let e=this.reader,t=this.ts(),n=e.u8(),i=n>>5,r=n&31;switch(i){case ye.CRDT_MAJOR.CON:return this.cCon(t,r);case ye.CRDT_MAJOR.VAL:return this.cVal(t);case ye.CRDT_MAJOR.OBJ:return this.cObj(t,r!==31?r:e.vu57());case ye.CRDT_MAJOR.VEC:return this.cVec(t,r!==31?r:e.vu57());case ye.CRDT_MAJOR.STR:return this.cStr(t,r!==31?r:e.vu57());case ye.CRDT_MAJOR.BIN:return this.cBin(t,r!==31?r:e.vu57());case ye.CRDT_MAJOR.ARR:return this.cArr(t,r!==31?r:e.vu57())}throw new Error("UNKNOWN_NODE")}cCon(e,t){let n=this.doc,i=t?this.ts():this.val(),r=new W.ConNode(e,i);return n.index.set(e,r),r}cVal(e){let t=this.cNode(),n=this.doc,i=new W.ValNode(n,e,t.id);return t.parent=i,n.index.set(e,i),i}cObj(e,t){let n=new W.ObjNode(this.doc,e);for(let i=0;i<t;i++)this.cObjChunk(n);return this.doc.index.set(e,n),n}cObjChunk(e){let t=this.key(),n=this.cNode();n.parent=e,e.keys.set(t,n.id)}cVec(e,t){let n=this.reader,i=new W.VecNode(this.doc,e),r=i.elements;for(let o=0;o<t;o++)if(!n.peak())n.x++,r.push(void 0);else{let l=this.cNode();l.parent=i,r.push(l.id)}return this.doc.index.set(e,i),i}cStr(e,t){let n=new W.StrNode(e);return t&&n.ingest(t,this.cStrChunk),this.doc.index.set(e,n),n}cBin(e,t){let n=new W.BinNode(e);return t&&n.ingest(t,this.cBinChunk),this.doc.index.set(e,n),n}cArr(e,t){let n=new W.ArrNode(this.doc,e);return t&&n.ingest(t,()=>{let i=this.ts(),[r,o]=this.reader.b1vu56();if(r)return new W.ArrChunk(i,o,void 0);let c=[];for(let l=0;l<o;l++){let u=this.cNode();u.parent=n,c.push(u.id)}return new W.ArrChunk(i,o,c)}),this.doc.index.set(e,n),n}};pt.Decoder=Sn});var Qs=g(Le=>{"use strict";h();Object.defineProperty(Le,"__esModule",{value:!0});Le.decoder=Le.encoder=void 0;var uo=Ws(),ao=Ys();Le.encoder=new uo.Encoder;Le.decoder=new ao.Decoder});var wt=g(Cn=>{"use strict";h();Object.defineProperty(Cn,"__esModule",{value:!0});Cn.hasOwnProperty=fo;var ho=Object.prototype.hasOwnProperty;function fo(s,e){return ho.call(s,e)}});var kn=g(_t=>{"use strict";h();Object.defineProperty(_t,"__esModule",{value:!0});_t.get=void 0;var po=wt(),go=(s,e)=>{let t=e.length,n;if(!t)return s;for(let i=0;i<t;i++)if(n=e[i],s instanceof Array){if(typeof n!="number"){if(n==="-")return;let r=~~n;if(""+r!==n)return;n=r}s=s[n]}else if(typeof s=="object"){if(!s||!(0,po.hasOwnProperty)(s,n))return;s=s[n]}else return;return s};_t.get=go});var bt=g(R=>{"use strict";h();Object.defineProperty(R,"__esModule",{value:!0});R.isInteger=R.isRoot=R.toPath=void 0;R.unescapeComponent=Zs;R.escapeComponent=ei;R.parseJsonPointer=ti;R.formatJsonPointer=vo;R.isChild=Oo;R.isPathEqual=No;R.parent=So;R.isValidIndex=Co;var wo=/~1/g,_o=/~0/g,bo=/~/g,mo=/\//g;function Zs(s){return s.indexOf("~")===-1?s:s.replace(wo,"/").replace(_o,"~")}function ei(s){return s.indexOf("/")===-1&&s.indexOf("~")===-1?s:s.replace(bo,"~0").replace(mo,"~1")}function ti(s){return s?s.slice(1).split("/").map(Zs):[]}function vo(s){return(0,R.isRoot)(s)?"":"/"+s.map(e=>ei(String(e))).join("/")}var yo=s=>typeof s=="string"?ti(s):s;R.toPath=yo;function Oo(s,e){if(s.length>=e.length)return!1;for(let t=0;t<s.length;t++)if(s[t]!==e[t])return!1;return!0}function No(s,e){if(s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(s[t]!==e[t])return!1;return!0}var xo=s=>!s.length;R.isRoot=xo;function So(s){if(s.length<1)throw new Error("NO_PARENT");return s.slice(0,s.length-1)}function Co(s){if(typeof s=="number")return!0;let e=Number.parseInt(s,10);return String(e)===s&&e>=0}var ko=s=>{let e=s.length,t=0,n;for(;t<e;){if(n=s.charCodeAt(t),n>=48&&n<=57){t++;continue}return!1}return!0};R.isInteger=ko});var si=g(ni=>{"use strict";h();Object.defineProperty(ni,"__esModule",{value:!0})});var ii=g(Oe=>{"use strict";h();Object.defineProperty(Oe,"__esModule",{value:!0});Oe.validatePath=Oe.validateJsonPointer=void 0;var Io=s=>{if(typeof s=="string"){if(s){if(s[0]!=="/")throw new Error("POINTER_INVALID");if(s.length>1024)throw new Error("POINTER_TOO_LONG")}}else(0,Oe.validatePath)(s)};Oe.validateJsonPointer=Io;var{isArray:qo}=Array,To=s=>{if(!qo(s))throw new Error("Invalid path.");if(s.length>256)throw new Error("Path too long.");for(let e of s)switch(typeof e){case"string":case"number":continue;default:throw new Error("Invalid path step.")}};Oe.validatePath=To});var oi=g(ie=>{"use strict";h();Object.defineProperty(ie,"__esModule",{value:!0});ie.isObjectReference=ie.isArrayEnd=ie.isArrayReference=ie.find=void 0;var jo=wt(),{isArray:ri}=Array,Ao=(s,e)=>{let t=e.length;if(!t)return{val:s};let n,i;for(let o=0;o<t;o++)if(n=s,i=e[o],ri(n)){let c=n.length;if(i==="-")i=c;else if(typeof i=="string"){let l=~~i;if(""+l!==i)throw new Error("INVALID_INDEX");if(i=l,i<0)throw new Error("INVALID_INDEX")}s=n[i]}else if(typeof n=="object"&&n)s=(0,jo.hasOwnProperty)(n,i)?n[i]:void 0;else throw new Error("NOT_FOUND");return{val:s,obj:n,key:i}};ie.find=Ao;var Po=s=>ri(s.obj)&&typeof s.key=="number";ie.isArrayReference=Po;var Eo=s=>s.obj.length===s.key;ie.isArrayEnd=Eo;var Bo=s=>typeof s.obj=="object"&&typeof s.key=="string";ie.isObjectReference=Bo});var ci=g(mt=>{"use strict";h();Object.defineProperty(mt,"__esModule",{value:!0});mt.findByPointer=void 0;var Lo=wt(),Mo=bt(),{isArray:Vo}=Array,Ro=(s,e)=>{if(!s)return{val:e};let t,n,i=0,r=1;for(;i>-1;)if(i=s.indexOf("/",r),n=i>-1?s.substring(r,i):s.substring(r),r=i+1,t=e,Vo(t)){let o=t.length;if(n==="-")n=o;else{let c=~~n;if(""+c!==n)throw new Error("INVALID_INDEX");if(n=c,n<0)throw"INVALID_INDEX"}e=t[n]}else if(typeof t=="object"&&t)n=(0,Mo.unescapeComponent)(n),e=(0,Lo.hasOwnProperty)(t,n)?t[n]:void 0;else throw"NOT_FOUND";return{val:e,obj:t,key:n}};mt.findByPointer=Ro});var li=g(In=>{"use strict";h();Object.defineProperty(In,"__esModule",{value:!0});var Do=(P(),j(A));Do.__exportStar(ci(),In)});var ui=g(we=>{"use strict";h();Object.defineProperty(we,"__esModule",{value:!0});var Me=(P(),j(A));Me.__exportStar(si(),we);Me.__exportStar(bt(),we);Me.__exportStar(ii(),we);Me.__exportStar(kn(),we);Me.__exportStar(oi(),we);Me.__exportStar(li(),we)});var ai=g(vt=>{"use strict";h();Object.defineProperty(vt,"__esModule",{value:!0});vt.find=void 0;var Uo=ui(),qn=se(),Fo=(s,e)=>{let t=(0,Uo.toPath)(e),n=s,i=t.length;if(!i)return n;let r=0;for(;r<i&&n;){let o=t[r++];if(n=n.container(),!n)throw new Error("NOT_CONTAINER");if(n instanceof qn.ObjNode){let c=n.get(String(o));if(!c)throw new Error("NOT_FOUND");n=c}else if(n instanceof qn.ArrNode){let c=n.getNode(Number(o));if(!c)throw new Error("NOT_FOUND");n=c}else if(n instanceof qn.VecNode){let c=n.get(Number(o));if(!c)throw new Error("NOT_FOUND");n=c}}return n};vt.find=Fo});var jn=g(yt=>{"use strict";h();Object.defineProperty(yt,"__esModule",{value:!0});yt.FanOut=void 0;var Tn=class{constructor(){this.listeners=new Set}emit(e){this.listeners.forEach(t=>t(e))}listen(e){let t=this.listeners;return t.add(e),()=>t.delete(e)}};yt.FanOut=Tn});var Ln=g(re=>{"use strict";h();Object.defineProperty(re,"__esModule",{value:!0});re.OnNewFanOut=re.MapFanOut=re.MicrotaskBufferFanOut=re.MergeFanOut=void 0;var Ot=jn(),An=class extends Ot.FanOut{constructor(e,t=n=>n){super(),this.fanouts=e,this.mappper=t,this.unsubs=[]}listen(e){this.listeners.size||(this.unsubs=this.fanouts.map(n=>n.listen(i=>this.emit(this.mappper(i)))));let t=super.listen(e);return()=>{if(t(),!this.listeners.size){for(let n of this.unsubs)n();this.unsubs=[]}}}};re.MergeFanOut=An;var Pn=class extends Ot.FanOut{constructor(e){super(),this.source=e,this.buffer=[],this.unsub=void 0}listen(e){this.unsub||(this.unsub=this.source.listen(n=>{let i=this.buffer;i.length||queueMicrotask(()=>{this.emit(i),this.buffer=[]}),i.push(n)}));let t=super.listen(e);return()=>{t(),this.listeners.size||this.clear()}}clear(){this.listeners.clear(),this.buffer=[],this.unsub?.(),this.unsub=void 0}};re.MicrotaskBufferFanOut=Pn;var En=class extends Ot.FanOut{constructor(e,t){super(),this.source=e,this.mapper=t,this.unsub=void 0}listen(e){this.unsub||(this.unsub=this.source.listen(n=>this.emit(this.mapper(n))));let t=super.listen(e);return()=>{t(),this.listeners.size||this.clear()}}clear(){this.listeners.clear(),this.unsub?.(),this.unsub=void 0}};re.MapFanOut=En;var Bn=class extends Ot.FanOut{constructor(e,t=void 0){super(),this.source=e,this.last=t,this.unsub=void 0}listen(e){this.unsub||(this.unsub=this.source.listen(n=>{this.last!==n&&this.emit(this.last=n)}));let t=super.listen(e);return()=>{t(),this.listeners.size||this.clear()}}clear(){this.listeners.clear(),this.last=void 0,this.unsub?.(),this.unsub=void 0}};re.OnNewFanOut=Bn});var di=g(Nt=>{"use strict";h();Object.defineProperty(Nt,"__esModule",{value:!0});Nt.NodeEvents=void 0;var hi=Ln(),Mn=class{constructor(e){this.api=e,this.subscribe=t=>this.onViewChanges.listen(()=>t()),this.getSnapshot=()=>this.api.view(),this.onChanges=new hi.MapFanOut(this.api.api.onChanges,this.getSnapshot),this.onViewChanges=new hi.OnNewFanOut(this.onChanges,this.api.view())}onChange(e){return this.api.api.onChange.listen(n=>{e(n)})}handleDelete(){this.onViewChanges.clear(),this.onChanges.clear()}};Nt.NodeEvents=Mn});var fi=g(xt=>{"use strict";h();Object.defineProperty(xt,"__esModule",{value:!0});xt.ExtNode=void 0;var zo=z(),Vn=class{constructor(e){this.data=e,this.api=void 0,this.parent=void 0,this.id=e.id}children(e){}child(){return this.data}container(){return this.data.container()}delta(){}toString(e,t){return this.name()+(t?" "+(0,zo.printTs)(t):"")+" "+this.data.toString(e)}};xt.ExtNode=Vn});var pi=g(Ve=>{"use strict";h();Object.defineProperty(Ve,"__esModule",{value:!0});Ve.deepEqual=void 0;var Rn=Array.isArray,$o=Object.prototype,Ho=(s,e)=>{if(s===e)return!0;let t=0,n=0;if(Rn(s)){if(!Rn(e)||(t=s.length,t!==e.length))return!1;for(n=t;n--!==0;)if(!(0,Ve.deepEqual)(s[n],e[n]))return!1;return!0}if(s&&e&&typeof s=="object"&&typeof e=="object"){e:{if(s.__proto__===$o)break e;if(s instanceof Uint8Array){if(!(e instanceof Uint8Array))return!1;let r=s.length;if(r!==e.length)return!1;for(let o=0;o<r;o++)if(s[o]!==e[o])return!1;return!0}}let i=Object.keys(s);if(t=i.length,t!==Object.keys(e).length||Rn(e))return!1;for(n=t;n--!==0;){let r=i[n];if(!(0,Ve.deepEqual)(s[r],e[r]))return!1}return!0}return!1};Ve.deepEqual=Ho});var gi=g(Dn=>{"use strict";h();Object.defineProperty(Dn,"__esModule",{value:!0});var Jo=(P(),j(A));Jo.__exportStar(pi(),Dn)});var wi=g(Un=>{"use strict";h();Object.defineProperty(Un,"__esModule",{value:!0});var Go=(P(),j(A));Go.__exportStar(gi(),Un)});var _i=g(St=>{"use strict";h();Object.defineProperty(St,"__esModule",{value:!0});St.cmpUint8Array=void 0;var Ko=(s,e)=>{let t=s.length;if(t!==e.length)return!1;for(let n=0;n<t;n++)if(s[n]!==e[n])return!1;return!0};St.cmpUint8Array=Ko});var Ct=g(N=>{"use strict";h();Object.defineProperty(N,"__esModule",{value:!0});N.apply=N.invert=N.dst=N.src=N.diffEdit=N.diff=N.overlap=N.sfx=N.pfx=N.normalize=void 0;var Wo=s=>{let e=s.length;if(e<2)return s;let t=0;e:{if(!s[0][1])break e;for(t=1;t<e;t++){let i=s[t-1],r=s[t];if(!r[1]||i[0]===r[0])break e}return s}let n=[];for(let i=0;i<t;i++)n.push(s[i]);for(let i=t;i<e;i++){let r=s[i];if(!r[1])continue;let o=n.length>0?n[n.length-1]:null;o&&o[0]===r[0]?o[1]+=r[1]:n.push(r)}return n};N.normalize=Wo;var Xo=s=>{let e=s.charCodeAt(0);return e>=56320&&e<=57343},Yo=s=>{let e=s.charCodeAt(s.length-1);return e>=55296&&e<=56319},mi=(s,e)=>{s.push([0,""]);let t=0,n=0,i=0,r="",o="",c=0;for(;t<s.length;){if(t<s.length-1&&!s[t][1]){s.splice(t,1);continue}let u=s[t];switch(u[0]){case 1:i++,t++,o+=u[1];break;case-1:n++,t++,r+=u[1];break;case 0:{let a=t-i-n-1;if(e){let _=s[a];if(a>=0){let y=_[1];if(Yo(y)){let v=y.slice(-1);if(_[1]=y=y.slice(0,-1),r=v+r,o=v+o,!y){s.splice(a,1),t--;let V=a-1,J=s[V];if(J){let Q=J[0];Q===1?(i++,V--,o=J[1]+o):Q===-1&&(n++,V--,r=J[1]+r)}a=V}}}let m=s[t],b=m[1];if(Xo(b)){let y=b.charAt(0);m[1]=b.slice(1),r+=y,o+=y}}if(t<s.length-1&&!s[t][1]){s.splice(t,1);break}let d=r.length>0,f=o.length>0;if(d||f){d&&f&&(c=(0,N.pfx)(o,r),c!==0&&(a>=0?s[a][1]+=o.slice(0,c):(s.splice(0,0,[0,o.slice(0,c)]),t++),o=o.slice(c),r=r.slice(c)),c=(0,N.sfx)(o,r),c!==0&&(s[t][1]=o.slice(o.length-c)+s[t][1],o=o.slice(0,o.length-c),r=r.slice(0,r.length-c)));let _=i+n,m=r.length,b=o.length;m===0&&b===0?(s.splice(t-_,_),t=t-_):m===0?(s.splice(t-_,_,[1,o]),t=t-_+1):b===0?(s.splice(t-_,_,[-1,r]),t=t-_+1):(s.splice(t-_,_,[-1,r],[1,o]),t=t-_+2)}let p=s[t-1];t!==0&&p[0]===0?(p[1]+=s[t][1],s.splice(t,1)):t++,i=0,n=0,r="",o="";break}}}s[s.length-1][1]===""&&s.pop();let l=!1;for(t=1;t<s.length-1;){let u=s[t-1],a=s[t+1];if(u[0]===0&&a[0]===0){let d=u[1],f=s[t],p=f[1],_=a[1];p.slice(p.length-d.length)===d?(s[t][1]=d+p.slice(0,p.length-d.length),a[1]=d+_,s.splice(t-1,1),l=!0):p.slice(0,_.length)===_&&(u[1]+=a[1],f[1]=p.slice(_.length)+_,s.splice(t+1,1),l=!0)}t++}l&&mi(s,e)},bi=(s,e,t,n)=>{if(t>0&&t<s.length){let o=s.charCodeAt(t);o>=56320&&o<=57343&&t--}if(n>0&&n<e.length){let o=e.charCodeAt(n);o>=56320&&o<=57343&&n--}let i=Fn(s.slice(0,t),e.slice(0,n),!1),r=Fn(s.slice(t),e.slice(n),!1);return i.concat(r)},Qo=(s,e)=>{let t=s.length,n=e.length,i=Math.ceil((t+n)/2),r=i,o=2*i,c=new Array(o),l=new Array(o);for(let m=0;m<o;m++)c[m]=-1,l[m]=-1;c[r+1]=0,l[r+1]=0;let u=t-n,a=u%2!==0,d=0,f=0,p=0,_=0;for(let m=0;m<i;m++){for(let b=-m+d;b<=m-f;b+=2){let y=r+b,v=0,V=c[y-1],J=c[y+1];b===-m||b!==m&&V<J?v=J:v=V+1;let Q=v-b;for(;v<t&&Q<n&&s.charAt(v)===e.charAt(Q);)v++,Q++;if(c[y]=v,v>t)f+=2;else if(Q>n)d+=2;else if(a){let Xe=r+u-b,Ms=l[Xe];if(Xe>=0&&Xe<o&&Ms!==-1&&v>=t-Ms)return bi(s,e,v,Q)}}for(let b=-m+p;b<=m-_;b+=2){let y=r+b,v=b===-m||b!==m&&l[y-1]<l[y+1]?l[y+1]:l[y-1]+1,V=v-b;for(;v<t&&V<n&&s.charAt(t-v-1)===e.charAt(n-V-1);)v++,V++;if(l[y]=v,v>t)_+=2;else if(V>n)p+=2;else if(!a){let J=r+u-b,Q=c[J];if(J>=0&&J<o&&Q!==-1){let Xe=r+Q-J;if(v=t-v,Q>=v)return bi(s,e,Q,Xe)}}}}return[[-1,s],[1,e]]},Zo=(s,e)=>{if(!s)return[[1,e]];if(!e)return[[-1,s]];let t=s.length,n=e.length,i=t>n?s:e,r=t>n?e:s,o=r.length,c=i.indexOf(r);if(c>=0){let l=i.slice(0,c),u=i.slice(c+o);return t>n?[[-1,l],[0,r],[-1,u]]:[[1,l],[0,r],[1,u]]}return o===1?[[-1,s],[1,e]]:Qo(s,e)},ec=(s,e)=>{if(!s||!e||s.charAt(0)!==e.charAt(0))return 0;let t=0,n=Math.min(s.length,e.length),i=n,r=0;for(;t<i;)s.slice(r,i)===e.slice(r,i)?(t=i,r=t):n=i,i=Math.floor((n-t)/2+t);let o=s.charCodeAt(i-1);return o>=55296&&o<=56319&&i--,i};N.pfx=ec;var tc=(s,e)=>{if(!s||!e||s.slice(-1)!==e.slice(-1))return 0;let t=0,n=Math.min(s.length,e.length),i=n,r=0;for(;t<i;)s.slice(s.length-i,s.length-r)===e.slice(e.length-i,e.length-r)?(t=i,r=t):n=i,i=Math.floor((n-t)/2+t);if(i>0&&i<s.length){let o=s.length-i-1,c=s.charCodeAt(o),l=c>=55296&&c<=56319,u=c===8205||c>=65024&&c<=65039||c>=768&&c<=879;if(l||u)for(i--;i>0;){let a=s.length-i-1;if(a<0)break;let d=s.charCodeAt(a),f=d>=55296&&d<=56319,p=d===8205||d>=65024&&d<=65039||d>=768&&d<=879;if(!f&&!p)break;i--}}return i};N.sfx=tc;var nc=(s,e)=>{let t=s.length,n=e.length;if(t===0||n===0)return 0;let i=t;if(t>n?(i=n,s=s.substring(t-n)):t<n&&(e=e.substring(0,t)),s===e)return i;let r=0,o=1;for(;;){let c=s.substring(i-o),l=e.indexOf(c);if(l===-1)return r;o+=l,(l===0||s.substring(i-o)===e.substring(0,o))&&(r=o,o++)}};N.overlap=nc;var Fn=(s,e,t)=>{if(s===e)return s?[[0,s]]:[];let n=(0,N.pfx)(s,e),i=s.slice(0,n);s=s.slice(n),e=e.slice(n);let r=(0,N.sfx)(s,e),o=s.slice(s.length-r);s=s.slice(0,s.length-r),e=e.slice(0,e.length-r);let c=Zo(s,e);return i&&c.unshift([0,i]),o&&c.push([0,o]),mi(c,t),c},sc=(s,e)=>Fn(s,e,!0);N.diff=sc;var ic=(s,e,t)=>{e:{if(t<0)break e;let n=s.length,i=e.length;if(n===i)break e;let r=e.slice(t),o=r.length;if(o>n||s.slice(n-o)!==r)break e;if(i>n){let u=n-o,a=s.slice(0,u),d=e.slice(0,u);if(a!==d)break e;let f=e.slice(u,t),p=[];return a&&p.push([0,a]),f&&p.push([1,f]),r&&p.push([0,r]),p}else{let u=i-o,a=e.slice(0,u),d=s.slice(0,u);if(d!==a)break e;let f=s.slice(u,n-o),p=[];return d&&p.push([0,d]),f&&p.push([-1,f]),r&&p.push([0,r]),p}}return(0,N.diff)(s,e)};N.diffEdit=ic;var rc=s=>{let e="",t=s.length;for(let n=0;n<t;n++){let i=s[n];i[0]!==1&&(e+=i[1])}return e};N.src=rc;var oc=s=>{let e="",t=s.length;for(let n=0;n<t;n++){let i=s[n];i[0]!==-1&&(e+=i[1])}return e};N.dst=oc;var cc=s=>{let e=s[0];return e===0?s:e===1?[-1,s[1]]:[1,s[1]]},lc=s=>s.map(cc);N.invert=lc;var uc=(s,e,t,n)=>{let i=s.length,r=e;for(let o=i-1;o>=0;o--){let[c,l]=s[o];if(c===0)r-=l.length;else if(c===1)t(r,l);else{let u=l.length;r-=u,n(r,u,l)}}};N.apply=uc});var vi=g(E=>{"use strict";h();Object.defineProperty(E,"__esModule",{value:!0});E.dst=E.src=E.apply=E.diff=E.toBin=E.toStr=void 0;var ac=(P(),j(A)),kt=ac.__importStar(Ct()),hc=s=>{let e="",t=s.length;for(let n=0;n<t;n++)e+=String.fromCharCode(s[n]);return e};E.toStr=hc;var dc=s=>{let e=s.length,t=new Uint8Array(e);for(let n=0;n<e;n++)t[n]=s.charCodeAt(n);return t};E.toBin=dc;var fc=(s,e)=>{let t=(0,E.toStr)(s),n=(0,E.toStr)(e);return kt.diff(t,n)};E.diff=fc;var pc=(s,e,t,n)=>kt.apply(s,e,(i,r)=>t(i,(0,E.toBin)(r)),n);E.apply=pc;var gc=s=>(0,E.toBin)(kt.src(s));E.src=gc;var wc=s=>(0,E.toBin)(kt.dst(s));E.dst=wc});var yi=g(he=>{"use strict";h();Object.defineProperty(he,"__esModule",{value:!0});he.apply=he.diff=he.agg=void 0;var _c=(P(),j(A)),Re=_c.__importStar(Ct()),bc=s=>{let e=[],t=s.length,n=[],i=(r,o)=>{if(!o.length)return;let c=n.length;if(c){let l=n[c-1];if(l[0]===r){l[1]+=o;return}}n.push([r,o])};e:for(let r=0;r<t;r++){let o=s[r],c=o[0],l=o[1],u=l.indexOf(`
|
|
4
4
|
`);if(u<0){i(c,l);continue e}else i(c,l.slice(0,u+1)),n.length&&e.push(n),n=[];let a=u,d=l.length;t:for(;a<d;){let f=l.indexOf(`
|
|
5
5
|
`,a+1);if(f<0){i(c,l.slice(a+1));break t}e.push([[c,l.slice(a+1,f+1)]]),a=f}}n.length&&e.push(n);{let r=e.length;for(let o=0;o<r;o++){let c=e[o]=Re.normalize(e[o]),l=c.length;e:{if(l<2)break e;let u=c[0],a=c[1],d=a[0];if(u[0]!==0||d!==-1&&d!==1)break e;for(let f=2;f<l;f++)if(c[f][0]!==d)break e;for(let f=o+1;f<r;f++){let p=e[f]=Re.normalize(e[f]),_=p.length,m=u[1],b,y;if(p.length>1&&(b=p[0])[0]===d&&(y=p[1])[0]===0&&m===b[1]){c.splice(0,1),a[1]=m+a[1],y[1]=m+y[1],p.splice(0,1);break e}else for(let v=0;v<_;v++)if(p[v][0]!==d)break e}}e:{if(c.length<2)break e;let u=c[c.length-1],a=u[1];if(u[0]!==-1)break e;t:for(let d=o+1;d<r;d++){let f=e[d]=Re.normalize(e[d]),p=f.length,_;if(p===0)continue t;if(p===1){if(_=f[0],_[0]===-1)continue t;if(f[0][0]!==0)break e}else if(_=f[1],p>2||f[0][0]!==-1)break e;let m=_[0];if(m===-1)continue t;if(m!==0)break e;let b=_[1];if(b.length>a.length||!a.endsWith(b))break e;let y=a.length-b.length;u[1]=a.slice(0,y),c.push([0,b]),_[0]=-1,e[o]=Re.normalize(e[o]),e[d]=Re.normalize(e[d]);break e}}}}return e};he.agg=bc;var mc=(s,e)=>{if(!e.length)return s.map((f,p)=>[-1,p,-1]);if(!s.length)return e.map((f,p)=>[1,-1,p]);let t=s.join(`
|
|
6
6
|
`)+`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __nodeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __nodeCreateRequire(import.meta.url);
|
|
3
|
-
var a=Object.create;var p=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var i=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty;var j=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var z=(e,t)=>()=>(e&&(t=e(e=0)),t);var l=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),m=(e,t)=>{for(var n in t)p(e,n,{get:t[n],enumerable:!0})},y=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of g(t))!s.call(e,o)&&o!==n&&p(e,o,{get:()=>t[o],enumerable:!(r=c(t,o))||r.enumerable});return e};var H=(e,t,n)=>(n=e!=null?a(i(e)):{},y(t||!e||!e.__esModule?p(n,"default",{value:e,enumerable:!0}):n,e)),J=e=>y(p({},"__esModule",{value:!0}),e);var b,h=z(()=>{b={agent:"2.8.
|
|
3
|
+
var a=Object.create;var p=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var i=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty;var j=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var z=(e,t)=>()=>(e&&(t=e(e=0)),t);var l=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),m=(e,t)=>{for(var n in t)p(e,n,{get:t[n],enumerable:!0})},y=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of g(t))!s.call(e,o)&&o!==n&&p(e,o,{get:()=>t[o],enumerable:!(r=c(t,o))||r.enumerable});return e};var H=(e,t,n)=>(n=e!=null?a(i(e)):{},y(t||!e||!e.__esModule?p(n,"default",{value:e,enumerable:!0}):n,e)),J=e=>y(p({},"__esModule",{value:!0}),e);var b,h=z(()=>{b={agent:"2.8.6",ztype:"0.0.0-nogit",ztypeSchemaVersion:"2.1.2",crdtHelper:"3.0.4",jsonJoy:"18.28.0"}});export{j as a,z as b,l as c,m as d,H as e,J as f,h as g,b as h};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __nodeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __nodeCreateRequire(import.meta.url);
|
|
3
|
-
import{g as t,h as o}from"./chunk-
|
|
3
|
+
import{g as t,h as o}from"./chunk-WRU7YLUO.js";t();import{createRequire as a}from"module";import{fileURLToPath as i}from"url";import e from"path";var c=a(import.meta.url),n=typeof o>"u"?void 0:o,s=()=>{if(n)return{version:n.agent};try{let p=e.resolve(e.dirname(i(import.meta.url)),"../package.json");return c(p)}catch{return{}}},E=()=>s().version??"0.0.0";t();var r="zion-mcp",I="ZION",f="zion-nocode",A=`Not authenticated. Run \`${r} login\` once \u2014 it opens a browser and stores the token in ~/.${r}, shared by every directory (a workspace-local .${r}/credentials.json overrides it).`,l="https://auth.functorz.com/login",g="https://zionbackend.functorz.com",d="https://zion-app.functorz.com/zero/{projectExId}/api/graphql-v2",h="https://app-logger.functorz.com/log/{projectExId}/api/graphql",T="production",N={production:{editorBaseUrl:"https://zion.functorz.com",authEndpoint:l,apiBaseUrl:g,zeroApiUrlTemplate:d,logApiUrlTemplate:h},canary:{editorBaseUrl:"https://zion-canary.functorz.com",authEndpoint:"https://auth-canary.functorz.com/login",apiBaseUrl:"https://zionbackend-canary.functorz.com",zeroApiUrlTemplate:"https://zion-app-canary.functorz.com/zero/{projectExId}/api/graphql-v2",logApiUrlTemplate:"https://app-logger-canary.functorz.com/log/{projectExId}/api/graphql"},staging:{editorBaseUrl:"https://zion.functorz.work",authEndpoint:"https://auth.functorz.work/login",apiBaseUrl:"https://zionbackend.functorz.work",zeroApiUrlTemplate:"https://zion-app.functorz.work/zero/{projectExId}/api/graphql-v2",logApiUrlTemplate:"https://app-logger.functorz.work/log/{projectExId}/api/graphql"},local:{editorBaseUrl:"http://localhost:3000",authEndpoint:"https://auth.functorz.work/login",apiBaseUrl:"http://localhost:8080",zeroApiUrlTemplate:"https://zion-app.functorz.work/zero/{projectExId}/api/graphql-v2",logApiUrlTemplate:"https://app-logger.functorz.work/log/{projectExId}/api/graphql"}};export{n as a,s as b,E as c,r as d,I as e,f,A as g,T as h,N as i};
|