zen-code 4.9.0 → 4.9.2

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 (116) hide show
  1. package/dist/app.js +187 -144
  2. package/dist/{chunk-4nsg4vcd.js → chunk-0pss3s5r.js} +1 -1
  3. package/dist/chunk-0sxrk9sx.js +1 -0
  4. package/dist/{chunk-gcm4jp0d.js → chunk-0zk0m93z.js} +1 -1
  5. package/dist/chunk-178yjjsx.js +1 -0
  6. package/dist/chunk-1p9xzvpt.js +3 -0
  7. package/dist/{chunk-hfve7nf5.js → chunk-2eh0sv3s.js} +2 -2
  8. package/dist/chunk-43xrz4wp.js +2 -0
  9. package/dist/chunk-48ce2wt0.js +1 -0
  10. package/dist/chunk-48vkm1yn.js +5 -0
  11. package/dist/{chunk-va71tsw3.js → chunk-55nx49pj.js} +2 -2
  12. package/dist/chunk-578m1dhj.js +2 -0
  13. package/dist/{chunk-trjpzw1n.js → chunk-5dsevrtz.js} +3 -3
  14. package/dist/{chunk-1y82m5kn.js → chunk-62zh99t6.js} +4 -4
  15. package/dist/chunk-66890qd3.js +2 -0
  16. package/dist/{chunk-9k5d9vf1.js → chunk-6nfpdtn6.js} +1 -1
  17. package/dist/chunk-738m8242.js +53 -0
  18. package/dist/{chunk-98f6hg43.js → chunk-8f2zh5h6.js} +2 -2
  19. package/dist/{chunk-jbf8ve63.js → chunk-8ty2zfve.js} +1 -1
  20. package/dist/{chunk-9dahn9h7.js → chunk-94jawhw7.js} +1 -1
  21. package/dist/chunk-98wjxsna.js +79 -0
  22. package/dist/chunk-9b7nj74j.js +1 -0
  23. package/dist/{chunk-wn43r152.js → chunk-9k64296h.js} +1 -1
  24. package/dist/chunk-9x562s6p.js +1 -0
  25. package/dist/chunk-a90fm6gz.js +278 -0
  26. package/dist/chunk-ac5t2ywn.js +100 -0
  27. package/dist/chunk-ad2hbq42.js +1 -0
  28. package/dist/chunk-afhxxkmv.js +16 -0
  29. package/dist/chunk-b4vvgbav.js +1 -0
  30. package/dist/{chunk-g7pm00z7.js → chunk-b9pcntkv.js} +9 -9
  31. package/dist/chunk-c7y5efa0.js +1 -0
  32. package/dist/chunk-cbjnwrt7.js +2 -0
  33. package/dist/{chunk-g377vrpj.js → chunk-ce53j63y.js} +1 -1
  34. package/dist/{chunk-kba8akjs.js → chunk-dcs1r9as.js} +1 -1
  35. package/dist/chunk-dcwnpdtk.js +9 -0
  36. package/dist/{chunk-b52b0t16.js → chunk-dxec2q4t.js} +1 -1
  37. package/dist/{chunk-13nyfrmm.js → chunk-e3tyc24s.js} +1 -1
  38. package/dist/{chunk-ep2es95e.js → chunk-e8hp8d68.js} +3 -3
  39. package/dist/chunk-fkrydbn4.js +18 -0
  40. package/dist/chunk-frhhpxxy.js +2 -0
  41. package/dist/{chunk-ns6tjjkq.js → chunk-fw3nrwpf.js} +1 -1
  42. package/dist/chunk-gyhxdxb4.js +1 -0
  43. package/dist/chunk-h1enhch1.js +2 -0
  44. package/dist/chunk-hcnx1j2z.js +1 -0
  45. package/dist/chunk-hfegb4pr.js +2 -0
  46. package/dist/{chunk-mmq834zt.js → chunk-hfypkhky.js} +1 -1
  47. package/dist/chunk-hmemx3cw.js +2 -0
  48. package/dist/chunk-hra0748z.js +2 -0
  49. package/dist/chunk-hsev32dg.js +4 -0
  50. package/dist/chunk-hyf24r36.js +2 -0
  51. package/dist/chunk-jb4yt88g.js +6 -0
  52. package/dist/chunk-jjcmm167.js +1 -0
  53. package/dist/chunk-jrepjpft.js +2 -0
  54. package/dist/chunk-k38fjqj7.js +140 -0
  55. package/dist/{chunk-cs73xbzz.js → chunk-kym9tb01.js} +1 -1
  56. package/dist/chunk-mt1g6g89.js +1 -0
  57. package/dist/chunk-p0vzbr7s.js +585 -0
  58. package/dist/{chunk-heasksrr.js → chunk-pndhbee8.js} +2 -2
  59. package/dist/{chunk-cggjws6a.js → chunk-pwrscdkf.js} +1 -1
  60. package/dist/{chunk-j7a40ww9.js → chunk-r019959h.js} +2 -2
  61. package/dist/chunk-r10bn684.js +1 -0
  62. package/dist/{chunk-30sq2w0d.js → chunk-r3pe49q4.js} +3 -3
  63. package/dist/chunk-r4tq44hr.js +1 -0
  64. package/dist/chunk-rjrnaka2.js +1 -0
  65. package/dist/{chunk-8g2zdcy0.js → chunk-rt5mpgbg.js} +2 -2
  66. package/dist/chunk-rztre6k0.js +1 -0
  67. package/dist/chunk-s77qbhtz.js +3 -0
  68. package/dist/chunk-t7rwtc17.js +1 -0
  69. package/dist/chunk-v8g52kan.js +1 -0
  70. package/dist/chunk-vd6c87cm.js +2 -0
  71. package/dist/{chunk-rncpxz1b.js → chunk-vfwbx331.js} +2 -2
  72. package/dist/chunk-vh9zd1v3.js +5 -0
  73. package/dist/chunk-w2hbsa9j.js +86 -0
  74. package/dist/chunk-wabmqprd.js +184 -0
  75. package/dist/chunk-wpy5r9ma.js +40 -0
  76. package/dist/chunk-x552nspp.js +6 -0
  77. package/dist/chunk-x90r4sje.js +1 -0
  78. package/dist/chunk-yndex7hs.js +1 -0
  79. package/dist/{chunk-7kdvr78m.js → chunk-yqwxbcc7.js} +4 -4
  80. package/dist/chunk-z8n7y37k.js +1 -0
  81. package/dist/chunk-zr7sx9hd.js +1 -0
  82. package/dist/chunk-zxqmghzf.js +1 -0
  83. package/dist/cli.js +1 -1
  84. package/dist/nonInteractive.js +2 -2
  85. package/dist/zen-keyboard.js +1 -1
  86. package/package.json +1 -1
  87. package/dist/chunk-02vv5584.js +0 -1
  88. package/dist/chunk-1edvf7b5.js +0 -1
  89. package/dist/chunk-1rmnbdef.js +0 -1
  90. package/dist/chunk-1ttywx0y.js +0 -6
  91. package/dist/chunk-32ase1cw.js +0 -2
  92. package/dist/chunk-3490ntd8.js +0 -1
  93. package/dist/chunk-3pcybja5.js +0 -7
  94. package/dist/chunk-5rr85f28.js +0 -1
  95. package/dist/chunk-5x8nxw0t.js +0 -137
  96. package/dist/chunk-6rfc36jg.js +0 -1
  97. package/dist/chunk-76h8pe7x.js +0 -2
  98. package/dist/chunk-8z38ybz7.js +0 -1
  99. package/dist/chunk-b8dxq9rq.js +0 -1
  100. package/dist/chunk-cjqarwdn.js +0 -1
  101. package/dist/chunk-cyexd09c.js +0 -2
  102. package/dist/chunk-f8ewggk1.js +0 -1
  103. package/dist/chunk-j9aysaeb.js +0 -1
  104. package/dist/chunk-jfhc5c0d.js +0 -1
  105. package/dist/chunk-jxsfzfac.js +0 -2
  106. package/dist/chunk-m76ya904.js +0 -1
  107. package/dist/chunk-mjzeawnq.js +0 -6
  108. package/dist/chunk-nwy6n6b6.js +0 -274
  109. package/dist/chunk-qd305hg1.js +0 -1
  110. package/dist/chunk-qez6ejd4.js +0 -1
  111. package/dist/chunk-r2h3x9zv.js +0 -2
  112. package/dist/chunk-rz3b356n.js +0 -1
  113. package/dist/chunk-xhnvpygg.js +0 -2
  114. package/dist/chunk-xkz5z0zn.js +0 -1
  115. package/dist/chunk-zwxjkwqd.js +0 -26
  116. package/dist/chunk-zz32kgt2.js +0 -1
