@graphrefly/graphrefly 0.42.0 → 0.43.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.
Files changed (143) hide show
  1. package/dist/{chunk-5ST42ESJ.js → chunk-3XDYJRYU.js} +1 -1
  2. package/dist/{chunk-FDZAZNRO.js → chunk-4YAN45KM.js} +1 -1
  3. package/dist/{chunk-ACMJ2ZPS.js → chunk-626TESAC.js} +1 -1
  4. package/dist/{chunk-7B7ELAT2.js → chunk-6HOSXQKF.js} +1 -1
  5. package/dist/{chunk-G5VBJ5K6.js → chunk-CUNIRONA.js} +1 -1
  6. package/dist/chunk-EBW4V6JN.js +1 -0
  7. package/dist/chunk-FDQGFWLF.js +1 -0
  8. package/dist/{chunk-KY2LMAXU.js → chunk-FG4TKHMC.js} +1 -1
  9. package/dist/{chunk-YGL7FPVQ.js → chunk-I7IGYPSL.js} +1 -1
  10. package/dist/{chunk-3K7HA4Y6.js → chunk-INQD2KRQ.js} +1 -1
  11. package/dist/{chunk-AGNM6RS6.js → chunk-JNWRYDJN.js} +1 -1
  12. package/dist/{chunk-LDQ3IUIP.js → chunk-JQFH2DV6.js} +1 -1
  13. package/dist/{chunk-5QRRKBUT.js → chunk-K2Q24F5T.js} +1 -1
  14. package/dist/chunk-KVV66NN2.js +1 -0
  15. package/dist/{chunk-3ERTUW2J.js → chunk-NON4NLIC.js} +4 -4
  16. package/dist/{chunk-IZM3UEH3.js → chunk-O2BLLH7M.js} +1 -1
  17. package/dist/{chunk-FUZ6S2DY.js → chunk-OCKEEPRJ.js} +1 -1
  18. package/dist/{chunk-NWXQIOIB.js → chunk-OFZG3TB3.js} +1 -1
  19. package/dist/{chunk-4QH6VJF4.js → chunk-OYJKFY7V.js} +1 -1
  20. package/dist/{chunk-7ARY3Y3T.js → chunk-P6C4WHZO.js} +1 -1
  21. package/dist/{chunk-Q7QQQA3I.js → chunk-PT7W5FCD.js} +1 -1
  22. package/dist/{chunk-KCACBSJH.js → chunk-Q4U3A3L5.js} +1 -1
  23. package/dist/{chunk-LPRWATHB.js → chunk-QE4IGY7I.js} +1 -1
  24. package/dist/{chunk-WHMUB5QB.js → chunk-QYVXF7GW.js} +1 -1
  25. package/dist/{chunk-DEJTNNQC.js → chunk-S3EEIPO7.js} +1 -1
  26. package/dist/{chunk-KT5DTRBP.js → chunk-SUWT3ZON.js} +1 -1
  27. package/dist/{chunk-CISGGAIF.js → chunk-TPKQW72B.js} +1 -1
  28. package/dist/{chunk-2K5RXLAH.js → chunk-V5A7M7RJ.js} +1 -1
  29. package/dist/{chunk-AS3TV2TV.js → chunk-VNC3TMVY.js} +1 -1
  30. package/dist/{chunk-6YFZMUMR.js → chunk-VOPGGIL7.js} +1 -1
  31. package/dist/{chunk-VRALOYRD.js → chunk-VQ4A6T2A.js} +1 -1
  32. package/dist/{chunk-HZKW2AAB.js → chunk-XG62INFA.js} +1 -1
  33. package/dist/{chunk-7VKFXLZQ.js → chunk-Y4NI3X7O.js} +1 -1
  34. package/dist/compat/index.cjs +5 -5
  35. package/dist/compat/index.d.cts +4 -4
  36. package/dist/compat/index.d.ts +4 -4
  37. package/dist/compat/index.js +1 -1
  38. package/dist/compat/nestjs/index.cjs +5 -5
  39. package/dist/compat/nestjs/index.d.cts +3 -3
  40. package/dist/compat/nestjs/index.d.ts +3 -3
  41. package/dist/compat/nestjs/index.js +1 -1
  42. package/dist/compat/zustand/index.js +1 -1
  43. package/dist/core/index.d.cts +2 -2
  44. package/dist/core/index.d.ts +2 -2
  45. package/dist/extra/index.cjs +11 -11
  46. package/dist/extra/index.d.cts +2 -2
  47. package/dist/extra/index.d.ts +2 -2
  48. package/dist/extra/index.js +1 -1
  49. package/dist/extra/node.js +1 -1
  50. package/dist/extra/operators.js +1 -1
  51. package/dist/extra/reactive.js +1 -1
  52. package/dist/extra/sources.js +1 -1
  53. package/dist/graph/index.cjs +1 -1
  54. package/dist/graph/index.d.cts +1 -1
  55. package/dist/graph/index.d.ts +1 -1
  56. package/dist/graph/index.js +1 -1
  57. package/dist/{index-C0-Jv1kP.d.cts → index-0rKFCVFp.d.cts} +9 -0
  58. package/dist/{index-B11anra4.d.cts → index-B5iz82A3.d.cts} +2 -2
  59. package/dist/{index-BtAsBp8K.d.cts → index-BAOD98JD.d.cts} +1 -1
  60. package/dist/{index-D-Xs74HZ.d.cts → index-BiX1Nkgx.d.cts} +13 -3
  61. package/dist/{index-HoU88d5U.d.cts → index-BojK2fwH.d.cts} +2 -2
  62. package/dist/{index-3NmAfcH0.d.cts → index-BwLvVVsy.d.cts} +1 -1
  63. package/dist/{index-DQo8xBgd.d.ts → index-C59mYFKp.d.ts} +1 -1
  64. package/dist/{index-DBIqYS43.d.cts → index-C9pjcz3l.d.cts} +0 -15
  65. package/dist/{index-CJQm0g38.d.ts → index-CAC_rNzm.d.ts} +1 -1
  66. package/dist/{index-sl4NyzQx.d.cts → index-CDXc9zKM.d.cts} +1 -1
  67. package/dist/{index-2B7u2pVn.d.cts → index-CLon-IWF.d.cts} +1 -1
  68. package/dist/{index-CEMx8n40.d.cts → index-COD1kVoS.d.cts} +1 -1
  69. package/dist/{index-Bn4zHYLj.d.ts → index-CPT7C_f1.d.ts} +1 -1
  70. package/dist/{index-D8l8hNXn.d.ts → index-CQG3D1cp.d.ts} +1 -1
  71. package/dist/{index-DO9XxMzS.d.ts → index-CZQXo5tH.d.ts} +0 -15
  72. package/dist/{index-Bbkgpt5t.d.ts → index-D-AEQVLo.d.ts} +2 -2
  73. package/dist/{index-CZmcDtFn.d.ts → index-D4Y1cMG0.d.ts} +1 -1
  74. package/dist/{index-B3OTH1dV.d.ts → index-DSZ3ZCHF.d.ts} +1 -1
  75. package/dist/{index-BUYXac2c.d.ts → index-Dh_HJ82K.d.ts} +2 -2
  76. package/dist/{index-4Uz-e_fL.d.ts → index-DwigL4lY.d.ts} +13 -3
  77. package/dist/{index-CPNSy-U0.d.cts → index-DyR7eU5S.d.cts} +19 -0
  78. package/dist/{index-BeT2r7sk.d.ts → index-JZUPJIJy.d.ts} +19 -0
  79. package/dist/{index-pT8sCpOJ.d.ts → index-K0_0eR8g.d.ts} +9 -0
  80. package/dist/{index-CJIuLu2f.d.cts → index-O16yXPK4.d.cts} +1 -1
  81. package/dist/{index-LIpQQE9f.d.cts → index-O7fucFrU.d.cts} +1 -1
  82. package/dist/{index-DmAgG5CI.d.cts → index-RV_yDjOX.d.cts} +1 -1
  83. package/dist/{index-D6egPFAL.d.ts → index-cm1GNcWE.d.ts} +1 -1
  84. package/dist/{index-CpyNFqkB.d.ts → index-wAzD9yVj.d.ts} +1 -1
  85. package/dist/index.cjs +39 -39
  86. package/dist/index.d.cts +16 -16
  87. package/dist/index.d.ts +16 -16
  88. package/dist/index.js +1 -1
  89. package/dist/patterns/ai/browser.js +1 -1
  90. package/dist/patterns/ai/index.cjs +15 -15
  91. package/dist/patterns/ai/index.d.cts +5 -5
  92. package/dist/patterns/ai/index.d.ts +5 -5
  93. package/dist/patterns/ai/index.js +1 -1
  94. package/dist/patterns/ai/node.js +1 -1
  95. package/dist/patterns/cqrs/index.cjs +3 -3
  96. package/dist/patterns/cqrs/index.d.cts +2 -2
  97. package/dist/patterns/cqrs/index.d.ts +2 -2
  98. package/dist/patterns/cqrs/index.js +1 -1
  99. package/dist/patterns/demo-shell/index.js +1 -1
  100. package/dist/patterns/domain-templates/index.cjs +2 -2
  101. package/dist/patterns/domain-templates/index.js +1 -1
  102. package/dist/patterns/graphspec/index.cjs +4 -4
  103. package/dist/patterns/graphspec/index.js +1 -1
  104. package/dist/patterns/harness/index.cjs +7 -7
  105. package/dist/patterns/harness/index.d.cts +5 -5
  106. package/dist/patterns/harness/index.d.ts +5 -5
  107. package/dist/patterns/harness/index.js +1 -1
  108. package/dist/patterns/inspect/index.cjs +3 -3
  109. package/dist/patterns/inspect/index.d.cts +1 -1
  110. package/dist/patterns/inspect/index.d.ts +1 -1
  111. package/dist/patterns/inspect/index.js +1 -1
  112. package/dist/patterns/job-queue/index.cjs +3 -3
  113. package/dist/patterns/job-queue/index.d.cts +2 -2
  114. package/dist/patterns/job-queue/index.d.ts +2 -2
  115. package/dist/patterns/job-queue/index.js +1 -1
  116. package/dist/patterns/memory/index.cjs +3 -3
  117. package/dist/patterns/memory/index.d.cts +2 -2
  118. package/dist/patterns/memory/index.d.ts +2 -2
  119. package/dist/patterns/memory/index.js +1 -1
  120. package/dist/patterns/messaging/index.cjs +3 -3
  121. package/dist/patterns/messaging/index.js +1 -1
  122. package/dist/patterns/orchestration/index.cjs +3 -3
  123. package/dist/patterns/orchestration/index.d.cts +3 -3
  124. package/dist/patterns/orchestration/index.d.ts +3 -3
  125. package/dist/patterns/orchestration/index.js +1 -1
  126. package/dist/patterns/process/index.cjs +1 -1
  127. package/dist/patterns/process/index.d.cts +3 -3
  128. package/dist/patterns/process/index.d.ts +3 -3
  129. package/dist/patterns/process/index.js +1 -1
  130. package/dist/patterns/reactive-layout/index.js +1 -1
  131. package/dist/patterns/reduction/index.js +1 -1
  132. package/dist/patterns/surface/index.cjs +3 -3
  133. package/dist/patterns/surface/index.js +1 -1
  134. package/dist/{pipeline-graph-WBlobVhU.d.cts → pipeline-graph-DPqKDk59.d.cts} +2 -2
  135. package/dist/{pipeline-graph-v8fMvqNk.d.ts → pipeline-graph-loP57TBA.d.ts} +2 -2
  136. package/dist/resilience-YIWPK4YC.js +1 -0
  137. package/dist/{sugar-CH-2ZY90.d.ts → sugar-DLwvMr3F.d.ts} +23 -3
  138. package/dist/{sugar-DStZfUEK.d.cts → sugar-DyVGtczU.d.cts} +23 -3
  139. package/package.json +1 -1
  140. package/dist/chunk-3ZZX7M25.js +0 -1
  141. package/dist/chunk-VE5SIZEM.js +0 -1
  142. package/dist/chunk-XLQPNNIC.js +0 -1
  143. package/dist/resilience-445VFFXQ.js +0 -1
