@graphrefly/graphrefly 0.30.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{cascading-dNCtjW8j.d.cts → cascading-BfQmSmjU.d.cts} +21 -2
- package/dist/{cascading-BszPheHD.d.ts → cascading-D3sapjue.d.ts} +21 -2
- package/dist/chunk-2JNT5NDF.js +61 -0
- package/dist/{chunk-DDPYNMGG.js → chunk-2RH4QNDQ.js} +1 -1
- package/dist/chunk-4JBKKUCJ.js +7 -0
- package/dist/{chunk-SLMYTGTU.js → chunk-4UUDNFYG.js} +1 -1
- package/dist/chunk-4VXL3UZK.js +1 -0
- package/dist/{chunk-SHYH5SXV.js → chunk-4YGJ7KZ6.js} +1 -1
- package/dist/{chunk-GJR3P6JG.js → chunk-5PBXUVHI.js} +1 -1
- package/dist/{chunk-W4TSQ6RJ.js → chunk-7AJKUA36.js} +1 -1
- package/dist/{chunk-XQAXYVXX.js → chunk-7EMUF2RY.js} +1 -1
- package/dist/chunk-7JZ3YORY.js +80 -0
- package/dist/chunk-7QMVU3IX.js +1 -0
- package/dist/{chunk-WANIEEKV.js → chunk-7QS77X6G.js} +1 -1
- package/dist/{chunk-BA5URFYW.js → chunk-A4JT4SAD.js} +1 -1
- package/dist/{chunk-Y36UZ5VS.js → chunk-BU4SUZSA.js} +1 -1
- package/dist/{chunk-P7JXGKDO.js → chunk-CNXUW2CU.js} +1 -1
- package/dist/{chunk-Y32RJO24.js → chunk-CZVYLXFK.js} +1 -1
- package/dist/{chunk-567NWZ3T.js → chunk-DWIAG62L.js} +1 -1
- package/dist/chunk-EIFHFDFD.js +1 -0
- package/dist/chunk-FTA5TB2A.js +1 -0
- package/dist/{chunk-T5SHIKJD.js → chunk-JAHAJU4G.js} +1 -1
- package/dist/{chunk-AV3PIDFQ.js → chunk-JYMNVEH6.js} +1 -1
- package/dist/{chunk-5Z4HDCO6.js → chunk-K54OKWNY.js} +1 -1
- package/dist/chunk-KD3IYBTD.js +3 -0
- package/dist/{chunk-3NEPQO2E.js → chunk-LG73TUF4.js} +2 -2
- package/dist/chunk-LJGPOJHS.js +1 -0
- package/dist/chunk-LWGLBCMU.js +1 -0
- package/dist/{chunk-BKPLTBL5.js → chunk-M2VFLRPJ.js} +1 -1
- package/dist/{chunk-GNCBXARM.js → chunk-MFNOZ5E6.js} +1 -1
- package/dist/{chunk-TWMEGG45.js → chunk-N2KKISCE.js} +1 -1
- package/dist/chunk-PNTBXOQ6.js +5 -0
- package/dist/{chunk-73Z3W2RN.js → chunk-PWKLZ2XU.js} +1 -1
- package/dist/{chunk-7TDOES3L.js → chunk-Q2SY7M7K.js} +1 -1
- package/dist/{chunk-OL33ZI6R.js → chunk-RWGJQQLT.js} +1 -1
- package/dist/chunk-SGS4OJGS.js +1 -0
- package/dist/{chunk-4OFIQ66T.js → chunk-TOCCHQI6.js} +1 -1
- package/dist/chunk-UMH3HSP7.js +1 -0
- package/dist/{chunk-XHVB6G6M.js → chunk-UXEB35L4.js} +1 -1
- package/dist/{chunk-33FA6V4B.js → chunk-VXJX3ZZP.js} +1 -1
- package/dist/{chunk-BZP5T4X6.js → chunk-W6FQIFVE.js} +1 -1
- package/dist/{chunk-RD52SNH2.js → chunk-WE32AFFA.js} +1 -1
- package/dist/{chunk-KA6MMXIY.js → chunk-WF3V5X2L.js} +1 -1
- package/dist/chunk-WQ7I7JVU.js +1 -0
- package/dist/{chunk-4JJCCD5S.js → chunk-X4OOM6QU.js} +1 -1
- package/dist/{chunk-AUY2YKCO.js → chunk-XRSHMHEG.js} +1 -1
- package/dist/chunk-Y26UN6J5.js +18 -0
- package/dist/{chunk-VWPRPPKR.js → chunk-ZWETYYQG.js} +1 -1
- package/dist/compat/index.cjs +2 -2
- package/dist/compat/index.d.cts +5 -5
- package/dist/compat/index.d.ts +5 -5
- package/dist/compat/index.js +1 -1
- package/dist/compat/jotai/index.cjs +1 -1
- package/dist/compat/jotai/index.js +1 -1
- package/dist/compat/nanostores/index.cjs +1 -1
- package/dist/compat/nanostores/index.js +1 -1
- package/dist/compat/nestjs/index.cjs +5 -5
- package/dist/compat/nestjs/index.d.cts +3 -3
- package/dist/compat/nestjs/index.d.ts +3 -3
- package/dist/compat/nestjs/index.js +1 -1
- package/dist/compat/zustand/index.cjs +2 -2
- package/dist/compat/zustand/index.d.cts +2 -2
- package/dist/compat/zustand/index.d.ts +2 -2
- package/dist/compat/zustand/index.js +1 -1
- package/dist/{composite-DGspwCqk.d.ts → composite-BY9hMxN7.d.ts} +1 -1
- package/dist/{composite-nrRumJ7l.d.cts → composite-CH0S8DFn.d.cts} +1 -1
- package/dist/content-addressed-storage-BUiREIuj.d.ts +124 -0
- package/dist/content-addressed-storage-DqIWCmZG.d.cts +124 -0
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.js +1 -1
- package/dist/extra/browser.cjs +1 -1
- package/dist/extra/browser.js +1 -1
- package/dist/extra/index.cjs +18 -18
- package/dist/extra/index.d.cts +7 -6
- package/dist/extra/index.d.ts +7 -6
- package/dist/extra/index.js +1 -1
- package/dist/extra/node.cjs +2 -2
- package/dist/extra/node.js +1 -1
- package/dist/extra/operators.cjs +1 -1
- package/dist/extra/operators.d.cts +41 -1
- package/dist/extra/operators.d.ts +41 -1
- package/dist/extra/operators.js +1 -1
- package/dist/extra/reactive.cjs +1 -1
- package/dist/extra/reactive.d.cts +1 -1
- package/dist/extra/reactive.d.ts +1 -1
- package/dist/extra/reactive.js +1 -1
- package/dist/extra/sources.cjs +1 -1
- package/dist/extra/sources.d.cts +62 -2
- package/dist/extra/sources.d.ts +62 -2
- package/dist/extra/sources.js +1 -1
- package/dist/extra/storage-browser.cjs +1 -1
- package/dist/extra/storage-browser.js +1 -1
- package/dist/{fallback-BaTS7vVY.d.cts → fallback-Cb3GH1O7.d.cts} +6 -14
- package/dist/{fallback-eOm3LNxP.d.ts → fallback-DRjJ_ZM8.d.ts} +6 -14
- package/dist/graph/index.cjs +4 -4
- package/dist/graph/index.d.cts +3 -3
- package/dist/graph/index.d.ts +3 -3
- package/dist/graph/index.js +1 -1
- package/dist/{graph-CWeI0aHd.d.ts → graph-BOhEGJ6E.d.ts} +10 -0
- package/dist/{graph-C4Uxwv0T.d.cts → graph-CdJeX7O7.d.cts} +10 -0
- package/dist/{index-B-z8WaSd.d.cts → index-BDLy6CQ9.d.cts} +1 -1
- package/dist/{index-iBp74eGU.d.cts → index-BJDXj9Wf.d.cts} +2 -2
- package/dist/{index-BBINVimG.d.ts → index-BUZPTPSQ.d.ts} +2 -2
- package/dist/{index-DnrZghBB.d.ts → index-BbcSZCAG.d.ts} +1 -1
- package/dist/{index-lKuLYmHO.d.cts → index-BiGeETJs.d.cts} +1 -1
- package/dist/{index-BHu_Wba0.d.cts → index-BmZb8fNF.d.cts} +3 -3
- package/dist/{index-Docdiu9a.d.ts → index-Bnmttu35.d.ts} +1 -1
- package/dist/{index-D6ajK8Mh.d.cts → index-BuN2wGJs.d.cts} +517 -134
- package/dist/{index-Cy7eFeIX.d.cts → index-BwdPDWI4.d.cts} +1 -1
- package/dist/{index-DylQCKEL.d.cts → index-BzxU4yhV.d.cts} +11 -2
- package/dist/{index-D9Y_u6BG.d.cts → index-C-Gsh-0a.d.cts} +2 -2
- package/dist/{index-ybtSyjWB.d.cts → index-C22aTC1X.d.cts} +5 -5
- package/dist/{index-yIdWFo2b.d.cts → index-C4QTaDli.d.cts} +2 -2
- package/dist/{index-BJHQUCZx.d.ts → index-C7RqYbOZ.d.ts} +82 -7
- package/dist/{index-C5Ghnp5B.d.ts → index-C9qCLIN4.d.ts} +2 -2
- package/dist/{index-DVNLe3pS.d.cts → index-CCdg0JLX.d.cts} +1 -1
- package/dist/{index-B5iVOD7w.d.ts → index-CEoU-r-g.d.ts} +2 -2
- package/dist/{index-CfFYyLR8.d.ts → index-CHfBm51k.d.ts} +11 -2
- package/dist/{index-Dljd76bC.d.ts → index-CNyiYQWF.d.ts} +5 -5
- package/dist/{index-C6NBfXj-.d.ts → index-CVevMZ0n.d.ts} +2 -2
- package/dist/{index-DGb1awva.d.ts → index-CZUzi6Dy.d.ts} +2 -2
- package/dist/{index-FrYrV-Vf.d.ts → index-Ckl03Q0s.d.ts} +1 -1
- package/dist/{index-Bvi5uJxX.d.ts → index-CmSjld-4.d.ts} +1 -1
- package/dist/{index-9iguV3bF.d.cts → index-CnjUhRbs.d.cts} +2 -2
- package/dist/{index-C98oJsEs.d.cts → index-D3HcdZ4d.d.cts} +1 -1
- package/dist/{index-IZ3l_vQ9.d.ts → index-DD1czHj3.d.ts} +1 -1
- package/dist/{index-BS220yqj.d.cts → index-DNhTQReY.d.cts} +82 -7
- package/dist/{index-UZO988ox.d.cts → index-DSawGt8n.d.cts} +2 -2
- package/dist/{index-CcpEvuPl.d.cts → index-DUkuH3jP.d.cts} +1 -1
- package/dist/{index-CRAkoq-y.d.cts → index-DY2QbdoP.d.cts} +1 -1
- package/dist/{index-CvS9IuTG.d.ts → index-Dbmj0iYR.d.ts} +1 -1
- package/dist/{index-ClgKmOHe.d.ts → index-DhlAMlm9.d.ts} +517 -134
- package/dist/{index-ClB7TCfL.d.cts → index-DlGaEBW5.d.cts} +2 -2
- package/dist/{index-CotRMjtJ.d.ts → index-Dp_pS7Bw.d.ts} +1 -1
- package/dist/{index-Cc8VQIgL.d.ts → index-Dxk-pUQI.d.ts} +2 -2
- package/dist/{index-DBQUKh59.d.cts → index-EGjF6iSY.d.cts} +3 -3
- package/dist/{index-D9HrBx2J.d.ts → index-LGzAYqdR.d.ts} +1 -1
- package/dist/{index-DR3gf_DG.d.cts → index-LzCJ0kMT.d.cts} +2 -2
- package/dist/{index-RQg6lTrN.d.ts → index-MV2yGIAq.d.ts} +2 -2
- package/dist/{index-Bs3-LC83.d.cts → index-_BXz9K7b.d.cts} +1 -1
- package/dist/{index-SSGqF8mI.d.cts → index-aBqZUx3B.d.cts} +1 -1
- package/dist/{index-CFW32Dy1.d.ts → index-eYHRkoK-.d.ts} +1 -1
- package/dist/{index-B2HBxvMb.d.ts → index-gXTVbSax.d.ts} +3 -3
- package/dist/{index-B8Aj_z8S.d.cts → index-j33Lfb1G.d.cts} +23 -2
- package/dist/{index-BEpRsvhg.d.ts → index-lpGUhTBn.d.ts} +3 -3
- package/dist/{index-BXbQUn4n.d.ts → index-zMQIQuDu.d.ts} +23 -2
- package/dist/index.cjs +106 -125
- package/dist/index.d.cts +34 -33
- package/dist/index.d.ts +34 -33
- package/dist/index.js +1 -1
- package/dist/patterns/ai/browser.cjs +5 -22
- package/dist/patterns/ai/browser.d.cts +3 -3
- package/dist/patterns/ai/browser.d.ts +3 -3
- package/dist/patterns/ai/browser.js +1 -1
- package/dist/patterns/ai/index.cjs +30 -44
- package/dist/patterns/ai/index.d.cts +13 -11
- package/dist/patterns/ai/index.d.ts +13 -11
- package/dist/patterns/ai/index.js +1 -1
- package/dist/patterns/ai/node.cjs +2 -2
- package/dist/patterns/ai/node.d.cts +5 -4
- package/dist/patterns/ai/node.d.ts +5 -4
- package/dist/patterns/ai/node.js +1 -1
- package/dist/patterns/audit/index.cjs +3 -3
- package/dist/patterns/audit/index.d.cts +3 -3
- package/dist/patterns/audit/index.d.ts +3 -3
- package/dist/patterns/audit/index.js +1 -1
- package/dist/patterns/cqrs/index.cjs +6 -6
- package/dist/patterns/cqrs/index.d.cts +2 -2
- package/dist/patterns/cqrs/index.d.ts +2 -2
- package/dist/patterns/cqrs/index.js +1 -1
- package/dist/patterns/demo-shell/index.cjs +2 -2
- package/dist/patterns/demo-shell/index.d.cts +3 -3
- package/dist/patterns/demo-shell/index.d.ts +3 -3
- package/dist/patterns/demo-shell/index.js +1 -1
- package/dist/patterns/domain-templates/index.cjs +6 -6
- package/dist/patterns/domain-templates/index.d.cts +2 -2
- package/dist/patterns/domain-templates/index.d.ts +2 -2
- package/dist/patterns/domain-templates/index.js +1 -1
- package/dist/patterns/graphspec/index.cjs +27 -25
- package/dist/patterns/graphspec/index.d.cts +3 -3
- package/dist/patterns/graphspec/index.d.ts +3 -3
- package/dist/patterns/graphspec/index.js +1 -1
- package/dist/patterns/guarded-execution/index.cjs +7 -7
- package/dist/patterns/guarded-execution/index.d.cts +4 -4
- package/dist/patterns/guarded-execution/index.d.ts +4 -4
- package/dist/patterns/guarded-execution/index.js +1 -1
- package/dist/patterns/harness/index.cjs +12 -11
- package/dist/patterns/harness/index.d.cts +6 -6
- package/dist/patterns/harness/index.d.ts +6 -6
- package/dist/patterns/harness/index.js +1 -1
- package/dist/patterns/job-queue/index.cjs +5 -5
- package/dist/patterns/job-queue/index.d.cts +2 -2
- package/dist/patterns/job-queue/index.d.ts +2 -2
- package/dist/patterns/job-queue/index.js +1 -1
- package/dist/patterns/lens/index.cjs +5 -5
- package/dist/patterns/lens/index.d.cts +4 -4
- package/dist/patterns/lens/index.d.ts +4 -4
- package/dist/patterns/lens/index.js +1 -1
- package/dist/patterns/memory/index.cjs +4 -4
- package/dist/patterns/memory/index.d.cts +2 -2
- package/dist/patterns/memory/index.d.ts +2 -2
- package/dist/patterns/memory/index.js +1 -1
- package/dist/patterns/messaging/index.cjs +5 -5
- package/dist/patterns/messaging/index.d.cts +2 -2
- package/dist/patterns/messaging/index.d.ts +2 -2
- package/dist/patterns/messaging/index.js +1 -1
- package/dist/patterns/orchestration/index.cjs +7 -7
- package/dist/patterns/orchestration/index.d.cts +2 -2
- package/dist/patterns/orchestration/index.d.ts +2 -2
- package/dist/patterns/orchestration/index.js +1 -1
- package/dist/patterns/reactive-layout/index.cjs +2 -2
- package/dist/patterns/reactive-layout/index.d.cts +3 -3
- package/dist/patterns/reactive-layout/index.d.ts +3 -3
- package/dist/patterns/reactive-layout/index.js +1 -1
- package/dist/patterns/reduction/index.cjs +5 -5
- package/dist/patterns/reduction/index.d.cts +2 -2
- package/dist/patterns/reduction/index.d.ts +2 -2
- package/dist/patterns/reduction/index.js +1 -1
- package/dist/patterns/refine-loop/index.cjs +8 -8
- package/dist/patterns/refine-loop/index.d.cts +3 -3
- package/dist/patterns/refine-loop/index.d.ts +3 -3
- package/dist/patterns/refine-loop/index.js +1 -1
- package/dist/patterns/resilient-pipeline/index.cjs +1 -1
- package/dist/patterns/resilient-pipeline/index.d.cts +3 -3
- package/dist/patterns/resilient-pipeline/index.d.ts +3 -3
- package/dist/patterns/resilient-pipeline/index.js +1 -1
- package/dist/patterns/surface/index.cjs +15 -13
- package/dist/patterns/surface/index.d.cts +4 -4
- package/dist/patterns/surface/index.d.ts +4 -4
- package/dist/patterns/surface/index.js +1 -1
- package/dist/{reactive-layout-BAr6-_o5.d.ts → reactive-layout-Bq0rA2Wb.d.ts} +1 -1
- package/dist/{reactive-layout-5oEn8lHM.d.cts → reactive-layout-Dhhe54Oj.d.cts} +1 -1
- package/dist/{reactive-map-BvDrRuwt.d.ts → reactive-map-CtRaCddO.d.ts} +59 -1
- package/dist/{reactive-map-CmlPPKHN.d.cts → reactive-map-IJIfZxoh.d.cts} +59 -1
- package/dist/{resilience-XRUF267O.js → resilience-IVNDYORD.js} +1 -1
- package/dist/{topology-tree-CVREibAc.d.cts → topology-tree-CpSjvIXp.d.cts} +1 -1
- package/dist/{topology-tree-CkjojcB6.d.ts → topology-tree-DAbCV2Yw.d.ts} +1 -1
- package/dist/{types-O3GzJY2U.d.cts → types-BgMqbc7N.d.cts} +41 -14
- package/dist/{types-u64Ose53.d.ts → types-CdfO2QTt.d.ts} +41 -14
- package/package.json +1 -1
- package/dist/chunk-2GQREQ6C.js +0 -1
- package/dist/chunk-4C2OR2GH.js +0 -18
- package/dist/chunk-5JDE5JHE.js +0 -1
- package/dist/chunk-7JDLFI6N.js +0 -1
- package/dist/chunk-AMBYCIOH.js +0 -3
- package/dist/chunk-GLSM33ZM.js +0 -78
- package/dist/chunk-ISCENNXS.js +0 -1
- package/dist/chunk-IUK4EFCE.js +0 -1
- package/dist/chunk-KASHOCF5.js +0 -1
- package/dist/chunk-LI3E75VE.js +0 -64
- package/dist/chunk-MGKAO4EK.js +0 -7
- package/dist/chunk-NSG4C6BF.js +0 -23
- package/dist/chunk-VIEUJSTT.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as S,G as g,m as x}from"./chunk-
|
|
1
|
+
import{E as S,G as g,m as x}from"./chunk-7AJKUA36.js";import{b as z,c as w}from"./chunk-CK2E7BTU.js";var p=class{_version=0;_maxSize;_buf;_head=0;_size=0;constructor(n,i){if(i!==void 0&&i<1)throw new RangeError("maxSize must be >= 1");if(this._maxSize=i,i!==void 0){if(this._buf=new Array(i),n&&n.length>0){let r=Math.min(n.length,i),h=n.length-r;for(let l=0;l<r;l++)this._buf[l]=n[h+l];this._size=r}}else this._buf=n?[...n]:[],this._size=this._buf.length}get version(){return this._version}get size(){return this._size}at(n){if(!Number.isInteger(n))return;let i=n>=0?n:this._size+n;if(!(i<0||i>=this._size))return this._maxSize!==void 0?this._buf[(this._head+i)%this._maxSize]:this._buf[i]}append(n){this._rawAppend(n),this._version+=1}appendMany(n){if(n.length===0)return;let i=this._maxSize!==void 0&&n.length>this._maxSize?n.length-this._maxSize:0;for(let r=i;r<n.length;r++)this._rawAppend(n[r]);this._version+=1}clear(){if(this._size===0)return 0;let n=this._size;if(this._maxSize===void 0)this._buf.length=0;else for(let i=0;i<n;i++)this._buf[(this._head+i)%this._maxSize]=void 0;return this._head=0,this._size=0,this._version+=1,n}trimHead(n){if(!Number.isInteger(n)||n<0)throw new RangeError(`trimHead: n must be a non-negative integer (got ${n})`);if(n===0||this._size===0)return 0;let i=Math.min(n,this._size);if(this._maxSize===void 0)this._buf.splice(0,i);else{for(let r=0;r<i;r++)this._buf[(this._head+r)%this._maxSize]=void 0;this._head=(this._head+i)%this._maxSize}return this._size-=i,this._version+=1,i}slice(n,i){if(!Number.isInteger(n)||n<0)throw new RangeError(`slice: start must be a non-negative integer (got ${n})`);if(i!==void 0&&(!Number.isInteger(i)||i<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${i})`);let r=i===void 0?this._size:Math.min(Math.max(i,0),this._size),h=Math.min(n,this._size);if(h>=r)return[];let l=r-h;if(this._maxSize===void 0)return this._buf.slice(h,r);let s=new Array(l);for(let u=0;u<l;u++)s[u]=this._buf[(this._head+h+u)%this._maxSize];return s}tail(n){if(!Number.isInteger(n)||n<0)throw new RangeError(`tail: n must be a non-negative integer (got ${n})`);if(n===0||this._size===0)return[];let i=Math.min(n,this._size);return this.slice(this._size-i,this._size)}toArray(){if(this._maxSize===void 0)return[...this._buf];let n=new Array(this._size);for(let i=0;i<this._size;i++)n[i]=this._buf[(this._head+i)%this._maxSize];return n}_rawAppend(n){if(this._maxSize===void 0){this._buf.push(n),this._size=this._buf.length;return}this._size<this._maxSize?(this._buf[(this._head+this._size)%this._maxSize]=n,this._size+=1):(this._buf[this._head]=n,this._head=(this._head+1)%this._maxSize)}};function A(_){return _.subscribe(()=>{})}var E=64;function L(_,n={}){let{name:i,maxSize:r,versioning:h,backend:l}=n,s=l??new p(_,r),u=S(s.toArray(),{name:i,describeKind:"state",equals:(e,t)=>e===t,...h!=null?{versioning:h}:{}});function M(){let e=s.toArray();x(()=>{u.down([[w]]),u.down([[z,e]])})}let d=new Map,a=new Map;function v(e,t){return`${e}:${t===void 0?"END":t}`}function y(e){if(e.size<E)return;let t=e.keys().next();if(t.done)return;let o=e.get(t.value);o!==void 0&&o.dispose(),e.delete(t.value)}function b(e){let t=s.version;try{return e()}finally{s.version!==t&&M()}}return{entries:u,get size(){return s.size},at(e){return s.at(e)},append(e){b(()=>s.append(e))},appendMany(e){e.length!==0&&b(()=>s.appendMany(e))},clear(){b(()=>s.clear())},trimHead(e){b(()=>s.trimHead(e))},tail(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`tail: n must be a non-negative integer (got ${e})`);let t=d.get(e);if(t!==void 0)return d.delete(e),d.set(e,t),t.node;y(d);let o=g([u],([m])=>{let c=m;return e===0||c.length===0?[]:c.slice(Math.max(0,c.length-e))},{initial:s.tail(e),describeKind:"derived"}),f=A(o);return d.set(e,{node:o,dispose:f}),o},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 o=v(e,t),f=a.get(o);if(f!==void 0)return a.delete(o),a.set(o,f),f.node;y(a);let m=g([u],([k])=>{let T=k;return t===void 0?T.slice(e):T.slice(e,t)},{initial:s.slice(e,t),describeKind:"derived"}),c=A(m);return a.set(o,{node:m,dispose:c}),m},disposeTail(e){let t=d.get(e);return t===void 0?!1:(t.dispose(),d.delete(e),!0)},disposeSlice(e,t){let o=v(e,t),f=a.get(o);return f===void 0?!1:(f.dispose(),a.delete(o),!0)},disposeAllViews(){for(let e of d.values())e.dispose();d.clear();for(let e of a.values())e.dispose();a.clear()},dispose(){for(let e of d.values())e.dispose();d.clear();for(let e of a.values())e.dispose();a.clear()}}}export{p as a,L as b};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import{b as Ne,i as Re}from"./chunk-RWGJQQLT.js";import{a as Pe}from"./chunk-SGS4OJGS.js";import{x as fe}from"./chunk-WQ7I7JVU.js";import{a as Z,b as de,i as Oe}from"./chunk-4VVTGLXJ.js";import{f as pe}from"./chunk-UMH3HSP7.js";import{A as ee,D as be,E as U,F as B,m as _,p as D}from"./chunk-7AJKUA36.js";import{b as E,c as ye,d as ke,h as le,i as P,j as x}from"./chunk-CK2E7BTU.js";function Ce(r){return{describeKind:"producer",...r}}function oe(r,n){return B(i=>{let s=!0,u={emit(t){s&&i.emit(t)},error(t){s&&(s=!1,i.down([[x,t]]))},complete(){s&&(s=!1,i.down([[P]]))}},o;try{let t=r(u);o=typeof t=="function"?t:void 0}catch(t){return u.error(t),()=>{s=!1}}return()=>{s=!1;try{o?.()}catch{}}},Ce(n))}function Me(r,n,i){let s=!0,u,o=0,t=0,e={},a=[],l=()=>{let d=u;u=void 0;try{d?.()}catch{}};for(let d of n){let p=i?.name?`${i.name}::${d}`:d,g=i?.channelOpts?.[d],y=B(T=>(o++,()=>{t++,o>0&&t>=o&&t>=n.length&&l()}),Ce({...g,name:p}));e[d]=y,a.push(y)}let m={};for(let d of n)m[d]=p=>{s&&e[d].down([[E,p]])};m.error=d=>{s&&(s=!1,_(()=>{for(let p of a)p.down([[x,d]])}),l())},m.complete=()=>{s&&(s=!1,_(()=>{for(let d of a)d.down([[P]])}),l())};let f=r(m);return u=typeof f=="function"?f:void 0,Object.assign(e,{dispose:()=>{s&&(s=!1,_(()=>{for(let d of a)try{d.down([[P]])}catch{}}),l())}})}var he=class{ring;arr;constructor(n){n===Number.POSITIVE_INFINITY||n<=0?(this.arr=[],this.ring=null):(this.ring=new Pe(n),this.arr=null)}get length(){return this.ring!=null?this.ring.size:this.arr.length}push(n){this.ring!=null?this.ring.push(n):this.arr.push(n)}shift(){return this.ring!=null?this.ring.shift():this.arr.shift()}drain(){if(this.ring!=null){let i=this.ring.toArray();return this.ring.clear(),i}let n=this.arr;return this.arr=[],n}};function se(r){return r instanceof Error?r:new Error(String(r))}function De(r){return r===void 0?null:typeof r=="string"?Oe(r):r}function z(r,n){let{name:i,onTransportError:s,retry:u,backpressure:o,batchSize:t=Number.POSITIVE_INFINITY,flushIntervalMs:e=0,serialize:a,stopOn:l,onUpstreamMessage:m,onDispose:f,send:c,sendBatch:d,ctx:p}=n;if(!c&&!d)throw new Error("reactiveSink: `send` or `sendBatch` must be provided");let g=p,y=Math.max(1,u?.maxAttempts??1),T=De(u?.backoff??(y>1?"exponential":void 0)),h=u?.shouldRetry??(()=>!0),b=d!==void 0||t<Number.POSITIVE_INFINITY||e>0,w=k=>i?`${i}::${k}`:void 0,v=U(void 0,{equals:()=>!1,name:w("sent")}),S=U(null,{name:w("failed")}),L=U(0,{name:w("inFlight")}),F=U(null,{name:w("errors")}),K=b?U(0,{name:w("buffered")}):void 0,G=o?U(!1,{name:w("paused")}):void 0,ie=0,Q=k=>{ie+=k,L.down([[E,ie]])},O=k=>{try{s?.(k)}catch{}try{F.down([[E,k]])}catch{}},q=new Set,J=k=>{q.add(k);let N=()=>q.delete(k);k.then(N,N)},I=(k,N,C)=>{let A=T?T(N-1,C,null):0,H=A==null?0:typeof A=="number"&&A>0?A:0,$=Math.max(1,Math.ceil(H/1e6));return new Promise(M=>{setTimeout(()=>M(k()),$)})},W=k=>k!=null&&typeof k=="object"&&typeof k.then=="function",V=k=>{let N;try{N=a?a(k):k}catch(M){let R=se(M);return O({stage:"serialize",error:R,value:k}),S.down([[E,{value:k,error:R,attempts:0}]]),Promise.resolve()}let C=0,A=M=>{Q(-1);let R=se(M);if(O({stage:"send",error:R,value:k,attempt:C}),!(C<y&&h(R,C))){S.down([[E,{value:k,error:R,attempts:C}]]);return}return I($,C,R)},H=()=>{Q(-1),v.down([[E,k]])};function $(){C+=1,Q(1);let M;try{M=c(N,g)}catch(R){return A(R)??Promise.resolve()}return W(M)?M.then(H,R=>A(R)):(H(),Promise.resolve())}return $()},te=o?.maxBuffer??Number.POSITIVE_INFINITY,X=new he(te),Y,ae=!1,me=()=>{K?.down([[E,X.length]])},ue=k=>{G&&G.down([[E,k]])},we=o?.strategy??"drop-oldest",Be=(k,N)=>{let C={value:k,payload:N};if(X.length<te)return X.push(C),me(),!0;if(we==="drop-oldest"){let H=X.shift();return X.push(C),me(),ue(!0),S.down([[E,{value:H.value,error:new Error("backpressure: buffer overflow \u2014 dropped oldest"),attempts:0}]]),!0}if(we==="drop-newest")return ue(!0),S.down([[E,{value:k,error:new Error("backpressure: buffer overflow \u2014 dropped newest"),attempts:0}]]),!1;let A=new Error("backpressure: buffer overflow");return O({stage:"send",error:A,value:k}),S.down([[E,{value:k,error:A,attempts:0}]]),ue(!0),!1},Fe=k=>{let N=0,C=k.map(M=>M.payload),A=M=>{Q(-1);let R=se(M);if(O({stage:"send",error:R,value:k.map(ge=>ge.value),attempt:N}),!(N<y&&h(R,N))){for(let{value:ge}of k)S.down([[E,{value:ge,error:R,attempts:N}]]);return}return I($,N,R)},H=()=>{Q(-1);for(let{value:M}of k)v.down([[E,M]])};function $(){N+=1,Q(1);let M;try{M=d(C,g)}catch(R){return A(R)??Promise.resolve()}return W(M)?M.then(H,R=>A(R)):(H(),Promise.resolve())}return $()},He=async k=>{for(let N of k)await ze(N.value,N.payload)},ze=(k,N)=>{let C=0,A=M=>{Q(-1);let R=se(M);if(O({stage:"send",error:R,value:k,attempt:C}),!(C<y&&h(R,C))){S.down([[E,{value:k,error:R,attempts:C}]]);return}return I($,C,R)},H=()=>{Q(-1),v.down([[E,k]])};function $(){C+=1,Q(1);let M;try{M=c(N,g)}catch(R){return A(R)??Promise.resolve()}return W(M)?M.then(H,R=>A(R)):(H(),Promise.resolve())}return $()},ne=()=>{if(ae||X.length===0)return Promise.resolve();let k=X.drain();if(me(),ue(!1),d!==void 0){let C=Fe(k);return J(C),C}let N=He(k);return J(N),N},qe=()=>{Y!==void 0||ae||e<=0||(Y=setTimeout(()=>{Y=void 0,ne()},e))},Ue=r.subscribe(k=>{for(let N of k){let C=N[0];if(C!==E)try{m?.(N)}catch{}if(C===E){let A=N[1];if(b){let H;if(a)try{H=a(A)}catch(M){let R=se(M);O({stage:"serialize",error:R,value:A}),S.down([[E,{value:A,error:R,attempts:0}]]);continue}else H=A;if(!Be(A,H))continue;X.length>=t?ne():qe()}else{let H=V(A);J(H)}}else ee.messageTier(C)>=3&&b&&(Y!==void 0&&(clearTimeout(Y),Y=void 0),ne())}}),Se;if(l){let k=!1;Se=l.subscribe(N=>{if(!k){k=!0;return}N.length>0&&!Te&&Ee()})}let Te=!1,Ee=()=>{if(Te)return;Te=!0,Y!==void 0&&(clearTimeout(Y),Y=void 0),b&&ne(),ae=!0,Se?.(),Ue();let k=N=>{try{N.down([[le]])}catch{}};k(F),k(S),k(v),k(L),K&&k(K),G&&k(G);try{f?.()}catch{}},ce={dispose:Ee,sent:v,failed:S,inFlight:L,errors:F};return b&&(ce.buffered=K,ce.flush=async()=>{ae||(await ne(),await Promise.all(q))}),G&&(ce.paused=G),ce}function j(r){return{describeKind:"producer",...r}}function Ke(r,n){let{parse:i,closeOnTeardown:s=!1,...u}=n??{};return B(o=>{let t=!0,e,a=()=>{let T=e;e=void 0,T?.()},l=T=>{t&&(t=!1,o.down([T]),a())},m=(T,h=T)=>{if(t)try{let b=T!==null&&typeof T=="object"&&"data"in T?T.data:T,w=i?i(b,h):b;o.emit(w)}catch(b){l([x,b])}},f=T=>{l([x,T])},c=()=>{l([P])};if(typeof r=="function"){try{if(e=r(m,f,c),typeof e!="function")throw new Error("fromWebSocket register contract violation: register must return cleanup callable")}catch(T){l([x,T])}return()=>{t=!1,a()}}let d=r,p=T=>m(T,T),g=T=>f(T),y=()=>c();return d.addEventListener("message",p),d.addEventListener("error",g),d.addEventListener("close",y),e=()=>{d.removeEventListener("message",p),d.removeEventListener("error",g),d.removeEventListener("close",y),s&&d.close()},()=>{t=!1,a()}},j(u))}function Tr(r,n){return oe(r,n)}function We(r,n){let{method:i="GET",headers:s,body:u,transform:o=b=>b.json(),timeoutNs:t=30*1e9,signal:e,completeAfterFetch:a=!1,refetchOnSubscribe:l=!1,...m}=n??{},f=U(0,{name:`${m.name??"http"}/fetchCount`}),c=U(0,{name:`${m.name??"http"}/lastUpdated`}),d=U(!1,{name:`${m.name??"http"}/fetched`}),p=0,g=u!==void 0?typeof u=="string"?u:JSON.stringify(u):void 0,y=b=>{let w=new AbortController,v=!0;if(e?.aborted)return v=!1,b.down([[x,e.reason??new Error("Aborted")]]),()=>{};e?.addEventListener("abort",()=>w.abort(e.reason),{once:!0});let S=setTimeout(()=>w.abort(new Error("Request timeout")),Math.ceil(t/1e6));return fetch(r,{method:i,headers:s,body:g,signal:w.signal}).then(async L=>{if(clearTimeout(S),!v)return;if(!L.ok)throw new Error(`HTTP ${L.status}: ${L.statusText}`);let F=await o(L);v&&(_(()=>{p+=1,f.down([[E,p]]),c.down([[E,D()]]),d.down([[E,!0]]),b.emit(F)}),a&&b.down([[P]]))}).catch(L=>{clearTimeout(S),v&&(L&&L.name==="AbortError"||b.down([[x,L]]))}),()=>{v=!1,w.abort()}},T=B(b=>y({emit:w=>b.emit(w),down:w=>b.down(w)}),{...j(m),resubscribable:l});return{...Re(T),fetchCount:f,lastUpdated:c,fetched:d}}function gr(r,n,i){let{method:s="POST",headers:u={"Content-Type":"application/json"},serialize:o=p=>JSON.stringify(p),timeoutNs:t,batchFormat:e="json-array",batchSize:a,flushIntervalMs:l,retry:m,onTransportError:f}=i??{},c=async p=>{let g=t!==void 0?new AbortController:void 0,y;g&&t!==void 0&&(y=setTimeout(()=>g.abort(new Error("Request timeout")),Math.ceil(t/1e6)));try{let T=await fetch(n,{method:s,headers:u,body:p,signal:g?.signal}),h=async()=>{try{await T.arrayBuffer?.()}catch{}};if(!T.ok)throw await h(),new Error(`HTTP ${T.status}: ${T.statusText}`);await h()}finally{y!==void 0&&clearTimeout(y)}};return a!==void 0||l!==void 0?z(r,{onTransportError:f,retry:m,batchSize:a,flushIntervalMs:l,sendBatch:async p=>{let g;e==="ndjson"?g=p.map(y=>{let T=o(y);return typeof T=="string"?T:new TextDecoder().decode(T)}).join(`
|
|
2
|
+
`):g=JSON.stringify(p),await c(g)}}):z(r,{onTransportError:f,retry:m,serialize:o,send:async p=>{await c(p)}})}function Ae(r){return Symbol.keyFor(r)??r.description??"message"}function re(r,n){return typeof r=="string"?r:n(r)}function Le(r,n){let i=`event: ${r}
|
|
3
|
+
`;if(n!==void 0){let s=n.split(/\r?\n/);for(let u of s)i+=`data: ${u}
|
|
4
|
+
`}return`${i}
|
|
5
|
+
`}function yr(r,n){let{serialize:i=d=>{if(d instanceof Error)return d.message;try{return JSON.stringify(d)}catch{return String(d)}},dataEvent:s="data",errorEvent:u="error",completeEvent:o="complete",includeResolved:t=!1,includeDirty:e=!1,keepAliveMs:a,signal:l,eventNameResolver:m=Ae}=n??{},f=new TextEncoder,c;return new ReadableStream({start(d){let p=!1,g,y=()=>{},T=()=>{p||(p=!0,g!==void 0&&clearInterval(g),l?.removeEventListener("abort",b),y(),d.close())};c=T;let h=(w,v)=>{p||d.enqueue(f.encode(Le(w,v)))},b=()=>{p||T()};y=r.subscribe(w=>{for(let v of w){let S=v[0];if(!(ee.isLocalOnly(S)&&!(S===ye&&e))){if(S===E){h(s,re(v[1],i));continue}if(S===x){h(u,re(v[1],i)),T();return}if(S===P){h(o),T();return}!t&&S===ke||h(m(S),v.length>1?re(v[1],i):void 0)}}}),a!==void 0&&a>0&&(g=setInterval(()=>{p||d.enqueue(f.encode(`: keepalive
|
|
6
|
+
|
|
7
|
+
`))},a)),l?.aborted?b():l?.addEventListener("abort",b,{once:!0})},cancel(){c?.()}})}function kr(r,n){let{serialize:i=c=>{if(c instanceof Error)return c.message;try{return JSON.stringify(c)}catch{return String(c)}},dataEvent:s="data",errorEvent:u="error",completeEvent:o="complete",includeResolved:t=!1,includeDirty:e=!1,keepAliveMs:a,signal:l,eventNameResolver:m=Ae}=n??{},f=new TextEncoder;return B(c=>{let d=!0,p,g=(h,b)=>{d&&c.emit(f.encode(Le(h,b)))},y=()=>{d&&(d=!1,c.down([[P]]))},T=r.subscribe(h=>{if(d)for(let b of h){let w=b[0];if(!(ee.isLocalOnly(w)&&!(w===ye&&e))){if(w===E){g(s,re(b[1],i));continue}if(w===x){g(u,re(b[1],i)),d=!1,c.down([[P]]);return}if(w===P){g(o),d=!1,c.down([[P]]);return}!t&&w===ke||g(m(w),b.length>1?re(b[1],i):void 0)}}});return a!==void 0&&a>0&&(p=setInterval(()=>{d&&c.emit(f.encode(`: keepalive
|
|
8
|
+
|
|
9
|
+
`))},a)),l?.aborted?y():l?.addEventListener("abort",y,{once:!0}),()=>{d=!1,p!==void 0&&clearInterval(p),l?.removeEventListener("abort",y),T()}})}function br(r){let n,i=!1;return new ReadableStream({start(s){n=r.subscribe(u=>{for(let o of u){let t=o[0];if(i)return;if(t===E)try{s.enqueue(o[1])}catch{i=!0,n?.()}else if(t===x){i=!0;try{s.error(o[1])}catch{}return}else if(t===P){i=!0;try{s.close()}catch{}return}}})},cancel(){i=!0,n?.()}})}async function*$e(r,n){let i=n?.parse??(v=>v),s=n?.signal,u=new TextDecoder,o="",t="message",e=[],a,l,m=[],f=()=>{if(e.length===0&&t==="message"&&a===void 0){e=[];return}let v=e.join(`
|
|
10
|
+
`);m.push({event:t,data:i(v),id:a,retry:l}),t="message",e=[],a=void 0,l=void 0},c=v=>{if(v===""){f();return}if(v.startsWith(":"))return;let S=v.indexOf(":"),L=S<0?v:v.slice(0,S),F=S<0?"":v.slice(S+1);switch(F.startsWith(" ")&&(F=F.slice(1)),L){case"event":t=F;break;case"data":e.push(F);break;case"id":F.includes("\0")||(a=F);break;case"retry":{let K=Number(F);Number.isFinite(K)&&(l=K);break}}},d=(v,S)=>{o+=u.decode(v,{stream:!S});let L=o.split(/\r?\n/);o=L.pop()??"";for(let F of L)c(F)},p=r,g=r instanceof ReadableStream?r:p&&typeof p=="object"&&p.body instanceof ReadableStream?p.body:null,y,T,h=!1,b=()=>{h||(h=!0,y&&y.cancel().catch(()=>{}),T&&typeof T.return=="function"&&Promise.resolve(T.return()).catch(()=>{}))},w=()=>{b()};if(s){if(s.aborted)return;s.addEventListener("abort",w,{once:!0})}try{if(g){for(y=g.getReader();!s?.aborted;){let{value:v,done:S}=await y.read();if(S)break;for(d(v,!1);m.length>0;)yield m.shift()}d(new Uint8Array,!0)}else{for(T=r[Symbol.asyncIterator]();!s?.aborted;){let S=await T.next();if(S.done)break;for(d(S.value,!1);m.length>0;)yield m.shift()}d(new Uint8Array,!0)}if(o.trim()){for(let v of o.split(/\r?\n/))c(v);f()}for(;m.length>0;)yield m.shift()}finally{s&&s.removeEventListener("abort",w),b()}}function hr(r,n){let{parse:i,...s}=n??{};return B(u=>{let o=!0,t=new AbortController;return(async()=>{try{for await(let a of $e(r,{parse:i,signal:t.signal})){if(!o)return;u.emit(a)}o&&u.down([[P]])}catch(a){o&&u.down([[x,a]])}})(),()=>{o=!1,t.abort()}},j(s))}function vr(r,n){let{method:i="GET",headers:s,body:u,signal:o,...t}=n??{};return B(e=>{let a=!0,l=new AbortController;if(o?.aborted)return e.down([[x,o.reason??new Error("Aborted")]]),()=>{};o?.addEventListener("abort",()=>l.abort(o.reason),{once:!0});let m=u!==void 0?typeof u=="string"?u:JSON.stringify(u):void 0;return(async()=>{try{let c=await fetch(r,{method:i,headers:s,body:m,signal:l.signal});if(!a)return;if(!c.ok)throw new Error(`HTTP ${c.status}: ${c.statusText}`);if(!c.body)throw new Error("HTTP response has no body");let d=c.body.getReader();for(;a;){let{value:p,done:g}=await d.read();if(g)break;p&&e.emit(p)}a&&e.down([[P]])}catch(c){if(!a||c&&c.name==="AbortError")return;e.down([[x,c]])}})(),()=>{a=!1,l.abort()}},j(t))}function wr(r,n){let{intervalMs:i=5e3,...s}=n??{};return fe(pe(i,{period:i}),()=>We(r,{...s,completeAfterFetch:!0}).node)}function Sr(r,n,i){let{serialize:s=T=>{if(typeof T=="string"||T instanceof Blob||T instanceof ArrayBuffer||ArrayBuffer.isView(T))return T;try{return JSON.stringify(T)}catch{return String(T)}},closeOnComplete:u=!0,closeOnError:o=!0,closeCode:t,closeReason:e,onTransportError:a,retry:l,backpressure:m,stopOn:f}=i??{},c=!1,d=T=>{if(!c){c=!0;try{n.close(t,e)}catch(h){let b=h instanceof Error?h:new Error(String(h));try{a?.({stage:"close",error:b,value:void 0,message:T})}catch{}}}},p=null,y=z(r,{onTransportError:a,serialize:T=>{let h=s(T);if(h===void 0)throw new Error("serialize returned undefined");return h},retry:l,backpressure:m,stopOn:f,onDispose:()=>{if(p){try{n.removeEventListener("close",p)}catch{}p=null}},send:T=>{n.send(T)},onUpstreamMessage:T=>{(T[0]===P&&u||T[0]===x&&o)&&d(T)}});return p=()=>{c=!0,y.dispose()},n.addEventListener("close",p),y}function Er(r,n){let{parse:i,maxRetries:s,backoff:u="exponential",closeOnTeardown:o=!0,...t}=n??{};return Ne(()=>Ke(r(),{parse:i,closeOnTeardown:o,...t}),{count:s,backoff:u})}function xr(r,n){let{method:i="notifications/message",onDisconnect:s,...u}=n??{};return oe(({emit:o,error:t})=>(r.setNotificationHandler(i,e=>o(e)),s?.(e=>t(e??new Error("MCP client disconnected"))),()=>r.setNotificationHandler(i,()=>{})),u)}function Or(r,n){return Me(({traces:s,metrics:u,logs:o,error:t})=>r({onTraces:e=>{_(()=>{for(let a of e)s(a)})},onMetrics:e=>{_(()=>{for(let a of e)u(a)})},onLogs:e=>{_(()=>{for(let a of e)o(a)})},onError:t})??void 0,["traces","metrics","logs"],n?.name?{name:n.name}:void 0)}function Nr(r,n){return oe(r,n)}function Rr(r){let n=r.match(/^<(\d{1,3})>\d?\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s*(.*)/s);if(!n){let s=D();return{facility:1,severity:6,timestamp:new Date(Math.floor(s/1e6)).toISOString(),hostname:"-",appName:"-",procId:"-",msgId:"-",message:r.trim(),timestampNs:s}}let i=Number(n[1]);return{facility:i>>3,severity:i&7,timestamp:n[2],hostname:n[3],appName:n[4],procId:n[5],msgId:n[6],message:(n[7]??"").trim(),timestampNs:D()}}function Pr(r,n){return oe(r,n)}var je={c:"counter",g:"gauge",ms:"timer",h:"histogram",s:"set",d:"distribution"};function Cr(r){let n=r.split("|"),[i,s]=(n[0]??"").split(":");if(!i||s===void 0)throw new Error(`Invalid StatsD line: ${r}`);let u=n[1]?.trim()??"c",o=je[u]??"counter",t=o==="set"?0:Number(s),e,a={};for(let l=2;l<n.length;l++){let m=n[l].trim();if(m.startsWith("@"))e=Number(m.slice(1));else if(m.startsWith("#"))for(let f of m.slice(1).split(",")){let[c,d]=f.split(":");c&&(a[c]=d??"")}}return{name:i.trim(),value:t,type:o,sampleRate:e,tags:a,timestampNs:D()}}function Mr(r,n){let{intervalNs:i=15*1e9,headers:s,timeoutNs:u=10*1e9,signal:o,maxConsecutiveErrors:t=1}=n??{},e=Math.ceil(i/1e6),a=0;return fe(pe(0,{period:e,signal:o}),()=>B(l=>{let m=!0,f=new AbortController,c=setTimeout(()=>f.abort(new Error("Scrape timeout")),Math.ceil(u/1e6));return(async()=>{try{let p=await fetch(r,{headers:{Accept:"text/plain",...s},signal:f.signal});if(clearTimeout(c),!m)return;if(!p.ok)throw new Error(`Prometheus scrape ${p.status}: ${p.statusText}`);let g=await p.text();if(!m)return;let y=Qe(g);for(let T of y)l.emit(T);a=0,l.down([[P]])}catch(p){if(clearTimeout(c),!m||p instanceof Error&&p.name==="AbortError")return;a+=1,a>=t&&l.down([[x,p]])}})(),()=>{m=!1,clearTimeout(c),f.abort()}}))}function Qe(r){let n=[],i=new Map,s=new Map;for(let u of r.split(`
|
|
11
|
+
`)){let o=u.trim();if(!o)continue;if(o.startsWith("# TYPE ")){let c=o.slice(7),d=c.indexOf(" ");d>0&&i.set(c.slice(0,d),c.slice(d+1).trim());continue}if(o.startsWith("# HELP ")){let c=o.slice(7),d=c.indexOf(" ");d>0&&s.set(c.slice(0,d),c.slice(d+1).trim());continue}if(o.startsWith("#"))continue;let t,e={},a,l,m=o.indexOf("{");if(m>=0){t=o.slice(0,m);let c=o.indexOf("}",m);if(c<0)continue;let d=o.slice(m+1,c);e=_e(d);let p=o.slice(c+1).trim().split(/\s+/);a=p[0]??"",l=p[1]}else{let c=o.split(/\s+/);t=c[0]??"",a=c[1]??"",l=c[2]}if(!t||!a)continue;let f=t.replace(/(_total|_count|_sum|_bucket|_created|_info)$/,"");n.push({name:t,labels:e,value:Number(a),timestampMs:l?Number(l):void 0,type:i.get(f)??i.get(t),help:s.get(f)??s.get(t),timestampNs:D()})}return n}function _e(r){let n={},i=/(\w+)="((?:[^"\\]|\\.)*)"/g,s=i.exec(r);for(;s!==null;)n[s[1]]=s[2].replace(/\\(.)/g,"$1"),s=i.exec(r);return n}function Ar(r,n,i){let{fromBeginning:s=!1,deserialize:u=t=>{if(t===null)return null;try{return JSON.parse(t.toString())}catch{return t.toString()}},...o}=i??{};return B(t=>{let e=!0;return(async()=>{try{await r.subscribe({topic:n,fromBeginning:s}),await r.run({eachMessage:async({topic:l,partition:m,message:f})=>{if(!e)return;let c={};if(f.headers)for(let[d,p]of Object.entries(f.headers))p!==void 0&&(c[d]=typeof p=="string"?p:p.toString());t.emit({topic:l,partition:m,key:f.key?.toString()??null,value:u(f.value),headers:c,offset:f.offset,timestamp:f.timestamp,timestampNs:D()})}})}catch(l){e&&t.down([[x,l]])}})(),()=>{e=!1}},j(o))}function Lr(r,n,i,s){let{serialize:u=e=>JSON.stringify(e),keyExtractor:o,onTransportError:t}=s??{};return z(r,{onTransportError:t,send:async e=>{let a=o?.(e)??null,l=u(e);await n.send({topic:i,messages:[{key:a,value:Buffer.from(l)}]})}})}function Ir(r,n,i){let{blockMs:s=5e3,startId:u="$",parse:o=e=>{for(let l=0;l<e.length;l+=2)if(e[l]==="data")try{return JSON.parse(e[l+1])}catch{return e[l+1]}let a={};for(let l=0;l<e.length;l+=2)a[e[l]]=e[l+1];return a},...t}=i??{};return B(e=>{let a=!0,l=u;return(async()=>{for(;a;)try{let f=await r.xread("BLOCK",s,"STREAMS",n,l);if(!a)return;if(f)for(let[c,d]of f)for(let[p,g]of d)l=p,e.emit({id:p,key:n,data:o(g),timestampNs:D()})}catch(f){if(!a)return;e.down([[x,f]]);return}})(),()=>{a=!1}},j(t))}function Br(r,n,i,s){let{serialize:u=e=>["data",JSON.stringify(e)],maxLen:o,onTransportError:t}=s??{};return z(r,{onTransportError:t,send:async e=>{let a=u(e);await(o!==void 0?n.xadd(i,"MAXLEN","~",String(o),"*",...a):n.xadd(i,"*",...a))}})}function Fr(r,n){let{delimiter:i=",",hasHeader:s=!0,columns:u,parseLine:o,...t}=n??{},e=o??(a=>Ie(a,i));return B(a=>{let l=!1;return(async()=>{try{let f=u,c="";for await(let d of r){if(l)return;c+=d;let p=c.split(/\r?\n/);c=p.pop()??"";for(let g of p){if(l)return;if(!g.trim())continue;let y=e(g);if(!f&&s){f=y;continue}f||(f=y.map((h,b)=>`col${b}`));let T={};for(let h=0;h<f.length;h++)T[f[h]]=y[h]??"";a.emit(T)}}if(!l&&c.trim()){let d=e(c);if(f){let p={};for(let g=0;g<f.length;g++)p[f[g]]=d[g]??"";a.emit(p)}}l||a.down([[P]])}catch(f){l||a.down([[x,f]])}})(),()=>{l=!0}},j(t))}function Hr(r,n){let{delimiter:i=",",hasHeader:s=!0,columns:u,parseLine:o,...t}=n??{},e=o??(a=>Ie(a,i));return be([r],(a,l,m)=>{let f=a[0];if(f==null||f.length===0)return;let c=m.store;typeof c.buffer!="string"&&(c.buffer=""),c.headers===void 0&&u&&(c.headers=u.slice());for(let d of f){c.buffer=c.buffer+d;let p=c.buffer.split(/\r?\n/);c.buffer=p.pop()??"";for(let g of p){if(!g.trim())continue;let y=e(g);if(!c.headers&&s){c.headers=y;continue}c.headers||(c.headers=y.map((h,b)=>`col${b}`));let T={};for(let h=0;h<c.headers.length;h++)T[c.headers[h]]=y[h]??"";l.emit(T)}}},{describeKind:"derived",...t})}function zr(r,n){return be([r],(i,s,u)=>{let o=i[0];if(o==null||o.length===0)return;let t=u.store;typeof t.buffer!="string"&&(t.buffer="");for(let e of o){t.buffer=t.buffer+e;let a=t.buffer.split(/\r?\n/);t.buffer=a.pop()??"";for(let l of a)if(l.trim())try{s.emit(JSON.parse(l))}catch(m){s.down([[x,m]]);return}}},{describeKind:"derived",...n??{}})}function Ie(r,n){let i=[],s="",u=!1;for(let o=0;o<r.length;o++){let t=r[o];u?t==='"'?r[o+1]==='"'?(s+='"',o++):u=!1:s+=t:t==='"'?u=!0:t===n?(i.push(s),s=""):s+=t}return i.push(s),i}function qr(r,n){return B(i=>{let s=!1;return(async()=>{try{let o="";for await(let t of r){if(s)return;o+=t;let e=o.split(/\r?\n/);o=e.pop()??"";for(let a of e){if(s)return;let l=a.trim();l&&i.emit(JSON.parse(l))}}!s&&o.trim()&&i.emit(JSON.parse(o.trim())),s||i.down([[P]])}catch(o){s||i.down([[x,o]])}})(),()=>{s=!0}},j(n))}function Ur(r,n,i){let{intervalNs:s=5*1e9,format:u="JSONEachRow",signal:o,maxConsecutiveErrors:t=1}=i??{},e=Math.ceil(s/1e6),a=0;return fe(pe(0,{period:e,signal:o}),()=>B(l=>{let m=!0;return(async()=>{try{let c=await r.query({query:n,format:u});if(!m)return;let d=await c.json();if(!m)return;for(let p of d)l.emit(p);a=0,l.down([[P]])}catch(c){if(!m)return;a+=1,a>=t&&l.down([[x,c]])}})(),()=>{m=!1}}))}function Dr(r,n){let{autoAck:i=!0,deserialize:s=e=>{try{return JSON.parse(e.toString())}catch{return e.toString()}},onAckError:u,...o}=n??{},t=e=>{if(u)try{u(e instanceof Error?e:new Error(String(e)))}catch{}};return B(e=>{let a=!0;return(async()=>{for(;a;)try{let m=await r.receive();if(!a)return;let f={topic:m.getTopicName(),messageId:m.getMessageId().toString(),key:m.getPartitionKey(),value:s(m.getData()),properties:m.getProperties(),publishTime:m.getPublishTimestamp(),eventTime:m.getEventTimestamp(),timestampNs:D()};if(i)e.emit(f),r.acknowledge(m).catch(t);else{let c=!1,d={value:f,ack(){c||(c=!0,r.acknowledge(m).catch(t))},nack(p){if(c)return;c=!0;let g=r;try{let y=g.negativeAcknowledge?.(m);y&&typeof y.then=="function"&&y.catch(t)}catch(y){t(y)}}};e.emit(d)}}catch(m){a&&e.down([[x,m]]);return}})(),()=>{a=!1}},j(o))}function Kr(r,n,i){let{serialize:s=e=>Buffer.from(JSON.stringify(e)),keyExtractor:u,propertiesExtractor:o,onTransportError:t}=i??{};return z(r,{onTransportError:t,send:async e=>{await n.send({data:s(e),partitionKey:u?.(e),properties:o?.(e)})}})}function Wr(r,n,i){let s=new TextDecoder,{queue:u,deserialize:o=e=>{let a=s.decode(e);try{return JSON.parse(a)}catch{return a}},...t}=i??{};return B(e=>{let a=!0,l=r.subscribe(n,u?{queue:u}:void 0);return(async()=>{try{for await(let f of l){if(!a)return;let c={};if(f.headers)for(let d of f.headers.keys())c[d]=f.headers.get(d);e.emit({subject:f.subject,data:o(f.data),headers:c,reply:f.reply,sid:f.sid,timestampNs:D()})}a&&e.down([[P]])}catch(f){a&&e.down([[x,f]])}})(),()=>{a=!1}},j(t))}function $r(r,n,i,s){let u=new TextEncoder,{serialize:o=e=>u.encode(JSON.stringify(e)),onTransportError:t}=s??{};return z(r,{onTransportError:t,send:e=>{n.publish(i,o(e))}})}function jr(r,n,i){let{autoAck:s=!0,deserialize:u=a=>{try{return JSON.parse(a.toString())}catch{return a.toString()}},onAckError:o,...t}=i??{},e=a=>{if(o)try{o(a instanceof Error?a:new Error(String(a)))}catch{}};return B(a=>{let l=!0,m;return(async()=>{try{m=(await r.consume(n,d=>{if(!l)return;if(d===null){l&&a.down([[x,new Error("Consumer cancelled by broker")]]);return}let p={queue:n,routingKey:d.fields.routingKey,exchange:d.fields.exchange,content:u(d.content),properties:d.properties,deliveryTag:d.fields.deliveryTag,redelivered:d.fields.redelivered,timestampNs:D()};if(s){a.emit(p);try{r.ack(d)}catch(g){e(g)}}else{let g=!1,y=r,T={value:p,ack(){if(!g){g=!0;try{r.ack(d)}catch(h){e(h)}}},nack(h){if(g)return;g=!0;let b=h?.requeue;if(!y.nack){e(new Error("RabbitMQ channel does not expose `nack`; cannot negative-ack"));return}try{y.nack(d,!1,b)}catch(w){e(w)}}};a.emit(T)}},{noAck:!1})).consumerTag}catch(c){l&&a.down([[x,c]])}})(),()=>{l=!1,m!==void 0&&r.cancel(m)}},j(t))}function Qr(r,n,i,s){let{serialize:u=e=>Buffer.from(JSON.stringify(e)),routingKeyExtractor:o=()=>"",onTransportError:t}=s??{};return z(r,{onTransportError:t,send:e=>{let a=o(e),l=u(e);n.publish(i,a,l)}})}function Je(r,n,i){let{serialize:s=f=>`${JSON.stringify(f)}
|
|
12
|
+
`,flushIntervalMs:u=0,batchSize:o=Number.POSITIVE_INFINITY,onTransportError:t,mode:e}=i??{},l=u>0||o<Number.POSITIVE_INFINITY?z(r,{onTransportError:t,batchSize:o,flushIntervalMs:u,serialize:s,sendBatch:f=>{n.write(f.join(""))}}):z(r,{onTransportError:t,serialize:s,send:f=>{n.write(f)}}),m=l.dispose;return l.dispose=()=>{m();try{n.end()}catch{}},l}function ve(r,n){return r.includes(n)||r.includes('"')||r.includes(`
|
|
13
|
+
`)?`"${r.replace(/"/g,'""')}"`:r}function _r(r,n,i){let{columns:s,delimiter:u=",",writeHeader:o=!0,cellExtractor:t=(d,p)=>String(d[p]??""),flushIntervalMs:e=0,batchSize:a=Number.POSITIVE_INFINITY,onTransportError:l,...m}=i,f=!1;return Je(r,n,{serialize:d=>{if(!f&&o){f=!0;let p=s.map(y=>ve(y,u)).join(u),g=s.map(y=>ve(t(d,y),u)).join(u);return`${p}
|
|
14
|
+
${g}
|
|
15
|
+
`}return`${s.map(p=>ve(t(d,p),u)).join(u)}
|
|
16
|
+
`},flushIntervalMs:e,batchSize:a,onTransportError:l,...m})}function Jr(r,n,i,s){let{batchSize:u=1e3,flushIntervalMs:o=5e3,format:t="JSONEachRow",transform:e=l=>l,onTransportError:a}=s??{};return z(r,{onTransportError:a,batchSize:u,flushIntervalMs:o,serialize:e,sendBatch:async l=>{await n.insert({table:i,values:l,format:t})}})}function Vr(r,n,i,s){let{format:u="ndjson",keyGenerator:o=(c,d)=>{let p=Math.floor(d/1e6);return`data/${new Date(p).toISOString().replace(/[:.]/g,"-")}-${c}.${u==="ndjson"?"ndjson":"json"}`},batchSize:t=1e3,flushIntervalMs:e=1e4,transform:a=c=>c,onTransportError:l}=s??{},m=u==="ndjson"?"application/x-ndjson":"application/json",f=0;return z(r,{onTransportError:l,batchSize:t,flushIntervalMs:e,serialize:a,sendBatch:async c=>{f+=1;let d=u==="ndjson"?`${c.map(g=>JSON.stringify(g)).join(`
|
|
17
|
+
`)}
|
|
18
|
+
`:JSON.stringify(c),p=o(f,D());await n.putObject({Bucket:i,Key:p,Body:d,ContentType:m})}})}function Yr(r,n,i,s){let{toSQL:u=(t,e)=>({sql:`INSERT INTO "${e.replace(/"/g,'""')}" (data) VALUES ($1)`,params:[JSON.stringify(t)]}),onTransportError:o}=s??{};return z(r,{onTransportError:o,serialize:t=>u(t,i),send:async t=>{let e=t;await n.query(e.sql,e.params)}})}function Gr(r,n,i){let{toDocument:s=o=>o,onTransportError:u}=i??{};return z(r,{onTransportError:u,serialize:s,send:async o=>{await n.insertOne(o)}})}function Xr(r,n,i){let{labels:s={},toLine:u=e=>JSON.stringify(e),toLabels:o,onTransportError:t}=i??{};return z(r,{onTransportError:t,serialize:e=>({line:u(e),labels:o?{...s,...o(e)}:s}),send:async e=>{let{line:a,labels:l}=e,m=`${D()}`;await n.push({streams:[{stream:l,values:[[m,a]]}]})}})}function Zr(r,n,i){let{toResourceSpans:s=o=>[o],onTransportError:u}=i??{};return z(r,{onTransportError:u,serialize:s,send:async o=>{await n.push({resourceSpans:o})}})}function et(r,n,i,s){let{prefix:u="checkpoints/",debounceMs:o=500,compactEvery:t=10,onError:e}=s??{},a={debounceMs:o,compactEvery:t,save(l,m){let f=Math.floor(D()/1e6),c=`${u}${r.name}/checkpoint-${f}.json`,d;try{d=JSON.stringify(m)}catch(p){e?.(p);return}n.putObject({Bucket:i,Key:c,Body:d,ContentType:"application/json"}).catch(p=>e?.(p))},load(){return null}};return r.attachStorage([a],{onError:l=>e?.(l)})}function rt(r,n,i){let{prefix:s="graphrefly:checkpoint:",debounceMs:u=500,compactEvery:o=10,onError:t}=i??{},e=`${s}${r.name}`,a={debounceMs:u,compactEvery:o,save(l,m){let f;try{f=JSON.stringify(m)}catch(c){t?.(c);return}n.set(e,f).catch(c=>t?.(c))},async load(){let l=await n.get(e);if(l==null)return null;try{return JSON.parse(l)}catch{return null}}};return r.attachStorage([a],{onError:l=>t?.(l)})}function tt(r,n,i){let{mapRow:s=t=>t,params:u,...o}=i??{};return B(t=>{try{let a=r.query(n,u).map(s);t.emit(a),t.down([[P]])}catch(e){t.down([[x,e instanceof Error?e:new Error(String(e))]])}},{describeKind:"producer",completeWhenDepsComplete:!1,...o})}function nt(r,n,i){let{mapRow:s=t=>t,params:u,...o}=i??{};return B(t=>{try{let e=r.iterate(n,u);_(()=>{for(let a of e)t.emit(s(a));t.down([[P]])})}catch(e){t.down([[x,e instanceof Error?e:new Error(String(e))]])}},{describeKind:"producer",completeWhenDepsComplete:!1,...o})}function ot(r,n,i,s){if(i.includes("\0")||i.length===0)throw new Error(`toSqlite: invalid table name: ${JSON.stringify(i)}`);let{toSQL:u=(O,q)=>({sql:`INSERT INTO "${q.replace(/"/g,'""')}" (data) VALUES (?)`,params:[JSON.stringify(O)]}),onTransportError:o,batchInsert:t=!1,maxBatchSize:e=1e3,flushIntervalMs:a=0}=s??{},l=O=>u(O,i);if(!t)return z(r,{onTransportError:o,serialize:l,send:O=>{let q=O;n.query(q.sql,q.params)}});let m=U(null),f=U(void 0,{equals:()=>!1}),c=U(null),d=U(0),p=U(0),g=O=>{try{o?.(O)}catch{}try{m.down([[E,O]])}catch{}},y=[],T=!1,h,b=!1,w=()=>p.down([[E,y.length]]),v=O=>{b||f.down([[E,O]])},S=O=>{b||c.down([[E,O]])},L=O=>{b||d.down([[E,O]])},F=O=>{b||g(O)},K=()=>{if(y.length===0||T)return;T=!0,L(1);try{n.query("BEGIN",[])}catch(I){T=!1,L(0),F({stage:"send",error:I instanceof Error?I:new Error(String(I)),value:void 0});return}let O=y;y=[],w();let q,J=0;for(let I of O)try{n.query(I.query.sql,I.query.params),J+=1}catch(W){q=W instanceof Error?W:new Error(String(W));break}if(q){try{n.query("ROLLBACK",[])}catch{}F({stage:"send",error:q,value:void 0});for(let I of O)S({value:I.value,error:q,attempts:1})}else try{n.query("COMMIT",[]);for(let I of O)v(I.value)}catch(I){let W=I instanceof Error?I:new Error(String(I));F({stage:"send",error:W,value:void 0});for(let V=0;V<J;V++)S({value:O[V].value,error:W,attempts:1})}T=!1,L(0)},G=()=>{a>0&&h===void 0&&!b&&(h=setTimeout(()=>{h=void 0,K()},a))},ie=r.subscribe(O=>{for(let q of O){let J=q[0];if(J===E){let I=q[1],W;try{W=l(I)}catch(V){let te=V instanceof Error?V:new Error(String(V));g({stage:"serialize",error:te,value:I}),c.down([[E,{value:I,error:te,attempts:0}]]);continue}y.push({value:I,query:W}),w(),y.length>=e?K():G()}else ee.messageTier(J)>=3&&K()}});return{dispose:()=>{if(!b){h!==void 0&&(clearTimeout(h),h=void 0),K(),b=!0,ie();for(let O of[m,f,c,d,p])try{O.down([[le]])}catch{}}},sent:f,failed:c,inFlight:d,errors:m,buffered:p,flush:async()=>{b||K()}}}function st(r,n){let{args:i,mapRow:s=o=>o,...u}=n??{};return B(o=>{let t=!0;return r.findMany(i).then(e=>{t&&(o.emit(e.map(s)),o.down([[P]]))}).catch(e=>{if(t)try{o.down([[x,e instanceof Error?e:new Error(String(e))]])}catch{}}),()=>{t=!1}},{...u,describeKind:"producer",completeWhenDepsComplete:!1})}function it(r,n){let{mapRow:i=u=>u,...s}=n??{};return B(u=>{let o=!0;return r.execute().then(t=>{o&&(u.emit(t.map(i)),u.down([[P]]))}).catch(t=>{if(o)try{u.down([[x,t instanceof Error?t:new Error(String(t))]])}catch{}}),()=>{o=!1}},{...s,describeKind:"producer",completeWhenDepsComplete:!1})}function at(r,n){let{mapRow:i=u=>u,...s}=n??{};return B(u=>{let o=!0;return r.execute().then(t=>{o&&(u.emit(t.map(i)),u.down([[P]]))}).catch(t=>{if(o)try{u.down([[x,t instanceof Error?t:new Error(String(t))]])}catch{}}),()=>{o=!1}},{...s,describeKind:"producer",completeWhenDepsComplete:!1})}async function ct(r,n){let i;try{i=await r.text()}catch{i=""}let s=n??"HTTP",u=new Error(`${s} API ${r.status}: ${r.statusText}${i?` \u2014 ${i}`:""}`);return u.status=r.status,u.headers=r.headers,u}export{oe as a,Me as b,z as c,Ke as d,Tr as e,We as f,gr as g,yr as h,kr as i,br as j,$e as k,hr as l,vr as m,wr as n,Sr as o,Er as p,xr as q,Or as r,Nr as s,Rr as t,Pr as u,Cr as v,Mr as w,Qe as x,Ar as y,Lr as z,Ir as A,Br as B,Fr as C,Hr as D,zr as E,qr as F,Ur as G,Dr as H,Kr as I,Wr as J,$r as K,jr as L,Qr as M,Je as N,_r as O,Jr as P,Vr as Q,Yr as R,Gr as S,Xr as T,Zr as U,et as V,rt as W,tt as X,nt as Y,ot as Z,st as _,it as $,at as aa,ct as ba};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as I}from"./chunk-
|
|
1
|
+
import{c as I}from"./chunk-K54OKWNY.js";import{g as _,j as P}from"./chunk-4JBKKUCJ.js";import{D as y,E as K,G as E,m as F}from"./chunk-7AJKUA36.js";import{b as j,d as x,i as A,j as D}from"./chunk-CK2E7BTU.js";import{b as B}from"./chunk-QYADASLV.js";var ee={};B(ee,{approval:()=>V,branch:()=>U,gate:()=>z,join:()=>J,loop:()=>Q,onFailure:()=>Z,pipeline:()=>L,sensor:()=>Y,subPipeline:()=>X,task:()=>H});function O(e,n){if(typeof n=="string")return{node:e.resolve(n),path:n};let o=$(e,n);if(!o)throw new Error("orchestration dep node must already be registered in the graph so explicit edges can be recorded; pass a string path or register the node first");return{node:n,path:o}}function $(e,n){let o=e.describe(),r=`::${_}::`;for(let t of Object.keys(o.nodes).sort())if(!t.includes(r))try{if(e.resolve(t)===n)return t}catch{}}function w(e,n,o,r){e.add(o,{name:n})}function N(e,n){return I("orchestration",e,n)}function W(e){let n=r=>{let t=r.trim();return t.length===0?0:Number(t)},o;return typeof e=="string"?o=n(e):e===null?o=0:o=Number(e),Number.isFinite(o)?Math.max(0,Math.trunc(o)):1}function L(e,n){return new P(e,n)}function H(e,n,o,r){let a=(r?.deps??[]).map(i=>O(e,i)),{deps:s,...p}=r??{},T=(i,f,c)=>{let l=i.map((h,g)=>h!=null&&h.length>0?h.at(-1):c.prevData[g]);f.emit(o(l,c))},d=y(a.map(i=>i.node),T,{...p,name:n,describeKind:"derived",meta:N("task",r?.meta)});return w(e,n,d,a.flatMap(i=>i.path?[i.path]:[])),d}function U(e,n,o,r,t){let a=O(e,o),s=E([a.node],([p])=>({branch:r(p)?"then":"else",value:p}),{...t,name:n,meta:N("branch",t?.meta)});return w(e,n,s,a.path?[a.path]:[]),s}function V(e,n,o,r,t){let a=O(e,o),s=O(e,r),p=t?.isApproved??(d=>!!d),T=y([a.node,s.node],(d,i,f)=>{let c=d[0],l=d[1],h=l!=null&&l.length>0?l.at(-1):f.prevData[1];if(h===void 0||!p(h)){i.down([[x]]);return}if(c==null||c.length===0){l!=null&&l.length>0&&f.prevData[0]!==void 0?i.emit(f.prevData[0]):i.down([[x]]);return}for(let g of c)i.emit(g)},{...t,name:n,describeKind:"derived",meta:N("approval",t?.meta)});return w(e,n,T,[a.path,s.path].filter(d=>typeof d=="string")),T}function z(e,n,o,r){let t=r?.maxPending??1/0;if(t<1&&t!==1/0)throw new RangeError("gate: maxPending must be >= 1");let a=r?.startOpen??!1,s=O(e,o),p=K([],{name:"pending",equals:()=>!1}),T=K(a,{name:"isOpen"}),d=E([p],([u])=>u.length,{name:"count"}),i=[],f=!1,c=a,l=T.subscribe(u=>{for(let m of u)m[0]===j&&(c=m[1])});function h(){p.emit([...i])}function g(u){i.push(u),i.length>t&&i.shift(),h()}function R(u){let m=i.splice(0,u);return h(),m}function k(u){if(f)throw new Error(`gate: ${u}() called after gate was torn down`)}let b=y([s.node],(u,m,S)=>{let G=S.terminalDeps[0];if(G!==void 0){f=!0,i=[],h(),m.down(G===!0?[[A]]:[[D,G]]);return}let v=u[0];if(v==null||v.length===0){m.down([[x]]);return}for(let C of v)c?m.emit(C):(g(C),m.down([[x]]))},{name:n,describeKind:"derived",meta:N("gate",r?.meta)}),q={node:b,pending:p,count:d,isOpen:T,approve(u=1){k("approve");let m=R(u);for(let S of m){if(f)break;b.emit(S)}},reject(u=1){k("reject"),R(u)},modify(u,m=1){k("modify");let S=[...i],G=R(m);for(let v=0;v<G.length&&!f;v++)b.emit(u(G[v],v,S))},open(){k("open"),F(()=>{T.emit(!0);let u=R(i.length);for(let m of u){if(f)break;b.emit(m)}})},close(){k("close"),T.emit(!1)}};e.addDisposer(d.subscribe(()=>{})),e.addDisposer(l),w(e,n,b,s.path?[s.path]:[]);let M=new P(`${n}_state`);return M.add(p,{name:"pending"}),M.add(T,{name:"isOpen"}),M.add(d,{name:"count"}),e.mount(`${n}_state`,M),q}function J(e,n,o,r){let t=o.map(s=>O(e,s)),a=E(t.map(s=>s.node),s=>s,{...r,name:n,meta:N("join",r?.meta)});return w(e,n,a,t.flatMap(s=>s.path?[s.path]:[])),a}function Q(e,n,o,r,t){let a=O(e,o),s=t?.iterations,p=typeof s=="number"||s===void 0?void 0:O(e,s),T=typeof s=="number"?s:void 0,d=y(p?[a.node,p.node]:[a.node],(i,f,c)=>{let l=i[0],h=l!=null&&l.length>0?l.at(-1):c.prevData[0],g=p?i[1]:void 0,R=T??(p?g!=null&&g.length>0?g.at(-1):c.prevData[1]:1),k=W(R);for(let b=0;b<k;b+=1)h=r(h,b,f);f.emit(h)},{...t,name:n,describeKind:"derived",meta:N("loop",t?.meta)});return w(e,n,d,[a.path,p?.path].filter(i=>typeof i=="string")),d}function X(e,n,o,r){let t=o instanceof P?o:L(n,r);return typeof o=="function"&&o(t),e.mount(n,t),t}function Y(e,n,o,r){let t=y([],()=>{},{...r,name:n,initial:o,describeKind:"producer",meta:N("sensor",r?.meta)});return w(e,n,t,[]),{node:t,push(a){t.emit(a)},error(a){t.down([[D,a]])},complete(){t.down([[A]])}}}function Z(e,n,o,r,t){let a=O(e,o),s=!1,p=y([],(T,d)=>{let i=a.node.subscribe(f=>{for(let c of f){if(s)return;if(c[0]===D)try{d.emit(r(c[1],d))}catch(l){s=!0,d.down([[D,l]])}else d.down([c]),c[0]===A&&(s=!0)}});return()=>i()},{...t,name:n,describeKind:"derived",completeWhenDepsComplete:!1,errorWhenDepsError:!1,meta:N("onFailure",t?.meta)});return w(e,n,p,a.path?[a.path]:[]),p}export{L as a,H as b,U as c,V as d,z as e,J as f,Q as g,X as h,Y as i,Z as j,ee as k};
|