@@ -1,4 +1,4 @@
1
- import{$ as s$,X as u,Z as VO,_ as SO}from"./chunk-jxsfzfac.js";import{ub as vG,vb as R,yb as W}from"./chunk-kba8akjs.js";var L$=R((wO)=>{wO.parse=function($,E){return new W$($,E).parse()};class W${constructor($,E){this.source=$,this.transform=E||kO,this.position=0,this.entries=[],this.recorded=[],this.dimension=0}isEof(){return this.position>=this.source.length}nextCharacter(){var $=this.source[this.position++];if($==="\\")return{value:this.source[this.position++],escaped:!0};return{value:$,escaped:!1}}record($){this.recorded.push($)}newEntry($){var E;if(this.recorded.length>0||$){if(E=this.recorded.join(""),E==="NULL"&&!$)E=null;if(E!==null)E=this.transform(E);this.entries.push(E),this.recorded=[]}}consumeDimensions(){if(this.source[0]==="[")while(!this.isEof()){var $=this.nextCharacter();if($.value==="=")break}}parse($){var E,_,O;this.consumeDimensions();while(!this.isEof())if(E=this.nextCharacter(),E.value==="{"&&!O){if(this.dimension++,this.dimension>1)_=new W$(this.source.substr(this.position-1),this.transform),this.entries.push(_.parse(!0)),this.position+=_.position-2}else if(E.value==="}"&&!O){if(this.dimension--,!this.dimension){if(this.newEntry(),$)return this.entries}}else if(E.value==='"'&&!E.escaped){if(O)this.newEntry(!0);O=!O}else if(E.value===","&&!O)this.newEntry();else this.record(E.value);if(this.dimension!==0)throw Error("array dimension not balanced");return this.entries}}function kO($){return $}});var Q$=R((nG,e$)=>{var hO=L$();e$.exports={create:function($,E){return{parse:function(){return hO.parse($,E)}}}}});var _E=R((iG,EE)=>{var bO=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/,yO=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,vO=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,pO=/^-?infinity$/;EE.exports=function(E){if(pO.test(E))return Number(E.replace("i","I"));var _=bO.exec(E);if(!_)return mO(E)||null;var O=!!_[8],G=parseInt(_[1],10);if(O)G=$E(G);var X=parseInt(_[2],10)-1,U=_[3],J=parseInt(_[4],10),Z=parseInt(_[5],10),H=parseInt(_[6],10),Y=_[7];Y=Y?1000*parseFloat(Y):0;var T,K=fO(E);if(K!=null){if(T=new Date(Date.UTC(G,X,U,J,Z,H,Y)),j$(G))T.setUTCFullYear(G);if(K!==0)T.setTime(T.getTime()-K)}else if(T=new Date(G,X,U,J,Z,H,Y),j$(G))T.setFullYear(G);return T};function mO($){var E=yO.exec($);if(!E)return;var _=parseInt(E[1],10),O=!!E[4];if(O)_=$E(_);var G=parseInt(E[2],10)-1,X=E[3],U=new Date(_,G,X);if(j$(_))U.setFullYear(_);return U}function fO($){if($.endsWith("+00"))return 0;var E=vO.exec($.split(" ")[1]);if(!E)return;var _=E[1];if(_==="Z")return 0;var O=_==="-"?-1:1,G=parseInt(E[2],10)*3600+parseInt(E[3]||0,10)*60+parseInt(E[4]||0,10);return G*O*1000}function $E($){return-($-1)}function j$($){return $>=0&&$<100}});var GE=R((sG,OE)=>{OE.exports=uO;var dO=Object.prototype.hasOwnProperty;function uO($){for(var E=1;E<arguments.length;E++){var _=arguments[E];for(var O in _)if(dO.call(_,O))$[O]=_[O]}return $}});var JE=R((tG,UE)=>{var gO=GE();UE.exports=x;function x($){if(!(this instanceof x))return new x($);gO(this,E0($))}var cO=["seconds","minutes","hours","days","months","years"];x.prototype.toPostgres=function(){var $=cO.filter(this.hasOwnProperty,this);if(this.milliseconds&&$.indexOf("seconds")<0)$.push("seconds");if($.length===0)return"0";return $.map(function(E){var _=this[E]||0;if(E==="seconds"&&this.milliseconds)_=(_+this.milliseconds/1000).toFixed(6).replace(/\.?0+$/,"");return _+" "+E},this).join(" ")};var lO={years:"Y",months:"M",days:"D",hours:"H",minutes:"M",seconds:"S"},oO=["years","months","days"],nO=["hours","minutes","seconds"];x.prototype.toISOString=x.prototype.toISO=function(){var $=oO.map(_,this).join(""),E=nO.map(_,this).join("");return"P"+$+"T"+E;function _(O){var G=this[O]||0;if(O==="seconds"&&this.milliseconds)G=(G+this.milliseconds/1000).toFixed(6).replace(/0+$/,"");return G+lO[O]}};var N$="([+-]?\\d+)",iO=N$+"\\s+years?",sO=N$+"\\s+mons?",tO=N$+"\\s+days?",aO="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",rO=new RegExp([iO,sO,tO,aO].map(function($){return"("+$+")?"}).join("\\s*")),XE={years:2,months:4,days:6,hours:9,minutes:10,seconds:11,milliseconds:12},eO=["hours","minutes","seconds","milliseconds"];function $0($){var E=$+"000000".slice($.length);return parseInt(E,10)/1000}function E0($){if(!$)return{};var E=rO.exec($),_=E[8]==="-";return Object.keys(XE).reduce(function(O,G){var X=XE[G],U=E[X];if(!U)return O;if(U=G==="milliseconds"?$0(U):parseInt(U,10),!U)return O;if(_&&~eO.indexOf(G))U*=-1;return O[G]=U,O},{})}});var TE=R((aG,HE)=>{var ZE=Buffer.from||Buffer;HE.exports=function(E){if(/^\\x/.test(E))return ZE(E.substr(2),"hex");var _="",O=0;while(O<E.length)if(E[O]!=="\\")_+=E[O],++O;else if(/[0-7]{3}/.test(E.substr(O+1,3)))_+=String.fromCharCode(parseInt(E.substr(O+1,3),8)),O+=4;else{var G=1;while(O+G<E.length&&E[O+G]==="\\")G++;for(var X=0;X<Math.floor(G/2);++X)_+="\\";O+=Math.floor(G/2)*2}return ZE(_,"binary")}});var jE=R((rG,QE)=>{var c=L$(),l=Q$(),$$=_E(),RE=JE(),KE=TE();function E$($){return function(_){if(_===null)return _;return $(_)}}function WE($){if($===null)return $;return $==="TRUE"||$==="t"||$==="true"||$==="y"||$==="yes"||$==="on"||$==="1"}function _0($){if(!$)return null;return c.parse($,WE)}function O0($){return parseInt($,10)}function F$($){if(!$)return null;return c.parse($,E$(O0))}function G0($){if(!$)return null;return c.parse($,E$(function(E){return LE(E).trim()}))}var X0=function($){if(!$)return null;var E=l.create($,function(_){if(_!==null)_=D$(_);return _});return E.parse()},z$=function($){if(!$)return null;var E=l.create($,function(_){if(_!==null)_=parseFloat(_);return _});return E.parse()},V=function($){if(!$)return null;var E=l.create($);return E.parse()},P$=function($){if(!$)return null;var E=l.create($,function(_){if(_!==null)_=$$(_);return _});return E.parse()},U0=function($){if(!$)return null;var E=l.create($,function(_){if(_!==null)_=RE(_);return _});return E.parse()},J0=function($){if(!$)return null;return c.parse($,E$(KE))},A$=function($){return parseInt($,10)},LE=function($){var E=String($);if(/^\d+$/.test(E))return E;return $},YE=function($){if(!$)return null;return c.parse($,E$(JSON.parse))},D$=function($){if($[0]!=="(")return null;return $=$.substring(1,$.length-1).split(","),{x:parseFloat($[0]),y:parseFloat($[1])}},Z0=function($){if($[0]!=="<"&&$[1]!=="(")return null;var E="(",_="",O=!1;for(var G=2;G<$.length-1;G++){if(!O)E+=$[G];if($[G]===")"){O=!0;continue}else if(!O)continue;if($[G]===",")continue;_+=$[G]}var X=D$(E);return X.radius=parseFloat(_),X},H0=function($){$(20,LE),$(21,A$),$(23,A$),$(26,A$),$(700,parseFloat),$(701,parseFloat),$(16,WE),$(1082,$$),$(1114,$$),$(1184,$$),$(600,D$),$(651,V),$(718,Z0),$(1000,_0),$(1001,J0),$(1005,F$),$(1007,F$),$(1028,F$),$(1016,G0),$(1017,X0),$(1021,z$),$(1022,z$),$(1231,z$),$(1014,V),$(1015,V),$(1008,V),$(1009,V),$(1040,V),$(1041,V),$(1115,P$),$(1182,P$),$(1185,P$),$(1186,RE),$(1187,U0),$(17,KE),$(114,JSON.parse.bind(JSON)),$(3802,JSON.parse.bind(JSON)),$(199,YE),$(3807,YE),$(3907,V),$(2951,V),$(791,V),$(1183,V),$(1270,V)};QE.exports={init:H0}});var FE=R((eG,NE)=>{var P=1e6;function T0($){var E=$.readInt32BE(0),_=$.readUInt32BE(4),O="";if(E<0)E=~E+(_===0),_=~_+1>>>0,O="-";var G="",X,U,J,Z,H,Y;{if(X=E%P,E=E/P>>>0,U=4294967296*X+_,_=U/P>>>0,J=""+(U-P*_),_===0&&E===0)return O+J+G;Z="",H=6-J.length;for(Y=0;Y<H;Y++)Z+="0";G=Z+J+G}{if(X=E%P,E=E/P>>>0,U=4294967296*X+_,_=U/P>>>0,J=""+(U-P*_),_===0&&E===0)return O+J+G;Z="",H=6-J.length;for(Y=0;Y<H;Y++)Z+="0";G=Z+J+G}{if(X=E%P,E=E/P>>>0,U=4294967296*X+_,_=U/P>>>0,J=""+(U-P*_),_===0&&E===0)return O+J+G;Z="",H=6-J.length;for(Y=0;Y<H;Y++)Z+="0";G=Z+J+G}return X=E%P,U=4294967296*X+_,J=""+U%P,O+J+G}NE.exports=T0});var ME=R(($8,DE)=>{var Y0=FE(),j=function($,E,_,O,G){_=_||0,O=O||!1,G=G||function(Q,C,K$){return Q*Math.pow(2,K$)+C};var X=_>>3,U=function(Q){if(O)return~Q&255;return Q},J=255,Z=8-_%8;if(E<Z)J=255<<8-E&255,Z=E;if(_)J=J>>_%8;var H=0;if(_%8+E>=8)H=G(0,U($[X])&J,Z);var Y=E+_>>3;for(var T=X+1;T<Y;T++)H=G(H,U($[T]),8);var K=(E+_)%8;if(K>0)H=G(H,U($[Y])>>8-K,K);return H},AE=function($,E,_){var O=Math.pow(2,_-1)-1,G=j($,1),X=j($,_,1);if(X===0)return 0;var U=1,J=function(H,Y,T){if(H===0)H=1;for(var K=1;K<=T;K++)if(U/=2,(Y&1<<T-K)>0)H+=U;return H},Z=j($,E,_+1,!1,J);if(X==Math.pow(2,_+1)-1){if(Z===0)return G===0?1/0:-1/0;return NaN}return(G===0?1:-1)*Math.pow(2,X-O)*Z},R0=function($){if(j($,1)==1)return-1*(j($,15,1,!0)+1);return j($,15,1)},zE=function($){if(j($,1)==1)return-1*(j($,31,1,!0)+1);return j($,31,1)},K0=function($){return AE($,23,8)},W0=function($){return AE($,52,11)},L0=function($){var E=j($,16,32);if(E==49152)return NaN;var _=Math.pow(1e4,j($,16,16)),O=0,G=[],X=j($,16);for(var U=0;U<X;U++)O+=j($,16,64+16*U)*_,_/=1e4;var J=Math.pow(10,j($,16,48));return(E===0?1:-1)*Math.round(O*J)/J},PE=function($,E){var _=j(E,1),O=j(E,63,1),G=new Date((_===0?1:-1)*O/1000+946684800000);if(!$)G.setTime(G.getTime()+G.getTimezoneOffset()*60000);return G.usec=O%1000,G.getMicroSeconds=function(){return this.usec},G.setMicroSeconds=function(X){this.usec=X},G.getUTCMicroSeconds=function(){return this.usec},G},o=function($){var E=j($,32),_=j($,32,32),O=j($,32,64),G=96,X=[];for(var U=0;U<E;U++)X[U]=j($,32,G),G+=32,G+=32;var J=function(H){var Y=j($,32,G);if(G+=32,Y==4294967295)return null;var T;if(H==23||H==20)return T=j($,Y*8,G),G+=Y*8,T;else if(H==25)return T=$.toString(this.encoding,G>>3,(G+=Y<<3)>>3),T;else console.log("ERROR: ElementType not implemented: "+H)},Z=function(H,Y){var T=[],K;if(H.length>1){var Q=H.shift();for(K=0;K<Q;K++)T[K]=Z(H,Y);H.unshift(Q)}else for(K=0;K<H[0];K++)T[K]=J(Y);return T};return Z(X,O)},Q0=function($){return $.toString("utf8")},j0=function($){if($===null)return null;return j($,8)>0},N0=function($){$(20,Y0),$(21,R0),$(23,zE),$(26,zE),$(1700,L0),$(700,K0),$(701,W0),$(16,j0),$(1114,PE.bind(null,!1)),$(1184,PE.bind(null,!0)),$(1000,o),$(1007,o),$(1016,o),$(1008,o),$(1009,o),$(25,Q0)};DE.exports={init:N0}});var SE=R((E8,VE)=>{VE.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23,REGPROC:24,TEXT:25,OID:26,TID:27,XID:28,CID:29,JSON:114,XML:142,PG_NODE_TREE:194,SMGR:210,PATH:602,POLYGON:604,CIDR:650,FLOAT4:700,FLOAT8:701,ABSTIME:702,RELTIME:703,TINTERVAL:704,CIRCLE:718,MACADDR8:774,MONEY:790,MACADDR:829,INET:869,ACLITEM:1033,BPCHAR:1042,VARCHAR:1043,DATE:1082,TIME:1083,TIMESTAMP:1114,TIMESTAMPTZ:1184,INTERVAL:1186,TIMETZ:1266,BIT:1560,VARBIT:1562,NUMERIC:1700,REFCURSOR:1790,REGPROCEDURE:2202,REGOPER:2203,REGOPERATOR:2204,REGCLASS:2205,REGTYPE:2206,UUID:2950,TXID_SNAPSHOT:2970,PG_LSN:3220,PG_NDISTINCT:3361,PG_DEPENDENCIES:3402,TSVECTOR:3614,TSQUERY:3615,GTSVECTOR:3642,REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var i=R((V0)=>{var F0=jE(),z0=ME(),P0=Q$(),A0=SE();V0.getTypeParser=D0;V0.setTypeParser=M0;V0.arrayParser=P0;V0.builtins=A0;var n={text:{},binary:{}};function CE($){return String($)}function D0($,E){if(E=E||"text",!n[E])return CE;return n[E][$]||CE}function M0($,E,_){if(typeof E=="function")_=E,E="text";n[E][$]=_}F0.init(function($,E){n.text[$]=E});z0.init(function($,E){n.binary[$]=E})});var s=R((O8,M$)=>{var IE;try{IE=process.platform==="win32"?process.env.USERNAME:process.env.USER}catch{}M$.exports={host:"localhost",user:IE,database:void 0,password:null,connectionString:void 0,port:5432,rows:0,binary:!1,max:10,idleTimeoutMillis:30000,client_encoding:"",ssl:!1,application_name:void 0,fallback_application_name:void 0,options:void 0,parseInputDatesAsUTC:!1,statement_timeout:!1,lock_timeout:!1,idle_in_transaction_session_timeout:!1,query_timeout:!1,connect_timeout:0,keepalives:1,keepalives_idle:0};var h=i(),B0=h.getTypeParser(20,"text"),k0=h.getTypeParser(1016,"text");M$.exports.__defineSetter__("parseInt8",function($){h.setTypeParser(20,"text",$?h.getTypeParser(23,"text"):B0),h.setTypeParser(1016,"text",$?h.getTypeParser(1007,"text"):k0)})});var b=R((G8,kE)=>{var w0=s(),qE=W("util"),{isDate:x0}=qE.types||qE;function h0($){return'"'+$.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")+'"'}function BE($){let E="{";for(let _=0;_<$.length;_++){if(_>0)E=E+",";if($[_]===null||typeof $[_]>"u")E=E+"NULL";else if(Array.isArray($[_]))E=E+BE($[_]);else if(ArrayBuffer.isView($[_])){let O=$[_];if(!(O instanceof Buffer)){let G=Buffer.from(O.buffer,O.byteOffset,O.byteLength);if(G.length===O.byteLength)O=G;else O=G.slice(O.byteOffset,O.byteOffset+O.byteLength)}E+="\\\\x"+O.toString("hex")}else E+=h0(_$($[_]))}return E=E+"}",E}var _$=function($,E){if($==null)return null;if(typeof $==="object"){if($ instanceof Buffer)return $;if(ArrayBuffer.isView($)){let _=Buffer.from($.buffer,$.byteOffset,$.byteLength);if(_.length===$.byteLength)return _;return _.slice($.byteOffset,$.byteOffset+$.byteLength)}if(x0($))if(w0.parseInputDatesAsUTC)return v0($);else return y0($);if(Array.isArray($))return BE($);return b0($,E)}return $.toString()};function b0($,E){if($&&typeof $.toPostgres==="function"){if(E=E||[],E.indexOf($)!==-1)throw Error('circular reference detected while preparing "'+$+'" for query');return E.push($),_$($.toPostgres(_$),E)}return JSON.stringify($)}function y0($){let E=-$.getTimezoneOffset(),_=$.getFullYear(),O=_<1;if(O)_=Math.abs(_)+1;let G=String(_).padStart(4,"0")+"-"+String($.getMonth()+1).padStart(2,"0")+"-"+String($.getDate()).padStart(2,"0")+"T"+String($.getHours()).padStart(2,"0")+":"+String($.getMinutes()).padStart(2,"0")+":"+String($.getSeconds()).padStart(2,"0")+"."+String($.getMilliseconds()).padStart(3,"0");if(E<0)G+="-",E*=-1;else G+="+";if(G+=String(Math.floor(E/60)).padStart(2,"0")+":"+String(E%60).padStart(2,"0"),O)G+=" BC";return G}function v0($){let E=$.getUTCFullYear(),_=E<1;if(_)E=Math.abs(E)+1;let O=String(E).padStart(4,"0")+"-"+String($.getUTCMonth()+1).padStart(2,"0")+"-"+String($.getUTCDate()).padStart(2,"0")+"T"+String($.getUTCHours()).padStart(2,"0")+":"+String($.getUTCMinutes()).padStart(2,"0")+":"+String($.getUTCSeconds()).padStart(2,"0")+"."+String($.getUTCMilliseconds()).padStart(3,"0");if(O+="+00:00",_)O+=" BC";return O}function p0($,E,_){if($=typeof $==="string"?{text:$}:$,E)if(typeof E==="function")$.callback=E;else $.values=E;if(_)$.callback=_;return $}var m0=function($){return'"'+$.replace(/"/g,'""')+'"'},f0=function($){let E=!1,_="'";if($==null)return"''";if(typeof $!=="string")return"''";for(let O=0;O<$.length;O++){let G=$[O];if(G==="'")_+=G+G;else if(G==="\\")_+=G+G,E=!0;else _+=G}if(_+="'",E===!0)_=" E"+_;return _};kE.exports={prepareValue:function(E){return _$(E)},normalizeQueryConfig:p0,escapeIdentifier:m0,escapeLiteral:f0}});var xE=R((X8,wE)=>{var y=W("crypto");function V$($){return y.createHash("md5").update($,"utf-8").digest("hex")}function d0($,E,_){let O=V$(E+$);return"md5"+V$(Buffer.concat([Buffer.from(O),_]))}function u0($){return y.createHash("sha256").update($).digest()}function g0($,E){return $=$.replace(/(\D)-/,"$1"),y.createHash($).update(E).digest()}function c0($,E){return y.createHmac("sha256",$).update(E).digest()}async function l0($,E,_){return y.pbkdf2Sync($,E,_,32,"sha256")}wE.exports={postgresMd5PasswordHash:d0,randomBytes:y.randomBytes,deriveKey:l0,sha256:u0,hashByName:g0,hmacSha256:c0,md5:V$}});var vE=R((U8,yE)=>{var hE=W("crypto");yE.exports={postgresMd5PasswordHash:n0,randomBytes:o0,deriveKey:a0,sha256:i0,hashByName:s0,hmacSha256:t0,md5:S$};var bE=hE.webcrypto||globalThis.crypto,k=bE.subtle,C$=new TextEncoder;function o0($){return bE.getRandomValues(Buffer.alloc($))}async function S$($){try{return hE.createHash("md5").update($,"utf-8").digest("hex")}catch(E){let _=typeof $==="string"?C$.encode($):$,O=await k.digest("MD5",_);return Array.from(new Uint8Array(O)).map((G)=>G.toString(16).padStart(2,"0")).join("")}}async function n0($,E,_){let O=await S$(E+$);return"md5"+await S$(Buffer.concat([Buffer.from(O),_]))}async function i0($){return await k.digest("SHA-256",$)}async function s0($,E){return await k.digest($,E)}async function t0($,E){let _=await k.importKey("raw",$,{name:"HMAC",hash:"SHA-256"},!1,["sign"]);return await k.sign("HMAC",_,C$.encode(E))}async function a0($,E,_){let O=await k.importKey("raw",C$.encode($),"PBKDF2",!1,["deriveBits"]),G={name:"PBKDF2",hash:"SHA-256",salt:E,iterations:_};return await k.deriveBits(G,O,256,["deriveBits"])}});var q$=R((J8,I$)=>{var r0=parseInt(process.versions&&process.versions.node&&process.versions.node.split(".")[0])<15;if(r0)I$.exports=xE();else I$.exports=vE()});var fE=R((Z8,mE)=>{function w($,E){return Error("SASL channel binding: "+$+" when parsing public certificate "+E.toString("base64"))}function B$($,E){let _=$[E++];if(_<128)return{length:_,index:E};let O=_&127;if(O>4)throw w("bad length",$);_=0;for(let G=0;G<O;G++)_=_<<8|$[E++];return{length:_,index:E}}function pE($,E){if($[E++]!==6)throw w("non-OID data",$);let{length:_,index:O}=B$($,E);E=O;let G=E+_,X=$[E++],U=(X/40>>0)+"."+X%40;while(E<G){let J=0;while(E<G){let Z=$[E++];if(J=J<<7|Z&127,Z<128)break}U+="."+J}return{oid:U,index:E}}function t($,E){if($[E++]!==48)throw w("non-sequence data",$);return B$($,E)}function e0($,E){if(E===void 0)E=0;E=t($,E).index;let{length:_,index:O}=t($,E);E=O+_,E=t($,E).index;let{oid:G,index:X}=pE($,E);switch(G){case"1.2.840.113549.1.1.4":return"MD5";case"1.2.840.113549.1.1.5":return"SHA-1";case"1.2.840.113549.1.1.11":return"SHA-256";case"1.2.840.113549.1.1.12":return"SHA-384";case"1.2.840.113549.1.1.13":return"SHA-512";case"1.2.840.113549.1.1.14":return"SHA-224";case"1.2.840.113549.1.1.15":return"SHA512-224";case"1.2.840.113549.1.1.16":return"SHA512-256";case"1.2.840.10045.4.1":return"SHA-1";case"1.2.840.10045.4.3.1":return"SHA-224";case"1.2.840.10045.4.3.2":return"SHA-256";case"1.2.840.10045.4.3.3":return"SHA-384";case"1.2.840.10045.4.3.4":return"SHA-512";case"1.2.840.113549.1.1.10":{if(E=X,E=t($,E).index,$[E++]!==160)throw w("non-tag data",$);E=B$($,E).index,E=t($,E).index;let{oid:U}=pE($,E);switch(U){case"1.2.840.113549.2.5":return"MD5";case"1.3.14.3.2.26":return"SHA-1";case"2.16.840.1.101.3.4.2.1":return"SHA-256";case"2.16.840.1.101.3.4.2.2":return"SHA-384";case"2.16.840.1.101.3.4.2.3":return"SHA-512"}throw w("unknown hash OID "+U,$)}case"1.3.101.110":case"1.3.101.112":return"SHA-512";case"1.3.101.111":case"1.3.101.113":throw w("Ed448 certificate channel binding is not currently supported by Postgres")}throw w("unknown OID "+G,$)}mE.exports={signatureAlgorithmHashFromCertificate:e0}});var cE=R((H8,gE)=>{var q=q$(),{signatureAlgorithmHashFromCertificate:$1}=fE();function E1($,E){let _=["SCRAM-SHA-256"];if(E)_.unshift("SCRAM-SHA-256-PLUS");let O=_.find((U)=>$.includes(U));if(!O)throw Error("SASL: Only mechanism(s) "+_.join(" and ")+" are supported");if(O==="SCRAM-SHA-256-PLUS"&&typeof E.getPeerCertificate!=="function")throw Error("SASL: Mechanism SCRAM-SHA-256-PLUS requires a certificate");let G=q.randomBytes(18).toString("base64");return{mechanism:O,clientNonce:G,response:(O==="SCRAM-SHA-256-PLUS"?"p=tls-server-end-point":E?"y":"n")+",,n=*,r="+G,message:"SASLInitialResponse"}}async function _1($,E,_,O){if($.message!=="SASLInitialResponse")throw Error("SASL: Last message was not SASLInitialResponse");if(typeof E!=="string")throw Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string");if(E==="")throw Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a non-empty string");if(typeof _!=="string")throw Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a string");let G=X1(_);if(!G.nonce.startsWith($.clientNonce))throw Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce");else if(G.nonce.length===$.clientNonce.length)throw Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce is too short");let X="n=*,r="+$.clientNonce,U="r="+G.nonce+",s="+G.salt+",i="+G.iteration,J=O?"eSws":"biws";if($.mechanism==="SCRAM-SHA-256-PLUS"){let t$=O.getPeerCertificate().raw,e=$1(t$);if(e==="MD5"||e==="SHA-1")e="SHA-256";let BO=await q.hashByName(e,t$);J=Buffer.concat([Buffer.from("p=tls-server-end-point,,"),Buffer.from(BO)]).toString("base64")}let Z="c="+J+",r="+G.nonce,H=X+","+U+","+Z,Y=Buffer.from(G.salt,"base64"),T=await q.deriveKey(E,Y,G.iteration),K=await q.hmacSha256(T,"Client Key"),Q=await q.sha256(K),C=await q.hmacSha256(Q,H),K$=J1(Buffer.from(K),Buffer.from(C)).toString("base64"),IO=await q.hmacSha256(T,"Server Key"),qO=await q.hmacSha256(IO,H);$.message="SASLResponse",$.serverSignature=Buffer.from(qO).toString("base64"),$.response=Z+",p="+K$}function O1($,E){if($.message!=="SASLResponse")throw Error("SASL: Last message was not SASLResponse");if(typeof E!=="string")throw Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:_}=U1(E);if(_!==$.serverSignature)throw Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature does not match")}function G1($){if(typeof $!=="string")throw TypeError("SASL: text must be a string");return $.split("").map((E,_)=>$.charCodeAt(_)).every((E)=>E>=33&&E<=43||E>=45&&E<=126)}function dE($){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/.test($)}function uE($){if(typeof $!=="string")throw TypeError("SASL: attribute pairs text must be a string");return new Map($.split(",").map((E)=>{if(!/^.=/.test(E))throw Error("SASL: Invalid attribute pair entry");let _=E[0],O=E.substring(2);return[_,O]}))}function X1($){let E=uE($),_=E.get("r");if(!_)throw Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce missing");else if(!G1(_))throw Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce must only contain printable characters");let O=E.get("s");if(!O)throw Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing");else if(!dE(O))throw Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt must be base64");let G=E.get("i");if(!G)throw Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration missing");else if(!/^[1-9][0-9]*$/.test(G))throw Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: invalid iteration count");let X=parseInt(G,10);return{nonce:_,salt:O,iteration:X}}function U1($){let _=uE($).get("v");if(!_)throw Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature is missing");else if(!dE(_))throw Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature must be base64");return{serverSignature:_}}function J1($,E){if(!Buffer.isBuffer($))throw TypeError("first argument must be a Buffer");if(!Buffer.isBuffer(E))throw TypeError("second argument must be a Buffer");if($.length!==E.length)throw Error("Buffer lengths must match");if($.length===0)throw Error("Buffers cannot be empty");return Buffer.from($.map((_,O)=>$[O]^E[O]))}gE.exports={startSession:E1,continueSession:_1,finalizeSession:O1}});var G$=R((T8,lE)=>{var Z1=i();function O$($){this._types=$||Z1,this.text={},this.binary={}}O$.prototype.getOverrides=function($){switch($){case"text":return this.text;case"binary":return this.binary;default:return{}}};O$.prototype.setTypeParser=function($,E,_){if(typeof E==="function")_=E,E="text";this.getOverrides(E)[$]=_};O$.prototype.getTypeParser=function($,E){return E=E||"text",this.getOverrides(E)[$]||this._types.getTypeParser($,E)};lE.exports=O$});var iE=R((Y8,nE)=>{function v($,E={}){if($.charAt(0)==="/"){let Z=$.split(" ");return{host:Z[0],database:Z[1]}}let _={},O,G=!1;if(/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test($))$=encodeURI($).replace(/%25(\d\d)/g,"%$1");try{try{O=new URL($,"postgres://base")}catch(Z){O=new URL($.replace("@/","@___DUMMY___/"),"postgres://base"),G=!0}}catch(Z){throw Z.input&&(Z.input="*****REDACTED*****"),Z}for(let Z of O.searchParams.entries())_[Z[0]]=Z[1];if(_.user=_.user||decodeURIComponent(O.username),_.password=_.password||decodeURIComponent(O.password),O.protocol=="socket:")return _.host=decodeURI(O.pathname),_.database=O.searchParams.get("db"),_.client_encoding=O.searchParams.get("encoding"),_;let X=G?"":O.hostname;if(!_.host)_.host=decodeURIComponent(X);else if(X&&/^%2f/i.test(X))O.pathname=X+O.pathname;if(!_.port)_.port=O.port;let U=O.pathname.slice(1)||null;if(_.database=U?decodeURI(U):null,_.ssl==="true"||_.ssl==="1")_.ssl=!0;if(_.ssl==="0")_.ssl=!1;if(_.sslcert||_.sslkey||_.sslrootcert||_.sslmode)_.ssl={};let J=_.sslcert||_.sslkey||_.sslrootcert?W("fs"):null;if(_.sslcert)_.ssl.cert=J.readFileSync(_.sslcert).toString();if(_.sslkey)_.ssl.key=J.readFileSync(_.sslkey).toString();if(_.sslrootcert)_.ssl.ca=J.readFileSync(_.sslrootcert).toString();if(E.useLibpqCompat&&_.uselibpqcompat)throw Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");if(_.uselibpqcompat==="true"||E.useLibpqCompat)switch(_.sslmode){case"disable":{_.ssl=!1;break}case"prefer":{_.ssl.rejectUnauthorized=!1;break}case"require":{if(_.sslrootcert)_.ssl.checkServerIdentity=function(){};else _.ssl.rejectUnauthorized=!1;break}case"verify-ca":{if(!_.ssl.ca)throw Error("SECURITY WARNING: Using sslmode=verify-ca requires specifying a CA with sslrootcert. If a public CA is used, verify-ca allows connections to a server that somebody else may have registered with the CA, making you vulnerable to Man-in-the-Middle attacks. Either specify a custom CA certificate with sslrootcert parameter or use sslmode=verify-full for proper security.");_.ssl.checkServerIdentity=function(){};break}case"verify-full":break}else switch(_.sslmode){case"disable":{_.ssl=!1;break}case"prefer":case"require":case"verify-ca":case"verify-full":{if(_.sslmode!=="verify-full")k$(_.sslmode);break}case"no-verify":{_.ssl.rejectUnauthorized=!1;break}}return _}function H1($){return Object.entries($).reduce((_,[O,G])=>{if(G!==void 0&&G!==null)_[O]=G;return _},{})}function oE($){return Object.entries($).reduce((_,[O,G])=>{if(O==="ssl"){let X=G;if(typeof X==="boolean")_[O]=X;if(typeof X==="object")_[O]=H1(X)}else if(G!==void 0&&G!==null)if(O==="port"){if(G!==""){let X=parseInt(G,10);if(isNaN(X))throw Error(`Invalid ${O}: ${G}`);_[O]=X}}else _[O]=G;return _},{})}function T1($){return oE(v($))}function k$($){if(!k$.warned&&typeof process<"u"&&process.emitWarning)k$.warned=!0,process.emitWarning(`SECURITY WARNING: The SSL modes 'prefer', 'require', and 'verify-ca' are treated as aliases for 'verify-full'.
1
+ import{dh as u,th as VO,vh as SO,wh as s$}from"./chunk-ac5t2ywn.js";import"./chunk-dcwnpdtk.js";import"./chunk-cbjnwrt7.js";import"./chunk-vh9zd1v3.js";import"./chunk-w2hbsa9j.js";import"./chunk-rztre6k0.js";import"./chunk-wpy5r9ma.js";import"./chunk-h1enhch1.js";import"./chunk-hyf24r36.js";import{pq as vG,qq as R,tq as W}from"./chunk-dcs1r9as.js";var L$=R((wO)=>{wO.parse=function($,E){return new W$($,E).parse()};class W${constructor($,E){this.source=$,this.transform=E||kO,this.position=0,this.entries=[],this.recorded=[],this.dimension=0}isEof(){return this.position>=this.source.length}nextCharacter(){var $=this.source[this.position++];if($==="\\")return{value:this.source[this.position++],escaped:!0};return{value:$,escaped:!1}}record($){this.recorded.push($)}newEntry($){var E;if(this.recorded.length>0||$){if(E=this.recorded.join(""),E==="NULL"&&!$)E=null;if(E!==null)E=this.transform(E);this.entries.push(E),this.recorded=[]}}consumeDimensions(){if(this.source[0]==="[")while(!this.isEof()){var $=this.nextCharacter();if($.value==="=")break}}parse($){var E,_,O;this.consumeDimensions();while(!this.isEof())if(E=this.nextCharacter(),E.value==="{"&&!O){if(this.dimension++,this.dimension>1)_=new W$(this.source.substr(this.position-1),this.transform),this.entries.push(_.parse(!0)),this.position+=_.position-2}else if(E.value==="}"&&!O){if(this.dimension--,!this.dimension){if(this.newEntry(),$)return this.entries}}else if(E.value==='"'&&!E.escaped){if(O)this.newEntry(!0);O=!O}else if(E.value===","&&!O)this.newEntry();else this.record(E.value);if(this.dimension!==0)throw Error("array dimension not balanced");return this.entries}}function kO($){return $}});var Q$=R((nG,e$)=>{var hO=L$();e$.exports={create:function($,E){return{parse:function(){return hO.parse($,E)}}}}});var _E=R((iG,EE)=>{var bO=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/,yO=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,vO=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,pO=/^-?infinity$/;EE.exports=function(E){if(pO.test(E))return Number(E.replace("i","I"));var _=bO.exec(E);if(!_)return mO(E)||null;var O=!!_[8],G=parseInt(_[1],10);if(O)G=$E(G);var X=parseInt(_[2],10)-1,U=_[3],J=parseInt(_[4],10),Z=parseInt(_[5],10),H=parseInt(_[6],10),Y=_[7];Y=Y?1000*parseFloat(Y):0;var T,K=fO(E);if(K!=null){if(T=new Date(Date.UTC(G,X,U,J,Z,H,Y)),j$(G))T.setUTCFullYear(G);if(K!==0)T.setTime(T.getTime()-K)}else if(T=new Date(G,X,U,J,Z,H,Y),j$(G))T.setFullYear(G);return T};function mO($){var E=yO.exec($);if(!E)return;var _=parseInt(E[1],10),O=!!E[4];if(O)_=$E(_);var G=parseInt(E[2],10)-1,X=E[3],U=new Date(_,G,X);if(j$(_))U.setFullYear(_);return U}function fO($){if($.endsWith("+00"))return 0;var E=vO.exec($.split(" ")[1]);if(!E)return;var _=E[1];if(_==="Z")return 0;var O=_==="-"?-1:1,G=parseInt(E[2],10)*3600+parseInt(E[3]||0,10)*60+parseInt(E[4]||0,10);return G*O*1000}function $E($){return-($-1)}function j$($){return $>=0&&$<100}});var GE=R((sG,OE)=>{OE.exports=uO;var dO=Object.prototype.hasOwnProperty;function uO($){for(var E=1;E<arguments.length;E++){var _=arguments[E];for(var O in _)if(dO.call(_,O))$[O]=_[O]}return $}});var JE=R((tG,UE)=>{var gO=GE();UE.exports=x;function x($){if(!(this instanceof x))return new x($);gO(this,E0($))}var cO=["seconds","minutes","hours","days","months","years"];x.prototype.toPostgres=function(){var $=cO.filter(this.hasOwnProperty,this);if(this.milliseconds&&$.indexOf("seconds")<0)$.push("seconds");if($.length===0)return"0";return $.map(function(E){var _=this[E]||0;if(E==="seconds"&&this.milliseconds)_=(_+this.milliseconds/1000).toFixed(6).replace(/\.?0+$/,"");return _+" "+E},this).join(" ")};var lO={years:"Y",months:"M",days:"D",hours:"H",minutes:"M",seconds:"S"},oO=["years","months","days"],nO=["hours","minutes","seconds"];x.prototype.toISOString=x.prototype.toISO=function(){var $=oO.map(_,this).join(""),E=nO.map(_,this).join("");return"P"+$+"T"+E;function _(O){var G=this[O]||0;if(O==="seconds"&&this.milliseconds)G=(G+this.milliseconds/1000).toFixed(6).replace(/0+$/,"");return G+lO[O]}};var N$="([+-]?\\d+)",iO=N$+"\\s+years?",sO=N$+"\\s+mons?",tO=N$+"\\s+days?",aO="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",rO=new RegExp([iO,sO,tO,aO].map(function($){return"("+$+")?"}).join("\\s*")),XE={years:2,months:4,days:6,hours:9,minutes:10,seconds:11,milliseconds:12},eO=["hours","minutes","seconds","milliseconds"];function $0($){var E=$+"000000".slice($.length);return parseInt(E,10)/1000}function E0($){if(!$)return{};var E=rO.exec($),_=E[8]==="-";return Object.keys(XE).reduce(function(O,G){var X=XE[G],U=E[X];if(!U)return O;if(U=G==="milliseconds"?$0(U):parseInt(U,10),!U)return O;if(_&&~eO.indexOf(G))U*=-1;return O[G]=U,O},{})}});var TE=R((aG,HE)=>{var ZE=Buffer.from||Buffer;HE.exports=function(E){if(/^\\x/.test(E))return ZE(E.substr(2),"hex");var _="",O=0;while(O<E.length)if(E[O]!=="\\")_+=E[O],++O;else if(/[0-7]{3}/.test(E.substr(O+1,3)))_+=String.fromCharCode(parseInt(E.substr(O+1,3),8)),O+=4;else{var G=1;while(O+G<E.length&&E[O+G]==="\\")G++;for(var X=0;X<Math.floor(G/2);++X)_+="\\";O+=Math.floor(G/2)*2}return ZE(_,"binary")}});var jE=R((rG,QE)=>{var c=L$(),l=Q$(),$$=_E(),RE=JE(),KE=TE();function E$($){return function(_){if(_===null)return _;return $(_)}}function WE($){if($===null)return $;return $==="TRUE"||$==="t"||$==="true"||$==="y"||$==="yes"||$==="on"||$==="1"}function _0($){if(!$)return null;return c.parse($,WE)}function O0($){return parseInt($,10)}function F$($){if(!$)return null;return c.parse($,E$(O0))}function G0($){if(!$)return null;return c.parse($,E$(function(E){return LE(E).trim()}))}var X0=function($){if(!$)return null;var E=l.create($,function(_){if(_!==null)_=D$(_);return _});return E.parse()},z$=function($){if(!$)return null;var E=l.create($,function(_){if(_!==null)_=parseFloat(_);return _});return E.parse()},V=function($){if(!$)return null;var E=l.create($);return E.parse()},P$=function($){if(!$)return null;var E=l.create($,function(_){if(_!==null)_=$$(_);return _});return E.parse()},U0=function($){if(!$)return null;var E=l.create($,function(_){if(_!==null)_=RE(_);return _});return E.parse()},J0=function($){if(!$)return null;return c.parse($,E$(KE))},A$=function($){return parseInt($,10)},LE=function($){var E=String($);if(/^\d+$/.test(E))return E;return $},YE=function($){if(!$)return null;return c.parse($,E$(JSON.parse))},D$=function($){if($[0]!=="(")return null;return $=$.substring(1,$.length-1).split(","),{x:parseFloat($[0]),y:parseFloat($[1])}},Z0=function($){if($[0]!=="<"&&$[1]!=="(")return null;var E="(",_="",O=!1;for(var G=2;G<$.length-1;G++){if(!O)E+=$[G];if($[G]===")"){O=!0;continue}else if(!O)continue;if($[G]===",")continue;_+=$[G]}var X=D$(E);return X.radius=parseFloat(_),X},H0=function($){$(20,LE),$(21,A$),$(23,A$),$(26,A$),$(700,parseFloat),$(701,parseFloat),$(16,WE),$(1082,$$),$(1114,$$),$(1184,$$),$(600,D$),$(651,V),$(718,Z0),$(1000,_0),$(1001,J0),$(1005,F$),$(1007,F$),$(1028,F$),$(1016,G0),$(1017,X0),$(1021,z$),$(1022,z$),$(1231,z$),$(1014,V),$(1015,V),$(1008,V),$(1009,V),$(1040,V),$(1041,V),$(1115,P$),$(1182,P$),$(1185,P$),$(1186,RE),$(1187,U0),$(17,KE),$(114,JSON.parse.bind(JSON)),$(3802,JSON.parse.bind(JSON)),$(199,YE),$(3807,YE),$(3907,V),$(2951,V),$(791,V),$(1183,V),$(1270,V)};QE.exports={init:H0}});var FE=R((eG,NE)=>{var P=1e6;function T0($){var E=$.readInt32BE(0),_=$.readUInt32BE(4),O="";if(E<0)E=~E+(_===0),_=~_+1>>>0,O="-";var G="",X,U,J,Z,H,Y;{if(X=E%P,E=E/P>>>0,U=4294967296*X+_,_=U/P>>>0,J=""+(U-P*_),_===0&&E===0)return O+J+G;Z="",H=6-J.length;for(Y=0;Y<H;Y++)Z+="0";G=Z+J+G}{if(X=E%P,E=E/P>>>0,U=4294967296*X+_,_=U/P>>>0,J=""+(U-P*_),_===0&&E===0)return O+J+G;Z="",H=6-J.length;for(Y=0;Y<H;Y++)Z+="0";G=Z+J+G}{if(X=E%P,E=E/P>>>0,U=4294967296*X+_,_=U/P>>>0,J=""+(U-P*_),_===0&&E===0)return O+J+G;Z="",H=6-J.length;for(Y=0;Y<H;Y++)Z+="0";G=Z+J+G}return X=E%P,U=4294967296*X+_,J=""+U%P,O+J+G}NE.exports=T0});var ME=R(($8,DE)=>{var Y0=FE(),j=function($,E,_,O,G){_=_||0,O=O||!1,G=G||function(Q,C,K$){return Q*Math.pow(2,K$)+C};var X=_>>3,U=function(Q){if(O)return~Q&255;return Q},J=255,Z=8-_%8;if(E<Z)J=255<<8-E&255,Z=E;if(_)J=J>>_%8;var H=0;if(_%8+E>=8)H=G(0,U($[X])&J,Z);var Y=E+_>>3;for(var T=X+1;T<Y;T++)H=G(H,U($[T]),8);var K=(E+_)%8;if(K>0)H=G(H,U($[Y])>>8-K,K);return H},AE=function($,E,_){var O=Math.pow(2,_-1)-1,G=j($,1),X=j($,_,1);if(X===0)return 0;var U=1,J=function(H,Y,T){if(H===0)H=1;for(var K=1;K<=T;K++)if(U/=2,(Y&1<<T-K)>0)H+=U;return H},Z=j($,E,_+1,!1,J);if(X==Math.pow(2,_+1)-1){if(Z===0)return G===0?1/0:-1/0;return NaN}return(G===0?1:-1)*Math.pow(2,X-O)*Z},R0=function($){if(j($,1)==1)return-1*(j($,15,1,!0)+1);return j($,15,1)},zE=function($){if(j($,1)==1)return-1*(j($,31,1,!0)+1);return j($,31,1)},K0=function($){return AE($,23,8)},W0=function($){return AE($,52,11)},L0=function($){var E=j($,16,32);if(E==49152)return NaN;var _=Math.pow(1e4,j($,16,16)),O=0,G=[],X=j($,16);for(var U=0;U<X;U++)O+=j($,16,64+16*U)*_,_/=1e4;var J=Math.pow(10,j($,16,48));return(E===0?1:-1)*Math.round(O*J)/J},PE=function($,E){var _=j(E,1),O=j(E,63,1),G=new Date((_===0?1:-1)*O/1000+946684800000);if(!$)G.setTime(G.getTime()+G.getTimezoneOffset()*60000);return G.usec=O%1000,G.getMicroSeconds=function(){return this.usec},G.setMicroSeconds=function(X){this.usec=X},G.getUTCMicroSeconds=function(){return this.usec},G},o=function($){var E=j($,32),_=j($,32,32),O=j($,32,64),G=96,X=[];for(var U=0;U<E;U++)X[U]=j($,32,G),G+=32,G+=32;var J=function(H){var Y=j($,32,G);if(G+=32,Y==4294967295)return null;var T;if(H==23||H==20)return T=j($,Y*8,G),G+=Y*8,T;else if(H==25)return T=$.toString(this.encoding,G>>3,(G+=Y<<3)>>3),T;else console.log("ERROR: ElementType not implemented: "+H)},Z=function(H,Y){var T=[],K;if(H.length>1){var Q=H.shift();for(K=0;K<Q;K++)T[K]=Z(H,Y);H.unshift(Q)}else for(K=0;K<H[0];K++)T[K]=J(Y);return T};return Z(X,O)},Q0=function($){return $.toString("utf8")},j0=function($){if($===null)return null;return j($,8)>0},N0=function($){$(20,Y0),$(21,R0),$(23,zE),$(26,zE),$(1700,L0),$(700,K0),$(701,W0),$(16,j0),$(1114,PE.bind(null,!1)),$(1184,PE.bind(null,!0)),$(1000,o),$(1007,o),$(1016,o),$(1008,o),$(1009,o),$(25,Q0)};DE.exports={init:N0}});var SE=R((E8,VE)=>{VE.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23,REGPROC:24,TEXT:25,OID:26,TID:27,XID:28,CID:29,JSON:114,XML:142,PG_NODE_TREE:194,SMGR:210,PATH:602,POLYGON:604,CIDR:650,FLOAT4:700,FLOAT8:701,ABSTIME:702,RELTIME:703,TINTERVAL:704,CIRCLE:718,MACADDR8:774,MONEY:790,MACADDR:829,INET:869,ACLITEM:1033,BPCHAR:1042,VARCHAR:1043,DATE:1082,TIME:1083,TIMESTAMP:1114,TIMESTAMPTZ:1184,INTERVAL:1186,TIMETZ:1266,BIT:1560,VARBIT:1562,NUMERIC:1700,REFCURSOR:1790,REGPROCEDURE:2202,REGOPER:2203,REGOPERATOR:2204,REGCLASS:2205,REGTYPE:2206,UUID:2950,TXID_SNAPSHOT:2970,PG_LSN:3220,PG_NDISTINCT:3361,PG_DEPENDENCIES:3402,TSVECTOR:3614,TSQUERY:3615,GTSVECTOR:3642,REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var i=R((V0)=>{var F0=jE(),z0=ME(),P0=Q$(),A0=SE();V0.getTypeParser=D0;V0.setTypeParser=M0;V0.arrayParser=P0;V0.builtins=A0;var n={text:{},binary:{}};function CE($){return String($)}function D0($,E){if(E=E||"text",!n[E])return CE;return n[E][$]||CE}function M0($,E,_){if(typeof E=="function")_=E,E="text";n[E][$]=_}F0.init(function($,E){n.text[$]=E});z0.init(function($,E){n.binary[$]=E})});var s=R((O8,M$)=>{var IE;try{IE=process.platform==="win32"?process.env.USERNAME:process.env.USER}catch{}M$.exports={host:"localhost",user:IE,database:void 0,password:null,connectionString:void 0,port:5432,rows:0,binary:!1,max:10,idleTimeoutMillis:30000,client_encoding:"",ssl:!1,application_name:void 0,fallback_application_name:void 0,options:void 0,parseInputDatesAsUTC:!1,statement_timeout:!1,lock_timeout:!1,idle_in_transaction_session_timeout:!1,query_timeout:!1,connect_timeout:0,keepalives:1,keepalives_idle:0};var h=i(),B0=h.getTypeParser(20,"text"),k0=h.getTypeParser(1016,"text");M$.exports.__defineSetter__("parseInt8",function($){h.setTypeParser(20,"text",$?h.getTypeParser(23,"text"):B0),h.setTypeParser(1016,"text",$?h.getTypeParser(1007,"text"):k0)})});var b=R((G8,kE)=>{var w0=s(),qE=W("util"),{isDate:x0}=qE.types||qE;function h0($){return'"'+$.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")+'"'}function BE($){let E="{";for(let _=0;_<$.length;_++){if(_>0)E=E+",";if($[_]===null||typeof $[_]>"u")E=E+"NULL";else if(Array.isArray($[_]))E=E+BE($[_]);else if(ArrayBuffer.isView($[_])){let O=$[_];if(!(O instanceof Buffer)){let G=Buffer.from(O.buffer,O.byteOffset,O.byteLength);if(G.length===O.byteLength)O=G;else O=G.slice(O.byteOffset,O.byteOffset+O.byteLength)}E+="\\\\x"+O.toString("hex")}else E+=h0(_$($[_]))}return E=E+"}",E}var _$=function($,E){if($==null)return null;if(typeof $==="object"){if($ instanceof Buffer)return $;if(ArrayBuffer.isView($)){let _=Buffer.from($.buffer,$.byteOffset,$.byteLength);if(_.length===$.byteLength)return _;return _.slice($.byteOffset,$.byteOffset+$.byteLength)}if(x0($))if(w0.parseInputDatesAsUTC)return v0($);else return y0($);if(Array.isArray($))return BE($);return b0($,E)}return $.toString()};function b0($,E){if($&&typeof $.toPostgres==="function"){if(E=E||[],E.indexOf($)!==-1)throw Error('circular reference detected while preparing "'+$+'" for query');return E.push($),_$($.toPostgres(_$),E)}return JSON.stringify($)}function y0($){let E=-$.getTimezoneOffset(),_=$.getFullYear(),O=_<1;if(O)_=Math.abs(_)+1;let G=String(_).padStart(4,"0")+"-"+String($.getMonth()+1).padStart(2,"0")+"-"+String($.getDate()).padStart(2,"0")+"T"+String($.getHours()).padStart(2,"0")+":"+String($.getMinutes()).padStart(2,"0")+":"+String($.getSeconds()).padStart(2,"0")+"."+String($.getMilliseconds()).padStart(3,"0");if(E<0)G+="-",E*=-1;else G+="+";if(G+=String(Math.floor(E/60)).padStart(2,"0")+":"+String(E%60).padStart(2,"0"),O)G+=" BC";return G}function v0($){let E=$.getUTCFullYear(),_=E<1;if(_)E=Math.abs(E)+1;let O=String(E).padStart(4,"0")+"-"+String($.getUTCMonth()+1).padStart(2,"0")+"-"+String($.getUTCDate()).padStart(2,"0")+"T"+String($.getUTCHours()).padStart(2,"0")+":"+String($.getUTCMinutes()).padStart(2,"0")+":"+String($.getUTCSeconds()).padStart(2,"0")+"."+String($.getUTCMilliseconds()).padStart(3,"0");if(O+="+00:00",_)O+=" BC";return O}function p0($,E,_){if($=typeof $==="string"?{text:$}:$,E)if(typeof E==="function")$.callback=E;else $.values=E;if(_)$.callback=_;return $}var m0=function($){return'"'+$.replace(/"/g,'""')+'"'},f0=function($){let E=!1,_="'";if($==null)return"''";if(typeof $!=="string")return"''";for(let O=0;O<$.length;O++){let G=$[O];if(G==="'")_+=G+G;else if(G==="\\")_+=G+G,E=!0;else _+=G}if(_+="'",E===!0)_=" E"+_;return _};kE.exports={prepareValue:function(E){return _$(E)},normalizeQueryConfig:p0,escapeIdentifier:m0,escapeLiteral:f0}});var xE=R((X8,wE)=>{var y=W("crypto");function V$($){return y.createHash("md5").update($,"utf-8").digest("hex")}function d0($,E,_){let O=V$(E+$);return"md5"+V$(Buffer.concat([Buffer.from(O),_]))}function u0($){return y.createHash("sha256").update($).digest()}function g0($,E){return $=$.replace(/(\D)-/,"$1"),y.createHash($).update(E).digest()}function c0($,E){return y.createHmac("sha256",$).update(E).digest()}async function l0($,E,_){return y.pbkdf2Sync($,E,_,32,"sha256")}wE.exports={postgresMd5PasswordHash:d0,randomBytes:y.randomBytes,deriveKey:l0,sha256:u0,hashByName:g0,hmacSha256:c0,md5:V$}});var vE=R((U8,yE)=>{var hE=W("crypto");yE.exports={postgresMd5PasswordHash:n0,randomBytes:o0,deriveKey:a0,sha256:i0,hashByName:s0,hmacSha256:t0,md5:S$};var bE=hE.webcrypto||globalThis.crypto,k=bE.subtle,C$=new TextEncoder;function o0($){return bE.getRandomValues(Buffer.alloc($))}async function S$($){try{return hE.createHash("md5").update($,"utf-8").digest("hex")}catch(E){let _=typeof $==="string"?C$.encode($):$,O=await k.digest("MD5",_);return Array.from(new Uint8Array(O)).map((G)=>G.toString(16).padStart(2,"0")).join("")}}async function n0($,E,_){let O=await S$(E+$);return"md5"+await S$(Buffer.concat([Buffer.from(O),_]))}async function i0($){return await k.digest("SHA-256",$)}async function s0($,E){return await k.digest($,E)}async function t0($,E){let _=await k.importKey("raw",$,{name:"HMAC",hash:"SHA-256"},!1,["sign"]);return await k.sign("HMAC",_,C$.encode(E))}async function a0($,E,_){let O=await k.importKey("raw",C$.encode($),"PBKDF2",!1,["deriveBits"]),G={name:"PBKDF2",hash:"SHA-256",salt:E,iterations:_};return await k.deriveBits(G,O,256,["deriveBits"])}});var q$=R((J8,I$)=>{var r0=parseInt(process.versions&&process.versions.node&&process.versions.node.split(".")[0])<15;if(r0)I$.exports=xE();else I$.exports=vE()});var fE=R((Z8,mE)=>{function w($,E){return Error("SASL channel binding: "+$+" when parsing public certificate "+E.toString("base64"))}function B$($,E){let _=$[E++];if(_<128)return{length:_,index:E};let O=_&127;if(O>4)throw w("bad length",$);_=0;for(let G=0;G<O;G++)_=_<<8|$[E++];return{length:_,index:E}}function pE($,E){if($[E++]!==6)throw w("non-OID data",$);let{length:_,index:O}=B$($,E);E=O;let G=E+_,X=$[E++],U=(X/40>>0)+"."+X%40;while(E<G){let J=0;while(E<G){let Z=$[E++];if(J=J<<7|Z&127,Z<128)break}U+="."+J}return{oid:U,index:E}}function t($,E){if($[E++]!==48)throw w("non-sequence data",$);return B$($,E)}function e0($,E){if(E===void 0)E=0;E=t($,E).index;let{length:_,index:O}=t($,E);E=O+_,E=t($,E).index;let{oid:G,index:X}=pE($,E);switch(G){case"1.2.840.113549.1.1.4":return"MD5";case"1.2.840.113549.1.1.5":return"SHA-1";case"1.2.840.113549.1.1.11":return"SHA-256";case"1.2.840.113549.1.1.12":return"SHA-384";case"1.2.840.113549.1.1.13":return"SHA-512";case"1.2.840.113549.1.1.14":return"SHA-224";case"1.2.840.113549.1.1.15":return"SHA512-224";case"1.2.840.113549.1.1.16":return"SHA512-256";case"1.2.840.10045.4.1":return"SHA-1";case"1.2.840.10045.4.3.1":return"SHA-224";case"1.2.840.10045.4.3.2":return"SHA-256";case"1.2.840.10045.4.3.3":return"SHA-384";case"1.2.840.10045.4.3.4":return"SHA-512";case"1.2.840.113549.1.1.10":{if(E=X,E=t($,E).index,$[E++]!==160)throw w("non-tag data",$);E=B$($,E).index,E=t($,E).index;let{oid:U}=pE($,E);switch(U){case"1.2.840.113549.2.5":return"MD5";case"1.3.14.3.2.26":return"SHA-1";case"2.16.840.1.101.3.4.2.1":return"SHA-256";case"2.16.840.1.101.3.4.2.2":return"SHA-384";case"2.16.840.1.101.3.4.2.3":return"SHA-512"}throw w("unknown hash OID "+U,$)}case"1.3.101.110":case"1.3.101.112":return"SHA-512";case"1.3.101.111":case"1.3.101.113":throw w("Ed448 certificate channel binding is not currently supported by Postgres")}throw w("unknown OID "+G,$)}mE.exports={signatureAlgorithmHashFromCertificate:e0}});var cE=R((H8,gE)=>{var q=q$(),{signatureAlgorithmHashFromCertificate:$1}=fE();function E1($,E){let _=["SCRAM-SHA-256"];if(E)_.unshift("SCRAM-SHA-256-PLUS");let O=_.find((U)=>$.includes(U));if(!O)throw Error("SASL: Only mechanism(s) "+_.join(" and ")+" are supported");if(O==="SCRAM-SHA-256-PLUS"&&typeof E.getPeerCertificate!=="function")throw Error("SASL: Mechanism SCRAM-SHA-256-PLUS requires a certificate");let G=q.randomBytes(18).toString("base64");return{mechanism:O,clientNonce:G,response:(O==="SCRAM-SHA-256-PLUS"?"p=tls-server-end-point":E?"y":"n")+",,n=*,r="+G,message:"SASLInitialResponse"}}async function _1($,E,_,O){if($.message!=="SASLInitialResponse")throw Error("SASL: Last message was not SASLInitialResponse");if(typeof E!=="string")throw Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string");if(E==="")throw Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a non-empty string");if(typeof _!=="string")throw Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a string");let G=X1(_);if(!G.nonce.startsWith($.clientNonce))throw Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce");else if(G.nonce.length===$.clientNonce.length)throw Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce is too short");let X="n=*,r="+$.clientNonce,U="r="+G.nonce+",s="+G.salt+",i="+G.iteration,J=O?"eSws":"biws";if($.mechanism==="SCRAM-SHA-256-PLUS"){let t$=O.getPeerCertificate().raw,e=$1(t$);if(e==="MD5"||e==="SHA-1")e="SHA-256";let BO=await q.hashByName(e,t$);J=Buffer.concat([Buffer.from("p=tls-server-end-point,,"),Buffer.from(BO)]).toString("base64")}let Z="c="+J+",r="+G.nonce,H=X+","+U+","+Z,Y=Buffer.from(G.salt,"base64"),T=await q.deriveKey(E,Y,G.iteration),K=await q.hmacSha256(T,"Client Key"),Q=await q.sha256(K),C=await q.hmacSha256(Q,H),K$=J1(Buffer.from(K),Buffer.from(C)).toString("base64"),IO=await q.hmacSha256(T,"Server Key"),qO=await q.hmacSha256(IO,H);$.message="SASLResponse",$.serverSignature=Buffer.from(qO).toString("base64"),$.response=Z+",p="+K$}function O1($,E){if($.message!=="SASLResponse")throw Error("SASL: Last message was not SASLResponse");if(typeof E!=="string")throw Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:_}=U1(E);if(_!==$.serverSignature)throw Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature does not match")}function G1($){if(typeof $!=="string")throw TypeError("SASL: text must be a string");return $.split("").map((E,_)=>$.charCodeAt(_)).every((E)=>E>=33&&E<=43||E>=45&&E<=126)}function dE($){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/.test($)}function uE($){if(typeof $!=="string")throw TypeError("SASL: attribute pairs text must be a string");return new Map($.split(",").map((E)=>{if(!/^.=/.test(E))throw Error("SASL: Invalid attribute pair entry");let _=E[0],O=E.substring(2);return[_,O]}))}function X1($){let E=uE($),_=E.get("r");if(!_)throw Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce missing");else if(!G1(_))throw Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce must only contain printable characters");let O=E.get("s");if(!O)throw Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing");else if(!dE(O))throw Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt must be base64");let G=E.get("i");if(!G)throw Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration missing");else if(!/^[1-9][0-9]*$/.test(G))throw Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: invalid iteration count");let X=parseInt(G,10);return{nonce:_,salt:O,iteration:X}}function U1($){let _=uE($).get("v");if(!_)throw Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature is missing");else if(!dE(_))throw Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature must be base64");return{serverSignature:_}}function J1($,E){if(!Buffer.isBuffer($))throw TypeError("first argument must be a Buffer");if(!Buffer.isBuffer(E))throw TypeError("second argument must be a Buffer");if($.length!==E.length)throw Error("Buffer lengths must match");if($.length===0)throw Error("Buffers cannot be empty");return Buffer.from($.map((_,O)=>$[O]^E[O]))}gE.exports={startSession:E1,continueSession:_1,finalizeSession:O1}});var G$=R((T8,lE)=>{var Z1=i();function O$($){this._types=$||Z1,this.text={},this.binary={}}O$.prototype.getOverrides=function($){switch($){case"text":return this.text;case"binary":return this.binary;default:return{}}};O$.prototype.setTypeParser=function($,E,_){if(typeof E==="function")_=E,E="text";this.getOverrides(E)[$]=_};O$.prototype.getTypeParser=function($,E){return E=E||"text",this.getOverrides(E)[$]||this._types.getTypeParser($,E)};lE.exports=O$});var iE=R((Y8,nE)=>{function v($,E={}){if($.charAt(0)==="/"){let Z=$.split(" ");return{host:Z[0],database:Z[1]}}let _={},O,G=!1;if(/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test($))$=encodeURI($).replace(/%25(\d\d)/g,"%$1");try{try{O=new URL($,"postgres://base")}catch(Z){O=new URL($.replace("@/","@___DUMMY___/"),"postgres://base"),G=!0}}catch(Z){throw Z.input&&(Z.input="*****REDACTED*****"),Z}for(let Z of O.searchParams.entries())_[Z[0]]=Z[1];if(_.user=_.user||decodeURIComponent(O.username),_.password=_.password||decodeURIComponent(O.password),O.protocol=="socket:")return _.host=decodeURI(O.pathname),_.database=O.searchParams.get("db"),_.client_encoding=O.searchParams.get("encoding"),_;let X=G?"":O.hostname;if(!_.host)_.host=decodeURIComponent(X);else if(X&&/^%2f/i.test(X))O.pathname=X+O.pathname;if(!_.port)_.port=O.port;let U=O.pathname.slice(1)||null;if(_.database=U?decodeURI(U):null,_.ssl==="true"||_.ssl==="1")_.ssl=!0;if(_.ssl==="0")_.ssl=!1;if(_.sslcert||_.sslkey||_.sslrootcert||_.sslmode)_.ssl={};let J=_.sslcert||_.sslkey||_.sslrootcert?W("fs"):null;if(_.sslcert)_.ssl.cert=J.readFileSync(_.sslcert).toString();if(_.sslkey)_.ssl.key=J.readFileSync(_.sslkey).toString();if(_.sslrootcert)_.ssl.ca=J.readFileSync(_.sslrootcert).toString();if(E.useLibpqCompat&&_.uselibpqcompat)throw Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");if(_.uselibpqcompat==="true"||E.useLibpqCompat)switch(_.sslmode){case"disable":{_.ssl=!1;break}case"prefer":{_.ssl.rejectUnauthorized=!1;break}case"require":{if(_.sslrootcert)_.ssl.checkServerIdentity=function(){};else _.ssl.rejectUnauthorized=!1;break}case"verify-ca":{if(!_.ssl.ca)throw Error("SECURITY WARNING: Using sslmode=verify-ca requires specifying a CA with sslrootcert. If a public CA is used, verify-ca allows connections to a server that somebody else may have registered with the CA, making you vulnerable to Man-in-the-Middle attacks. Either specify a custom CA certificate with sslrootcert parameter or use sslmode=verify-full for proper security.");_.ssl.checkServerIdentity=function(){};break}case"verify-full":break}else switch(_.sslmode){case"disable":{_.ssl=!1;break}case"prefer":case"require":case"verify-ca":case"verify-full":{if(_.sslmode!=="verify-full")k$(_.sslmode);break}case"no-verify":{_.ssl.rejectUnauthorized=!1;break}}return _}function H1($){return Object.entries($).reduce((_,[O,G])=>{if(G!==void 0&&G!==null)_[O]=G;return _},{})}function oE($){return Object.entries($).reduce((_,[O,G])=>{if(O==="ssl"){let X=G;if(typeof X==="boolean")_[O]=X;if(typeof X==="object")_[O]=H1(X)}else if(G!==void 0&&G!==null)if(O==="port"){if(G!==""){let X=parseInt(G,10);if(isNaN(X))throw Error(`Invalid ${O}: ${G}`);_[O]=X}}else _[O]=G;return _},{})}function T1($){return oE(v($))}function k$($){if(!k$.warned&&typeof process<"u"&&process.emitWarning)k$.warned=!0,process.emitWarning(`SECURITY WARNING: The SSL modes 'prefer', 'require', and 'verify-ca' are treated as aliases for 'verify-full'.
2
2
  In the next major version (pg-connection-string v3.0.0 and pg v9.0.0), these modes will adopt standard libpq semantics, which have weaker security guarantees.
3
3
 
4
4
  To prepare for this change:
@@ -0,0 +1 @@
1
+ import{$f as c,Ag as D,Bg as E,Cg as F,Dg as G,Eg as H,Fg as I,Gg as J,Hg as K,Zf as a,_f as b,ag as d,bg as e,cg as f,dg as g,eg as h,fg as i,gg as j,hg as k,ig as l,jg as m,kg as n,lg as o,mg as p,ng as q,og as r,pg as s,qg as t,rg as u,sg as v,tg as w,ug as x,vg as y,wg as z,xg as A,yg as B,zg as C}from"./chunk-p0vzbr7s.js";import"./chunk-x552nspp.js";import"./chunk-48vkm1yn.js";import"./chunk-afhxxkmv.js";import"./chunk-43xrz4wp.js";import"./chunk-ac5t2ywn.js";import"./chunk-dcwnpdtk.js";import"./chunk-cbjnwrt7.js";import"./chunk-vh9zd1v3.js";import"./chunk-w2hbsa9j.js";import"./chunk-rztre6k0.js";import"./chunk-wpy5r9ma.js";import"./chunk-frhhpxxy.js";import"./chunk-h1enhch1.js";import"./chunk-hyf24r36.js";import"./chunk-k38fjqj7.js";import"./chunk-dcs1r9as.js";export{u as toStandardTool,x as listSkills,K as humanInTheLoopMiddleware,I as getAgentListFromPackage,t as fromLangChainTool,G as create_task_tool,H as createTaskTool,C as createMCPMiddleware,v as anthropicPromptCachingMiddleware,e as ToolSchema,k as ToolRegistry,f as ToolCustomParamsSchema,F as TaskSchema,J as SubAgentsMiddleware,D as SubAgentStateSchema,E as SubAgentAnnotation,m as StandardAgent,y as SkillsMiddleware,a as ProviderTypeSchema,d as PromptVersionSchema,c as PromptSchema,b as ModelSchema,h as MiddlewareSchema,l as MiddlewareRegistry,g as MiddlewareCustomParamsSchema,s as MemoryStorage,B as MCPMiddleware,z as LoadMcpToolsSchema,A as ExecuteMcpToolSchema,r as BaseStorage,w as AgentsMdMiddleware,o as AgentValidator,p as AgentSerializer,i as AgentSchema,n as AgentRepository,j as AgentPackageSchema,q as AgentPackage};
@@ -1,4 +1,4 @@
1
- import"./chunk-kba8akjs.js";import{sql as z}from"kysely";class I{db;pragmaPromise=null;constructor(x){this.db=x}ensurePragma(){if(!this.pragmaPromise)this.pragmaPromise=this.doEnsurePragma();return this.pragmaPromise}async doEnsurePragma(){await z`PRAGMA busy_timeout = 5000`.execute(this.db),await z`PRAGMA journal_mode = WAL`.execute(this.db),await z`PRAGMA synchronous = NORMAL`.execute(this.db),await z`PRAGMA wal_autocheckpoint = 1000`.execute(this.db)}dateToDb(x){return x.toISOString()}dbToDate(x){return new Date(x)}jsonToDb(x){return JSON.stringify(x)}dbToJson(x){if(typeof x==="string")try{return JSON.parse(x)}catch{return x}return x}buildJsonQuery(x,E,F,B){let G=`$.${JSON.stringify(F)}`;if(B===null)return z`
1
+ import{Kd as z}from"./chunk-hsev32dg.js";import"./chunk-dcs1r9as.js";class I{db;pragmaPromise=null;constructor(x){this.db=x}ensurePragma(){if(!this.pragmaPromise)this.pragmaPromise=this.doEnsurePragma();return this.pragmaPromise}async doEnsurePragma(){await z`PRAGMA busy_timeout = 5000`.execute(this.db),await z`PRAGMA journal_mode = WAL`.execute(this.db),await z`PRAGMA synchronous = NORMAL`.execute(this.db),await z`PRAGMA wal_autocheckpoint = 1000`.execute(this.db)}dateToDb(x){return x.toISOString()}dbToDate(x){return new Date(x)}jsonToDb(x){return JSON.stringify(x)}dbToJson(x){if(typeof x==="string")try{return JSON.parse(x)}catch{return x}return x}buildJsonQuery(x,E,F,B){let G=`$.${JSON.stringify(F)}`;if(B===null)return z`
2
2
  json_type(${z.ref(E)}, ${z.lit(G)}) = 'null'
3
3
  `;let C;if(typeof B==="string")C=B;else if(typeof B==="number")C=B;else if(typeof B==="boolean")C=B?1:0;else C=JSON.stringify(B);return z`json_extract(${z.ref(E)}, ${z.lit(G)}) = ${z.lit(C)}`}now(){return new Date().toISOString()}async createTables(x){await this.ensurePragma(),await z`
4
4
  CREATE TABLE IF NOT EXISTS threads (
@@ -0,0 +1 @@
1
+ import{Se as c}from"./chunk-66890qd3.js";import"./chunk-738m8242.js";import"./chunk-e3tyc24s.js";import"./chunk-ad2hbq42.js";import"./chunk-pwrscdkf.js";import"./chunk-fkrydbn4.js";import{Fg as a,Gg as b}from"./chunk-p0vzbr7s.js";import"./chunk-x552nspp.js";import"./chunk-48vkm1yn.js";import"./chunk-afhxxkmv.js";import"./chunk-43xrz4wp.js";import"./chunk-ac5t2ywn.js";import"./chunk-dcwnpdtk.js";import"./chunk-cbjnwrt7.js";import"./chunk-vh9zd1v3.js";import"./chunk-w2hbsa9j.js";import"./chunk-rztre6k0.js";import"./chunk-wpy5r9ma.js";import"./chunk-frhhpxxy.js";import"./chunk-h1enhch1.js";import"./chunk-hyf24r36.js";import"./chunk-578m1dhj.js";import"./chunk-1p9xzvpt.js";import"./chunk-hra0748z.js";import"./chunk-jb4yt88g.js";import"./chunk-k38fjqj7.js";import"./chunk-dcs1r9as.js";export{a as getAgentListFromPackage,c as createSubAgentsMiddleware,b as SubAgentsMiddleware};
@@ -0,0 +1,3 @@
1
+ import{qq as g,tq as u}from"./chunk-dcs1r9as.js";var e=g((D_,f)=>{var F=u("constants"),j_=process.cwd,m=null,G_=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!m)m=j_.call(process);return m};try{process.cwd()}catch(_){}if(typeof process.chdir==="function"){if(n=process.chdir,process.chdir=function(_){m=null,n.call(process,_)},Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,n)}var n;f.exports=H_;function H_(_){if(F.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./))j(_);if(!_.lutimes)D(_);if(_.chown=V(_.chown),_.fchown=V(_.fchown),_.lchown=V(_.lchown),_.chmod=W(_.chmod),_.fchmod=W(_.fchmod),_.lchmod=W(_.lchmod),_.chownSync=R(_.chownSync),_.fchownSync=R(_.fchownSync),_.lchownSync=R(_.lchownSync),_.chmodSync=U(_.chmodSync),_.fchmodSync=U(_.fchmodSync),_.lchmodSync=U(_.lchmodSync),_.stat=Q(_.stat),_.fstat=Q(_.fstat),_.lstat=Q(_.lstat),_.statSync=T(_.statSync),_.fstatSync=T(_.fstatSync),_.lstatSync=T(_.lstatSync),_.chmod&&!_.lchmod)_.lchmod=function(O,I,E){if(E)process.nextTick(E)},_.lchmodSync=function(){};if(_.chown&&!_.lchown)_.lchown=function(O,I,E,P){if(P)process.nextTick(P)},_.lchownSync=function(){};if(G_==="win32")_.rename=typeof _.rename!=="function"?_.rename:function(O){function I(E,P,z){var M=Date.now(),J=0;O(E,P,function Y(x){if(x&&(x.code==="EACCES"||x.code==="EPERM"||x.code==="EBUSY")&&Date.now()-M<60000){if(setTimeout(function(){_.stat(P,function(y,$){if(y&&y.code==="ENOENT")O(E,P,Y);else z(x)})},J),J<100)J+=10;return}if(z)z(x)})}if(Object.setPrototypeOf)Object.setPrototypeOf(I,O);return I}(_.rename);_.read=typeof _.read!=="function"?_.read:function(O){function I(E,P,z,M,J,Y){var x;if(Y&&typeof Y==="function"){var y=0;x=function($,t,r){if($&&$.code==="EAGAIN"&&y<10)return y++,O.call(_,E,P,z,M,J,x);Y.apply(this,arguments)}}return O.call(_,E,P,z,M,J,x)}if(Object.setPrototypeOf)Object.setPrototypeOf(I,O);return I}(_.read),_.readSync=typeof _.readSync!=="function"?_.readSync:function(O){return function(I,E,P,z,M){var J=0;while(!0)try{return O.call(_,I,E,P,z,M)}catch(Y){if(Y.code==="EAGAIN"&&J<10){J++;continue}throw Y}}}(_.readSync);function j(O){O.lchmod=function(I,E,P){O.open(I,F.O_WRONLY|F.O_SYMLINK,E,function(z,M){if(z){if(P)P(z);return}O.fchmod(M,E,function(J){O.close(M,function(Y){if(P)P(J||Y)})})})},O.lchmodSync=function(I,E){var P=O.openSync(I,F.O_WRONLY|F.O_SYMLINK,E),z=!0,M;try{M=O.fchmodSync(P,E),z=!1}finally{if(z)try{O.closeSync(P)}catch(J){}else O.closeSync(P)}return M}}function D(O){if(F.hasOwnProperty("O_SYMLINK")&&O.futimes)O.lutimes=function(I,E,P,z){O.open(I,F.O_SYMLINK,function(M,J){if(M){if(z)z(M);return}O.futimes(J,E,P,function(Y){O.close(J,function(x){if(z)z(Y||x)})})})},O.lutimesSync=function(I,E,P){var z=O.openSync(I,F.O_SYMLINK),M,J=!0;try{M=O.futimesSync(z,E,P),J=!1}finally{if(J)try{O.closeSync(z)}catch(Y){}else O.closeSync(z)}return M};else if(O.futimes)O.lutimes=function(I,E,P,z){if(z)process.nextTick(z)},O.lutimesSync=function(){}}function W(O){if(!O)return O;return function(I,E,P){return O.call(_,I,E,function(z){if(k(z))z=null;if(P)P.apply(this,arguments)})}}function U(O){if(!O)return O;return function(I,E){try{return O.call(_,I,E)}catch(P){if(!k(P))throw P}}}function V(O){if(!O)return O;return function(I,E,P,z){return O.call(_,I,E,P,function(M){if(k(M))M=null;if(z)z.apply(this,arguments)})}}function R(O){if(!O)return O;return function(I,E,P){try{return O.call(_,I,E,P)}catch(z){if(!k(z))throw z}}}function Q(O){if(!O)return O;return function(I,E,P){if(typeof E==="function")P=E,E=null;function z(M,J){if(J){if(J.uid<0)J.uid+=4294967296;if(J.gid<0)J.gid+=4294967296}if(P)P.apply(this,arguments)}return E?O.call(_,I,E,z):O.call(_,I,z)}}function T(O){if(!O)return O;return function(I,E){var P=E?O.call(_,I,E):O.call(_,I);if(P){if(P.uid<0)P.uid+=4294967296;if(P.gid<0)P.gid+=4294967296}return P}}function k(O){if(!O)return!0;if(O.code==="ENOSYS")return!0;var I=!process.getuid||process.getuid()!==0;if(I){if(O.code==="EINVAL"||O.code==="EPERM")return!0}return!1}}});var O_=g((V_,__)=>{var s=u("stream").Stream;__.exports=J_;function J_(_){return{ReadStream:j,WriteStream:D};function j(W,U){if(!(this instanceof j))return new j(W,U);s.call(this);var V=this;this.path=W,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,U=U||{};var R=Object.keys(U);for(var Q=0,T=R.length;Q<T;Q++){var k=R[Q];this[k]=U[k]}if(this.encoding)this.setEncoding(this.encoding);if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!=="number")throw TypeError("end must be a Number");if(this.start>this.end)throw Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){V._read()});return}_.open(this.path,this.flags,this.mode,function(O,I){if(O){V.emit("error",O),V.readable=!1;return}V.fd=I,V.emit("open",I),V._read()})}function D(W,U){if(!(this instanceof D))return new D(W,U);s.call(this),this.path=W,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,U=U||{};var V=Object.keys(U);for(var R=0,Q=V.length;R<Q;R++){var T=V[R];this[T]=U[T]}if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.start<0)throw Error("start must be >= zero");this.pos=this.start}if(this.busy=!1,this._queue=[],this.fd===null)this._open=_.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush()}}});var N_=g((A_,P_)=>{P_.exports=M_;var K_=Object.getPrototypeOf||function(_){return _.__proto__};function M_(_){if(_===null||typeof _!=="object")return _;if(_ instanceof Object)var j={__proto__:K_(_)};else var j=Object.create(null);return Object.getOwnPropertyNames(_).forEach(function(D){Object.defineProperty(j,D,Object.getOwnPropertyDescriptor(_,D))}),j}});var v_=g((L_,a)=>{var v=u("fs"),U_=e(),X_=O_(),Y_=N_(),b=u("util"),w,p;if(typeof Symbol==="function"&&typeof Symbol.for==="function")w=Symbol.for("graceful-fs.queue"),p=Symbol.for("graceful-fs.previous");else w="___graceful-fs.queue",p="___graceful-fs.previous";function Z_(){}function z_(_,j){Object.defineProperty(_,w,{get:function(){return j}})}var h=Z_;if(b.debuglog)h=b.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))h=function(){var _=b.format.apply(b,arguments);_="GFS4: "+_.split(/\n/).join(`
2
+ GFS4: `),console.error(_)};if(!v[w]){if(i=global[w]||[],z_(v,i),v.close=function(_){function j(D,W){return _.call(v,D,function(U){if(!U)E_();if(typeof W==="function")W.apply(this,arguments)})}return Object.defineProperty(j,p,{value:_}),j}(v.close),v.closeSync=function(_){function j(D){_.apply(v,arguments),E_()}return Object.defineProperty(j,p,{value:_}),j}(v.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){h(v[w]),u("assert").equal(v[w].length,0)})}var i;if(!global[w])z_(global,v[w]);a.exports=c(Y_(v));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!v.__patched)a.exports=c(v),v.__patched=!0;function c(_){U_(_),_.gracefulify=c,_.createReadStream=t,_.createWriteStream=r;var j=_.readFile;_.readFile=D;function D(N,H,G){if(typeof H==="function")G=H,H=null;return L(N,H,G);function L(q,A,Z,B){return j(q,A,function(K){if(K&&(K.code==="EMFILE"||K.code==="ENFILE"))S([L,[q,A,Z],K,B||Date.now(),Date.now()]);else if(typeof Z==="function")Z.apply(this,arguments)})}}var W=_.writeFile;_.writeFile=U;function U(N,H,G,L){if(typeof G==="function")L=G,G=null;return q(N,H,G,L);function q(A,Z,B,K,C){return W(A,Z,B,function(X){if(X&&(X.code==="EMFILE"||X.code==="ENFILE"))S([q,[A,Z,B,K],X,C||Date.now(),Date.now()]);else if(typeof K==="function")K.apply(this,arguments)})}}var V=_.appendFile;if(V)_.appendFile=R;function R(N,H,G,L){if(typeof G==="function")L=G,G=null;return q(N,H,G,L);function q(A,Z,B,K,C){return V(A,Z,B,function(X){if(X&&(X.code==="EMFILE"||X.code==="ENFILE"))S([q,[A,Z,B,K],X,C||Date.now(),Date.now()]);else if(typeof K==="function")K.apply(this,arguments)})}}var Q=_.copyFile;if(Q)_.copyFile=T;function T(N,H,G,L){if(typeof G==="function")L=G,G=0;return q(N,H,G,L);function q(A,Z,B,K,C){return Q(A,Z,B,function(X){if(X&&(X.code==="EMFILE"||X.code==="ENFILE"))S([q,[A,Z,B,K],X,C||Date.now(),Date.now()]);else if(typeof K==="function")K.apply(this,arguments)})}}var k=_.readdir;_.readdir=I;var O=/^v[0-5]\./;function I(N,H,G){if(typeof H==="function")G=H,H=null;var L=O.test(process.version)?function(Z,B,K,C){return k(Z,q(Z,B,K,C))}:function(Z,B,K,C){return k(Z,B,q(Z,B,K,C))};return L(N,H,G);function q(A,Z,B,K){return function(C,X){if(C&&(C.code==="EMFILE"||C.code==="ENFILE"))S([L,[A,Z,B],C,K||Date.now(),Date.now()]);else{if(X&&X.sort)X.sort();if(typeof B==="function")B.call(this,C,X)}}}}if(process.version.substr(0,4)==="v0.8"){var E=X_(_);Y=E.ReadStream,y=E.WriteStream}var P=_.ReadStream;if(P)Y.prototype=Object.create(P.prototype),Y.prototype.open=x;var z=_.WriteStream;if(z)y.prototype=Object.create(z.prototype),y.prototype.open=$;Object.defineProperty(_,"ReadStream",{get:function(){return Y},set:function(N){Y=N},enumerable:!0,configurable:!0}),Object.defineProperty(_,"WriteStream",{get:function(){return y},set:function(N){y=N},enumerable:!0,configurable:!0});var M=Y;Object.defineProperty(_,"FileReadStream",{get:function(){return M},set:function(N){M=N},enumerable:!0,configurable:!0});var J=y;Object.defineProperty(_,"FileWriteStream",{get:function(){return J},set:function(N){J=N},enumerable:!0,configurable:!0});function Y(N,H){if(this instanceof Y)return P.apply(this,arguments),this;else return Y.apply(Object.create(Y.prototype),arguments)}function x(){var N=this;l(N.path,N.flags,N.mode,function(H,G){if(H){if(N.autoClose)N.destroy();N.emit("error",H)}else N.fd=G,N.emit("open",G),N.read()})}function y(N,H){if(this instanceof y)return z.apply(this,arguments),this;else return y.apply(Object.create(y.prototype),arguments)}function $(){var N=this;l(N.path,N.flags,N.mode,function(H,G){if(H)N.destroy(),N.emit("error",H);else N.fd=G,N.emit("open",G)})}function t(N,H){return new _.ReadStream(N,H)}function r(N,H){return new _.WriteStream(N,H)}var I_=_.open;_.open=l;function l(N,H,G,L){if(typeof G==="function")L=G,G=null;return q(N,H,G,L);function q(A,Z,B,K,C){return I_(A,Z,B,function(X,B_){if(X&&(X.code==="EMFILE"||X.code==="ENFILE"))S([q,[A,Z,B,K],X,C||Date.now(),Date.now()]);else if(typeof K==="function")K.apply(this,arguments)})}}return _}function S(_){h("ENQUEUE",_[0].name,_[1]),v[w].push(_),o()}var d;function E_(){var _=Date.now();for(var j=0;j<v[w].length;++j)if(v[w][j].length>2)v[w][j][3]=_,v[w][j][4]=_;o()}function o(){if(clearTimeout(d),d=void 0,v[w].length===0)return;var _=v[w].shift(),j=_[0],D=_[1],W=_[2],U=_[3],V=_[4];if(U===void 0)h("RETRY",j.name,D),j.apply(null,D);else if(Date.now()-U>=60000){h("TIMEOUT",j.name,D);var R=D.pop();if(typeof R==="function")R.call(null,W)}else{var Q=Date.now()-V,T=Math.max(V-U,1),k=Math.min(T*1.2,100);if(Q>=k)h("RETRY",j.name,D),j.apply(null,D.concat([U]));else v[w].push(_)}if(d===void 0)d=setTimeout(o,0)}});
3
+ export{v_ as lq};
@@ -1,2 +1,2 @@
1
- import{R as U,T as Y,U as B,V as W}from"./chunk-va71tsw3.js";import{ea as q,fa as T,ga as O,pa as j}from"./chunk-nwy6n6b6.js";import{pb as k}from"./chunk-cyexd09c.js";import{ub as b}from"./chunk-kba8akjs.js";var J=b(q(),1);function K({manager:G,enabled:N=!0}){return Y({queryKey:W.config.detail(),queryFn:async()=>{return await G.initialize(),await G.getConfig()},enabled:N,staleTime:300000,gcTime:600000})}function P({manager:G}){let N=U();return B({mutationFn:async(R)=>{return await G.updateConfig(R),await G.getConfig()},onSuccess:(R)=>{N.setQueryData(W.config.detail(),R),N.invalidateQueries({queryKey:W.providers.all}),N.invalidateQueries({queryKey:W.models.all})}})}var X=b(j(),1),H=null,Z=null;async function S(){if(!H){if(!Z)Z=k().then((G)=>{return H=G,Z=null,G});return Z}return Promise.resolve(H)}var I=J.createContext(void 0),E=({manager:G,get_allowed_models:N,children:R})=>{let{data:z,isLoading:V,error:x}=K({manager:G}),$=P({manager:G}),{data:F=[],isLoading:h,error:p}=Y({queryKey:W.models.available(),queryFn:N,staleTime:1800000,retry:1}),A=J.useMemo(()=>{return{provider_id:z?.provider_id||"openai",provider_type:z?.provider_type||"openai",model_id:z?.model_id||F[0]?.id||"default",mcp_config:z?.mcp_config,enable_thinking:z?.enable_thinking??!0,switch_command:z?.switch_command||"",cwd:process.cwd()}},[z?.provider_id,z?.provider_type,z?.model_id,z?.mcp_config,z?.enable_thinking,z?.switch_command,z?.providers,F]),Q=J.useMemo(()=>{return z?.compact_mode??!1},[z?.compact_mode]),w=async()=>{await $.mutateAsync({compact_mode:!Q})},v=J.useMemo(()=>{return z?.show_detailed_info??!1},[z?.show_detailed_info]),L=async()=>{await $.mutateAsync({show_detailed_info:!v})},D=async(_)=>{await $.mutateAsync(_)};if(V||h)return X.jsxDEV(T,{padding:2,children:X.jsxDEV(O,{children:"Loading configuration..."},void 0,!1,void 0,this)},void 0,!1,void 0,this);return X.jsxDEV(I.Provider,{value:{config:z||null,updateConfig:D,extraParams:A,AVAILABLE_MODELS:F,manager:G,compactMode:Q,toggleCompactMode:w,showDetailedInfo:v,toggleDetailedInfo:L},children:R},void 0,!1,void 0,this)},s=()=>{let G=J.useContext(I);if(G===void 0)throw Error("useSettings must be used within a SettingsProvider");return G},r=({get_allowed_models:G,children:N})=>{let[R,z]=J.useState(null);if(J.useEffect(()=>{S().then(z)},[]),!R)return X.jsxDEV(T,{padding:2,children:X.jsxDEV(O,{children:"Initializing configuration manager..."},void 0,!1,void 0,this)},void 0,!1,void 0,this);return X.jsxDEV(E,{manager:R,get_allowed_models:G,children:N},void 0,!1,void 0,this)};
2
- export{s as N,r as O};
1
+ import{M as U,O as Y,P as B,Q as W}from"./chunk-55nx49pj.js";import{Ae as T,Be as O,Ke as j,ye as q}from"./chunk-a90fm6gz.js";import{Pf as k}from"./chunk-fkrydbn4.js";import{pq as b}from"./chunk-dcs1r9as.js";var J=b(q(),1);function K({manager:G,enabled:N=!0}){return Y({queryKey:W.config.detail(),queryFn:async()=>{return await G.initialize(),await G.getConfig()},enabled:N,staleTime:300000,gcTime:600000})}function P({manager:G}){let N=U();return B({mutationFn:async(R)=>{return await G.updateConfig(R),await G.getConfig()},onSuccess:(R)=>{N.setQueryData(W.config.detail(),R),N.invalidateQueries({queryKey:W.providers.all}),N.invalidateQueries({queryKey:W.models.all})}})}var X=b(j(),1),H=null,Z=null;async function S(){if(!H){if(!Z)Z=k().then((G)=>{return H=G,Z=null,G});return Z}return Promise.resolve(H)}var I=J.createContext(void 0),E=({manager:G,get_allowed_models:N,children:R})=>{let{data:z,isLoading:V,error:x}=K({manager:G}),$=P({manager:G}),{data:F=[],isLoading:h,error:p}=Y({queryKey:W.models.available(),queryFn:N,staleTime:1800000,retry:1}),A=J.useMemo(()=>{return{provider_id:z?.provider_id||"openai",provider_type:z?.provider_type||"openai",model_id:z?.model_id||F[0]?.id||"default",mcp_config:z?.mcp_config,enable_thinking:z?.enable_thinking??!0,switch_command:z?.switch_command||"",cwd:process.cwd()}},[z?.provider_id,z?.provider_type,z?.model_id,z?.mcp_config,z?.enable_thinking,z?.switch_command,z?.providers,F]),Q=J.useMemo(()=>{return z?.compact_mode??!1},[z?.compact_mode]),w=async()=>{await $.mutateAsync({compact_mode:!Q})},v=J.useMemo(()=>{return z?.show_detailed_info??!1},[z?.show_detailed_info]),L=async()=>{await $.mutateAsync({show_detailed_info:!v})},D=async(_)=>{await $.mutateAsync(_)};if(V||h)return X.jsxDEV(T,{padding:2,children:X.jsxDEV(O,{children:"Loading configuration..."},void 0,!1,void 0,this)},void 0,!1,void 0,this);return X.jsxDEV(I.Provider,{value:{config:z||null,updateConfig:D,extraParams:A,AVAILABLE_MODELS:F,manager:G,compactMode:Q,toggleCompactMode:w,showDetailedInfo:v,toggleDetailedInfo:L},children:R},void 0,!1,void 0,this)},s=()=>{let G=J.useContext(I);if(G===void 0)throw Error("useSettings must be used within a SettingsProvider");return G},r=({get_allowed_models:G,children:N})=>{let[R,z]=J.useState(null);if(J.useEffect(()=>{S().then(z)},[]),!R)return X.jsxDEV(T,{padding:2,children:X.jsxDEV(O,{children:"Initializing configuration manager..."},void 0,!1,void 0,this)},void 0,!1,void 0,this);return X.jsxDEV(E,{manager:R,get_allowed_models:G,children:N},void 0,!1,void 0,this)};
2
+ export{s as I,r as J};
@@ -0,0 +1,2 @@
1
+ import{ri as o}from"./chunk-cbjnwrt7.js";var e=o;
2
+ export{e as _g};
@@ -0,0 +1 @@
1
+ import{Af as o,Bf as p,Cf as q,Df as r,Ef as s,Ff as t,Gf as u,Hf as v,If as w,Jf as x,Kf as y,Lf as z,Mf as A,sf as b,tf as h,uf as i,vf as j,wf as k,xf as l,yf as m,zf as n}from"./chunk-ad2hbq42.js";import{Nf as e}from"./chunk-pwrscdkf.js";import{Of as a,Pf as f,Qf as g}from"./chunk-fkrydbn4.js";import"./chunk-43xrz4wp.js";import"./chunk-cbjnwrt7.js";import"./chunk-wpy5r9ma.js";import{kq as c}from"./chunk-578m1dhj.js";import"./chunk-1p9xzvpt.js";import"./chunk-hra0748z.js";import{nq as d}from"./chunk-jb4yt88g.js";import"./chunk-k38fjqj7.js";import"./chunk-dcs1r9as.js";export{i as createServerWithManager,m as createRemoteManager,f as createFSManager,g as createCustomManager,h as createConfigServer,y as TaskStoreSchema,A as TaskStoreManager,t as TaskStatusSchema,w as TaskNodeSchema,v as TaskExecutionSchema,x as TaskExecutionRecordSchema,s as SparkStoreSchema,z as SparkStoreManager,p as SparkStatusSchema,q as SparkSourceSchema,o as SparkPrioritySchema,n as SparkItemTypeSchema,r as SparkItemSchema,k as RemoteSkillStore,l as RemotePluginStore,j as RemoteConfigStore,d as FileSystemSkillStore,e as FileSystemPluginStore,c as FileSystemConfigStore,b as ConfigServer,a as ConfigManager,u as AgentTypeSchema};
@@ -0,0 +1,5 @@
1
+ import{Dl as m}from"./chunk-rztre6k0.js";var B=Symbol("Let zodToJsonSchema decide on which parser to use");var M={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},U=(t)=>typeof t==="string"?{...M,name:t}:{...M,...t};var b=(t,n)=>{let r=0;for(;r<t.length&&r<n.length;r++)if(t[r]!==n[r])break;return[(t.length-r).toString(),...n.slice(r)].join("/")};function D(t){if(t.target!=="openAi")return{};let n=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?b(n,t.currentPath):n.join("/")}}function S(t,n,r,o){if(!o?.errorMessages)return;if(r)t.errorMessage={...t.errorMessage,[n]:r}}function e(t,n,r,o,p){t[n]=r,S(t,n,o,p)}function w(t,n){let r={type:"array"};if(t.type?._def&&t.type?._def?.typeName!==m.ZodAny)r.items=i(t.type._def,{...n,currentPath:[...n.currentPath,"items"]});if(t.minLength)e(r,"minItems",t.minLength.value,t.minLength.message,n);if(t.maxLength)e(r,"maxItems",t.maxLength.value,t.maxLength.message,n);if(t.exactLength)e(r,"minItems",t.exactLength.value,t.exactLength.message,n),e(r,"maxItems",t.exactLength.value,t.exactLength.message,n);return r}function E(t,n){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let o of t.checks)switch(o.kind){case"min":if(n.target==="jsonSchema7")if(o.inclusive)e(r,"minimum",o.value,o.message,n);else e(r,"exclusiveMinimum",o.value,o.message,n);else{if(!o.inclusive)r.exclusiveMinimum=!0;e(r,"minimum",o.value,o.message,n)}break;case"max":if(n.target==="jsonSchema7")if(o.inclusive)e(r,"maximum",o.value,o.message,n);else e(r,"exclusiveMaximum",o.value,o.message,n);else{if(!o.inclusive)r.exclusiveMaximum=!0;e(r,"maximum",o.value,o.message,n)}break;case"multipleOf":e(r,"multipleOf",o.value,o.message,n);break}return r}function K(){return{type:"boolean"}}function N(t,n){return i(t.type._def,n)}var $=(t,n)=>{return i(t.innerType._def,n)};function O(t,n,r){let o=r??n.dateStrategy;if(Array.isArray(o))return{anyOf:o.map((p,u)=>O(t,n,p))};switch(o){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return it(t,n)}}var it=(t,n)=>{let r={type:"integer",format:"unix-time"};if(n.target==="openApi3")return r;for(let o of t.checks)switch(o.kind){case"min":e(r,"minimum",o.value,o.message,n);break;case"max":e(r,"maximum",o.value,o.message,n);break}return r};function J(t,n){return{...i(t.innerType._def,n),default:t.defaultValue()}}function q(t,n){return n.effectStrategy==="input"?i(t.schema._def,n):D(n)}function Q(t){return{type:"string",enum:Array.from(t.values)}}var ut=(t)=>{if("type"in t&&t.type==="string")return!1;return"allOf"in t};function X(t,n){let r=[i(t.left._def,{...n,currentPath:[...n.currentPath,"allOf","0"]}),i(t.right._def,{...n,currentPath:[...n.currentPath,"allOf","1"]})].filter((u)=>!!u),o=n.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,p=[];return r.forEach((u)=>{if(ut(u)){if(p.push(...u.allOf),u.unevaluatedProperties===void 0)o=void 0}else{let l=u;if("additionalProperties"in u&&u.additionalProperties===!1){let{additionalProperties:y,...a}=u;l=a}else o=void 0;p.push(l)}}),p.length?{allOf:p,...o}:void 0}function Y(t,n){let r=typeof t.value;if(r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string")return{type:Array.isArray(t.value)?"array":"object"};if(n.target==="openApi3")return{type:r==="bigint"?"integer":r,enum:[t.value]};return{type:r==="bigint"?"integer":r,const:t.value}}var I=void 0,Z={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(I===void 0)I=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return I},uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function A(t,n){let r={type:"string"};if(t.checks)for(let o of t.checks)switch(o.kind){case"min":e(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,o.value):o.value,o.message,n);break;case"max":e(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,o.value):o.value,o.message,n);break;case"email":switch(n.emailStrategy){case"format:email":v(r,"email",o.message,n);break;case"format:idn-email":v(r,"idn-email",o.message,n);break;case"pattern:zod":g(r,Z.email,o.message,n);break}break;case"url":v(r,"uri",o.message,n);break;case"uuid":v(r,"uuid",o.message,n);break;case"regex":g(r,o.regex,o.message,n);break;case"cuid":g(r,Z.cuid,o.message,n);break;case"cuid2":g(r,Z.cuid2,o.message,n);break;case"startsWith":g(r,RegExp(`^${L(o.value,n)}`),o.message,n);break;case"endsWith":g(r,RegExp(`${L(o.value,n)}$`),o.message,n);break;case"datetime":v(r,"date-time",o.message,n);break;case"date":v(r,"date",o.message,n);break;case"time":v(r,"time",o.message,n);break;case"duration":v(r,"duration",o.message,n);break;case"length":e(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,o.value):o.value,o.message,n),e(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,o.value):o.value,o.message,n);break;case"includes":{g(r,RegExp(L(o.value,n)),o.message,n);break}case"ip":{if(o.version!=="v6")v(r,"ipv4",o.message,n);if(o.version!=="v4")v(r,"ipv6",o.message,n);break}case"base64url":g(r,Z.base64url,o.message,n);break;case"jwt":g(r,Z.jwt,o.message,n);break;case"cidr":{if(o.version!=="v6")g(r,Z.ipv4Cidr,o.message,n);if(o.version!=="v4")g(r,Z.ipv6Cidr,o.message,n);break}case"emoji":g(r,Z.emoji(),o.message,n);break;case"ulid":{g(r,Z.ulid,o.message,n);break}case"base64":{switch(n.base64Strategy){case"format:binary":{v(r,"binary",o.message,n);break}case"contentEncoding:base64":{e(r,"contentEncoding","base64",o.message,n);break}case"pattern:zod":{g(r,Z.base64,o.message,n);break}}break}case"nanoid":g(r,Z.nanoid,o.message,n);case"toLowerCase":case"toUpperCase":case"trim":break;default:((p)=>{})(o)}return r}function L(t,n){return n.patternStrategy==="escape"?at(t):t}var mt=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function at(t){let n="";for(let r=0;r<t.length;r++){if(!mt.has(t[r]))n+="\\";n+=t[r]}return n}function v(t,n,r,o){if(t.format||t.anyOf?.some((p)=>p.format)){if(!t.anyOf)t.anyOf=[];if(t.format){if(t.anyOf.push({format:t.format,...t.errorMessage&&o.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage){if(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0)delete t.errorMessage}}t.anyOf.push({format:n,...r&&o.errorMessages&&{errorMessage:{format:r}}})}else e(t,"format",n,r,o)}function g(t,n,r,o){if(t.pattern||t.allOf?.some((p)=>p.pattern)){if(!t.allOf)t.allOf=[];if(t.pattern){if(t.allOf.push({pattern:t.pattern,...t.errorMessage&&o.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage){if(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0)delete t.errorMessage}}t.allOf.push({pattern:H(n,o),...r&&o.errorMessages&&{errorMessage:{pattern:r}}})}else e(t,"pattern",H(n,o),r,o)}function H(t,n){if(!n.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},o=r.i?t.source.toLowerCase():t.source,p="",u=!1,l=!1,y=!1;for(let a=0;a<o.length;a++){if(u){p+=o[a],u=!1;continue}if(r.i){if(l){if(o[a].match(/[a-z]/)){if(y)p+=o[a],p+=`${o[a-2]}-${o[a]}`.toUpperCase(),y=!1;else if(o[a+1]==="-"&&o[a+2]?.match(/[a-z]/))p+=o[a],y=!0;else p+=`${o[a]}${o[a].toUpperCase()}`;continue}}else if(o[a].match(/[a-z]/)){p+=`[${o[a]}${o[a].toUpperCase()}]`;continue}}if(r.m){if(o[a]==="^"){p+=`(^|(?<=[\r
2
+ ]))`;continue}else if(o[a]==="$"){p+=`($|(?=[\r
3
+ ]))`;continue}}if(r.s&&o[a]==="."){p+=l?`${o[a]}\r
4
+ `:`[${o[a]}\r
5
+ ]`;continue}if(p+=o[a],o[a]==="\\")u=!0;else if(l&&o[a]==="]")l=!1;else if(!l&&o[a]==="[")l=!0}try{new RegExp(p)}catch{return console.warn(`Could not convert regex pattern at ${n.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return p}function P(t,n){if(n.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(n.target==="openApi3"&&t.keyType?._def.typeName===m.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((o,p)=>({...o,[p]:i(t.valueType._def,{...n,currentPath:[...n.currentPath,"properties",p]})??D(n)}),{}),additionalProperties:n.rejectedAdditionalProperties};let r={type:"object",additionalProperties:i(t.valueType._def,{...n,currentPath:[...n.currentPath,"additionalProperties"]})??n.allowedAdditionalProperties};if(n.target==="openApi3")return r;if(t.keyType?._def.typeName===m.ZodString&&t.keyType._def.checks?.length){let{type:o,...p}=A(t.keyType._def,n);return{...r,propertyNames:p}}else if(t.keyType?._def.typeName===m.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};else if(t.keyType?._def.typeName===m.ZodBranded&&t.keyType._def.type._def.typeName===m.ZodString&&t.keyType._def.type._def.checks?.length){let{type:o,...p}=N(t.keyType._def,n);return{...r,propertyNames:p}}return r}function V(t,n){if(n.mapStrategy==="record")return P(t,n);let r=i(t.keyType._def,{...n,currentPath:[...n.currentPath,"items","items","0"]})||D(n),o=i(t.valueType._def,{...n,currentPath:[...n.currentPath,"items","items","1"]})||D(n);return{type:"array",maxItems:125,items:{type:"array",items:[r,o],minItems:2,maxItems:2}}}function W(t){let n=t.values,o=Object.keys(t.values).filter((u)=>{return typeof n[n[u]]!=="number"}).map((u)=>n[u]),p=Array.from(new Set(o.map((u)=>typeof u)));return{type:p.length===1?p[0]==="string"?"string":"number":["string","number"],enum:o}}function z(t){return t.target==="openAi"?void 0:{not:D({...t,currentPath:[...t.currentPath,"not"]})}}function F(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var _={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function G(t,n){if(n.target==="openApi3")return d(t,n);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every((o)=>(o._def.typeName in _)&&(!o._def.checks||!o._def.checks.length))){let o=r.reduce((p,u)=>{let l=_[u._def.typeName];return l&&!p.includes(l)?[...p,l]:p},[]);return{type:o.length>1?o:o[0]}}else if(r.every((o)=>o._def.typeName==="ZodLiteral"&&!o.description)){let o=r.reduce((p,u)=>{let l=typeof u._def.value;switch(l){case"string":case"number":case"boolean":return[...p,l];case"bigint":return[...p,"integer"];case"object":if(u._def.value===null)return[...p,"null"];case"symbol":case"undefined":case"function":default:return p}},[]);if(o.length===r.length){let p=o.filter((u,l,y)=>y.indexOf(u)===l);return{type:p.length>1?p:p[0],enum:r.reduce((u,l)=>{return u.includes(l._def.value)?u:[...u,l._def.value]},[])}}}else if(r.every((o)=>o._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((o,p)=>[...o,...p._def.values.filter((u)=>!o.includes(u))],[])};return d(t,n)}var d=(t,n)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((o,p)=>i(o._def,{...n,currentPath:[...n.currentPath,"anyOf",`${p}`]})).filter((o)=>!!o&&(!n.strictUnions||typeof o==="object"&&Object.keys(o).length>0));return r.length?{anyOf:r}:void 0};function j(t,n){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length)){if(n.target==="openApi3")return{type:_[t.innerType._def.typeName],nullable:!0};return{type:[_[t.innerType._def.typeName],"null"]}}if(n.target==="openApi3"){let o=i(t.innerType._def,{...n,currentPath:[...n.currentPath]});if(o&&"$ref"in o)return{allOf:[o],nullable:!0};return o&&{...o,nullable:!0}}let r=i(t.innerType._def,{...n,currentPath:[...n.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function C(t,n){let r={type:"number"};if(!t.checks)return r;for(let o of t.checks)switch(o.kind){case"int":r.type="integer",S(r,"type",o.message,n);break;case"min":if(n.target==="jsonSchema7")if(o.inclusive)e(r,"minimum",o.value,o.message,n);else e(r,"exclusiveMinimum",o.value,o.message,n);else{if(!o.inclusive)r.exclusiveMinimum=!0;e(r,"minimum",o.value,o.message,n)}break;case"max":if(n.target==="jsonSchema7")if(o.inclusive)e(r,"maximum",o.value,o.message,n);else e(r,"exclusiveMaximum",o.value,o.message,n);else{if(!o.inclusive)r.exclusiveMaximum=!0;e(r,"maximum",o.value,o.message,n)}break;case"multipleOf":e(r,"multipleOf",o.value,o.message,n);break}return r}function R(t,n){let r=n.target==="openAi",o={type:"object",properties:{}},p=[],u=t.shape();for(let y in u){let a=u[y];if(a===void 0||a._def===void 0)continue;let x=lt(a);if(x&&r){if(a._def.typeName==="ZodOptional")a=a._def.innerType;if(!a.isNullable())a=a.nullable();x=!1}let T=i(a._def,{...n,currentPath:[...n.currentPath,"properties",y],propertyPath:[...n.currentPath,"properties",y]});if(T===void 0)continue;if(o.properties[y]=T,!x)p.push(y)}if(p.length)o.required=p;let l=et(t,n);if(l!==void 0)o.additionalProperties=l;return o}function et(t,n){if(t.catchall._def.typeName!=="ZodNever")return i(t.catchall._def,{...n,currentPath:[...n.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return n.allowedAdditionalProperties;case"strict":return n.rejectedAdditionalProperties;case"strip":return n.removeAdditionalStrategy==="strict"?n.allowedAdditionalProperties:n.rejectedAdditionalProperties}}function lt(t){try{return t.isOptional()}catch{return!0}}var k=(t,n)=>{if(n.currentPath.toString()===n.propertyPath?.toString())return i(t.innerType._def,n);let r=i(t.innerType._def,{...n,currentPath:[...n.currentPath,"anyOf","1"]});return r?{anyOf:[{not:D(n)},r]}:D(n)};var c=(t,n)=>{if(n.pipeStrategy==="input")return i(t.in._def,n);else if(n.pipeStrategy==="output")return i(t.out._def,n);let r=i(t.in._def,{...n,currentPath:[...n.currentPath,"allOf","0"]}),o=i(t.out._def,{...n,currentPath:[...n.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,o].filter((p)=>p!==void 0)}};function h(t,n){return i(t.type._def,n)}function f(t,n){let o={type:"array",uniqueItems:!0,items:i(t.valueType._def,{...n,currentPath:[...n.currentPath,"items"]})};if(t.minSize)e(o,"minItems",t.minSize.value,t.minSize.message,n);if(t.maxSize)e(o,"maxItems",t.maxSize.value,t.maxSize.message,n);return o}function s(t,n){if(t.rest)return{type:"array",minItems:t.items.length,items:t.items.map((r,o)=>i(r._def,{...n,currentPath:[...n.currentPath,"items",`${o}`]})).reduce((r,o)=>o===void 0?r:[...r,o],[]),additionalItems:i(t.rest._def,{...n,currentPath:[...n.currentPath,"additionalItems"]})};else return{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,o)=>i(r._def,{...n,currentPath:[...n.currentPath,"items",`${o}`]})).reduce((r,o)=>o===void 0?r:[...r,o],[])}}function tt(t){return{not:D(t)}}function nt(t){return D(t)}var rt=(t,n)=>{return i(t.innerType._def,n)};var ot=(t,n,r)=>{switch(n){case m.ZodString:return A(t,r);case m.ZodNumber:return C(t,r);case m.ZodObject:return R(t,r);case m.ZodBigInt:return E(t,r);case m.ZodBoolean:return K();case m.ZodDate:return O(t,r);case m.ZodUndefined:return tt(r);case m.ZodNull:return F(r);case m.ZodArray:return w(t,r);case m.ZodUnion:case m.ZodDiscriminatedUnion:return G(t,r);case m.ZodIntersection:return X(t,r);case m.ZodTuple:return s(t,r);case m.ZodRecord:return P(t,r);case m.ZodLiteral:return Y(t,r);case m.ZodEnum:return Q(t);case m.ZodNativeEnum:return W(t);case m.ZodNullable:return j(t,r);case m.ZodOptional:return k(t,r);case m.ZodMap:return V(t,r);case m.ZodSet:return f(t,r);case m.ZodLazy:return()=>t.getter()._def;case m.ZodPromise:return h(t,r);case m.ZodNaN:case m.ZodNever:return z(r);case m.ZodEffects:return q(t,r);case m.ZodAny:return D(r);case m.ZodUnknown:return nt(r);case m.ZodDefault:return J(t,r);case m.ZodBranded:return N(t,r);case m.ZodReadonly:return rt(t,r);case m.ZodCatch:return $(t,r);case m.ZodPipeline:return c(t,r);case m.ZodFunction:case m.ZodVoid:case m.ZodSymbol:return;default:return((o)=>{return})(n)}};function i(t,n,r=!1){let o=n.seen.get(t);if(n.override){let y=n.override?.(t,n,o,r);if(y!==B)return y}if(o&&!r){let y=yt(o,n);if(y!==void 0)return y}let p={def:t,path:n.currentPath,jsonSchema:void 0};n.seen.set(t,p);let u=ot(t,t.typeName,n),l=typeof u==="function"?i(u(),n):u;if(l)Dt(t,n,l);if(n.postProcess){let y=n.postProcess(l,t,n);return p.jsonSchema=l,y}return p.jsonSchema=l,l}var yt=(t,n)=>{switch(n.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:b(n.currentPath,t.path)};case"none":case"seen":{if(t.path.length<n.currentPath.length&&t.path.every((r,o)=>n.currentPath[o]===r))return console.warn(`Recursive reference detected at ${n.currentPath.join("/")}! Defaulting to any`),D(n);return n.$refStrategy==="seen"?D(n):void 0}}},Dt=(t,n,r)=>{if(t.description){if(r.description=t.description,n.markdownDescription)r.markdownDescription=t.description}return r};var pt=(t)=>{let n=U(t),r=n.name!==void 0?[...n.basePath,n.definitionPath,n.name]:n.basePath;return{...n,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(n.definitions).map(([o,p])=>[p._def,{def:p._def,path:[...n.basePath,n.definitionPath,o],jsonSchema:void 0}]))}};var gt=(t,n)=>{let r=pt(n),o=typeof n==="object"&&n.definitions?Object.entries(n.definitions).reduce((a,[x,T])=>({...a,[x]:i(T._def,{...r,currentPath:[...r.basePath,r.definitionPath,x]},!0)??D(r)}),{}):void 0,p=typeof n==="string"?n:n?.nameStrategy==="title"?void 0:n?.name,u=i(t._def,p===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,p]},!1)??D(r),l=typeof n==="object"&&n.name!==void 0&&n.nameStrategy==="title"?n.name:void 0;if(l!==void 0)u.title=l;if(r.flags.hasReferencedOpenAiAnyType){if(!o)o={};if(!o[r.openAiAnyTypeName])o[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}}let y=p===void 0?o?{...u,[r.definitionPath]:o}:u:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,p].join("/"),[r.definitionPath]:{...o,[p]:u}};if(r.target==="jsonSchema7")y.$schema="http://json-schema.org/draft-07/schema#";else if(r.target==="jsonSchema2019-09"||r.target==="openAi")y.$schema="https://json-schema.org/draft/2019-09/schema#";if(r.target==="openAi"&&(("anyOf"in y)||("oneOf"in y)||("allOf"in y)||("type"in y)&&Array.isArray(y.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return y};export{gt as Kg};
@@ -1,7 +1,7 @@
1
- import{ea as c}from"./chunk-nwy6n6b6.js";import{ub as h,vb as wY}from"./chunk-kba8akjs.js";var IX=wY((DY)=>{var p=h(c());(function(){function X($){if($==null)return null;if(typeof $==="function")return $.$$typeof===i?null:$.displayName||$.name||null;if(typeof $==="string")return $;switch($){case L:return"Fragment";case k:return"Profiler";case P:return"StrictMode";case b:return"Suspense";case YX:return"SuspenseList";case d:return"Activity"}if(typeof $==="object")switch(typeof $.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),$.$$typeof){case w:return"Portal";case R:return $.displayName||"Context";case S:return($._context.displayName||"Context")+".Consumer";case g:var V=$.render;return $=$.displayName,$||($=V.displayName||V.name||"",$=$!==""?"ForwardRef("+$+")":"ForwardRef"),$;case O:return V=$.displayName||null,V!==null?V:X($.type)||"Memo";case Q:V=$._payload,$=$._init;try{return X($(V))}catch(D){}}return null}function Y($){return""+$}function G($){try{Y($);var V=!1}catch(_X){V=!0}if(V){V=console;var D=V.error,T=typeof Symbol==="function"&&Symbol.toStringTag&&$[Symbol.toStringTag]||$.constructor.name||"Object";return D.call(V,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",T),Y($)}}function J($){if($===L)return"<>";if(typeof $==="object"&&$!==null&&$.$$typeof===Q)return"<...>";try{var V=X($);return V?"<"+V+">":"<...>"}catch(D){return"<...>"}}function Z(){var $=s.A;return $===null?null:$.getOwner()}function H(){return Error("react-stack-top-frame")}function _($){if(y.call($,"key")){var V=Object.getOwnPropertyDescriptor($,"key").get;if(V&&V.isReactWarning)return!1}return $.key!==void 0}function W($,V){function D(){vX||(vX=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",V))}D.isReactWarning=!0,Object.defineProperty($,"key",{get:D,configurable:!0})}function A(){var $=X(this.type);return gX[$]||(gX[$]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),$=this.props.ref,$!==void 0?$:null}function U($,V,D,T,_X,KX){var I=D.ref;return $={$$typeof:K,type:$,key:V,props:D,_owner:T},(I!==void 0?I:null)!==null?Object.defineProperty($,"ref",{enumerable:!1,get:A}):Object.defineProperty($,"ref",{enumerable:!1,value:null}),$._store={},Object.defineProperty($._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty($,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty($,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:_X}),Object.defineProperty($,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:KX}),Object.freeze&&(Object.freeze($.props),Object.freeze($)),$}function z($,V,D,T,_X,KX){var I=V.children;if(I!==void 0)if(T)if(n(I)){for(T=0;T<I.length;T++)E(I[T]);Object.freeze&&Object.freeze(I)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else E(I);if(y.call(V,"key")){I=X($);var a=Object.keys(V).filter(function(BY){return BY!=="key"});T=0<a.length?"{key: someKey, "+a.join(": ..., ")+": ...}":"{key: someKey}",mX[I+T]||(a=0<a.length?"{"+a.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ import{ye as c}from"./chunk-a90fm6gz.js";import{pq as h,qq as wY}from"./chunk-dcs1r9as.js";var IX=wY((DY)=>{var p=h(c());(function(){function X($){if($==null)return null;if(typeof $==="function")return $.$$typeof===i?null:$.displayName||$.name||null;if(typeof $==="string")return $;switch($){case L:return"Fragment";case k:return"Profiler";case P:return"StrictMode";case b:return"Suspense";case YX:return"SuspenseList";case d:return"Activity"}if(typeof $==="object")switch(typeof $.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),$.$$typeof){case w:return"Portal";case R:return $.displayName||"Context";case S:return($._context.displayName||"Context")+".Consumer";case g:var V=$.render;return $=$.displayName,$||($=V.displayName||V.name||"",$=$!==""?"ForwardRef("+$+")":"ForwardRef"),$;case O:return V=$.displayName||null,V!==null?V:X($.type)||"Memo";case Q:V=$._payload,$=$._init;try{return X($(V))}catch(D){}}return null}function Y($){return""+$}function G($){try{Y($);var V=!1}catch(_X){V=!0}if(V){V=console;var D=V.error,T=typeof Symbol==="function"&&Symbol.toStringTag&&$[Symbol.toStringTag]||$.constructor.name||"Object";return D.call(V,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",T),Y($)}}function J($){if($===L)return"<>";if(typeof $==="object"&&$!==null&&$.$$typeof===Q)return"<...>";try{var V=X($);return V?"<"+V+">":"<...>"}catch(D){return"<...>"}}function Z(){var $=s.A;return $===null?null:$.getOwner()}function H(){return Error("react-stack-top-frame")}function _($){if(y.call($,"key")){var V=Object.getOwnPropertyDescriptor($,"key").get;if(V&&V.isReactWarning)return!1}return $.key!==void 0}function W($,V){function D(){vX||(vX=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",V))}D.isReactWarning=!0,Object.defineProperty($,"key",{get:D,configurable:!0})}function A(){var $=X(this.type);return gX[$]||(gX[$]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),$=this.props.ref,$!==void 0?$:null}function U($,V,D,T,_X,KX){var I=D.ref;return $={$$typeof:K,type:$,key:V,props:D,_owner:T},(I!==void 0?I:null)!==null?Object.defineProperty($,"ref",{enumerable:!1,get:A}):Object.defineProperty($,"ref",{enumerable:!1,value:null}),$._store={},Object.defineProperty($._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty($,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty($,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:_X}),Object.defineProperty($,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:KX}),Object.freeze&&(Object.freeze($.props),Object.freeze($)),$}function z($,V,D,T,_X,KX){var I=V.children;if(I!==void 0)if(T)if(n(I)){for(T=0;T<I.length;T++)E(I[T]);Object.freeze&&Object.freeze(I)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else E(I);if(y.call(V,"key")){I=X($);var a=Object.keys(V).filter(function(BY){return BY!=="key"});T=0<a.length?"{key: someKey, "+a.join(": ..., ")+": ...}":"{key: someKey}",mX[I+T]||(a=0<a.length?"{"+a.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
6
  <%s key={someKey} {...props} />`,T,I,a,I),mX[I+T]=!0)}if(I=null,D!==void 0&&(G(D),I=""+D),_(V)&&(G(V.key),I=""+V.key),"key"in V){D={};for(var TX in V)TX!=="key"&&(D[TX]=V[TX])}else D=V;return I&&W(D,typeof $==="function"?$.displayName||$.name||"Unknown":$),U($,I,D,Z(),_X,KX)}function E($){N($)?$._store&&($._store.validated=1):typeof $==="object"&&$!==null&&$.$$typeof===Q&&($._payload.status==="fulfilled"?N($._payload.value)&&$._payload.value._store&&($._payload.value._store.validated=1):$._store&&($._store.validated=1))}function N($){return typeof $==="object"&&$!==null&&$.$$typeof===K}var K=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),R=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),YX=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),d=Symbol.for("react.activity"),i=Symbol.for("react.client.reference"),s=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,y=Object.prototype.hasOwnProperty,n=Array.isArray,EX=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function($){return $()}};var vX,gX={},bX=p.react_stack_bottom_frame.bind(p,H)(),hX=EX(J(H)),mX={};DY.Fragment=L,DY.jsx=function($,V,D){var T=1e4>s.recentlyCreatedOwnerStacks++;return z($,V,D,!1,T?Error("react-stack-top-frame"):bX,T?EX(J($)):hX)},DY.jsxs=function($,V,D){var T=1e4>s.recentlyCreatedOwnerStacks++;return z($,V,D,!0,T?Error("react-stack-top-frame"):bX,T?EX(J($)):hX)}})()});var o=h(c(),1),fX=h(IX(),1),PX=o.createContext(void 0),GX=(X)=>{let Y=o.useContext(PX);if(X)return X;if(!Y)throw Error("No QueryClient set, use QueryClientProvider to set one");return Y},FY=({client:X,children:Y})=>{return o.useEffect(()=>{return X.mount(),()=>{X.unmount()}},[X]),fX.jsx(PX.Provider,{value:X,children:Y})};var M=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(X){return this.listeners.add(X),this.onSubscribe(),()=>{this.listeners.delete(X),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var EY={setTimeout:(X,Y)=>setTimeout(X,Y),clearTimeout:(X)=>clearTimeout(X),setInterval:(X,Y)=>setInterval(X,Y),clearInterval:(X)=>clearInterval(X)},KY=class{#X=EY;#Y=!1;setTimeoutProvider(X){if(this.#Y&&X!==this.#X)console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:this.#X,provider:X});this.#X=X,this.#Y=!1}setTimeout(X,Y){return this.#Y=!0,this.#X.setTimeout(X,Y)}clearTimeout(X){this.#X.clearTimeout(X)}setInterval(X,Y){return this.#Y=!0,this.#X.setInterval(X,Y)}clearInterval(X){this.#X.clearInterval(X)}},q=new KY;function dX(X){setTimeout(X,0)}var x=typeof window>"u"||"Deno"in globalThis;function F(){}function cX(X,Y){return typeof X==="function"?X(Y):X}function JX(X){return typeof X==="number"&&X>=0&&X!==1/0}function VX(X,Y){return Math.max(X+(Y||0)-Date.now(),0)}function C(X,Y){return typeof X==="function"?X(Y):X}function j(X,Y){return typeof X==="function"?X(Y):X}function AX(X,Y){let{type:G="all",exact:J,fetchStatus:Z,predicate:H,queryKey:_,stale:W}=X;if(_){if(J){if(Y.queryHash!==ZX(_,Y.options))return!1}else if(!u(Y.queryKey,_))return!1}if(G!=="all"){let A=Y.isActive();if(G==="active"&&!A)return!1;if(G==="inactive"&&A)return!1}if(typeof W==="boolean"&&Y.isStale()!==W)return!1;if(Z&&Z!==Y.state.fetchStatus)return!1;if(H&&!H(Y))return!1;return!0}function NX(X,Y){let{exact:G,status:J,predicate:Z,mutationKey:H}=X;if(H){if(!Y.options.mutationKey)return!1;if(G){if(v(Y.options.mutationKey)!==v(H))return!1}else if(!u(Y.options.mutationKey,H))return!1}if(J&&Y.state.status!==J)return!1;if(Z&&!Z(Y))return!1;return!0}function ZX(X,Y){return(Y?.queryKeyHashFn||v)(X)}function v(X){return JSON.stringify(X,(Y,G)=>kX(G)?Object.keys(G).sort().reduce((J,Z)=>{return J[Z]=G[Z],J},{}):G)}function u(X,Y){if(X===Y)return!0;if(typeof X!==typeof Y)return!1;if(X&&Y&&typeof X==="object"&&typeof Y==="object")return Object.keys(Y).every((G)=>u(X[G],Y[G]));return!1}var TY=Object.prototype.hasOwnProperty;function zX(X,Y,G=0){if(X===Y)return X;if(G>500)return Y;let J=yX(X)&&yX(Y);if(!J&&!(kX(X)&&kX(Y)))return Y;let H=(J?X:Object.keys(X)).length,_=J?Y:Object.keys(Y),W=_.length,A=J?Array(W):{},U=0;for(let z=0;z<W;z++){let E=J?z:_[z],N=X[E],K=Y[E];if(N===K){if(A[E]=N,J?z<H:TY.call(X,E))U++;continue}if(N===null||K===null||typeof N!=="object"||typeof K!=="object"){A[E]=K;continue}let w=zX(N,K,G+1);if(A[E]=w,w===N)U++}return H===W&&U===H?X:A}function r(X,Y){if(!Y||Object.keys(X).length!==Object.keys(Y).length)return!1;for(let G in X)if(X[G]!==Y[G])return!1;return!0}function yX(X){return Array.isArray(X)&&X.length===Object.keys(X).length}function kX(X){if(!pX(X))return!1;let Y=X.constructor;if(Y===void 0)return!0;let G=Y.prototype;if(!pX(G))return!1;if(!G.hasOwnProperty("isPrototypeOf"))return!1;if(Object.getPrototypeOf(X)!==Object.prototype)return!1;return!0}function pX(X){return Object.prototype.toString.call(X)==="[object Object]"}function lX(X){return new Promise((Y)=>{q.setTimeout(Y,X)})}function $X(X,Y,G){if(typeof G.structuralSharing==="function")return G.structuralSharing(X,Y);else if(G.structuralSharing!==!1){try{return zX(X,Y)}catch(J){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${G.queryHash}]: ${J}`),J}return zX(X,Y)}return Y}function uX(X,Y,G=0){let J=[...X,Y];return G&&J.length>G?J.slice(1):J}function iX(X,Y,G=0){let J=[Y,...X];return G&&J.length>G?J.slice(0,-1):J}var l=Symbol();function LX(X,Y){if(X.queryFn===l)console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${X.queryHash}'`);if(!X.queryFn&&Y?.initialPromise)return()=>Y.initialPromise;if(!X.queryFn||X.queryFn===l)return()=>Promise.reject(Error(`Missing queryFn: '${X.queryHash}'`));return X.queryFn}function t(X,Y){if(typeof X==="function")return X(...Y);return!!X}function sX(X,Y,G){let J=!1,Z;return Object.defineProperty(X,"signal",{enumerable:!0,get:()=>{if(Z??=Y(),J)return Z;if(J=!0,Z.aborted)G();else Z.addEventListener("abort",G,{once:!0});return Z}}),X}var IY=class extends M{#X;#Y;#G;constructor(){super();this.#G=(X)=>{if(!x&&window.addEventListener){let Y=()=>X();return window.addEventListener("visibilitychange",Y,!1),()=>{window.removeEventListener("visibilitychange",Y)}}return}}onSubscribe(){if(!this.#Y)this.setEventListener(this.#G)}onUnsubscribe(){if(!this.hasListeners())this.#Y?.(),this.#Y=void 0}setEventListener(X){this.#G=X,this.#Y?.(),this.#Y=X((Y)=>{if(typeof Y==="boolean")this.setFocused(Y);else this.onFocus()})}setFocused(X){if(this.#X!==X)this.#X=X,this.onFocus()}onFocus(){let X=this.isFocused();this.listeners.forEach((Y)=>{Y(X)})}isFocused(){if(typeof this.#X==="boolean")return this.#X;return globalThis.document?.visibilityState!=="hidden"}},e=new IY;function WX(){let X,Y,G=new Promise((Z,H)=>{X=Z,Y=H});G.status="pending",G.catch(()=>{});function J(Z){Object.assign(G,Z),delete G.resolve,delete G.reject}return G.resolve=(Z)=>{J({status:"fulfilled",value:Z}),X(Z)},G.reject=(Z)=>{J({status:"rejected",reason:Z}),Y(Z)},G}var nX=dX;function PY(){let X=[],Y=0,G=(W)=>{W()},J=(W)=>{W()},Z=nX,H=(W)=>{if(Y)X.push(W);else Z(()=>{G(W)})},_=()=>{let W=X;if(X=[],W.length)Z(()=>{J(()=>{W.forEach((A)=>{G(A)})})})};return{batch:(W)=>{let A;Y++;try{A=W()}finally{if(Y--,!Y)_()}return A},batchCalls:(W)=>{return(...A)=>{H(()=>{W(...A)})}},schedule:H,setNotifyFunction:(W)=>{G=W},setBatchNotifyFunction:(W)=>{J=W},setScheduler:(W)=>{Z=W}}}var B=PY();var kY=class extends M{#X=!0;#Y;#G;constructor(){super();this.#G=(X)=>{if(!x&&window.addEventListener){let Y=()=>X(!0),G=()=>X(!1);return window.addEventListener("online",Y,!1),window.addEventListener("offline",G,!1),()=>{window.removeEventListener("online",Y),window.removeEventListener("offline",G)}}return}}onSubscribe(){if(!this.#Y)this.setEventListener(this.#G)}onUnsubscribe(){if(!this.hasListeners())this.#Y?.(),this.#Y=void 0}setEventListener(X){this.#G=X,this.#Y?.(),this.#Y=X(this.setOnline.bind(this))}setOnline(X){if(this.#X!==X)this.#X=X,this.listeners.forEach((G)=>{G(X)})}isOnline(){return this.#X}},XX=new kY;function QY(X){return Math.min(1000*2**X,30000)}function QX(X){return(X??"online")==="online"?XX.isOnline():!0}var UX=class extends Error{constructor(X){super("CancelledError");this.revert=X?.revert,this.silent=X?.silent}};function BX(X){let Y=!1,G=0,J,Z=WX(),H=()=>Z.status!=="pending",_=(L)=>{if(!H()){let P=new UX(L);N(P),X.onCancel?.(P)}},W=()=>{Y=!0},A=()=>{Y=!1},U=()=>e.isFocused()&&(X.networkMode==="always"||XX.isOnline())&&X.canRun(),z=()=>QX(X.networkMode)&&X.canRun(),E=(L)=>{if(!H())J?.(),Z.resolve(L)},N=(L)=>{if(!H())J?.(),Z.reject(L)},K=()=>{return new Promise((L)=>{J=(P)=>{if(H()||U())L(P)},X.onPause?.()}).then(()=>{if(J=void 0,!H())X.onContinue?.()})},w=()=>{if(H())return;let L,P=G===0?X.initialPromise:void 0;try{L=P??X.fn()}catch(k){L=Promise.reject(k)}Promise.resolve(L).then(E).catch((k)=>{if(H())return;let S=X.retry??(x?0:3),R=X.retryDelay??QY,g=typeof R==="function"?R(G,k):R,b=S===!0||typeof S==="number"&&G<S||typeof S==="function"&&S(G,k);if(Y||!b){N(k);return}G++,X.onFail?.(G,k),lX(g).then(()=>{return U()?void 0:K()}).then(()=>{if(Y)N(k);else w()})})};return{promise:Z,status:()=>Z.status,cancel:_,continue:()=>{return J?.(),Z},cancelRetry:W,continueRetry:A,canStart:z,start:()=>{if(z())w();else K().then(w);return Z}}}var wX=class{#X;destroy(){this.clearGcTimeout()}scheduleGc(){if(this.clearGcTimeout(),JX(this.gcTime))this.#X=q.setTimeout(()=>{this.optionalRemove()},this.gcTime)}updateGcTime(X){this.gcTime=Math.max(this.gcTime||0,X??(x?1/0:300000))}clearGcTimeout(){if(this.#X)q.clearTimeout(this.#X),this.#X=void 0}};var rX=class extends wX{#X;#Y;#G;#Z;#J;#W;#H;constructor(X){super();this.#H=!1,this.#W=X.defaultOptions,this.setOptions(X.options),this.observers=[],this.#Z=X.client,this.#G=this.#Z.getQueryCache(),this.queryKey=X.queryKey,this.queryHash=X.queryHash,this.#X=oX(this.options),this.state=X.state??this.#X,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#J?.promise}setOptions(X){if(this.options={...this.#W,...X},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let Y=oX(this.options);if(Y.data!==void 0)this.setState(aX(Y.data,Y.dataUpdatedAt)),this.#X=Y}}optionalRemove(){if(!this.observers.length&&this.state.fetchStatus==="idle")this.#G.remove(this)}setData(X,Y){let G=$X(this.state.data,X,this.options);return this.#$({data:G,type:"success",dataUpdatedAt:Y?.updatedAt,manual:Y?.manual}),G}setState(X,Y){this.#$({type:"setState",state:X,setStateOptions:Y})}cancel(X){let Y=this.#J?.promise;return this.#J?.cancel(X),Y?Y.then(F).catch(F):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#X)}isActive(){return this.observers.some((X)=>j(X.options.enabled,this)!==!1)}isDisabled(){if(this.getObserversCount()>0)return!this.isActive();return this.options.queryFn===l||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){if(this.getObserversCount()>0)return this.observers.some((X)=>C(X.options.staleTime,this)==="static");return!1}isStale(){if(this.getObserversCount()>0)return this.observers.some((X)=>X.getCurrentResult().isStale);return this.state.data===void 0||this.state.isInvalidated}isStaleByTime(X=0){if(this.state.data===void 0)return!0;if(X==="static")return!1;if(this.state.isInvalidated)return!0;return!VX(this.state.dataUpdatedAt,X)}onFocus(){this.observers.find((Y)=>Y.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#J?.continue()}onOnline(){this.observers.find((Y)=>Y.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#J?.continue()}addObserver(X){if(!this.observers.includes(X))this.observers.push(X),this.clearGcTimeout(),this.#G.notify({type:"observerAdded",query:this,observer:X})}removeObserver(X){if(this.observers.includes(X)){if(this.observers=this.observers.filter((Y)=>Y!==X),!this.observers.length){if(this.#J)if(this.#H)this.#J.cancel({revert:!0});else this.#J.cancelRetry();this.scheduleGc()}this.#G.notify({type:"observerRemoved",query:this,observer:X})}}getObserversCount(){return this.observers.length}invalidate(){if(!this.state.isInvalidated)this.#$({type:"invalidate"})}async fetch(X,Y){if(this.state.fetchStatus!=="idle"&&this.#J?.status()!=="rejected"){if(this.state.data!==void 0&&Y?.cancelRefetch)this.cancel({silent:!0});else if(this.#J)return this.#J.continueRetry(),this.#J.promise}if(X)this.setOptions(X);if(!this.options.queryFn){let W=this.observers.find((A)=>A.options.queryFn);if(W)this.setOptions(W.options)}if(!Array.isArray(this.options.queryKey))console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']");let G=new AbortController,J=(W)=>{Object.defineProperty(W,"signal",{enumerable:!0,get:()=>{return this.#H=!0,G.signal}})},Z=()=>{let W=LX(this.options,Y),U=(()=>{let z={client:this.#Z,queryKey:this.queryKey,meta:this.meta};return J(z),z})();if(this.#H=!1,this.options.persister)return this.options.persister(W,U,this);return W(U)},_=(()=>{let W={fetchOptions:Y,options:this.options,queryKey:this.queryKey,client:this.#Z,state:this.state,fetchFn:Z};return J(W),W})();if(this.options.behavior?.onFetch(_,this),this.#Y=this.state,this.state.fetchStatus==="idle"||this.state.fetchMeta!==_.fetchOptions?.meta)this.#$({type:"fetch",meta:_.fetchOptions?.meta});this.#J=BX({initialPromise:Y?.initialPromise,fn:_.fetchFn,onCancel:(W)=>{if(W instanceof UX&&W.revert)this.setState({...this.#Y,fetchStatus:"idle"});G.abort()},onFail:(W,A)=>{this.#$({type:"failed",failureCount:W,error:A})},onPause:()=>{this.#$({type:"pause"})},onContinue:()=>{this.#$({type:"continue"})},retry:_.options.retry,retryDelay:_.options.retryDelay,networkMode:_.options.networkMode,canRun:()=>!0});try{let W=await this.#J.start();if(W===void 0)throw console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),Error(`${this.queryHash} data is undefined`);return this.setData(W),this.#G.config.onSuccess?.(W,this),this.#G.config.onSettled?.(W,this.state.error,this),W}catch(W){if(W instanceof UX){if(W.silent)return this.#J.promise;else if(W.revert){if(this.state.data===void 0)throw W;return this.state.data}}throw this.#$({type:"error",error:W}),this.#G.config.onError?.(W,this),this.#G.config.onSettled?.(this.state.data,W,this),W}finally{this.scheduleGc()}}#$(X){let Y=(G)=>{switch(X.type){case"failed":return{...G,fetchFailureCount:X.failureCount,fetchFailureReason:X.error};case"pause":return{...G,fetchStatus:"paused"};case"continue":return{...G,fetchStatus:"fetching"};case"fetch":return{...G,...xX(G.data,this.options),fetchMeta:X.meta??null};case"success":let J={...G,...aX(X.data,X.dataUpdatedAt),dataUpdateCount:G.dataUpdateCount+1,...!X.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#Y=X.manual?J:void 0,J;case"error":let Z=X.error;return{...G,error:Z,errorUpdateCount:G.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:G.fetchFailureCount+1,fetchFailureReason:Z,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...G,isInvalidated:!0};case"setState":return{...G,...X.state}}};this.state=Y(this.state),B.batch(()=>{this.observers.forEach((G)=>{G.onQueryUpdate()}),this.#G.notify({query:this,type:"updated",action:X})})}};function xX(X,Y){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:QX(Y.networkMode)?"fetching":"paused",...X===void 0&&{error:null,status:"pending"}}}function aX(X,Y){return{data:X,dataUpdatedAt:Y??Date.now(),error:null,isInvalidated:!1,status:"success"}}function oX(X){let Y=typeof X.initialData==="function"?X.initialData():X.initialData,G=Y!==void 0,J=G?typeof X.initialDataUpdatedAt==="function"?X.initialDataUpdatedAt():X.initialDataUpdatedAt:0;return{data:Y,dataUpdateCount:0,dataUpdatedAt:G?J??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:G?"success":"pending",fetchStatus:"idle"}}var SX=class extends M{constructor(X,Y){super();this.options=Y,this.#X=X,this.#$=null,this.#H=WX(),this.bindMethods(),this.setOptions(Y)}#X;#Y=void 0;#G=void 0;#Z=void 0;#J;#W;#H;#$;#B;#N;#L;#z;#V;#_;#U=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){if(this.listeners.size===1){if(this.#Y.addObserver(this),tX(this.#Y,this.options))this.#A();else this.updateResult();this.#E()}}onUnsubscribe(){if(!this.hasListeners())this.destroy()}shouldFetchOnReconnect(){return jX(this.#Y,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return jX(this.#Y,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#K(),this.#T(),this.#Y.removeObserver(this)}setOptions(X){let Y=this.options,G=this.#Y;if(this.options=this.#X.defaultQueryOptions(X),this.options.enabled!==void 0&&typeof this.options.enabled!=="boolean"&&typeof this.options.enabled!=="function"&&typeof j(this.options.enabled,this.#Y)!=="boolean")throw Error("Expected enabled to be a boolean or a callback that returns a boolean");if(this.#I(),this.#Y.setOptions(this.options),Y._defaulted&&!r(this.options,Y))this.#X.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#Y,observer:this});let J=this.hasListeners();if(J&&eX(this.#Y,G,this.options,Y))this.#A();if(this.updateResult(),J&&(this.#Y!==G||j(this.options.enabled,this.#Y)!==j(Y.enabled,this.#Y)||C(this.options.staleTime,this.#Y)!==C(Y.staleTime,this.#Y)))this.#w();let Z=this.#D();if(J&&(this.#Y!==G||j(this.options.enabled,this.#Y)!==j(Y.enabled,this.#Y)||Z!==this.#_))this.#F(Z)}getOptimisticResult(X){let Y=this.#X.getQueryCache().build(this.#X,X),G=this.createResult(Y,X);if(jY(this,G))this.#Z=G,this.#W=this.options,this.#J=this.#Y.state;return G}getCurrentResult(){return this.#Z}trackResult(X,Y){return new Proxy(X,{get:(G,J)=>{if(this.trackProp(J),Y?.(J),J==="promise"){if(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#H.status==="pending")this.#H.reject(Error("experimental_prefetchInRender feature flag is not enabled"))}return Reflect.get(G,J)}})}trackProp(X){this.#U.add(X)}getCurrentQuery(){return this.#Y}refetch({...X}={}){return this.fetch({...X})}fetchOptimistic(X){let Y=this.#X.defaultQueryOptions(X),G=this.#X.getQueryCache().build(this.#X,Y);return G.fetch().then(()=>this.createResult(G,Y))}fetch(X){return this.#A({...X,cancelRefetch:X.cancelRefetch??!0}).then(()=>{return this.updateResult(),this.#Z})}#A(X){this.#I();let Y=this.#Y.fetch(this.options,X);if(!X?.throwOnError)Y=Y.catch(F);return Y}#w(){this.#K();let X=C(this.options.staleTime,this.#Y);if(x||this.#Z.isStale||!JX(X))return;let G=VX(this.#Z.dataUpdatedAt,X)+1;this.#z=q.setTimeout(()=>{if(!this.#Z.isStale)this.updateResult()},G)}#D(){return(typeof this.options.refetchInterval==="function"?this.options.refetchInterval(this.#Y):this.options.refetchInterval)??!1}#F(X){if(this.#T(),this.#_=X,x||j(this.options.enabled,this.#Y)===!1||!JX(this.#_)||this.#_===0)return;this.#V=q.setInterval(()=>{if(this.options.refetchIntervalInBackground||e.isFocused())this.#A()},this.#_)}#E(){this.#w(),this.#F(this.#D())}#K(){if(this.#z)q.clearTimeout(this.#z),this.#z=void 0}#T(){if(this.#V)q.clearInterval(this.#V),this.#V=void 0}createResult(X,Y){let G=this.#Y,J=this.options,Z=this.#Z,H=this.#J,_=this.#W,A=X!==G?X.state:this.#G,{state:U}=X,z={...U},E=!1,N;if(Y._optimisticResults){let Q=this.hasListeners(),d=!Q&&tX(X,Y),i=Q&&eX(X,G,Y,J);if(d||i)z={...z,...xX(U.data,X.options)};if(Y._optimisticResults==="isRestoring")z.fetchStatus="idle"}let{error:K,errorUpdatedAt:w,status:L}=z;N=z.data;let P=!1;if(Y.placeholderData!==void 0&&N===void 0&&L==="pending"){let Q;if(Z?.isPlaceholderData&&Y.placeholderData===_?.placeholderData)Q=Z.data,P=!0;else Q=typeof Y.placeholderData==="function"?Y.placeholderData(this.#L?.state.data,this.#L):Y.placeholderData;if(Q!==void 0)L="success",N=$X(Z?.data,Q,Y),E=!0}if(Y.select&&N!==void 0&&!P)if(Z&&N===H?.data&&Y.select===this.#B)N=this.#N;else try{this.#B=Y.select,N=Y.select(N),N=$X(Z?.data,N,Y),this.#N=N,this.#$=null}catch(Q){this.#$=Q}if(this.#$)K=this.#$,N=this.#N,w=Date.now(),L="error";let k=z.fetchStatus==="fetching",S=L==="pending",R=L==="error",g=S&&k,b=N!==void 0,O={status:L,fetchStatus:z.fetchStatus,isPending:S,isSuccess:L==="success",isError:R,isInitialLoading:g,isLoading:g,data:N,dataUpdatedAt:z.dataUpdatedAt,error:K,errorUpdatedAt:w,failureCount:z.fetchFailureCount,failureReason:z.fetchFailureReason,errorUpdateCount:z.errorUpdateCount,isFetched:z.dataUpdateCount>0||z.errorUpdateCount>0,isFetchedAfterMount:z.dataUpdateCount>A.dataUpdateCount||z.errorUpdateCount>A.errorUpdateCount,isFetching:k,isRefetching:k&&!S,isLoadingError:R&&!b,isPaused:z.fetchStatus==="paused",isPlaceholderData:E,isRefetchError:R&&b,isStale:MX(X,Y),refetch:this.refetch,promise:this.#H,isEnabled:j(Y.enabled,X)!==!1};if(this.options.experimental_prefetchInRender){let Q=O.data!==void 0,d=O.status==="error"&&!Q,i=(n)=>{if(d)n.reject(O.error);else if(Q)n.resolve(O.data)},s=()=>{let n=this.#H=O.promise=WX();i(n)},y=this.#H;switch(y.status){case"pending":if(X.queryHash===G.queryHash)i(y);break;case"fulfilled":if(d||O.data!==y.value)s();break;case"rejected":if(!d||O.error!==y.reason)s();break}}return O}updateResult(){let X=this.#Z,Y=this.createResult(this.#Y,this.options);if(this.#J=this.#Y.state,this.#W=this.options,this.#J.data!==void 0)this.#L=this.#Y;if(r(Y,X))return;this.#Z=Y;let G=()=>{if(!X)return!0;let{notifyOnChangeProps:J}=this.options,Z=typeof J==="function"?J():J;if(Z==="all"||!Z&&!this.#U.size)return!0;let H=new Set(Z??this.#U);if(this.options.throwOnError)H.add("error");return Object.keys(this.#Z).some((_)=>{let W=_;return this.#Z[W]!==X[W]&&H.has(W)})};this.#P({listeners:G()})}#I(){let X=this.#X.getQueryCache().build(this.#X,this.options);if(X===this.#Y)return;let Y=this.#Y;if(this.#Y=X,this.#G=X.state,this.hasListeners())Y?.removeObserver(this),X.addObserver(this)}onQueryUpdate(){if(this.updateResult(),this.hasListeners())this.#E()}#P(X){B.batch(()=>{if(X.listeners)this.listeners.forEach((Y)=>{Y(this.#Z)});this.#X.getQueryCache().notify({query:this.#Y,type:"observerResultsUpdated"})})}};function xY(X,Y){return j(Y.enabled,X)!==!1&&X.state.data===void 0&&!(X.state.status==="error"&&Y.retryOnMount===!1)}function tX(X,Y){return xY(X,Y)||X.state.data!==void 0&&jX(X,Y,Y.refetchOnMount)}function jX(X,Y,G){if(j(Y.enabled,X)!==!1&&C(Y.staleTime,X)!=="static"){let J=typeof G==="function"?G(X):G;return J==="always"||J!==!1&&MX(X,Y)}return!1}function eX(X,Y,G,J){return(X!==Y||j(J.enabled,X)===!1)&&(!G.suspense||X.state.status!=="error")&&MX(X,G)}function MX(X,Y){return j(Y.enabled,X)!==!1&&X.isStaleByTime(C(Y.staleTime,X))}function jY(X,Y){if(!r(X.getCurrentResult(),Y))return!0;return!1}function RX(X){return{onFetch:(Y,G)=>{let J=Y.options,Z=Y.fetchOptions?.meta?.fetchMore?.direction,H=Y.state.data?.pages||[],_=Y.state.data?.pageParams||[],W={pages:[],pageParams:[]},A=0,U=async()=>{let z=!1,E=(w)=>{sX(w,()=>Y.signal,()=>z=!0)},N=LX(Y.options,Y.fetchOptions),K=async(w,L,P)=>{if(z)return Promise.reject();if(L==null&&w.pages.length)return Promise.resolve(w);let S=(()=>{let YX={client:Y.client,queryKey:Y.queryKey,pageParam:L,direction:P?"backward":"forward",meta:Y.options.meta};return E(YX),YX})(),R=await N(S),{maxPages:g}=Y.options,b=P?iX:uX;return{pages:b(w.pages,R,g),pageParams:b(w.pageParams,L,g)}};if(Z&&H.length){let w=Z==="backward",L=w?SY:XY,P={pages:H,pageParams:_},k=L(J,P);W=await K(P,k,w)}else{let w=X??H.length;do{let L=A===0?_[0]??J.initialPageParam:XY(J,W);if(A>0&&L==null)break;W=await K(W,L),A++}while(A<w)}return W};if(Y.options.persister)Y.fetchFn=()=>{return Y.options.persister?.(U,{client:Y.client,queryKey:Y.queryKey,meta:Y.options.meta,signal:Y.signal},G)};else Y.fetchFn=U}}}function XY(X,{pages:Y,pageParams:G}){let J=Y.length-1;return Y.length>0?X.getNextPageParam(Y[J],Y,G[J],G):void 0}function SY(X,{pages:Y,pageParams:G}){return Y.length>0?X.getPreviousPageParam?.(Y[0],Y,G[0],G):void 0}var YY=class extends wX{#X;#Y;#G;#Z;constructor(X){super();this.#X=X.client,this.mutationId=X.mutationId,this.#G=X.mutationCache,this.#Y=[],this.state=X.state||CX(),this.setOptions(X.options),this.scheduleGc()}setOptions(X){this.options=X,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(X){if(!this.#Y.includes(X))this.#Y.push(X),this.clearGcTimeout(),this.#G.notify({type:"observerAdded",mutation:this,observer:X})}removeObserver(X){this.#Y=this.#Y.filter((Y)=>Y!==X),this.scheduleGc(),this.#G.notify({type:"observerRemoved",mutation:this,observer:X})}optionalRemove(){if(!this.#Y.length)if(this.state.status==="pending")this.scheduleGc();else this.#G.remove(this)}continue(){return this.#Z?.continue()??this.execute(this.state.variables)}async execute(X){let Y=()=>{this.#J({type:"continue"})},G={client:this.#X,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#Z=BX({fn:()=>{if(!this.options.mutationFn)return Promise.reject(Error("No mutationFn found"));return this.options.mutationFn(X,G)},onFail:(H,_)=>{this.#J({type:"failed",failureCount:H,error:_})},onPause:()=>{this.#J({type:"pause"})},onContinue:Y,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#G.canRun(this)});let J=this.state.status==="pending",Z=!this.#Z.canStart();try{if(J)Y();else{if(this.#J({type:"pending",variables:X,isPaused:Z}),this.#G.config.onMutate)await this.#G.config.onMutate(X,this,G);let _=await this.options.onMutate?.(X,G);if(_!==this.state.context)this.#J({type:"pending",context:_,variables:X,isPaused:Z})}let H=await this.#Z.start();return await this.#G.config.onSuccess?.(H,X,this.state.context,this,G),await this.options.onSuccess?.(H,X,this.state.context,G),await this.#G.config.onSettled?.(H,null,this.state.variables,this.state.context,this,G),await this.options.onSettled?.(H,null,X,this.state.context,G),this.#J({type:"success",data:H}),H}catch(H){try{await this.#G.config.onError?.(H,X,this.state.context,this,G)}catch(_){Promise.reject(_)}try{await this.options.onError?.(H,X,this.state.context,G)}catch(_){Promise.reject(_)}try{await this.#G.config.onSettled?.(void 0,H,this.state.variables,this.state.context,this,G)}catch(_){Promise.reject(_)}try{await this.options.onSettled?.(void 0,H,X,this.state.context,G)}catch(_){Promise.reject(_)}throw this.#J({type:"error",error:H}),H}finally{this.#G.runNext(this)}}#J(X){let Y=(G)=>{switch(X.type){case"failed":return{...G,failureCount:X.failureCount,failureReason:X.error};case"pause":return{...G,isPaused:!0};case"continue":return{...G,isPaused:!1};case"pending":return{...G,context:X.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:X.isPaused,status:"pending",variables:X.variables,submittedAt:Date.now()};case"success":return{...G,data:X.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...G,data:void 0,error:X.error,failureCount:G.failureCount+1,failureReason:X.error,isPaused:!1,status:"error"}}};this.state=Y(this.state),B.batch(()=>{this.#Y.forEach((G)=>{G.onMutationUpdate(X)}),this.#G.notify({mutation:this,type:"updated",action:X})})}};function CX(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var GY=class extends M{constructor(X={}){super();this.config=X,this.#X=new Set,this.#Y=new Map,this.#G=0}#X;#Y;#G;build(X,Y,G){let J=new YY({client:X,mutationCache:this,mutationId:++this.#G,options:X.defaultMutationOptions(Y),state:G});return this.add(J),J}add(X){this.#X.add(X);let Y=DX(X);if(typeof Y==="string"){let G=this.#Y.get(Y);if(G)G.push(X);else this.#Y.set(Y,[X])}this.notify({type:"added",mutation:X})}remove(X){if(this.#X.delete(X)){let Y=DX(X);if(typeof Y==="string"){let G=this.#Y.get(Y);if(G){if(G.length>1){let J=G.indexOf(X);if(J!==-1)G.splice(J,1)}else if(G[0]===X)this.#Y.delete(Y)}}}this.notify({type:"removed",mutation:X})}canRun(X){let Y=DX(X);if(typeof Y==="string"){let J=this.#Y.get(Y)?.find((Z)=>Z.state.status==="pending");return!J||J===X}else return!0}runNext(X){let Y=DX(X);if(typeof Y==="string")return this.#Y.get(Y)?.find((J)=>J!==X&&J.state.isPaused)?.continue()??Promise.resolve();else return Promise.resolve()}clear(){B.batch(()=>{this.#X.forEach((X)=>{this.notify({type:"removed",mutation:X})}),this.#X.clear(),this.#Y.clear()})}getAll(){return Array.from(this.#X)}find(X){let Y={exact:!0,...X};return this.getAll().find((G)=>NX(Y,G))}findAll(X={}){return this.getAll().filter((Y)=>NX(X,Y))}notify(X){B.batch(()=>{this.listeners.forEach((Y)=>{Y(X)})})}resumePausedMutations(){let X=this.getAll().filter((Y)=>Y.state.isPaused);return B.batch(()=>Promise.all(X.map((Y)=>Y.continue().catch(F))))}};function DX(X){return X.options.scope?.id}var OX=class extends M{#X;#Y=void 0;#G;#Z;constructor(X,Y){super();this.#X=X,this.setOptions(Y),this.bindMethods(),this.#J()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(X){let Y=this.options;if(this.options=this.#X.defaultMutationOptions(X),!r(this.options,Y))this.#X.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#G,observer:this});if(Y?.mutationKey&&this.options.mutationKey&&v(Y.mutationKey)!==v(this.options.mutationKey))this.reset();else if(this.#G?.state.status==="pending")this.#G.setOptions(this.options)}onUnsubscribe(){if(!this.hasListeners())this.#G?.removeObserver(this)}onMutationUpdate(X){this.#J(),this.#W(X)}getCurrentResult(){return this.#Y}reset(){this.#G?.removeObserver(this),this.#G=void 0,this.#J(),this.#W()}mutate(X,Y){return this.#Z=Y,this.#G?.removeObserver(this),this.#G=this.#X.getMutationCache().build(this.#X,this.options),this.#G.addObserver(this),this.#G.execute(X)}#J(){let X=this.#G?.state??CX();this.#Y={...X,isPending:X.status==="pending",isSuccess:X.status==="success",isError:X.status==="error",isIdle:X.status==="idle",mutate:this.mutate,reset:this.reset}}#W(X){B.batch(()=>{if(this.#Z&&this.hasListeners()){let Y=this.#Y.variables,G=this.#Y.context,J={client:this.#X,meta:this.options.meta,mutationKey:this.options.mutationKey};if(X?.type==="success"){try{this.#Z.onSuccess?.(X.data,Y,G,J)}catch(Z){Promise.reject(Z)}try{this.#Z.onSettled?.(X.data,null,Y,G,J)}catch(Z){Promise.reject(Z)}}else if(X?.type==="error"){try{this.#Z.onError?.(X.error,Y,G,J)}catch(Z){Promise.reject(Z)}try{this.#Z.onSettled?.(void 0,X.error,Y,G,J)}catch(Z){Promise.reject(Z)}}}this.listeners.forEach((Y)=>{Y(this.#Y)})})}};var JY=class extends M{constructor(X={}){super();this.config=X,this.#X=new Map}#X;build(X,Y,G){let J=Y.queryKey,Z=Y.queryHash??ZX(J,Y),H=this.get(Z);if(!H)H=new rX({client:X,queryKey:J,queryHash:Z,options:X.defaultQueryOptions(Y),state:G,defaultOptions:X.getQueryDefaults(J)}),this.add(H);return H}add(X){if(!this.#X.has(X.queryHash))this.#X.set(X.queryHash,X),this.notify({type:"added",query:X})}remove(X){let Y=this.#X.get(X.queryHash);if(Y){if(X.destroy(),Y===X)this.#X.delete(X.queryHash);this.notify({type:"removed",query:X})}}clear(){B.batch(()=>{this.getAll().forEach((X)=>{this.remove(X)})})}get(X){return this.#X.get(X)}getAll(){return[...this.#X.values()]}find(X){let Y={exact:!0,...X};return this.getAll().find((G)=>AX(Y,G))}findAll(X={}){let Y=this.getAll();return Object.keys(X).length>0?Y.filter((G)=>AX(X,G)):Y}notify(X){B.batch(()=>{this.listeners.forEach((Y)=>{Y(X)})})}onFocus(){B.batch(()=>{this.getAll().forEach((X)=>{X.onFocus()})})}onOnline(){B.batch(()=>{this.getAll().forEach((X)=>{X.onOnline()})})}};var MY=class{#X;#Y;#G;#Z;#J;#W;#H;#$;constructor(X={}){this.#X=X.queryCache||new JY,this.#Y=X.mutationCache||new GY,this.#G=X.defaultOptions||{},this.#Z=new Map,this.#J=new Map,this.#W=0}mount(){if(this.#W++,this.#W!==1)return;this.#H=e.subscribe(async(X)=>{if(X)await this.resumePausedMutations(),this.#X.onFocus()}),this.#$=XX.subscribe(async(X)=>{if(X)await this.resumePausedMutations(),this.#X.onOnline()})}unmount(){if(this.#W--,this.#W!==0)return;this.#H?.(),this.#H=void 0,this.#$?.(),this.#$=void 0}isFetching(X){return this.#X.findAll({...X,fetchStatus:"fetching"}).length}isMutating(X){return this.#Y.findAll({...X,status:"pending"}).length}getQueryData(X){let Y=this.defaultQueryOptions({queryKey:X});return this.#X.get(Y.queryHash)?.state.data}ensureQueryData(X){let Y=this.defaultQueryOptions(X),G=this.#X.build(this,Y),J=G.state.data;if(J===void 0)return this.fetchQuery(X);if(X.revalidateIfStale&&G.isStaleByTime(C(Y.staleTime,G)))this.prefetchQuery(Y);return Promise.resolve(J)}getQueriesData(X){return this.#X.findAll(X).map(({queryKey:Y,state:G})=>{let J=G.data;return[Y,J]})}setQueryData(X,Y,G){let J=this.defaultQueryOptions({queryKey:X}),H=this.#X.get(J.queryHash)?.state.data,_=cX(Y,H);if(_===void 0)return;return this.#X.build(this,J).setData(_,{...G,manual:!0})}setQueriesData(X,Y,G){return B.batch(()=>this.#X.findAll(X).map(({queryKey:J})=>[J,this.setQueryData(J,Y,G)]))}getQueryState(X){let Y=this.defaultQueryOptions({queryKey:X});return this.#X.get(Y.queryHash)?.state}removeQueries(X){let Y=this.#X;B.batch(()=>{Y.findAll(X).forEach((G)=>{Y.remove(G)})})}resetQueries(X,Y){let G=this.#X;return B.batch(()=>{return G.findAll(X).forEach((J)=>{J.reset()}),this.refetchQueries({type:"active",...X},Y)})}cancelQueries(X,Y={}){let G={revert:!0,...Y},J=B.batch(()=>this.#X.findAll(X).map((Z)=>Z.cancel(G)));return Promise.all(J).then(F).catch(F)}invalidateQueries(X,Y={}){return B.batch(()=>{if(this.#X.findAll(X).forEach((G)=>{G.invalidate()}),X?.refetchType==="none")return Promise.resolve();return this.refetchQueries({...X,type:X?.refetchType??X?.type??"active"},Y)})}refetchQueries(X,Y={}){let G={...Y,cancelRefetch:Y.cancelRefetch??!0},J=B.batch(()=>this.#X.findAll(X).filter((Z)=>!Z.isDisabled()&&!Z.isStatic()).map((Z)=>{let H=Z.fetch(void 0,G);if(!G.throwOnError)H=H.catch(F);return Z.state.fetchStatus==="paused"?Promise.resolve():H}));return Promise.all(J).then(F)}fetchQuery(X){let Y=this.defaultQueryOptions(X);if(Y.retry===void 0)Y.retry=!1;let G=this.#X.build(this,Y);return G.isStaleByTime(C(Y.staleTime,G))?G.fetch(Y):Promise.resolve(G.state.data)}prefetchQuery(X){return this.fetchQuery(X).then(F).catch(F)}fetchInfiniteQuery(X){return X.behavior=RX(X.pages),this.fetchQuery(X)}prefetchInfiniteQuery(X){return this.fetchInfiniteQuery(X).then(F).catch(F)}ensureInfiniteQueryData(X){return X.behavior=RX(X.pages),this.ensureQueryData(X)}resumePausedMutations(){if(XX.isOnline())return this.#Y.resumePausedMutations();return Promise.resolve()}getQueryCache(){return this.#X}getMutationCache(){return this.#Y}getDefaultOptions(){return this.#G}setDefaultOptions(X){this.#G=X}setQueryDefaults(X,Y){this.#Z.set(v(X),{queryKey:X,defaultOptions:Y})}getQueryDefaults(X){let Y=[...this.#Z.values()],G={};return Y.forEach((J)=>{if(u(X,J.queryKey))Object.assign(G,J.defaultOptions)}),G}setMutationDefaults(X,Y){this.#J.set(v(X),{mutationKey:X,defaultOptions:Y})}getMutationDefaults(X){let Y=[...this.#J.values()],G={};return Y.forEach((J)=>{if(u(X,J.mutationKey))Object.assign(G,J.defaultOptions)}),G}defaultQueryOptions(X){if(X._defaulted)return X;let Y={...this.#G.queries,...this.getQueryDefaults(X.queryKey),...X,_defaulted:!0};if(!Y.queryHash)Y.queryHash=ZX(Y.queryKey,Y);if(Y.refetchOnReconnect===void 0)Y.refetchOnReconnect=Y.networkMode!=="always";if(Y.throwOnError===void 0)Y.throwOnError=!!Y.suspense;if(!Y.networkMode&&Y.persister)Y.networkMode="offlineFirst";if(Y.queryFn===l)Y.enabled=!1;return Y}defaultMutationOptions(X){if(X?._defaulted)return X;return{...this.#G.mutations,...X?.mutationKey&&this.getMutationDefaults(X.mutationKey),...X,_defaulted:!0}}clear(){this.#X.clear(),this.#Y.clear()}};var f=h(c(),1);var HX=h(c(),1),RY=h(IX(),1);function CY(){let X=!1;return{clearReset:()=>{X=!1},reset:()=>{X=!0},isReset:()=>{return X}}}var OY=HX.createContext(CY()),ZY=()=>HX.useContext(OY);var $Y=h(c(),1);var WY=(X,Y,G)=>{let J=G?.state.error&&typeof X.throwOnError==="function"?t(X.throwOnError,[G.state.error,G]):X.throwOnError;if(X.suspense||X.experimental_prefetchInRender||J){if(!Y.isReset())X.retryOnMount=!1}},HY=(X)=>{$Y.useEffect(()=>{X.clearReset()},[X])},_Y=({result:X,errorResetBoundary:Y,throwOnError:G,query:J,suspense:Z})=>{return X.isError&&!Y.isReset()&&!X.isFetching&&J&&(Z&&X.data===void 0||t(G,[X.error,J]))};var FX=h(c(),1),zY=FX.createContext(!1),VY=()=>FX.useContext(zY),K2=zY.Provider;var AY=(X)=>{if(X.suspense){let G=(Z)=>Z==="static"?Z:Math.max(Z??1000,1000),J=X.staleTime;if(X.staleTime=typeof J==="function"?(...Z)=>G(J(...Z)):G(J),typeof X.gcTime==="number")X.gcTime=Math.max(X.gcTime,1000)}},NY=(X,Y)=>X.isLoading&&X.isFetching&&!Y,LY=(X,Y)=>X?.suspense&&Y.isPending,qX=(X,Y,G)=>Y.fetchOptimistic(X).catch(()=>{G.clearReset()});function UY(X,Y,G){if(typeof X!=="object"||Array.isArray(X))throw Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');let J=VY(),Z=ZY(),H=GX(G),_=H.defaultQueryOptions(X);H.getDefaultOptions().queries?._experimental_beforeQuery?.(_);let W=H.getQueryCache().get(_.queryHash);if(!_.queryFn)console.error(`[${_.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`);_._optimisticResults=J?"isRestoring":"optimistic",AY(_),WY(_,Z,W),HY(Z);let A=!H.getQueryCache().get(_.queryHash),[U]=f.useState(()=>new Y(H,_)),z=U.getOptimisticResult(_),E=!J&&X.subscribed!==!1;if(f.useSyncExternalStore(f.useCallback((N)=>{let K=E?U.subscribe(B.batchCalls(N)):F;return U.updateResult(),K},[U,E]),()=>U.getCurrentResult(),()=>U.getCurrentResult()),f.useEffect(()=>{U.setOptions(_)},[_,U]),LY(_,z))throw qX(_,U,Z);if(_Y({result:z,errorResetBoundary:Z,throwOnError:_.throwOnError,query:W,suspense:_.suspense}))throw z.error;if(H.getDefaultOptions().queries?._experimental_afterQuery?.(_,z),_.experimental_prefetchInRender&&!x&&NY(z,J))(A?qX(_,U,Z):W?.promise)?.catch(F).finally(()=>{U.updateResult()});return!_.notifyOnChangeProps?U.trackResult(z):z}function qY(X,Y){return UY(X,SX,Y)}var m=h(c(),1);function vY(X,Y){let G=GX(Y),[J]=m.useState(()=>new OX(G,X));m.useEffect(()=>{J.setOptions(X)},[J,X]);let Z=m.useSyncExternalStore(m.useCallback((_)=>J.subscribe(B.batchCalls(_)),[J]),()=>J.getCurrentResult(),()=>J.getCurrentResult()),H=m.useCallback((_,W)=>{J.mutate(_,W).catch(F)},[J]);if(Z.error&&t(J.options.throwOnError,[Z.error]))throw Z.error;return{...Z,mutate:H,mutateAsync:Z.mutate}}var p2={config:{all:["config"],detail:()=>["config","detail"]},providers:{all:["providers"],list:()=>["providers","list"],detail:(X)=>["providers","detail",X]},models:{all:["models"],list:(X)=>["models","list",X],available:()=>["models","available"]},skills:{all:["skills"],list:()=>["skills","list"],detail:(X)=>["skills","detail",X]},tasks:{all:["tasks"],list:(X)=>["tasks","list",X],detail:(X)=>["tasks","detail",X]},history:{all:["history"],list:()=>["history","list"],detail:(X)=>["history","detail",X]},knowledge:{all:["knowledge"],memories:()=>["knowledge","memories"],skills:()=>["knowledge","skills"]},agents:{all:["agents"],list:()=>["agents","list"],detail:(X)=>["agents","detail",X]},mcp:{all:["mcp"],config:()=>["mcp","config"]},errors:{all:["errors"],list:()=>["errors","list"],stats:()=>["errors","stats"]}};
7
- export{MY as P,IX as Q,GX as R,FY as S,qY as T,vY as U,p2 as V};
7
+ export{MY as K,IX as L,GX as M,FY as N,qY as O,vY as P,p2 as Q};
@@ -0,0 +1,2 @@
1
+ import{lq as r}from"./chunk-1p9xzvpt.js";import{mq as Ow}from"./chunk-hra0748z.js";import{pq as iw,qq as B,tq as uw}from"./chunk-dcs1r9as.js";var f=B((PS,m)=>{function M(S,w){if(typeof w==="boolean")w={forever:w};if(this._originalTimeouts=JSON.parse(JSON.stringify(S)),this._timeouts=S,this._options=w||{},this._maxRetryTime=w&&w.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}m.exports=M;M.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};M.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};M.prototype.retry=function(S){if(this._timeout)clearTimeout(this._timeout);if(!S)return!1;var w=new Date().getTime();if(S&&w-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(S);var N=this._timeouts.shift();if(N===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),N=this._timeouts.shift();else return!1;var J=this,x=setTimeout(function(){if(J._attempts++,J._operationTimeoutCb){if(J._timeout=setTimeout(function(){J._operationTimeoutCb(J._attempts)},J._operationTimeout),J._options.unref)J._timeout.unref()}J._fn(J._attempts)},N);if(this._options.unref)x.unref();return!0};M.prototype.attempt=function(S,w){if(this._fn=S,w){if(w.timeout)this._operationTimeout=w.timeout;if(w.cb)this._operationTimeoutCb=w.cb}var N=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){N._operationTimeoutCb()},N._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};M.prototype.try=function(S){console.log("Using RetryOperation.try() is deprecated"),this.attempt(S)};M.prototype.start=function(S){console.log("Using RetryOperation.start() is deprecated"),this.attempt(S)};M.prototype.start=M.prototype.try;M.prototype.errors=function(){return this._errors};M.prototype.attempts=function(){return this._attempts};M.prototype.mainError=function(){if(this._errors.length===0)return null;var S={},w=null,N=0;for(var J=0;J<this._errors.length;J++){var x=this._errors[J],h=x.message,E=(S[h]||0)+1;if(S[h]=E,E>=N)w=x,N=E}return w}});var n=B((Yw)=>{var Xw=f();Yw.operation=function(S){var w=Yw.timeouts(S);return new Xw(w,{forever:S&&S.forever,unref:S&&S.unref,maxRetryTime:S&&S.maxRetryTime})};Yw.timeouts=function(S){if(S instanceof Array)return[].concat(S);var w={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var N in S)w[N]=S[N];if(w.minTimeout>w.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var J=[];for(var x=0;x<w.retries;x++)J.push(this.createTimeout(x,w));if(S&&S.forever&&!J.length)J.push(this.createTimeout(x,w));return J.sort(function(h,E){return h-E}),J};Yw.createTimeout=function(S,w){var N=w.randomize?Math.random()+1:1,J=Math.round(N*w.minTimeout*Math.pow(w.factor,S));return J=Math.min(J,w.maxTimeout),J};Yw.wrap=function(S,w,N){if(w instanceof Array)N=w,w=null;if(!N){N=[];for(var J in S)if(typeof S[J]==="function")N.push(J)}for(var x=0;x<N.length;x++){var h=N[x],E=S[h];S[h]=function(V){var $=Yw.operation(w),z=Array.prototype.slice.call(arguments,1),xw=z.pop();z.push(function(v){if($.retry(v))return;if(v)arguments[0]=$.mainError();xw.apply(this,arguments)}),$.attempt(function(){V.apply(S,z)})}.bind(S,E),S[h].options=w}}});var a=B((_w,u)=>{var c=Symbol();function Uw(S,w,N){let J=w[c];if(J)return w.stat(S,(h,E)=>{if(h)return N(h);N(null,E.mtime,J)});let x=new Date(Math.ceil(Date.now()/1000)*1000+5);w.utimes(S,x,x,(h)=>{if(h)return N(h);w.stat(S,(E,F)=>{if(E)return N(E);let V=F.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty(w,c,{value:V}),N(null,F.mtime,V)})})}function qw(S){let w=Date.now();if(S==="s")w=Math.ceil(w/1000)*1000;return new Date(w)}_w.probe=Uw;_w.getMtime=qw});var i=B((vw,Q)=>{var Cw=uw("path"),P=r(),Pw=n(),Rw=Ow(),p=a(),T={};function K(S,w){return w.lockfilePath||`${S}.lock`}function R(S,w,N){if(!w.realpath)return N(null,Cw.resolve(S));w.fs.realpath(S,N)}function C(S,w,N){let J=K(S,w);w.fs.mkdir(J,(x)=>{if(!x)return p.probe(J,w.fs,(h,E,F)=>{if(h)return w.fs.rmdir(J,()=>{}),N(h);N(null,E,F)});if(x.code!=="EEXIST")return N(x);if(w.stale<=0)return N(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:S}));w.fs.stat(J,(h,E)=>{if(h){if(h.code==="ENOENT")return C(S,{...w,stale:0},N);return N(h)}if(!t(E,w))return N(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:S}));s(S,w,(F)=>{if(F)return N(F);C(S,{...w,stale:0},N)})})})}function t(S,w){return S.mtime.getTime()<Date.now()-w.stale}function s(S,w,N){w.fs.rmdir(K(S,w),(J)=>{if(J&&J.code!=="ENOENT")return N(J);N()})}function Z(S,w){let N=T[S];if(N.updateTimeout)return;if(N.updateDelay=N.updateDelay||w.update,N.updateTimeout=setTimeout(()=>{N.updateTimeout=null,w.fs.stat(N.lockfilePath,(J,x)=>{let h=N.lastUpdate+w.stale<Date.now();if(J){if(J.code==="ENOENT"||h)return O(S,N,Object.assign(J,{code:"ECOMPROMISED"}));return N.updateDelay=1000,Z(S,w)}if(N.mtime.getTime()!==x.mtime.getTime())return O(S,N,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let F=p.getMtime(N.mtimePrecision);w.fs.utimes(N.lockfilePath,F,F,(V)=>{let $=N.lastUpdate+w.stale<Date.now();if(N.released)return;if(V){if(V.code==="ENOENT"||$)return O(S,N,Object.assign(V,{code:"ECOMPROMISED"}));return N.updateDelay=1000,Z(S,w)}N.mtime=F,N.lastUpdate=Date.now(),N.updateDelay=null,Z(S,w)})})},N.updateDelay),N.updateTimeout.unref)N.updateTimeout.unref()}function O(S,w,N){if(w.released=!0,w.updateTimeout)clearTimeout(w.updateTimeout);if(T[S]===w)delete T[S];w.options.onCompromised(N)}function jw(S,w,N){w={stale:1e4,update:null,realpath:!0,retries:0,fs:P,onCompromised:(J)=>{throw J},...w},w.retries=w.retries||0,w.retries=typeof w.retries==="number"?{retries:w.retries}:w.retries,w.stale=Math.max(w.stale||0,2000),w.update=w.update==null?w.stale/2:w.update||0,w.update=Math.max(Math.min(w.update,w.stale/2),1000),R(S,w,(J,x)=>{if(J)return N(J);let h=Pw.operation(w.retries);h.attempt(()=>{C(x,w,(E,F,V)=>{if(h.retry(E))return;if(E)return N(h.mainError());let $=T[x]={lockfilePath:K(x,w),mtime:F,mtimePrecision:V,options:w,lastUpdate:Date.now()};Z(x,w),N(null,(z)=>{if($.released)return z&&z(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));l(x,{...w,realpath:!1},z)})})})})}function l(S,w,N){w={fs:P,realpath:!0,...w},R(S,w,(J,x)=>{if(J)return N(J);let h=T[x];if(!h)return N(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));h.updateTimeout&&clearTimeout(h.updateTimeout),h.released=!0,delete T[x],s(x,w,N)})}function Lw(S,w,N){w={stale:1e4,realpath:!0,fs:P,...w},w.stale=Math.max(w.stale||0,2000),R(S,w,(J,x)=>{if(J)return N(J);w.fs.stat(K(x,w),(h,E)=>{if(h)return h.code==="ENOENT"?N(null,!1):N(h);return N(null,!t(E,w))})})}function yw(){return T}Rw(()=>{for(let S in T){let w=T[S].options;try{w.fs.rmdirSync(K(S,w))}catch(N){}}});vw.lock=jw;vw.unlock=l;vw.check=Lw;vw.getLocks=yw});var o=B((jS,e)=>{var fw=r();function kw(S){let w=["mkdir","realpath","stat","rmdir","utimes"],N={...S};return w.forEach((J)=>{N[J]=(...x)=>{let h=x.pop(),E;try{E=S[`${J}Sync`](...x)}catch(F){return h(F)}h(null,E)}}),N}function nw(S){return(...w)=>new Promise((N,J)=>{w.push((x,h)=>{if(x)J(x);else N(h)}),S(...w)})}function cw(S){return(...w)=>{let N,J;if(w.push((x,h)=>{N=x,J=h}),S(...w),N)throw N;return J}}function aw(S){if(S={...S},S.fs=kw(S.fs||fw),typeof S.retries==="number"&&S.retries>0||S.retries&&typeof S.retries.retries==="number"&&S.retries.retries>0)throw Object.assign(Error("Cannot use retries with the sync api"),{code:"ESYNC"});return S}e.exports={toPromise:nw,toSync:cw,toSyncOptions:aw}});var Sw=B((LS,W)=>{var G=i(),{toPromise:H,toSync:I,toSyncOptions:j}=o();async function ww(S,w){let N=await H(G.lock)(S,w);return H(N)}function rw(S,w){let N=I(G.lock)(S,j(w));return I(N)}function pw(S,w){return H(G.unlock)(S,w)}function tw(S,w){return I(G.unlock)(S,j(w))}function sw(S,w){return H(G.check)(S,w)}function lw(S,w){return I(G.check)(S,j(w))}W.exports=ww;W.exports.lock=ww;W.exports.unlock=pw;W.exports.lockSync=rw;W.exports.unlockSync=tw;W.exports.check=sw;W.exports.checkSync=lw});class d{#w=null;read(){return Promise.resolve(this.#w)}write(S){return this.#w=S,Promise.resolve()}}class g{#w=null;read(){return this.#w||null}write(S){this.#w=S}}function hw(S,w){if(S===void 0)throw Error("lowdb: missing adapter");if(w===void 0)throw Error("lowdb: missing default data")}class X{adapter;data;constructor(S,w){hw(S,w),this.adapter=S,this.data=w}async read(){let S=await this.adapter.read();if(S)this.data=S}async write(){if(this.data)await this.adapter.write(this.data)}async update(S){S(this.data),await this.write()}}import{readFileSync as Bw,renameSync as Gw,writeFileSync as Kw}from"node:fs";import{readFile as Qw}from"node:fs/promises";import q from"node:path";import{rename as Ew,writeFile as Fw}from"node:fs/promises";import{basename as Mw,dirname as Vw,join as Tw}from"node:path";import{fileURLToPath as Ww}from"node:url";function $w(S){let w=S instanceof URL?Ww(S):S.toString();return Tw(Vw(w),`.${Mw(w)}.tmp`)}async function zw(S,w,N){for(let J=0;J<w;J++)try{return await S()}catch(x){if(J<w-1)await new Promise((h)=>setTimeout(h,N));else throw x}}class U{#w;#S;#N=!1;#x=null;#h=null;#E=null;#J=null;#F(S){return this.#J=S,this.#E||=new Promise((w,N)=>{this.#h=[w,N]}),new Promise((w,N)=>{this.#E?.then(w).catch(N)})}async#M(S){this.#N=!0;try{await Fw(this.#S,S,"utf-8"),await zw(async()=>{await Ew(this.#S,this.#w)},10,100),this.#x?.[0]()}catch(w){if(w instanceof Error)this.#x?.[1](w);throw w}finally{if(this.#N=!1,this.#x=this.#h,this.#h=this.#E=null,this.#J!==null){let w=this.#J;this.#J=null,await this.write(w)}}}constructor(S){this.#w=S,this.#S=$w(S)}async write(S){return this.#N?this.#F(S):this.#M(S)}}class _{#w;#S;constructor(S){this.#w=S,this.#S=new U(S)}async read(){let S;try{S=await Qw(this.#w,"utf-8")}catch(w){if(w.code==="ENOENT")return null;throw w}return S}write(S){return this.#S.write(S)}}class A{#w;#S;constructor(S){this.#S=S;let w=S.toString();this.#w=q.join(q.dirname(w),`.${q.basename(w)}.tmp`)}read(){let S;try{S=Bw(this.#S,"utf-8")}catch(w){if(w.code==="ENOENT")return null;throw w}return S}write(S){Kw(this.#w,S),Gw(this.#w,this.#S)}}class D{#w;#S;#N;constructor(S,{parse:w,stringify:N}){this.#w=new _(S),this.#S=w,this.#N=N}async read(){let S=await this.#w.read();if(S===null)return null;else return this.#S(S)}write(S){return this.#w.write(this.#N(S))}}class b{#w;#S;#N;constructor(S,{parse:w,stringify:N}){this.#w=new A(S),this.#S=w,this.#N=N}read(){let S=this.#w.read();if(S===null)return null;else return this.#S(S)}write(S){this.#w.write(this.#N(S))}}class Y extends D{constructor(S){super(S,{parse:JSON.parse,stringify:(w)=>JSON.stringify(w,null,2)})}}var Jw=iw(Sw(),1);import ew from"os";import Nw from"path";import L from"fs";var y={config:{provider_id:"default",provider_type:"openai",model_id:"glm-5",providers:[{id:"default",type:"openai",apiKey:"",baseUrl:"https://api.openai.com/v1"}],compact_mode:!0}};function ow(S){return"main_model"in S&&!("providers"in S)}function wS(S){let w=[];if(S.model_provider==="openai"||S.openai_api_key||S.openai_base_url)w.push({id:"openai",type:"openai",apiKey:S.openai_api_key||"",baseUrl:S.openai_base_url||"https://api.openai.com/v1"});if(S.model_provider==="anthropic"||S.anthropic_api_key||S.anthropic_base_url)w.push({id:"anthropic",type:"anthropic",apiKey:S.anthropic_api_key||"",baseUrl:S.anthropic_base_url||"https://api.anthropic.com"});if(w.length===0)w.push({id:"default",type:"openai",apiKey:"",baseUrl:"https://api.openai.com/v1"});let N=S.model_provider==="anthropic"?"anthropic":"openai",J=w.find((x)=>x.id===N)||w[0];return{provider_id:J.id,provider_type:J.type,model_id:S.main_model,providers:w,mcp_config:S.mcp_config,stream_refresh_interval:S.stream_refresh_interval,enable_thinking:S.enable_thinking,switch_command:S.switch_command,compact_mode:S.compact_mode,permissions:S.permissions}}class SS{db;zenConfigDir;dbPath;getLockfilePath(){return`${this.dbPath}.lock`}lockOptions={stale:5000,retries:{retries:5,minTimeout:100,maxTimeout:1000}};constructor(){let S=ew.homedir();this.zenConfigDir=Nw.join(S,".zen-code");let w=Nw.join(this.zenConfigDir,"settings.json"),N=new Y(w);this.dbPath=w,this.db=new X(N,y)}async withLock(S){if(await L.promises.mkdir(this.zenConfigDir,{recursive:!0}),!L.existsSync(this.dbPath))await L.promises.writeFile(this.dbPath,JSON.stringify(y,null,2),"utf-8");let w=await Jw.default.lock(this.dbPath,{...this.lockOptions,lockfilePath:this.getLockfilePath()});try{return await S()}finally{await w()}}async initialize(){await this.withLock(async()=>{if(await this.db.read(),!this.db.data||!this.db.data.config)this.db.data=y,await this.db.write();else if(ow(this.db.data.config))console.log("Migrating legacy config to new format..."),this.db.data.config=wS(this.db.data.config),await this.db.write(),console.log("Config migration completed.");this.syncEnvFromConfig()})}async getConfig(){return this.withLock(async()=>{return await this.db.read(),this.db.data.config})}async updateConfig(S){await this.withLock(async()=>{await this.db.read(),Object.assign(this.db.data.config,S),await this.db.write(),this.syncEnvFromConfig()})}syncEnvFromConfig(){let S=this.db.data.config,w=S.providers.find((N)=>N.id===S.provider_id);if(w){if(w.type==="openai")process.env.MODEL_PROVIDER="openai",process.env.OPENAI_API_KEY=w.apiKey,process.env.OPENAI_BASE_URL=w.baseUrl;else if(w.type==="anthropic")process.env.MODEL_PROVIDER="anthropic",process.env.ANTHROPIC_API_KEY=w.apiKey,process.env.ANTHROPIC_BASE_URL=w.baseUrl;else if(w.type==="gemini"||w.type==="google")process.env.MODEL_PROVIDER="gemini",process.env.GOOGLE_API_KEY=w.apiKey,process.env.GOOGLE_BASE_URL=w.baseUrl}}getZenConfigDir(){return this.zenConfigDir}}
2
+ export{X as iq,Y as jq,SS as kq};
@@ -1,4 +1,4 @@
1
- import{X as z,Y as P,Z as K,_ as O}from"./chunk-jxsfzfac.js";import{yb as b}from"./chunk-kba8akjs.js";import{Kysely as L,sql as D}from"kysely";var G={maxRetries:3,baseDelayMs:100,nonRetryablePatterns:["database disk image is malformed","database is malformed","cannot rollback","no transaction is active","database or disk is full"],isRetryableError:(H)=>{let J=H?.message?.toLowerCase()||"";for(let V of G.nonRetryablePatterns)if(J.includes(V.toLowerCase()))return!1;return J.includes("sqlite_busy")||J.includes("database is locked")||J==="sqlite_busy"||J==="database is locked"}};async function F(H,J){let V=null;for(let Z=0;Z<G.maxRetries;Z++)try{return await H()}catch($){V=$;let X=$?.message?.toLowerCase()||"";if(!G.isRetryableError($)){if(X.includes("malformed")){let j=Error(`SQLite database is corrupted: ${$.message}
1
+ import{Bd as L,Kd as D}from"./chunk-hsev32dg.js";import{dh as z,sh as P,th as K,vh as O}from"./chunk-ac5t2ywn.js";import"./chunk-dcwnpdtk.js";import"./chunk-cbjnwrt7.js";import"./chunk-vh9zd1v3.js";import"./chunk-w2hbsa9j.js";import"./chunk-rztre6k0.js";import"./chunk-wpy5r9ma.js";import"./chunk-h1enhch1.js";import"./chunk-hyf24r36.js";import{pq as R,tq as b}from"./chunk-dcs1r9as.js";var G={maxRetries:3,baseDelayMs:100,nonRetryablePatterns:["database disk image is malformed","database is malformed","cannot rollback","no transaction is active","database or disk is full"],isRetryableError:(H)=>{let J=H?.message?.toLowerCase()||"";for(let V of G.nonRetryablePatterns)if(J.includes(V.toLowerCase()))return!1;return J.includes("sqlite_busy")||J.includes("database is locked")||J==="sqlite_busy"||J==="database is locked"}};async function F(H,J){let V=null;for(let Z=0;Z<G.maxRetries;Z++)try{return await H()}catch($){V=$;let X=$?.message?.toLowerCase()||"";if(!G.isRetryableError($)){if(X.includes("malformed")){let j=Error(`SQLite database is corrupted: ${$.message}
2
2
 
3
3
  Context: ${J||"unknown"}
4
4
 
@@ -10,7 +10,7 @@ Possible causes:
10
10
  Recovery options:
11
11
  - Delete the database file to start fresh (data will be lost)
12
12
  - Use SQLite recovery tools: sqlite3 <db> ".recover" > recover.sql
13
- - Switch to PostgreSQL/Redis for production use`);throw j.name="SQLiteCorruptError",j.cause=$,j}throw $}if(Z<G.maxRetries-1){let j=G.baseDelayMs*Math.pow(2,Z);console.warn(`SQLite lock detected${J?` (${J})`:""}, retrying in ${j}ms (attempt ${Z+1}/${G.maxRetries})`),await new Promise((U)=>setTimeout(U,j))}}throw V}var R=["source","step","parents"];function x(H){return H}var E=x(R);class N extends K{db;isSetup;constructor(H,J){super(J);this.db=new L({dialect:H}),this.isSetup=!1}static async fromConnStringAsync(H){let J;if(globalThis.Bun){console.log("LG | Using BunWorkerDialect "+H);let{BunSqliteDialect:V}=await import("kysely-bun-worker/normal");J=new N(new V({url:H}))}else{console.log("LG | Using NodeWasmDialect");let{default:V}=await import("node-sqlite3-wasm"),{NodeWasmDialect:Z}=await import("kysely-wasm");console.log(H);let $=new Z({database:new V.Database(H)});J=new N($)}return await J.setup(),J}async setup(){if(this.isSetup)return;await D`PRAGMA busy_timeout = 5000`.execute(this.db),await D`PRAGMA journal_mode = WAL`.execute(this.db),await D`PRAGMA synchronous = NORMAL`.execute(this.db),await D`PRAGMA wal_autocheckpoint = 1000`.execute(this.db),await D`
13
+ - Switch to PostgreSQL/Redis for production use`);throw j.name="SQLiteCorruptError",j.cause=$,j}throw $}if(Z<G.maxRetries-1){let j=G.baseDelayMs*Math.pow(2,Z);console.warn(`SQLite lock detected${J?` (${J})`:""}, retrying in ${j}ms (attempt ${Z+1}/${G.maxRetries})`),await new Promise((U)=>setTimeout(U,j))}}throw V}var x=["source","step","parents"];function E(H){return H}var T=E(x);class N extends K{db;isSetup;constructor(H,J){super(J);this.db=new L({dialect:H}),this.isSetup=!1}static async fromConnStringAsync(H){let J;if(globalThis.Bun){console.log("LG | Using BunWorkerDialect "+H);let{BunSqliteDialect:V}=await import("./chunk-gyhxdxb4.js");J=new N(new V({url:H}))}else{console.log("LG | Using NodeWasmDialect");let{default:V}=await import("./chunk-x90r4sje.js").then((m)=>R(m.default,1)),{NodeWasmDialect:Z}=await import("./chunk-yndex7hs.js");console.log(H);let $=new Z({database:new V.Database(H)});J=new N($)}return await J.setup(),J}async setup(){if(this.isSetup)return;await D`PRAGMA busy_timeout = 5000`.execute(this.db),await D`PRAGMA journal_mode = WAL`.execute(this.db),await D`PRAGMA synchronous = NORMAL`.execute(this.db),await D`PRAGMA wal_autocheckpoint = 1000`.execute(this.db),await D`
14
14
  CREATE TABLE IF NOT EXISTS checkpoints (
15
15
  thread_id TEXT NOT NULL,
16
16
  checkpoint_ns TEXT NOT NULL DEFAULT '',
@@ -83,7 +83,7 @@ CREATE TABLE IF NOT EXISTS writes (
83
83
  AND ps.checkpoint_id = checkpoints.parent_checkpoint_id
84
84
  AND ps.channel = ${z}
85
85
  ORDER BY ps.idx
86
- )`.as("pending_sends")]);if(X)U=U.where("thread_id","=",X);if(j!==void 0&&j!==null)U=U.where("checkpoint_ns","=",j);if(Z?.configurable?.checkpoint_id!==void 0)U=U.where("checkpoint_id","<",Z.configurable.checkpoint_id);let W=Object.fromEntries(Object.entries($??{}).filter(([B,M])=>M!==void 0&&E.includes(B)));for(let[B,M]of Object.entries(W))U=U.where(D`json_extract(CAST(metadata AS TEXT), ${D.lit("$."+B)})`,"=",D.lit(JSON.stringify(M)));if(U=U.orderBy("checkpoint_id","desc"),V)U=U.limit(parseInt(V,10));let A=await U.execute();for(let B of A){let M=await Promise.all(JSON.parse(B.pending_writes).map(async(Q)=>{return[Q.task_id,Q.channel,await this.serde.loadsTyped(Q.type??"json",Q.value??"")]})),Y=await this.serde.loadsTyped(B.type??"json",new TextDecoder().decode(B.checkpoint));if(Y.v<4&&B.parent_checkpoint_id!=null)await this.migratePendingSends(Y,B.thread_id,B.parent_checkpoint_id);yield{config:{configurable:{thread_id:B.thread_id,checkpoint_ns:B.checkpoint_ns,checkpoint_id:B.checkpoint_id}},checkpoint:Y,metadata:await this.serde.loadsTyped(B.type??"json",new TextDecoder().decode(B.metadata)),parentConfig:B.parent_checkpoint_id?{configurable:{thread_id:B.thread_id,checkpoint_ns:B.checkpoint_ns,checkpoint_id:B.parent_checkpoint_id}}:void 0,pendingWrites:M}}}async put(H,J,V){if(await this.setup(),!H.configurable)throw Error("Empty configuration supplied.");let Z=H.configurable?.thread_id,$=H.configurable?.checkpoint_ns??"",X=H.configurable?.checkpoint_id;if(!Z)throw Error('Missing "thread_id" field in passed "config.configurable".');let j=P(J),[[U,W],[A,B]]=await Promise.all([this.serde.dumpsTyped(j),this.serde.dumpsTyped(V)]);if(U!==A)throw Error("Failed to serialized checkpoint and metadata to the same type.");return await F(async()=>{await this.db.insertInto("checkpoints").values({thread_id:Z,checkpoint_ns:$,checkpoint_id:J.id,parent_checkpoint_id:X??null,type:U,checkpoint:new Uint8Array(Buffer.from(W)),metadata:new Uint8Array(Buffer.from(B))}).onConflict((M)=>M.columns(["thread_id","checkpoint_ns","checkpoint_id"]).doUpdateSet({parent_checkpoint_id:X??null,type:U,checkpoint:new Uint8Array(Buffer.from(W)),metadata:new Uint8Array(Buffer.from(B))})).execute()},`put(${Z}/${J.id})`),{configurable:{thread_id:Z,checkpoint_ns:$,checkpoint_id:J.id}}}async putWrites(H,J,V){if(await this.setup(),!H.configurable)throw Error("Empty configuration supplied.");if(!H.configurable?.thread_id)throw Error("Missing thread_id field in config.configurable.");if(!H.configurable?.checkpoint_id)throw Error("Missing checkpoint_id field in config.configurable.");let Z=await Promise.all(J.map(async(j,U)=>{let[W,A]=await this.serde.dumpsTyped(j[1]);return{thread_id:H.configurable.thread_id,checkpoint_ns:H.configurable.checkpoint_ns??"",checkpoint_id:H.configurable.checkpoint_id,task_id:V,idx:U,channel:j[0],type:W,value:new Uint8Array(Buffer.from(A))}}));if(Z.length===0)return;let $=H.configurable.thread_id,X=H.configurable.checkpoint_id;await F(async()=>{await this.db.transaction().execute(async(j)=>{await j.deleteFrom("writes").where("thread_id","=",$).where("checkpoint_ns","=",Z[0].checkpoint_ns).where("checkpoint_id","=",X).where("task_id","=",V).execute();for(let U of Z)await j.insertInto("writes").values(U).execute()})},`putWrites(${$}/${X}/${V})`)}async deleteThread(H){await F(async()=>{await this.db.transaction().execute(async(J)=>{await J.deleteFrom("checkpoints").where("thread_id","=",H).execute(),await J.deleteFrom("writes").where("thread_id","=",H).execute()})},`deleteThread(${H})`)}async migratePendingSends(H,J,V){let Z=await this.db.selectFrom("writes as ps").select(["ps.checkpoint_id",D`json_group_array(
86
+ )`.as("pending_sends")]);if(X)U=U.where("thread_id","=",X);if(j!==void 0&&j!==null)U=U.where("checkpoint_ns","=",j);if(Z?.configurable?.checkpoint_id!==void 0)U=U.where("checkpoint_id","<",Z.configurable.checkpoint_id);let W=Object.fromEntries(Object.entries($??{}).filter(([B,M])=>M!==void 0&&T.includes(B)));for(let[B,M]of Object.entries(W))U=U.where(D`json_extract(CAST(metadata AS TEXT), ${D.lit("$."+B)})`,"=",D.lit(JSON.stringify(M)));if(U=U.orderBy("checkpoint_id","desc"),V)U=U.limit(parseInt(V,10));let A=await U.execute();for(let B of A){let M=await Promise.all(JSON.parse(B.pending_writes).map(async(Q)=>{return[Q.task_id,Q.channel,await this.serde.loadsTyped(Q.type??"json",Q.value??"")]})),Y=await this.serde.loadsTyped(B.type??"json",new TextDecoder().decode(B.checkpoint));if(Y.v<4&&B.parent_checkpoint_id!=null)await this.migratePendingSends(Y,B.thread_id,B.parent_checkpoint_id);yield{config:{configurable:{thread_id:B.thread_id,checkpoint_ns:B.checkpoint_ns,checkpoint_id:B.checkpoint_id}},checkpoint:Y,metadata:await this.serde.loadsTyped(B.type??"json",new TextDecoder().decode(B.metadata)),parentConfig:B.parent_checkpoint_id?{configurable:{thread_id:B.thread_id,checkpoint_ns:B.checkpoint_ns,checkpoint_id:B.parent_checkpoint_id}}:void 0,pendingWrites:M}}}async put(H,J,V){if(await this.setup(),!H.configurable)throw Error("Empty configuration supplied.");let Z=H.configurable?.thread_id,$=H.configurable?.checkpoint_ns??"",X=H.configurable?.checkpoint_id;if(!Z)throw Error('Missing "thread_id" field in passed "config.configurable".');let j=P(J),[[U,W],[A,B]]=await Promise.all([this.serde.dumpsTyped(j),this.serde.dumpsTyped(V)]);if(U!==A)throw Error("Failed to serialized checkpoint and metadata to the same type.");return await F(async()=>{await this.db.insertInto("checkpoints").values({thread_id:Z,checkpoint_ns:$,checkpoint_id:J.id,parent_checkpoint_id:X??null,type:U,checkpoint:new Uint8Array(Buffer.from(W)),metadata:new Uint8Array(Buffer.from(B))}).onConflict((M)=>M.columns(["thread_id","checkpoint_ns","checkpoint_id"]).doUpdateSet({parent_checkpoint_id:X??null,type:U,checkpoint:new Uint8Array(Buffer.from(W)),metadata:new Uint8Array(Buffer.from(B))})).execute()},`put(${Z}/${J.id})`),{configurable:{thread_id:Z,checkpoint_ns:$,checkpoint_id:J.id}}}async putWrites(H,J,V){if(await this.setup(),!H.configurable)throw Error("Empty configuration supplied.");if(!H.configurable?.thread_id)throw Error("Missing thread_id field in config.configurable.");if(!H.configurable?.checkpoint_id)throw Error("Missing checkpoint_id field in config.configurable.");let Z=await Promise.all(J.map(async(j,U)=>{let[W,A]=await this.serde.dumpsTyped(j[1]);return{thread_id:H.configurable.thread_id,checkpoint_ns:H.configurable.checkpoint_ns??"",checkpoint_id:H.configurable.checkpoint_id,task_id:V,idx:U,channel:j[0],type:W,value:new Uint8Array(Buffer.from(A))}}));if(Z.length===0)return;let $=H.configurable.thread_id,X=H.configurable.checkpoint_id;await F(async()=>{await this.db.transaction().execute(async(j)=>{await j.deleteFrom("writes").where("thread_id","=",$).where("checkpoint_ns","=",Z[0].checkpoint_ns).where("checkpoint_id","=",X).where("task_id","=",V).execute();for(let U of Z)await j.insertInto("writes").values(U).execute()})},`putWrites(${$}/${X}/${V})`)}async deleteThread(H){await F(async()=>{await this.db.transaction().execute(async(J)=>{await J.deleteFrom("checkpoints").where("thread_id","=",H).execute(),await J.deleteFrom("writes").where("thread_id","=",H).execute()})},`deleteThread(${H})`)}async migratePendingSends(H,J,V){let Z=await this.db.selectFrom("writes as ps").select(["ps.checkpoint_id",D`json_group_array(
87
87
  json_object(
88
88
  'type', ps.type,
89
89
  'value', CAST(ps.value AS TEXT)
@@ -1,4 +1,4 @@
1
- import{Ja as f,La as g}from"./chunk-5x8nxw0t.js";import{Sa as b}from"./chunk-13nyfrmm.js";import{yb as i}from"./chunk-kba8akjs.js";import{AgentPackage as E,MemoryStorage as L}from"@langgraph-js/standard-agent";import{tool as U}from"@langchain/core/tools";import{z as o}from"zod";var I=o.object({content:o.string().min(1),status:o.enum(["pending","in_progress","completed"]),id:o.string()}),A=o.object({todos:o.array(I).describe("The updated todo list")}),u=U(async()=>{return"todo saved successfully"},{name:"todo_write",description:`Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
1
+ import{gf as f,if as g}from"./chunk-wabmqprd.js";import{qf as T}from"./chunk-e3tyc24s.js";import{ng as b,pg as w}from"./chunk-p0vzbr7s.js";import{Vh as d}from"./chunk-dcwnpdtk.js";import{ri as s}from"./chunk-cbjnwrt7.js";import{tq as o}from"./chunk-dcs1r9as.js";var A=s.object({content:s.string().min(1),status:s.enum(["pending","in_progress","completed"]),id:s.string()}),z=s.object({todos:s.array(A).describe("The updated todo list")}),u=d(async()=>{return"todo saved successfully"},{name:"todo_write",description:`Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
2
2
  It also helps the user understand the progress of the task and overall progress of their requests.
3
3
  ## When to Use This Tool
4
4
  Use this tool proactively in these scenarios:
@@ -172,7 +172,7 @@ The assistant did not use the todo list because this is a single command executi
172
172
  - Use clear, descriptive task names
173
173
 
174
174
  When in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.
175
- `,schema:A});import{z as n}from"zod";import{tool as z}from"langchain";var C=n.object({label:n.string().min(1).max(50).describe("选项显示文本,简洁明了(1-50 字符)")}),W=n.object({description:n.string().min(1).describe("向用户提出的问题,清晰具体,包含必要的上下文"),type:n.enum(["single_select","multi_select"]).describe("选择类型:single_select(单选)或 multi_select(多选)"),options:n.array(C).min(2).max(6).describe("选项列表,至少 2 个,最多 6 个"),allow_custom_input:n.boolean().default(!0).describe("是否允许用户输入自定义文本,默认 true"),placeholder:n.string().optional().describe("自定义输入框的占位符文本")}),h=z(()=>{},{name:"ask_user_questions",description:"Ask the user a question with selectable options",schema:W});var q=[h,u];async function _(e,t){await e.addTool({id:t.name,name:t.name,description:t.description});let l={id:t.name,name:t.name,description:t.description,paramsSchema:t.schema,execute:async(d)=>{let a=await t.invoke(d);if(a&&typeof a==="object"&&"content"in a)return a.content;return a}};e.tools.registerImplementation(l)}async function p(e){return await Promise.all(q.map((t)=>_(e,t)))}async function y(e){let t={id:"filesystem",name:"filesystem",description:"File and directory operations (read, write, search, glob)",execute:async()=>{return new f}};await e.addMiddleware(t),e.middlewares.registerImplementation(t);let l={id:"terminal",name:"terminal",description:"Terminal command execution (Bash/CMD, background processes)",execute:async()=>{return new g}};await e.addMiddleware(l),e.middlewares.registerImplementation(l);let d={id:"subagents",name:"subagents",description:"Task delegation to specialized agents",execute:async()=>{let{createSubAgentsMiddleware:s}=await import("./chunk-1rmnbdef.js");return await s(e)}};await e.addMiddleware(d),e.middlewares.registerImplementation(d);let a={id:"memories",name:"memories",description:"Knowledge persistence",execute:async(s)=>{s.projectMemoriesDir=s.projectMemoriesDir||"./.claude/memories";let{MemoriesMiddleware:r}=await import("./chunk-rz3b356n.js");return new r(s)}};await e.addMiddleware(a),e.middlewares.registerImplementation(a);let c={id:"skills",name:"skills",description:"Progressive skills disclosure",execute:async(s)=>{if(s.projectSkillsDir=s.projectSkillsDir||"./.claude/skills",!s.skillsDir){let v=await import("os"),x=await import("path");s.skillsDir=x.join(v.homedir(),".claude","skills")}let{SkillsMiddleware:r}=await import("@langgraph-js/standard-agent");return new r(s)}};await e.addMiddleware(c),e.middlewares.registerImplementation(c);let m={id:"agents_md",name:"agents_md",description:"Inject agent documentation",execute:async(s)=>{let{AgentsMdMiddleware:r}=await import("@langgraph-js/standard-agent");return new r({projectRoot:s?.projectRoot})}};await e.addMiddleware(m),e.middlewares.registerImplementation(m)}var k=`# 架构师 - 任务派发协调者
175
+ `,schema:z});var C=s.object({label:s.string().min(1).max(50).describe("选项显示文本,简洁明了(1-50 字符)")}),W=s.object({description:s.string().min(1).describe("向用户提出的问题,清晰具体,包含必要的上下文"),type:s.enum(["single_select","multi_select"]).describe("选择类型:single_select(单选)或 multi_select(多选)"),options:s.array(C).min(2).max(6).describe("选项列表,至少 2 个,最多 6 个"),allow_custom_input:s.boolean().default(!0).describe("是否允许用户输入自定义文本,默认 true"),placeholder:s.string().optional().describe("自定义输入框的占位符文本")}),h=d(()=>{},{name:"ask_user_questions",description:"Ask the user a question with selectable options",schema:W});var q=[h,u];async function _(e,t){await e.addTool({id:t.name,name:t.name,description:t.description});let r={id:t.name,name:t.name,description:t.description,paramsSchema:t.schema,execute:async(l)=>{let n=await t.invoke(l);if(n&&typeof n==="object"&&"content"in n)return n.content;return n}};e.tools.registerImplementation(r)}async function p(e){return await Promise.all(q.map((t)=>_(e,t)))}async function y(e){let t={id:"filesystem",name:"filesystem",description:"File and directory operations (read, write, search, glob)",execute:async()=>{return new f}};await e.addMiddleware(t),e.middlewares.registerImplementation(t);let r={id:"terminal",name:"terminal",description:"Terminal command execution (Bash/CMD, background processes)",execute:async()=>{return new g}};await e.addMiddleware(r),e.middlewares.registerImplementation(r);let l={id:"subagents",name:"subagents",description:"Task delegation to specialized agents",execute:async()=>{let{createSubAgentsMiddleware:a}=await import("./chunk-178yjjsx.js");return await a(e)}};await e.addMiddleware(l),e.middlewares.registerImplementation(l);let n={id:"memories",name:"memories",description:"Knowledge persistence",execute:async(a)=>{a.projectMemoriesDir=a.projectMemoriesDir||"./.claude/memories";let{MemoriesMiddleware:i}=await import("./chunk-c7y5efa0.js");return new i(a)}};await e.addMiddleware(n),e.middlewares.registerImplementation(n);let c={id:"skills",name:"skills",description:"Progressive skills disclosure",execute:async(a)=>{if(a.projectSkillsDir=a.projectSkillsDir||"./.claude/skills",!a.skillsDir){let U=await import("os"),I=await import("path");a.skillsDir=I.join(U.homedir(),".claude","skills")}let{SkillsMiddleware:i}=await import("./chunk-0sxrk9sx.js");return new i(a)}};await e.addMiddleware(c),e.middlewares.registerImplementation(c);let m={id:"agents_md",name:"agents_md",description:"Inject agent documentation",execute:async(a)=>{let{AgentsMdMiddleware:i}=await import("./chunk-0sxrk9sx.js");return new i({projectRoot:a?.projectRoot})}};await e.addMiddleware(m),e.middlewares.registerImplementation(m)}var k=`# 架构师 - 任务派发协调者
176
176
 
177
177
  你是一位**任务派发架构师**,核心职责是将用户需求分析并拆解为子任务,然后委派给合适的子 agent 执行。
178
178
 
@@ -294,5 +294,5 @@ When in doubt, use this tool. Being proactive with task management demonstrates
294
294
 
295
295
  ---
296
296
 
297
- **记住**:你是协调者,不是执行者。快速分析需求,立即委派任务,高效汇总结果。`;async function w(){let e=new L,t=new E(e);return await t.addModel({id:"glm-4.7",model_name:"glm-4.7",model_provider:process.env.MODEL_PROVIDER||"openai",stream_usage:!0,enable_thinking:!0,temperature:0.7,max_tokens:4096,top_p:1,frequency_penalty:0,presence_penalty:0}),await t.addPrompt({id:"prompts/default",name:"default",content:b}),await t.addPrompt({id:"prompts/manager",name:"manager",content:k}),await p(t),await y(t),await t.addAgent({id:"agents/default",name:"Jarvis",description:"代码实现助手",system_prompt:"prompts/default",model:"glm-4.7",tools:{ask_user_questions:!0,todo_write:!0},middleware:{filesystem:!0,terminal:!0,agents_md:!0,skills:!0,memories:!0,subagents:!0}}),await t.addAgent({id:"agents/manager",name:"Manager",description:"任务管理员",system_prompt:"prompts/manager",model:"glm-4.7",tools:{ask_user_questions:!0,todo_write:!0},middleware:{filesystem:!0,terminal:!0,agents_md:!0,skills:!0,memories:!0,subagents:!0}}),t}var T;try{T=await w()}catch(e){throw console.error("Failed to load agent package:",e),Error(`Failed to initialize agent package: ${e instanceof Error?e.message:String(e)}`)}var ae=T;
298
- export{A as Da,ae as Ea};
297
+ **记住**:你是协调者,不是执行者。快速分析需求,立即委派任务,高效汇总结果。`;async function v(){let e=new w,t=new b(e);return await t.addModel({id:"glm-4.7",model_name:"glm-4.7",model_provider:process.env.MODEL_PROVIDER||"openai",stream_usage:!0,enable_thinking:!0,temperature:0.7,max_tokens:4096,top_p:1,frequency_penalty:0,presence_penalty:0}),await t.addPrompt({id:"prompts/default",name:"default",content:T}),await t.addPrompt({id:"prompts/manager",name:"manager",content:k}),await p(t),await y(t),await t.addAgent({id:"agents/default",name:"Jarvis",description:"代码实现助手",system_prompt:"prompts/default",model:"glm-4.7",tools:{ask_user_questions:!0,todo_write:!0},middleware:{filesystem:!0,terminal:!0,agents_md:!0,skills:!0,memories:!0,subagents:!0}}),await t.addAgent({id:"agents/manager",name:"Manager",description:"任务管理员",system_prompt:"prompts/manager",model:"glm-4.7",tools:{ask_user_questions:!0,todo_write:!0},middleware:{filesystem:!0,terminal:!0,agents_md:!0,skills:!0,memories:!0,subagents:!0}}),t}var x;try{x=await v()}catch(e){throw console.error("Failed to load agent package:",e),Error(`Failed to initialize agent package: ${e instanceof Error?e.message:String(e)}`)}var te=x;
298
+ export{z as We,te as Xe};
@@ -0,0 +1,2 @@
1
+ import{jf as B,of as D}from"./chunk-738m8242.js";import{Fg as q,Gg as x}from"./chunk-p0vzbr7s.js";async function Q(z){let E=await q(z);return new x({agents:E,stateSchema:B,async createAgent(G,H,J){return await D(H.subagent_id,z,J,{},{parent_id:G})}})}
2
+ export{Q as Se};