@@ -1,3 +1,3 @@
1
- "use strict";var gt=Object.defineProperty;var Hn=Object.getOwnPropertyDescriptor;var Bn=Object.getOwnPropertyNames;var Un=Object.prototype.hasOwnProperty;var L=(r,e)=>()=>(r&&(e=r(r=0)),e);var Wn=(r,e)=>{for(var t in e)gt(r,t,{get:e[t],enumerable:!0})},Kn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Bn(e))!Un.call(r,s)&&s!==t&&gt(r,s,{get:()=>e[s],enumerable:!(n=Hn(e,s))||n.enumerable});return r};var qn=r=>Kn(gt({},"__esModule",{value:!0}),r);function ze(){return ve>0||Se}function Kt(){return ve>0}function we(r){ve>0?De.push(r):r()}function le(r){ve+=1;let e=!1;try{r()}catch(t){throw e=!0,t}finally{if(ve-=1,ve===0)if(e){if(!Se){let t=De.splice(0);for(let n of t)try{n()}catch{}ue.length=0,ce.length=0,_e.length=0}}else Yn()}}function Yn(){let r=!Se;r&&(Se=!0);let e=[],t=0;try{for(;ue.length>0||ce.length>0||_e.length>0||r&&De.length>0;){if(r&&De.length>0){let o=De.splice(0);for(let i of o)try{i()}catch(a){e.push(a)}continue}if(t+=1,t>1e3)throw ue.length=0,ce.length=0,_e.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let s=(ue.length>0?ue:ce.length>0?ce:_e).splice(0);for(let o of s)try{o()}catch(i){e.push(i)}}}finally{r&&(Se=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function je(r,e,t){if(e.length===0)return;if(e.length===1){let u=t(e[0][0]);if(u<3||!ze()){r(e);return}(u>=5?_e:u===4?ce:ue).push(()=>r(e));return}let n=e.length,s=n,o=n,i=n,a=0;for(;a<n&&t(e[a][0])<3;)a++;for(s=a;a<n&&t(e[a][0])===3;)a++;for(o=a;a<n&&t(e[a][0])===4;)a++;i=a;let d=ze();if(s>0){let u=e.slice(0,s);r(u)}if(o>s){let u=e.slice(s,o);d?ue.push(()=>r(u)):r(u)}if(i>o){let u=e.slice(o,i);d?ce.push(()=>r(u)):r(u)}if(n>i){let u=e.slice(i,n);d?_e.push(()=>r(u)):r(u)}}var ve,Se,ue,ce,_e,De,Ge=L(()=>{"use strict";ve=0,Se=!1,ue=[],ce=[],_e=[],De=[]});function B(){return Math.trunc(performance.now()*1e6)}function ne(){return Date.now()*1e6}var pe=L(()=>{"use strict"});function qt(r){return Array.isArray(r)?[...r]:[r]}function Jn(r,e){return r.has(e)||r.has("*")}function mt(r){let e=[];return r((s,o)=>{e.push({kind:"allow",actions:new Set(qt(s)),where:o?.where??(()=>!0)})},(s,o)=>{e.push({kind:"deny",actions:new Set(qt(s)),where:o?.where??(()=>!0)})}),(s,o)=>{let i=!1,a=!1;for(let d of e)Jn(d.actions,o)&&d.where(s)&&(d.kind==="deny"?i=!0:a=!0);return i?!1:a}}function bt(r){return mt((e,t)=>{for(let n of r){let s=n.actorType==null?null:new Set(Array.isArray(n.actorType)?n.actorType:[n.actorType]),o=n.actorId==null?null:new Set(Array.isArray(n.actorId)?n.actorId:[n.actorId]),i=Object.entries(n.claims??{}),a=d=>{if(s!==null&&!s.has(String(d.type))||o!==null&&!o.has(String(d.id??"")))return!1;for(let[u,l]of i)if(d[u]!==l)return!1;return!0};n.effect==="deny"?t(n.action,{where:a}):e(n.action,{where:a})}})}function yt(r){let e=Xn.filter(t=>r({type:t,id:""},"write"));return e.length===0?"restricted":e.includes("human")&&e.includes("llm")&&e.every(t=>t==="human"||t==="llm"||t==="system")?"both":e.length===1?e[0]:e.join("+")}var Z,Xn,fe=L(()=>{"use strict";Z=class extends Error{actor;action;nodeName;constructor(e,t){super(t??`GuardDenied: action "${String(e.action)}" denied for actor type "${String(e.actor.type)}"`),this.name="GuardDenied",this.actor=e.actor,this.action=e.action,this.nodeName=e.nodeName}get node(){return this.nodeName}};Xn=["human","llm","wallet","system"]});var Te,D,U,Y,Q,te,oe,z,H,I,he,He,Yt,Be,Jt,Xt,Ue,vt,_t,wt,We,re=L(()=>{"use strict";Te=Symbol.for("graphrefly/START"),D=Symbol.for("graphrefly/DATA"),U=Symbol.for("graphrefly/DIRTY"),Y=Symbol.for("graphrefly/RESOLVED"),Q=Symbol.for("graphrefly/INVALIDATE"),te=Symbol.for("graphrefly/PAUSE"),oe=Symbol.for("graphrefly/RESUME"),z=Symbol.for("graphrefly/TEARDOWN"),H=Symbol.for("graphrefly/COMPLETE"),I=Symbol.for("graphrefly/ERROR"),he=Object.freeze([U]),He=Object.freeze([Y]),Yt=Object.freeze([Q]),Be=Object.freeze([Te]),Jt=Object.freeze([H]),Xt=Object.freeze([z]),Ue=Object.freeze([he]),vt=Object.freeze([He]),_t=Object.freeze([Yt]),wt=Object.freeze([Jt]),We=Object.freeze([Xt])});function Qt(r,e){let t=new TextEncoder().encode(r.name);if(t.length===0||t.length>255)throw new Error(`encodeEnvelope: codec name "${r.name}" encodes to ${t.length} bytes (must be 1\u2013255)`);let n=r.version;if(!Number.isInteger(n)||n<0||n>65535)throw new Error(`encodeEnvelope: codec.version ${n} out of u16 range (expected integer 0\u201365535)`);let s=2+t.length+2+e.length;if(s>4294967295)throw new Error(`encodeEnvelope: total envelope size ${s} exceeds 2^32-1 bytes (payload ${e.length} bytes)`);let o=new Uint8Array(s),i=0;return o[i++]=Tt,o[i++]=t.length,o.set(t,i),i+=t.length,o[i++]=n>>>8&255,o[i++]=n&255,o.set(e,i),o}function en(r,e){if(r.length<Zt)throw new Error(`decodeEnvelope: bytes too short (${r.length} < ${Zt})`);let t=0,n=r[t++];if(n!==Tt)throw new Error(`decodeEnvelope: unsupported envelope version ${n} (expected ${Tt})`);let s=r[t++];if(s===0)throw new Error("decodeEnvelope: name_len must be >= 1");if(t+s+2>r.length)throw new Error(`decodeEnvelope: envelope truncated (need ${t+s+2} bytes, have ${r.length})`);let o=new TextDecoder().decode(r.subarray(t,t+s));t+=s;let i=(r[t]<<8|r[t+1])>>>0;t+=2;let a=r.subarray(t),d=e.lookupCodec(o);if(d==null)throw new Error(`decodeEnvelope: codec "${o}" not registered (envelope codec_v=${i})`);return{codec:d,codecVersion:i,payload:a}}function tn(r){r.registerCodec(Zn)}var Zn,Tt,Zt,Nt=L(()=>{"use strict";Zn={name:"json",version:1,contentType:"application/json",encode(r){let e=JSON.stringify(r);return new TextEncoder().encode(e)},decode(r,e){let t=new TextDecoder().decode(r);return JSON.parse(t)}},Tt=1,Zt=4});function Ke(r){if(r==null)return Ne;let{type:e,id:t,...n}=r;return{type:e??"system",id:t??"",...n}}var Ne,qe=L(()=>{"use strict";Ne={type:"system",id:""}});function nn(r){r.registerMessageType(Te,{tier:0,wireCrossing:!1}),r.registerMessageType(U,{tier:1,wireCrossing:!1}),r.registerMessageType(Q,{tier:1,wireCrossing:!1,metaPassthrough:!1}),r.registerMessageType(te,{tier:2,wireCrossing:!1}),r.registerMessageType(oe,{tier:2,wireCrossing:!1}),r.registerMessageType(D,{tier:3,wireCrossing:!0}),r.registerMessageType(Y,{tier:3,wireCrossing:!0}),r.registerMessageType(H,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(I,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(z,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var Ye,rn=L(()=>{"use strict";re();Ye=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=t=>{let n=this._messageTypes.get(t);return n!=null?n.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=e}registerMessageType(e,t){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:t.tier,wireCrossing:t.wireCrossing??t.tier>=3,metaPassthrough:t.metaPassthrough??!0}),this}messageTier(e){let t=this._messageTypes.get(e);return t!=null?t.tier:1}isWireCrossing(e){let t=this._messageTypes.get(e);return t!=null?t.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let t=this._messageTypes.get(e);return t!=null?t.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}}});function Ot(r){if(r===void 0)return null;if(typeof r=="number"){if(!Number.isFinite(r))throw new TypeError(`Cannot hash non-finite number: ${r}`);if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${r}. Cross-language cid parity is not guaranteed for unsafe integers.`);return r}if(typeof r=="string"||typeof r=="boolean"||r===null)return r;if(Array.isArray(r))return r.map(Ot);if(typeof r=="object"&&r!==null){let e={};for(let t of Object.keys(r).sort())e[t]=Ot(r[t]);return e}return null}function tr(r){let e=er.encode(r),t=e.length,n=t*8,s=t+9+63&-64,o=new Uint8Array(s);o.set(e),o[t]=128;let i=new DataView(o.buffer);i.setUint32(s-4,n>>>0,!1),i.setUint32(s-8,Math.floor(n/4294967296)>>>0,!1);let a=1779033703,d=3144134277,u=1013904242,l=2773480762,h=1359893119,f=2600822924,g=528734635,c=1541459225,v=new Uint32Array(64),p=(_,b)=>_>>>b|_<<32-b;for(let _=0;_<s;_+=64){for(let O=0;O<16;O++)v[O]=i.getUint32(_+O*4,!1);for(let O=16;O<64;O++){let R=v[O-15],G=v[O-2],S=p(R,7)^p(R,18)^R>>>3,ae=p(G,17)^p(G,19)^G>>>10;v[O]=v[O-16]+S+v[O-7]+ae>>>0}let b=a,y=d,w=u,x=l,m=h,N=f,k=g,A=c;for(let O=0;O<64;O++){let R=p(m,6)^p(m,11)^p(m,25),G=m&N^~m&k,S=A+R+G+Qn[O]+v[O]>>>0,ae=p(b,2)^p(b,13)^p(b,22),se=b&y^b&w^y&w,Fe=ae+se>>>0;A=k,k=N,N=m,m=x+S>>>0,x=w,w=y,y=b,b=S+Fe>>>0}a=a+b>>>0,d=d+y>>>0,u=u+w>>>0,l=l+x>>>0,h=h+m>>>0,f=f+N>>>0,g=g+k>>>0,c=c+A>>>0}let T=_=>_.toString(16).padStart(8,"0");return T(a)+T(d)+T(u)+T(l)+T(h)+T(f)+T(g)+T(c)}function Ce(r){let e=Ot(r??null),t=JSON.stringify(e);return tr(t).slice(0,16)}function nr(){let r=globalThis.crypto;if(r?.randomUUID)return r.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),t=e()+e()+e()+e();return`${t.slice(0,8)}-${t.slice(8,12)}-4${t.slice(13,16)}-${(parseInt(t.slice(16,17),16)&3|8).toString(16)}${t.slice(17,20)}-${t.slice(20,32)}`}function xt(r,e,t){let n=t?.id??nr();if(r===0)return{id:n,version:0};let o=(t?.hash??Ce)(e);return{id:n,version:0,cid:o,prev:null}}function sn(r,e,t){r.version+=1,"cid"in r&&(r.prev=r.cid,r.cid=t(e))}var Qn,er,kt=L(()=>{"use strict";Qn=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),er=new TextEncoder});function dn(r){return{node:r,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function Et(r){r.prevData=void 0,r.dirty=!1,r.involvedThisWave=!1,r.dataBatch.length=0,r.terminal=void 0}function Je(r){return r.length===0?r:typeof r[0]=="symbol"?[r]:r}function xe(r,e,t){let n=un(r)?r:[],s=typeof r=="function"?r:typeof e=="function"?e:void 0,o={};return un(r)?o=(At(e)?e:t)??{}:At(r)?o=r:o=(At(e)?e:t)??{},new $(n,s,o)}var on,an,rr,sr,Oe,$,un,At,ge=L(()=>{"use strict";Nt();qe();Ge();pe();rn();fe();re();kt();on=()=>{},an=100;rr=(r,e,t,n)=>{t.direction==="down-in"&&r._onDepMessage(t.depIndex,e)},sr=(r,e,t,n)=>{let s=r;if(s._status==="completed"||s._status==="errored")return;let o=s._cached,i=o===void 0?[Be]:[Be,[D,o]];s._status==="dirty"&&i.push(he),je(e,i,s._config.tierOf)},Oe=new Ye({onMessage:rr,onSubscribe:sr});nn(Oe);tn(Oe);$=class r{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,t,n){this._config=n.config??Oe,this._config.onMessage,this._optsName=n.name,this._describeKind=n.describeKind,this._equals=n.equals??Object.is,this._resubscribable=n.resubscribable??!1,this._resetOnTeardown=n.resetOnTeardown??!1,this._autoComplete=n.completeWhenDepsComplete??!0,this._autoError=n.errorWhenDepsError??!0,this._pausable=n.pausable??!0,this._guard=n.guard,this._fn=t,this._partial=n.partial??!1,this._cached=n.initial!==void 0?n.initial:void 0,this._status=e.length===0&&t==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=n.versioningHash??this._config.defaultHashFn??Ce;let s=n.versioning??this._config.defaultVersioning;this._versioningLevel=s,this._versioning=s!=null?xt(s,this._cached===void 0?void 0:this._cached,{id:n.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(dn);let o={};for(let[a,d]of Object.entries(n.meta??{})){let u={initial:d,name:`${n.name??"node"}:meta:${a}`,describeKind:"state",config:this._config};n.guard!=null&&(u.guard=n.guard),o[a]=new r([],void 0,u)}Object.freeze(o),this.meta=o,this._hasMeta=Object.keys(o).length>0;let i=this;this._actions={emit(a){i._emit([[D,a]])},down(a){i._emit(Je(a))},up(a){i._emitUp(Je(a))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,t){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let n=this._versioningLevel;if(n!=null&&e<=n)return;let s=t?.hash??this._hashFn;s!==this._hashFn&&(this._hashFn=s);let o=this._cached===void 0?void 0:this._cached,i=this._versioning,a=i?.id??t?.id,d=i?.version??0,u=xt(e,o,{id:a,hash:s});u.version=d,this._versioning=u,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let t=Ke(e);if(this._guard!=null&&!this._guard(t,"observe"))return!1;if(this._extraGuards!=null){for(let n of this._extraGuards)if(!n(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,n=e?.actor!=null;if(!t&&!n)return;let s=Ke(e?.actor),o=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(s,o))throw new Z({actor:s,action:o,nodeName:this.name});if(this._extraGuards!=null){for(let i of this._extraGuards)if(!i(s,o))throw new Z({actor:s,action:o,nodeName:this.name})}this._lastMutation={actor:s,timestamp_ns:ne()}}down(e,t){let n=Je(e);n.length!==0&&(this._checkGuard(t),this._emit(n))}emit(e,t){this._checkGuard(t),this._emit([[D,e]])}up(e,t){if(this._deps.length===0)return;let n=Je(e);if(n.length===0)return;this._checkGuard(t);let s=t??{internal:!0};this._validateUpTiers(n);for(let o of this._deps)o.node.up?.(n,s)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let t of this._deps)t.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let t=this._config.tierOf;for(let n of e){let s=t(n[0]);if(s===3||s===4)throw new Error(`Node "${this.name}": tier-${s} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,t){if(t!=null&&this._guard!=null){let d=Ke(t);if(!this._guard(d,"observe"))throw new Z({actor:d,action:"observe",nodeName:this.name})}let s=this._isTerminal&&this._resubscribable;if(s){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let d of this._deps)Et(d);if(this._partial===!1){for(let d of this._deps)if(d.prevData!==void 0||d.dataBatch.length!==0||d.terminal!==void 0||d.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let o;try{o=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:s},this._actions)}catch(d){throw this._sinkCount-=1,d}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let i=this._isTerminal;if(this._sinkCount===1&&!i)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof o=="function")try{o()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let a=!1;return()=>{a||(a=!0,this._sinkCount-=1,this._removeSink(e),typeof o=="function"&&o(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[t]=this._sinks;this._sinks=t}else this._sinks.size===0&&(this._sinks=null)}_activate(){if(this._deps.length===0){this._fn&&this._execFn();return}this._dirtyDepCount=0;let e=this._deps.length,t=0;try{for(let n=0;n<e;n++){let s=n,o=this._deps[n];o.unsub=on,o.unsub=o.node.subscribe(i=>{if(o.unsub===null)return;let a=this._config.tierOf,d=!1;for(let u of i)a(u[0])>=3&&(d=!0),this._config.onMessage(this,u,{direction:"down-in",depIndex:s},this._actions);d&&this._maybeRunFnOnSettlement()}),t++}}catch(n){this._deps[t].unsub=null;for(let s=0;s<t;s++){let o=this._deps[s];if(o.unsub!=null){let i=o.unsub;o.unsub=null;try{i()}catch{}Et(o)}}throw this._dirtyDepCount=0,n}}_addDep(e){for(let s=0;s<this._deps.length;s++)if(this._deps[s].node===e)return s;let t=this._deps.length,n=dn(e);if(this._deps.push(n),this._sinks==null)return t;n.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Ue),n.unsub=on;try{n.unsub=e.subscribe(s=>{if(n.unsub===null)return;let o=this._config.tierOf,i=!1;for(let a of s)o(a[0])>=3&&(i=!0),this._config.onMessage(this,a,{direction:"down-in",depIndex:t},this._actions);i&&this._maybeRunFnOnSettlement()})}catch(s){throw n.unsub=null,this._deps.pop(),this._dirtyDepCount--,s}return t}_deactivate(e=!1){let t=this._cleanup;if(this._cleanup=void 0,typeof t=="function")try{t()}catch(n){this._emit([[I,this._wrapFnError("cleanup threw",n)]])}else if(t!=null&&typeof t=="object"){let n=t.deactivate;if(typeof n=="function")try{n()}catch(s){this._emit([[I,this._wrapFnError("cleanup.deactivate threw",s)]])}}for(let n of this._deps){if(n.unsub!=null){let s=n.unsub;n.unsub=null;try{s()}catch{}}Et(n)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,t){let n=this._deps[e],s=t[0];if(this._inspectorHooks!=null){let o={kind:"dep_message",depIndex:e,message:t};for(let i of this._inspectorHooks)i(o)}if(s!==Te){if(s===U){this._depDirtied(n);return}if(s===Q){if(this._depInvalidated(n),this._cached===void 0)return;this._emit(_t);return}if(s===te||s===oe){this._emit([t]);return}if(s===z){this._emit(We);return}if(s===D)this._depSettledAsData(n,t[1]);else if(s===Y)this._depSettledAsResolved(n);else if(s===H)this._depSettledAsTerminal(n,!0);else if(s===I)this._depSettledAsTerminal(n,t[1]);else{this._emit([t]);return}if(!this._fn){(s===D||s===Y)&&this._emit([t]),(s===H||s===I)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Ue))}_depSettledAsData(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(t),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=t,e.involvedThisWave=!0,this._hasNewTerminal=!0}_depInvalidated(e){e.prevData=void 0,e.terminal=void 0,e.dataBatch.length=0,e.dirty?e.involvedThisWave=!1:(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++)}_maybeRunFnOnSettlement(){if(!(this._isTerminal&&!this._resubscribable)&&!(this._dirtyDepCount>0)){if(!this._partial&&!this._hasCalledFnOnce)for(let e=0;e<this._deps.length;e++){let t=this._deps[e];if(t.dataBatch.length===0&&t.prevData===void 0&&t.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(vt),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(t=>t.terminal!==void 0&&t.terminal!==!0);if(e!=null){this._autoError&&this._emit([[I,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(wt)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(i){this._emit([[I,this._wrapFnError("cleanup threw",i)]]);return}}else if(e!=null&&typeof e=="object"){let i=e.beforeRun;if(typeof i=="function"){e.beforeRun=void 0;try{i()}catch(a){this._emit([[I,this._wrapFnError("cleanup.beforeRun threw",a)]]);return}}}let t=this._deps.map(i=>i.involvedThisWave?i.dataBatch.length>0?[...i.dataBatch]:[]:void 0),n=this._deps.map(i=>i.prevData);for(let i=0;i<this._deps.length;i++){let a=t[i];a!=null&&a.length>0&&(this._deps[i].prevData=a[a.length-1])}let s=this._deps.map(i=>i.terminal),o={prevData:n,terminalDeps:s,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let i={kind:"run",batchData:t,prevData:n};for(let a of this._inspectorHooks)a(i)}this._isExecutingFn=!0;try{let i=this._fn(t,this._actions,o);if(typeof i=="function")this._cleanup=i;else if(i!=null&&typeof i=="object"){let a=i;(typeof a.beforeRun=="function"||typeof a.deactivate=="function"||typeof a.invalidate=="function")&&(this._cleanup=i)}}catch(i){this._emit([[I,this._wrapFnError("fn threw",i)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>an?(this._rerunDepth=0,this._emit([[I,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${an} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,t){let n=t instanceof Error?t.message:String(t);return new Error(`Node "${this.name}": ${e}: ${n}`,{cause:t})}_frameBatch(e){let t=this._config.tierOf;if(e.length===1)return t(e[0][0])===3&&this._status!=="dirty"?[he,e[0]]:e;let n=!0,s=!1,o=!1,i=-1;for(let d of e){let u=t(d[0]);u<i&&(n=!1),u===3&&(s=!0),d[0]===U&&(o=!0),i=u}let a=e;if(!n){let d=e.map((u,l)=>({m:u,i:l,tier:t(u[0])}));d.sort((u,l)=>u.tier-l.tier||u.i-l.i),a=d.map(u=>u.m)}if(s&&!o&&this._status!=="dirty"){let d=0;for(;d<a.length&&t(a[d][0])===0;)d++;return d===0?[he,...a]:[...a.slice(0,d),he,...a.slice(d)]}return a}_emit(e){if(e.length===0)return;for(let a=0;a<e.length;a++){let d=e[a];if(d[0]===I&&d[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let t=e;if(this._isTerminal&&!this._resubscribable){let a=e.filter(d=>d[0]===z||d[0]===Q);if(a.length===0)return;t=a}t=this._frameBatch(t);let s=null;for(let a=0;a<t.length;a++){let d=t[a],u=d[0];if(u!==te&&u!==oe){s?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${u===te?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let l=!0;if(this._pausable!==!1){let h=d[1];if(u===te)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(h),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(h))l=!1;else if(this._pauseLocks.delete(h),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let f=this._pauseBuffer;this._pauseBuffer=[],this._emit(f)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}l?s?.push(d):s==null&&(s=t.slice(0,a))}if(s!=null){if(s.length===0)return;t=s}if(this._hasMeta&&t.some(a=>a[0]===z))for(let a of Object.keys(this.meta))try{this.meta[a]._emit(We)}catch{}let{finalMessages:o,equalsError:i}=this._updateState(t);if(o.length>0&&this._config.inspectorEnabled){let a=this._config.globalInspector;if(a!=null)try{a({kind:"emit",node:this,messages:o})}catch{}}if(o.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let a=this._config.tierOf,d=[];for(let u of o)a(u[0])===3?this._pauseBuffer.push(u):d.push(u);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(o);i!=null&&this._emit([[I,i]])}_updateState(e){let t=this._config.tierOf,n,s,o=-1,i=0;for(let l of e)t(l[0])===3&&i++;let a=i<=1,d=-1;if(this._versioning!=null&&i>1){for(let l=e.length-1;l>=0;l--)if(e[l][0]===D){d=l;break}}for(let l=0;l<e.length;l++){let h=e[l],f=h[0];if(f===D){if(h.length>=2){let g=!1;if(a&&this._cached!==void 0)try{g=this._equals(this._cached,h[1])}catch(c){s=this._wrapFnError("equals threw",c),o=l;break}if(g){n==null&&(n=e.slice(0,l)),n.push(He),this._status="resolved";continue}this._cached=h[1],this._versioning!=null&&(d<0||l===d)&&sn(this._versioning,h[1],this._hashFn)}this._status="settled",n?.push(h)}else if(n?.push(h),f===U)this._status="dirty";else if(f===Y)this._status="resolved";else if(f===H){this._status="completed";{let g=this._config.rigorRecorder;if(g!=null)try{g.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(f===I){this._status="errored";{let g=this._config.rigorRecorder;if(g!=null)try{g.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(f===Q){if(this._cached!==void 0){let c=this._config.rigorRecorder;if(c!=null)try{c.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let g=this._cleanup;if(typeof g=="function"){this._cleanup=void 0;try{g()}catch{}}else if(g!=null&&typeof g=="object"){let c=g.invalidate;if(typeof c=="function")try{c()}catch{}}}else f===z&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let u=o>=0?n??e.slice(0,o):n??e;return s!=null?{finalMessages:u,equalsError:s}:{finalMessages:u}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let t=[...this._sinks];for(let n of t)n(e)};_dispatchOrAccumulate(e){if(Kt()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],we(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}je(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let t=this._frameBatch(e);je(this._deliverToSinks,t,this._config.tierOf)}},un=r=>Array.isArray(r),At=r=>typeof r=="object"&&r!=null&&!Array.isArray(r)});function St(r,e){if(e!=null&&e.length>0)return new Set(e);switch(r){case"standard":return new Set(["type","status","value","deps","meta","v"]);case"full":return null;case"spec":return new Set(["type","deps","meta","value"]);default:return new Set(["type","deps"])}}function or(r){return r._describeKind!=null?r._describeKind:r._deps.length>0?"derived":r._fn!=null?"producer":"state"}function Xe(r){let e=new WeakSet,t={};for(let[n,s]of cn(r))t[n]=Rt(s,e);return t}function Rt(r,e){if(r==null)return r;let t=typeof r;if(t==="boolean"||t==="number"||t==="string")return r;if(t==="function")return"<function>";if(Array.isArray(r))return e.has(r)?"<cycle>":(e.add(r),r.map(n=>Rt(n,e)));if(t==="object"){let n=r;if(e.has(n))return"<cycle>";e.add(n);try{if(typeof n.subscribe=="function"&&"cache"in n)return"<Node>"}catch{return"<unserializable>"}let s={};for(let[o,i]of cn(n))s[o]=Rt(i,e);return s}return"<unserializable>"}function cn(r){let e=[],t;try{t=Object.keys(r)}catch{return e}for(let n of t)try{e.push([n,r[n]])}catch{e.push([n,"<unserializable>"])}return e}function ir(r){let e={};for(let[t,n]of Object.entries(r.meta))try{e[t]=n.cache}catch{}return e}function Dt(r,e,t){let n=e==null,s=!n&&e!=null?[...e].filter(l=>l.startsWith("meta.")).map(l=>l.slice(5)):null,o=n||e.has("meta")||s!=null&&s.length>0,i="state",a=[];r instanceof $&&(i=or(r),a=r._deps.map(l=>l.node.name??""));let d={type:i,deps:a};(n||e.has("status"))&&(d.status=r.status);let u=r instanceof $?r._guard:void 0;if(o){let l={...ir(r)};if(u!=null&&l.access===void 0&&(l.access=yt(u)),s!=null&&s.length>0&&!e.has("meta")){let h={};for(let f of s)f in l&&(h[f]=l[f]);d.meta=h}else d.meta=l}if(r.name!=null&&(d.name=r.name),(n||e.has("value"))&&(!t||i==="state")){r.status==="sentinel"&&(d.sentinel=!0);try{d.value=r.cache}catch{}}if((n||e.has("v"))&&r.v!=null){let l={id:r.v.id,version:r.v.version};"cid"in r.v&&(l.cid=r.v.cid,l.prev=r.v.prev),d.v=l}return(n||e.has("guard"))&&u!=null&&(d.guard=yt(u)),(n||e.has("lastMutation"))&&r.lastMutation!=null&&(d.lastMutation=r.lastMutation),d}var Ze=L(()=>{"use strict";fe();ge()});function W(r,e){return xe([],{...e,initial:r})}function Qe(r,e){return xe((n,s,o)=>r(s,o)??void 0,{describeKind:"producer",...e})}function F(r,e,t){return xe(r,(s,o,i)=>{let a=s.map((d,u)=>d!=null&&d.length>0?d.at(-1):i.prevData[u]);o.emit(e(a,i))},{describeKind:"derived",...t})}var me=L(()=>{"use strict";ge()});function ie(r,e,t){return{[r]:!0,[`${r}_type`]:e,...t??{}}}var Me=L(()=>{"use strict"});function K(r){return r.subscribe(()=>{})}var ln=L(()=>{"use strict"});var ke=L(()=>{"use strict";ln()});function pn(r){let e=new WeakSet,t=new WeakSet,n=[r],s=0;for(;n.length>0;){let o=n.pop();s+=ur(o,e,t,n)}return s}function ur(r,e,t,n){if(r==null)return 0;switch(typeof r){case"number":return V.number;case"boolean":return V.boolean;case"string":return V.string+r.length*2;case"bigint":return V.bigint+cr(r);case"symbol":return V.symbol;case"function":return e.has(r)?0:(e.add(r),V.function);case"undefined":return 0}let o=r;if(e.has(o))return 0;e.add(o);let i=o[dr];if(typeof i=="function")try{let u=i.call(o);if(typeof u=="number"&&Number.isFinite(u))return u}catch{}if(o instanceof Date)return V.date;if(o instanceof RegExp)return V.regexp+o.source.length*2;if(o instanceof Error){let u=o.message?o.message.length*2:0,l=o.stack?o.stack.length*2:0;return V.error+u+l}if(typeof URL<"u"&&o instanceof URL)return V.url+o.href.length*2;if(typeof Promise<"u"&&o instanceof Promise)return V.promise;if(o instanceof WeakMap)return V.weakmap;if(o instanceof WeakSet)return V.weakset;if(o instanceof Map){let u=V.map;for(let[l,h]of o)u+=V.mapEntry,n.push(l),n.push(h);return u}if(o instanceof Set){let u=V.set;for(let l of o)u+=V.setEntry,n.push(l);return u}if(Array.isArray(o)){let u=V.array+o.length*8;for(let l of o)n.push(l);return u}if(o instanceof ArrayBuffer)return t.has(o)?0:(t.add(o),o.byteLength);if(ArrayBuffer.isView(o)){let u=o;return t.has(u.buffer)?48:(t.add(u.buffer),u.buffer.byteLength+48)}let a=V.object,d=Object.keys(o);for(let u of d){a+=V.string+u.length*2;try{n.push(o[u])}catch{}}return a}function cr(r){let e=r<0n?-r:r;if(e===0n)return 0;let t=e.toString(2).length;return Math.ceil(t/32)*8}var V,dr,fn=L(()=>{"use strict";V={object:56,array:64,string:40,number:8,boolean:4,null:0,undefined:0,symbol:40,bigint:16,function:120,map:72,set:72,mapEntry:40,setEntry:24,date:24,regexp:48,error:64,url:80,promise:48,weakmap:40,weakset:40},dr=Symbol.for("sizeof")});function hn(r,e,t,n={}){let s=e in r.nodes,o=t in r.nodes;if(!s)return tt(e,t,"no-such-from");if(!o)return tt(e,t,"no-such-to");let i=n.maxDepth;if(i!=null&&(!Number.isInteger(i)||i<0))throw new Error("explainPath: maxDepth must be an integer >= 0");if(e===t){if(n.findCycle===!0){let u=lr(r,e,n);if(u!=null)return u}let d=nt(e,r.nodes[e],0,n);return rt(e,t,[d])}if(i===0)return tt(e,t,"no-path");let a=gn(r,e,t,i);return a.found?rt(e,t,mn(r,a.pathOrder,n)):tt(e,t,a.truncated?"max-depth-exceeded":"no-path")}function gn(r,e,t,n){let s=new Map,o=[{path:t,depth:0}],i=new Set([t]),a=0,d=!1;for(;a<o.length;){let h=o[a++];if(h.path===e)break;if(n!=null&&h.depth>=n){let v=r.nodes[h.path];v?.deps&&v.deps.length>0&&(d=!0);continue}let f=r.nodes[h.path];if(f==null)continue;let g=f.deps??[],c=new Map;for(let v=0;v<g.length;v++){let p=g[v];if(!p)continue;let T=c.get(p);T==null&&(T=[],c.set(p,T)),T.push(v)}for(let[v,p]of c)i.has(v)||(i.add(v),s.set(v,{from:h.path,depIndices:p}),o.push({path:v,depth:h.depth+1}))}if(!s.has(e))return{found:!1,pathOrder:[],truncated:d};let u=[{path:e}],l=e;for(;l!==t;){let h=s.get(l);if(h==null)return{found:!1,pathOrder:[],truncated:!1};u[u.length-1].depIndices=h.depIndices,u.push({path:h.from}),l=h.from}return{found:!0,pathOrder:u,truncated:!1}}function lr(r,e,t){let n=r.nodes[e];if(n==null)return null;let s=n.deps??[],o=[];for(let a=0;a<s.length;a++)s[a]===e&&o.push(a);if(o.length>0){let a=nt(e,n,0,t);a.dep_index=o[0];let d=nt(e,n,1,t);return rt(e,e,[a,d])}let i=null;for(let a=0;a<s.length;a++){let d=s[a];if(!d||d===e)continue;let u=gn(r,d,e,t.maxDepth);u.found&&(i==null||u.pathOrder.length<i.pathOrder.length)&&(i=u,i={found:!0,pathOrder:[{path:e,depIndices:[a]},...u.pathOrder],truncated:!1})}return i==null?null:rt(e,e,mn(r,i.pathOrder,t))}function mn(r,e,t){return e.map((n,s)=>{let o=r.nodes[n.path],i=nt(n.path,o,s,t);return n.depIndices!=null&&n.depIndices.length>0&&(i.dep_index=n.depIndices[0],n.depIndices.length>1&&(i.dep_indices=[...n.depIndices])),i})}function nt(r,e,t,n){let s={path:r,type:e.type,hop:t};e.status!==void 0&&(s.status=e.status),"value"in e&&(s.value=e.value),e.v!=null&&(s.v=e.v);let o=n.annotations?.get(r)??e.annotation;o!=null&&(s.annotation=o);let i=n.lastMutations?.get(r)??e.lastMutation;return i!=null&&(s.lastMutation=i),s}function rt(r,e,t){return bn(r,e,!0,"ok",t)}function tt(r,e,t){return bn(r,e,!1,t,[])}function bn(r,e,t,n,s){let o=pr(r,e,t,n,s);return{from:r,to:e,found:t,reason:n,steps:s,text:o,toJSON(){return{from:r,to:e,found:t,reason:n,steps:s}}}}function pr(r,e,t,n,s){if(!t)switch(n){case"no-such-from":return`explainPath: no node named "${r}"`;case"no-such-to":return`explainPath: no node named "${e}"`;case"max-depth-exceeded":return`explainPath: no path from "${r}" to "${e}" within maxDepth`;default:return`explainPath: no path from "${r}" to "${e}"`}let o=[`Causal path: ${r} \u2192 ${e} (${s.length} step(s))`];for(let i of s){let d=` ${i.hop===0?"\xB7":"\u2193"} ${i.path} (${i.type}${i.status?`/${i.status}`:""})`;if(o.push(d),"value"in i&&o.push(` value: ${fr(i.value)}`),i.annotation!=null&&o.push(` annotation: ${i.annotation}`),i.lastMutation!=null){let u=i.lastMutation.actor;o.push(` actor: ${u.type}${u.id?`:${u.id}`:""}`)}}return o.join(`
2
- `)}function fr(r){if(r===void 0)return"<sentinel>";if(r===null)return"null";if(typeof r=="string")return JSON.stringify(r);if(typeof r=="number"||typeof r=="boolean"||typeof r=="bigint")return String(r);try{let e=JSON.stringify(r);return e.length>80?`${e.slice(0,77)}...`:e}catch{return String(r)}}var yn=L(()=>{"use strict"});function Ct(r,e){if(Object.is(r,e))return!0;if(r==null||e==null||typeof r!="object"||typeof e!="object")return!1;if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let o=0;o<r.length;o++)if(!Ct(r[o],e[o]))return!1;return!0}if(Array.isArray(e))return!1;let t=Object.keys(r),n=Object.keys(e);if(t.length!==n.length)return!1;let s=new Set(n);for(let o of t)if(!s.has(o)||!Ct(r[o],e[o]))return!1;return!0}function vn(r,e){return`${r}\0${e}`}function Mt(r,e){let t=[],n=new Set(r.subgraphs),s=new Set(e.subgraphs),o=[];for(let p of s)n.has(p)||o.push(p);o.sort();for(let p of o)t.push({type:"subgraph-mounted",path:p});let i=new Set(Object.keys(r.nodes)),a=new Set(Object.keys(e.nodes)),d=[];for(let p of a)i.has(p)||d.push(p);d.sort();for(let p of d)t.push({type:"node-added",path:p,node:{...e.nodes[p]}});let u=[];for(let p of a){if(!i.has(p))continue;let T=r.nodes[p]?.meta,_=e.nodes[p]?.meta;T==null&&_==null||Ct(T??{},_??{})||u.push(p)}u.sort();for(let p of u)t.push({type:"node-meta-changed",path:p,prevMeta:r.nodes[p]?.meta??{},nextMeta:e.nodes[p]?.meta??{}});let l=new Map;for(let p of r.edges)l.set(vn(p.from,p.to),p);let h=new Map;for(let p of e.edges)h.set(vn(p.from,p.to),p);let f=[];for(let[p,T]of h)l.has(p)||f.push(T);f.sort((p,T)=>p.from<T.from?-1:p.from>T.from?1:p.to<T.to?-1:p.to>T.to?1:0);for(let p of f)t.push({type:"edge-added",from:p.from,to:p.to});let g=[];for(let[p,T]of l)h.has(p)||g.push(T);g.sort((p,T)=>p.from<T.from?-1:p.from>T.from?1:p.to<T.to?-1:p.to>T.to?1:0);for(let p of g)t.push({type:"edge-removed",from:p.from,to:p.to});let c=[];for(let p of i)a.has(p)||c.push(p);c.sort();for(let p of c)t.push({type:"node-removed",path:p});let v=[];for(let p of n)s.has(p)||v.push(p);v.sort();for(let p of v)t.push({type:"subgraph-unmounted",path:p});return{events:t,flushedAt_ns:B()}}var _n=L(()=>{"use strict";pe()});var st,wn=L(()=>{"use strict";st=class{_timer;_gen=0;start(e,t){this.cancel(),this._gen+=1;let n=this._gen;this._timer=setTimeout(()=>{this._timer=void 0,n===this._gen&&t()},e)}cancel(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}get pending(){return this._timer!==void 0}}});var Le,Tn=L(()=>{"use strict";Le=class{constructor(e){this.capacity=e;if(!Number.isInteger(e)||e<=0)throw new Error(`RingBuffer capacity must be a positive integer (got ${e})`);this.buf=new Array(e)}buf;head=0;_size=0;get size(){return this._size}get maxSize(){return this.capacity}push(e){let t=(this.head+this._size)%this.capacity;this.buf[t]=e,this._size<this.capacity?this._size++:this.head=(this.head+1)%this.capacity}shift(){if(this._size===0)return;let e=this.buf[this.head];return this.buf[this.head]=void 0,this.head=(this.head+1)%this.capacity,this._size--,e}at(e){if(this._size===0)return;let t=e<0?this._size+e:e;if(!(t<0||t>=this._size))return this.buf[(this.head+t)%this.capacity]}toArray(){let e=new Array(this._size);for(let t=0;t<this._size;t++)e[t]=this.buf[(this.head+t)%this.capacity];return e}clear(){for(let e=0;e<this._size;e++)this.buf[(this.head+e)%this.capacity]=void 0;this.head=0,this._size=0}}});function Nn(r,e){let t=e?.topN??10,n=r.describe({detail:"standard"}),s=[],o=r._collectObserveTargets;typeof o=="function"&&o.call(r,"",s);let i=new Map;for(let[f,g]of s)i.set(f,g);let a=[];for(let[f,g]of Object.entries(n.nodes)){let c=i.get(f),v=c instanceof $?c:null,p=v?pn(v.cache):0,T=v?v._sinkCount:0,_=g.deps?.length??0,b=g.type==="effect"&&T===0,y=T===0?g.type==="effect"?"orphan-effect":g.type==="derived"?"idle-derived":g.type==="producer"?"idle-producer":null:null;a.push({path:f,type:g.type,status:g.status??"unknown",valueSizeBytes:p,subscriberCount:T,depCount:_,isOrphanEffect:b,orphanKind:y})}let d=a.reduce((f,g)=>f+g.valueSizeBytes,0),u=(f,g)=>[...a].sort(g??((c,v)=>v[f]-c[f])).slice(0,t),l=a.filter(f=>f.orphanKind!=null),h=a.filter(f=>f.isOrphanEffect);return{nodeCount:a.length,edgeCount:n.edges.length,subgraphCount:n.subgraphs.length,nodes:a,totalValueSizeBytes:d,hotspots:{byValueSize:u("valueSizeBytes"),bySubscriberCount:u("subscriberCount"),byDepCount:u("depCount")},orphans:l,orphanEffects:h}}var On=L(()=>{"use strict";ge();fn()});function xn(r,e){let t=Math.max(16,r.size*4),n=0;for(;r.size>0;){if(n++>=t){console.error(`[Graph "${e}".destroy] disposer drain exceeded cap (${t}); ${r.size} disposer(s) discarded`),r.clear();return}let s=r.values().next();if(s.done)return;let o=s.value;r.delete(o);try{o()}catch(i){console.error(`[Graph "${e}".destroy] disposer threw:`,i)}}}function Sn(r){return r!=null&&typeof r=="object"&&"cache"in r&&typeof r.subscribe=="function"&&typeof r.down=="function"}function hr(r){if(r!=null)return Sn(r)?r.cache:r}function ye(r){return r!=null&&typeof r=="object"&&"cache"in r&&typeof r.subscribe=="function"&&typeof r.down=="function"}function de(r){return ye(r)?r.cache??"":r}function kn(r){return ye(r)?r.cache??0:r}function En(r){return ye(r)?r.cache??!1:r}function gr(r){let e=[];for(let t of Object.keys(r).sort()){let n=r[t].v;n!=null&&e.push(`${t} ${n.id} ${n.version}`)}return e.join(`
3
- `)}function An(r){if(r.version!==be)throw new Error(`unsupported snapshot version ${String(r.version)} (expected ${be})`);for(let e of["name","nodes","edges","subgraphs"])if(!(e in r))throw new Error(`snapshot missing required key "${e}"`);if(typeof r.name!="string")throw new TypeError("snapshot 'name' must be a string");if(typeof r.nodes!="object"||r.nodes===null||Array.isArray(r.nodes))throw new TypeError("snapshot 'nodes' must be an object");if(!Array.isArray(r.edges))throw new TypeError("snapshot 'edges' must be an array");if(!Array.isArray(r.subgraphs))throw new TypeError("snapshot 'subgraphs' must be an array")}function mr(r,e){let t=new WeakMap,n=(s,o)=>{if(Object.is(s,o))return!0;if(s==null||o==null||typeof s!="object"||typeof o!="object")return!1;let i=t.get(s);if(i==null&&(i=new WeakSet,t.set(s,i)),i.has(o))return!0;i.add(o);let a=s.constructor,d=o.constructor;if(a!==d)return!1;if(s instanceof Date)return s.getTime()===o.getTime();if(s instanceof RegExp)return s.source===o.source&&s.flags===o.flags;if(Array.isArray(s)){let f=o;if(s.length!==f.length)return!1;for(let g=0;g<s.length;g++)if(!n(s[g],f[g]))return!1;return!0}if(s instanceof Map){let f=o;if(s.size!==f.size)return!1;for(let[g,c]of s)if(!f.has(g)||!n(c,f.get(g)))return!1;return!0}if(s instanceof Set){let f=o;if(s.size!==f.size)return!1;for(let g of s){let c=!1;for(let v of f)if(n(g,v)){c=!0;break}if(!c)return!1}return!0}if(ArrayBuffer.isView(s)){let f=s,g=o;if(f.length!==g.length)return!1;for(let c=0;c<f.length;c++)if(f[c]!==g[c])return!1;return!0}let u=Object.keys(s),l=Object.keys(o);if(u.length!==l.length)return!1;let h=new Set(l);for(let f of u)if(!h.has(f)||!n(s[f],o[f]))return!1;return!0};return n(r,e)}function br(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ot(r){let e="^";for(let t=0;t<r.length;t+=1){let n=r[t];if(n==="*"){e+=".*";continue}if(n==="?"){e+=".";continue}if(n==="["){let s=r.indexOf("]",t+1);if(s<=t+1){e+="\\[";continue}let o=r.slice(t+1,s);o.startsWith("!")&&(o=`^${o.slice(1)}`),o=o.replace(/\\/g,"\\\\"),e+=`[${o}]`,t=s;continue}e+=br(n)}return e+="$",new RegExp(e)}function Pt(r){if(typeof r=="string")return JSON.stringify(r);if(typeof r=="number"||typeof r=="boolean"||r==null)return String(r);try{return JSON.stringify(r)}catch{return"[unserializable]"}}function _r(r){return r==="none"?vr:r==="ansi"||r==null?yr:{data:r.data??"",dirty:r.dirty??"",resolved:r.resolved??"",invalidate:r.invalidate??"",pause:r.pause??"",resume:r.resume??"",complete:r.complete??"",error:r.error??"",teardown:r.teardown??"",derived:r.derived??"",path:r.path??"",reset:r.reset??""}}function Rn(r){if(r==null)return{};let e=r.detail;return e==="full"?{...r,structured:r.structured??!0,timeline:r.timeline??!0,causal:r.causal??!0,derived:r.derived??!0}:e==="minimal"?{...r,structured:r.structured??!0}:r.format==="stage-log"?{...r,structured:r.structured??!0,timeline:r.timeline??!0}:r}function wr(r,e,t){for(let n=0;n<r.length;n++){let s=r.charCodeAt(n);if(s<32||s===127)throw new Error(`Graph "${e}": ${t} "${r}" must not contain control character (U+${s.toString(16).padStart(4,"0").toUpperCase()} at index ${n})`)}}function Lt(r,e,t){if(r==="")throw new Error(`Graph "${e}": ${t} name must be non-empty`);if(r.includes(P))throw new Error(`Graph "${e}": ${t} "${r}" must not contain '${P}' (path separator)`);if(r===ee)throw new Error(`Graph "${e}": ${t} name "${ee}" is reserved for meta companion paths`);wr(r,e,t)}function Tr(r,e){if(r==="")throw new Error(`Graph "${e}": resolve path must be non-empty`);let t=r.split(P);for(let n of t)if(n==="")throw new Error(`Graph "${e}": resolve path has empty segment`);return t}function Nr(r,e){let t=!1;for(let s of r)if(!e.isMetaPassthrough(s[0])){t=!0;break}return t?r.filter(s=>e.isMetaPassthrough(s[0])):r}function Dn(r){for(let e of r._mounts.values())Dn(e);for(let e of r._nodes.values())try{e.down([[z]],{internal:!0})}catch{}}function Gn(r,e){let t=j.diff(r,e),n={};for(let s of t.nodesAdded){let o=e.nodes[s];o!=null&&(n[s]=o)}return{...t,nodesAddedFull:n}}function Ie(r,e,t,n={}){let s={paths:[],depths:new Map,truncated:!1};if(!e)return n.withDetail?s:[];if(!n.both&&t!=="upstream"&&t!=="downstream")throw new Error('reachable: direction must be "upstream" or "downstream"');let o=n.maxDepth;if(o!=null&&(!Number.isInteger(o)||o<0))throw new Error("reachable: maxDepth must be an integer >= 0");if(o===0)return n.withDetail?s:[];let i=new Map,a=new Map,d=new Map,u=new Map,l=new Set;for(let[b,y]of Object.entries(r.nodes)){if(!b)continue;l.add(b);let w=y.deps??[];i.set(b,w);for(let x of w)x&&(l.add(x),a.has(x)||a.set(x,new Set),a.get(x).add(b))}for(let b of r.edges){if(b==null||typeof b!="object")continue;let y=typeof b.from=="string"?b.from:"",w=typeof b.to=="string"?b.to:"";!y||!w||(l.add(y),l.add(w),u.has(y)||u.set(y,new Set),u.get(y).add(w),d.has(w)||d.set(w,new Set),d.get(w).add(y))}if(!l.has(e))return n.withDetail?s:[];let h=n.both===!0,f=b=>{if(h){let m=i.get(b)??[],N=d.get(b),k=a.get(b),A=u.get(b),O=[...m];return N&&O.push(...N),k&&O.push(...k),A&&O.push(...A),O}if(t==="upstream"){let m=i.get(b)??[],N=d.get(b);return N?[...m,...N]:m}let y=a.get(b),w=u.get(b),x=y?[...y]:[];return w&&x.push(...w),x},g=new Set([e]),c=new Map,v=[{path:e,depth:0}],p=0,T=!1;for(;p<v.length;){let b=v[p++];if(o!=null&&b.depth>=o){f(b.path).length>0&&(T=!0);continue}for(let y of f(b.path))!y||g.has(y)||(g.add(y),c.set(y,b.depth+1),v.push({path:y,depth:b.depth+1}))}let _=[...c.keys()].sort((b,y)=>b<y?-1:b>y?1:0);return n.withDetail?{paths:_,depths:c,truncated:T}:_}function Or(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++){let n=r[t],s=e[t];if(n.path!==s.path||n.type!==s.type||n.status!==s.status||n.hop!==s.hop||n.dep_index!==s.dep_index||n.annotation!==s.annotation||n.value!==s.value||n.lastMutation!==s.lastMutation)return!1;let o=n.v,i=s.v;if(o!==i&&(o==null||i==null||o.id!==i.id||o.version!==i.version))return!1}return!0}var P,ee,be,yr,vr,j,it=L(()=>{"use strict";qe();Ge();pe();fe();re();Ze();ge();me();_n();ke();wn();Tn();Nt();yn();On();P="::",ee="__meta__",be=1;yr={data:"\x1B[32m",dirty:"\x1B[33m",resolved:"\x1B[36m",invalidate:"\x1B[93m",pause:"\x1B[90m",resume:"\x1B[96m",complete:"\x1B[34m",error:"\x1B[31m",teardown:"\x1B[91m",derived:"\x1B[35m",path:"\x1B[90m",reset:"\x1B[0m"},vr={data:"",dirty:"",resolved:"",invalidate:"",pause:"",resume:"",complete:"",error:"",teardown:"",derived:"",path:"",reset:""};j=class r{name;opts;config;_nodes=new Map;_nodeToName=new WeakMap;_mounts=new Map;_parent=void 0;_storageDisposers=new Set;_disposers=new Set;_destroyed=!1;_topology;_topologyEmitters=new Set;_factory;_factoryArgs;constructor(e,t){if(e==="")throw new Error("Graph name must be non-empty");if(e.includes(P))throw new Error(`Graph name must not contain '${P}' (got "${e}")`);if(e===ee)throw new Error(`Graph name "${ee}" is reserved for meta companion paths`);this.name=e,this.opts=Object.freeze({...t??{}}),this.config=t?.config??Oe,this._traceRing=new Le(t?.traceCapacity??1e3),t?.versioning!=null&&this.setVersioning(t.versioning),typeof t?.factory=="string"&&(this._factory=t.factory,t.factoryArgs!==void 0&&(this._factoryArgs=t.factoryArgs))}tagFactory(e,t){return this._factory=e,this._factoryArgs=t,this}ancestors(e=!0){let t=[],n=e?this:this._parent;for(;n!=null;)t.push(n),n=n._parent;return t}get topology(){return this._topology==null&&(this._topology=Qe(e=>{let t=n=>{e.emit(n)};return this._topologyEmitters.add(t),()=>{this._topologyEmitters.delete(t)}},{name:`${this.name}_topology`})),this._topology}_emitTopology(e){if(!(this._topology==null||this._topologyEmitters.size===0))for(let t of this._topologyEmitters)t(e)}nameOf(e){return this._nodeToName.get(e)}add(e,t){let n=e.name,s=t?.name??n;if(s==null||s==="")throw new Error(`Graph "${this.name}": graph.add requires a non-empty name \u2014 pass via opts.name or set it on the node (e.g. state(0, { name: "x" }))`);let o=s,i=t?.annotation;if(Lt(o,this.name,"add"),this._mounts.has(o))throw new Error(`Graph "${this.name}": name "${o}" is already a mount point`);if(this._nodes.has(o))throw new Error(`Graph "${this.name}": node "${o}" already exists`);let a=this._nodeToName.get(e);if(a!==void 0)throw new Error(`Graph "${this.name}": node instance already registered as "${a}"`);return this._nodes.set(o,e),this._nodeToName.set(e,o),this._emitTopology({kind:"added",name:o,nodeKind:"node"}),i!=null&&(this._annotations.set(o,i),this.config.inspectorEnabled&&this._traceRing.push({path:o,annotation:i,timestamp_ns:B()})),e}setVersioning(e){if(e!=null)for(let t of this._nodes.values())t instanceof $&&t._applyVersioning(e)}remove(e){Lt(e,this.name,"remove");let t=this._mounts.get(e);if(t){let o={kind:"mount",nodes:[],mounts:[]},i=[];t._collectObserveTargets("",i);for(let[a,d]of i)a.includes(`${P}${ee}${P}`)||o.nodes.push(a);return o.nodes.sort(),o.mounts.push(e),o.mounts.push(...t._collectSubgraphs(`${e}${P}`)),this._mounts.delete(e),t._parent=void 0,Dn(t),this._emitTopology({kind:"removed",name:e,nodeKind:"mount",audit:o}),o}let n=this._nodes.get(e);if(!n)throw new Error(`Graph "${this.name}": unknown node or mount "${e}"`);this._nodes.delete(e),this._nodeToName.delete(n),n.down([[z]],{internal:!0});let s={kind:"node",nodes:[e],mounts:[]};return this._emitTopology({kind:"removed",name:e,nodeKind:"node",audit:s}),s}removeAll(e){let t=typeof e=="function"?e:(()=>{let o=ot(e);return i=>o.test(i)})(),n={kind:"mount",nodes:[],mounts:[]},s=[...this._nodes.keys(),...this._mounts.keys()].filter(o=>t(o));for(let o of s){let i=this.remove(o);n.nodes.push(...i.nodes),n.mounts.push(...i.mounts)}return n.nodes.sort(),n.mounts.sort(),n}[Symbol.iterator](){let e=[...this._nodes.keys()].sort(),t=this._nodes,n=0;return{[Symbol.iterator](){return this},next(){if(n>=e.length)return{value:void 0,done:!0};let s=e[n++];return{value:[s,t.get(s)],done:!1}}}}node(e){if(e==="")throw new Error(`Graph "${this.name}": node name must be non-empty`);if(e.includes(P))return this.resolve(e);let t=this._nodes.get(e);if(!t)throw new Error(`Graph "${this.name}": unknown node "${e}"`);return t}get(e){return this.node(e).cache}set(e,t,n){let s=n?.internal===!0;this.node(e).down([[D,t]],{actor:n?.actor,internal:s,delivery:"write"})}setAll(e,t){let n=Symbol.iterator in e?e:Object.entries(e);le(()=>{for(let[s,o]of n)this.set(s,o,t)})}invalidate(e,t){let n=t?.internal===!0;this.node(e).down([[Q]],{actor:t?.actor,internal:n,delivery:"write"})}error(e,t,n){let s=n?.internal===!0;this.node(e).down([[I,t]],{actor:n?.actor,internal:s,delivery:"write"})}complete(e,t){let n=t?.internal===!0;this.node(e).down([[H]],{actor:t?.actor,internal:n,delivery:"write"})}edges(e){let t=e?.recursive===!0,n=new Map;if(!t){for(let[d,u]of this._nodes)n.set(u,d);let a=[];for(let[d,u]of this._nodes)if(u instanceof $)for(let l of u._deps){let h=n.get(l.node);h!=null&&a.push([h,d])}return a.sort((d,u)=>d[0]<u[0]?-1:d[0]>u[0]?1:d[1]<u[1]?-1:d[1]>u[1]?1:0),a}let s=[];this._collectObserveTargets("",s);let o=new Map;for(let[a,d]of s)o.set(d,a);let i=[];for(let[a,d]of s)if(d instanceof $)for(let u of d._deps){let l=o.get(u.node);l!=null&&i.push([l,a])}return i.sort((a,d)=>a[0]<d[0]?-1:a[0]>d[0]?1:a[1]<d[1]?-1:a[1]>d[1]?1:0),i}mount(e,t){if(t===void 0){let s=new r(e);return this.mount(e,s)}if(typeof t=="function"){let s=new r(e);return t(s),this.mount(e,s)}let n=t;if(Lt(e,this.name,"mount"),this._nodes.has(e))throw new Error(`Graph "${this.name}": cannot mount at "${e}" \u2014 node with that name exists`);if(this._mounts.has(e))throw new Error(`Graph "${this.name}": mount "${e}" already exists`);if(n===this)throw new Error(`Graph "${this.name}": cannot mount a graph into itself`);if(n._parent!=null)throw new Error(`Graph "${this.name}": this child graph is already mounted on "${n._parent.name}"`);for(let s=this;s!=null;s=s._parent)if(s===n)throw new Error(`Graph "${this.name}": mount("${e}", \u2026) would create a mount cycle`);return this._mounts.set(e,n),n._parent=this,this._emitTopology({kind:"added",name:e,nodeKind:"mount"}),n}resolve(e){let t=Tr(e,this.name);return this._resolveFromSegments(t)}tryResolve(e){try{return this.resolve(e)}catch{return}}_resolveFromSegments(e){let t=e;if(t[0]===this.name&&(t=t.slice(1),t.length===0))throw new Error(`Graph "${this.name}": resolve path ends at graph name only`);let n=t[0],s=t.slice(1);if(s.length===0){let a=this._nodes.get(n);if(a)return a;throw this._mounts.has(n)?new Error(`Graph "${this.name}": path ends at subgraph "${n}" \u2014 not a node (GRAPHREFLY-SPEC \xA73.5)`):new Error(`Graph "${this.name}": unknown name "${n}"`)}let o=this._nodes.get(n);if(o&&s.length>0&&s[0]===ee)return this._resolveMetaChainFromNode(o,s,t.join(P));let i=this._mounts.get(n);if(!i)throw this._nodes.has(n)?new Error(`Graph "${this.name}": "${n}" is a node; trailing path "${s.join(P)}" is invalid`):new Error(`Graph "${this.name}": unknown mount or node "${n}"`);return i.resolve(s.join(P))}_resolveMetaChainFromNode(e,t,n){let s=e,o=0,i=[...t];for(;o<i.length;){if(i[o]!==ee)throw new Error(`Graph "${this.name}": expected ${ee} segment in meta path "${n}"`);if(o+1>=i.length)throw new Error(`Graph "${this.name}": meta path requires a key after ${ee} in "${n}"`);let a=i[o+1],d=s.meta[a];if(!d)throw new Error(`Graph "${this.name}": unknown meta "${a}" in path "${n}"`);s=d,o+=2}return s}signal(e,t){if(t?.internal!==!0){for(let s of e)if(this.config.messageTier(s[0])===3)throw new Error(`Graph "${this.name}": Graph.signal() rejects tier-3 messages (DATA / RESOLVED). Broadcast is for control-plane tiers (START / DIRTY / INVALIDATE / PAUSE / RESUME / COMPLETE / ERROR / TEARDOWN). For per-node value writes, use Graph.set or graph.node(name).down(...).`)}let n=[];if(this._signalDeliver(e,t??{},new Set,n),n.length>0)throw n[0]}_signalDeliver(e,t,n,s){for(let d of this._mounts.values())d._signalDeliver(e,t,n,s);let i=t.internal===!0?{internal:!0}:{actor:t.actor,delivery:"signal"},a=Nr(e,this.config);for(let d of[...this._nodes.keys()].sort()){let u=this._nodes.get(d);if(!n.has(u)){n.add(u);try{u.down(e,i)}catch(l){if(l instanceof Z)throw l;s.push(l)}a.length!==0&&this._signalMetaSubtree(u,a,n,i,s)}}}_signalMetaSubtree(e,t,n,s,o){for(let i of Object.keys(e.meta).sort()){let a=e.meta[i];if(!n.has(a)){n.add(a);try{a.down(t,s)}catch(d){if(d instanceof Z)throw d;o.push(d)}this._signalMetaSubtree(a,t,n,s,o)}}}describe(e){if(e?.reactive==="diff")return this._describeReactiveDiff(e);if(e?.reactive===!0)return this._describeReactive(e);let t=hr(e?.actor),n=e?.filter;if(e?.detail!=null&&e?.fields!=null)throw new TypeError("Graph.describe(): pass either `detail` or `fields`, not both. `detail: 'spec'` is the canonical spec projection; use `fields` only when you need a custom subset.");let s=St(e?.detail,e?.fields),o=e?.detail==="spec",i=s,a=[];this._collectObserveTargets("",a);let d=new Map;for(let[y,w]of a)d.set(w,y);let u=[];{let y=a.map(([,m])=>m),w=new Set(d.values()),x=0;for(;y.length>0;){let m=y.shift();if(m instanceof $)for(let N of m._deps){let k=N.node;if(d.has(k))continue;let A=k.name??"",O=A;if(!O||w.has(O))if(A){let R=2;for(;w.has(`${A}#${R}`);)R++;O=`${A}#${R}`}else for(O=`__internal__/${x++}`;w.has(O);)O=`__internal__/${x++}`;d.set(k,O),w.add(O),u.push([O,k]),y.push(k)}}}let l=[...a,...u],h={};for(let[y,w]of l){if(t!=null&&!w.allowsObserve(t))continue;let x=Dt(w,i,o),m=w instanceof $?w._deps.map(O=>d.get(O.node)??O.node.name??""):[],{name:N,...k}=x,A={...k,deps:m};if(!o){let O=this._annotations.get(y);O!=null&&(A.annotation=O)}if(n!=null)if(typeof n=="function"){let O=n;if(!(O.length>=2?O(y,A):O(A)))continue}else{let O=!0;for(let[R,G]of Object.entries(n)){let S=R==="deps_includes"?"depsIncludes":R==="meta_has"?"metaHas":R;if(S==="depsIncludes"){if(!A.deps.includes(String(G))){O=!1;break}continue}if(S==="metaHas"){if(!Object.hasOwn(A.meta??{},String(G))){O=!1;break}continue}if(A[S]!==G){O=!1;break}}if(!O)continue}h[y]=A}let f=new Set(Object.keys(h)),g=[];for(let[y,w]of l)if(w instanceof $)for(let x of w._deps){let m=d.get(x.node);m!=null&&g.push([m,y])}g.sort((y,w)=>y[0]<w[0]?-1:y[0]>w[0]?1:y[1]<w[1]?-1:y[1]>w[1]?1:0);let c=g.map(([y,w])=>({from:y,to:w}));(t!=null||n!=null)&&(c=c.filter(y=>f.has(y.from)&&f.has(y.to)));let v=this._collectSubgraphs(""),p=t!=null||n!=null?v.filter(y=>{let w=`${y}${P}`;return[...f].some(x=>x===y||x.startsWith(w))}):v,T=this,_=e;return{name:this.name,nodes:h,edges:c,subgraphs:p,...this._factory!==void 0?{factory:this._factory}:{},...this._factoryArgs!==void 0?{factoryArgs:this._factoryArgs}:{},expand(y){let w={..._};return Array.isArray(y)?(w.fields=y,w.detail=void 0):(w.detail=y,w.fields=void 0),T.describe(w)}}}_collectSubgraphs(e){let t=[];for(let n of[...this._mounts.keys()].sort()){let s=e===""?n:`${e}${n}`;t.push(s),t.push(...this._mounts.get(n)._collectSubgraphs(`${s}${P}`))}return t}resourceProfile(e){return Nn(this,e)}reachable(e,t,n={}){return n.withDetail===!0?Ie(this.describe(),e,t,{...n,withDetail:!0}):Ie(this.describe(),e,t,n)}explain(e,t,n){return n?.reactive===!0?this._explainReactive(e,t,n):this._explainStatic(de(e),de(t),{...n?.maxDepth!==void 0?{maxDepth:kn(n.maxDepth)}:{},...n?.findCycle!==void 0?{findCycle:En(n.findCycle)}:{}})}_explainStatic(e,t,n){let s=this.describe({detail:"full"}),o=new Map(this._annotations),i=new Map;for(let[a,d]of Object.entries(s.nodes))d.lastMutation!=null&&i.set(a,d.lastMutation);return hn(s,e,t,{...n?.maxDepth!=null?{maxDepth:n.maxDepth}:{},...n?.findCycle===!0?{findCycle:!0}:{},annotations:o,lastMutations:i})}_describeReactive(e){let t={...e,reactive:!1},n=e.reactiveName??"describe",s=0,o=W(s,{name:`${n}_version`}),i=this.observe({timeline:!0,structured:!0}),a=!1,d=!1,u=()=>{a||d||(a=!0,we(()=>{a=!1,!d&&(s+=1,o.emit(s))}))},l=i.onEvent(_=>{let b=_.type;b!=="data"&&b!=="error"&&b!=="complete"&&b!=="teardown"||u()}),h=[],f=new WeakSet,g=_=>{if(f.has(_)||d)return;f.add(_);let b=_.topology.subscribe(y=>{for(let w of y){if(w[0]!==D)continue;let x=w[1];if(u(),x.kind==="added"&&x.nodeKind==="mount"){let m=_._mounts.get(x.name);m!=null&&g(m)}}});h.push(b);for(let y of _._mounts.keys()){let w=_._mounts.get(y);w!=null&&g(w)}};g(this);let c,v=e.actor;Sn(v)&&(c=v.subscribe(_=>{let b=!1,y=!1;for(let w of _){let x=w[0];x===D?b=!0:(x===H||x===I||x===z)&&(y=!0)}b&&u(),y&&(c?.(),c=void 0,u())}));let p;try{p=F([o],()=>this.describe(t),{name:n,describeKind:"derived",meta:{domain:"audit",kind:"describe"},equals:(_,b)=>_===b})}catch(_){l(),c?.();for(let b of h)b();throw i.dispose(),_}let T=K(p);return{node:p,dispose(){d=!0,l(),c?.();for(let _ of h)_();h.length=0,i.dispose(),T()}}}_describeReactiveDiff(e){let t={...e,reactive:!1},n=e.reactiveName??"describe-diff",s={name:this.name,nodes:{},edges:[],subgraphs:[]},o=this.describe(t),i=Mt(s,o),a=W(i,{name:n,meta:{domain:"audit",kind:"describe-diff"},equals:(f,g)=>f===g}),d=this._describeReactive({...e,reactiveName:void 0}),u=!1,l=d.node.subscribe(f=>{if(!u)for(let g of f){if(g[0]!==D)continue;let c=g[1],v=Mt(o,c);o=c,v.events.length!==0&&a.emit(v)}}),h=K(a);return{node:a,dispose(){u=!0,l(),d.dispose(),a.down([[z,"describe-diff disposed"]]),h()}}}_explainReactive(e,t,n){let s=0,o=W(s,{name:"explain_version"}),i=this.observe({timeline:!0,structured:!0}),a=!1,d=!1,u=()=>{a||d||(a=!0,we(()=>{a=!1,!d&&(s+=1,o.emit(s))}))},l=i.onEvent(_=>{let b=_.type;b!=="data"&&b!=="error"&&b!=="complete"&&b!=="teardown"||u()}),h=[];e!=null&&ye(e)&&h.push(e),t!=null&&ye(t)&&h.push(t),n?.maxDepth!=null&&ye(n.maxDepth)&&h.push(n.maxDepth),n?.findCycle!=null&&ye(n.findCycle)&&h.push(n.findCycle);let f=()=>{for(let _ of h)if(_.cache===void 0)return!1;return!0},g=()=>{let _=de(e),b=de(t);return{from:_,to:b,found:!1,reason:"pending",steps:[],text:"(awaiting reactive args)",toJSON:()=>({from:_,to:b,found:!1,reason:"pending",steps:[]})}},c;try{c=F([o],()=>{if(!f())return g();let _=de(e),b=de(t),y={...n?.maxDepth!==void 0?{maxDepth:kn(n.maxDepth)}:{},...n?.findCycle!==void 0?{findCycle:En(n.findCycle)}:{}};return this._explainStatic(_,b,y)},{name:n?.name??"explain",describeKind:"derived",meta:{domain:"audit",kind:"explain_path",from:de(e),to:de(t)},equals:(_,b)=>_.found===b.found&&_.reason===b.reason&&_.steps.length===b.steps.length&&Or(_.steps,b.steps)})}catch(_){throw l(),i.dispose(),_}let v=K(c),p=[],T=_=>{let b;return b=_.subscribe(y=>{let w=!1,x=!1;for(let m of y){let N=m[0];N===D?w=!0:(N===H||N===I||N===z)&&(x=!0)}(w||x)&&u(),x&&b&&(b(),b=void 0)}),()=>{b&&(b(),b=void 0)}};for(let _ of h)p.push(T(_));return{node:c,dispose(){d=!0,l();for(let _ of p)_?.();p.length=0,i.dispose(),v()}}}_pathsMatching(e){let t=ot(e),n=[];return this._collectObserveTargets("",n),n.map(([s])=>s).filter(s=>t.test(s))}_collectObserveTargets(e,t){for(let n of[...this._mounts.keys()].sort()){let s=e===""?n:`${e}${P}${n}`;this._mounts.get(n)._collectObserveTargets(s,t)}for(let n of[...this._nodes.keys()].sort()){let s=this._nodes.get(n),o=e===""?n:`${e}${P}${n}`;t.push([o,s]),this._appendMetaObserveTargets(o,s,t)}}_appendMetaObserveTargets(e,t,n){for(let s of Object.keys(t.meta).sort()){let o=t.meta[s],i=`${e}${P}${ee}${P}${s}`;n.push([i,o]),this._appendMetaObserveTargets(i,o,n)}}observe(e,t){let n=typeof e=="string",o=Rn(n?t:e);if(o.reactive===!0)return this._observeReactive(n?e:void 0,o);let i=o.structured===!0||o.timeline===!0||o.causal===!0||o.derived===!0||o.detail==="minimal"||o.detail==="full"||o.format!=null,a=o.actor;if(n){let l=e,h=this.resolve(l);if(a!=null&&!h.allowsObserve(a))throw new Z({actor:a,action:"observe",nodeName:l});return i?this._buildStructuredObserver([[l,h]],o,"one"):{subscribe(f){return h.subscribe(f)},up(f){try{h.up?.(f)}catch(g){if(g instanceof Z)return;throw g}}}}let d=[];this._collectObserveTargets("",d),d.sort((l,h)=>l[0]<h[0]?-1:l[0]>h[0]?1:0);let u=a==null?d:d.filter(([,l])=>l.allowsObserve(a));return i?this._buildStructuredObserver(u,o,"all"):{subscribe:l=>{let h=u.map(([f,g])=>g.subscribe(c=>{l(f,c)}));return()=>{for(let f of h)f()}},up:(l,h)=>{try{this.resolve(l).up?.(h)}catch(f){if(f instanceof Z)return;throw f}}}}_observeReactive(e,t){let n=t.tiers,s=n!=null?new Set(n):null,o=t.reactiveName??"observe";return Qe(i=>{let a=[],d=!1,u=!1,l=()=>{if(a.length===0||u)return;let v={events:a.slice(),flushedAt_ns:B()};a.length=0,i.emit(v)},h={...t,reactive:!1,structured:!0,timeline:!0},f=e!=null?this.observe(e,h):this.observe(h),g=v=>{u||(a.push(v),!d&&(d=!0,we(()=>{d=!1,l()})))};for(let v of f.events)g(v);let c=f.onEvent(g);return()=>{u=!0,c(),f.dispose()}},{name:o,meta:{domain:"audit",kind:"observe-reactive"}})}_buildStructuredObserver(e,t,n){let s=n==="one"?e[0]?.[0]:void 0,o=i=>{if(n==="one"&&s!=null){let l=this.resolve(s);return this._buildStructuredObserver([[s,l]],i,"one")}let a=[];this._collectObserveTargets("",a),a.sort((l,h)=>l[0]<h[0]?-1:l[0]>h[0]?1:0);let d=i.actor,u=d==null?a:a.filter(([,l])=>l.allowsObserve(d));return this._buildStructuredObserver(u,i,"all")};return this._createObserveResult(e,t,o)}_createObserveResult(e,t,n){let s=t.timeline===!0,o=t.causal===!0,i=t.derived===!0,a=t.detail==="minimal",d=this.config.inspectorEnabled,u=(o||i)&&d,l=t.maxEvents,h=l!=null&&l>0?new Le(l):null,f=[],g=new Set,c=t.tiers!=null?new Set(t.tiers):null,v={},p=new Set,T=0,_=0,b=0,y=0,w=0,x=0,m=!1,N=!1,k=0,A=new Map,O=new Map,R=new Map,G=E=>{if(!(c!=null&&!c.has(E.type))){h?h.push(E):f.push(E);for(let M of g)M(E)}},S=E=>c==null||c.has(E),ae=()=>s?{timestamp_ns:B(),in_batch:ze(),batch_id:k}:{},se=(E,M)=>{if(!(!u||!(E instanceof $)))return E._setInspectorHook(J=>{if(J.kind==="dep_message")A.set(E,J.depIndex);else if(J.kind==="run"){let Re=J.batchData.map((C,q)=>C!=null&&C.length>0?C.at(-1):J.prevData[q]);O.set(E,Re);let X=J.batchData.map(C=>C!=null?[...C]:void 0);R.set(E,X),i&&G({type:"derived",path:M,dep_values:Re,dep_batches:X,...ae()})}})},Fe=E=>{let M=A.get(E),J=O.get(E);if(!o||J==null)return{};let X=(M!=null&&M>=0&&E instanceof $?E._deps[M]:void 0)?.node,C=X?.v,q=R.get(E);return{trigger_dep_index:M,trigger_dep_name:X?.name,...C!=null?{trigger_version:{id:C.id,version:C.version}}:{},dep_values:[...J],...q!=null?{dep_batches:q}:{}}},Bt=[],Ut=[];for(let[E,M]of e){let J=se(M,E);J&&Bt.push(J),Ut.push(M.subscribe(Re=>{k++;for(let X of Re){let C=X[0],q=ae();if(C===D){v[E]=X[1];let ht=M instanceof $?M.lastMutation?.actor??Ne:Ne;G({type:"data",path:E,data:X[1],actor:ht,...q,...Fe(M)})}else if(a)C===U?S("dirty")&&T++:C===Y?S("resolved")&&_++:C===Q?S("invalidate")&&b++:C===te?S("pause")&&y++:C===oe?S("resume")&&w++:C===z?S("teardown")&&x++:C===H&&!p.has(E)?S("complete")&&(m=!0):C===I&&S("error")&&(N=!0,p.add(E));else if(C===U)S("dirty")&&T++,G({type:"dirty",path:E,...q});else if(C===Y)S("resolved")&&_++,G({type:"resolved",path:E,...q,...Fe(M)});else if(C===Q)S("invalidate")&&b++,G({type:"invalidate",path:E,...q});else if(C===te)S("pause")&&y++,G({type:"pause",path:E,lockId:X[1],...q});else if(C===oe)S("resume")&&w++,G({type:"resume",path:E,lockId:X[1],...q});else if(C===H)S("complete")&&!p.has(E)&&(m=!0),G({type:"complete",path:E,...q});else if(C===I){S("error")&&(N=!0,p.add(E));let ht=M instanceof $?M.lastMutation?.actor??Ne:Ne;G({type:"error",path:E,data:X[1],actor:ht,...q})}else C===z&&(S("teardown")&&x++,G({type:"teardown",path:E,...q}))}}))}let lt=!1,pt=()=>{if(!lt){lt=!0;for(let E of Ut)E();for(let E of Bt)E();for(let E of Ve)E({value:void 0,done:!0});Ve.length=0}},ft=[],Ve=[];g.add(E=>{let M=Ve.shift();M?M({value:E,done:!1}):ft.push(E)});let Wt={get values(){return v},get dirtyCount(){return T},get resolvedCount(){return _},get invalidateCount(){return b},get pauseCount(){return y},get resumeCount(){return w},get teardownCount(){return x},get events(){return h?h.toArray():[...f]},get anyCompletedCleanly(){return m},get anyErrored(){return N},get completedWithoutErrors(){return m&&!N},onEvent(E){return g.add(E),()=>g.delete(E)},dispose:pt,expand(E){pt();let M={...t};return typeof E=="string"?M.detail=E:Object.assign(M,E),n(Rn(M))},[Symbol.asyncIterator](){return{next(){return ft.length>0?Promise.resolve({value:ft.shift(),done:!1}):lt?Promise.resolve({value:void 0,done:!0}):new Promise(E=>Ve.push(E))},return(){return pt(),Promise.resolve({value:void 0,done:!0})}}}};return t.format!=null&&this._attachFormatLogger(Wt,t),Wt}_attachFormatLogger(e,t){let n=t.format;if(n==null)return;let s=t.logger??(c=>console.log(c)),o=t.includeTypes?new Set(t.includeTypes):null,i=t.excludeTypes?new Set(t.excludeTypes):null,a=o==null&&i==null?()=>!0:c=>(o==null||o.has(c))&&(i==null||!i.has(c)),d=_r(t.theme),u=n==="stage-log"?B():0,l=c=>c==null?"":t.stageLabels?.[c]??c,h=(c,v)=>c.length>v?`${c.slice(0,v-1)}\u2026`:c,f=c=>c.type==="data"||c.type==="error"?h(Pt(c.data),120):"",g=c=>{if(n==="stage-log"){let m=(B()-u)/1e9,N=l(c.path).padEnd(9);if(c.type==="data"){let k=f(c);return`[${m.toFixed(3)}s] ${N} \u2190${k?` ${k}`:""}`}if(c.type==="error"){let k=f(c);return`[${m.toFixed(3)}s] ${N} \u2717${k?` ${k}`:""}`}return c.type==="complete"?`[${m.toFixed(3)}s] ${N} \u25A0 complete`:`[${m.toFixed(3)}s] ${N} ${c.type}`}if(n==="json")try{return JSON.stringify(c)}catch{return JSON.stringify({type:c.type,path:c.path,data:"[unserializable]"})}let v=d[c.type]??"",p=c.path?`${d.path}${c.path}${d.reset} `:"",T=c.type==="data"||c.type==="error",_=c.type==="pause"||c.type==="resume",b=T?` ${Pt(c.data)}`:_?` ${Pt(c.lockId)}`:"",y=c.type==="data"||c.type==="resolved"||c.type==="derived"?c:void 0,w=y?.trigger_dep_name!=null?` <- ${y.trigger_dep_name}`:y?.trigger_dep_index!=null?` <- #${y.trigger_dep_index}`:"",x=c.in_batch?" [batch]":"";return`${p}${v}${c.type.toUpperCase()}${d.reset}${b}${w}${x}`};e.onEvent(c=>{a(c.type)&&s(g(c),c)})}addDisposer(e){return this._disposers.add(e),()=>{this._disposers.delete(e)}}destroy(){xn(this._disposers,this.name),this.signal([[z]],{internal:!0}),xn(this._storageDisposers,this.name);for(let e of[...this._mounts.values()])e._parent=void 0,e._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}get destroyed(){return this._destroyed}_destroyClearOnly(){for(let e of[...this._mounts.values()])e._parent=void 0,e._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}snapshot(e){let{expand:t,...n}=this.describe({detail:"full"}),s={};for(let a of Object.keys(n.nodes).sort()){let{lastMutation:d,guard:u,...l}=n.nodes[a];s[a]=l}let o=[...n.subgraphs].sort(),i={...n,version:1,nodes:s,subgraphs:o};if(e?.format==null)return i;if(e.format==="json-string")return JSON.stringify(i);if(e.format==="bytes"){if(e.codec==null)throw new Error("snapshot({format: 'bytes'}) requires a `codec` name");let a=this.config.lookupCodec(e.codec);if(a==null)throw new Error(`snapshot: codec "${e.codec}" is not registered on this graph's config. Call config.registerCodec(...) before creating nodes.`);return Qt(a,a.encode(i))}throw new Error(`snapshot: unknown format "${String(e.format)}"`)}static decode(e,t){let n=t?.config??Oe,{codec:s,codecVersion:o,payload:i}=en(e,n);return s.decode(i,o)}restore(e,t){if(An(e),e.name!==this.name)throw new Error(`Graph "${this.name}": restore snapshot name "${e.name}" does not match this graph`);let n=t?.only==null?null:(Array.isArray(t.only)?t.only:[t.only]).map(o=>ot(o)),s=t?.includeProducers===!0;for(let o of Object.keys(e.nodes).sort()){if(n!==null&&!n.some(a=>a.test(o)))continue;let i=e.nodes[o];if(i!==void 0){if(!("value"in i)||i.value===void 0){"value"in i&&i.value===void 0&&t?.onError?.(o,new Error(`restore: slice.value is undefined for "${o}" (undefined is the global SENTINEL; not valid DATA)`));continue}if(!(i.type==="derived"||i.type==="effect")&&!(i.type==="producer"&&!s)){if(i.v!=null){let d=this.tryResolve(o)?.v;if(d!=null&&d.id===i.v.id&&d.version===i.v.version)continue}try{this.set(o,i.value)}catch(a){t?.onError?.(o,a)}}}}}static fromSnapshot(e,t){An(e);let n=typeof t=="function"?t:t?.build,s=typeof t=="function"?void 0:t?.factories,o=new r(e.name);if(n)return n(o),o.restore(e),o;for(let g of[...e.subgraphs].sort((c,v)=>{let p=c.split(P).length,T=v.split(P).length;return p!==T?p-T:c<v?-1:c>v?1:0})){let c=g.split(P),v=o;for(let p of c)v._mounts.has(p)||v.mount(p,new r(p)),v=v._mounts.get(p)}let i=s?Object.entries(s).map(([g,c])=>({re:ot(g),factory:c})):[],a=g=>{for(let c of i)if(c.re.test(g))return c.factory},d=g=>{let c=g.split(P),v=c.pop();if(v==null||v.length===0)throw new Error(`invalid snapshot path "${g}"`);let p=o;for(let T of c){let _=p._mounts.get(T);if(!_)throw new Error(`unknown mount "${T}" in path "${g}"`);p=_}return[p,v]},u=Object.entries(e.nodes).filter(([g])=>!g.includes(`${P}${ee}${P}`)).sort((g,c)=>g[0]<c[0]?-1:g[0]>c[0]?1:0),l=new Map(u),h=new Map,f=!0;for(;l.size>0&&f;){f=!1;for(let[g,c]of[...l.entries()]){let v=c?.deps??[];if(!v.every(w=>h.has(w)))continue;let[p,T]=d(g),_={...c?.meta??{}},b=a(g),y;if(c?.type==="state")y=W(c.value,{meta:_});else{if(b==null)continue;y=b(T,{path:g,type:c.type,value:c.value,meta:_,deps:v,resolvedDeps:v.map(w=>h.get(w))})}p.add(y,{name:T}),h.set(g,y),l.delete(g),f=!0}}if(l.size>0){let g=[...l.keys()].sort().join(", ");throw new Error(`Graph.fromSnapshot could not reconstruct nodes without build callback: ${g}. Pass matching factories via fromSnapshot(data, { factories: { pattern: factoryFn } }).`)}return o.restore(e),o}toJSON(){return this.snapshot()}attachSnapshotStorage(e,t={}){let n=e.map(u=>({tier:u,debounceMs:Math.max(0,u.debounceMs??0),compactEvery:Math.max(1,u.compactEvery??10),timer:void 0,seq:0,lastSnapshot:void 0,lastFingerprint:"",disposed:!1,savePending:void 0}));t.autoRestore===!0&&this._cascadeRestore(e,t.onError);let s=(u,l)=>{if(u.disposed)return;let h=gr(l.nodes);if(u.lastSnapshot!=null&&h!==""&&h===u.lastFingerprint)return;let f=u.seq+1,g=ne(),p=u.lastSnapshot==null||f%u.compactEvery===0?{name:this.name,mode:"full",snapshot:l,seq:f,timestamp_ns:g,format_version:be}:{name:this.name,mode:"diff",diff:Gn(u.lastSnapshot,l),seq:f,timestamp_ns:g,format_version:be};if(u.tier.filter&&!u.tier.filter(p))return;let T;try{T=u.tier.save(p)}catch(_){t.onError?.(_,u.tier);return}if(T&&typeof T.then=="function"){let y=(u.savePending??Promise.resolve()).then(()=>T,()=>T).then(()=>{u.disposed||(u.seq=f,u.lastSnapshot=l,u.lastFingerprint=h)},w=>{t.onError?.(w,u.tier)});u.savePending=y.finally(()=>{u.savePending===y&&(u.savePending=void 0)})}else u.seq=f,u.lastSnapshot=l,u.lastFingerprint=h},o=(u,l)=>{try{s(u,l)}catch(h){t.onError?.(h,u.tier)}},i=(u,l)=>{if(!l.some(c=>{let v=this.config.messageTier(c[0]);return v>=3&&v<5}))return;if(t.filter){let c=this.tryResolve(u);if(c==null)return;let v=Dt(c,St("standard"));if(!t.filter(u,v))return}let f,g=()=>(f==null&&(f=this.snapshot()),f);for(let c of n)c.disposed||(c.debounceMs===0?o(c,g()):(c.timer==null&&(c.timer=new st),c.timer.start(c.debounceMs,()=>{c.disposed||o(c,this.snapshot())})))},a;if(t.paths!=null){let l=(typeof t.paths=="string"?this._pathsMatching(t.paths):t.paths).map(h=>{let f=this.tryResolve(h);return f==null?()=>{}:f.subscribe(g=>i(h,g))});a=()=>{for(let h of l)h()}}else a=this.observe().subscribe((u,l)=>i(u,l));let d=()=>{a();for(let u of n)u.disposed=!0,u.timer?.cancel();this._storageDisposers.delete(d)};return this._storageDisposers.add(d),{dispose:d}}async _cascadeRestore(e,t){for(let n of e){let s;try{s=await n.load?.()}catch(i){t?.(i,n);continue}if(s==null||typeof s!="object"||Array.isArray(s))continue;let o=s;try{if(o.mode==="full"&&o.snapshot!=null)return this.restore(o.snapshot),!0;if(o.version===be&&o.nodes!=null)return this.restore(o),!0}catch(i){t?.(i,n)}}return!1}static async fromStorage(e,t,n){for(let s of t){let o;try{o=await s.load?.()}catch(d){n?.onError?.(d,s);continue}if(o==null||typeof o!="object"||Array.isArray(o))continue;let i=o,a=i.mode==="full"&&i.snapshot!=null?i.snapshot:i.version===be&&i.nodes!=null?i:void 0;if(a!=null)try{return r.fromSnapshot(a,n)}catch(d){n?.onError?.(d,s)}}throw new Error(`Graph.fromStorage: no tier held a restorable record for "${e}" across ${t.length} tier(s)`)}_annotations=new Map;_traceRing;trace(e,t,n){if(e!=null&&t!=null){if(this.tryResolve(e)==null)return;if(this._annotations.set(e,t),this.config.inspectorEnabled){let s={path:e,annotation:t,timestamp_ns:B(),...n?.actor!=null?{actor:n.actor}:{}};this._traceRing.push(s)}return}return e!=null?this.config.inspectorEnabled?this._annotations.get(e):void 0:this.config.inspectorEnabled?this._traceRing.toArray():[]}annotation(e){return this._annotations.get(e)}clearTrace(){this._annotations.clear(),this._traceRing.clear()}pruneTrace(e){let t=this._traceRing.toArray().filter(s=>!e(s)),n=this._traceRing.size-t.length;this._traceRing.clear();for(let s of t)this._traceRing.push(s);return n}static diff(e,t){let n=new Set(Object.keys(e.nodes)),s=new Set(Object.keys(t.nodes)),o=[...s].filter(_=>!n.has(_)).sort(),i=[...n].filter(_=>!s.has(_)).sort(),a=[],d=[];for(let _ of n){if(!s.has(_))continue;let b=e.nodes[_],y=t.nodes[_],w=b.v,x=y.v;w!=null&&x!=null&&w.id===x.id&&w.version!==x.version&&d.push({path:_,id:w.id,from:w.version,to:x.version});let m=w!=null&&x!=null&&w.id===x.id&&w.version===x.version;for(let N of["type","status","sentinel"]){let k=b[N],A=y[N];k!==A&&a.push({path:_,field:N,from:k,to:A})}if(!m)for(let N of["value","meta"]){let k=b[N],A=y[N];mr(k,A)||a.push({path:_,field:N,from:k,to:A})}}let u=_=>`${_.from} ${_.to}`,l=new Set(e.edges.map(u)),h=new Set(t.edges.map(u)),f=t.edges.filter(_=>!l.has(u(_))),g=e.edges.filter(_=>!h.has(u(_))),c=new Set(e.subgraphs),v=new Set(t.subgraphs),p=[...v].filter(_=>!c.has(_)).sort(),T=[...c].filter(_=>!v.has(_)).sort();return{nodesAdded:o,nodesRemoved:i,nodesChanged:a,versionChanges:d,edgesAdded:f,edgesRemoved:g,subgraphsAdded:p,subgraphsRemoved:T}}}});function $e(r,e){let t=new Map,n=(s,o)=>{if(t.has(s))return;let i={off:()=>{},prefix:o};t.set(s,i);let a=s.topology.subscribe(d=>{for(let u of d){if(u[0]!==D)continue;let l=u[1];if(e(l,s,o),l.kind==="added"&&l.nodeKind==="mount"){let h=s._mounts.get(l.name);if(h instanceof j){let f=`${o}${l.name}::`;n(h,f)}}else if(l.kind==="removed"&&l.nodeKind==="mount"){let h=`${o}${l.name}::`;for(let[f,g]of Array.from(t.entries()))f!==r&&g.prefix.startsWith(h)&&(g.off(),t.delete(f))}}});i.off=a;for(let[d,u]of s._mounts)if(u instanceof j){let l=`${o}${d}::`;n(u,l)}};return n(r,""),()=>{for(let s of t.values())s.off();t.clear()}}var Cn=L(()=>{"use strict";re();it()});var Ee=L(()=>{"use strict";it();Cn()});var Mr={};Wn(Mr,{AuditTrailGraph:()=>at,GuardedExecutionGraph:()=>ut,InspectGraph:()=>ct,PolicyGateGraph:()=>dt,auditTrail:()=>$t,complianceSnapshot:()=>Vt,computeHealthReport:()=>zn,graphLens:()=>jt,guardedExecution:()=>Gr,healthReportEqual:()=>jn,inspect:()=>Cr,policyGate:()=>Ft,watchTopologyTree:()=>$e});module.exports=qn(Mr);Ge();pe();fe();re();Ze();ge();me();kt();Me();Ge();re();ge();me();var Gt=class{_version=0;_maxSize;_buf;_head=0;_size=0;constructor(e,t){if(t!==void 0&&t<1)throw new RangeError("maxSize must be >= 1");if(this._maxSize=t,t!==void 0){if(this._buf=new Array(t),e&&e.length>0){let n=Math.min(e.length,t),s=e.length-n;for(let o=0;o<n;o++)this._buf[o]=e[s+o];this._size=n}}else this._buf=e?[...e]:[],this._size=this._buf.length}get version(){return this._version}get size(){return this._size}at(e){if(!Number.isInteger(e))return;let t=e>=0?e:this._size+e;if(!(t<0||t>=this._size))return this._maxSize!==void 0?this._buf[(this._head+t)%this._maxSize]:this._buf[t]}append(e){this._rawAppend(e),this._version+=1}appendMany(e){if(e.length===0)return;let t=this._maxSize!==void 0&&e.length>this._maxSize?e.length-this._maxSize:0;for(let n=t;n<e.length;n++)this._rawAppend(e[n]);this._version+=1}clear(){if(this._size===0)return 0;let e=this._size;if(this._maxSize===void 0)this._buf.length=0;else for(let t=0;t<e;t++)this._buf[(this._head+t)%this._maxSize]=void 0;return this._head=0,this._size=0,this._version+=1,e}trimHead(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`trimHead: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return 0;let t=Math.min(e,this._size);if(this._maxSize===void 0)this._buf.splice(0,t);else{for(let n=0;n<t;n++)this._buf[(this._head+n)%this._maxSize]=void 0;this._head=(this._head+t)%this._maxSize}return this._size-=t,this._version+=1,t}slice(e,t){if(!Number.isInteger(e)||e<0)throw new RangeError(`slice: start must be a non-negative integer (got ${e})`);if(t!==void 0&&(!Number.isInteger(t)||t<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${t})`);let n=t===void 0?this._size:Math.min(Math.max(t,0),this._size),s=Math.min(e,this._size);if(s>=n)return[];let o=n-s;if(this._maxSize===void 0)return this._buf.slice(s,n);let i=new Array(o);for(let a=0;a<o;a++)i[a]=this._buf[(this._head+s+a)%this._maxSize];return i}tail(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`tail: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return[];let t=Math.min(e,this._size);return this.slice(this._size-t,this._size)}toArray(){if(this._maxSize===void 0)return[...this._buf];let e=new Array(this._size);for(let t=0;t<this._size;t++)e[t]=this._buf[(this._head+t)%this._maxSize];return e}snapshot(){return this.toArray()}restore(e){if(this._maxSize===void 0){this._buf.length=0;for(let t=0;t<e.length;t++)this._buf.push(e[t]);this._size=this._buf.length}else{let t=this._maxSize;for(let o=0;o<t;o++)this._buf[o]=void 0;this._head=0;let n=Math.min(e.length,t),s=e.length-n;for(let o=0;o<n;o++)this._buf[o]=e[s+o];this._size=n}this._version+=1}_rawAppend(e){if(this._maxSize===void 0){this._buf.push(e),this._size=this._buf.length;return}this._size<this._maxSize?(this._buf[(this._head+this._size)%this._maxSize]=e,this._size+=1):(this._buf[this._head]=e,this._head=(this._head+1)%this._maxSize)}};function Pe(r){return r.subscribe(()=>{})}var ar=64;function et(r,e={}){let{name:t,maxSize:n,versioning:s,guard:o,backend:i}=e,a=i??new Gt(r,n),d=W(a.toArray(),{name:t,describeKind:"state",equals:(m,N)=>m===N,...s!=null?{versioning:s}:{},...o!=null?{guard:o}:{}});function u(){let m=a.toArray();le(()=>{d.down([[U]],{internal:!0}),d.down([[D,m]],{internal:!0})})}let l=new Map,h=new Map,f=new Map;function g(m,N){return`${m}:${N===void 0?"END":N}`}function c(m){if(m.size<ar)return;let N=m.keys().next();if(N.done)return;let k=m.get(N.value);k!==void 0&&k.dispose(),m.delete(N.value)}function v(m){let N=a.version;try{return m()}finally{a.version!==N&&u()}}function p(m){if(!Number.isInteger(m)||m<0)throw new RangeError(`tail: n must be a non-negative integer (got ${m})`);let N=l.get(m);if(N!==void 0)return l.delete(m),l.set(m,N),N.node;c(l);let k=F([d],([O])=>{let R=O;return m===0||R.length===0?[]:R.slice(Math.max(0,R.length-m))},{initial:a.tail(m),describeKind:"derived"}),A=Pe(k);return l.set(m,{node:k,dispose:A}),k}function T(m,N){if(!Number.isInteger(m)||m<0)throw new RangeError(`slice: start must be a non-negative integer (got ${m})`);if(N!==void 0&&(!Number.isInteger(N)||N<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${N})`);let k=g(m,N),A=h.get(k);if(A!==void 0)return h.delete(k),h.set(k,A),A.node;c(h);let O=F([d],([G])=>{let S=G;return N===void 0?S.slice(m):S.slice(m,N)},{initial:a.slice(m,N),describeKind:"derived"}),R=Pe(O);return h.set(k,{node:O,dispose:R}),O}function _(m){let N=f.get(m);if(N!==void 0)return N.node;let k=F([d,m],([O,R])=>{let G=O,S=Math.max(0,Math.trunc(R??0));return G.slice(S)},{initial:[],describeKind:"derived"}),A=Pe(k);return f.set(m,{node:k,dispose:A}),k}let b,y;function w(){b===void 0&&(b=xe([d],(m,N,k)=>{let A=m[0],R=A!=null&&A.length>0?A.at(-1):k.prevData[0];if(R==null||R.length===0){N.down([[Y]]);return}N.emit(R[R.length-1])},{name:t!=null?`${t}::lastValue`:"lastValue",describeKind:"derived",initial:a.size===0?void 0:a.at(a.size-1)}),y=F([d],([m])=>m.length>0,{name:t!=null?`${t}::hasLatest`:"hasLatest",describeKind:"derived",initial:a.size>0}),Pe(b),Pe(y))}let x={entries:d,get size(){return a.size},at(m){return a.at(m)},append(m){v(()=>a.append(m))},appendMany(m){m.length!==0&&v(()=>a.appendMany(m))},clear(){v(()=>a.clear())},trimHead(m){v(()=>a.trimHead(m))},withLatest(){return w(),d},get lastValue(){return w(),b},get hasLatest(){return w(),y},view(m){switch(m.kind){case"tail":return p(m.n);case"slice":return T(m.start,m.stop);case"fromCursor":return _(m.cursor)}},attach(m){let N=m.subscribe(k=>{for(let A of k)A[0]===D&&x.append(A[1])});return()=>N()},attachStorage(m){if(m.length===0)return()=>{};let N=new Map;for(let A of m)N.set(A,a.size);(async()=>{for(let A of m)if(typeof A.loadEntries=="function")try{let O=await Promise.resolve(A.loadEntries());O.entries.length>0&&a.size===0&&(a.restore(O.entries),N.set(A,O.entries.length),u());break}catch{}})();let k=d.subscribe(A=>{for(let O of A){if(O[0]!==D)continue;let R=O[1];for(let G of m){let S=N.get(G)??0;if(R.length<S){try{let se=G.appendEntries(R);se instanceof Promise&&se.catch(()=>{})}catch{}N.set(G,R.length);continue}if(R.length===S)continue;let ae=R.slice(S);N.set(G,R.length);try{let se=G.appendEntries(ae);se instanceof Promise&&se.catch(()=>{})}catch{}}}});return()=>k()},disposeAllViews(){for(let m of l.values())m.dispose();l.clear();for(let m of h.values())m.dispose();h.clear();for(let m of f.values())m.dispose();f.clear()},dispose(){for(let m of l.values())m.dispose();l.clear();for(let m of h.values())m.dispose();h.clear();for(let m of f.values())m.dispose();f.clear()}};return x}ke();Ee();qe();fe();re();me();Me();pe();fe();re();var ro=mt((r,e)=>{r("observe"),r("signal"),e("write")});function Pn(r){if(r===null||typeof r!="object"||Object.isFrozen(r))return r;for(let e of Object.keys(r))Pn(r[e]);return Object.freeze(r)}function xr(r){let e=r.cache,n=(typeof e=="number"&&Number.isFinite(e)?e:0)+1;return r.down([[U],[D,n]]),n}function Mn(r,e,t,n,s,o){let i=e(t,n,s);if(i===void 0)return;let a=o!=null?{...i,handlerVersion:o}:i;r.append(a)}function Ln(r,e){let t=e.freeze??!0;return function(...s){let o=t?s.map(Pn):s,i=ne(),a=e.seq?xr(e.seq):void 0;try{let d=r(...o);return e.audit&&e.onSuccess&&Mn(e.audit,e.onSuccess,o,d,{t_ns:i,seq:a},e.handlerVersion),d}catch(d){if(e.audit&&e.onFailure){let u=d instanceof Error?d.name:typeof d;Mn(e.audit,e.onFailure,o,d,{t_ns:i,seq:a,errorType:u},e.handlerVersion)}throw d}}}ke();Ee();function In(r,e){return ie("messaging",r,e)}var kr=1024,Ae=class extends j{_log;_publishImpl;events;latest;hasLatest;constructor(e,t={}){super(e,t.graph),this._log=et([],{name:"events",maxSize:t.retainedLimit??kr}),this._log.withLatest(),this.events=this._log.entries,this.add(this.events,{name:"events"}),this.latest=F([this.events],([n])=>{let s=n;return s.length===0?null:s[s.length-1]},{name:"latest",describeKind:"derived",meta:In("topic_latest")}),this.add(this.latest,{name:"latest"}),this.addDisposer(K(this.latest)),this.hasLatest=F([this.events],([n])=>n.length>0,{name:"hasLatest",describeKind:"derived",meta:In("topic_has_latest")}),this.add(this.hasLatest,{name:"hasLatest"}),this.addDisposer(K(this.hasLatest)),this.addDisposer(()=>{this.events.down([[H]])}),this.addDisposer(()=>this._log.disposeAllViews()),this._publishImpl=Ln(n=>{this._log.append(n)},{freeze:!1})}publish(e){if(e===void 0)throw new TypeError(`TopicGraph "${this.name}": publish(undefined) is not allowed (spec \xA75.12 SENTINEL).`);this._publishImpl(e)}attachEventStorage(e){return this._log.attachStorage(e)}retained(){return this.events.cache}get _logBundle(){return this._log}};function Vn(r,e){return ie("audit",r,e)}var Er=new Set(["data","error","complete","teardown"]),at=class extends j{entries;count;_log;_target;constructor(e,t){super(t.name??`${e.name}_audit`,t.graph),this._target=e,this._log=et([],{name:"entries",...t.maxSize!=null?{maxSize:t.maxSize}:{}}),this.entries=this._log.entries,this.add(this.entries,{name:"entries"}),this.count=F([this.entries],([d])=>d.length,{name:"count",describeKind:"derived",meta:Vn("count")}),this.add(this.count,{name:"count"}),this.addDisposer(K(this.count));let n=t.includeTypes!=null?new Set(t.includeTypes):Er,s=t.filter,o=0,i=e.observe({timeline:!0,structured:!0}),a=i.onEvent(d=>{if(d.type==="derived")return;let u=d.type;if(!n.has(u))return;let l=d.path??"",h={seq:o++,timestamp_ns:d.timestamp_ns??B(),wall_clock_ns:ne(),path:l,type:u},g=(l?It(e,l):void 0)?.lastMutation;g!=null&&(h.actor=g.actor),u==="data"&&(h.value=d.data),u==="error"&&(h.error=d.data);let c=l?Ar(e,l):void 0;c!=null&&(h.annotation=c),!(s!=null&&!s(h))&&this._log.append(h)});this.addDisposer(()=>{a(),i.dispose()}),this.addDisposer(()=>this._log.disposeAllViews())}all(){return this.entries.cache??[]}byNode(e){return this.all().filter(t=>t.path===e)}byActor(e){return this.all().filter(t=>t.actor?.id===e)}byActorType(e){return this.all().filter(t=>t.actor?.type===e)}byTimeRange(e,t){return this.all().filter(n=>!(n.timestamp_ns<e||t!=null&&n.timestamp_ns>=t))}get target(){return this._target}};function $t(r,e={}){return new at(r,e)}var dt=class extends j{policies;violations;violationCount;_target;_mode;_currentGuard;constructor(e,t,n){super(n.name??`${e.name}_policy`,n.graph),this._target=e,this._mode=n.mode??"audit";let s=$n(t)?t:W(t,{name:"policies"});this.policies=s,this.add(this.policies,{name:"policies"}),this.violations=new Ae("violations",{retainedLimit:n.violationsLimit??1e3}),this.mount("violations",this.violations),this.violationCount=F([this.violations.events],([c])=>c.length,{name:"violationCount",describeKind:"derived",meta:Vn("policy_violation_count")}),this.add(this.violationCount,{name:"violationCount"}),this.addDisposer(K(this.violationCount));let i=s.cache??[];this._currentGuard=bt(i);let a=s.subscribe(c=>{for(let v of c)v[0]===D&&(i=v[1]??[],this._currentGuard=bt(i))});this.addDisposer(a);let d=n.paths,u=$n(d)?d:void 0,l=d!=null,f=u!=null?u.cache??[]:l?[...d]:void 0,g=f??Fn(e);if(this._mode!=="enforce"&&u!=null){let c=u.subscribe(v=>{for(let p of v)p[0]===D&&(f=p[1]??[])});this.addDisposer(c)}if(this._mode==="enforce"){let c=new Map,v=p=>{if(c.has(p))return;let T=It(e,p);if(!(T instanceof $))return;let _=(b,y)=>{let w=this._currentGuard(b,y);return w||this._publishViolation(b,y,p,"blocked"),w};c.set(p,T._pushGuard(_))};for(let p of g)v(p);if(u!=null){let p=u.subscribe(T=>{for(let _ of T){if(_[0]!==D)continue;let b=_[1]??[],y=new Set(b),w=new Set(f??[]);le(()=>{for(let x of w){if(y.has(x))continue;let m=c.get(x);m!=null&&(m(),c.delete(x))}for(let x of y)w.has(x)||v(x);f=b})}});this.addDisposer(p)}if(l){let p=e.topology.subscribe(T=>{for(let _ of T){if(_[0]!==D)continue;let b=_[1];if(b.kind!=="removed"||b.nodeKind!=="node")continue;let y=c.get(b.name);y!=null&&(y(),c.delete(b.name))}});this.addDisposer(p)}else{let p=$e(e,(T,_,b)=>{if(T.kind==="added")if(T.nodeKind==="node")v(`${b}${T.name}`);else{let y=_._mounts.get(T.name);if(!(y instanceof j))return;let w=`${b}${T.name}::`,x=Fn(y);for(let m of x)v(m===""?`${b}${T.name}`:`${w}${m}`)}else if(T.kind==="removed")if(T.nodeKind==="node"){let y=`${b}${T.name}`,w=c.get(y);w!=null&&(w(),c.delete(y))}else{let y=`${b}${T.name}`,w=`${y}::`;for(let[x,m]of c)(x===y||x.startsWith(w))&&(m(),c.delete(x))}});this.addDisposer(p)}this.addDisposer(()=>{for(let p of c.values())p();c.clear()})}else{let c=e.observe({timeline:!0,structured:!0}),v=c.onEvent(p=>{if(p.type!=="data"&&p.type!=="error")return;let T=p.path??"";if(!T||f!=null&&!f.includes(T))return;let _=p.actor??It(e,T)?.lastMutation?.actor;if(_==null)return;let b="write";this._currentGuard(_,b)||this._publishViolation(_,b,T,"observed")});this.addDisposer(()=>{v(),c.dispose()})}}_publishViolation(e,t,n,s){this.violations.publish({timestamp_ns:B(),wall_clock_ns:ne(),path:n,actor:e,action:t,mode:this._mode,result:s})}all(){return this.violations.retained()}get mode(){return this._mode}get target(){return this._target}};function Ft(r,e,t={}){let n=new dt(r,e,t);return n.tagFactory("policyGate",Xe(t)),n}function Vt(r,e={}){let t={format_version:1,timestamp_ns:B(),wall_clock_ns:ne(),graph:r.snapshot()};if(e.actor!=null&&(t.actor=e.actor),e.audit!=null){let s=[...e.audit.all()];t.audit={count:s.length,entries:s}}if(e.policies!=null){let s=e.policies.policies.cache??[];t.policies={mode:e.policies.mode,rules:s,violations:[...e.policies.all()]}}let n=Rr(t);return{...t,fingerprint:n}}function $n(r){return typeof r=="object"&&r!==null&&"subscribe"in r}function It(r,e){try{return r.node(e)}catch{return}}function Ar(r,e){try{return r.annotation(e)}catch{return}}function Fn(r){let e=r.describe({detail:"minimal"});return Object.keys(e.nodes)}function Rr(r){return Ce(JSON.stringify(Sr(r)))}function Sr(r){let e=new Set,t=n=>{if(n===void 0)return{__undefined:!0};if(n===null)return null;let s=typeof n;if(s==="bigint")return{__bigint:n.toString()};if(s!=="object")return n;let o=n;if(e.has(o))return{__circular:!0};e.add(o);try{if(Array.isArray(o))return o.map(t);if(o instanceof Date)return{__date:o.toISOString()};if(o instanceof RegExp)return{__regexp:{source:o.source,flags:o.flags}};if(o instanceof Map)return{__map:[...o.entries()].map(([d,u])=>[t(d),t(u)])};if(o instanceof Set)return{__set:[...o].map(t)};if(ArrayBuffer.isView(o)){let a=o,d=new Array(a.length);for(let u=0;u<a.length;u++)d[u]=a[u]??0;return{__typed_array:{ctor:o.constructor.name,data:d}}}let i={};for(let a of Object.keys(o).sort())i[a]=t(o[a]);return i}finally{e.delete(o)}};return t(r)}pe();re();me();Me();ke();Ee();function zt(r){return typeof r=="object"&&r!==null&&"subscribe"in r&&"down"in r}function Dr(r){return ie("guarded",r)}var ut=class extends j{enforcer;violations;lints;scope;scopedDescribe;_target;_actorNode;_mode;_firedLintKinds=new Set;constructor(e,t){super(t.name??`${e.name}_guarded`,t.graph),this._target=e,this._mode=t.mode??"enforce";let n=t.policies,s=zt(n);if(!s&&this._mode==="enforce"&&n.length===0)throw new RangeError('guardedExecution: empty `policies` in `mode: "enforce"` denies every action. Pass at least `{ effect: "allow", action: "*" }` and layer deny rules on top.');this.lints=new Ae("lints",{retainedLimit:t.lintsLimit??64}),this.mount("lints",this.lints);let o=t.actor;o==null?this._actorNode=W(null,{name:"actor"}):zt(o)?this._actorNode=F([o],([d])=>d??null,{name:"actor",initial:null}):this._actorNode=W(o,{name:"actor"});let i={mode:this._mode,name:"enforcer"};if(t.violationsLimit!=null&&(i.violationsLimit=t.violationsLimit),this.enforcer=Ft(e,t.policies,i),this.violations=this.enforcer.violations,this.mount("enforcer",this.enforcer),s&&this._mode==="enforce"){let d=n,u=d.cache;u!=null&&u.length===0&&this._fireLint("empty-policies",'`policies` Node cached an empty array in `mode: "enforce"` \u2014 every action will be denied. Add at least one allow rule.');let l=d.subscribe(h=>{for(let f of h){if(f[0]!==D)continue;let g=f[1];(g==null||g.length===0)&&this._fireLint("empty-policies",'`policies` Node emitted an empty array in `mode: "enforce"` \u2014 every action will be denied. Add at least one allow rule.')}});this.addDisposer(l)}if(this._mode==="audit"){let d=e.describe({detail:"full"});Object.values(d.nodes).some(l=>l.guard!=null)||this._fireLint("audit-no-effect",'`mode: "audit"` + target has no per-node guards \u2014 `scopedDescribeNode` filters by per-node guards only, so policy rules will not affect describe() visibility. Policies still populate the `violations` topic on writes.')}o==null&&this._fireLint("no-actor","no actor configured \u2014 `wrapper.scopedDescribe` and `scopedDescribeNode()` will return an unscoped describe (full visibility) unless a per-call actor is supplied."),this.scope=F([this._actorNode,this.enforcer.policies],([d,u])=>({actor:d??null,mode:this._mode,policiesCount:u.length}),{name:"scope",describeKind:"derived",meta:Dr("scope")}),this.add(this.scope,{name:"scope"}),this.addDisposer(K(this.scope));let a=e.describe({reactive:!0,actor:this._actorNode,reactiveName:"scopedDescribe"});this.scopedDescribe=a.node,this.add(this.scopedDescribe,{name:"scopedDescribe"}),this.addDisposer(a.dispose)}_fireLint(e,t){this._firedLintKinds.has(e)||(this._firedLintKinds.add(e),this.lints.publish({kind:e,message:t,timestamp_ns:B()}))}scopedDescribeNode(e,t){let n=e==null?this._actorNode:zt(e)?e:W(e,{name:"actor_override"}),s=this._target.describe({reactive:!0,actor:n,...t??{}});return this.addDisposer(s.dispose),{node:s.node,dispose:s.dispose}}get target(){return this._target}};function Gr(r,e){return new ut(r,e)}me();Me();ke();Ee();Ee();function zn(r){let e=[];for(let[t,n]of Object.entries(r.nodes)){if(n.status!=="errored")continue;let s={path:t,status:"errored"},o=Ie(r,t,"upstream",{});for(let i of o)if(i!==t&&r.nodes[i]?.status==="errored"){s.upstreamCause=i;break}e.push(s)}return e.sort((t,n)=>t.path<n.path?-1:t.path>n.path?1:0),{ok:e.length===0,problems:e}}function jn(r,e){if(r.ok!==e.ok||r.problems.length!==e.problems.length)return!1;for(let t=0;t<r.problems.length;t++){let n=r.problems[t],s=e.problems[t];if(n.path!==s.path||n.status!==s.status||n.upstreamCause!==s.upstreamCause)return!1}return!0}function jt(r){let e=r.describe({reactive:!0,detail:"standard",reactiveName:"graphLens.topology"}),t=e.node,n=F([t],([h])=>zn(h),{name:"graphLens.health",describeKind:"derived",equals:jn,meta:ie("lens","health")}),s=K(n),o=new Map,i=-1,a=r.observe({reactive:!0,tiers:["data"]}),d=F([a,t],([h,f])=>{let g=h,c=f;if(g!=null&&g.flushedAt_ns>i){i=g.flushedAt_ns;for(let v of g.events){if(v.type!=="data")continue;let p=v.path;if(p==null||p==="")continue;let T=o.get(p);o.set(p,{path:p,count:(T?.count??0)+1,lastUpdate_ns:g.flushedAt_ns})}}if(c!=null&&o.size>0){let v=new Set(Object.keys(c.nodes));for(let p of[...o.keys()])v.has(p)||o.delete(p)}return new Map(o)},{name:"graphLens.flow",describeKind:"derived",meta:ie("lens","flow")}),u=K(d),l=!1;return{topology:t,health:n,flow:d,dispose(){l||(l=!0,u(),s(),e.dispose())}}}Ze();it();var Ht=class extends j{view;constructor(e){super("lens"),this.view=jt(e),this.add(this.view.topology,{name:"topology"}),this.add(this.view.health,{name:"health"}),this.add(this.view.flow,{name:"flow"})}},ct=class extends j{target;lens;audit;_defaultActor;_lensSubgraph;constructor(e,t={}){super(t.name??`inspect(${e.name})`),this.target=e,this._defaultActor=t.actor,this._lensSubgraph=new Ht(e),this.lens=this._lensSubgraph.view,this.mount("lens",this._lensSubgraph),this.audit=$t(e,t.audit??{}),this.mount("audit",this.audit),this.addDisposer(()=>this.lens.dispose())}explainTarget(e,t,n){return this.target.explain(e,t,n)}complianceSnapshot(e){let t=e?.actor??this._defaultActor;return Vt(this.target,{audit:this.audit,...t!=null?{actor:t}:{},...e?.policies!=null?{policies:e.policies}:{}})}};function Cr(r,e={}){let t=new ct(r,e);return t.tagFactory("inspect",Xe(e)),t}0&&(module.exports={AuditTrailGraph,GuardedExecutionGraph,InspectGraph,PolicyGateGraph,auditTrail,complianceSnapshot,computeHealthReport,graphLens,guardedExecution,healthReportEqual,inspect,policyGate,watchTopologyTree});
1
+ "use strict";var gt=Object.defineProperty;var Bn=Object.getOwnPropertyDescriptor;var Un=Object.getOwnPropertyNames;var Wn=Object.prototype.hasOwnProperty;var L=(r,e)=>()=>(r&&(e=r(r=0)),e);var Kn=(r,e)=>{for(var t in e)gt(r,t,{get:e[t],enumerable:!0})},qn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Un(e))!Wn.call(r,s)&&s!==t&&gt(r,s,{get:()=>e[s],enumerable:!(n=Bn(e,s))||n.enumerable});return r};var Yn=r=>qn(gt({},"__esModule",{value:!0}),r);function ze(){return ve>0||Se}function Kt(){return ve>0}function we(r){ve>0?De.push(r):r()}function le(r){ve+=1;let e=!1;try{r()}catch(t){throw e=!0,t}finally{if(ve-=1,ve===0)if(e){if(!Se){let t=De.splice(0);for(let n of t)try{n()}catch{}ue.length=0,ce.length=0,_e.length=0}}else Jn()}}function Jn(){let r=!Se;r&&(Se=!0);let e=[],t=0;try{for(;ue.length>0||ce.length>0||_e.length>0||r&&De.length>0;){if(r&&De.length>0){let o=De.splice(0);for(let i of o)try{i()}catch(a){e.push(a)}continue}if(t+=1,t>1e3)throw ue.length=0,ce.length=0,_e.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let s=(ue.length>0?ue:ce.length>0?ce:_e).splice(0);for(let o of s)try{o()}catch(i){e.push(i)}}}finally{r&&(Se=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function je(r,e,t){if(e.length===0)return;if(e.length===1){let u=t(e[0][0]);if(u<3||!ze()){r(e);return}(u>=5?_e:u===4?ce:ue).push(()=>r(e));return}let n=e.length,s=n,o=n,i=n,a=0;for(;a<n&&t(e[a][0])<3;)a++;for(s=a;a<n&&t(e[a][0])===3;)a++;for(o=a;a<n&&t(e[a][0])===4;)a++;i=a;let d=ze();if(s>0){let u=e.slice(0,s);r(u)}if(o>s){let u=e.slice(s,o);d?ue.push(()=>r(u)):r(u)}if(i>o){let u=e.slice(o,i);d?ce.push(()=>r(u)):r(u)}if(n>i){let u=e.slice(i,n);d?_e.push(()=>r(u)):r(u)}}var ve,Se,ue,ce,_e,De,Ge=L(()=>{"use strict";ve=0,Se=!1,ue=[],ce=[],_e=[],De=[]});function B(){return Math.trunc(performance.now()*1e6)}function ne(){return Date.now()*1e6}var pe=L(()=>{"use strict"});function qt(r){return Array.isArray(r)?[...r]:[r]}function Xn(r,e){return r.has(e)||r.has("*")}function mt(r){let e=[];return r((s,o)=>{e.push({kind:"allow",actions:new Set(qt(s)),where:o?.where??(()=>!0)})},(s,o)=>{e.push({kind:"deny",actions:new Set(qt(s)),where:o?.where??(()=>!0)})}),(s,o)=>{let i=!1,a=!1;for(let d of e)Xn(d.actions,o)&&d.where(s)&&(d.kind==="deny"?i=!0:a=!0);return i?!1:a}}function bt(r){return mt((e,t)=>{for(let n of r){let s=n.actorType==null?null:new Set(Array.isArray(n.actorType)?n.actorType:[n.actorType]),o=n.actorId==null?null:new Set(Array.isArray(n.actorId)?n.actorId:[n.actorId]),i=Object.entries(n.claims??{}),a=d=>{if(s!==null&&!s.has(String(d.type))||o!==null&&!o.has(String(d.id??"")))return!1;for(let[u,l]of i)if(d[u]!==l)return!1;return!0};n.effect==="deny"?t(n.action,{where:a}):e(n.action,{where:a})}})}function yt(r){let e=Zn.filter(t=>r({type:t,id:""},"write"));return e.length===0?"restricted":e.includes("human")&&e.includes("llm")&&e.every(t=>t==="human"||t==="llm"||t==="system")?"both":e.length===1?e[0]:e.join("+")}var Z,Zn,fe=L(()=>{"use strict";Z=class extends Error{actor;action;nodeName;constructor(e,t){super(t??`GuardDenied: action "${String(e.action)}" denied for actor type "${String(e.actor.type)}"`),this.name="GuardDenied",this.actor=e.actor,this.action=e.action,this.nodeName=e.nodeName}get node(){return this.nodeName}};Zn=["human","llm","wallet","system"]});var Te,D,U,Y,Q,te,oe,z,H,I,he,He,Yt,Be,Jt,Xt,Ue,vt,_t,wt,We,re=L(()=>{"use strict";Te=Symbol.for("graphrefly/START"),D=Symbol.for("graphrefly/DATA"),U=Symbol.for("graphrefly/DIRTY"),Y=Symbol.for("graphrefly/RESOLVED"),Q=Symbol.for("graphrefly/INVALIDATE"),te=Symbol.for("graphrefly/PAUSE"),oe=Symbol.for("graphrefly/RESUME"),z=Symbol.for("graphrefly/TEARDOWN"),H=Symbol.for("graphrefly/COMPLETE"),I=Symbol.for("graphrefly/ERROR"),he=Object.freeze([U]),He=Object.freeze([Y]),Yt=Object.freeze([Q]),Be=Object.freeze([Te]),Jt=Object.freeze([H]),Xt=Object.freeze([z]),Ue=Object.freeze([he]),vt=Object.freeze([He]),_t=Object.freeze([Yt]),wt=Object.freeze([Jt]),We=Object.freeze([Xt])});function Qt(r,e){let t=new TextEncoder().encode(r.name);if(t.length===0||t.length>255)throw new Error(`encodeEnvelope: codec name "${r.name}" encodes to ${t.length} bytes (must be 1\u2013255)`);let n=r.version;if(!Number.isInteger(n)||n<0||n>65535)throw new Error(`encodeEnvelope: codec.version ${n} out of u16 range (expected integer 0\u201365535)`);let s=2+t.length+2+e.length;if(s>4294967295)throw new Error(`encodeEnvelope: total envelope size ${s} exceeds 2^32-1 bytes (payload ${e.length} bytes)`);let o=new Uint8Array(s),i=0;return o[i++]=Tt,o[i++]=t.length,o.set(t,i),i+=t.length,o[i++]=n>>>8&255,o[i++]=n&255,o.set(e,i),o}function en(r,e){if(r.length<Zt)throw new Error(`decodeEnvelope: bytes too short (${r.length} < ${Zt})`);let t=0,n=r[t++];if(n!==Tt)throw new Error(`decodeEnvelope: unsupported envelope version ${n} (expected ${Tt})`);let s=r[t++];if(s===0)throw new Error("decodeEnvelope: name_len must be >= 1");if(t+s+2>r.length)throw new Error(`decodeEnvelope: envelope truncated (need ${t+s+2} bytes, have ${r.length})`);let o=new TextDecoder().decode(r.subarray(t,t+s));t+=s;let i=(r[t]<<8|r[t+1])>>>0;t+=2;let a=r.subarray(t),d=e.lookupCodec(o);if(d==null)throw new Error(`decodeEnvelope: codec "${o}" not registered (envelope codec_v=${i})`);return{codec:d,codecVersion:i,payload:a}}function tn(r){r.registerCodec(Qn)}var Qn,Tt,Zt,Nt=L(()=>{"use strict";Qn={name:"json",version:1,contentType:"application/json",encode(r){let e=JSON.stringify(r);return new TextEncoder().encode(e)},decode(r,e){let t=new TextDecoder().decode(r);return JSON.parse(t)}},Tt=1,Zt=4});function Ke(r){if(r==null)return Ne;let{type:e,id:t,...n}=r;return{type:e??"system",id:t??"",...n}}var Ne,qe=L(()=>{"use strict";Ne={type:"system",id:""}});function nn(r){r.registerMessageType(Te,{tier:0,wireCrossing:!1}),r.registerMessageType(U,{tier:1,wireCrossing:!1}),r.registerMessageType(Q,{tier:1,wireCrossing:!1,metaPassthrough:!1}),r.registerMessageType(te,{tier:2,wireCrossing:!1}),r.registerMessageType(oe,{tier:2,wireCrossing:!1}),r.registerMessageType(D,{tier:3,wireCrossing:!0}),r.registerMessageType(Y,{tier:3,wireCrossing:!0}),r.registerMessageType(H,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(I,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(z,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var Ye,rn=L(()=>{"use strict";re();Ye=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=t=>{let n=this._messageTypes.get(t);return n!=null?n.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=e}registerMessageType(e,t){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:t.tier,wireCrossing:t.wireCrossing??t.tier>=3,metaPassthrough:t.metaPassthrough??!0}),this}messageTier(e){let t=this._messageTypes.get(e);return t!=null?t.tier:1}isWireCrossing(e){let t=this._messageTypes.get(e);return t!=null?t.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let t=this._messageTypes.get(e);return t!=null?t.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}}});function Ot(r){if(r===void 0)return null;if(typeof r=="number"){if(!Number.isFinite(r))throw new TypeError(`Cannot hash non-finite number: ${r}`);if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${r}. Cross-language cid parity is not guaranteed for unsafe integers.`);return r}if(typeof r=="string"||typeof r=="boolean"||r===null)return r;if(Array.isArray(r))return r.map(Ot);if(typeof r=="object"&&r!==null){let e={};for(let t of Object.keys(r).sort())e[t]=Ot(r[t]);return e}return null}function nr(r){let e=tr.encode(r),t=e.length,n=t*8,s=t+9+63&-64,o=new Uint8Array(s);o.set(e),o[t]=128;let i=new DataView(o.buffer);i.setUint32(s-4,n>>>0,!1),i.setUint32(s-8,Math.floor(n/4294967296)>>>0,!1);let a=1779033703,d=3144134277,u=1013904242,l=2773480762,h=1359893119,f=2600822924,g=528734635,c=1541459225,v=new Uint32Array(64),p=(_,b)=>_>>>b|_<<32-b;for(let _=0;_<s;_+=64){for(let O=0;O<16;O++)v[O]=i.getUint32(_+O*4,!1);for(let O=16;O<64;O++){let R=v[O-15],G=v[O-2],S=p(R,7)^p(R,18)^R>>>3,ae=p(G,17)^p(G,19)^G>>>10;v[O]=v[O-16]+S+v[O-7]+ae>>>0}let b=a,y=d,w=u,x=l,m=h,N=f,k=g,E=c;for(let O=0;O<64;O++){let R=p(m,6)^p(m,11)^p(m,25),G=m&N^~m&k,S=E+R+G+er[O]+v[O]>>>0,ae=p(b,2)^p(b,13)^p(b,22),se=b&y^b&w^y&w,Fe=ae+se>>>0;E=k,k=N,N=m,m=x+S>>>0,x=w,w=y,y=b,b=S+Fe>>>0}a=a+b>>>0,d=d+y>>>0,u=u+w>>>0,l=l+x>>>0,h=h+m>>>0,f=f+N>>>0,g=g+k>>>0,c=c+E>>>0}let T=_=>_.toString(16).padStart(8,"0");return T(a)+T(d)+T(u)+T(l)+T(h)+T(f)+T(g)+T(c)}function Ce(r){let e=Ot(r??null),t=JSON.stringify(e);return nr(t).slice(0,16)}function rr(){let r=globalThis.crypto;if(r?.randomUUID)return r.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),t=e()+e()+e()+e();return`${t.slice(0,8)}-${t.slice(8,12)}-4${t.slice(13,16)}-${(parseInt(t.slice(16,17),16)&3|8).toString(16)}${t.slice(17,20)}-${t.slice(20,32)}`}function xt(r,e,t){let n=t?.id??rr();if(r===0)return{id:n,version:0};let o=(t?.hash??Ce)(e);return{id:n,version:0,cid:o,prev:null}}function sn(r,e,t){r.version+=1,"cid"in r&&(r.prev=r.cid,r.cid=t(e))}var er,tr,kt=L(()=>{"use strict";er=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),tr=new TextEncoder});function dn(r){return{node:r,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function At(r){r.prevData=void 0,r.dirty=!1,r.involvedThisWave=!1,r.dataBatch.length=0,r.terminal=void 0}function Je(r){return r.length===0?r:typeof r[0]=="symbol"?[r]:r}function xe(r,e,t){let n=un(r)?r:[],s=typeof r=="function"?r:typeof e=="function"?e:void 0,o={};return un(r)?o=(Et(e)?e:t)??{}:Et(r)?o=r:o=(Et(e)?e:t)??{},new $(n,s,o)}var on,an,sr,or,Oe,$,un,Et,ge=L(()=>{"use strict";Nt();qe();Ge();pe();rn();fe();re();kt();on=()=>{},an=100;sr=(r,e,t,n)=>{t.direction==="down-in"&&r._onDepMessage(t.depIndex,e)},or=(r,e,t,n)=>{let s=r;if(s._status==="completed"||s._status==="errored")return;let o=s._cached,i=o===void 0?[Be]:[Be,[D,o]];s._status==="dirty"&&i.push(he),je(e,i,s._config.tierOf)},Oe=new Ye({onMessage:sr,onSubscribe:or});nn(Oe);tn(Oe);$=class r{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,t,n){this._config=n.config??Oe,this._config.onMessage,this._optsName=n.name,this._describeKind=n.describeKind,this._equals=n.equals??Object.is,this._resubscribable=n.resubscribable??!1,this._resetOnTeardown=n.resetOnTeardown??!1,this._autoComplete=n.completeWhenDepsComplete??!0,this._autoError=n.errorWhenDepsError??!0,this._pausable=n.pausable??!0,this._guard=n.guard,this._fn=t,this._partial=n.partial??!1,this._cached=n.initial!==void 0?n.initial:void 0,this._status=e.length===0&&t==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=n.versioningHash??this._config.defaultHashFn??Ce;let s=n.versioning??this._config.defaultVersioning;this._versioningLevel=s,this._versioning=s!=null?xt(s,this._cached===void 0?void 0:this._cached,{id:n.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(dn);let o={};for(let[a,d]of Object.entries(n.meta??{})){let u={initial:d,name:`${n.name??"node"}:meta:${a}`,describeKind:"state",config:this._config};n.guard!=null&&(u.guard=n.guard),o[a]=new r([],void 0,u)}Object.freeze(o),this.meta=o,this._hasMeta=Object.keys(o).length>0;let i=this;this._actions={emit(a){i._emit([[D,a]])},down(a){i._emit(Je(a))},up(a){i._emitUp(Je(a))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,t){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let n=this._versioningLevel;if(n!=null&&e<=n)return;let s=t?.hash??this._hashFn;s!==this._hashFn&&(this._hashFn=s);let o=this._cached===void 0?void 0:this._cached,i=this._versioning,a=i?.id??t?.id,d=i?.version??0,u=xt(e,o,{id:a,hash:s});u.version=d,this._versioning=u,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let t=Ke(e);if(this._guard!=null&&!this._guard(t,"observe"))return!1;if(this._extraGuards!=null){for(let n of this._extraGuards)if(!n(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,n=e?.actor!=null;if(!t&&!n)return;let s=Ke(e?.actor),o=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(s,o))throw new Z({actor:s,action:o,nodeName:this.name});if(this._extraGuards!=null){for(let i of this._extraGuards)if(!i(s,o))throw new Z({actor:s,action:o,nodeName:this.name})}this._lastMutation={actor:s,timestamp_ns:ne()}}down(e,t){let n=Je(e);n.length!==0&&(this._checkGuard(t),this._emit(n))}emit(e,t){this._checkGuard(t),this._emit([[D,e]])}up(e,t){if(this._deps.length===0)return;let n=Je(e);if(n.length===0)return;this._checkGuard(t);let s=t??{internal:!0};this._validateUpTiers(n);for(let o of this._deps)o.node.up?.(n,s)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let t of this._deps)t.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let t=this._config.tierOf;for(let n of e){let s=t(n[0]);if(s===3||s===4)throw new Error(`Node "${this.name}": tier-${s} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,t){if(t!=null&&this._guard!=null){let d=Ke(t);if(!this._guard(d,"observe"))throw new Z({actor:d,action:"observe",nodeName:this.name})}let s=this._isTerminal&&this._resubscribable;if(s){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let d of this._deps)At(d);if(this._partial===!1){for(let d of this._deps)if(d.prevData!==void 0||d.dataBatch.length!==0||d.terminal!==void 0||d.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let o;try{o=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:s},this._actions)}catch(d){throw this._sinkCount-=1,d}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let i=this._isTerminal;if(this._sinkCount===1&&!i)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof o=="function")try{o()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let a=!1;return()=>{a||(a=!0,this._sinkCount-=1,this._removeSink(e),typeof o=="function"&&o(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[t]=this._sinks;this._sinks=t}else this._sinks.size===0&&(this._sinks=null)}_activate(){if(this._deps.length===0){this._fn&&this._execFn();return}this._dirtyDepCount=0;let e=this._deps.length,t=0;try{for(let n=0;n<e;n++){let s=n,o=this._deps[n];o.unsub=on,o.unsub=o.node.subscribe(i=>{if(o.unsub===null)return;let a=this._config.tierOf,d=!1;for(let u of i)a(u[0])>=3&&(d=!0),this._config.onMessage(this,u,{direction:"down-in",depIndex:s},this._actions);d&&this._maybeRunFnOnSettlement()}),t++}}catch(n){this._deps[t].unsub=null;for(let s=0;s<t;s++){let o=this._deps[s];if(o.unsub!=null){let i=o.unsub;o.unsub=null;try{i()}catch{}At(o)}}throw this._dirtyDepCount=0,n}}_addDep(e){for(let s=0;s<this._deps.length;s++)if(this._deps[s].node===e)return s;let t=this._deps.length,n=dn(e);if(this._deps.push(n),this._sinks==null)return t;n.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Ue),n.unsub=on;try{n.unsub=e.subscribe(s=>{if(n.unsub===null)return;let o=this._config.tierOf,i=!1;for(let a of s)o(a[0])>=3&&(i=!0),this._config.onMessage(this,a,{direction:"down-in",depIndex:t},this._actions);i&&this._maybeRunFnOnSettlement()})}catch(s){throw n.unsub=null,this._deps.pop(),this._dirtyDepCount--,s}return t}_deactivate(e=!1){let t=this._cleanup;if(this._cleanup=void 0,typeof t=="function")try{t()}catch(n){this._emit([[I,this._wrapFnError("cleanup threw",n)]])}else if(t!=null&&typeof t=="object"){let n=t.deactivate;if(typeof n=="function")try{n()}catch(s){this._emit([[I,this._wrapFnError("cleanup.deactivate threw",s)]])}}for(let n of this._deps){if(n.unsub!=null){let s=n.unsub;n.unsub=null;try{s()}catch{}}At(n)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,t){let n=this._deps[e],s=t[0];if(this._inspectorHooks!=null){let o={kind:"dep_message",depIndex:e,message:t};for(let i of this._inspectorHooks)i(o)}if(s!==Te){if(s===U){this._depDirtied(n);return}if(s===Q){if(this._depInvalidated(n),this._cached===void 0)return;this._emit(_t);return}if(s===te||s===oe){this._emit([t]);return}if(s===z){this._emit(We);return}if(s===D)this._depSettledAsData(n,t[1]);else if(s===Y)this._depSettledAsResolved(n);else if(s===H)this._depSettledAsTerminal(n,!0);else if(s===I)this._depSettledAsTerminal(n,t[1]);else{this._emit([t]);return}if(!this._fn){(s===D||s===Y)&&this._emit([t]),(s===H||s===I)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Ue))}_depSettledAsData(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(t),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=t,e.involvedThisWave=!0,this._hasNewTerminal=!0}_depInvalidated(e){e.prevData=void 0,e.terminal=void 0,e.dataBatch.length=0,e.dirty?e.involvedThisWave=!1:(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++)}_maybeRunFnOnSettlement(){if(!(this._isTerminal&&!this._resubscribable)&&!(this._dirtyDepCount>0)){if(!this._partial&&!this._hasCalledFnOnce)for(let e=0;e<this._deps.length;e++){let t=this._deps[e];if(t.dataBatch.length===0&&t.prevData===void 0&&t.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(vt),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(t=>t.terminal!==void 0&&t.terminal!==!0);if(e!=null){this._autoError&&this._emit([[I,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(wt)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(i){this._emit([[I,this._wrapFnError("cleanup threw",i)]]);return}}else if(e!=null&&typeof e=="object"){let i=e.beforeRun;if(typeof i=="function"){e.beforeRun=void 0;try{i()}catch(a){this._emit([[I,this._wrapFnError("cleanup.beforeRun threw",a)]]);return}}}let t=this._deps.map(i=>i.involvedThisWave?i.dataBatch.length>0?[...i.dataBatch]:[]:void 0),n=this._deps.map(i=>i.prevData);for(let i=0;i<this._deps.length;i++){let a=t[i];a!=null&&a.length>0&&(this._deps[i].prevData=a[a.length-1])}let s=this._deps.map(i=>i.terminal),o={prevData:n,terminalDeps:s,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let i={kind:"run",batchData:t,prevData:n};for(let a of this._inspectorHooks)a(i)}this._isExecutingFn=!0;try{let i=this._fn(t,this._actions,o);if(typeof i=="function")this._cleanup=i;else if(i!=null&&typeof i=="object"){let a=i;(typeof a.beforeRun=="function"||typeof a.deactivate=="function"||typeof a.invalidate=="function")&&(this._cleanup=i)}}catch(i){this._emit([[I,this._wrapFnError("fn threw",i)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>an?(this._rerunDepth=0,this._emit([[I,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${an} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,t){let n=t instanceof Error?t.message:String(t);return new Error(`Node "${this.name}": ${e}: ${n}`,{cause:t})}_frameBatch(e){let t=this._config.tierOf;if(e.length===1)return t(e[0][0])===3&&this._status!=="dirty"?[he,e[0]]:e;let n=!0,s=!1,o=!1,i=-1;for(let d of e){let u=t(d[0]);u<i&&(n=!1),u===3&&(s=!0),d[0]===U&&(o=!0),i=u}let a=e;if(!n){let d=e.map((u,l)=>({m:u,i:l,tier:t(u[0])}));d.sort((u,l)=>u.tier-l.tier||u.i-l.i),a=d.map(u=>u.m)}if(s&&!o&&this._status!=="dirty"){let d=0;for(;d<a.length&&t(a[d][0])===0;)d++;return d===0?[he,...a]:[...a.slice(0,d),he,...a.slice(d)]}return a}_emit(e){if(e.length===0)return;for(let a=0;a<e.length;a++){let d=e[a];if(d[0]===I&&d[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let t=e;if(this._isTerminal&&!this._resubscribable){let a=e.filter(d=>d[0]===z||d[0]===Q);if(a.length===0)return;t=a}t=this._frameBatch(t);let s=null;for(let a=0;a<t.length;a++){let d=t[a],u=d[0];if(u!==te&&u!==oe){s?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${u===te?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let l=!0;if(this._pausable!==!1){let h=d[1];if(u===te)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(h),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(h))l=!1;else if(this._pauseLocks.delete(h),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let f=this._pauseBuffer;this._pauseBuffer=[],this._emit(f)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}l?s?.push(d):s==null&&(s=t.slice(0,a))}if(s!=null){if(s.length===0)return;t=s}if(this._hasMeta&&t.some(a=>a[0]===z))for(let a of Object.keys(this.meta))try{this.meta[a]._emit(We)}catch{}let{finalMessages:o,equalsError:i}=this._updateState(t);if(o.length>0&&this._config.inspectorEnabled){let a=this._config.globalInspector;if(a!=null)try{a({kind:"emit",node:this,messages:o})}catch{}}if(o.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let a=this._config.tierOf,d=[];for(let u of o)a(u[0])===3?this._pauseBuffer.push(u):d.push(u);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(o);i!=null&&this._emit([[I,i]])}_updateState(e){let t=this._config.tierOf,n,s,o=-1,i=0;for(let l of e)t(l[0])===3&&i++;let a=i<=1,d=-1;if(this._versioning!=null&&i>1){for(let l=e.length-1;l>=0;l--)if(e[l][0]===D){d=l;break}}for(let l=0;l<e.length;l++){let h=e[l],f=h[0];if(f===D){if(h.length>=2){let g=!1;if(a&&this._cached!==void 0)try{g=this._equals(this._cached,h[1])}catch(c){s=this._wrapFnError("equals threw",c),o=l;break}if(g){n==null&&(n=e.slice(0,l)),n.push(He),this._status="resolved";continue}this._cached=h[1],this._versioning!=null&&(d<0||l===d)&&sn(this._versioning,h[1],this._hashFn)}this._status="settled",n?.push(h)}else if(n?.push(h),f===U)this._status="dirty";else if(f===Y)this._status="resolved";else if(f===H){this._status="completed";{let g=this._config.rigorRecorder;if(g!=null)try{g.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(f===I){this._status="errored";{let g=this._config.rigorRecorder;if(g!=null)try{g.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(f===Q){if(this._cached!==void 0){let c=this._config.rigorRecorder;if(c!=null)try{c.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let g=this._cleanup;if(typeof g=="function"){this._cleanup=void 0;try{g()}catch{}}else if(g!=null&&typeof g=="object"){let c=g.invalidate;if(typeof c=="function")try{c()}catch{}}}else f===z&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let u=o>=0?n??e.slice(0,o):n??e;return s!=null?{finalMessages:u,equalsError:s}:{finalMessages:u}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let t=[...this._sinks];for(let n of t)n(e)};_dispatchOrAccumulate(e){if(Kt()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],we(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}je(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let t=this._frameBatch(e);je(this._deliverToSinks,t,this._config.tierOf)}},un=r=>Array.isArray(r),Et=r=>typeof r=="object"&&r!=null&&!Array.isArray(r)});function St(r,e){if(e!=null&&e.length>0)return new Set(e);switch(r){case"standard":return new Set(["type","status","value","deps","meta","v"]);case"full":return null;case"spec":return new Set(["type","deps","meta","value"]);default:return new Set(["type","deps"])}}function ir(r){return r._describeKind!=null?r._describeKind:r._deps.length>0?"derived":r._fn!=null?"producer":"state"}function Xe(r){let e=new WeakSet,t={};for(let[n,s]of cn(r))t[n]=Rt(s,e);return t}function Rt(r,e){if(r==null)return r;let t=typeof r;if(t==="boolean"||t==="number"||t==="string")return r;if(t==="function")return"<function>";if(Array.isArray(r))return e.has(r)?"<cycle>":(e.add(r),r.map(n=>Rt(n,e)));if(t==="object"){let n=r;if(e.has(n))return"<cycle>";e.add(n);try{if(typeof n.subscribe=="function"&&"cache"in n)return"<Node>"}catch{return"<unserializable>"}let s={};for(let[o,i]of cn(n))s[o]=Rt(i,e);return s}return"<unserializable>"}function cn(r){let e=[],t;try{t=Object.keys(r)}catch{return e}for(let n of t)try{e.push([n,r[n]])}catch{e.push([n,"<unserializable>"])}return e}function ar(r){let e={};for(let[t,n]of Object.entries(r.meta))try{e[t]=n.cache}catch{}return e}function Dt(r,e,t){let n=e==null,s=!n&&e!=null?[...e].filter(l=>l.startsWith("meta.")).map(l=>l.slice(5)):null,o=n||e.has("meta")||s!=null&&s.length>0,i="state",a=[];r instanceof $&&(i=ir(r),a=r._deps.map(l=>l.node.name??""));let d={type:i,deps:a};(n||e.has("status"))&&(d.status=r.status);let u=r instanceof $?r._guard:void 0;if(o){let l={...ar(r)};if(u!=null&&l.access===void 0&&(l.access=yt(u)),s!=null&&s.length>0&&!e.has("meta")){let h={};for(let f of s)f in l&&(h[f]=l[f]);d.meta=h}else d.meta=l}if(r.name!=null&&(d.name=r.name),(n||e.has("value"))&&(!t||i==="state")){r.status==="sentinel"&&(d.sentinel=!0);try{d.value=r.cache}catch{}}if((n||e.has("v"))&&r.v!=null){let l={id:r.v.id,version:r.v.version};"cid"in r.v&&(l.cid=r.v.cid,l.prev=r.v.prev),d.v=l}return(n||e.has("guard"))&&u!=null&&(d.guard=yt(u)),(n||e.has("lastMutation"))&&r.lastMutation!=null&&(d.lastMutation=r.lastMutation),d}var Ze=L(()=>{"use strict";fe();ge()});function W(r,e){return xe([],{...e,initial:r})}function Qe(r,e){return xe((n,s,o)=>r(s,o)??void 0,{describeKind:"producer",...e})}function F(r,e,t){return xe(r,(s,o,i)=>{let a=s.map((d,u)=>d!=null&&d.length>0?d.at(-1):i.prevData[u]);o.emit(e(a,i))},{describeKind:"derived",...t})}var me=L(()=>{"use strict";ge()});function ie(r,e,t){return{[r]:!0,[`${r}_type`]:e,...t??{}}}var Me=L(()=>{"use strict"});function K(r){return r.subscribe(()=>{})}var ln=L(()=>{"use strict"});var ke=L(()=>{"use strict";ln()});function pn(r){let e=new WeakSet,t=new WeakSet,n=[r],s=0;for(;n.length>0;){let o=n.pop();s+=cr(o,e,t,n)}return s}function cr(r,e,t,n){if(r==null)return 0;switch(typeof r){case"number":return V.number;case"boolean":return V.boolean;case"string":return V.string+r.length*2;case"bigint":return V.bigint+lr(r);case"symbol":return V.symbol;case"function":return e.has(r)?0:(e.add(r),V.function);case"undefined":return 0}let o=r;if(e.has(o))return 0;e.add(o);let i=o[ur];if(typeof i=="function")try{let u=i.call(o);if(typeof u=="number"&&Number.isFinite(u))return u}catch{}if(o instanceof Date)return V.date;if(o instanceof RegExp)return V.regexp+o.source.length*2;if(o instanceof Error){let u=o.message?o.message.length*2:0,l=o.stack?o.stack.length*2:0;return V.error+u+l}if(typeof URL<"u"&&o instanceof URL)return V.url+o.href.length*2;if(typeof Promise<"u"&&o instanceof Promise)return V.promise;if(o instanceof WeakMap)return V.weakmap;if(o instanceof WeakSet)return V.weakset;if(o instanceof Map){let u=V.map;for(let[l,h]of o)u+=V.mapEntry,n.push(l),n.push(h);return u}if(o instanceof Set){let u=V.set;for(let l of o)u+=V.setEntry,n.push(l);return u}if(Array.isArray(o)){let u=V.array+o.length*8;for(let l of o)n.push(l);return u}if(o instanceof ArrayBuffer)return t.has(o)?0:(t.add(o),o.byteLength);if(ArrayBuffer.isView(o)){let u=o;return t.has(u.buffer)?48:(t.add(u.buffer),u.buffer.byteLength+48)}let a=V.object,d=Object.keys(o);for(let u of d){a+=V.string+u.length*2;try{n.push(o[u])}catch{}}return a}function lr(r){let e=r<0n?-r:r;if(e===0n)return 0;let t=e.toString(2).length;return Math.ceil(t/32)*8}var V,ur,fn=L(()=>{"use strict";V={object:56,array:64,string:40,number:8,boolean:4,null:0,undefined:0,symbol:40,bigint:16,function:120,map:72,set:72,mapEntry:40,setEntry:24,date:24,regexp:48,error:64,url:80,promise:48,weakmap:40,weakset:40},ur=Symbol.for("sizeof")});function hn(r,e,t,n={}){let s=e in r.nodes,o=t in r.nodes;if(!s)return tt(e,t,"no-such-from");if(!o)return tt(e,t,"no-such-to");let i=n.maxDepth;if(i!=null&&(!Number.isInteger(i)||i<0))throw new Error("explainPath: maxDepth must be an integer >= 0");if(e===t){if(n.findCycle===!0){let u=pr(r,e,n);if(u!=null)return u}let d=nt(e,r.nodes[e],0,n);return rt(e,t,[d])}if(i===0)return tt(e,t,"no-path");let a=gn(r,e,t,i);return a.found?rt(e,t,mn(r,a.pathOrder,n)):tt(e,t,a.truncated?"max-depth-exceeded":"no-path")}function gn(r,e,t,n){let s=new Map,o=[{path:t,depth:0}],i=new Set([t]),a=0,d=!1;for(;a<o.length;){let h=o[a++];if(h.path===e)break;if(n!=null&&h.depth>=n){let v=r.nodes[h.path];v?.deps&&v.deps.length>0&&(d=!0);continue}let f=r.nodes[h.path];if(f==null)continue;let g=f.deps??[],c=new Map;for(let v=0;v<g.length;v++){let p=g[v];if(!p)continue;let T=c.get(p);T==null&&(T=[],c.set(p,T)),T.push(v)}for(let[v,p]of c)i.has(v)||(i.add(v),s.set(v,{from:h.path,depIndices:p}),o.push({path:v,depth:h.depth+1}))}if(!s.has(e))return{found:!1,pathOrder:[],truncated:d};let u=[{path:e}],l=e;for(;l!==t;){let h=s.get(l);if(h==null)return{found:!1,pathOrder:[],truncated:!1};u[u.length-1].depIndices=h.depIndices,u.push({path:h.from}),l=h.from}return{found:!0,pathOrder:u,truncated:!1}}function pr(r,e,t){let n=r.nodes[e];if(n==null)return null;let s=n.deps??[],o=[];for(let a=0;a<s.length;a++)s[a]===e&&o.push(a);if(o.length>0){let a=nt(e,n,0,t);a.dep_index=o[0];let d=nt(e,n,1,t);return rt(e,e,[a,d])}let i=null;for(let a=0;a<s.length;a++){let d=s[a];if(!d||d===e)continue;let u=gn(r,d,e,t.maxDepth);u.found&&(i==null||u.pathOrder.length<i.pathOrder.length)&&(i=u,i={found:!0,pathOrder:[{path:e,depIndices:[a]},...u.pathOrder],truncated:!1})}return i==null?null:rt(e,e,mn(r,i.pathOrder,t))}function mn(r,e,t){return e.map((n,s)=>{let o=r.nodes[n.path],i=nt(n.path,o,s,t);return n.depIndices!=null&&n.depIndices.length>0&&(i.dep_index=n.depIndices[0],n.depIndices.length>1&&(i.dep_indices=[...n.depIndices])),i})}function nt(r,e,t,n){let s={path:r,type:e.type,hop:t};e.status!==void 0&&(s.status=e.status),"value"in e&&(s.value=e.value),e.v!=null&&(s.v=e.v);let o=n.annotations?.get(r)??e.annotation;o!=null&&(s.annotation=o);let i=n.lastMutations?.get(r)??e.lastMutation;return i!=null&&(s.lastMutation=i),s}function rt(r,e,t){return bn(r,e,!0,"ok",t)}function tt(r,e,t){return bn(r,e,!1,t,[])}function bn(r,e,t,n,s){let o=fr(r,e,t,n,s);return{from:r,to:e,found:t,reason:n,steps:s,text:o,toJSON(){return{from:r,to:e,found:t,reason:n,steps:s}}}}function fr(r,e,t,n,s){if(!t)switch(n){case"no-such-from":return`explainPath: no node named "${r}"`;case"no-such-to":return`explainPath: no node named "${e}"`;case"max-depth-exceeded":return`explainPath: no path from "${r}" to "${e}" within maxDepth`;default:return`explainPath: no path from "${r}" to "${e}"`}let o=[`Causal path: ${r} \u2192 ${e} (${s.length} step(s))`];for(let i of s){let d=` ${i.hop===0?"\xB7":"\u2193"} ${i.path} (${i.type}${i.status?`/${i.status}`:""})`;if(o.push(d),"value"in i&&o.push(` value: ${hr(i.value)}`),i.annotation!=null&&o.push(` annotation: ${i.annotation}`),i.lastMutation!=null){let u=i.lastMutation.actor;o.push(` actor: ${u.type}${u.id?`:${u.id}`:""}`)}}return o.join(`
2
+ `)}function hr(r){if(r===void 0)return"<sentinel>";if(r===null)return"null";if(typeof r=="string")return JSON.stringify(r);if(typeof r=="number"||typeof r=="boolean"||typeof r=="bigint")return String(r);try{let e=JSON.stringify(r);return e.length>80?`${e.slice(0,77)}...`:e}catch{return String(r)}}var yn=L(()=>{"use strict"});function Ct(r,e){if(Object.is(r,e))return!0;if(r==null||e==null||typeof r!="object"||typeof e!="object")return!1;if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let o=0;o<r.length;o++)if(!Ct(r[o],e[o]))return!1;return!0}if(Array.isArray(e))return!1;let t=Object.keys(r),n=Object.keys(e);if(t.length!==n.length)return!1;let s=new Set(n);for(let o of t)if(!s.has(o)||!Ct(r[o],e[o]))return!1;return!0}function vn(r,e){return`${r}\0${e}`}function Mt(r,e){let t=[],n=new Set(r.subgraphs),s=new Set(e.subgraphs),o=[];for(let p of s)n.has(p)||o.push(p);o.sort();for(let p of o)t.push({type:"subgraph-mounted",path:p});let i=new Set(Object.keys(r.nodes)),a=new Set(Object.keys(e.nodes)),d=[];for(let p of a)i.has(p)||d.push(p);d.sort();for(let p of d)t.push({type:"node-added",path:p,node:{...e.nodes[p]}});let u=[];for(let p of a){if(!i.has(p))continue;let T=r.nodes[p]?.meta,_=e.nodes[p]?.meta;T==null&&_==null||Ct(T??{},_??{})||u.push(p)}u.sort();for(let p of u)t.push({type:"node-meta-changed",path:p,prevMeta:r.nodes[p]?.meta??{},nextMeta:e.nodes[p]?.meta??{}});let l=new Map;for(let p of r.edges)l.set(vn(p.from,p.to),p);let h=new Map;for(let p of e.edges)h.set(vn(p.from,p.to),p);let f=[];for(let[p,T]of h)l.has(p)||f.push(T);f.sort((p,T)=>p.from<T.from?-1:p.from>T.from?1:p.to<T.to?-1:p.to>T.to?1:0);for(let p of f)t.push({type:"edge-added",from:p.from,to:p.to});let g=[];for(let[p,T]of l)h.has(p)||g.push(T);g.sort((p,T)=>p.from<T.from?-1:p.from>T.from?1:p.to<T.to?-1:p.to>T.to?1:0);for(let p of g)t.push({type:"edge-removed",from:p.from,to:p.to});let c=[];for(let p of i)a.has(p)||c.push(p);c.sort();for(let p of c)t.push({type:"node-removed",path:p});let v=[];for(let p of n)s.has(p)||v.push(p);v.sort();for(let p of v)t.push({type:"subgraph-unmounted",path:p});return{events:t,flushedAt_ns:B()}}var _n=L(()=>{"use strict";pe()});var st,wn=L(()=>{"use strict";st=class{_timer;_gen=0;start(e,t){this.cancel(),this._gen+=1;let n=this._gen;this._timer=setTimeout(()=>{this._timer=void 0,n===this._gen&&t()},e)}cancel(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}get pending(){return this._timer!==void 0}}});var Le,Tn=L(()=>{"use strict";Le=class{constructor(e){this.capacity=e;if(!Number.isInteger(e)||e<=0)throw new Error(`RingBuffer capacity must be a positive integer (got ${e})`);this.buf=new Array(e)}buf;head=0;_size=0;get size(){return this._size}get maxSize(){return this.capacity}push(e){let t=(this.head+this._size)%this.capacity;this.buf[t]=e,this._size<this.capacity?this._size++:this.head=(this.head+1)%this.capacity}shift(){if(this._size===0)return;let e=this.buf[this.head];return this.buf[this.head]=void 0,this.head=(this.head+1)%this.capacity,this._size--,e}at(e){if(this._size===0)return;let t=e<0?this._size+e:e;if(!(t<0||t>=this._size))return this.buf[(this.head+t)%this.capacity]}toArray(){let e=new Array(this._size);for(let t=0;t<this._size;t++)e[t]=this.buf[(this.head+t)%this.capacity];return e}clear(){for(let e=0;e<this._size;e++)this.buf[(this.head+e)%this.capacity]=void 0;this.head=0,this._size=0}}});function Nn(r,e){let t=e?.topN??10,n=r.describe({detail:"standard"}),s=[],o=r._collectObserveTargets;typeof o=="function"&&o.call(r,"",s);let i=new Map;for(let[f,g]of s)i.set(f,g);let a=[];for(let[f,g]of Object.entries(n.nodes)){let c=i.get(f),v=c instanceof $?c:null,p=v?pn(v.cache):0,T=v?v._sinkCount:0,_=g.deps?.length??0,b=g.type==="effect"&&T===0,y=T===0?g.type==="effect"?"orphan-effect":g.type==="derived"?"idle-derived":g.type==="producer"?"idle-producer":null:null;a.push({path:f,type:g.type,status:g.status??"unknown",valueSizeBytes:p,subscriberCount:T,depCount:_,isOrphanEffect:b,orphanKind:y})}let d=a.reduce((f,g)=>f+g.valueSizeBytes,0),u=(f,g)=>[...a].sort(g??((c,v)=>v[f]-c[f])).slice(0,t),l=a.filter(f=>f.orphanKind!=null),h=a.filter(f=>f.isOrphanEffect);return{nodeCount:a.length,edgeCount:n.edges.length,subgraphCount:n.subgraphs.length,nodes:a,totalValueSizeBytes:d,hotspots:{byValueSize:u("valueSizeBytes"),bySubscriberCount:u("subscriberCount"),byDepCount:u("depCount")},orphans:l,orphanEffects:h}}var On=L(()=>{"use strict";ge();fn()});function xn(r,e){let t=Math.max(16,r.size*4),n=0;for(;r.size>0;){if(n++>=t){console.error(`[Graph "${e}".destroy] disposer drain exceeded cap (${t}); ${r.size} disposer(s) discarded`),r.clear();return}let s=r.values().next();if(s.done)return;let o=s.value;r.delete(o);try{o()}catch(i){console.error(`[Graph "${e}".destroy] disposer threw:`,i)}}}function Sn(r){return r!=null&&typeof r=="object"&&"cache"in r&&typeof r.subscribe=="function"&&typeof r.down=="function"}function gr(r){if(r!=null)return Sn(r)?r.cache:r}function ye(r){return r!=null&&typeof r=="object"&&"cache"in r&&typeof r.subscribe=="function"&&typeof r.down=="function"}function de(r){return ye(r)?r.cache??"":r}function kn(r){return ye(r)?r.cache??0:r}function An(r){return ye(r)?r.cache??!1:r}function mr(r){let e=[];for(let t of Object.keys(r).sort()){let n=r[t].v;n!=null&&e.push(`${t} ${n.id} ${n.version}`)}return e.join(`
3
+ `)}function En(r){if(r.version!==be)throw new Error(`unsupported snapshot version ${String(r.version)} (expected ${be})`);for(let e of["name","nodes","edges","subgraphs"])if(!(e in r))throw new Error(`snapshot missing required key "${e}"`);if(typeof r.name!="string")throw new TypeError("snapshot 'name' must be a string");if(typeof r.nodes!="object"||r.nodes===null||Array.isArray(r.nodes))throw new TypeError("snapshot 'nodes' must be an object");if(!Array.isArray(r.edges))throw new TypeError("snapshot 'edges' must be an array");if(!Array.isArray(r.subgraphs))throw new TypeError("snapshot 'subgraphs' must be an array")}function br(r,e){let t=new WeakMap,n=(s,o)=>{if(Object.is(s,o))return!0;if(s==null||o==null||typeof s!="object"||typeof o!="object")return!1;let i=t.get(s);if(i==null&&(i=new WeakSet,t.set(s,i)),i.has(o))return!0;i.add(o);let a=s.constructor,d=o.constructor;if(a!==d)return!1;if(s instanceof Date)return s.getTime()===o.getTime();if(s instanceof RegExp)return s.source===o.source&&s.flags===o.flags;if(Array.isArray(s)){let f=o;if(s.length!==f.length)return!1;for(let g=0;g<s.length;g++)if(!n(s[g],f[g]))return!1;return!0}if(s instanceof Map){let f=o;if(s.size!==f.size)return!1;for(let[g,c]of s)if(!f.has(g)||!n(c,f.get(g)))return!1;return!0}if(s instanceof Set){let f=o;if(s.size!==f.size)return!1;for(let g of s){let c=!1;for(let v of f)if(n(g,v)){c=!0;break}if(!c)return!1}return!0}if(ArrayBuffer.isView(s)){let f=s,g=o;if(f.length!==g.length)return!1;for(let c=0;c<f.length;c++)if(f[c]!==g[c])return!1;return!0}let u=Object.keys(s),l=Object.keys(o);if(u.length!==l.length)return!1;let h=new Set(l);for(let f of u)if(!h.has(f)||!n(s[f],o[f]))return!1;return!0};return n(r,e)}function yr(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ot(r){let e="^";for(let t=0;t<r.length;t+=1){let n=r[t];if(n==="*"){e+=".*";continue}if(n==="?"){e+=".";continue}if(n==="["){let s=r.indexOf("]",t+1);if(s<=t+1){e+="\\[";continue}let o=r.slice(t+1,s);o.startsWith("!")&&(o=`^${o.slice(1)}`),o=o.replace(/\\/g,"\\\\"),e+=`[${o}]`,t=s;continue}e+=yr(n)}return e+="$",new RegExp(e)}function Pt(r){if(typeof r=="string")return JSON.stringify(r);if(typeof r=="number"||typeof r=="boolean"||r==null)return String(r);try{return JSON.stringify(r)}catch{return"[unserializable]"}}function wr(r){return r==="none"?_r:r==="ansi"||r==null?vr:{data:r.data??"",dirty:r.dirty??"",resolved:r.resolved??"",invalidate:r.invalidate??"",pause:r.pause??"",resume:r.resume??"",complete:r.complete??"",error:r.error??"",teardown:r.teardown??"",derived:r.derived??"",path:r.path??"",reset:r.reset??""}}function Rn(r){if(r==null)return{};let e=r.detail;return e==="full"?{...r,structured:r.structured??!0,timeline:r.timeline??!0,causal:r.causal??!0,derived:r.derived??!0}:e==="minimal"?{...r,structured:r.structured??!0}:r.format==="stage-log"?{...r,structured:r.structured??!0,timeline:r.timeline??!0}:r}function Tr(r,e,t){for(let n=0;n<r.length;n++){let s=r.charCodeAt(n);if(s<32||s===127)throw new Error(`Graph "${e}": ${t} "${r}" must not contain control character (U+${s.toString(16).padStart(4,"0").toUpperCase()} at index ${n})`)}}function Lt(r,e,t){if(r==="")throw new Error(`Graph "${e}": ${t} name must be non-empty`);if(r.includes(P))throw new Error(`Graph "${e}": ${t} "${r}" must not contain '${P}' (path separator)`);if(r===ee)throw new Error(`Graph "${e}": ${t} name "${ee}" is reserved for meta companion paths`);Tr(r,e,t)}function Nr(r,e){if(r==="")throw new Error(`Graph "${e}": resolve path must be non-empty`);let t=r.split(P);for(let n of t)if(n==="")throw new Error(`Graph "${e}": resolve path has empty segment`);return t}function Or(r,e){let t=!1;for(let s of r)if(!e.isMetaPassthrough(s[0])){t=!0;break}return t?r.filter(s=>e.isMetaPassthrough(s[0])):r}function Dn(r){for(let e of r._mounts.values())Dn(e);for(let e of r._nodes.values())try{e.down([[z]],{internal:!0})}catch{}}function Gn(r,e){let t=j.diff(r,e),n={};for(let s of t.nodesAdded){let o=e.nodes[s];o!=null&&(n[s]=o)}return{...t,nodesAddedFull:n}}function Ie(r,e,t,n={}){let s={paths:[],depths:new Map,truncated:!1};if(!e)return n.withDetail?s:[];if(!n.both&&t!=="upstream"&&t!=="downstream")throw new Error('reachable: direction must be "upstream" or "downstream"');let o=n.maxDepth;if(o!=null&&(!Number.isInteger(o)||o<0))throw new Error("reachable: maxDepth must be an integer >= 0");if(o===0)return n.withDetail?s:[];let i=new Map,a=new Map,d=new Map,u=new Map,l=new Set;for(let[b,y]of Object.entries(r.nodes)){if(!b)continue;l.add(b);let w=y.deps??[];i.set(b,w);for(let x of w)x&&(l.add(x),a.has(x)||a.set(x,new Set),a.get(x).add(b))}for(let b of r.edges){if(b==null||typeof b!="object")continue;let y=typeof b.from=="string"?b.from:"",w=typeof b.to=="string"?b.to:"";!y||!w||(l.add(y),l.add(w),u.has(y)||u.set(y,new Set),u.get(y).add(w),d.has(w)||d.set(w,new Set),d.get(w).add(y))}if(!l.has(e))return n.withDetail?s:[];let h=n.both===!0,f=b=>{if(h){let m=i.get(b)??[],N=d.get(b),k=a.get(b),E=u.get(b),O=[...m];return N&&O.push(...N),k&&O.push(...k),E&&O.push(...E),O}if(t==="upstream"){let m=i.get(b)??[],N=d.get(b);return N?[...m,...N]:m}let y=a.get(b),w=u.get(b),x=y?[...y]:[];return w&&x.push(...w),x},g=new Set([e]),c=new Map,v=[{path:e,depth:0}],p=0,T=!1;for(;p<v.length;){let b=v[p++];if(o!=null&&b.depth>=o){f(b.path).length>0&&(T=!0);continue}for(let y of f(b.path))!y||g.has(y)||(g.add(y),c.set(y,b.depth+1),v.push({path:y,depth:b.depth+1}))}let _=[...c.keys()].sort((b,y)=>b<y?-1:b>y?1:0);return n.withDetail?{paths:_,depths:c,truncated:T}:_}function xr(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++){let n=r[t],s=e[t];if(n.path!==s.path||n.type!==s.type||n.status!==s.status||n.hop!==s.hop||n.dep_index!==s.dep_index||n.annotation!==s.annotation||n.value!==s.value||n.lastMutation!==s.lastMutation)return!1;let o=n.v,i=s.v;if(o!==i&&(o==null||i==null||o.id!==i.id||o.version!==i.version))return!1}return!0}var P,ee,be,vr,_r,j,it=L(()=>{"use strict";qe();Ge();pe();fe();re();Ze();ge();me();_n();ke();wn();Tn();Nt();yn();On();P="::",ee="__meta__",be=1;vr={data:"\x1B[32m",dirty:"\x1B[33m",resolved:"\x1B[36m",invalidate:"\x1B[93m",pause:"\x1B[90m",resume:"\x1B[96m",complete:"\x1B[34m",error:"\x1B[31m",teardown:"\x1B[91m",derived:"\x1B[35m",path:"\x1B[90m",reset:"\x1B[0m"},_r={data:"",dirty:"",resolved:"",invalidate:"",pause:"",resume:"",complete:"",error:"",teardown:"",derived:"",path:"",reset:""};j=class r{name;opts;config;_nodes=new Map;_nodeToName=new WeakMap;_mounts=new Map;_parent=void 0;_storageDisposers=new Set;_disposers=new Set;_destroyed=!1;_topology;_topologyEmitters=new Set;_factory;_factoryArgs;constructor(e,t){if(e==="")throw new Error("Graph name must be non-empty");if(e.includes(P))throw new Error(`Graph name must not contain '${P}' (got "${e}")`);if(e===ee)throw new Error(`Graph name "${ee}" is reserved for meta companion paths`);this.name=e,this.opts=Object.freeze({...t??{}}),this.config=t?.config??Oe,this._traceRing=new Le(t?.traceCapacity??1e3),t?.versioning!=null&&this.setVersioning(t.versioning),typeof t?.factory=="string"&&(this._factory=t.factory,t.factoryArgs!==void 0&&(this._factoryArgs=t.factoryArgs))}tagFactory(e,t){return this._factory=e,this._factoryArgs=t,this}ancestors(e=!0){let t=[],n=e?this:this._parent;for(;n!=null;)t.push(n),n=n._parent;return t}get topology(){return this._topology==null&&(this._topology=Qe(e=>{let t=n=>{e.emit(n)};return this._topologyEmitters.add(t),()=>{this._topologyEmitters.delete(t)}},{name:`${this.name}_topology`})),this._topology}_emitTopology(e){if(!(this._topology==null||this._topologyEmitters.size===0))for(let t of this._topologyEmitters)t(e)}nameOf(e){return this._nodeToName.get(e)}add(e,t){let n=e.name,s=t?.name??n;if(s==null||s==="")throw new Error(`Graph "${this.name}": graph.add requires a non-empty name \u2014 pass via opts.name or set it on the node (e.g. state(0, { name: "x" }))`);let o=s,i=t?.annotation;if(Lt(o,this.name,"add"),this._mounts.has(o))throw new Error(`Graph "${this.name}": name "${o}" is already a mount point`);if(this._nodes.has(o))throw new Error(`Graph "${this.name}": node "${o}" already exists`);let a=this._nodeToName.get(e);if(a!==void 0)throw new Error(`Graph "${this.name}": node instance already registered as "${a}"`);return this._nodes.set(o,e),this._nodeToName.set(e,o),this._emitTopology({kind:"added",name:o,nodeKind:"node"}),i!=null&&(this._annotations.set(o,i),this.config.inspectorEnabled&&this._traceRing.push({path:o,annotation:i,timestamp_ns:B()})),e}setVersioning(e){if(e!=null)for(let t of this._nodes.values())t instanceof $&&t._applyVersioning(e)}remove(e){Lt(e,this.name,"remove");let t=this._mounts.get(e);if(t){let o={kind:"mount",nodes:[],mounts:[]},i=[];t._collectObserveTargets("",i);for(let[a,d]of i)a.includes(`${P}${ee}${P}`)||o.nodes.push(a);return o.nodes.sort(),o.mounts.push(e),o.mounts.push(...t._collectSubgraphs(`${e}${P}`)),this._mounts.delete(e),t._parent=void 0,Dn(t),this._emitTopology({kind:"removed",name:e,nodeKind:"mount",audit:o}),o}let n=this._nodes.get(e);if(!n)throw new Error(`Graph "${this.name}": unknown node or mount "${e}"`);this._nodes.delete(e),this._nodeToName.delete(n),n.down([[z]],{internal:!0});let s={kind:"node",nodes:[e],mounts:[]};return this._emitTopology({kind:"removed",name:e,nodeKind:"node",audit:s}),s}removeAll(e){let t=typeof e=="function"?e:(()=>{let o=ot(e);return i=>o.test(i)})(),n={kind:"mount",nodes:[],mounts:[]},s=[...this._nodes.keys(),...this._mounts.keys()].filter(o=>t(o));for(let o of s){let i=this.remove(o);n.nodes.push(...i.nodes),n.mounts.push(...i.mounts)}return n.nodes.sort(),n.mounts.sort(),n}[Symbol.iterator](){let e=[...this._nodes.keys()].sort(),t=this._nodes,n=0;return{[Symbol.iterator](){return this},next(){if(n>=e.length)return{value:void 0,done:!0};let s=e[n++];return{value:[s,t.get(s)],done:!1}}}}node(e){if(e==="")throw new Error(`Graph "${this.name}": node name must be non-empty`);if(e.includes(P))return this.resolve(e);let t=this._nodes.get(e);if(!t)throw new Error(`Graph "${this.name}": unknown node "${e}"`);return t}get(e){return this.node(e).cache}set(e,t,n){let s=n?.internal===!0;this.node(e).down([[D,t]],{actor:n?.actor,internal:s,delivery:"write"})}setAll(e,t){let n=Symbol.iterator in e?e:Object.entries(e);le(()=>{for(let[s,o]of n)this.set(s,o,t)})}invalidate(e,t){let n=t?.internal===!0;this.node(e).down([[Q]],{actor:t?.actor,internal:n,delivery:"write"})}error(e,t,n){let s=n?.internal===!0;this.node(e).down([[I,t]],{actor:n?.actor,internal:s,delivery:"write"})}complete(e,t){let n=t?.internal===!0;this.node(e).down([[H]],{actor:t?.actor,internal:n,delivery:"write"})}edges(e){let t=e?.recursive===!0,n=new Map;if(!t){for(let[d,u]of this._nodes)n.set(u,d);let a=[];for(let[d,u]of this._nodes)if(u instanceof $)for(let l of u._deps){let h=n.get(l.node);h!=null&&a.push([h,d])}return a.sort((d,u)=>d[0]<u[0]?-1:d[0]>u[0]?1:d[1]<u[1]?-1:d[1]>u[1]?1:0),a}let s=[];this._collectObserveTargets("",s);let o=new Map;for(let[a,d]of s)o.set(d,a);let i=[];for(let[a,d]of s)if(d instanceof $)for(let u of d._deps){let l=o.get(u.node);l!=null&&i.push([l,a])}return i.sort((a,d)=>a[0]<d[0]?-1:a[0]>d[0]?1:a[1]<d[1]?-1:a[1]>d[1]?1:0),i}mount(e,t){if(t===void 0){let s=new r(e);return this.mount(e,s)}if(typeof t=="function"){let s=new r(e);return t(s),this.mount(e,s)}let n=t;if(Lt(e,this.name,"mount"),this._nodes.has(e))throw new Error(`Graph "${this.name}": cannot mount at "${e}" \u2014 node with that name exists`);if(this._mounts.has(e))throw new Error(`Graph "${this.name}": mount "${e}" already exists`);if(n===this)throw new Error(`Graph "${this.name}": cannot mount a graph into itself`);if(n._parent!=null)throw new Error(`Graph "${this.name}": this child graph is already mounted on "${n._parent.name}"`);for(let s=this;s!=null;s=s._parent)if(s===n)throw new Error(`Graph "${this.name}": mount("${e}", \u2026) would create a mount cycle`);return this._mounts.set(e,n),n._parent=this,this._emitTopology({kind:"added",name:e,nodeKind:"mount"}),n}resolve(e){let t=Nr(e,this.name);return this._resolveFromSegments(t)}tryResolve(e){try{return this.resolve(e)}catch{return}}_resolveFromSegments(e){let t=e;if(t[0]===this.name&&(t=t.slice(1),t.length===0))throw new Error(`Graph "${this.name}": resolve path ends at graph name only`);let n=t[0],s=t.slice(1);if(s.length===0){let a=this._nodes.get(n);if(a)return a;throw this._mounts.has(n)?new Error(`Graph "${this.name}": path ends at subgraph "${n}" \u2014 not a node (GRAPHREFLY-SPEC \xA73.5)`):new Error(`Graph "${this.name}": unknown name "${n}"`)}let o=this._nodes.get(n);if(o&&s.length>0&&s[0]===ee)return this._resolveMetaChainFromNode(o,s,t.join(P));let i=this._mounts.get(n);if(!i)throw this._nodes.has(n)?new Error(`Graph "${this.name}": "${n}" is a node; trailing path "${s.join(P)}" is invalid`):new Error(`Graph "${this.name}": unknown mount or node "${n}"`);return i.resolve(s.join(P))}_resolveMetaChainFromNode(e,t,n){let s=e,o=0,i=[...t];for(;o<i.length;){if(i[o]!==ee)throw new Error(`Graph "${this.name}": expected ${ee} segment in meta path "${n}"`);if(o+1>=i.length)throw new Error(`Graph "${this.name}": meta path requires a key after ${ee} in "${n}"`);let a=i[o+1],d=s.meta[a];if(!d)throw new Error(`Graph "${this.name}": unknown meta "${a}" in path "${n}"`);s=d,o+=2}return s}signal(e,t){if(t?.internal!==!0){for(let s of e)if(this.config.messageTier(s[0])===3)throw new Error(`Graph "${this.name}": Graph.signal() rejects tier-3 messages (DATA / RESOLVED). Broadcast is for control-plane tiers (START / DIRTY / INVALIDATE / PAUSE / RESUME / COMPLETE / ERROR / TEARDOWN). For per-node value writes, use Graph.set or graph.node(name).down(...).`)}let n=[];if(this._signalDeliver(e,t??{},new Set,n),n.length>0)throw n[0]}_signalDeliver(e,t,n,s){for(let d of this._mounts.values())d._signalDeliver(e,t,n,s);let i=t.internal===!0?{internal:!0}:{actor:t.actor,delivery:"signal"},a=Or(e,this.config);for(let d of[...this._nodes.keys()].sort()){let u=this._nodes.get(d);if(!n.has(u)){n.add(u);try{u.down(e,i)}catch(l){if(l instanceof Z)throw l;s.push(l)}a.length!==0&&this._signalMetaSubtree(u,a,n,i,s)}}}_signalMetaSubtree(e,t,n,s,o){for(let i of Object.keys(e.meta).sort()){let a=e.meta[i];if(!n.has(a)){n.add(a);try{a.down(t,s)}catch(d){if(d instanceof Z)throw d;o.push(d)}this._signalMetaSubtree(a,t,n,s,o)}}}describe(e){if(e?.reactive==="diff")return this._describeReactiveDiff(e);if(e?.reactive===!0)return this._describeReactive(e);let t=gr(e?.actor),n=e?.filter;if(e?.detail!=null&&e?.fields!=null)throw new TypeError("Graph.describe(): pass either `detail` or `fields`, not both. `detail: 'spec'` is the canonical spec projection; use `fields` only when you need a custom subset.");let s=St(e?.detail,e?.fields),o=e?.detail==="spec",i=s,a=[];this._collectObserveTargets("",a);let d=new Map;for(let[y,w]of a)d.set(w,y);let u=[];{let y=a.map(([,m])=>m),w=new Set(d.values()),x=0;for(;y.length>0;){let m=y.shift();if(m instanceof $)for(let N of m._deps){let k=N.node;if(d.has(k))continue;let E=k.name??"",O=E;if(!O||w.has(O))if(E){let R=2;for(;w.has(`${E}#${R}`);)R++;O=`${E}#${R}`}else for(O=`__internal__/${x++}`;w.has(O);)O=`__internal__/${x++}`;d.set(k,O),w.add(O),u.push([O,k]),y.push(k)}}}let l=[...a,...u],h={};for(let[y,w]of l){if(t!=null&&!w.allowsObserve(t))continue;let x=Dt(w,i,o),m=w instanceof $?w._deps.map(O=>d.get(O.node)??O.node.name??""):[],{name:N,...k}=x,E={...k,deps:m};if(!o){let O=this._annotations.get(y);O!=null&&(E.annotation=O)}if(n!=null)if(typeof n=="function"){let O=n;if(!(O.length>=2?O(y,E):O(E)))continue}else{let O=!0;for(let[R,G]of Object.entries(n)){let S=R==="deps_includes"?"depsIncludes":R==="meta_has"?"metaHas":R;if(S==="depsIncludes"){if(!E.deps.includes(String(G))){O=!1;break}continue}if(S==="metaHas"){if(!Object.hasOwn(E.meta??{},String(G))){O=!1;break}continue}if(E[S]!==G){O=!1;break}}if(!O)continue}h[y]=E}let f=new Set(Object.keys(h)),g=[];for(let[y,w]of l)if(w instanceof $)for(let x of w._deps){let m=d.get(x.node);m!=null&&g.push([m,y])}g.sort((y,w)=>y[0]<w[0]?-1:y[0]>w[0]?1:y[1]<w[1]?-1:y[1]>w[1]?1:0);let c=g.map(([y,w])=>({from:y,to:w}));(t!=null||n!=null)&&(c=c.filter(y=>f.has(y.from)&&f.has(y.to)));let v=this._collectSubgraphs(""),p=t!=null||n!=null?v.filter(y=>{let w=`${y}${P}`;return[...f].some(x=>x===y||x.startsWith(w))}):v,T=this,_=e;return{name:this.name,nodes:h,edges:c,subgraphs:p,...this._factory!==void 0?{factory:this._factory}:{},...this._factoryArgs!==void 0?{factoryArgs:this._factoryArgs}:{},expand(y){let w={..._};return Array.isArray(y)?(w.fields=y,w.detail=void 0):(w.detail=y,w.fields=void 0),T.describe(w)}}}_collectSubgraphs(e){let t=[];for(let n of[...this._mounts.keys()].sort()){let s=e===""?n:`${e}${n}`;t.push(s),t.push(...this._mounts.get(n)._collectSubgraphs(`${s}${P}`))}return t}resourceProfile(e){return Nn(this,e)}reachable(e,t,n={}){return n.withDetail===!0?Ie(this.describe(),e,t,{...n,withDetail:!0}):Ie(this.describe(),e,t,n)}explain(e,t,n){return n?.reactive===!0?this._explainReactive(e,t,n):this._explainStatic(de(e),de(t),{...n?.maxDepth!==void 0?{maxDepth:kn(n.maxDepth)}:{},...n?.findCycle!==void 0?{findCycle:An(n.findCycle)}:{}})}_explainStatic(e,t,n){let s=this.describe({detail:"full"}),o=new Map(this._annotations),i=new Map;for(let[a,d]of Object.entries(s.nodes))d.lastMutation!=null&&i.set(a,d.lastMutation);return hn(s,e,t,{...n?.maxDepth!=null?{maxDepth:n.maxDepth}:{},...n?.findCycle===!0?{findCycle:!0}:{},annotations:o,lastMutations:i})}_describeReactive(e){let t={...e,reactive:!1},n=e.reactiveName??"describe",s=0,o=W(s,{name:`${n}_version`}),i=this.observe({timeline:!0,structured:!0}),a=!1,d=!1,u=()=>{a||d||(a=!0,we(()=>{a=!1,!d&&(s+=1,o.emit(s))}))},l=i.onEvent(_=>{let b=_.type;b!=="data"&&b!=="error"&&b!=="complete"&&b!=="teardown"||u()}),h=[],f=new WeakSet,g=_=>{if(f.has(_)||d)return;f.add(_);let b=_.topology.subscribe(y=>{for(let w of y){if(w[0]!==D)continue;let x=w[1];if(u(),x.kind==="added"&&x.nodeKind==="mount"){let m=_._mounts.get(x.name);m!=null&&g(m)}}});h.push(b);for(let y of _._mounts.keys()){let w=_._mounts.get(y);w!=null&&g(w)}};g(this);let c,v=e.actor;Sn(v)&&(c=v.subscribe(_=>{let b=!1,y=!1;for(let w of _){let x=w[0];x===D?b=!0:(x===H||x===I||x===z)&&(y=!0)}b&&u(),y&&(c?.(),c=void 0,u())}));let p;try{p=F([o],()=>this.describe(t),{name:n,describeKind:"derived",meta:{domain:"audit",kind:"describe"},equals:(_,b)=>_===b})}catch(_){l(),c?.();for(let b of h)b();throw i.dispose(),_}let T=K(p);return{node:p,dispose(){d=!0,l(),c?.();for(let _ of h)_();h.length=0,i.dispose(),T()}}}_describeReactiveDiff(e){let t={...e,reactive:!1},n=e.reactiveName??"describe-diff",s={name:this.name,nodes:{},edges:[],subgraphs:[]},o=this.describe(t),i=Mt(s,o),a=W(i,{name:n,meta:{domain:"audit",kind:"describe-diff"},equals:(f,g)=>f===g}),d=this._describeReactive({...e,reactiveName:void 0}),u=!1,l=d.node.subscribe(f=>{if(!u)for(let g of f){if(g[0]!==D)continue;let c=g[1],v=Mt(o,c);o=c,v.events.length!==0&&a.emit(v)}}),h=K(a);return{node:a,dispose(){u=!0,l(),d.dispose(),a.down([[z,"describe-diff disposed"]]),h()}}}_explainReactive(e,t,n){let s=0,o=W(s,{name:"explain_version"}),i=this.observe({timeline:!0,structured:!0}),a=!1,d=!1,u=()=>{a||d||(a=!0,we(()=>{a=!1,!d&&(s+=1,o.emit(s))}))},l=i.onEvent(_=>{let b=_.type;b!=="data"&&b!=="error"&&b!=="complete"&&b!=="teardown"||u()}),h=[];e!=null&&ye(e)&&h.push(e),t!=null&&ye(t)&&h.push(t),n?.maxDepth!=null&&ye(n.maxDepth)&&h.push(n.maxDepth),n?.findCycle!=null&&ye(n.findCycle)&&h.push(n.findCycle);let f=()=>{for(let _ of h)if(_.cache===void 0)return!1;return!0},g=()=>{let _=de(e),b=de(t);return{from:_,to:b,found:!1,reason:"pending",steps:[],text:"(awaiting reactive args)",toJSON:()=>({from:_,to:b,found:!1,reason:"pending",steps:[]})}},c;try{c=F([o],()=>{if(!f())return g();let _=de(e),b=de(t),y={...n?.maxDepth!==void 0?{maxDepth:kn(n.maxDepth)}:{},...n?.findCycle!==void 0?{findCycle:An(n.findCycle)}:{}};return this._explainStatic(_,b,y)},{name:n?.name??"explain",describeKind:"derived",meta:{domain:"audit",kind:"explain_path",from:de(e),to:de(t)},equals:(_,b)=>_.found===b.found&&_.reason===b.reason&&_.steps.length===b.steps.length&&xr(_.steps,b.steps)})}catch(_){throw l(),i.dispose(),_}let v=K(c),p=[],T=_=>{let b;return b=_.subscribe(y=>{let w=!1,x=!1;for(let m of y){let N=m[0];N===D?w=!0:(N===H||N===I||N===z)&&(x=!0)}(w||x)&&u(),x&&b&&(b(),b=void 0)}),()=>{b&&(b(),b=void 0)}};for(let _ of h)p.push(T(_));return{node:c,dispose(){d=!0,l();for(let _ of p)_?.();p.length=0,i.dispose(),v()}}}_pathsMatching(e){let t=ot(e),n=[];return this._collectObserveTargets("",n),n.map(([s])=>s).filter(s=>t.test(s))}_collectObserveTargets(e,t){for(let n of[...this._mounts.keys()].sort()){let s=e===""?n:`${e}${P}${n}`;this._mounts.get(n)._collectObserveTargets(s,t)}for(let n of[...this._nodes.keys()].sort()){let s=this._nodes.get(n),o=e===""?n:`${e}${P}${n}`;t.push([o,s]),this._appendMetaObserveTargets(o,s,t)}}_appendMetaObserveTargets(e,t,n){for(let s of Object.keys(t.meta).sort()){let o=t.meta[s],i=`${e}${P}${ee}${P}${s}`;n.push([i,o]),this._appendMetaObserveTargets(i,o,n)}}observe(e,t){let n=typeof e=="string",o=Rn(n?t:e);if(o.reactive===!0)return this._observeReactive(n?e:void 0,o);let i=o.structured===!0||o.timeline===!0||o.causal===!0||o.derived===!0||o.detail==="minimal"||o.detail==="full"||o.format!=null,a=o.actor;if(n){let l=e,h=this.resolve(l);if(a!=null&&!h.allowsObserve(a))throw new Z({actor:a,action:"observe",nodeName:l});return i?this._buildStructuredObserver([[l,h]],o,"one"):{subscribe(f){return h.subscribe(f)},up(f){try{h.up?.(f)}catch(g){if(g instanceof Z)return;throw g}}}}let d=[];this._collectObserveTargets("",d),d.sort((l,h)=>l[0]<h[0]?-1:l[0]>h[0]?1:0);let u=a==null?d:d.filter(([,l])=>l.allowsObserve(a));return i?this._buildStructuredObserver(u,o,"all"):{subscribe:l=>{let h=u.map(([f,g])=>g.subscribe(c=>{l(f,c)}));return()=>{for(let f of h)f()}},up:(l,h)=>{try{this.resolve(l).up?.(h)}catch(f){if(f instanceof Z)return;throw f}}}}_observeReactive(e,t){let n=t.tiers,s=n!=null?new Set(n):null,o=t.reactiveName??"observe";return Qe(i=>{let a=[],d=!1,u=!1,l=()=>{if(a.length===0||u)return;let v={events:a.slice(),flushedAt_ns:B()};a.length=0,i.emit(v)},h={...t,reactive:!1,structured:!0,timeline:!0},f=e!=null?this.observe(e,h):this.observe(h),g=v=>{u||(a.push(v),!d&&(d=!0,we(()=>{d=!1,l()})))};for(let v of f.events)g(v);let c=f.onEvent(g);return()=>{u=!0,c(),f.dispose()}},{name:o,meta:{domain:"audit",kind:"observe-reactive"}})}_buildStructuredObserver(e,t,n){let s=n==="one"?e[0]?.[0]:void 0,o=i=>{if(n==="one"&&s!=null){let l=this.resolve(s);return this._buildStructuredObserver([[s,l]],i,"one")}let a=[];this._collectObserveTargets("",a),a.sort((l,h)=>l[0]<h[0]?-1:l[0]>h[0]?1:0);let d=i.actor,u=d==null?a:a.filter(([,l])=>l.allowsObserve(d));return this._buildStructuredObserver(u,i,"all")};return this._createObserveResult(e,t,o)}_createObserveResult(e,t,n){let s=t.timeline===!0,o=t.causal===!0,i=t.derived===!0,a=t.detail==="minimal",d=this.config.inspectorEnabled,u=(o||i)&&d,l=t.maxEvents,h=l!=null&&l>0?new Le(l):null,f=[],g=new Set,c=t.tiers!=null?new Set(t.tiers):null,v={},p=new Set,T=0,_=0,b=0,y=0,w=0,x=0,m=!1,N=!1,k=0,E=new Map,O=new Map,R=new Map,G=A=>{if(!(c!=null&&!c.has(A.type))){h?h.push(A):f.push(A);for(let M of g)M(A)}},S=A=>c==null||c.has(A),ae=()=>s?{timestamp_ns:B(),in_batch:ze(),batch_id:k}:{},se=(A,M)=>{if(!(!u||!(A instanceof $)))return A._setInspectorHook(J=>{if(J.kind==="dep_message")E.set(A,J.depIndex);else if(J.kind==="run"){let Re=J.batchData.map((C,q)=>C!=null&&C.length>0?C.at(-1):J.prevData[q]);O.set(A,Re);let X=J.batchData.map(C=>C!=null?[...C]:void 0);R.set(A,X),i&&G({type:"derived",path:M,dep_values:Re,dep_batches:X,...ae()})}})},Fe=A=>{let M=E.get(A),J=O.get(A);if(!o||J==null)return{};let X=(M!=null&&M>=0&&A instanceof $?A._deps[M]:void 0)?.node,C=X?.v,q=R.get(A);return{trigger_dep_index:M,trigger_dep_name:X?.name,...C!=null?{trigger_version:{id:C.id,version:C.version}}:{},dep_values:[...J],...q!=null?{dep_batches:q}:{}}},Bt=[],Ut=[];for(let[A,M]of e){let J=se(M,A);J&&Bt.push(J),Ut.push(M.subscribe(Re=>{k++;for(let X of Re){let C=X[0],q=ae();if(C===D){v[A]=X[1];let ht=M instanceof $?M.lastMutation?.actor??Ne:Ne;G({type:"data",path:A,data:X[1],actor:ht,...q,...Fe(M)})}else if(a)C===U?S("dirty")&&T++:C===Y?S("resolved")&&_++:C===Q?S("invalidate")&&b++:C===te?S("pause")&&y++:C===oe?S("resume")&&w++:C===z?S("teardown")&&x++:C===H&&!p.has(A)?S("complete")&&(m=!0):C===I&&S("error")&&(N=!0,p.add(A));else if(C===U)S("dirty")&&T++,G({type:"dirty",path:A,...q});else if(C===Y)S("resolved")&&_++,G({type:"resolved",path:A,...q,...Fe(M)});else if(C===Q)S("invalidate")&&b++,G({type:"invalidate",path:A,...q});else if(C===te)S("pause")&&y++,G({type:"pause",path:A,lockId:X[1],...q});else if(C===oe)S("resume")&&w++,G({type:"resume",path:A,lockId:X[1],...q});else if(C===H)S("complete")&&!p.has(A)&&(m=!0),G({type:"complete",path:A,...q});else if(C===I){S("error")&&(N=!0,p.add(A));let ht=M instanceof $?M.lastMutation?.actor??Ne:Ne;G({type:"error",path:A,data:X[1],actor:ht,...q})}else C===z&&(S("teardown")&&x++,G({type:"teardown",path:A,...q}))}}))}let lt=!1,pt=()=>{if(!lt){lt=!0;for(let A of Ut)A();for(let A of Bt)A();for(let A of Ve)A({value:void 0,done:!0});Ve.length=0}},ft=[],Ve=[];g.add(A=>{let M=Ve.shift();M?M({value:A,done:!1}):ft.push(A)});let Wt={get values(){return v},get dirtyCount(){return T},get resolvedCount(){return _},get invalidateCount(){return b},get pauseCount(){return y},get resumeCount(){return w},get teardownCount(){return x},get events(){return h?h.toArray():[...f]},get anyCompletedCleanly(){return m},get anyErrored(){return N},get completedWithoutErrors(){return m&&!N},onEvent(A){return g.add(A),()=>g.delete(A)},dispose:pt,expand(A){pt();let M={...t};return typeof A=="string"?M.detail=A:Object.assign(M,A),n(Rn(M))},[Symbol.asyncIterator](){return{next(){return ft.length>0?Promise.resolve({value:ft.shift(),done:!1}):lt?Promise.resolve({value:void 0,done:!0}):new Promise(A=>Ve.push(A))},return(){return pt(),Promise.resolve({value:void 0,done:!0})}}}};return t.format!=null&&this._attachFormatLogger(Wt,t),Wt}_attachFormatLogger(e,t){let n=t.format;if(n==null)return;let s=t.logger??(c=>console.log(c)),o=t.includeTypes?new Set(t.includeTypes):null,i=t.excludeTypes?new Set(t.excludeTypes):null,a=o==null&&i==null?()=>!0:c=>(o==null||o.has(c))&&(i==null||!i.has(c)),d=wr(t.theme),u=n==="stage-log"?B():0,l=c=>c==null?"":t.stageLabels?.[c]??c,h=(c,v)=>c.length>v?`${c.slice(0,v-1)}\u2026`:c,f=c=>c.type==="data"||c.type==="error"?h(Pt(c.data),120):"",g=c=>{if(n==="stage-log"){let m=(B()-u)/1e9,N=l(c.path).padEnd(9);if(c.type==="data"){let k=f(c);return`[${m.toFixed(3)}s] ${N} \u2190${k?` ${k}`:""}`}if(c.type==="error"){let k=f(c);return`[${m.toFixed(3)}s] ${N} \u2717${k?` ${k}`:""}`}return c.type==="complete"?`[${m.toFixed(3)}s] ${N} \u25A0 complete`:`[${m.toFixed(3)}s] ${N} ${c.type}`}if(n==="json")try{return JSON.stringify(c)}catch{return JSON.stringify({type:c.type,path:c.path,data:"[unserializable]"})}let v=d[c.type]??"",p=c.path?`${d.path}${c.path}${d.reset} `:"",T=c.type==="data"||c.type==="error",_=c.type==="pause"||c.type==="resume",b=T?` ${Pt(c.data)}`:_?` ${Pt(c.lockId)}`:"",y=c.type==="data"||c.type==="resolved"||c.type==="derived"?c:void 0,w=y?.trigger_dep_name!=null?` <- ${y.trigger_dep_name}`:y?.trigger_dep_index!=null?` <- #${y.trigger_dep_index}`:"",x=c.in_batch?" [batch]":"";return`${p}${v}${c.type.toUpperCase()}${d.reset}${b}${w}${x}`};e.onEvent(c=>{a(c.type)&&s(g(c),c)})}addDisposer(e){return this._disposers.add(e),()=>{this._disposers.delete(e)}}destroy(){xn(this._disposers,this.name),this.signal([[z]],{internal:!0}),xn(this._storageDisposers,this.name);for(let e of[...this._mounts.values()])e._parent=void 0,e._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}get destroyed(){return this._destroyed}_destroyClearOnly(){for(let e of[...this._mounts.values()])e._parent=void 0,e._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}snapshot(e){let{expand:t,...n}=this.describe({detail:"full"}),s={};for(let a of Object.keys(n.nodes).sort()){let{lastMutation:d,guard:u,...l}=n.nodes[a];s[a]=l}let o=[...n.subgraphs].sort(),i={...n,version:1,nodes:s,subgraphs:o};if(e?.format==null)return i;if(e.format==="json-string")return JSON.stringify(i);if(e.format==="bytes"){if(e.codec==null)throw new Error("snapshot({format: 'bytes'}) requires a `codec` name");let a=this.config.lookupCodec(e.codec);if(a==null)throw new Error(`snapshot: codec "${e.codec}" is not registered on this graph's config. Call config.registerCodec(...) before creating nodes.`);return Qt(a,a.encode(i))}throw new Error(`snapshot: unknown format "${String(e.format)}"`)}static decode(e,t){let n=t?.config??Oe,{codec:s,codecVersion:o,payload:i}=en(e,n);return s.decode(i,o)}restore(e,t){if(En(e),e.name!==this.name)throw new Error(`Graph "${this.name}": restore snapshot name "${e.name}" does not match this graph`);let n=t?.only==null?null:(Array.isArray(t.only)?t.only:[t.only]).map(o=>ot(o)),s=t?.includeProducers===!0;for(let o of Object.keys(e.nodes).sort()){if(n!==null&&!n.some(a=>a.test(o)))continue;let i=e.nodes[o];if(i!==void 0){if(!("value"in i)||i.value===void 0){"value"in i&&i.value===void 0&&t?.onError?.(o,new Error(`restore: slice.value is undefined for "${o}" (undefined is the global SENTINEL; not valid DATA)`));continue}if(!(i.type==="derived"||i.type==="effect")&&!(i.type==="producer"&&!s)){if(i.v!=null){let d=this.tryResolve(o)?.v;if(d!=null&&d.id===i.v.id&&d.version===i.v.version)continue}try{this.set(o,i.value)}catch(a){t?.onError?.(o,a)}}}}}static fromSnapshot(e,t){En(e);let n=typeof t=="function"?t:t?.build,s=typeof t=="function"?void 0:t?.factories,o=new r(e.name);if(n)return n(o),o.restore(e),o;for(let g of[...e.subgraphs].sort((c,v)=>{let p=c.split(P).length,T=v.split(P).length;return p!==T?p-T:c<v?-1:c>v?1:0})){let c=g.split(P),v=o;for(let p of c)v._mounts.has(p)||v.mount(p,new r(p)),v=v._mounts.get(p)}let i=s?Object.entries(s).map(([g,c])=>({re:ot(g),factory:c})):[],a=g=>{for(let c of i)if(c.re.test(g))return c.factory},d=g=>{let c=g.split(P),v=c.pop();if(v==null||v.length===0)throw new Error(`invalid snapshot path "${g}"`);let p=o;for(let T of c){let _=p._mounts.get(T);if(!_)throw new Error(`unknown mount "${T}" in path "${g}"`);p=_}return[p,v]},u=Object.entries(e.nodes).filter(([g])=>!g.includes(`${P}${ee}${P}`)).sort((g,c)=>g[0]<c[0]?-1:g[0]>c[0]?1:0),l=new Map(u),h=new Map,f=!0;for(;l.size>0&&f;){f=!1;for(let[g,c]of[...l.entries()]){let v=c?.deps??[];if(!v.every(w=>h.has(w)))continue;let[p,T]=d(g),_={...c?.meta??{}},b=a(g),y;if(c?.type==="state")y=W(c.value,{meta:_});else{if(b==null)continue;y=b(T,{path:g,type:c.type,value:c.value,meta:_,deps:v,resolvedDeps:v.map(w=>h.get(w))})}p.add(y,{name:T}),h.set(g,y),l.delete(g),f=!0}}if(l.size>0){let g=[...l.keys()].sort().join(", ");throw new Error(`Graph.fromSnapshot could not reconstruct nodes without build callback: ${g}. Pass matching factories via fromSnapshot(data, { factories: { pattern: factoryFn } }).`)}return o.restore(e),o}toJSON(){return this.snapshot()}attachSnapshotStorage(e,t={}){let n=e.map(u=>({tier:u,debounceMs:Math.max(0,u.debounceMs??0),compactEvery:Math.max(1,u.compactEvery??10),timer:void 0,seq:0,lastSnapshot:void 0,lastFingerprint:"",disposed:!1,savePending:void 0}));t.autoRestore===!0&&this._cascadeRestore(e,t.onError);let s=(u,l)=>{if(u.disposed)return;let h=mr(l.nodes);if(u.lastSnapshot!=null&&h!==""&&h===u.lastFingerprint)return;let f=u.seq+1,g=ne(),p=u.lastSnapshot==null||f%u.compactEvery===0?{name:this.name,mode:"full",snapshot:l,seq:f,timestamp_ns:g,format_version:be}:{name:this.name,mode:"diff",diff:Gn(u.lastSnapshot,l),seq:f,timestamp_ns:g,format_version:be};if(u.tier.filter&&!u.tier.filter(p))return;let T;try{T=u.tier.save(p)}catch(_){t.onError?.(_,u.tier);return}if(T&&typeof T.then=="function"){let y=(u.savePending??Promise.resolve()).then(()=>T,()=>T).then(()=>{u.disposed||(u.seq=f,u.lastSnapshot=l,u.lastFingerprint=h)},w=>{t.onError?.(w,u.tier)});u.savePending=y.finally(()=>{u.savePending===y&&(u.savePending=void 0)})}else u.seq=f,u.lastSnapshot=l,u.lastFingerprint=h},o=(u,l)=>{try{s(u,l)}catch(h){t.onError?.(h,u.tier)}},i=(u,l)=>{if(!l.some(c=>{let v=this.config.messageTier(c[0]);return v>=3&&v<5}))return;if(t.filter){let c=this.tryResolve(u);if(c==null)return;let v=Dt(c,St("standard"));if(!t.filter(u,v))return}let f,g=()=>(f==null&&(f=this.snapshot()),f);for(let c of n)c.disposed||(c.debounceMs===0?o(c,g()):(c.timer==null&&(c.timer=new st),c.timer.start(c.debounceMs,()=>{c.disposed||o(c,this.snapshot())})))},a;if(t.paths!=null){let l=(typeof t.paths=="string"?this._pathsMatching(t.paths):t.paths).map(h=>{let f=this.tryResolve(h);return f==null?()=>{}:f.subscribe(g=>i(h,g))});a=()=>{for(let h of l)h()}}else a=this.observe().subscribe((u,l)=>i(u,l));let d=()=>{a();for(let u of n)u.disposed=!0,u.timer?.cancel();this._storageDisposers.delete(d)};return this._storageDisposers.add(d),{dispose:d}}async _cascadeRestore(e,t){for(let n of e){let s;try{s=await n.load?.()}catch(i){t?.(i,n);continue}if(s==null||typeof s!="object"||Array.isArray(s))continue;let o=s;try{if(o.mode==="full"&&o.snapshot!=null)return this.restore(o.snapshot),!0;if(o.version===be&&o.nodes!=null)return this.restore(o),!0}catch(i){t?.(i,n)}}return!1}static async fromStorage(e,t,n){for(let s of t){let o;try{o=await s.load?.()}catch(d){n?.onError?.(d,s);continue}if(o==null||typeof o!="object"||Array.isArray(o))continue;let i=o,a=i.mode==="full"&&i.snapshot!=null?i.snapshot:i.version===be&&i.nodes!=null?i:void 0;if(a!=null)try{return r.fromSnapshot(a,n)}catch(d){n?.onError?.(d,s)}}throw new Error(`Graph.fromStorage: no tier held a restorable record for "${e}" across ${t.length} tier(s)`)}_annotations=new Map;_traceRing;trace(e,t,n){if(e!=null&&t!=null){if(this.tryResolve(e)==null)return;if(this._annotations.set(e,t),this.config.inspectorEnabled){let s={path:e,annotation:t,timestamp_ns:B(),...n?.actor!=null?{actor:n.actor}:{}};this._traceRing.push(s)}return}return e!=null?this.config.inspectorEnabled?this._annotations.get(e):void 0:this.config.inspectorEnabled?this._traceRing.toArray():[]}annotation(e){return this._annotations.get(e)}clearTrace(){this._annotations.clear(),this._traceRing.clear()}pruneTrace(e){let t=this._traceRing.toArray().filter(s=>!e(s)),n=this._traceRing.size-t.length;this._traceRing.clear();for(let s of t)this._traceRing.push(s);return n}static diff(e,t){let n=new Set(Object.keys(e.nodes)),s=new Set(Object.keys(t.nodes)),o=[...s].filter(_=>!n.has(_)).sort(),i=[...n].filter(_=>!s.has(_)).sort(),a=[],d=[];for(let _ of n){if(!s.has(_))continue;let b=e.nodes[_],y=t.nodes[_],w=b.v,x=y.v;w!=null&&x!=null&&w.id===x.id&&w.version!==x.version&&d.push({path:_,id:w.id,from:w.version,to:x.version});let m=w!=null&&x!=null&&w.id===x.id&&w.version===x.version;for(let N of["type","status","sentinel"]){let k=b[N],E=y[N];k!==E&&a.push({path:_,field:N,from:k,to:E})}if(!m)for(let N of["value","meta"]){let k=b[N],E=y[N];br(k,E)||a.push({path:_,field:N,from:k,to:E})}}let u=_=>`${_.from} ${_.to}`,l=new Set(e.edges.map(u)),h=new Set(t.edges.map(u)),f=t.edges.filter(_=>!l.has(u(_))),g=e.edges.filter(_=>!h.has(u(_))),c=new Set(e.subgraphs),v=new Set(t.subgraphs),p=[...v].filter(_=>!c.has(_)).sort(),T=[...c].filter(_=>!v.has(_)).sort();return{nodesAdded:o,nodesRemoved:i,nodesChanged:a,versionChanges:d,edgesAdded:f,edgesRemoved:g,subgraphsAdded:p,subgraphsRemoved:T}}}});function $e(r,e){let t=new Map,n=(s,o)=>{if(t.has(s))return;let i={off:()=>{},prefix:o};t.set(s,i);let a=s.topology.subscribe(d=>{for(let u of d){if(u[0]!==D)continue;let l=u[1];if(e(l,s,o),l.kind==="added"&&l.nodeKind==="mount"){let h=s._mounts.get(l.name);if(h instanceof j){let f=`${o}${l.name}::`;n(h,f)}}else if(l.kind==="removed"&&l.nodeKind==="mount"){let h=`${o}${l.name}::`;for(let[f,g]of Array.from(t.entries()))f!==r&&g.prefix.startsWith(h)&&(g.off(),t.delete(f))}}});i.off=a;for(let[d,u]of s._mounts)if(u instanceof j){let l=`${o}${d}::`;n(u,l)}};return n(r,""),()=>{for(let s of t.values())s.off();t.clear()}}var Cn=L(()=>{"use strict";re();it()});var Ae=L(()=>{"use strict";it();Cn()});var Pr={};Kn(Pr,{AuditTrailGraph:()=>at,GuardedExecutionGraph:()=>ut,InspectGraph:()=>ct,PolicyGateGraph:()=>dt,auditTrail:()=>$t,complianceSnapshot:()=>Vt,computeHealthReport:()=>jn,graphLens:()=>jt,guardedExecution:()=>Cr,healthReportEqual:()=>Hn,inspect:()=>Mr,policyGate:()=>Ft,watchTopologyTree:()=>$e});module.exports=Yn(Pr);Ge();pe();fe();re();Ze();ge();me();kt();Me();Ge();re();ge();me();var Gt=class{_version=0;_maxSize;_buf;_head=0;_size=0;constructor(e,t){if(t!==void 0&&t<1)throw new RangeError("maxSize must be >= 1");if(this._maxSize=t,t!==void 0){if(this._buf=new Array(t),e&&e.length>0){let n=Math.min(e.length,t),s=e.length-n;for(let o=0;o<n;o++)this._buf[o]=e[s+o];this._size=n}}else this._buf=e?[...e]:[],this._size=this._buf.length}get version(){return this._version}get size(){return this._size}at(e){if(!Number.isInteger(e))return;let t=e>=0?e:this._size+e;if(!(t<0||t>=this._size))return this._maxSize!==void 0?this._buf[(this._head+t)%this._maxSize]:this._buf[t]}append(e){this._rawAppend(e),this._version+=1}appendMany(e){if(e.length===0)return;let t=this._maxSize!==void 0&&e.length>this._maxSize?e.length-this._maxSize:0;for(let n=t;n<e.length;n++)this._rawAppend(e[n]);this._version+=1}clear(){if(this._size===0)return 0;let e=this._size;if(this._maxSize===void 0)this._buf.length=0;else for(let t=0;t<e;t++)this._buf[(this._head+t)%this._maxSize]=void 0;return this._head=0,this._size=0,this._version+=1,e}trimHead(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`trimHead: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return 0;let t=Math.min(e,this._size);if(this._maxSize===void 0)this._buf.splice(0,t);else{for(let n=0;n<t;n++)this._buf[(this._head+n)%this._maxSize]=void 0;this._head=(this._head+t)%this._maxSize}return this._size-=t,this._version+=1,t}slice(e,t){if(!Number.isInteger(e)||e<0)throw new RangeError(`slice: start must be a non-negative integer (got ${e})`);if(t!==void 0&&(!Number.isInteger(t)||t<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${t})`);let n=t===void 0?this._size:Math.min(Math.max(t,0),this._size),s=Math.min(e,this._size);if(s>=n)return[];let o=n-s;if(this._maxSize===void 0)return this._buf.slice(s,n);let i=new Array(o);for(let a=0;a<o;a++)i[a]=this._buf[(this._head+s+a)%this._maxSize];return i}tail(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`tail: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return[];let t=Math.min(e,this._size);return this.slice(this._size-t,this._size)}toArray(){if(this._maxSize===void 0)return[...this._buf];let e=new Array(this._size);for(let t=0;t<this._size;t++)e[t]=this._buf[(this._head+t)%this._maxSize];return e}snapshot(){return this.toArray()}restore(e){if(this._maxSize===void 0){this._buf.length=0;for(let t=0;t<e.length;t++)this._buf.push(e[t]);this._size=this._buf.length}else{let t=this._maxSize;for(let o=0;o<t;o++)this._buf[o]=void 0;this._head=0;let n=Math.min(e.length,t),s=e.length-n;for(let o=0;o<n;o++)this._buf[o]=e[s+o];this._size=n}this._version+=1}_rawAppend(e){if(this._maxSize===void 0){this._buf.push(e),this._size=this._buf.length;return}this._size<this._maxSize?(this._buf[(this._head+this._size)%this._maxSize]=e,this._size+=1):(this._buf[this._head]=e,this._head=(this._head+1)%this._maxSize)}};function Pe(r){return r.subscribe(()=>{})}var dr=64;function et(r,e={}){let{name:t,maxSize:n,versioning:s,guard:o,backend:i}=e,a=i??new Gt(r,n),d=W(a.toArray(),{name:t,describeKind:"state",equals:(m,N)=>m===N,...s!=null?{versioning:s}:{},...o!=null?{guard:o}:{}});function u(){let m=a.toArray();le(()=>{d.down([[U]],{internal:!0}),d.down([[D,m]],{internal:!0})})}let l=new Map,h=new Map,f=new Map;function g(m,N){return`${m}:${N===void 0?"END":N}`}function c(m){if(m.size<dr)return;let N=m.keys().next();if(N.done)return;let k=m.get(N.value);k!==void 0&&k.dispose(),m.delete(N.value)}function v(m){let N=a.version;try{return m()}finally{a.version!==N&&u()}}function p(m){if(!Number.isInteger(m)||m<0)throw new RangeError(`tail: n must be a non-negative integer (got ${m})`);let N=l.get(m);if(N!==void 0)return l.delete(m),l.set(m,N),N.node;c(l);let k=F([d],([O])=>{let R=O;return m===0||R.length===0?[]:R.slice(Math.max(0,R.length-m))},{initial:a.tail(m),describeKind:"derived"}),E=Pe(k);return l.set(m,{node:k,dispose:E}),k}function T(m,N){if(!Number.isInteger(m)||m<0)throw new RangeError(`slice: start must be a non-negative integer (got ${m})`);if(N!==void 0&&(!Number.isInteger(N)||N<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${N})`);let k=g(m,N),E=h.get(k);if(E!==void 0)return h.delete(k),h.set(k,E),E.node;c(h);let O=F([d],([G])=>{let S=G;return N===void 0?S.slice(m):S.slice(m,N)},{initial:a.slice(m,N),describeKind:"derived"}),R=Pe(O);return h.set(k,{node:O,dispose:R}),O}function _(m){let N=f.get(m);if(N!==void 0)return N.node;let k=F([d,m],([O,R])=>{let G=O,S=Math.max(0,Math.trunc(R??0));return G.slice(S)},{initial:[],describeKind:"derived"}),E=Pe(k);return f.set(m,{node:k,dispose:E}),k}let b,y;function w(){b===void 0&&(b=xe([d],(m,N,k)=>{let E=m[0],R=E!=null&&E.length>0?E.at(-1):k.prevData[0];if(R==null||R.length===0){N.down([[Y]]);return}N.emit(R[R.length-1])},{name:t!=null?`${t}::lastValue`:"lastValue",describeKind:"derived",initial:a.size===0?void 0:a.at(a.size-1)}),y=F([d],([m])=>m.length>0,{name:t!=null?`${t}::hasLatest`:"hasLatest",describeKind:"derived",initial:a.size>0}),Pe(b),Pe(y))}let x={entries:d,get size(){return a.size},at(m){return a.at(m)},append(m){v(()=>a.append(m))},appendMany(m){m.length!==0&&v(()=>a.appendMany(m))},clear(){v(()=>a.clear())},trimHead(m){v(()=>a.trimHead(m))},withLatest(){return w(),d},get lastValue(){return w(),b},get hasLatest(){return w(),y},view(m){switch(m.kind){case"tail":return p(m.n);case"slice":return T(m.start,m.stop);case"fromCursor":return _(m.cursor)}},attach(m){let N=m.subscribe(k=>{for(let E of k)E[0]===D&&x.append(E[1])});return()=>N()},attachStorage(m){if(m.length===0)return()=>{};let N=new Map;for(let E of m)N.set(E,a.size);(async()=>{for(let E of m)if(typeof E.loadEntries=="function")try{let O=await Promise.resolve(E.loadEntries());O.entries.length>0&&a.size===0&&(a.restore(O.entries),N.set(E,O.entries.length),u());break}catch{}})();let k=d.subscribe(E=>{for(let O of E){if(O[0]!==D)continue;let R=O[1];for(let G of m){let S=N.get(G)??0;if(R.length<S){try{let se=G.appendEntries(R);se instanceof Promise&&se.catch(()=>{})}catch{}N.set(G,R.length);continue}if(R.length===S)continue;let ae=R.slice(S);N.set(G,R.length);try{let se=G.appendEntries(ae);se instanceof Promise&&se.catch(()=>{})}catch{}}}});return()=>k()},disposeAllViews(){for(let m of l.values())m.dispose();l.clear();for(let m of h.values())m.dispose();h.clear();for(let m of f.values())m.dispose();f.clear()},dispose(){for(let m of l.values())m.dispose();l.clear();for(let m of h.values())m.dispose();h.clear();for(let m of f.values())m.dispose();f.clear()}};return x}ke();Ae();qe();fe();re();me();Me();pe();fe();re();var so=mt((r,e)=>{r("observe"),r("signal"),e("write")});function Ln(r){if(r===null||typeof r!="object"||Object.isFrozen(r))return r;for(let e of Object.keys(r))Ln(r[e]);return Object.freeze(r)}var Mn=new WeakSet;function kr(r){let e=r.cache,t=typeof e=="number"&&Number.isFinite(e);!t&&e!==void 0&&!Mn.has(r)&&(Mn.add(r),console.warn(`bumpCursor: cursor cache held a non-numeric value (${String(e)}); resetting to 0. Causes include: a snapshot codec round-tripping the cursor as a string / null / NaN, OR a malformed initial seed (e.g. state<number>(NaN)). Audit consumers may see colliding seq values after this point.`));let s=(t?e:0)+1;return r.down([[U],[D,s]]),s}function Pn(r,e,t,n,s,o){let i=e(t,n,s);if(i===void 0)return;let a=o!=null?{...i,handlerVersion:o}:i;r.append(a)}function In(r,e){let t=e.freeze??!0;return function(...s){let o=t?s.map(Ln):s,i=ne(),a=e.seq?kr(e.seq):void 0;try{let d=r(...o);return e.audit&&e.onSuccess&&Pn(e.audit,e.onSuccess,o,d,{t_ns:i,seq:a},e.handlerVersion),d}catch(d){if(e.audit&&e.onFailure){let u=d instanceof Error?d.name:typeof d;Pn(e.audit,e.onFailure,o,d,{t_ns:i,seq:a,errorType:u},e.handlerVersion)}throw d}}}ke();Ae();function $n(r,e){return ie("messaging",r,e)}var Ar=1024,Ee=class extends j{_log;_publishImpl;events;latest;hasLatest;constructor(e,t={}){super(e,t.graph),this._log=et([],{name:"events",maxSize:t.retainedLimit??Ar}),this._log.withLatest(),this.events=this._log.entries,this.add(this.events,{name:"events"}),this.latest=F([this.events],([n])=>{let s=n;return s.length===0?null:s[s.length-1]},{name:"latest",describeKind:"derived",meta:$n("topic_latest")}),this.add(this.latest,{name:"latest"}),this.addDisposer(K(this.latest)),this.hasLatest=F([this.events],([n])=>n.length>0,{name:"hasLatest",describeKind:"derived",meta:$n("topic_has_latest")}),this.add(this.hasLatest,{name:"hasLatest"}),this.addDisposer(K(this.hasLatest)),this.addDisposer(()=>{this.events.down([[H]])}),this.addDisposer(()=>this._log.disposeAllViews()),this._publishImpl=In(n=>{this._log.append(n)},{freeze:!1})}publish(e){if(e===void 0)throw new TypeError(`TopicGraph "${this.name}": publish(undefined) is not allowed (spec \xA75.12 SENTINEL).`);this._publishImpl(e)}attachEventStorage(e){return this._log.attachStorage(e)}retained(){return this.events.cache}get _logBundle(){return this._log}};function zn(r,e){return ie("audit",r,e)}var Er=new Set(["data","error","complete","teardown"]),at=class extends j{entries;count;includeTypes;_log;_target;constructor(e,t){super(t.name??`${e.name}_audit`,t.graph),this._target=e,this._log=et([],{name:"entries",...t.maxSize!=null?{maxSize:t.maxSize}:{}}),this.entries=this._log.entries,this.add(this.entries,{name:"entries"}),this.count=F([this.entries],([d])=>d.length,{name:"count",describeKind:"derived",meta:zn("count")}),this.add(this.count,{name:"count"}),this.addDisposer(K(this.count));let n=t.includeTypes!=null?new Set(t.includeTypes):new Set(Er);this.includeTypes=n;let s=t.filter,o=0,i=e.observe({timeline:!0,structured:!0}),a=i.onEvent(d=>{if(d.type==="derived")return;let u=d.type;if(!n.has(u))return;let l=d.path??"",h={seq:o++,timestamp_ns:d.timestamp_ns??B(),wall_clock_ns:ne(),path:l,type:u},g=(l?It(e,l):void 0)?.lastMutation;g!=null&&(h.actor=g.actor),u==="data"&&(h.value=d.data),u==="error"&&(h.error=d.data);let c=l?Rr(e,l):void 0;c!=null&&(h.annotation=c),!(s!=null&&!s(h))&&this._log.append(h)});this.addDisposer(()=>{a(),i.dispose()}),this.addDisposer(()=>this._log.disposeAllViews())}all(){return this.entries.cache??[]}byNode(e){return this.all().filter(t=>t.path===e)}byActor(e){return this.all().filter(t=>t.actor?.id===e)}byActorType(e){return this.all().filter(t=>t.actor?.type===e)}byTimeRange(e,t){return this.all().filter(n=>!(n.timestamp_ns<e||t!=null&&n.timestamp_ns>=t))}get target(){return this._target}};function $t(r,e={}){return new at(r,e)}var dt=class extends j{policies;violations;violationCount;_target;_mode;_currentGuard;constructor(e,t,n){super(n.name??`${e.name}_policy`,n.graph),this._target=e,this._mode=n.mode??"audit";let s=Fn(t)?t:W(t,{name:"policies"});this.policies=s,this.add(this.policies,{name:"policies"}),this.violations=new Ee("violations",{retainedLimit:n.violationsLimit??1e3}),this.mount("violations",this.violations),this.violationCount=F([this.violations.events],([c])=>c.length,{name:"violationCount",describeKind:"derived",meta:zn("policy_violation_count")}),this.add(this.violationCount,{name:"violationCount"}),this.addDisposer(K(this.violationCount));let i=s.cache??[];this._currentGuard=bt(i);let a=s.subscribe(c=>{for(let v of c)v[0]===D&&(i=v[1]??[],this._currentGuard=bt(i))});this.addDisposer(a);let d=n.paths,u=Fn(d)?d:void 0,l=d!=null,f=u!=null?u.cache??[]:l?[...d]:void 0,g=f??Vn(e);if(this._mode!=="enforce"&&u!=null){let c=u.subscribe(v=>{for(let p of v)p[0]===D&&(f=p[1]??[])});this.addDisposer(c)}if(this._mode==="enforce"){let c=new Map,v=p=>{if(c.has(p))return;let T=It(e,p);if(!(T instanceof $))return;let _=(b,y)=>{let w=this._currentGuard(b,y);return w||this._publishViolation(b,y,p,"blocked"),w};c.set(p,T._pushGuard(_))};for(let p of g)v(p);if(u!=null){let p=u.subscribe(T=>{for(let _ of T){if(_[0]!==D)continue;let b=_[1]??[],y=new Set(b),w=new Set(f??[]);le(()=>{for(let x of w){if(y.has(x))continue;let m=c.get(x);m!=null&&(m(),c.delete(x))}for(let x of y)w.has(x)||v(x);f=b})}});this.addDisposer(p)}if(l){let p=e.topology.subscribe(T=>{for(let _ of T){if(_[0]!==D)continue;let b=_[1];if(b.kind!=="removed"||b.nodeKind!=="node")continue;let y=c.get(b.name);y!=null&&(y(),c.delete(b.name))}});this.addDisposer(p)}else{let p=$e(e,(T,_,b)=>{if(T.kind==="added")if(T.nodeKind==="node")v(`${b}${T.name}`);else{let y=_._mounts.get(T.name);if(!(y instanceof j))return;let w=`${b}${T.name}::`,x=Vn(y);for(let m of x)v(m===""?`${b}${T.name}`:`${w}${m}`)}else if(T.kind==="removed")if(T.nodeKind==="node"){let y=`${b}${T.name}`,w=c.get(y);w!=null&&(w(),c.delete(y))}else{let y=`${b}${T.name}`,w=`${y}::`;for(let[x,m]of c)(x===y||x.startsWith(w))&&(m(),c.delete(x))}});this.addDisposer(p)}this.addDisposer(()=>{for(let p of c.values())p();c.clear()})}else{let c=e.observe({timeline:!0,structured:!0}),v=c.onEvent(p=>{if(p.type!=="data"&&p.type!=="error")return;let T=p.path??"";if(!T||f!=null&&!f.includes(T))return;let _=p.actor??It(e,T)?.lastMutation?.actor;if(_==null)return;let b="write";this._currentGuard(_,b)||this._publishViolation(_,b,T,"observed")});this.addDisposer(()=>{v(),c.dispose()})}}_publishViolation(e,t,n,s){this.violations.publish({timestamp_ns:B(),wall_clock_ns:ne(),path:n,actor:e,action:t,mode:this._mode,result:s})}all(){return this.violations.retained()}get mode(){return this._mode}get target(){return this._target}};function Ft(r,e,t={}){let n=new dt(r,e,t);return n.tagFactory("policyGate",Xe(t)),n}function Vt(r,e={}){let t={format_version:1,timestamp_ns:B(),wall_clock_ns:ne(),graph:r.snapshot()};if(e.actor!=null&&(t.actor=e.actor),e.audit!=null){let s=[...e.audit.all()];t.audit={count:s.length,entries:s}}if(e.policies!=null){let s=e.policies.policies.cache??[];t.policies={mode:e.policies.mode,rules:s,violations:[...e.policies.all()]}}let n=Sr(t);return{...t,fingerprint:n}}function Fn(r){return typeof r=="object"&&r!==null&&"subscribe"in r}function It(r,e){try{return r.node(e)}catch{return}}function Rr(r,e){try{return r.annotation(e)}catch{return}}function Vn(r){let e=r.describe({detail:"minimal"});return Object.keys(e.nodes)}function Sr(r){return Ce(JSON.stringify(Dr(r)))}function Dr(r){let e=new Set,t=n=>{if(n===void 0)return{__undefined:!0};if(n===null)return null;let s=typeof n;if(s==="bigint")return{__bigint:n.toString()};if(s!=="object")return n;let o=n;if(e.has(o))return{__circular:!0};e.add(o);try{if(Array.isArray(o))return o.map(t);if(o instanceof Date)return{__date:o.toISOString()};if(o instanceof RegExp)return{__regexp:{source:o.source,flags:o.flags}};if(o instanceof Map)return{__map:[...o.entries()].map(([d,u])=>[t(d),t(u)])};if(o instanceof Set)return{__set:[...o].map(t)};if(ArrayBuffer.isView(o)){let a=o,d=new Array(a.length);for(let u=0;u<a.length;u++)d[u]=a[u]??0;return{__typed_array:{ctor:o.constructor.name,data:d}}}let i={};for(let a of Object.keys(o).sort())i[a]=t(o[a]);return i}finally{e.delete(o)}};return t(r)}pe();re();me();Me();ke();Ae();function zt(r){return typeof r=="object"&&r!==null&&"subscribe"in r&&"down"in r}function Gr(r){return ie("guarded",r)}var ut=class extends j{enforcer;violations;lints;scope;scopedDescribe;_target;_actorNode;_mode;_firedLintKinds=new Set;constructor(e,t){super(t.name??`${e.name}_guarded`,t.graph),this._target=e,this._mode=t.mode??"enforce";let n=t.policies,s=zt(n);if(!s&&this._mode==="enforce"&&n.length===0)throw new RangeError('guardedExecution: empty `policies` in `mode: "enforce"` denies every action. Pass at least `{ effect: "allow", action: "*" }` and layer deny rules on top.');this.lints=new Ee("lints",{retainedLimit:t.lintsLimit??64}),this.mount("lints",this.lints);let o=t.actor;o==null?this._actorNode=W(null,{name:"actor"}):zt(o)?this._actorNode=F([o],([d])=>d??null,{name:"actor",initial:null}):this._actorNode=W(o,{name:"actor"});let i={mode:this._mode,name:"enforcer"};if(t.violationsLimit!=null&&(i.violationsLimit=t.violationsLimit),this.enforcer=Ft(e,t.policies,i),this.violations=this.enforcer.violations,this.mount("enforcer",this.enforcer),s&&this._mode==="enforce"){let d=n,u=d.cache;u!=null&&u.length===0&&this._fireLint("empty-policies",'`policies` Node cached an empty array in `mode: "enforce"` \u2014 every action will be denied. Add at least one allow rule.');let l=d.subscribe(h=>{for(let f of h){if(f[0]!==D)continue;let g=f[1];(g==null||g.length===0)&&this._fireLint("empty-policies",'`policies` Node emitted an empty array in `mode: "enforce"` \u2014 every action will be denied. Add at least one allow rule.')}});this.addDisposer(l)}if(this._mode==="audit"){let d=e.describe({detail:"full"});Object.values(d.nodes).some(l=>l.guard!=null)||this._fireLint("audit-no-effect",'`mode: "audit"` + target has no per-node guards \u2014 `scopedDescribeNode` filters by per-node guards only, so policy rules will not affect describe() visibility. Policies still populate the `violations` topic on writes.')}o==null&&this._fireLint("no-actor","no actor configured \u2014 `wrapper.scopedDescribe` and `scopedDescribeNode()` will return an unscoped describe (full visibility) unless a per-call actor is supplied."),this.scope=F([this._actorNode,this.enforcer.policies],([d,u])=>({actor:d??null,mode:this._mode,policiesCount:u.length}),{name:"scope",describeKind:"derived",meta:Gr("scope")}),this.add(this.scope,{name:"scope"}),this.addDisposer(K(this.scope));let a=e.describe({reactive:!0,actor:this._actorNode,reactiveName:"scopedDescribe"});this.scopedDescribe=a.node,this.add(this.scopedDescribe,{name:"scopedDescribe"}),this.addDisposer(a.dispose)}_fireLint(e,t){this._firedLintKinds.has(e)||(this._firedLintKinds.add(e),this.lints.publish({kind:e,message:t,timestamp_ns:B()}))}scopedDescribeNode(e,t){let n=e==null?this._actorNode:zt(e)?e:W(e,{name:"actor_override"}),s=this._target.describe({reactive:!0,actor:n,...t??{}});return this.addDisposer(s.dispose),{node:s.node,dispose:s.dispose}}get target(){return this._target}};function Cr(r,e){return new ut(r,e)}me();Me();ke();Ae();Ae();function jn(r){let e=[];for(let[t,n]of Object.entries(r.nodes)){if(n.status!=="errored")continue;let s={path:t,status:"errored"},o=Ie(r,t,"upstream",{});for(let i of o)if(i!==t&&r.nodes[i]?.status==="errored"){s.upstreamCause=i;break}e.push(s)}return e.sort((t,n)=>t.path<n.path?-1:t.path>n.path?1:0),{ok:e.length===0,problems:e}}function Hn(r,e){if(r.ok!==e.ok||r.problems.length!==e.problems.length)return!1;for(let t=0;t<r.problems.length;t++){let n=r.problems[t],s=e.problems[t];if(n.path!==s.path||n.status!==s.status||n.upstreamCause!==s.upstreamCause)return!1}return!0}function jt(r){let e=r.describe({reactive:!0,detail:"standard",reactiveName:"graphLens.topology"}),t=e.node,n=F([t],([h])=>jn(h),{name:"graphLens.health",describeKind:"derived",equals:Hn,meta:ie("lens","health")}),s=K(n),o=new Map,i=-1,a=r.observe({reactive:!0,tiers:["data"]}),d=F([a,t],([h,f])=>{let g=h,c=f;if(g!=null&&g.flushedAt_ns>i){i=g.flushedAt_ns;for(let v of g.events){if(v.type!=="data")continue;let p=v.path;if(p==null||p==="")continue;let T=o.get(p);o.set(p,{path:p,count:(T?.count??0)+1,lastUpdate_ns:g.flushedAt_ns})}}if(c!=null&&o.size>0){let v=new Set(Object.keys(c.nodes));for(let p of[...o.keys()])v.has(p)||o.delete(p)}return new Map(o)},{name:"graphLens.flow",describeKind:"derived",meta:ie("lens","flow")}),u=K(d),l=!1;return{topology:t,health:n,flow:d,dispose(){l||(l=!0,u(),s(),e.dispose())}}}Ze();it();var Ht=class extends j{view;constructor(e){super("lens"),this.view=jt(e),this.add(this.view.topology,{name:"topology"}),this.add(this.view.health,{name:"health"}),this.add(this.view.flow,{name:"flow"})}},ct=class extends j{target;lens;audit;_defaultActor;_lensSubgraph;constructor(e,t={}){super(t.name??`inspect(${e.name})`),this.target=e,this._defaultActor=t.actor,this._lensSubgraph=new Ht(e),this.lens=this._lensSubgraph.view,this.mount("lens",this._lensSubgraph),this.audit=$t(e,t.audit??{}),this.mount("audit",this.audit),this.addDisposer(()=>this.lens.dispose())}explainTarget(e,t,n){return this.target.explain(e,t,n)}complianceSnapshot(e){let t=e?.actor??this._defaultActor;return Vt(this.target,{audit:this.audit,...t!=null?{actor:t}:{},...e?.policies!=null?{policies:e.policies}:{}})}};function Mr(r,e={}){let t=new ct(r,e);return t.tagFactory("inspect",Xe(e)),t}0&&(module.exports={AuditTrailGraph,GuardedExecutionGraph,InspectGraph,PolicyGateGraph,auditTrail,complianceSnapshot,computeHealthReport,graphLens,guardedExecution,healthReportEqual,inspect,policyGate,watchTopologyTree});
@@ -1,4 +1,4 @@
1
- export { A as AuditEntry, a as AuditTrailGraph, b as AuditTrailOptions, C as ComplianceSnapshotOptions, c as ComplianceSnapshotResult, F as FlowEntry, G as GraphLensView, d as GuardedExecutionGraph, e as GuardedExecutionLint, f as GuardedExecutionOptions, g as GuardedScope, H as HealthProblem, h as HealthReport, I as InspectGraph, j as InspectOptions, P as PolicyGateGraph, k as PolicyGateOptions, l as PolicyViolation, m as auditTrail, n as complianceSnapshot, o as computeHealthReport, p as graphLens, q as guardedExecution, r as healthReportEqual, s as inspect, t as policyGate } from '../../index-CPNSy-U0.cjs';
1
+ export { A as AuditEntry, a as AuditTrailGraph, b as AuditTrailOptions, C as ComplianceSnapshotOptions, c as ComplianceSnapshotResult, F as FlowEntry, G as GraphLensView, d as GuardedExecutionGraph, e as GuardedExecutionLint, f as GuardedExecutionOptions, g as GuardedScope, H as HealthProblem, h as HealthReport, I as InspectGraph, j as InspectOptions, P as PolicyGateGraph, k as PolicyGateOptions, l as PolicyViolation, m as auditTrail, n as complianceSnapshot, o as computeHealthReport, p as graphLens, q as guardedExecution, r as healthReportEqual, s as inspect, t as policyGate } from '../../index-DyR7eU5S.cjs';
2
2
  export { e as DescribeFilter } from '../../graph-C4SHb3Ly.cjs';
3
3
  export { w as watchTopologyTree } from '../../topology-tree-BSdfSwMi.cjs';
4
4
  import '../../node-ClS5yC-B.cjs';
@@ -1,4 +1,4 @@
1
- export { A as AuditEntry, a as AuditTrailGraph, b as AuditTrailOptions, C as ComplianceSnapshotOptions, c as ComplianceSnapshotResult, F as FlowEntry, G as GraphLensView, d as GuardedExecutionGraph, e as GuardedExecutionLint, f as GuardedExecutionOptions, g as GuardedScope, H as HealthProblem, h as HealthReport, I as InspectGraph, j as InspectOptions, P as PolicyGateGraph, k as PolicyGateOptions, l as PolicyViolation, m as auditTrail, n as complianceSnapshot, o as computeHealthReport, p as graphLens, q as guardedExecution, r as healthReportEqual, s as inspect, t as policyGate } from '../../index-BeT2r7sk.js';
1
+ export { A as AuditEntry, a as AuditTrailGraph, b as AuditTrailOptions, C as ComplianceSnapshotOptions, c as ComplianceSnapshotResult, F as FlowEntry, G as GraphLensView, d as GuardedExecutionGraph, e as GuardedExecutionLint, f as GuardedExecutionOptions, g as GuardedScope, H as HealthProblem, h as HealthReport, I as InspectGraph, j as InspectOptions, P as PolicyGateGraph, k as PolicyGateOptions, l as PolicyViolation, m as auditTrail, n as complianceSnapshot, o as computeHealthReport, p as graphLens, q as guardedExecution, r as healthReportEqual, s as inspect, t as policyGate } from '../../index-JZUPJIJy.js';
2
2
  export { e as DescribeFilter } from '../../graph-7VguS7a4.js';
3
3
  export { w as watchTopologyTree } from '../../topology-tree-BNGvuG82.js';
4
4
  import '../../node-ClS5yC-B.js';
@@ -1 +1 @@
1
- import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m}from"../../chunk-VE5SIZEM.js";import"../../chunk-4QH6VJF4.js";import"../../chunk-4I45FVQS.js";import"../../chunk-3ZZX7M25.js";import"../../chunk-L6NSJVJZ.js";import"../../chunk-LDQ3IUIP.js";import{a}from"../../chunk-XLQPNNIC.js";import"../../chunk-3G5U5QNE.js";import"../../chunk-C72GO4IZ.js";import"../../chunk-ACMJ2ZPS.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-2K5RXLAH.js";import"../../chunk-35JTVPOX.js";import"../../chunk-LYCLF26R.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{b as AuditTrailGraph,g as GuardedExecutionGraph,l as InspectGraph,d as PolicyGateGraph,c as auditTrail,f as complianceSnapshot,i as computeHealthReport,k as graphLens,h as guardedExecution,j as healthReportEqual,m as inspect,e as policyGate,a as watchTopologyTree};
1
+ import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m}from"../../chunk-EBW4V6JN.js";import"../../chunk-OYJKFY7V.js";import"../../chunk-4I45FVQS.js";import"../../chunk-FDQGFWLF.js";import"../../chunk-L6NSJVJZ.js";import{a}from"../../chunk-KVV66NN2.js";import"../../chunk-3G5U5QNE.js";import"../../chunk-C72GO4IZ.js";import"../../chunk-626TESAC.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-35JTVPOX.js";import"../../chunk-JQFH2DV6.js";import"../../chunk-V5A7M7RJ.js";import"../../chunk-LYCLF26R.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{b as AuditTrailGraph,g as GuardedExecutionGraph,l as InspectGraph,d as PolicyGateGraph,c as auditTrail,f as complianceSnapshot,i as computeHealthReport,k as graphLens,h as guardedExecution,j as healthReportEqual,m as inspect,e as policyGate,a as watchTopologyTree};