zion-mcp 2.7.14 → 2.8.0

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 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.7.14`
23
+ - **Command**: `npx -y zion-mcp@2.8.0`
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.7.14"]
35
+ "args": ["-y", "zion-mcp@2.8.0"]
36
36
  }
37
37
  }
38
38
  }
@@ -45,7 +45,7 @@ Zion MCP Server 是 [FunctorZ (Zion)](https://functorz.com) 提供的官方 [Mod
45
45
  - **Auth**: `auth`(op:`LOGIN` / `LOGOUT` / `WHOAMI` / `REAUTH`)、`get_account_profile`。
46
46
  - **Projects**: `get_projects`、`create_project`、`set_current_project`、`get_current_project`、`rename_project`、`rename_project_app`、`delete_project`、`reset_project`、`project_inspect`(op:`DETAIL` / `METADATA` / `RESOURCES`)。
47
47
  - **Schema 会话**: `schema_session`(op:`LOAD` / `RELOAD` / `SYNC` / `SNAPSHOT` / `VALIDATE`)、`schema_observe`(op:`STATE` / `EVENTS`)、`schema_status`。修改仅存于内存 CRDT 会话,需 `sync_backend` 后才会生效上线。
48
- - **Actionflow 模板**: `list_actionflow_node_templates`(服务端托管的预置集成节点——短信、视频/AI 生成等——含输入/输出类型,供规划用)。添加时先读 `schema_actionflow_node op=BROWSE_ACTION_FLOW_ADD_NODE_OPTIONS`,再把它返回的条目交给 `op=ADD_NODE`。
48
+ - **Actionflow 模板**: `list_actionflow_node_templates`(预置集成节点——短信、视频/AI 生成等——含 templateCodeId 与输入/输出类型,供规划用)。添加时先读 `schema_actionflow_node op=BROWSE_ACTION_FLOW_ADD_NODE_OPTIONS`,再把它返回的条目交给 `op=ADD_NODE`。
49
49
  - **Schema 编辑(ztype facades)** — 每个工具带一个 `op`;改动立即生效(用 `schema_undo` 撤销),再执行 `schema_session op=VALIDATE` + `sync_backend` 部署。由 ztype 工具目录自动生成。高频 facade 为常驻 MCP 工具,其余目录项通过 `search_tools` / `describe_tool` 按需发现(见下方 **工具发现**),再经 `ztype_tool_calls` 执行:
50
50
  <!-- GENERATED-ZTYPE-TOOLS:START (pnpm gen:tools) -->
51
51
  - `schema_action_menu` — op: `GET_SELECTABLE_COMPONENT_ACTIONS`
@@ -70,7 +70,7 @@ Zion MCP Server 是 [FunctorZ (Zion)](https://functorz.com) 提供的官方 [Mod
70
70
  - `schema_delete_tpa_parameter_children` — op: `DELETE_TPA_PARAMETER_CHILDREN`
71
71
  - `schema_delete_tpa_response_data` — op: `DELETE_TPA_RESPONSE_DATA`
72
72
  - `schema_delete_tpa_response_data_children` — op: `DELETE_TPA_RESPONSE_DATA_CHILDREN`
73
- - `schema_design_system` — op: `ADD_COLOR_THEMES` / `DELETE_COLOR_THEMES` / `GET_COLOR_THEMES` / `GET_STYLE_SCALE` / `SET_STYLE_SCALE` / `UPDATE_COLOR_THEMES`
73
+ - `schema_design_system` — op: `GET_STYLE_SCALE` / `SET_STYLE_SCALE`
74
74
  - `schema_get_all_tpa_configs_info` — op: `GET_ALL_TPA_CONFIGS_INFO`
75
75
  - `schema_get_tpa_config_detail` — op: `GET_TPA_CONFIG_DETAIL`
76
76
  - `schema_overview` — op: `GET_ENTITY_RELATION_GRAPH` / `GET_PROJECT_OVERVIEW`
@@ -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-QPWH6HFY.js";import{c as g,f as j,g as h}from"./chunk-GVWWJW5X.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-U2LHS4U2.js";import{c as g,f as j,g as h}from"./chunk-OHILD5KP.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
  `)+`
@@ -0,0 +1,3 @@
1
+ import { createRequire as __nodeCreateRequire } from 'node:module';
2
+ const require = __nodeCreateRequire(import.meta.url);
3
+ import{g as t,h as o}from"./chunk-OHILD5KP.js";t();import{createRequire as a}from"module";import{fileURLToPath as s}from"url";import e from"path";var c=a(import.meta.url),n=typeof o>"u"?void 0:o,i=()=>{if(n)return{version:n.agent};try{let p=e.resolve(e.dirname(s(import.meta.url)),"../package.json");return c(p)}catch{return{}}},E=()=>i().version??"0.0.0";t();var r="zion-mcp",U="ZION",I="zion-nocode",T=`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).`;function y(){return process.env.MCP_TYPE_SYSTEM?.toLowerCase()==="post"?"post_type_system_refactor":"pre_type_system_refactor"}var l="https://auth.functorz.com/login",g="https://zionbackend.functorz.com",_="https://zion-app.functorz.com/zero/{projectExId}/api/graphql-v2",d="https://app-logger.functorz.com/log/{projectExId}/api/graphql",A="production",N={production:{editorBaseUrl:"https://zion.functorz.com",authEndpoint:l,apiBaseUrl:g,zeroApiUrlTemplate:_,logApiUrlTemplate:d},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,i as b,E as c,r as d,U as e,I as f,T as g,y as h,A as i,N as j};