@mcp-use/inspector 0.4.6 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +14 -2
- package/dist/client/assets/{api_chain-C23oJnEu.js → api_chain-O4sRd0Fo.js} +1 -1
- package/dist/client/assets/{combine_docs_chain-DL4SSw1r.js → combine_docs_chain-Dy29TWun.js} +1 -1
- package/dist/client/assets/{few_shot-BNXy_2Ql.js → few_shot-CM_Ntb28.js} +1 -1
- package/dist/client/assets/{index-CPBnAlyU.css → index-3KbVdD5D.css} +1 -1
- package/dist/client/assets/{index-DkAopXco.js → index-B7rBD_6O.js} +99 -99
- package/dist/client/assets/{index-AFI-b3hA.js → index-BfCX6SZ1.js} +1 -1
- package/dist/client/assets/{index-DBFF1lMx.js → index-BfVWhhVi.js} +1 -1
- package/dist/client/assets/{index-BOE1bu_0.js → index-D_cnxdEU.js} +1 -1
- package/dist/client/assets/{index-De9tTo6D.js → index-DbhTveB4.js} +1 -1
- package/dist/client/assets/{index-Bgtt--Zu.js → index-thIEMA5R.js} +1 -1
- package/dist/client/assets/{json-BGsjO6Of.js → json-y5509_BL.js} +1 -1
- package/dist/client/assets/{langfuse-YA2S23SM-DhR-jd9m.js → langfuse-YA2S23SM-CWG57icG.js} +4 -4
- package/dist/client/assets/{llm_chain-BjPpdLtn.js → llm_chain-DT3ghCCe.js} +1 -1
- package/dist/client/assets/{sequential_chain-CMeHtLVI.js → sequential_chain-Bz0Lnisp.js} +1 -1
- package/dist/client/assets/{types-dtvs-u87.js → types-2prBjw5Q.js} +1 -1
- package/dist/client/assets/{vector_db_qa-B2yinyB2.js → vector_db_qa-BWzj5gOL.js} +1 -1
- package/dist/client/assets/{zodToJsonSchema-B4lr8sxI.js → zodToJsonSchema-Qxfd2wnD.js} +1 -1
- package/dist/client/index.html +3 -3
- package/dist/server/{chunk-PHIMHO3V.js → chunk-72QXQFWZ.js} +1 -1
- package/dist/server/{chunk-O5RJ7JZN.js → chunk-DNYI44U5.js} +6 -6
- package/dist/server/{chunk-PELF3XGD.js → chunk-DZ4Q7WNY.js} +1 -1
- package/dist/server/{chunk-JIJ5PZK3.js → chunk-KLSPQ537.js} +13 -1
- package/dist/server/{chunk-X2NAWSXV.js → chunk-WF3LG4SC.js} +14 -2
- package/dist/server/cli.js +4 -4
- package/dist/server/index.js +5 -5
- package/dist/server/middleware.js +5 -5
- package/dist/server/server.js +4 -4
- package/dist/server/shared-routes.js +2 -2
- package/dist/server/shared-static.js +2 -2
- package/dist/server/shared-utils-browser.d.ts.map +1 -1
- package/dist/server/shared-utils-browser.js +1 -1
- package/dist/server/shared-utils.d.ts.map +1 -1
- package/dist/server/shared-utils.js +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
var ih=Object.defineProperty;var ah=(n,e,t)=>e in n?ih(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var jr=(n,e,t)=>ah(n,typeof e!="symbol"?e+"":e,t);import{b as xi,_ as le,c as Me,d as Bi,u as qi,a as pt,e as sh,n as oh,s as cn,f as uh,o as lt,h as lh,g as ch,S as fh,C as No,i as dh,j as hh,B as ph,k as mh}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D_cnxdEU.js","assets/index-thIEMA5R.js","assets/index-B7rBD_6O.js","assets/index-3KbVdD5D.css","assets/zodToJsonSchema-Qxfd2wnD.js","assets/deep-compare-strict-DtUHXpbW.js","assets/v4-BKrj-4V8.js","assets/llm_chain-DT3ghCCe.js","assets/sequential_chain-Bz0Lnisp.js","assets/combine_docs_chain-Dy29TWun.js","assets/vector_db_qa-BWzj5gOL.js","assets/api_chain-O4sRd0Fo.js","assets/few_shot-CM_Ntb28.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var ih=Object.defineProperty;var ah=(n,e,t)=>e in n?ih(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var jr=(n,e,t)=>ah(n,typeof e!="symbol"?e+"":e,t);import{b as xi,_ as le,c as Me,d as Bi,u as qi,a as pt,e as sh,n as oh,s as cn,f as uh,o as lt,h as lh,g as ch,S as fh,C as No,i as dh,j as hh,B as ph,k as mh}from"./index-B7rBD_6O.js";import{r as gh,s as yh,v as Le,P as gt,p as ai,a as Lo,b as lf,h as bh,T as _h,d as vh,g as Lt,e as si,_ as wh,$ as Eh,t as Fo,z as Nt,f as ti}from"./zodToJsonSchema-Qxfd2wnD.js";import{d as zi}from"./deep-compare-strict-DtUHXpbW.js";import{v as cf}from"./v4-BKrj-4V8.js";var Hi={},_n={},Gi,Do;function We(){if(Do)return Gi;Do=1;function n(p){"@babel/helpers - typeof";return n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(b){return typeof b}:function(b){return b&&typeof Symbol=="function"&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b},n(p)}function e(p,b,w){return Object.defineProperty(p,"prototype",{writable:!1}),p}function t(p,b){if(!(p instanceof b))throw new TypeError("Cannot call a class as a function")}function r(p,b,w){return b=f(b),i(p,l()?Reflect.construct(b,w||[],f(p).constructor):b.apply(p,w))}function i(p,b){if(b&&(n(b)=="object"||typeof b=="function"))return b;if(b!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return a(p)}function a(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function s(p,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function");p.prototype=Object.create(b&&b.prototype,{constructor:{value:p,writable:!0,configurable:!0}}),Object.defineProperty(p,"prototype",{writable:!1}),b&&h(p,b)}function o(p){var b=typeof Map=="function"?new Map:void 0;return o=function(m){if(m===null||!c(m))return m;if(typeof m!="function")throw new TypeError("Super expression must either be null or a function");if(b!==void 0){if(b.has(m))return b.get(m);b.set(m,g)}function g(){return u(m,arguments,f(this).constructor)}return g.prototype=Object.create(m.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),h(g,m)},o(p)}function u(p,b,w){if(l())return Reflect.construct.apply(null,arguments);var m=[null];m.push.apply(m,b);var g=new(p.bind.apply(p,m));return w&&h(g,w.prototype),g}function l(){try{var p=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(l=function(){return!!p})()}function c(p){try{return Function.toString.call(p).indexOf("[native code]")!==-1}catch{return typeof p=="function"}}function h(p,b){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(w,m){return w.__proto__=m,w},h(p,b)}function f(p){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(b){return b.__proto__||Object.getPrototypeOf(b)},f(p)}var _=(function(p){function b(w){var m;return t(this,b),m=r(this,b,[`Format functions must be synchronous taking a two arguments: (info, opts)
|
|
3
3
|
Found: `.concat(w.toString().split(`
|
|
4
4
|
`)[0],`
|
|
5
5
|
`)]),Error.captureStackTrace(m,b),m}return s(b,p),e(b)})(o(Error));return Gi=function(p){if(p.length>2)throw new _(p);function b(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.options=m}b.prototype.transform=p;function w(m){return new b(m)}return w.Format=b,w},Gi}var Mr={exports:{}},Vi={exports:{}},Wi={exports:{}};function ff(){return()=>{}}function df(n){return JSON.stringify(n)}function hf(){}function pf(){}const Sh={debuglog:ff,inspect:df,inherits:hf,format:pf},Oh=Object.freeze(Object.defineProperty({__proto__:null,debuglog:ff,default:Sh,format:pf,inherits:hf,inspect:df},Symbol.toStringTag,{value:"Module"})),ft=xi(Oh);var Ji={exports:{}},Uo;function Th(){return Uo||(Uo=1,(function(n){var e={};n.exports=e;var t={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(t).forEach(function(r){var i=t[r],a=e[r]=[];a.open="\x1B["+i[0]+"m",a.close="\x1B["+i[1]+"m"})})(Ji)),Ji.exports}const Ph={},Xr=Object.freeze(Object.defineProperty({__proto__:null,default:Ph},Symbol.toStringTag,{value:"Module"})),ut=xi(Xr);var Ki,Bo;function xh(){return Bo||(Bo=1,Ki=function(n,e){e=e||process.argv||[];var t=e.indexOf("--"),r=/^-{1,2}/.test(n)?"":"--",i=e.indexOf(r+n);return i!==-1&&(t===-1?!0:i<t)}),Ki}var Yi,qo;function Ah(){if(qo)return Yi;qo=1;var n={},e=xh(),t=n,r=void 0;e("no-color")||e("no-colors")||e("color=false")?r=!1:(e("color")||e("colors")||e("color=true")||e("color=always"))&&(r=!0),"FORCE_COLOR"in t&&(r=t.FORCE_COLOR.length===0||parseInt(t.FORCE_COLOR,10)!==0);function i(o){return o===0?!1:{level:o,hasBasic:!0,has256:o>=2,has16m:o>=3}}function a(o){if(r===!1)return 0;if(e("color=16m")||e("color=full")||e("color=truecolor"))return 3;if(e("color=256"))return 2;if(o&&!o.isTTY&&r!==!0)return 0;var u=r?1:0;if("CI"in t)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(c){return c in t})||t.CI_NAME==="codeship"?1:u;if("TEAMCITY_VERSION"in t)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(t.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in t){var l=parseInt((t.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(t.TERM_PROGRAM){case"iTerm.app":return l>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(t.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(t.TERM)||"COLORTERM"in t?1:(t.TERM==="dumb",u)}function s(o){var u=a(o);return i(u)}return Yi={supportsColor:s,stdout:s(process.stdout),stderr:s(process.stderr)},Yi}var Qi={exports:{}},zo;function Rh(){return zo||(zo=1,(function(n){n.exports=function(t,r){var i="";t=t||"Run the trap, drop the bass",t=t.split("");var a={a:["@","Ą","Ⱥ","Ʌ","Δ","Λ","Д"],b:["ß","Ɓ","Ƀ","ɮ","β","฿"],c:["©","Ȼ","Ͼ"],d:["Ð","Ɗ","Ԁ","ԁ","Ԃ","ԃ"],e:["Ë","ĕ","Ǝ","ɘ","Σ","ξ","Ҽ","੬"],f:["Ӻ"],g:["ɢ"],h:["Ħ","ƕ","Ң","Һ","Ӈ","Ԋ"],i:["༏"],j:["Ĵ"],k:["ĸ","Ҡ","Ӄ","Ԟ"],l:["Ĺ"],m:["ʍ","Ӎ","ӎ","Ԡ","ԡ","൩"],n:["Ñ","ŋ","Ɲ","Ͷ","Π","Ҋ"],o:["Ø","õ","ø","Ǿ","ʘ","Ѻ","ם","","๏"],p:["Ƿ","Ҏ"],q:["্"],r:["®","Ʀ","Ȑ","Ɍ","ʀ","Я"],s:["§","Ϟ","ϟ","Ϩ"],t:["Ł","Ŧ","ͳ"],u:["Ʊ","Ս"],v:["ט"],w:["Ш","Ѡ","Ѽ","൰"],x:["Ҳ","Ӿ","Ӽ","ӽ"],y:["¥","Ұ","Ӌ"],z:["Ƶ","ɀ"]};return t.forEach(function(s){s=s.toLowerCase();var o=a[s]||[" "],u=Math.floor(Math.random()*o.length);typeof a[s]<"u"?i+=a[s][u]:i+=s}),i}})(Qi)),Qi.exports}var Zi={exports:{}},Ho;function Ih(){return Ho||(Ho=1,(function(n){n.exports=function(t,r){t=t||" he is here ";var i={up:["̍","̎","̄","̅","̿","̑","̆","̐","͒","͗","͑","̇","̈","̊","͂","̓","̈","͊","͋","͌","̃","̂","̌","͐","̀","́","̋","̏","̒","̓","̔","̽","̉","ͣ","ͤ","ͥ","ͦ","ͧ","ͨ","ͩ","ͪ","ͫ","ͬ","ͭ","ͮ","ͯ","̾","͛","͆","̚"],down:["̖","̗","̘","̙","̜","̝","̞","̟","̠","̤","̥","̦","̩","̪","̫","̬","̭","̮","̯","̰","̱","̲","̳","̹","̺","̻","̼","ͅ","͇","͈","͉","͍","͎","͓","͔","͕","͖","͙","͚","̣"],mid:["̕","̛","̀","́","͘","̡","̢","̧","̨","̴","̵","̶","͜","͝","͞","͟","͠","͢","̸","̷","͡"," ҉"]},a=[].concat(i.up,i.down,i.mid);function s(l){var c=Math.floor(Math.random()*l);return c}function o(l){var c=!1;return a.filter(function(h){c=h===l}),c}function u(l,c){var h="",f,_;c=c||{},c.up=typeof c.up<"u"?c.up:!0,c.mid=typeof c.mid<"u"?c.mid:!0,c.down=typeof c.down<"u"?c.down:!0,c.size=typeof c.size<"u"?c.size:"maxi",l=l.split("");for(_ in l)if(!o(_)){switch(h=h+l[_],f={up:0,down:0,mid:0},c.size){case"mini":f.up=s(8),f.mid=s(2),f.down=s(8);break;case"maxi":f.up=s(16)+3,f.mid=s(4)+1,f.down=s(64)+3;break;default:f.up=s(8)+1,f.mid=s(6)/2,f.down=s(8)+1;break}var p=["up","mid","down"];for(var b in p)for(var w=p[b],m=0;m<=f[w];m++)c[w]&&(h=h+i[w][s(i[w].length)])}return h}return u(t,r)}})(Zi)),Zi.exports}var Xi={exports:{}},Go;function Ch(){return Go||(Go=1,(function(n){n.exports=function(e){return function(t,r,i){if(t===" ")return t;switch(r%3){case 0:return e.red(t);case 1:return e.white(t);case 2:return e.blue(t)}}}})(Xi)),Xi.exports}var ea={exports:{}},Vo;function $h(){return Vo||(Vo=1,(function(n){n.exports=function(e){return function(t,r,i){return r%2===0?t:e.inverse(t)}}})(ea)),ea.exports}var ta={exports:{}},Wo;function jh(){return Wo||(Wo=1,(function(n){n.exports=function(e){var t=["red","yellow","green","blue","magenta"];return function(r,i,a){return r===" "?r:e[t[i++%t.length]](r)}}})(ta)),ta.exports}var ra={exports:{}},Jo;function Mh(){return Jo||(Jo=1,(function(n){n.exports=function(e){var t=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(r,i,a){return r===" "?r:e[t[Math.round(Math.random()*(t.length-2))]](r)}}})(ra)),ra.exports}var Ko;function kh(){return Ko||(Ko=1,(function(n){var e={};n.exports=e,e.themes={};var t=ft,r=e.styles=Th(),i=Object.defineProperties,a=new RegExp(/[\r\n]+/g);e.supportsColor=Ah().supportsColor,typeof e.enabled>"u"&&(e.enabled=e.supportsColor()!==!1),e.enable=function(){e.enabled=!0},e.disable=function(){e.enabled=!1},e.stripColors=e.strip=function(b){return(""+b).replace(/\x1B\[\d+m/g,"")},e.stylize=function(w,m){if(!e.enabled)return w+"";var g=r[m];return!g&&m in e?e[m](w):g.open+w+g.close};var s=/[|\\{}()[\]^$+*?.]/g,o=function(b){if(typeof b!="string")throw new TypeError("Expected a string");return b.replace(s,"\\$&")};function u(b){var w=function m(){return h.apply(m,arguments)};return w._styles=b,w.__proto__=c,w}var l=(function(){var b={};return r.grey=r.gray,Object.keys(r).forEach(function(w){r[w].closeRe=new RegExp(o(r[w].close),"g"),b[w]={get:function(){return u(this._styles.concat(w))}}}),b})(),c=i(function(){},l);function h(){var b=Array.prototype.slice.call(arguments),w=b.map(function(O){return O!=null&&O.constructor===String?O:t.inspect(O)}).join(" ");if(!e.enabled||!w)return w;for(var m=w.indexOf(`
|
|
@@ -40,7 +40,7 @@ Found: ${t.toString().split(`
|
|
|
40
40
|
`)[0]}
|
|
41
41
|
`),Error.captureStackTrace(this,n)}}return as=e=>{if(e.length>2)throw new n(e);function t(i={}){this.options=i}t.prototype.transform=e;function r(i){return new t(i)}return r.Format=t,r},as}var ss,Hl;function Zp(){if(Hl)return ss;Hl=1;const n=Qp(),{MESSAGE:e}=xe(),t=fn();function r(i,a){return typeof a=="bigint"?a.toString():a}return ss=n((i,a)=>{const s=t.configure(a);return i[e]=s(i,a.replacer||r,a.space),i}),ss}var os,Gl;function ho(){if(Gl)return os;Gl=1;function n(j,D,G){return(D=a(D))in j?Object.defineProperty(j,D,{value:G,enumerable:!0,configurable:!0,writable:!0}):j[D]=G,j}function e(j){"@babel/helpers - typeof";return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(D){return typeof D}:function(D){return D&&typeof Symbol=="function"&&D.constructor===Symbol&&D!==Symbol.prototype?"symbol":typeof D},e(j)}function t(j,D){if(!(j instanceof D))throw new TypeError("Cannot call a class as a function")}function r(j,D){for(var G=0;G<D.length;G++){var U=D[G];U.enumerable=U.enumerable||!1,U.configurable=!0,"value"in U&&(U.writable=!0),Object.defineProperty(j,a(U.key),U)}}function i(j,D,G){return D&&r(j.prototype,D),Object.defineProperty(j,"prototype",{writable:!1}),j}function a(j){var D=s(j,"string");return e(D)=="symbol"?D:D+""}function s(j,D){if(e(j)!="object"||!j)return j;var G=j[Symbol.toPrimitive];if(G!==void 0){var U=G.call(j,D);if(e(U)!="object")return U;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(j)}function o(j,D,G){return D=h(D),u(j,c()?Reflect.construct(D,G||[],h(j).constructor):D.apply(j,G))}function u(j,D){if(D&&(e(D)=="object"||typeof D=="function"))return D;if(D!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return l(j)}function l(j){if(j===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return j}function c(){try{var j=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(c=function(){return!!j})()}function h(j){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(D){return D.__proto__||Object.getPrototypeOf(D)},h(j)}function f(j,D){if(typeof D!="function"&&D!==null)throw new TypeError("Super expression must either be null or a function");j.prototype=Object.create(D&&D.prototype,{constructor:{value:j,writable:!0,configurable:!0}}),Object.defineProperty(j,"prototype",{writable:!1}),D&&_(j,D)}function _(j,D){return _=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(G,U){return G.__proto__=U,G},_(j,D)}var p=Ar(),b=p.Stream,w=p.Transform,m=fo(),g=xe(),v=g.LEVEL,E=g.SPLAT,O=Hf(),C=Wf(),R=Jf(),I=Kp(),$=Yp(),M=xf(),z=M.warn,B=co(),F=/%[scdjifoO%]/g,Y=(function(j){function D(G){var U;return t(this,D),U=o(this,D,[{objectMode:!0}]),U.configure(G),U}return f(D,j),i(D,[{key:"child",value:function(U){var H=this;return Object.create(H,{write:{value:function(X){var ae=Object.assign({},U,X);X instanceof Error&&(ae.stack=X.stack,ae.message=X.message),H.write(ae)}}})}},{key:"configure",value:function(){var U=this,H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},J=H.silent,X=H.format,ae=H.defaultMeta,Q=H.levels,ee=H.level,N=ee===void 0?"info":ee,k=H.exitOnError,V=k===void 0?!0:k,se=H.transports,oe=H.colors,T=H.emitErrs,x=H.formatters,W=H.padLevels,re=H.rewriters,_e=H.stripColors,he=H.exceptionHandlers,ye=H.rejectionHandlers;if(this.transports.length&&this.clear(),this.silent=J,this.format=X||this.format||Zp()(),this.defaultMeta=ae||null,this.levels=Q||this.levels||B.npm.levels,this.level=N,this.exceptions&&this.exceptions.unhandle(),this.rejections&&this.rejections.unhandle(),this.exceptions=new C(this),this.rejections=new R(this),this.profilers={},this.exitOnError=V,se&&(se=Array.isArray(se)?se:[se],se.forEach(function(ke){return U.add(ke)})),oe||T||x||W||re||_e)throw new Error(["{ colors, emitErrs, formatters, padLevels, rewriters, stripColors } were removed in winston@3.0.0.","Use a custom winston.format(function) instead.","See: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md"].join(`
|
|
42
42
|
`));he&&this.exceptions.handle(he),ye&&this.rejections.handle(ye)}},{key:"getHighestLogLevel",value:function(){var U=this,H=Z(this.levels,this.level);return!this.transports||this.transports.length===0?H:this.transports.reduce(function(J,X){var ae=Z(U.levels,X.level);return ae!==null&&ae>J?ae:J},H)}},{key:"isLevelEnabled",value:function(U){var H=this,J=Z(this.levels,U);if(J===null)return!1;var X=Z(this.levels,this.level);if(X===null)return!1;if(!this.transports||this.transports.length===0)return X>=J;var ae=this.transports.findIndex(function(Q){var ee=Z(H.levels,Q.level);return ee===null&&(ee=X),ee>=J});return ae!==-1}},{key:"log",value:function(U,H){for(var J=arguments.length,X=new Array(J>2?J-2:0),ae=2;ae<J;ae++)X[ae-2]=arguments[ae];if(arguments.length===1)return U[v]=U.level,this._addDefaultMeta(U),this.write(U),this;if(arguments.length===2)return H&&e(H)==="object"?(H[v]=H.level=U,this._addDefaultMeta(H),this.write(H),this):(H=n(n(n({},v,U),"level",U),"message",H),this._addDefaultMeta(H),this.write(H),this);var Q=X[0];if(e(Q)==="object"&&Q!==null){var ee=H&&H.match&&H.match(F);if(!ee){var N=Object.assign({},this.defaultMeta,Q,n(n(n(n({},v,U),E,X),"level",U),"message",H));return Q.message&&(N.message="".concat(N.message," ").concat(Q.message)),Q.stack&&(N.stack=Q.stack),Q.cause&&(N.cause=Q.cause),this.write(N),this}}return this.write(Object.assign({},this.defaultMeta,n(n(n(n({},v,U),E,X),"level",U),"message",H))),this}},{key:"_transform",value:function(U,H,J){if(this.silent)return J();U[v]||(U[v]=U.level),!this.levels[U[v]]&&this.levels[U[v]]!==0&&console.error("[winston] Unknown logger level: %s",U[v]),this._readableState.pipes||console.error("[winston] Attempt to write logs with no transports, which can increase memory usage: %j",U);try{this.push(this.format.transform(U,this.format.options))}finally{this._writableState.sync=!1,J()}}},{key:"_final",value:function(U){var H=this.transports.slice();m(H,function(J,X){if(!J||J.finished)return setImmediate(X);J.once("finish",X),J.end()},U)}},{key:"add",value:function(U){var H=!O(U)||U.log.length>2?new I({transport:U}):U;if(!H._writableState||!H._writableState.objectMode)throw new Error("Transports must WritableStreams in objectMode. Set { objectMode: true }.");return this._onEvent("error",H),this._onEvent("warn",H),this.pipe(H),U.handleExceptions&&this.exceptions.handle(),U.handleRejections&&this.rejections.handle(),this}},{key:"remove",value:function(U){if(!U)return this;var H=U;return(!O(U)||U.log.length>2)&&(H=this.transports.filter(function(J){return J.transport===U})[0]),H&&this.unpipe(H),this}},{key:"clear",value:function(){return this.unpipe(),this}},{key:"close",value:function(){return this.exceptions.unhandle(),this.rejections.unhandle(),this.clear(),this.emit("close"),this}},{key:"setLevels",value:function(){z.deprecated("setLevels")}},{key:"query",value:function(U,H){typeof U=="function"&&(H=U,U={}),U=U||{};var J={},X=Object.assign({},U.query||{});function ae(ee,N){U.query&&typeof ee.formatQuery=="function"&&(U.query=ee.formatQuery(X)),ee.query(U,function(k,V){if(k)return N(k);typeof ee.formatResults=="function"&&(V=ee.formatResults(V,U.format)),N(null,V)})}function Q(ee,N){ae(ee,function(k,V){N&&(V=k||V,V&&(J[ee.name]=V),N()),N=null})}m(this.transports.filter(function(ee){return!!ee.query}),Q,function(){return H(null,J)})}},{key:"stream",value:function(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},H=new b,J=[];return H._streams=J,H.destroy=function(){for(var X=J.length;X--;)J[X].destroy()},this.transports.filter(function(X){return!!X.stream}).forEach(function(X){var ae=X.stream(U);ae&&(J.push(ae),ae.on("log",function(Q){Q.transport=Q.transport||[],Q.transport.push(X.name),H.emit("log",Q)}),ae.on("error",function(Q){Q.transport=Q.transport||[],Q.transport.push(X.name),H.emit("error",Q)}))}),H}},{key:"startTimer",value:function(){return new $(this)}},{key:"profile",value:function(U){var H=Date.now();if(this.profilers[U]){var J=this.profilers[U];delete this.profilers[U];for(var X=arguments.length,ae=new Array(X>1?X-1:0),Q=1;Q<X;Q++)ae[Q-1]=arguments[Q];typeof ae[ae.length-2]=="function"&&(console.warn("Callback function no longer supported as of winston@3.0.0"),ae.pop());var ee=e(ae[ae.length-1])==="object"?ae.pop():{};return ee.level=ee.level||"info",ee.durationMs=H-J,ee.message=ee.message||U,this.write(ee)}return this.profilers[U]=H,this}},{key:"handleExceptions",value:function(){var U;console.warn("Deprecated: .handleExceptions() will be removed in winston@4. Use .exceptions.handle()"),(U=this.exceptions).handle.apply(U,arguments)}},{key:"unhandleExceptions",value:function(){var U;console.warn("Deprecated: .unhandleExceptions() will be removed in winston@4. Use .exceptions.unhandle()"),(U=this.exceptions).unhandle.apply(U,arguments)}},{key:"cli",value:function(){throw new Error(["Logger.cli() was removed in winston@3.0.0","Use a custom winston.formats.cli() instead.","See: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md"].join(`
|
|
43
|
-
`))}},{key:"_onEvent",value:function(U,H){function J(X){U==="error"&&!this.transports.includes(H)&&this.add(H),this.emit(U,X,H)}H["__winston"+U]||(H["__winston"+U]=J.bind(this),H.on(U,H["__winston"+U]))}},{key:"_addDefaultMeta",value:function(U){this.defaultMeta&&Object.assign(U,this.defaultMeta)}}])})(w);function Z(j,D){var G=j[D];return!G&&G!==0?null:G}return Object.defineProperty(Y.prototype,"transports",{configurable:!1,enumerable:!0,get:function(){var D=this._readableState.pipes;return Array.isArray(D)?D:[D].filter(Boolean)}}),os=Y,os}var us,Vl;function Kf(){if(Vl)return us;Vl=1;function n(w){"@babel/helpers - typeof";return n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(m){return typeof m}:function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},n(w)}function e(w,m,g){return Object.defineProperty(w,"prototype",{writable:!1}),w}function t(w,m){if(!(w instanceof m))throw new TypeError("Cannot call a class as a function")}function r(w,m,g){return m=o(m),i(w,s()?Reflect.construct(m,g||[],o(w).constructor):m.apply(w,g))}function i(w,m){if(m&&(n(m)=="object"||typeof m=="function"))return m;if(m!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return a(w)}function a(w){if(w===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return w}function s(){try{var w=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(s=function(){return!!w})()}function o(w){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(m){return m.__proto__||Object.getPrototypeOf(m)},o(w)}function u(w,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function");w.prototype=Object.create(m&&m.prototype,{constructor:{value:w,writable:!0,configurable:!0}}),Object.defineProperty(w,"prototype",{writable:!1}),m&&l(w,m)}function l(w,m){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(g,v){return g.__proto__=v,g},l(w,m)}var c=xe(),h=c.LEVEL,f=co(),_=ho(),p=Ii()("winston:create-logger");function b(w){return"is"+w.charAt(0).toUpperCase()+w.slice(1)+"Enabled"}return us=function(){var w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};w.levels=w.levels||f.npm.levels;var m=(function(v){function E(O){return t(this,E),r(this,E,[O])}return u(E,v),e(E)})(_),g=new m(w);return Object.keys(w.levels).forEach(function(v){if(p('Define prototype method for "%s"',v),v==="log"){console.warn('Level "log" not defined: conflicts with the method "log". Use a different level name.');return}m.prototype[v]=function(){for(var E=this||g,O=arguments.length,C=new Array(O),R=0;R<O;R++)C[R]=arguments[R];if(C.length===1){var I=C[0],$=I&&I.message&&I||{message:I};return $.level=$[h]=v,E._addDefaultMeta($),E.write($),this||g}return C.length===0?(E.log(v,""),E):E.log.apply(E,[v].concat(C))},m.prototype[b(v)]=function(){return(this||g).isLevelEnabled(v)}}),g},us}var ls,Wl;function Xp(){if(Wl)return ls;Wl=1;function n(o){"@babel/helpers - typeof";return n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u},n(o)}function e(o,u){if(!(o instanceof u))throw new TypeError("Cannot call a class as a function")}function t(o,u){for(var l=0;l<u.length;l++){var c=u[l];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(o,i(c.key),c)}}function r(o,u,l){return u&&t(o.prototype,u),Object.defineProperty(o,"prototype",{writable:!1}),o}function i(o){var u=a(o,"string");return n(u)=="symbol"?u:u+""}function a(o,u){if(n(o)!="object"||!o)return o;var l=o[Symbol.toPrimitive];if(l!==void 0){var c=l.call(o,u);if(n(c)!="object")return c;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}var s=Kf();return ls=(function(){function o(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e(this,o),this.loggers=new Map,this.options=u}return r(o,[{key:"add",value:function(l,c){var h=this;if(!this.loggers.has(l)){c=Object.assign({},c||this.options);var f=c.transports||this.options.transports;f?c.transports=Array.isArray(f)?f.slice():[f]:c.transports=[];var _=s(c);_.on("close",function(){return h._delete(l)}),this.loggers.set(l,_)}return this.loggers.get(l)}},{key:"get",value:function(l,c){return this.add(l,c)}},{key:"has",value:function(l){return!!this.loggers.has(l)}},{key:"close",value:function(l){var c=this;if(l)return this._removeLogger(l);this.loggers.forEach(function(h,f){return c._removeLogger(f)})}},{key:"_removeLogger",value:function(l){if(this.loggers.has(l)){var c=this.loggers.get(l);c.close(),this._delete(l)}}},{key:"_delete",value:function(l){this.loggers.delete(l)}}])})(),ls}var Jl;function em(){return Jl||(Jl=1,(function(n){var e=Pf(),t=xf(),r=t.warn;n.version=hp.version,n.transports=qp(),n.config=co(),n.addColors=e.levels,n.format=e.format,n.createLogger=Kf(),n.Logger=ho(),n.ExceptionHandler=Wf(),n.RejectionHandler=Jf(),n.Container=Xp(),n.Transport=hn(),n.loggers=new n.Container;var i=n.createLogger();Object.keys(n.config.npm.levels).concat(["log","query","stream","add","remove","clear","profile","startTimer","handleExceptions","unhandleExceptions","handleRejections","unhandleRejections","configure","child"]).forEach(function(a){return n[a]=function(){return i[a].apply(i,arguments)}}),Object.defineProperty(n,"level",{get:function(){return i.level},set:function(s){i.level=s}}),Object.defineProperty(n,"exceptions",{get:function(){return i.exceptions}}),Object.defineProperty(n,"rejections",{get:function(){return i.rejections}}),["exitOnError"].forEach(function(a){Object.defineProperty(n,a,{get:function(){return i[a]},set:function(o){i[a]=o}})}),Object.defineProperty(n,"default",{get:function(){return{exceptionHandlers:i.exceptionHandlers,rejectionHandlers:i.rejectionHandlers,transports:i.transports}}}),r.deprecated(n,"setLevels"),r.forFunctions(n,"useFormat",["cli"]),r.forProperties(n,"useFormat",["padLevels","stripColors"]),r.forFunctions(n,"deprecated",["addRewriter","addFilter","clone","extend"]),r.forProperties(n,"deprecated",["emitErrs","levelLength"])})(Hi)),Hi}var zr=em(),Pe={};async function Yf(){if(typeof process<"u")try{const n=await Me(()=>Promise.resolve().then(()=>Xr),void 0),e=await Me(()=>Promise.resolve().then(()=>Df),void 0);return{fs:n.default,path:e.default}}catch{return{fs:null,path:null}}return{fs:null,path:null}}le(Yf,"getNodeModules");var{combine:Kl,timestamp:Yl,label:Ql,printf:po,colorize:Zl,splat:Xl}=zr.format,Is="mcp-use";function ci(){try{if(typeof navigator<"u"&&navigator.userAgent?.includes("Cloudflare-Workers")||typeof globalThis.EdgeRuntime<"u"||typeof globalThis.Deno<"u")return!1;const n=typeof process<"u"&&!0&&typeof __dirname<"u",e=typeof zr.createLogger=="function";return n&&e}catch{return!1}}le(ci,"isNodeJSEnvironment");var Kt,tm=(Kt=class{_level;name;constructor(e=Is,t="info"){this.name=e,this._level=t}shouldLog(e){const t=["error","warn","info","http","verbose","debug","silly"],r=t.indexOf(this._level);return t.indexOf(e)<=r}formatMessage(e,t){return`${new Date().toLocaleTimeString("en-US",{hour12:!1})} [${this.name}] ${e}: ${t}`}error(e){this.shouldLog("error")&&console.error(this.formatMessage("error",e))}warn(e){this.shouldLog("warn")&&console.warn(this.formatMessage("warn",e))}info(e){this.shouldLog("info")&&console.info(this.formatMessage("info",e))}debug(e){this.shouldLog("debug")&&console.debug(this.formatMessage("debug",e))}http(e){this.shouldLog("http")&&console.log(this.formatMessage("http",e))}verbose(e){this.shouldLog("verbose")&&console.log(this.formatMessage("verbose",e))}silly(e){this.shouldLog("silly")&&console.log(this.formatMessage("silly",e))}get level(){return this._level}set level(e){this._level=e}},le(Kt,"SimpleConsoleLogger"),Kt);function ri(n){switch((typeof process<"u"&&Pe?n:void 0)?.trim()){case"2":return"debug";case"1":return"info";default:return"info"}}le(ri,"resolveLevel");var ec=po(({level:n,message:e,label:t,timestamp:r})=>`${r} [${t}] ${n}: ${e}`),rm=po(({level:n,message:e,label:t,timestamp:r})=>`${r} [${t}] ${n.toUpperCase()}: ${e}`),nm=po(({level:n,message:e,label:t,timestamp:r})=>`${r} [${t}] ${n.toUpperCase()}: ${e}`),ht,fi=(ht=class{static get(e=Is){if(!ci()){if(!this.simpleInstances[e]){const t=typeof process<"u"&&Pe?.DEBUG||void 0;this.simpleInstances[e]=new tm(e,ri(t))}return this.simpleInstances[e]}return this.instances[e]||(this.instances[e]=zr.createLogger({level:ri(Pe.DEBUG),format:Kl(Zl(),Xl(),Ql({label:e}),Yl({format:"HH:mm:ss"}),this.getFormatter()),transports:[]})),this.instances[e]}static getFormatter(){switch(this.currentFormat){case"minimal":return ec;case"detailed":return rm;case"emoji":return nm;default:return ec}}static async configure(e={}){const{level:t,console:r=!0,file:i,format:a="minimal"}=e,s=typeof process<"u"&&Pe?.DEBUG||void 0,o=t??ri(s);this.currentFormat=a;const u=this.get();u.level=o;const l=u;if(!ci()){Object.values(this.simpleInstances).forEach(c=>{c.level=o});return}if(l.clear(),r&&l.add(new zr.transports.Console),i){const{fs:c,path:h}=await Yf();if(c&&h){const f=h.dirname(h.resolve(i));c.existsSync(f)||c.mkdirSync(f,{recursive:!0}),l.add(new zr.transports.File({filename:i}))}}Object.values(this.instances).forEach(c=>{c&&"format"in c&&(c.level=o,c.format=Kl(Zl(),Xl(),Ql({label:Is}),Yl({format:"HH:mm:ss"}),this.getFormatter()))})}static setDebug(e){let t;e===2||e===!0?t="debug":t="info",Object.values(this.simpleInstances).forEach(r=>{r.level=t}),Object.values(this.instances).forEach(r=>{r&&(r.level=t)}),typeof process<"u"&&Pe&&(Pe.DEBUG=e?e===!0?"2":String(e):"0")}static setFormat(e){this.currentFormat=e,this.configure({format:e})}},le(ht,"Logger"),jr(ht,"instances",{}),jr(ht,"simpleInstances",{}),jr(ht,"currentFormat","minimal"),ht);ci()?fi.configure():fi.configure({console:!0});var A=fi.get(),im=Pe.MCP_USE_LANGFUSE?.toLowerCase()==="false",en={handler:null,client:null,initPromise:null};async function mo(n,e,t,r){try{const i=await Me(()=>import("./index-BOE1bu_0.js"),__vite__mapDeps([0,1,2,3,4,5,6])).catch(()=>null);if(!i){A.debug("Langfuse package not installed - tracing disabled. Install with: npm install langfuse-langchain");return}const{CallbackHandler:a}=i,u=class u extends a{agentId;metadata;metadataProvider;tagsProvider;verbose;constructor(c,h,f,_,p){super(c),this.agentId=h,this.metadata=f,this.metadataProvider=_,this.tagsProvider=p,this.verbose=c?.verbose??!1}async handleChainStart(c,h,f,_,p,b,w,m){A.debug("Langfuse: Chain start intercepted");const g=this.getCustomTags(),v=this.getMetadata(),E=[...p||[],...g],O={...b||{},...v};return this.verbose&&(A.debug(`Langfuse: Chain start with custom tags: ${JSON.stringify(E)}`),A.debug(`Langfuse: Chain start with metadata: ${JSON.stringify(O)}`)),super.handleChainStart(c,h,f,_,E,O,w,m)}getCustomTags(){const c=[],h=this.getEnvironmentTag();if(h&&c.push(`env:${h}`),this.agentId&&c.push(`agent_id:${this.agentId}`),this.tagsProvider){const f=this.tagsProvider();f&&f.length>0&&c.push(...f)}return c}getMetadata(){const c={},h=this.getEnvironmentTag();if(h&&(c.env=h),this.agentId&&(c.agent_id=this.agentId),this.metadata&&Object.assign(c,this.metadata),this.metadataProvider){const f=this.metadataProvider();f&&Object.assign(c,f)}return c}getEnvironmentTag(){const c=Pe.MCP_USE_AGENT_ENV;if(!c)return"unknown";const h=c.toLowerCase();return h==="local"||h==="development"?"local":h==="production"||h==="prod"?"production":h==="staging"||h==="stage"?"staging":h==="hosted"||h==="cloud"?"hosted":h.replace(/[^a-z0-9_-]/g,"_")}async handleLLMStart(...c){return A.debug("Langfuse: LLM start intercepted"),this.verbose&&A.debug(`Langfuse: LLM start args: ${JSON.stringify(c)}`),super.handleLLMStart(...c)}async handleToolStart(...c){return A.debug("Langfuse: Tool start intercepted"),this.verbose&&A.debug(`Langfuse: Tool start args: ${JSON.stringify(c)}`),super.handleToolStart(...c)}async handleRetrieverStart(...c){return A.debug("Langfuse: Retriever start intercepted"),this.verbose&&A.debug(`Langfuse: Retriever start args: ${JSON.stringify(c)}`),super.handleRetrieverStart(...c)}async handleAgentAction(...c){return A.debug("Langfuse: Agent action intercepted"),this.verbose&&A.debug(`Langfuse: Agent action args: ${JSON.stringify(c)}`),super.handleAgentAction(...c)}async handleAgentEnd(...c){return A.debug("Langfuse: Agent end intercepted"),this.verbose&&A.debug(`Langfuse: Agent end args: ${JSON.stringify(c)}`),super.handleAgentEnd(...c)}};le(u,"LoggingCallbackHandler");let s=u;const o={publicKey:Pe.LANGFUSE_PUBLIC_KEY,secretKey:Pe.LANGFUSE_SECRET_KEY,baseUrl:Pe.LANGFUSE_HOST||Pe.LANGFUSE_BASEURL||"https://cloud.langfuse.com",flushAt:Number.parseInt(Pe.LANGFUSE_FLUSH_AT||"15"),flushInterval:Number.parseInt(Pe.LANGFUSE_FLUSH_INTERVAL||"10000"),release:Pe.LANGFUSE_RELEASE,requestTimeout:Number.parseInt(Pe.LANGFUSE_REQUEST_TIMEOUT||"10000"),enabled:Pe.LANGFUSE_ENABLED!=="false"};en.handler=new s(o,n,e,t,r),A.debug("Langfuse observability initialized successfully with logging enabled");try{const l=await Me(()=>import("./index-Bgtt--Zu.js"),__vite__mapDeps([1,2,3,4,5,6])).catch(()=>null);if(l){const{Langfuse:c}=l;en.client=new c({publicKey:Pe.LANGFUSE_PUBLIC_KEY,secretKey:Pe.LANGFUSE_SECRET_KEY,baseUrl:Pe.LANGFUSE_HOST||"https://cloud.langfuse.com"}),A.debug("Langfuse client initialized")}}catch(l){A.debug(`Langfuse client initialization failed: ${l}`)}}catch(i){A.debug(`Langfuse initialization error: ${i}`)}}le(mo,"initializeLangfuse");im?A.debug("Langfuse tracing disabled via MCP_USE_LANGFUSE environment variable"):!Pe.LANGFUSE_PUBLIC_KEY||!Pe.LANGFUSE_SECRET_KEY?A.debug("Langfuse API keys not found - tracing disabled. Set LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY to enable"):en.initPromise=mo();var am=le(()=>en.handler,"langfuseHandler"),sm=le(()=>en.initPromise,"langfuseInitPromise");class om{static convert(e){return this.parseSchema(e)}static matchesCondition(e,t){if(!t.properties)return!0;if(typeof e!="object"||e===null||Array.isArray(e))return!1;const r=e;for(const[i,a]of Object.entries(t.properties)){if(!(i in r)){if("const"in a)return!1;continue}const s=r[i];if("const"in a&&s!==a.const||"minimum"in a&&typeof s=="number"&&s<a.minimum||"maximum"in a&&typeof s=="number"&&s>a.maximum)return!1}return!0}static validateConditionalSchema(e,t,r){this.validateRequiredProperties(e,t,r),this.validatePropertyPatterns(e,t,r),this.validateNestedConditions(e,t,r)}static validateRequiredProperties(e,t,r){if(t.required){if(typeof e!="object"||e===null){for(const i of t.required)r.addIssue({code:Bi.custom,message:`Required property '${i}' is missing`,path:[i]});return}for(const i of t.required)i in e||r.addIssue({code:Bi.custom,message:`Required property '${i}' is missing`,path:[i]})}}static validatePropertyPatterns(e,t,r){if(!t.properties||typeof e!="object"||e===null||Array.isArray(e))return;const i=e;for(const[a,s]of Object.entries(t.properties)){if(!(a in i))continue;const o=i[a];s.pattern&&typeof o=="string"&&(new RegExp(s.pattern).test(o)||r.addIssue({code:Bi.custom,message:`String '${o}' does not match pattern '${s.pattern}'`,path:[a]}))}}static validateNestedConditions(e,t,r){if(!t.if||!t.then)return;this.matchesCondition(e,t.if)?this.validateConditionalSchema(e,t.then,r):t.else&&this.validateConditionalSchema(e,t.else,r)}static parseSchema(e){return Array.isArray(e.type)?this.handleTypeArray(e):e.oneOf||e.anyOf||e.allOf?this.parseCombinator(e):e.if&&e.then?this.parseObject(e):e.properties&&(!e.type||e.type==="object")?this.parseObject(e):this.handleSingleType(e)}static handleTypeArray(e){if(!Array.isArray(e.type))throw new Error("Expected schema.type to be an array");return e.type.includes("null")?this.handleNullableType(e):this.createUnionFromTypes(e.type,e)}static handleNullableType(e){if(!Array.isArray(e.type))throw new Error("Expected schema.type to be an array");const t={...e};return t.type=e.type.filter(i=>i!=="null"),t.type.length===1?this.handleSingleType({...e,type:t.type[0]}).nullable():this.parseSchema(t).nullable()}static createUnionFromTypes(e,t){const r=e.map(i=>{const a={...t,type:i};return this.parseSchema(a)});return qi(r)}static handleSingleType(e){if(e.type===void 0)return e.oneOf||e.anyOf||e.allOf?this.parseCombinator(e):e.properties?this.parseObject(e):pt();switch(e.type){case"string":return this.parseString(e);case"number":case"integer":return this.parseNumberSchema(e);case"boolean":return sh();case"array":return this.parseArray(e);case"object":return this.parseObject(e);default:throw new Error("Unsupported schema type")}}static parseNumberSchema(e){let t=oh(),r=t;return r=this.applyNumberBounds(t,e),r=this.applyNumberMultipleOf(t,e),r=this.applyNumberEnum(t,e),r=this.applyIntegerConstraint(t,e),r}static applyNumberBounds(e,t){let r=e;return t.minimum!==void 0&&(r=t.exclusiveMinimum?r.gt(t.minimum):r.gte(t.minimum)),t.maximum!==void 0&&(r=t.exclusiveMaximum?r.lt(t.maximum):r.lte(t.maximum)),r}static applyNumberMultipleOf(e,t){return t.multipleOf===void 0?e:e.refine(r=>r%t.multipleOf===0,{message:`Number must be a multiple of ${t.multipleOf}`})}static applyNumberEnum(e,t){if(!t.enum)return e;const r=t.enum.filter(i=>typeof i=="number");return r.length===0?e:e.refine(i=>r.includes(i),{message:`Number must be one of: ${r.join(", ")}`})}static applyIntegerConstraint(e,t){return t.type!=="integer"?e:e.refine(r=>Number.isInteger(r),{message:"Number must be an integer"})}static parseString(e){let t=cn(),r=t;return e.format?this.applyStringFormat(t,e):(r=this.applyStringPattern(t,e),r=this.applyStringLength(t,e),r=this.applyStringEnum(t,e),r)}static applyStringFormat(e,t){if(!t.format)return e;switch(t.format){case"email":return e.email();case"date-time":return e.datetime();case"uri":return e.url();case"uuid":return e.uuid();case"date":return e.date();default:return e}}static applyStringPattern(e,t){if(!t.pattern)return e;const r=new RegExp(t.pattern);return e.regex(r,{message:`String must match pattern: ${t.pattern}`})}static applyStringLength(e,t){let r=e;return t.minLength!==void 0&&(e=e.min(t.minLength)),t.maxLength!==void 0&&(e=e.max(t.maxLength)),r}static applyStringEnum(e,t){return t.enum?e.refine(r=>t.enum?.includes(r),{message:`Value must be one of: ${t.enum?.join(", ")}`}):e}static parseArray(e){if(Array.isArray(e.items)){const a=e.items.map(s=>this.parseSchema(s));return qi(a)}const t=e.items?this.parseSchema(e.items):pt();let r=uh(t),i=r;return i=this.applyArrayConstraints(r,e),i}static applyArrayConstraints(e,t){return t.minItems!==void 0&&(e=e.min(t.minItems)),t.maxItems!==void 0&&(e=e.max(t.maxItems)),t.uniqueItems?e.refine(r=>new Set(r).size===r.length,{message:"Array items must be unique"}):e}static parseObject(e){if(e.if&&e.then)return this.parseConditional(e);const t={};return this.processObjectProperties(e,t),this.processAdditionalProperties(e,lt(t))}static processObjectProperties(e,t){const r=new Set(e.required||[]);if(e.properties)for(const[i,a]of Object.entries(e.properties)){const s=this.parseSchema(a);t[i]=r.has(i)?s:s.optional()}}static processAdditionalProperties(e,t){if(e.additionalProperties===!0)return t.passthrough();if(e.additionalProperties&&typeof e.additionalProperties=="object"){const r=this.parseSchema(e.additionalProperties);return t.catchall(r)}else return t.strict()}static parseConditional(e){const t=this.createBaseObjectSchema(e),r=e.if,i=e.then,a=e.else;return t.superRefine((s,o)=>{const u=this.applyDefaultValues(s,e);this.matchesCondition(u,r)?this.validateConditionalSchema(u,i,o):a&&this.validateConditionalSchema(u,a,o)})}static createBaseObjectSchema(e){const t={},r=new Set(e.required||[]);for(const[a,s]of Object.entries(e.properties||{})){const o=this.parseSchema(s);t[a]=r.has(a)?o:o.optional()}const i=lt(t);return this.processAdditionalProperties(e,i)}static applyDefaultValues(e,t){if(typeof e!="object"||e===null||Array.isArray(e))return e;const i={...e};if(!t.properties)return i;for(const[a,s]of Object.entries(t.properties))!(a in i)&&"default"in s&&(i[a]=s.default);return i}static parseCombinator(e){if(e.oneOf)return this.parseOneOf(e.oneOf);if(e.anyOf)return this.parseAnyOf(e.anyOf);if(e.allOf)return this.parseAllOf(e.allOf);throw new Error("Unsupported schema type")}static parseOneOf(e){return this.createUnionFromSchemas(e)}static parseAnyOf(e){return this.createUnionFromSchemas(e)}static createUnionFromSchemas(e){if(e.length===0)return pt();if(e.length===1)return this.parseSchema(e[0]);const t=[];for(const r of e)r.type==="null"?t.push(lh()):t.push(this.parseSchema(r));return t.length>=2?qi(t):t.length===1?t[0]:pt()}static parseAllOf(e){if(e.length===0)return pt();if(e.length===1)return this.parseSchema(e[0]);const t=e.reduce((r,i)=>this.mergeSchemas(r,i));return this.parseSchema(t)}static mergeSchemas(e,t){const r={...e,...t};if(e.properties&&t.properties){const i={...e.properties,...t.properties};r.properties=i}if(e.required&&t.required){const i=[...new Set([...e.required,...t.required])];r.required=i}return r}}function Ze(n){return encodeURI(um(n))}function um(n){return n.replace(/~/g,"~0").replace(/\//g,"~1")}const lm={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},cm={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},fm={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};let dm=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");function Ur(n,e=Object.create(null),t=dm,r=""){if(n&&typeof n=="object"&&!Array.isArray(n)){const a=n.$id||n.id;if(a){const s=new URL(a,t.href);s.hash.length>1?e[s.href]=n:(s.hash="",r===""?t=s:Ur(n,e,t))}}else if(n!==!0&&n!==!1)return e;const i=t.href+(r?"#"+r:"");if(e[i]!==void 0)throw new Error(`Duplicate schema URI "${i}".`);if(e[i]=n,n===!0||n===!1)return e;if(n.__absolute_uri__===void 0&&Object.defineProperty(n,"__absolute_uri__",{enumerable:!1,value:i}),n.$ref&&n.__absolute_ref__===void 0){const a=new URL(n.$ref,t.href);a.hash=a.hash,Object.defineProperty(n,"__absolute_ref__",{enumerable:!1,value:a.href})}if(n.$recursiveRef&&n.__absolute_recursive_ref__===void 0){const a=new URL(n.$recursiveRef,t.href);a.hash=a.hash,Object.defineProperty(n,"__absolute_recursive_ref__",{enumerable:!1,value:a.href})}if(n.$anchor){const a=new URL("#"+n.$anchor,t.href);e[a.href]=n}for(let a in n){if(fm[a])continue;const s=`${r}/${Ze(a)}`,o=n[a];if(Array.isArray(o)){if(lm[a]){const u=o.length;for(let l=0;l<u;l++)Ur(o[l],e,t,`${s}/${l}`)}}else if(cm[a])for(let u in o)Ur(o[u],e,t,`${s}/${Ze(u)}`);else Ur(o,e,t,s)}return e}const hm=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,pm=[0,31,28,31,30,31,30,31,31,30,31,30,31],mm=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,gm=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ym=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,bm=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,_m=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,vm=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,wm=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Em=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Sm=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Om=n=>{if(n[0]==='"')return!1;const[e,t,...r]=n.split("@");return!e||!t||r.length!==0||e.length>64||t.length>253||e[0]==="."||e.endsWith(".")||e.includes("..")||!/^[a-z0-9.-]+$/i.test(t)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(e)?!1:t.split(".").every(i=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(i))},Tm=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Pm=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,xm=n=>n.length>1&&n.length<80&&(/^P\d+([.,]\d+)?W$/.test(n)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(n)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(n));function at(n){return n.test.bind(n)}const tc={date:Qf,time:Zf.bind(void 0,!1),"date-time":Im,duration:xm,uri:jm,"uri-reference":at(ym),"uri-template":at(bm),url:at(_m),email:Om,hostname:at(gm),ipv4:at(Tm),ipv6:at(Pm),regex:km,uuid:at(vm),"json-pointer":at(wm),"json-pointer-uri-fragment":at(Em),"relative-json-pointer":at(Sm)};function Am(n){return n%4===0&&(n%100!==0||n%400===0)}function Qf(n){const e=n.match(hm);if(!e)return!1;const t=+e[1],r=+e[2],i=+e[3];return r>=1&&r<=12&&i>=1&&i<=(r==2&&Am(t)?29:pm[r])}function Zf(n,e){const t=e.match(mm);if(!t)return!1;const r=+t[1],i=+t[2],a=+t[3],s=!!t[5];return(r<=23&&i<=59&&a<=59||r==23&&i==59&&a==60)&&(!n||s)}const Rm=/t|\s/i;function Im(n){const e=n.split(Rm);return e.length==2&&Qf(e[0])&&Zf(!0,e[1])}const Cm=/\/|:/,$m=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function jm(n){return Cm.test(n)&&$m.test(n)}const Mm=/[^\\]\\Z/;function km(n){if(Mm.test(n))return!1;try{return new RegExp(n,"u"),!0}catch{return!1}}function Nm(n){let e=0,t=n.length,r=0,i;for(;r<t;)e++,i=n.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=n.charCodeAt(r),(i&64512)==56320&&r++);return e}function Se(n,e,t="2019-09",r=Ur(e),i=!0,a=null,s="#",o="#",u=Object.create(null)){if(e===!0)return{valid:!0,errors:[]};if(e===!1)return{valid:!1,errors:[{instanceLocation:s,keyword:"false",keywordLocation:s,error:"False boolean schema."}]};const l=typeof n;let c;switch(l){case"boolean":case"number":case"string":c=l;break;case"object":n===null?c="null":Array.isArray(n)?c="array":c="object";break;default:throw new Error(`Instances of "${l}" type are not supported.`)}const{$ref:h,$recursiveRef:f,$recursiveAnchor:_,type:p,const:b,enum:w,required:m,not:g,anyOf:v,allOf:E,oneOf:O,if:C,then:R,else:I,format:$,properties:M,patternProperties:z,additionalProperties:B,unevaluatedProperties:F,minProperties:Y,maxProperties:Z,propertyNames:j,dependentRequired:D,dependentSchemas:G,dependencies:U,prefixItems:H,items:J,additionalItems:X,unevaluatedItems:ae,contains:Q,minContains:ee,maxContains:N,minItems:k,maxItems:V,uniqueItems:se,minimum:oe,maximum:T,exclusiveMinimum:x,exclusiveMaximum:W,multipleOf:re,minLength:_e,maxLength:he,pattern:ye,__absolute_ref__:ke,__absolute_recursive_ref__:Et}=e,ie=[];if(_===!0&&a===null&&(a=e),f==="#"){const ce=a===null?r[Et]:a,ue=`${o}/$recursiveRef`,de=Se(n,a===null?e:a,t,r,i,ce,s,ue,u);de.valid||ie.push({instanceLocation:s,keyword:"$recursiveRef",keywordLocation:ue,error:"A subschema had errors."},...de.errors)}if(h!==void 0){const ue=r[ke||h];if(ue===void 0){let te=`Unresolved $ref "${h}".`;throw ke&&ke!==h&&(te+=` Absolute URI "${ke}".`),te+=`
|
|
43
|
+
`))}},{key:"_onEvent",value:function(U,H){function J(X){U==="error"&&!this.transports.includes(H)&&this.add(H),this.emit(U,X,H)}H["__winston"+U]||(H["__winston"+U]=J.bind(this),H.on(U,H["__winston"+U]))}},{key:"_addDefaultMeta",value:function(U){this.defaultMeta&&Object.assign(U,this.defaultMeta)}}])})(w);function Z(j,D){var G=j[D];return!G&&G!==0?null:G}return Object.defineProperty(Y.prototype,"transports",{configurable:!1,enumerable:!0,get:function(){var D=this._readableState.pipes;return Array.isArray(D)?D:[D].filter(Boolean)}}),os=Y,os}var us,Vl;function Kf(){if(Vl)return us;Vl=1;function n(w){"@babel/helpers - typeof";return n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(m){return typeof m}:function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},n(w)}function e(w,m,g){return Object.defineProperty(w,"prototype",{writable:!1}),w}function t(w,m){if(!(w instanceof m))throw new TypeError("Cannot call a class as a function")}function r(w,m,g){return m=o(m),i(w,s()?Reflect.construct(m,g||[],o(w).constructor):m.apply(w,g))}function i(w,m){if(m&&(n(m)=="object"||typeof m=="function"))return m;if(m!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return a(w)}function a(w){if(w===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return w}function s(){try{var w=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(s=function(){return!!w})()}function o(w){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(m){return m.__proto__||Object.getPrototypeOf(m)},o(w)}function u(w,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function");w.prototype=Object.create(m&&m.prototype,{constructor:{value:w,writable:!0,configurable:!0}}),Object.defineProperty(w,"prototype",{writable:!1}),m&&l(w,m)}function l(w,m){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(g,v){return g.__proto__=v,g},l(w,m)}var c=xe(),h=c.LEVEL,f=co(),_=ho(),p=Ii()("winston:create-logger");function b(w){return"is"+w.charAt(0).toUpperCase()+w.slice(1)+"Enabled"}return us=function(){var w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};w.levels=w.levels||f.npm.levels;var m=(function(v){function E(O){return t(this,E),r(this,E,[O])}return u(E,v),e(E)})(_),g=new m(w);return Object.keys(w.levels).forEach(function(v){if(p('Define prototype method for "%s"',v),v==="log"){console.warn('Level "log" not defined: conflicts with the method "log". Use a different level name.');return}m.prototype[v]=function(){for(var E=this||g,O=arguments.length,C=new Array(O),R=0;R<O;R++)C[R]=arguments[R];if(C.length===1){var I=C[0],$=I&&I.message&&I||{message:I};return $.level=$[h]=v,E._addDefaultMeta($),E.write($),this||g}return C.length===0?(E.log(v,""),E):E.log.apply(E,[v].concat(C))},m.prototype[b(v)]=function(){return(this||g).isLevelEnabled(v)}}),g},us}var ls,Wl;function Xp(){if(Wl)return ls;Wl=1;function n(o){"@babel/helpers - typeof";return n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u},n(o)}function e(o,u){if(!(o instanceof u))throw new TypeError("Cannot call a class as a function")}function t(o,u){for(var l=0;l<u.length;l++){var c=u[l];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(o,i(c.key),c)}}function r(o,u,l){return u&&t(o.prototype,u),Object.defineProperty(o,"prototype",{writable:!1}),o}function i(o){var u=a(o,"string");return n(u)=="symbol"?u:u+""}function a(o,u){if(n(o)!="object"||!o)return o;var l=o[Symbol.toPrimitive];if(l!==void 0){var c=l.call(o,u);if(n(c)!="object")return c;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}var s=Kf();return ls=(function(){function o(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e(this,o),this.loggers=new Map,this.options=u}return r(o,[{key:"add",value:function(l,c){var h=this;if(!this.loggers.has(l)){c=Object.assign({},c||this.options);var f=c.transports||this.options.transports;f?c.transports=Array.isArray(f)?f.slice():[f]:c.transports=[];var _=s(c);_.on("close",function(){return h._delete(l)}),this.loggers.set(l,_)}return this.loggers.get(l)}},{key:"get",value:function(l,c){return this.add(l,c)}},{key:"has",value:function(l){return!!this.loggers.has(l)}},{key:"close",value:function(l){var c=this;if(l)return this._removeLogger(l);this.loggers.forEach(function(h,f){return c._removeLogger(f)})}},{key:"_removeLogger",value:function(l){if(this.loggers.has(l)){var c=this.loggers.get(l);c.close(),this._delete(l)}}},{key:"_delete",value:function(l){this.loggers.delete(l)}}])})(),ls}var Jl;function em(){return Jl||(Jl=1,(function(n){var e=Pf(),t=xf(),r=t.warn;n.version=hp.version,n.transports=qp(),n.config=co(),n.addColors=e.levels,n.format=e.format,n.createLogger=Kf(),n.Logger=ho(),n.ExceptionHandler=Wf(),n.RejectionHandler=Jf(),n.Container=Xp(),n.Transport=hn(),n.loggers=new n.Container;var i=n.createLogger();Object.keys(n.config.npm.levels).concat(["log","query","stream","add","remove","clear","profile","startTimer","handleExceptions","unhandleExceptions","handleRejections","unhandleRejections","configure","child"]).forEach(function(a){return n[a]=function(){return i[a].apply(i,arguments)}}),Object.defineProperty(n,"level",{get:function(){return i.level},set:function(s){i.level=s}}),Object.defineProperty(n,"exceptions",{get:function(){return i.exceptions}}),Object.defineProperty(n,"rejections",{get:function(){return i.rejections}}),["exitOnError"].forEach(function(a){Object.defineProperty(n,a,{get:function(){return i[a]},set:function(o){i[a]=o}})}),Object.defineProperty(n,"default",{get:function(){return{exceptionHandlers:i.exceptionHandlers,rejectionHandlers:i.rejectionHandlers,transports:i.transports}}}),r.deprecated(n,"setLevels"),r.forFunctions(n,"useFormat",["cli"]),r.forProperties(n,"useFormat",["padLevels","stripColors"]),r.forFunctions(n,"deprecated",["addRewriter","addFilter","clone","extend"]),r.forProperties(n,"deprecated",["emitErrs","levelLength"])})(Hi)),Hi}var zr=em(),Pe={};async function Yf(){if(typeof process<"u")try{const n=await Me(()=>Promise.resolve().then(()=>Xr),void 0),e=await Me(()=>Promise.resolve().then(()=>Df),void 0);return{fs:n.default,path:e.default}}catch{return{fs:null,path:null}}return{fs:null,path:null}}le(Yf,"getNodeModules");var{combine:Kl,timestamp:Yl,label:Ql,printf:po,colorize:Zl,splat:Xl}=zr.format,Is="mcp-use";function ci(){try{if(typeof navigator<"u"&&navigator.userAgent?.includes("Cloudflare-Workers")||typeof globalThis.EdgeRuntime<"u"||typeof globalThis.Deno<"u")return!1;const n=typeof process<"u"&&!0&&typeof __dirname<"u",e=typeof zr.createLogger=="function";return n&&e}catch{return!1}}le(ci,"isNodeJSEnvironment");var Kt,tm=(Kt=class{_level;name;constructor(e=Is,t="info"){this.name=e,this._level=t}shouldLog(e){const t=["error","warn","info","http","verbose","debug","silly"],r=t.indexOf(this._level);return t.indexOf(e)<=r}formatMessage(e,t){return`${new Date().toLocaleTimeString("en-US",{hour12:!1})} [${this.name}] ${e}: ${t}`}error(e){this.shouldLog("error")&&console.error(this.formatMessage("error",e))}warn(e){this.shouldLog("warn")&&console.warn(this.formatMessage("warn",e))}info(e){this.shouldLog("info")&&console.info(this.formatMessage("info",e))}debug(e){this.shouldLog("debug")&&console.debug(this.formatMessage("debug",e))}http(e){this.shouldLog("http")&&console.log(this.formatMessage("http",e))}verbose(e){this.shouldLog("verbose")&&console.log(this.formatMessage("verbose",e))}silly(e){this.shouldLog("silly")&&console.log(this.formatMessage("silly",e))}get level(){return this._level}set level(e){this._level=e}},le(Kt,"SimpleConsoleLogger"),Kt);function ri(n){switch((typeof process<"u"&&Pe?n:void 0)?.trim()){case"2":return"debug";case"1":return"info";default:return"info"}}le(ri,"resolveLevel");var ec=po(({level:n,message:e,label:t,timestamp:r})=>`${r} [${t}] ${n}: ${e}`),rm=po(({level:n,message:e,label:t,timestamp:r})=>`${r} [${t}] ${n.toUpperCase()}: ${e}`),nm=po(({level:n,message:e,label:t,timestamp:r})=>`${r} [${t}] ${n.toUpperCase()}: ${e}`),ht,fi=(ht=class{static get(e=Is){if(!ci()){if(!this.simpleInstances[e]){const t=typeof process<"u"&&Pe?.DEBUG||void 0;this.simpleInstances[e]=new tm(e,ri(t))}return this.simpleInstances[e]}return this.instances[e]||(this.instances[e]=zr.createLogger({level:ri(Pe.DEBUG),format:Kl(Zl(),Xl(),Ql({label:e}),Yl({format:"HH:mm:ss"}),this.getFormatter()),transports:[]})),this.instances[e]}static getFormatter(){switch(this.currentFormat){case"minimal":return ec;case"detailed":return rm;case"emoji":return nm;default:return ec}}static async configure(e={}){const{level:t,console:r=!0,file:i,format:a="minimal"}=e,s=typeof process<"u"&&Pe?.DEBUG||void 0,o=t??ri(s);this.currentFormat=a;const u=this.get();u.level=o;const l=u;if(!ci()){Object.values(this.simpleInstances).forEach(c=>{c.level=o});return}if(l.clear(),r&&l.add(new zr.transports.Console),i){const{fs:c,path:h}=await Yf();if(c&&h){const f=h.dirname(h.resolve(i));c.existsSync(f)||c.mkdirSync(f,{recursive:!0}),l.add(new zr.transports.File({filename:i}))}}Object.values(this.instances).forEach(c=>{c&&"format"in c&&(c.level=o,c.format=Kl(Zl(),Xl(),Ql({label:Is}),Yl({format:"HH:mm:ss"}),this.getFormatter()))})}static setDebug(e){let t;e===2||e===!0?t="debug":t="info",Object.values(this.simpleInstances).forEach(r=>{r.level=t}),Object.values(this.instances).forEach(r=>{r&&(r.level=t)}),typeof process<"u"&&Pe&&(Pe.DEBUG=e?e===!0?"2":String(e):"0")}static setFormat(e){this.currentFormat=e,this.configure({format:e})}},le(ht,"Logger"),jr(ht,"instances",{}),jr(ht,"simpleInstances",{}),jr(ht,"currentFormat","minimal"),ht);ci()?fi.configure():fi.configure({console:!0});var A=fi.get(),im=Pe.MCP_USE_LANGFUSE?.toLowerCase()==="false",en={handler:null,client:null,initPromise:null};async function mo(n,e,t,r){try{const i=await Me(()=>import("./index-D_cnxdEU.js"),__vite__mapDeps([0,1,2,3,4,5,6])).catch(()=>null);if(!i){A.debug("Langfuse package not installed - tracing disabled. Install with: npm install langfuse-langchain");return}const{CallbackHandler:a}=i,u=class u extends a{agentId;metadata;metadataProvider;tagsProvider;verbose;constructor(c,h,f,_,p){super(c),this.agentId=h,this.metadata=f,this.metadataProvider=_,this.tagsProvider=p,this.verbose=c?.verbose??!1}async handleChainStart(c,h,f,_,p,b,w,m){A.debug("Langfuse: Chain start intercepted");const g=this.getCustomTags(),v=this.getMetadata(),E=[...p||[],...g],O={...b||{},...v};return this.verbose&&(A.debug(`Langfuse: Chain start with custom tags: ${JSON.stringify(E)}`),A.debug(`Langfuse: Chain start with metadata: ${JSON.stringify(O)}`)),super.handleChainStart(c,h,f,_,E,O,w,m)}getCustomTags(){const c=[],h=this.getEnvironmentTag();if(h&&c.push(`env:${h}`),this.agentId&&c.push(`agent_id:${this.agentId}`),this.tagsProvider){const f=this.tagsProvider();f&&f.length>0&&c.push(...f)}return c}getMetadata(){const c={},h=this.getEnvironmentTag();if(h&&(c.env=h),this.agentId&&(c.agent_id=this.agentId),this.metadata&&Object.assign(c,this.metadata),this.metadataProvider){const f=this.metadataProvider();f&&Object.assign(c,f)}return c}getEnvironmentTag(){const c=Pe.MCP_USE_AGENT_ENV;if(!c)return"unknown";const h=c.toLowerCase();return h==="local"||h==="development"?"local":h==="production"||h==="prod"?"production":h==="staging"||h==="stage"?"staging":h==="hosted"||h==="cloud"?"hosted":h.replace(/[^a-z0-9_-]/g,"_")}async handleLLMStart(...c){return A.debug("Langfuse: LLM start intercepted"),this.verbose&&A.debug(`Langfuse: LLM start args: ${JSON.stringify(c)}`),super.handleLLMStart(...c)}async handleToolStart(...c){return A.debug("Langfuse: Tool start intercepted"),this.verbose&&A.debug(`Langfuse: Tool start args: ${JSON.stringify(c)}`),super.handleToolStart(...c)}async handleRetrieverStart(...c){return A.debug("Langfuse: Retriever start intercepted"),this.verbose&&A.debug(`Langfuse: Retriever start args: ${JSON.stringify(c)}`),super.handleRetrieverStart(...c)}async handleAgentAction(...c){return A.debug("Langfuse: Agent action intercepted"),this.verbose&&A.debug(`Langfuse: Agent action args: ${JSON.stringify(c)}`),super.handleAgentAction(...c)}async handleAgentEnd(...c){return A.debug("Langfuse: Agent end intercepted"),this.verbose&&A.debug(`Langfuse: Agent end args: ${JSON.stringify(c)}`),super.handleAgentEnd(...c)}};le(u,"LoggingCallbackHandler");let s=u;const o={publicKey:Pe.LANGFUSE_PUBLIC_KEY,secretKey:Pe.LANGFUSE_SECRET_KEY,baseUrl:Pe.LANGFUSE_HOST||Pe.LANGFUSE_BASEURL||"https://cloud.langfuse.com",flushAt:Number.parseInt(Pe.LANGFUSE_FLUSH_AT||"15"),flushInterval:Number.parseInt(Pe.LANGFUSE_FLUSH_INTERVAL||"10000"),release:Pe.LANGFUSE_RELEASE,requestTimeout:Number.parseInt(Pe.LANGFUSE_REQUEST_TIMEOUT||"10000"),enabled:Pe.LANGFUSE_ENABLED!=="false"};en.handler=new s(o,n,e,t,r),A.debug("Langfuse observability initialized successfully with logging enabled");try{const l=await Me(()=>import("./index-thIEMA5R.js"),__vite__mapDeps([1,2,3,4,5,6])).catch(()=>null);if(l){const{Langfuse:c}=l;en.client=new c({publicKey:Pe.LANGFUSE_PUBLIC_KEY,secretKey:Pe.LANGFUSE_SECRET_KEY,baseUrl:Pe.LANGFUSE_HOST||"https://cloud.langfuse.com"}),A.debug("Langfuse client initialized")}}catch(l){A.debug(`Langfuse client initialization failed: ${l}`)}}catch(i){A.debug(`Langfuse initialization error: ${i}`)}}le(mo,"initializeLangfuse");im?A.debug("Langfuse tracing disabled via MCP_USE_LANGFUSE environment variable"):!Pe.LANGFUSE_PUBLIC_KEY||!Pe.LANGFUSE_SECRET_KEY?A.debug("Langfuse API keys not found - tracing disabled. Set LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY to enable"):en.initPromise=mo();var am=le(()=>en.handler,"langfuseHandler"),sm=le(()=>en.initPromise,"langfuseInitPromise");class om{static convert(e){return this.parseSchema(e)}static matchesCondition(e,t){if(!t.properties)return!0;if(typeof e!="object"||e===null||Array.isArray(e))return!1;const r=e;for(const[i,a]of Object.entries(t.properties)){if(!(i in r)){if("const"in a)return!1;continue}const s=r[i];if("const"in a&&s!==a.const||"minimum"in a&&typeof s=="number"&&s<a.minimum||"maximum"in a&&typeof s=="number"&&s>a.maximum)return!1}return!0}static validateConditionalSchema(e,t,r){this.validateRequiredProperties(e,t,r),this.validatePropertyPatterns(e,t,r),this.validateNestedConditions(e,t,r)}static validateRequiredProperties(e,t,r){if(t.required){if(typeof e!="object"||e===null){for(const i of t.required)r.addIssue({code:Bi.custom,message:`Required property '${i}' is missing`,path:[i]});return}for(const i of t.required)i in e||r.addIssue({code:Bi.custom,message:`Required property '${i}' is missing`,path:[i]})}}static validatePropertyPatterns(e,t,r){if(!t.properties||typeof e!="object"||e===null||Array.isArray(e))return;const i=e;for(const[a,s]of Object.entries(t.properties)){if(!(a in i))continue;const o=i[a];s.pattern&&typeof o=="string"&&(new RegExp(s.pattern).test(o)||r.addIssue({code:Bi.custom,message:`String '${o}' does not match pattern '${s.pattern}'`,path:[a]}))}}static validateNestedConditions(e,t,r){if(!t.if||!t.then)return;this.matchesCondition(e,t.if)?this.validateConditionalSchema(e,t.then,r):t.else&&this.validateConditionalSchema(e,t.else,r)}static parseSchema(e){return Array.isArray(e.type)?this.handleTypeArray(e):e.oneOf||e.anyOf||e.allOf?this.parseCombinator(e):e.if&&e.then?this.parseObject(e):e.properties&&(!e.type||e.type==="object")?this.parseObject(e):this.handleSingleType(e)}static handleTypeArray(e){if(!Array.isArray(e.type))throw new Error("Expected schema.type to be an array");return e.type.includes("null")?this.handleNullableType(e):this.createUnionFromTypes(e.type,e)}static handleNullableType(e){if(!Array.isArray(e.type))throw new Error("Expected schema.type to be an array");const t={...e};return t.type=e.type.filter(i=>i!=="null"),t.type.length===1?this.handleSingleType({...e,type:t.type[0]}).nullable():this.parseSchema(t).nullable()}static createUnionFromTypes(e,t){const r=e.map(i=>{const a={...t,type:i};return this.parseSchema(a)});return qi(r)}static handleSingleType(e){if(e.type===void 0)return e.oneOf||e.anyOf||e.allOf?this.parseCombinator(e):e.properties?this.parseObject(e):pt();switch(e.type){case"string":return this.parseString(e);case"number":case"integer":return this.parseNumberSchema(e);case"boolean":return sh();case"array":return this.parseArray(e);case"object":return this.parseObject(e);default:throw new Error("Unsupported schema type")}}static parseNumberSchema(e){let t=oh(),r=t;return r=this.applyNumberBounds(t,e),r=this.applyNumberMultipleOf(t,e),r=this.applyNumberEnum(t,e),r=this.applyIntegerConstraint(t,e),r}static applyNumberBounds(e,t){let r=e;return t.minimum!==void 0&&(r=t.exclusiveMinimum?r.gt(t.minimum):r.gte(t.minimum)),t.maximum!==void 0&&(r=t.exclusiveMaximum?r.lt(t.maximum):r.lte(t.maximum)),r}static applyNumberMultipleOf(e,t){return t.multipleOf===void 0?e:e.refine(r=>r%t.multipleOf===0,{message:`Number must be a multiple of ${t.multipleOf}`})}static applyNumberEnum(e,t){if(!t.enum)return e;const r=t.enum.filter(i=>typeof i=="number");return r.length===0?e:e.refine(i=>r.includes(i),{message:`Number must be one of: ${r.join(", ")}`})}static applyIntegerConstraint(e,t){return t.type!=="integer"?e:e.refine(r=>Number.isInteger(r),{message:"Number must be an integer"})}static parseString(e){let t=cn(),r=t;return e.format?this.applyStringFormat(t,e):(r=this.applyStringPattern(t,e),r=this.applyStringLength(t,e),r=this.applyStringEnum(t,e),r)}static applyStringFormat(e,t){if(!t.format)return e;switch(t.format){case"email":return e.email();case"date-time":return e.datetime();case"uri":return e.url();case"uuid":return e.uuid();case"date":return e.date();default:return e}}static applyStringPattern(e,t){if(!t.pattern)return e;const r=new RegExp(t.pattern);return e.regex(r,{message:`String must match pattern: ${t.pattern}`})}static applyStringLength(e,t){let r=e;return t.minLength!==void 0&&(e=e.min(t.minLength)),t.maxLength!==void 0&&(e=e.max(t.maxLength)),r}static applyStringEnum(e,t){return t.enum?e.refine(r=>t.enum?.includes(r),{message:`Value must be one of: ${t.enum?.join(", ")}`}):e}static parseArray(e){if(Array.isArray(e.items)){const a=e.items.map(s=>this.parseSchema(s));return qi(a)}const t=e.items?this.parseSchema(e.items):pt();let r=uh(t),i=r;return i=this.applyArrayConstraints(r,e),i}static applyArrayConstraints(e,t){return t.minItems!==void 0&&(e=e.min(t.minItems)),t.maxItems!==void 0&&(e=e.max(t.maxItems)),t.uniqueItems?e.refine(r=>new Set(r).size===r.length,{message:"Array items must be unique"}):e}static parseObject(e){if(e.if&&e.then)return this.parseConditional(e);const t={};return this.processObjectProperties(e,t),this.processAdditionalProperties(e,lt(t))}static processObjectProperties(e,t){const r=new Set(e.required||[]);if(e.properties)for(const[i,a]of Object.entries(e.properties)){const s=this.parseSchema(a);t[i]=r.has(i)?s:s.optional()}}static processAdditionalProperties(e,t){if(e.additionalProperties===!0)return t.passthrough();if(e.additionalProperties&&typeof e.additionalProperties=="object"){const r=this.parseSchema(e.additionalProperties);return t.catchall(r)}else return t.strict()}static parseConditional(e){const t=this.createBaseObjectSchema(e),r=e.if,i=e.then,a=e.else;return t.superRefine((s,o)=>{const u=this.applyDefaultValues(s,e);this.matchesCondition(u,r)?this.validateConditionalSchema(u,i,o):a&&this.validateConditionalSchema(u,a,o)})}static createBaseObjectSchema(e){const t={},r=new Set(e.required||[]);for(const[a,s]of Object.entries(e.properties||{})){const o=this.parseSchema(s);t[a]=r.has(a)?o:o.optional()}const i=lt(t);return this.processAdditionalProperties(e,i)}static applyDefaultValues(e,t){if(typeof e!="object"||e===null||Array.isArray(e))return e;const i={...e};if(!t.properties)return i;for(const[a,s]of Object.entries(t.properties))!(a in i)&&"default"in s&&(i[a]=s.default);return i}static parseCombinator(e){if(e.oneOf)return this.parseOneOf(e.oneOf);if(e.anyOf)return this.parseAnyOf(e.anyOf);if(e.allOf)return this.parseAllOf(e.allOf);throw new Error("Unsupported schema type")}static parseOneOf(e){return this.createUnionFromSchemas(e)}static parseAnyOf(e){return this.createUnionFromSchemas(e)}static createUnionFromSchemas(e){if(e.length===0)return pt();if(e.length===1)return this.parseSchema(e[0]);const t=[];for(const r of e)r.type==="null"?t.push(lh()):t.push(this.parseSchema(r));return t.length>=2?qi(t):t.length===1?t[0]:pt()}static parseAllOf(e){if(e.length===0)return pt();if(e.length===1)return this.parseSchema(e[0]);const t=e.reduce((r,i)=>this.mergeSchemas(r,i));return this.parseSchema(t)}static mergeSchemas(e,t){const r={...e,...t};if(e.properties&&t.properties){const i={...e.properties,...t.properties};r.properties=i}if(e.required&&t.required){const i=[...new Set([...e.required,...t.required])];r.required=i}return r}}function Ze(n){return encodeURI(um(n))}function um(n){return n.replace(/~/g,"~0").replace(/\//g,"~1")}const lm={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},cm={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},fm={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};let dm=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");function Ur(n,e=Object.create(null),t=dm,r=""){if(n&&typeof n=="object"&&!Array.isArray(n)){const a=n.$id||n.id;if(a){const s=new URL(a,t.href);s.hash.length>1?e[s.href]=n:(s.hash="",r===""?t=s:Ur(n,e,t))}}else if(n!==!0&&n!==!1)return e;const i=t.href+(r?"#"+r:"");if(e[i]!==void 0)throw new Error(`Duplicate schema URI "${i}".`);if(e[i]=n,n===!0||n===!1)return e;if(n.__absolute_uri__===void 0&&Object.defineProperty(n,"__absolute_uri__",{enumerable:!1,value:i}),n.$ref&&n.__absolute_ref__===void 0){const a=new URL(n.$ref,t.href);a.hash=a.hash,Object.defineProperty(n,"__absolute_ref__",{enumerable:!1,value:a.href})}if(n.$recursiveRef&&n.__absolute_recursive_ref__===void 0){const a=new URL(n.$recursiveRef,t.href);a.hash=a.hash,Object.defineProperty(n,"__absolute_recursive_ref__",{enumerable:!1,value:a.href})}if(n.$anchor){const a=new URL("#"+n.$anchor,t.href);e[a.href]=n}for(let a in n){if(fm[a])continue;const s=`${r}/${Ze(a)}`,o=n[a];if(Array.isArray(o)){if(lm[a]){const u=o.length;for(let l=0;l<u;l++)Ur(o[l],e,t,`${s}/${l}`)}}else if(cm[a])for(let u in o)Ur(o[u],e,t,`${s}/${Ze(u)}`);else Ur(o,e,t,s)}return e}const hm=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,pm=[0,31,28,31,30,31,30,31,31,30,31,30,31],mm=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,gm=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ym=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,bm=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,_m=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,vm=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,wm=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Em=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Sm=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Om=n=>{if(n[0]==='"')return!1;const[e,t,...r]=n.split("@");return!e||!t||r.length!==0||e.length>64||t.length>253||e[0]==="."||e.endsWith(".")||e.includes("..")||!/^[a-z0-9.-]+$/i.test(t)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(e)?!1:t.split(".").every(i=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(i))},Tm=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Pm=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,xm=n=>n.length>1&&n.length<80&&(/^P\d+([.,]\d+)?W$/.test(n)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(n)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(n));function at(n){return n.test.bind(n)}const tc={date:Qf,time:Zf.bind(void 0,!1),"date-time":Im,duration:xm,uri:jm,"uri-reference":at(ym),"uri-template":at(bm),url:at(_m),email:Om,hostname:at(gm),ipv4:at(Tm),ipv6:at(Pm),regex:km,uuid:at(vm),"json-pointer":at(wm),"json-pointer-uri-fragment":at(Em),"relative-json-pointer":at(Sm)};function Am(n){return n%4===0&&(n%100!==0||n%400===0)}function Qf(n){const e=n.match(hm);if(!e)return!1;const t=+e[1],r=+e[2],i=+e[3];return r>=1&&r<=12&&i>=1&&i<=(r==2&&Am(t)?29:pm[r])}function Zf(n,e){const t=e.match(mm);if(!t)return!1;const r=+t[1],i=+t[2],a=+t[3],s=!!t[5];return(r<=23&&i<=59&&a<=59||r==23&&i==59&&a==60)&&(!n||s)}const Rm=/t|\s/i;function Im(n){const e=n.split(Rm);return e.length==2&&Qf(e[0])&&Zf(!0,e[1])}const Cm=/\/|:/,$m=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function jm(n){return Cm.test(n)&&$m.test(n)}const Mm=/[^\\]\\Z/;function km(n){if(Mm.test(n))return!1;try{return new RegExp(n,"u"),!0}catch{return!1}}function Nm(n){let e=0,t=n.length,r=0,i;for(;r<t;)e++,i=n.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=n.charCodeAt(r),(i&64512)==56320&&r++);return e}function Se(n,e,t="2019-09",r=Ur(e),i=!0,a=null,s="#",o="#",u=Object.create(null)){if(e===!0)return{valid:!0,errors:[]};if(e===!1)return{valid:!1,errors:[{instanceLocation:s,keyword:"false",keywordLocation:s,error:"False boolean schema."}]};const l=typeof n;let c;switch(l){case"boolean":case"number":case"string":c=l;break;case"object":n===null?c="null":Array.isArray(n)?c="array":c="object";break;default:throw new Error(`Instances of "${l}" type are not supported.`)}const{$ref:h,$recursiveRef:f,$recursiveAnchor:_,type:p,const:b,enum:w,required:m,not:g,anyOf:v,allOf:E,oneOf:O,if:C,then:R,else:I,format:$,properties:M,patternProperties:z,additionalProperties:B,unevaluatedProperties:F,minProperties:Y,maxProperties:Z,propertyNames:j,dependentRequired:D,dependentSchemas:G,dependencies:U,prefixItems:H,items:J,additionalItems:X,unevaluatedItems:ae,contains:Q,minContains:ee,maxContains:N,minItems:k,maxItems:V,uniqueItems:se,minimum:oe,maximum:T,exclusiveMinimum:x,exclusiveMaximum:W,multipleOf:re,minLength:_e,maxLength:he,pattern:ye,__absolute_ref__:ke,__absolute_recursive_ref__:Et}=e,ie=[];if(_===!0&&a===null&&(a=e),f==="#"){const ce=a===null?r[Et]:a,ue=`${o}/$recursiveRef`,de=Se(n,a===null?e:a,t,r,i,ce,s,ue,u);de.valid||ie.push({instanceLocation:s,keyword:"$recursiveRef",keywordLocation:ue,error:"A subschema had errors."},...de.errors)}if(h!==void 0){const ue=r[ke||h];if(ue===void 0){let te=`Unresolved $ref "${h}".`;throw ke&&ke!==h&&(te+=` Absolute URI "${ke}".`),te+=`
|
|
44
44
|
Known schemas:
|
|
45
45
|
- ${Object.keys(r).join(`
|
|
46
46
|
- `)}`,new Error(te)}const de=`${o}/$ref`,ne=Se(n,ue,t,r,i,a,s,de,u);if(ne.valid||ie.push({instanceLocation:s,keyword:"$ref",keywordLocation:de,error:"A subschema had errors."},...ne.errors),t==="4"||t==="7")return{valid:ie.length===0,errors:ie}}if(Array.isArray(p)){let ce=p.length,ue=!1;for(let de=0;de<ce;de++)if(c===p[de]||p[de]==="integer"&&c==="number"&&n%1===0&&n===n){ue=!0;break}ue||ie.push({instanceLocation:s,keyword:"type",keywordLocation:`${o}/type`,error:`Instance type "${c}" is invalid. Expected "${p.join('", "')}".`})}else p==="integer"?(c!=="number"||n%1||n!==n)&&ie.push({instanceLocation:s,keyword:"type",keywordLocation:`${o}/type`,error:`Instance type "${c}" is invalid. Expected "${p}".`}):p!==void 0&&c!==p&&ie.push({instanceLocation:s,keyword:"type",keywordLocation:`${o}/type`,error:`Instance type "${c}" is invalid. Expected "${p}".`});if(b!==void 0&&(c==="object"||c==="array"?zi(n,b)||ie.push({instanceLocation:s,keyword:"const",keywordLocation:`${o}/const`,error:`Instance does not match ${JSON.stringify(b)}.`}):n!==b&&ie.push({instanceLocation:s,keyword:"const",keywordLocation:`${o}/const`,error:`Instance does not match ${JSON.stringify(b)}.`})),w!==void 0&&(c==="object"||c==="array"?w.some(ce=>zi(n,ce))||ie.push({instanceLocation:s,keyword:"enum",keywordLocation:`${o}/enum`,error:`Instance does not match any of ${JSON.stringify(w)}.`}):w.some(ce=>n===ce)||ie.push({instanceLocation:s,keyword:"enum",keywordLocation:`${o}/enum`,error:`Instance does not match any of ${JSON.stringify(w)}.`})),g!==void 0){const ce=`${o}/not`;Se(n,g,t,r,i,a,s,ce).valid&&ie.push({instanceLocation:s,keyword:"not",keywordLocation:ce,error:'Instance matched "not" schema.'})}let Ye=[];if(v!==void 0){const ce=`${o}/anyOf`,ue=ie.length;let de=!1;for(let ne=0;ne<v.length;ne++){const te=v[ne],S=Object.create(u),d=Se(n,te,t,r,i,_===!0?a:null,s,`${ce}/${ne}`,S);ie.push(...d.errors),de=de||d.valid,d.valid&&Ye.push(S)}de?ie.length=ue:ie.splice(ue,0,{instanceLocation:s,keyword:"anyOf",keywordLocation:ce,error:"Instance does not match any subschemas."})}if(E!==void 0){const ce=`${o}/allOf`,ue=ie.length;let de=!0;for(let ne=0;ne<E.length;ne++){const te=E[ne],S=Object.create(u),d=Se(n,te,t,r,i,_===!0?a:null,s,`${ce}/${ne}`,S);ie.push(...d.errors),de=de&&d.valid,d.valid&&Ye.push(S)}de?ie.length=ue:ie.splice(ue,0,{instanceLocation:s,keyword:"allOf",keywordLocation:ce,error:"Instance does not match every subschema."})}if(O!==void 0){const ce=`${o}/oneOf`,ue=ie.length,de=O.filter((ne,te)=>{const S=Object.create(u),d=Se(n,ne,t,r,i,_===!0?a:null,s,`${ce}/${te}`,S);return ie.push(...d.errors),d.valid&&Ye.push(S),d.valid}).length;de===1?ie.length=ue:ie.splice(ue,0,{instanceLocation:s,keyword:"oneOf",keywordLocation:ce,error:`Instance does not match exactly one subschema (${de} matches).`})}if((c==="object"||c==="array")&&Object.assign(u,...Ye),C!==void 0){const ce=`${o}/if`;if(Se(n,C,t,r,i,a,s,ce,u).valid){if(R!==void 0){const de=Se(n,R,t,r,i,a,s,`${o}/then`,u);de.valid||ie.push({instanceLocation:s,keyword:"if",keywordLocation:ce,error:'Instance does not match "then" schema.'},...de.errors)}}else if(I!==void 0){const de=Se(n,I,t,r,i,a,s,`${o}/else`,u);de.valid||ie.push({instanceLocation:s,keyword:"if",keywordLocation:ce,error:'Instance does not match "else" schema.'},...de.errors)}}if(c==="object"){if(m!==void 0)for(const ne of m)ne in n||ie.push({instanceLocation:s,keyword:"required",keywordLocation:`${o}/required`,error:`Instance does not have required property "${ne}".`});const ce=Object.keys(n);if(Y!==void 0&&ce.length<Y&&ie.push({instanceLocation:s,keyword:"minProperties",keywordLocation:`${o}/minProperties`,error:`Instance does not have at least ${Y} properties.`}),Z!==void 0&&ce.length>Z&&ie.push({instanceLocation:s,keyword:"maxProperties",keywordLocation:`${o}/maxProperties`,error:`Instance does not have at least ${Z} properties.`}),j!==void 0){const ne=`${o}/propertyNames`;for(const te in n){const S=`${s}/${Ze(te)}`,d=Se(te,j,t,r,i,a,S,ne);d.valid||ie.push({instanceLocation:s,keyword:"propertyNames",keywordLocation:ne,error:`Property name "${te}" does not match schema.`},...d.errors)}}if(D!==void 0){const ne=`${o}/dependantRequired`;for(const te in D)if(te in n){const S=D[te];for(const d of S)d in n||ie.push({instanceLocation:s,keyword:"dependentRequired",keywordLocation:ne,error:`Instance has "${te}" but does not have "${d}".`})}}if(G!==void 0)for(const ne in G){const te=`${o}/dependentSchemas`;if(ne in n){const S=Se(n,G[ne],t,r,i,a,s,`${te}/${Ze(ne)}`,u);S.valid||ie.push({instanceLocation:s,keyword:"dependentSchemas",keywordLocation:te,error:`Instance has "${ne}" but does not match dependant schema.`},...S.errors)}}if(U!==void 0){const ne=`${o}/dependencies`;for(const te in U)if(te in n){const S=U[te];if(Array.isArray(S))for(const d of S)d in n||ie.push({instanceLocation:s,keyword:"dependencies",keywordLocation:ne,error:`Instance has "${te}" but does not have "${d}".`});else{const d=Se(n,S,t,r,i,a,s,`${ne}/${Ze(te)}`);d.valid||ie.push({instanceLocation:s,keyword:"dependencies",keywordLocation:ne,error:`Instance has "${te}" but does not match dependant schema.`},...d.errors)}}}const ue=Object.create(null);let de=!1;if(M!==void 0){const ne=`${o}/properties`;for(const te in M){if(!(te in n))continue;const S=`${s}/${Ze(te)}`,d=Se(n[te],M[te],t,r,i,a,S,`${ne}/${Ze(te)}`);if(d.valid)u[te]=ue[te]=!0;else if(de=i,ie.push({instanceLocation:s,keyword:"properties",keywordLocation:ne,error:`Property "${te}" does not match schema.`},...d.errors),de)break}}if(!de&&z!==void 0){const ne=`${o}/patternProperties`;for(const te in z){const S=new RegExp(te,"u"),d=z[te];for(const y in n){if(!S.test(y))continue;const P=`${s}/${Ze(y)}`,L=Se(n[y],d,t,r,i,a,P,`${ne}/${Ze(te)}`);L.valid?u[y]=ue[y]=!0:(de=i,ie.push({instanceLocation:s,keyword:"patternProperties",keywordLocation:ne,error:`Property "${y}" matches pattern "${te}" but does not match associated schema.`},...L.errors))}}}if(!de&&B!==void 0){const ne=`${o}/additionalProperties`;for(const te in n){if(ue[te])continue;const S=`${s}/${Ze(te)}`,d=Se(n[te],B,t,r,i,a,S,ne);d.valid?u[te]=!0:(de=i,ie.push({instanceLocation:s,keyword:"additionalProperties",keywordLocation:ne,error:`Property "${te}" does not match additional properties schema.`},...d.errors))}}else if(!de&&F!==void 0){const ne=`${o}/unevaluatedProperties`;for(const te in n)if(!u[te]){const S=`${s}/${Ze(te)}`,d=Se(n[te],F,t,r,i,a,S,ne);d.valid?u[te]=!0:ie.push({instanceLocation:s,keyword:"unevaluatedProperties",keywordLocation:ne,error:`Property "${te}" does not match unevaluated properties schema.`},...d.errors)}}}else if(c==="array"){V!==void 0&&n.length>V&&ie.push({instanceLocation:s,keyword:"maxItems",keywordLocation:`${o}/maxItems`,error:`Array has too many items (${n.length} > ${V}).`}),k!==void 0&&n.length<k&&ie.push({instanceLocation:s,keyword:"minItems",keywordLocation:`${o}/minItems`,error:`Array has too few items (${n.length} < ${k}).`});const ce=n.length;let ue=0,de=!1;if(H!==void 0){const ne=`${o}/prefixItems`,te=Math.min(H.length,ce);for(;ue<te;ue++){const S=Se(n[ue],H[ue],t,r,i,a,`${s}/${ue}`,`${ne}/${ue}`);if(u[ue]=!0,!S.valid&&(de=i,ie.push({instanceLocation:s,keyword:"prefixItems",keywordLocation:ne,error:"Items did not match schema."},...S.errors),de))break}}if(J!==void 0){const ne=`${o}/items`;if(Array.isArray(J)){const te=Math.min(J.length,ce);for(;ue<te;ue++){const S=Se(n[ue],J[ue],t,r,i,a,`${s}/${ue}`,`${ne}/${ue}`);if(u[ue]=!0,!S.valid&&(de=i,ie.push({instanceLocation:s,keyword:"items",keywordLocation:ne,error:"Items did not match schema."},...S.errors),de))break}}else for(;ue<ce;ue++){const te=Se(n[ue],J,t,r,i,a,`${s}/${ue}`,ne);if(u[ue]=!0,!te.valid&&(de=i,ie.push({instanceLocation:s,keyword:"items",keywordLocation:ne,error:"Items did not match schema."},...te.errors),de))break}if(!de&&X!==void 0){const te=`${o}/additionalItems`;for(;ue<ce;ue++){const S=Se(n[ue],X,t,r,i,a,`${s}/${ue}`,te);u[ue]=!0,S.valid||(de=i,ie.push({instanceLocation:s,keyword:"additionalItems",keywordLocation:te,error:"Items did not match additional items schema."},...S.errors))}}}if(Q!==void 0)if(ce===0&&ee===void 0)ie.push({instanceLocation:s,keyword:"contains",keywordLocation:`${o}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(ee!==void 0&&ce<ee)ie.push({instanceLocation:s,keyword:"minContains",keywordLocation:`${o}/minContains`,error:`Array has less items (${ce}) than minContains (${ee}).`});else{const ne=`${o}/contains`,te=ie.length;let S=0;for(let d=0;d<ce;d++){const y=Se(n[d],Q,t,r,i,a,`${s}/${d}`,ne);y.valid?(u[d]=!0,S++):ie.push(...y.errors)}S>=(ee||0)&&(ie.length=te),ee===void 0&&N===void 0&&S===0?ie.splice(te,0,{instanceLocation:s,keyword:"contains",keywordLocation:ne,error:"Array does not contain item matching schema."}):ee!==void 0&&S<ee?ie.push({instanceLocation:s,keyword:"minContains",keywordLocation:`${o}/minContains`,error:`Array must contain at least ${ee} items matching schema. Only ${S} items were found.`}):N!==void 0&&S>N&&ie.push({instanceLocation:s,keyword:"maxContains",keywordLocation:`${o}/maxContains`,error:`Array may contain at most ${N} items matching schema. ${S} items were found.`})}if(!de&&ae!==void 0){const ne=`${o}/unevaluatedItems`;for(ue;ue<ce;ue++){if(u[ue])continue;const te=Se(n[ue],ae,t,r,i,a,`${s}/${ue}`,ne);u[ue]=!0,te.valid||ie.push({instanceLocation:s,keyword:"unevaluatedItems",keywordLocation:ne,error:"Items did not match unevaluated items schema."},...te.errors)}}if(se)for(let ne=0;ne<ce;ne++){const te=n[ne],S=typeof te=="object"&&te!==null;for(let d=0;d<ce;d++){if(ne===d)continue;const y=n[d];(te===y||S&&(typeof y=="object"&&y!==null)&&zi(te,y))&&(ie.push({instanceLocation:s,keyword:"uniqueItems",keywordLocation:`${o}/uniqueItems`,error:`Duplicate items at indexes ${ne} and ${d}.`}),ne=Number.MAX_SAFE_INTEGER,d=Number.MAX_SAFE_INTEGER)}}}else if(c==="number"){if(t==="4"?(oe!==void 0&&(x===!0&&n<=oe||n<oe)&&ie.push({instanceLocation:s,keyword:"minimum",keywordLocation:`${o}/minimum`,error:`${n} is less than ${x?"or equal to ":""} ${oe}.`}),T!==void 0&&(W===!0&&n>=T||n>T)&&ie.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${o}/maximum`,error:`${n} is greater than ${W?"or equal to ":""} ${T}.`})):(oe!==void 0&&n<oe&&ie.push({instanceLocation:s,keyword:"minimum",keywordLocation:`${o}/minimum`,error:`${n} is less than ${oe}.`}),T!==void 0&&n>T&&ie.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${o}/maximum`,error:`${n} is greater than ${T}.`}),x!==void 0&&n<=x&&ie.push({instanceLocation:s,keyword:"exclusiveMinimum",keywordLocation:`${o}/exclusiveMinimum`,error:`${n} is less than ${x}.`}),W!==void 0&&n>=W&&ie.push({instanceLocation:s,keyword:"exclusiveMaximum",keywordLocation:`${o}/exclusiveMaximum`,error:`${n} is greater than or equal to ${W}.`})),re!==void 0){const ce=n%re;Math.abs(0-ce)>=11920929e-14&&Math.abs(re-ce)>=11920929e-14&&ie.push({instanceLocation:s,keyword:"multipleOf",keywordLocation:`${o}/multipleOf`,error:`${n} is not a multiple of ${re}.`})}}else if(c==="string"){const ce=_e===void 0&&he===void 0?0:Nm(n);_e!==void 0&&ce<_e&&ie.push({instanceLocation:s,keyword:"minLength",keywordLocation:`${o}/minLength`,error:`String is too short (${ce} < ${_e}).`}),he!==void 0&&ce>he&&ie.push({instanceLocation:s,keyword:"maxLength",keywordLocation:`${o}/maxLength`,error:`String is too long (${ce} > ${he}).`}),ye!==void 0&&!new RegExp(ye,"u").test(n)&&ie.push({instanceLocation:s,keyword:"pattern",keywordLocation:`${o}/pattern`,error:"String does not match pattern."}),$!==void 0&&tc[$]&&!tc[$](n)&&ie.push({instanceLocation:s,keyword:"format",keywordLocation:`${o}/format`,error:`String does not match format "${$}".`})}return{valid:ie.length===0,errors:ie}}function Lm(n,e){return e?.[n]||yh(n)}function Fm(n,e,t){const r={};for(const i in n)Object.hasOwn(n,i)&&(r[e(i,t)]=n[i]);return r}function rc(n){return Array.isArray(n)?[...n]:{...n}}function Dm(n,e){const t=rc(n);for(const[r,i]of Object.entries(e)){const[a,...s]=r.split(".").reverse();let o=t;for(const u of s.reverse()){if(o[u]===void 0)break;o[u]=rc(o[u]),o=o[u]}o[a]!==void 0&&(o[a]={lc:1,type:"secret",id:[i]})}return t}function Xf(n){const e=Object.getPrototypeOf(n);return typeof n.lc_name=="function"&&(typeof e.lc_name!="function"||n.lc_name()!==e.lc_name())?n.lc_name():n.name}class bt{static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,Xf(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(e,...t){Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lc_kwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([r])=>this.lc_serializable_keys?.includes(r))):this.lc_kwargs=e??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof bt||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();const e={},t={},r=Object.keys(this.lc_kwargs).reduce((i,a)=>(i[a]=a in this?this[a]:this.lc_kwargs[a],i),{});for(let i=Object.getPrototypeOf(this);i;i=Object.getPrototypeOf(i))Object.assign(e,Reflect.get(i,"lc_aliases",this)),Object.assign(t,Reflect.get(i,"lc_secrets",this)),Object.assign(r,Reflect.get(i,"lc_attributes",this));return Object.keys(t).forEach(i=>{let a=this,s=r;const[o,...u]=i.split(".").reverse();for(const l of u.reverse()){if(!(l in a)||a[l]===void 0)return;(!(l in s)||s[l]===void 0)&&(typeof a[l]=="object"&&a[l]!=null?s[l]={}:Array.isArray(a[l])&&(s[l]=[])),a=a[l],s=s[l]}o in a&&a[o]!==void 0&&(s[o]=s[o]||a[o])}),{lc:1,type:"constructor",id:this.lc_id,kwargs:Fm(Object.keys(t).length?Dm(r,t):r,Lm,e)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}}var Um={};const Bm=()=>typeof window<"u"&&typeof window.document<"u",qm=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",zm=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),go=()=>typeof Deno<"u",Hm=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!go(),Gm=()=>{let n;return Bm()?n="browser":Hm()?n="node":qm()?n="webworker":zm()?n="jsdom":go()?n="deno":n="other",n};let cs;function Vm(){return cs===void 0&&(cs={library:"langchain-js",runtime:Gm()}),cs}function Jt(n){try{return typeof process<"u"?Um?.[n]:go()?Deno?.env.get(n):void 0}catch{return}}class Wm{}class mn extends Wm{get lc_namespace(){return["langchain_core","callbacks",this.name]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,Xf(this.constructor)]}constructor(e){super(),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lc_kwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ignoreLLM",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreChain",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreAgent",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreRetriever",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreCustomEvent",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"raiseError",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"awaitHandlers",{enumerable:!0,configurable:!0,writable:!0,value:Jt("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"}),this.lc_kwargs=e||{},e&&(this.ignoreLLM=e.ignoreLLM??this.ignoreLLM,this.ignoreChain=e.ignoreChain??this.ignoreChain,this.ignoreAgent=e.ignoreAgent??this.ignoreAgent,this.ignoreRetriever=e.ignoreRetriever??this.ignoreRetriever,this.ignoreCustomEvent=e.ignoreCustomEvent??this.ignoreCustomEvent,this.raiseError=e.raiseError??this.raiseError,this.awaitHandlers=this.raiseError||(e._awaitHandler??this.awaitHandlers))}copy(){return new this.constructor(this)}toJSON(){return bt.prototype.toJSON.call(this)}toJSONNotImplemented(){return bt.prototype.toJSONNotImplemented.call(this)}static fromMethods(e){class t extends mn{constructor(){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:Le()}),Object.assign(this,e)}}return new t}}const Jm=n=>{const e=n;return e!==void 0&&typeof e.copy=="function"&&typeof e.name=="string"&&typeof e.awaitHandlers=="boolean"},Km="gen_ai.operation.name",Ym="gen_ai.system",nc="gen_ai.request.model",Qm="gen_ai.response.model",ic="gen_ai.usage.input_tokens",ac="gen_ai.usage.output_tokens",sc="gen_ai.usage.total_tokens",Zm="gen_ai.request.max_tokens",Xm="gen_ai.request.temperature",eg="gen_ai.request.top_p",tg="gen_ai.request.frequency_penalty",rg="gen_ai.request.presence_penalty",ng="gen_ai.response.finish_reasons",ig="gen_ai.prompt",ag="gen_ai.completion",sg="gen_ai.request.extra_query",og="gen_ai.request.extra_body",ug="gen_ai.serialized.name",lg="gen_ai.serialized.signature",cg="gen_ai.serialized.doc",fg="gen_ai.response.id",dg="gen_ai.response.service_tier",hg="gen_ai.response.system_fingerprint",pg="gen_ai.usage.input_token_details",mg="gen_ai.usage.output_token_details",gg="langsmith.trace.session_id",yg="langsmith.trace.session_name",bg="langsmith.span.kind",_g="langsmith.trace.name",vg="langsmith.metadata",oc="langsmith.span.tags",wg="langsmith.request.streaming",Eg="langsmith.request.headers",Sg=(...n)=>fetch(...n),ed=Symbol.for("ls:fetch_implementation"),Og=()=>{const n=globalThis[ed];return n?typeof n=="function"&&"Headers"in n&&"Request"in n&&"Response"in n:!1},Tg=n=>async(...e)=>{if(n||ze("DEBUG")==="true"){const[r,i]=e;console.log(`→ ${i?.method||"GET"} ${r}`)}const t=await(globalThis[ed]??Sg)(...e);return(n||ze("DEBUG")==="true")&&console.log(`← ${t.status} ${t.statusText} ${t.url}`),t},td=()=>ze("PROJECT")??ct("LANGCHAIN_SESSION")??"default",rd="0.3.73";var Cs={};let st;const Pg=()=>typeof window<"u"&&typeof window.document<"u",xg=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",Ag=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),nd=()=>typeof Deno<"u",Rg=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!nd(),id=()=>st||(typeof Bun<"u"?st="bun":Pg()?st="browser":Rg()?st="node":xg()?st="webworker":Ag()?st="jsdom":nd()?st="deno":st="other",st);let fs;function ad(){if(fs===void 0){const n=id(),e=Cg();fs={library:"langsmith",runtime:n,sdk:"langsmith-js",sdk_version:rd,...e}}return fs}function sd(){const n=Ig(),e={},t=["LANGCHAIN_API_KEY","LANGCHAIN_ENDPOINT","LANGCHAIN_TRACING_V2","LANGCHAIN_PROJECT","LANGCHAIN_SESSION","LANGSMITH_API_KEY","LANGSMITH_ENDPOINT","LANGSMITH_TRACING_V2","LANGSMITH_PROJECT","LANGSMITH_SESSION"];for(const[r,i]of Object.entries(n))typeof i=="string"&&!t.includes(r)&&!r.toLowerCase().includes("key")&&!r.toLowerCase().includes("secret")&&!r.toLowerCase().includes("token")&&(r==="LANGCHAIN_REVISION_ID"?e.revision_id=i:e[r]=i);return e}function Ig(){const n={};try{if(typeof process<"u"&&Cs)for(const[e,t]of Object.entries(Cs))(e.startsWith("LANGCHAIN_")||e.startsWith("LANGSMITH_"))&&t!=null&&((e.toLowerCase().includes("key")||e.toLowerCase().includes("secret")||e.toLowerCase().includes("token"))&&typeof t=="string"?n[e]=t.slice(0,2)+"*".repeat(t.length-4)+t.slice(-2):n[e]=t)}catch{}return n}function ct(n){try{return typeof process<"u"?Cs?.[n]:void 0}catch{return}}function ze(n){return ct(`LANGSMITH_${n}`)||ct(`LANGCHAIN_${n}`)}let ds;function Cg(){if(ds!==void 0)return ds;const n=["VERCEL_GIT_COMMIT_SHA","NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA","COMMIT_REF","RENDER_GIT_COMMIT","CI_COMMIT_SHA","CIRCLE_SHA1","CF_PAGES_COMMIT_SHA","REACT_APP_GIT_SHA","SOURCE_VERSION","GITHUB_SHA","TRAVIS_COMMIT","GIT_COMMIT","BUILD_VCS_NUMBER","bamboo_planRepository_revision","Build.SourceVersion","BITBUCKET_COMMIT","DRONE_COMMIT_SHA","SEMAPHORE_GIT_SHA","BUILDKITE_COMMIT"],e={};for(const t of n){const r=ct(t);r!==void 0&&(e[t]=r)}return ds=e,e}function od(){return ct("OTEL_ENABLED")==="true"||ze("OTEL_ENABLED")==="true"}class $g{constructor(){Object.defineProperty(this,"hasWarned",{enumerable:!0,configurable:!0,writable:!0,value:!1})}startActiveSpan(e,...t){!this.hasWarned&&od()&&(console.warn('You have enabled OTEL export via the `OTEL_ENABLED` or `LANGSMITH_OTEL_ENABLED` environment variable, but have not initialized the required OTEL instances. Please add:\n```\nimport { initializeOTEL } from "langsmith/experimental/otel/setup";\ninitializeOTEL();\n```\nat the beginning of your code.'),this.hasWarned=!0);let r;if(t.length===1&&typeof t[0]=="function"?r=t[0]:t.length===2&&typeof t[1]=="function"?r=t[1]:t.length===3&&typeof t[2]=="function"&&(r=t[2]),typeof r=="function")return r()}}class jg{constructor(){Object.defineProperty(this,"mockTracer",{enumerable:!0,configurable:!0,writable:!0,value:new $g})}getTracer(e,t){return this.mockTracer}getActiveSpan(){}setSpan(e,t){return e}getSpan(e){}setSpanContext(e,t){return e}getTracerProvider(){}setGlobalTracerProvider(e){return!1}}class Mg{active(){return{}}with(e,t){return t()}}const hs=Symbol.for("ls:otel_trace"),ps=Symbol.for("ls:otel_context"),uc=Symbol.for("ls:otel_get_default_otlp_tracer_provider"),kg=new jg,Ng=new Mg;class Lg{getTraceInstance(){return globalThis[hs]??kg}getContextInstance(){return globalThis[ps]??Ng}initializeGlobalInstances(e){globalThis[hs]===void 0&&(globalThis[hs]=e.trace),globalThis[ps]===void 0&&(globalThis[ps]=e.context)}setDefaultOTLPTracerComponents(e){globalThis[uc]=e}getDefaultOTLPTracerComponents(){return globalThis[uc]??void 0}}const yo=new Lg;function ud(){return yo.getTraceInstance()}function Fg(){return yo.getContextInstance()}function Dg(){return yo.getDefaultOTLPTracerComponents()}const Ug={llm:"chat",tool:"execute_tool",retriever:"embeddings",embedding:"embeddings",prompt:"chat"};function Bg(n){return Ug[n]||n}class qg{constructor(){Object.defineProperty(this,"spans",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}exportBatch(e,t){for(const r of e)try{if(!r.run)continue;if(r.operation==="post"){const i=this.createSpanForRun(r,r.run,t.get(r.id));i&&!r.run.end_time&&this.spans.set(r.id,i)}else this.updateSpanForRun(r,r.run)}catch(i){console.error(`Error processing operation ${r.id}:`,i)}}createSpanForRun(e,t,r){const i=r&&ud().getSpan(r);if(i)try{return this.finishSpanSetup(i,t,e)}catch(a){console.error(`Failed to create span for run ${e.id}:`,a);return}}finishSpanSetup(e,t,r){return this.setSpanAttributes(e,t,r),t.error?(e.setStatus({code:2}),e.recordException(new Error(t.error))):e.setStatus({code:1}),t.end_time&&e.end(new Date(t.end_time)),e}updateSpanForRun(e,t){try{const r=this.spans.get(e.id);if(!r){console.debug(`No span found for run ${e.id} during update`);return}this.setSpanAttributes(r,t,e),t.error?(r.setStatus({code:2}),r.recordException(new Error(t.error))):r.setStatus({code:1});const i=t.end_time;i&&(r.end(new Date(i)),this.spans.delete(e.id))}catch(r){console.error(`Failed to update span for run ${e.id}:`,r)}}extractModelName(e){if(e.extra?.metadata){const t=e.extra.metadata;if(t.ls_model_name)return t.ls_model_name;if(t.invocation_params){const r=t.invocation_params;if(r.model)return r.model;if(r.model_name)return r.model_name}}}setSpanAttributes(e,t,r){if("run_type"in t&&t.run_type){e.setAttribute(bg,t.run_type);const o=Bg(t.run_type||"chain");e.setAttribute(Km,o)}"name"in t&&t.name&&e.setAttribute(_g,t.name),"session_id"in t&&t.session_id&&e.setAttribute(gg,t.session_id),"session_name"in t&&t.session_name&&e.setAttribute(yg,t.session_name),this.setGenAiSystem(e,t);const i=this.extractModelName(t);i&&e.setAttribute(nc,i),"prompt_tokens"in t&&typeof t.prompt_tokens=="number"&&e.setAttribute(ic,t.prompt_tokens),"completion_tokens"in t&&typeof t.completion_tokens=="number"&&e.setAttribute(ac,t.completion_tokens),"total_tokens"in t&&typeof t.total_tokens=="number"&&e.setAttribute(sc,t.total_tokens),this.setInvocationParameters(e,t);const a=t.extra?.metadata||{};for(const[o,u]of Object.entries(a))u!=null&&e.setAttribute(`${vg}.${o}`,String(u));const s=t.tags;if(s&&Array.isArray(s)?e.setAttribute(oc,s.join(", ")):s&&e.setAttribute(oc,String(s)),"serialized"in t&&typeof t.serialized=="object"){const o=t.serialized;o.name&&e.setAttribute(ug,String(o.name)),o.signature&&e.setAttribute(lg,String(o.signature)),o.doc&&e.setAttribute(cg,String(o.doc))}this.setIOAttributes(e,r)}setGenAiSystem(e,t){let r="langchain";const i=this.extractModelName(t);if(i){const a=i.toLowerCase();a.includes("anthropic")||a.startsWith("claude")?r="anthropic":a.includes("bedrock")?r="aws.bedrock":a.includes("azure")&&a.includes("openai")?r="az.ai.openai":a.includes("azure")&&a.includes("inference")?r="az.ai.inference":a.includes("cohere")?r="cohere":a.includes("deepseek")?r="deepseek":a.includes("gemini")?r="gemini":a.includes("groq")?r="groq":a.includes("watson")||a.includes("ibm")?r="ibm.watsonx.ai":a.includes("mistral")?r="mistral_ai":a.includes("gpt")||a.includes("openai")?r="openai":a.includes("perplexity")||a.includes("sonar")?r="perplexity":a.includes("vertex")?r="vertex_ai":(a.includes("xai")||a.includes("grok"))&&(r="xai")}e.setAttribute(Ym,r)}setInvocationParameters(e,t){if(!t.extra?.metadata?.invocation_params)return;const r=t.extra.metadata.invocation_params;r.max_tokens!==void 0&&e.setAttribute(Zm,r.max_tokens),r.temperature!==void 0&&e.setAttribute(Xm,r.temperature),r.top_p!==void 0&&e.setAttribute(eg,r.top_p),r.frequency_penalty!==void 0&&e.setAttribute(tg,r.frequency_penalty),r.presence_penalty!==void 0&&e.setAttribute(rg,r.presence_penalty)}setIOAttributes(e,t){if(t.run.inputs)try{const r=t.run.inputs;typeof r=="object"&&r!==null&&(r.model&&Array.isArray(r.messages)&&e.setAttribute(nc,r.model),r.stream!==void 0&&e.setAttribute(wg,r.stream),r.extra_headers&&e.setAttribute(Eg,JSON.stringify(r.extra_headers)),r.extra_query&&e.setAttribute(sg,JSON.stringify(r.extra_query)),r.extra_body&&e.setAttribute(og,JSON.stringify(r.extra_body))),e.setAttribute(ig,JSON.stringify(r))}catch(r){console.debug(`Failed to process inputs for run ${t.id}`,r)}if(t.run.outputs)try{const r=t.run.outputs,i=this.getUnifiedRunTokens(r);if(i&&(e.setAttribute(ic,i[0]),e.setAttribute(ac,i[1]),e.setAttribute(sc,i[0]+i[1])),r&&typeof r=="object"){if(r.model&&e.setAttribute(Qm,String(r.model)),r.id&&e.setAttribute(fg,r.id),r.choices&&Array.isArray(r.choices)){const a=r.choices.map(s=>s.finish_reason).filter(s=>s).map(String);a.length>0&&e.setAttribute(ng,a.join(", "))}if(r.service_tier&&e.setAttribute(dg,r.service_tier),r.system_fingerprint&&e.setAttribute(hg,r.system_fingerprint),r.usage_metadata&&typeof r.usage_metadata=="object"){const a=r.usage_metadata;a.input_token_details&&e.setAttribute(pg,JSON.stringify(a.input_token_details)),a.output_token_details&&e.setAttribute(mg,JSON.stringify(a.output_token_details))}}e.setAttribute(ag,JSON.stringify(r))}catch(r){console.debug(`Failed to process outputs for run ${t.id}`,r)}}getUnifiedRunTokens(e){if(!e)return null;let t=this.extractUnifiedRunTokens(e.usage_metadata);if(t)return t;const r=Object.keys(e);for(const s of r){const o=e[s];if(!(!o||typeof o!="object")&&(t=this.extractUnifiedRunTokens(o.usage_metadata),t||o.lc===1&&o.kwargs&&typeof o.kwargs=="object"&&(t=this.extractUnifiedRunTokens(o.kwargs.usage_metadata),t)))return t}const i=e.generations||[];if(!Array.isArray(i))return null;const a=Array.isArray(i[0])?i.flat():i;for(const s of a)if(typeof s=="object"&&s.message&&typeof s.message=="object"&&s.message.kwargs&&typeof s.message.kwargs=="object"&&(t=this.extractUnifiedRunTokens(s.message.kwargs.usage_metadata),t))return t;return null}extractUnifiedRunTokens(e){return!e||typeof e!="object"||typeof e.input_tokens!="number"||typeof e.output_tokens!="number"?null:[e.input_tokens,e.output_tokens]}}const zg=[429,500,502,503,504];let lc=class{constructor(e){Object.defineProperty(this,"maxConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailedResponseHook",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??6,"default"in gt?this.queue=new gt.default({concurrency:this.maxConcurrency}):this.queue=new gt({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...t){const r=this.onFailedResponseHook;return this.queue.add(()=>ai(()=>e(...t).catch(i=>{throw i instanceof Error?i:new Error(i)}),{async onFailedAttempt(i){if(i.message.startsWith("Cancel")||i.message.startsWith("TimeoutError")||i.name==="TimeoutError"||i.message.startsWith("AbortError")||i?.code==="ECONNABORTED")throw i;const a=i?.response;if(r&&await r(a))return;const s=a?.status??i?.status;if(s&&!zg.includes(+s))throw i},retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(e,t,...r){return e.signal?Promise.race([this.call(t,...r),new Promise((i,a)=>{e.signal?.addEventListener("abort",()=>{a(new Error("AbortError"))})})]):this.call(t,...r)}};function cc(n){return typeof n?._getType=="function"}function fc(n){const e={type:n._getType(),data:{content:n.content}};return n?.additional_kwargs&&Object.keys(n.additional_kwargs).length>0&&(e.data.additional_kwargs={...n.additional_kwargs}),e}const Hg=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function pe(n,e){if(!Hg.test(n)){const t=e!==void 0?`Invalid UUID for ${e}: ${n}`:`Invalid UUID: ${n}`;throw new Error(t)}return n}const dc={};function ld(n){dc[n]||(console.warn(n),dc[n]=!0)}function Ot(n){if(!n||n.split("/").length>2||n.startsWith("/")||n.endsWith("/")||n.split(":").length>2)throw new Error(`Invalid identifier format: ${n}`);const[e,t]=n.split(":"),r=t||"latest";if(e.includes("/")){const[i,a]=e.split("/",2);if(!i||!a)throw new Error(`Invalid identifier format: ${n}`);return[i,a,r]}else{if(!e)throw new Error(`Invalid identifier format: ${n}`);return["-",e,r]}}class Gg extends Error{constructor(e){super(e),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="LangSmithConflictError",this.status=409}}async function fe(n,e,t){let r;if(n.ok){t&&(r=await n.text());return}if(n.status===403)try{(await n.json())?.error==="org_scoped_key_requires_workspace"&&(r="This API key is org-scoped and requires workspace specification. Please provide 'workspaceId' parameter, or set LANGSMITH_WORKSPACE_ID environment variable.")}catch{const o=new Error(`${n.status} ${n.statusText}`);throw o.status=n?.status,o}if(r===void 0)try{r=await n.text()}catch{r=""}const i=`Failed to ${e}. Received status [${n.status}]: ${n.statusText}. Message: ${r}`;if(n.status===409)throw new Gg(i);const a=new Error(i);throw a.status=n.status,a}const cd="ERR_CONFLICTING_ENDPOINTS";class Vg extends Error{constructor(){super("You cannot provide both LANGSMITH_ENDPOINT / LANGCHAIN_ENDPOINT and LANGSMITH_RUNS_ENDPOINTS."),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:cd}),this.name="ConflictingEndpointsError"}}function Wg(n){return typeof n=="object"&&n!==null&&n.code===cd}var hc="[...]",Jg={result:"[Circular]"},di=[],Vt=[];const Kg=new TextEncoder;function Yg(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Yn(n){return Kg.encode(n)}function fd(n){if(n&&typeof n=="object"&&n!==null){if(n instanceof Map)return Object.fromEntries(n);if(n instanceof Set)return Array.from(n);if(n instanceof Date)return n.toISOString();if(n instanceof RegExp)return n.toString();if(n instanceof Error)return{name:n.name,message:n.message}}else if(typeof n=="bigint")return n.toString();return n}function Qg(n){return function(e,t){return fd(t)}}function Ge(n,e,t,r,i){try{const a=JSON.stringify(n,Qg(t),r);return Yn(a)}catch(a){if(!a.message?.includes("Converting circular structure to JSON"))return console.warn(`[WARNING]: LangSmith received unserializable value.${e?`
|
|
@@ -121,7 +121,7 @@ Instead got an unsupported type.`)}class Td extends Ae{static lc_name(){return"R
|
|
|
121
121
|
Details: ${p.message}`),new rn(b,JSON.stringify(e))}else{const p=Se(i,this.schema);if(!p.valid){let b="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(b=`${b}
|
|
122
122
|
Details: ${p.errors.map(w=>`${w.keywordLocation}: ${w.error}`).join(`
|
|
123
123
|
`)}`),new rn(b,JSON.stringify(e))}a=i}const s=wo(t),u=await Fe.configure(s.callbacks,this.callbacks,s.tags||r,this.tags,s.metadata,this.metadata,{verbose:this.verbose})?.handleToolStart(this.toJSON(),typeof e=="string"?e:JSON.stringify(e),s.runId,void 0,void 0,void 0,s.runName);delete s.runId;let l;try{l=await this._call(a,u,s)}catch(p){throw await u?.handleToolError(p),p}let c,h;if(this.responseFormat==="content_and_artifact")if(Array.isArray(l)&&l.length===2)[c,h]=l;else throw new Error(`Tool response format is "content_and_artifact" but the output was not a two-tuple.
|
|
124
|
-
Result: ${JSON.stringify(l)}`);else c=l;let f;Hr(e)&&(f=e.id),!f&&yy(s)&&(f=s.toolCall.id);const _=qb({content:c,artifact:h,toolCallId:f,name:this.name,metadata:this.metadata});return await u?.handleToolEnd(_),_}}class Ub extends Li{constructor(e){super(e),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:lt({input:cn().optional()}).transform(t=>t.input)})}call(e,t){const r=typeof e=="string"||e==null?{input:e}:e;return super.call(r,t)}}class Bb extends Li{static lc_name(){return"DynamicStructuredTool"}constructor(e){super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.description=e.description,this.func=e.func,this.returnDirect=e.returnDirect??this.returnDirect,this.schema=e.schema}async call(e,t,r){const i=wo(t);return i.runName===void 0&&(i.runName=this.name),super.call(e,i,r)}_call(e,t,r){return this.func(e,t,r)}}function qb(n){const{content:e,artifact:t,toolCallId:r,metadata:i}=n;return r&&!Sy(e)?typeof e=="string"||Array.isArray(e)&&e.every(a=>typeof a=="object")?new wr({status:"success",content:e,artifact:t,tool_call_id:r,name:n.name,metadata:i}):new wr({status:"success",content:zb(e),artifact:t,tool_call_id:r,name:n.name,metadata:i}):e}function zb(n){try{return JSON.stringify(n,null,2)??""}catch{return`${n}`}}var Fr={},Mc;function Hb(){if(Mc)return Fr;Mc=1;var n=/~/,e=/~[01]/g;function t(l){switch(l){case"~1":return"/";case"~0":return"~"}throw new Error("Invalid tilde escape: "+l)}function r(l){return n.test(l)?l.replace(e,t):l}function i(l,c,h){for(var f,_,p=1,b=c.length;p<b;){if(c[p]==="constructor"||c[p]==="prototype"||c[p]==="__proto__")return l;if(f=r(c[p++]),_=b>p,typeof l[f]>"u"&&(Array.isArray(l)&&f==="-"&&(f=l.length),_&&(c[p]!==""&&c[p]<1/0||c[p]==="-"?l[f]=[]:l[f]={})),!_)break;l=l[f]}var w=l[f];return h===void 0?delete l[f]:l[f]=h,w}function a(l){if(typeof l=="string"){if(l=l.split("/"),l[0]==="")return l;throw new Error("Invalid JSON pointer.")}else if(Array.isArray(l)){for(const c of l)if(typeof c!="string"&&typeof c!="number")throw new Error("Invalid JSON pointer. Must be of type string or number.");return l}throw new Error("Invalid JSON pointer.")}function s(l,c){if(typeof l!="object")throw new Error("Invalid input object.");c=a(c);var h=c.length;if(h===1)return l;for(var f=1;f<h;){if(l=l[r(c[f++])],h===f)return l;if(typeof l!="object"||l===null)return}}function o(l,c,h){if(typeof l!="object")throw new Error("Invalid input object.");if(c=a(c),c.length===0)throw new Error("Invalid JSON pointer for set.");return i(l,c,h)}function u(l){var c=a(l);return{get:function(h){return s(h,c)},set:function(h,f){return o(h,c,f)}}}return Fr.get=s,Fr.set=o,Fr.compile=u,Fr}Hb();class Gb extends Ae{static lc_name(){return"RunnablePassthrough"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e&&(this.func=e.func)}async invoke(e,t){const r=be(t);return this.func&&await this.func(e,r),this._callWithConfig(i=>Promise.resolve(i),e,r)}async*transform(e,t){const r=be(t);let i,a=!0;for await(const s of this._transformStreamWithConfig(e,o=>o,r))if(yield s,a)if(i===void 0)i=s;else try{i=To(i,s)}catch{i=void 0,a=!1}this.func&&i!==void 0&&await this.func(i,r)}static assign(e){return new Td(new Ir({steps:e}))}}class Vb extends Ao{get lc_namespace(){return["langchain","chains",this._chainType()]}constructor(e,t,r){if(arguments.length===1&&typeof e=="object"&&!("saveContext"in e)){const{memory:i,callbackManager:a,...s}=e;super({...s,callbacks:a??s.callbacks}),this.memory=i}else super({verbose:t,callbacks:r}),this.memory=e}_selectMemoryInputs(e){const t={...e};return"signal"in t&&delete t.signal,"timeout"in t&&delete t.timeout,t}async invoke(e,t){const r=be(t),i=await this._formatValues(e),s=await(await Fe.configure(r?.callbacks,this.callbacks,r?.tags,this.tags,r?.metadata,this.metadata,{verbose:this.verbose}))?.handleChainStart(this.toJSON(),i,void 0,void 0,void 0,void 0,r?.runName);let o;try{o=await(i.signal?Promise.race([this._call(i,s,r),new Promise((u,l)=>{i.signal?.addEventListener("abort",()=>{l(new Error("AbortError"))})})]):this._call(i,s,r))}catch(u){throw await s?.handleChainError(u),u}return this.memory!=null&&await this.memory.saveContext(this._selectMemoryInputs(e),o),await s?.handleChainEnd(o),Object.defineProperty(o,gb,{value:s?{runId:s?.runId}:void 0,configurable:!0}),o}_validateOutputs(e){const t=this.outputKeys.filter(r=>!(r in e));if(t.length)throw new Error(`Missing output keys: ${t.join(", ")} from chain ${this._chainType()}`)}async prepOutputs(e,t,r=!1){return this._validateOutputs(t),this.memory&&await this.memory.saveContext(e,t),r?t:{...e,...t}}serialize(){throw new Error("Method not implemented.")}async run(e,t){const r=this.inputKeys.filter(u=>!this.memory?.memoryKeys.includes(u));if(!(r.length<=1))throw new Error(`Chain ${this._chainType()} expects multiple inputs, cannot use 'run' `);const a=r.length?{[r[0]]:e}:{},s=await this.call(a,t),o=Object.keys(s);if(o.length===1)return s[o[0]];throw new Error("return values have multiple keys, `run` only supported when one key currently")}async _formatValues(e){const t={...e};if(t.timeout&&!t.signal&&(t.signal=AbortSignal.timeout(t.timeout),delete t.timeout),this.memory!=null){const r=await this.memory.loadMemoryVariables(this._selectMemoryInputs(e));for(const[i,a]of Object.entries(r))t[i]=a}return t}async call(e,t,r){const i={tags:r,...wo(t)};return this.invoke(e,i)}async apply(e,t){return Promise.all(e.map(async(r,i)=>this.call(r,t?.[i])))}static async deserialize(e,t={}){switch(e._type){case"llm_chain":{const{LLMChain:r}=await Me(async()=>{const{LLMChain:i}=await import("./llm_chain-BjPpdLtn.js");return{LLMChain:i}},__vite__mapDeps([7,4,2,3,5,6]));return r.deserialize(e)}case"sequential_chain":{const{SequentialChain:r}=await Me(async()=>{const{SequentialChain:i}=await import("./sequential_chain-CMeHtLVI.js");return{SequentialChain:i}},__vite__mapDeps([8,2,3,4,5,6]));return r.deserialize(e)}case"simple_sequential_chain":{const{SimpleSequentialChain:r}=await Me(async()=>{const{SimpleSequentialChain:i}=await import("./sequential_chain-CMeHtLVI.js");return{SimpleSequentialChain:i}},__vite__mapDeps([8,2,3,4,5,6]));return r.deserialize(e)}case"stuff_documents_chain":{const{StuffDocumentsChain:r}=await Me(async()=>{const{StuffDocumentsChain:i}=await import("./combine_docs_chain-DL4SSw1r.js");return{StuffDocumentsChain:i}},__vite__mapDeps([9,4,2,3,7,5,6]));return r.deserialize(e)}case"map_reduce_documents_chain":{const{MapReduceDocumentsChain:r}=await Me(async()=>{const{MapReduceDocumentsChain:i}=await import("./combine_docs_chain-DL4SSw1r.js");return{MapReduceDocumentsChain:i}},__vite__mapDeps([9,4,2,3,7,5,6]));return r.deserialize(e)}case"refine_documents_chain":{const{RefineDocumentsChain:r}=await Me(async()=>{const{RefineDocumentsChain:i}=await import("./combine_docs_chain-DL4SSw1r.js");return{RefineDocumentsChain:i}},__vite__mapDeps([9,4,2,3,7,5,6]));return r.deserialize(e)}case"vector_db_qa":{const{VectorDBQAChain:r}=await Me(async()=>{const{VectorDBQAChain:i}=await import("./vector_db_qa-B2yinyB2.js");return{VectorDBQAChain:i}},__vite__mapDeps([10,7,4,2,3,5,6,9]));return r.deserialize(e,t)}case"api_chain":{const{APIChain:r}=await Me(async()=>{const{APIChain:i}=await import("./api_chain-C23oJnEu.js");return{APIChain:i}},__vite__mapDeps([11,7,4,2,3,5,6]));return r.deserialize(e)}default:throw new Error(`Invalid prompt type in config: ${e._type}`)}}}class Ro extends Ae{get lc_attributes(){return{partialVariables:void 0}}constructor(e){super(e),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts",this._getPromptType()]}),Object.defineProperty(this,"inputVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputParser",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"partialVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const{inputVariables:t}=e;if(t.includes("stop"))throw new Error("Cannot have an input variable named 'stop', as it is used internally, please rename.");Object.assign(this,e)}async mergePartialAndUserVariables(e){const t=this.partialVariables??{},r={};for(const[a,s]of Object.entries(t))typeof s=="string"?r[a]=s:r[a]=await s();return{...r,...e}}async invoke(e,t){const r={...this.metadata,...t?.metadata},i=[...this.tags??[],...t?.tags??[]];return this._callWithConfig(a=>this.formatPromptValue(a),e,{...t,tags:i,metadata:r,runType:"prompt"})}serialize(){throw new Error("Use .toJSON() instead")}static async deserialize(e){switch(e._type){case"prompt":{const{PromptTemplate:t}=await Me(async()=>{const{PromptTemplate:r}=await Promise.resolve().then(()=>Lc);return{PromptTemplate:r}},void 0);return t.deserialize(e)}case void 0:{const{PromptTemplate:t}=await Me(async()=>{const{PromptTemplate:r}=await Promise.resolve().then(()=>Lc);return{PromptTemplate:r}},void 0);return t.deserialize({...e,_type:"prompt"})}case"few_shot":{const{FewShotPromptTemplate:t}=await Me(async()=>{const{FewShotPromptTemplate:r}=await import("./few_shot-BNXy_2Ql.js");return{FewShotPromptTemplate:r}},__vite__mapDeps([12,4,2,3,5,6]));return t.deserialize(e)}default:throw new Error(`Invalid prompt type in config: ${e._type}`)}}}class qs extends Ro{async formatPromptValue(e){const t=await this.format(e);return new yd(t)}}/*!
|
|
124
|
+
Result: ${JSON.stringify(l)}`);else c=l;let f;Hr(e)&&(f=e.id),!f&&yy(s)&&(f=s.toolCall.id);const _=qb({content:c,artifact:h,toolCallId:f,name:this.name,metadata:this.metadata});return await u?.handleToolEnd(_),_}}class Ub extends Li{constructor(e){super(e),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:lt({input:cn().optional()}).transform(t=>t.input)})}call(e,t){const r=typeof e=="string"||e==null?{input:e}:e;return super.call(r,t)}}class Bb extends Li{static lc_name(){return"DynamicStructuredTool"}constructor(e){super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.description=e.description,this.func=e.func,this.returnDirect=e.returnDirect??this.returnDirect,this.schema=e.schema}async call(e,t,r){const i=wo(t);return i.runName===void 0&&(i.runName=this.name),super.call(e,i,r)}_call(e,t,r){return this.func(e,t,r)}}function qb(n){const{content:e,artifact:t,toolCallId:r,metadata:i}=n;return r&&!Sy(e)?typeof e=="string"||Array.isArray(e)&&e.every(a=>typeof a=="object")?new wr({status:"success",content:e,artifact:t,tool_call_id:r,name:n.name,metadata:i}):new wr({status:"success",content:zb(e),artifact:t,tool_call_id:r,name:n.name,metadata:i}):e}function zb(n){try{return JSON.stringify(n,null,2)??""}catch{return`${n}`}}var Fr={},Mc;function Hb(){if(Mc)return Fr;Mc=1;var n=/~/,e=/~[01]/g;function t(l){switch(l){case"~1":return"/";case"~0":return"~"}throw new Error("Invalid tilde escape: "+l)}function r(l){return n.test(l)?l.replace(e,t):l}function i(l,c,h){for(var f,_,p=1,b=c.length;p<b;){if(c[p]==="constructor"||c[p]==="prototype"||c[p]==="__proto__")return l;if(f=r(c[p++]),_=b>p,typeof l[f]>"u"&&(Array.isArray(l)&&f==="-"&&(f=l.length),_&&(c[p]!==""&&c[p]<1/0||c[p]==="-"?l[f]=[]:l[f]={})),!_)break;l=l[f]}var w=l[f];return h===void 0?delete l[f]:l[f]=h,w}function a(l){if(typeof l=="string"){if(l=l.split("/"),l[0]==="")return l;throw new Error("Invalid JSON pointer.")}else if(Array.isArray(l)){for(const c of l)if(typeof c!="string"&&typeof c!="number")throw new Error("Invalid JSON pointer. Must be of type string or number.");return l}throw new Error("Invalid JSON pointer.")}function s(l,c){if(typeof l!="object")throw new Error("Invalid input object.");c=a(c);var h=c.length;if(h===1)return l;for(var f=1;f<h;){if(l=l[r(c[f++])],h===f)return l;if(typeof l!="object"||l===null)return}}function o(l,c,h){if(typeof l!="object")throw new Error("Invalid input object.");if(c=a(c),c.length===0)throw new Error("Invalid JSON pointer for set.");return i(l,c,h)}function u(l){var c=a(l);return{get:function(h){return s(h,c)},set:function(h,f){return o(h,c,f)}}}return Fr.get=s,Fr.set=o,Fr.compile=u,Fr}Hb();class Gb extends Ae{static lc_name(){return"RunnablePassthrough"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e&&(this.func=e.func)}async invoke(e,t){const r=be(t);return this.func&&await this.func(e,r),this._callWithConfig(i=>Promise.resolve(i),e,r)}async*transform(e,t){const r=be(t);let i,a=!0;for await(const s of this._transformStreamWithConfig(e,o=>o,r))if(yield s,a)if(i===void 0)i=s;else try{i=To(i,s)}catch{i=void 0,a=!1}this.func&&i!==void 0&&await this.func(i,r)}static assign(e){return new Td(new Ir({steps:e}))}}class Vb extends Ao{get lc_namespace(){return["langchain","chains",this._chainType()]}constructor(e,t,r){if(arguments.length===1&&typeof e=="object"&&!("saveContext"in e)){const{memory:i,callbackManager:a,...s}=e;super({...s,callbacks:a??s.callbacks}),this.memory=i}else super({verbose:t,callbacks:r}),this.memory=e}_selectMemoryInputs(e){const t={...e};return"signal"in t&&delete t.signal,"timeout"in t&&delete t.timeout,t}async invoke(e,t){const r=be(t),i=await this._formatValues(e),s=await(await Fe.configure(r?.callbacks,this.callbacks,r?.tags,this.tags,r?.metadata,this.metadata,{verbose:this.verbose}))?.handleChainStart(this.toJSON(),i,void 0,void 0,void 0,void 0,r?.runName);let o;try{o=await(i.signal?Promise.race([this._call(i,s,r),new Promise((u,l)=>{i.signal?.addEventListener("abort",()=>{l(new Error("AbortError"))})})]):this._call(i,s,r))}catch(u){throw await s?.handleChainError(u),u}return this.memory!=null&&await this.memory.saveContext(this._selectMemoryInputs(e),o),await s?.handleChainEnd(o),Object.defineProperty(o,gb,{value:s?{runId:s?.runId}:void 0,configurable:!0}),o}_validateOutputs(e){const t=this.outputKeys.filter(r=>!(r in e));if(t.length)throw new Error(`Missing output keys: ${t.join(", ")} from chain ${this._chainType()}`)}async prepOutputs(e,t,r=!1){return this._validateOutputs(t),this.memory&&await this.memory.saveContext(e,t),r?t:{...e,...t}}serialize(){throw new Error("Method not implemented.")}async run(e,t){const r=this.inputKeys.filter(u=>!this.memory?.memoryKeys.includes(u));if(!(r.length<=1))throw new Error(`Chain ${this._chainType()} expects multiple inputs, cannot use 'run' `);const a=r.length?{[r[0]]:e}:{},s=await this.call(a,t),o=Object.keys(s);if(o.length===1)return s[o[0]];throw new Error("return values have multiple keys, `run` only supported when one key currently")}async _formatValues(e){const t={...e};if(t.timeout&&!t.signal&&(t.signal=AbortSignal.timeout(t.timeout),delete t.timeout),this.memory!=null){const r=await this.memory.loadMemoryVariables(this._selectMemoryInputs(e));for(const[i,a]of Object.entries(r))t[i]=a}return t}async call(e,t,r){const i={tags:r,...wo(t)};return this.invoke(e,i)}async apply(e,t){return Promise.all(e.map(async(r,i)=>this.call(r,t?.[i])))}static async deserialize(e,t={}){switch(e._type){case"llm_chain":{const{LLMChain:r}=await Me(async()=>{const{LLMChain:i}=await import("./llm_chain-DT3ghCCe.js");return{LLMChain:i}},__vite__mapDeps([7,4,2,3,5,6]));return r.deserialize(e)}case"sequential_chain":{const{SequentialChain:r}=await Me(async()=>{const{SequentialChain:i}=await import("./sequential_chain-Bz0Lnisp.js");return{SequentialChain:i}},__vite__mapDeps([8,2,3,4,5,6]));return r.deserialize(e)}case"simple_sequential_chain":{const{SimpleSequentialChain:r}=await Me(async()=>{const{SimpleSequentialChain:i}=await import("./sequential_chain-Bz0Lnisp.js");return{SimpleSequentialChain:i}},__vite__mapDeps([8,2,3,4,5,6]));return r.deserialize(e)}case"stuff_documents_chain":{const{StuffDocumentsChain:r}=await Me(async()=>{const{StuffDocumentsChain:i}=await import("./combine_docs_chain-Dy29TWun.js");return{StuffDocumentsChain:i}},__vite__mapDeps([9,4,2,3,7,5,6]));return r.deserialize(e)}case"map_reduce_documents_chain":{const{MapReduceDocumentsChain:r}=await Me(async()=>{const{MapReduceDocumentsChain:i}=await import("./combine_docs_chain-Dy29TWun.js");return{MapReduceDocumentsChain:i}},__vite__mapDeps([9,4,2,3,7,5,6]));return r.deserialize(e)}case"refine_documents_chain":{const{RefineDocumentsChain:r}=await Me(async()=>{const{RefineDocumentsChain:i}=await import("./combine_docs_chain-Dy29TWun.js");return{RefineDocumentsChain:i}},__vite__mapDeps([9,4,2,3,7,5,6]));return r.deserialize(e)}case"vector_db_qa":{const{VectorDBQAChain:r}=await Me(async()=>{const{VectorDBQAChain:i}=await import("./vector_db_qa-BWzj5gOL.js");return{VectorDBQAChain:i}},__vite__mapDeps([10,7,4,2,3,5,6,9]));return r.deserialize(e,t)}case"api_chain":{const{APIChain:r}=await Me(async()=>{const{APIChain:i}=await import("./api_chain-O4sRd0Fo.js");return{APIChain:i}},__vite__mapDeps([11,7,4,2,3,5,6]));return r.deserialize(e)}default:throw new Error(`Invalid prompt type in config: ${e._type}`)}}}class Ro extends Ae{get lc_attributes(){return{partialVariables:void 0}}constructor(e){super(e),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts",this._getPromptType()]}),Object.defineProperty(this,"inputVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputParser",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"partialVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const{inputVariables:t}=e;if(t.includes("stop"))throw new Error("Cannot have an input variable named 'stop', as it is used internally, please rename.");Object.assign(this,e)}async mergePartialAndUserVariables(e){const t=this.partialVariables??{},r={};for(const[a,s]of Object.entries(t))typeof s=="string"?r[a]=s:r[a]=await s();return{...r,...e}}async invoke(e,t){const r={...this.metadata,...t?.metadata},i=[...this.tags??[],...t?.tags??[]];return this._callWithConfig(a=>this.formatPromptValue(a),e,{...t,tags:i,metadata:r,runType:"prompt"})}serialize(){throw new Error("Use .toJSON() instead")}static async deserialize(e){switch(e._type){case"prompt":{const{PromptTemplate:t}=await Me(async()=>{const{PromptTemplate:r}=await Promise.resolve().then(()=>Lc);return{PromptTemplate:r}},void 0);return t.deserialize(e)}case void 0:{const{PromptTemplate:t}=await Me(async()=>{const{PromptTemplate:r}=await Promise.resolve().then(()=>Lc);return{PromptTemplate:r}},void 0);return t.deserialize({...e,_type:"prompt"})}case"few_shot":{const{FewShotPromptTemplate:t}=await Me(async()=>{const{FewShotPromptTemplate:r}=await import("./few_shot-CM_Ntb28.js");return{FewShotPromptTemplate:r}},__vite__mapDeps([12,4,2,3,5,6]));return t.deserialize(e)}default:throw new Error(`Invalid prompt type in config: ${e._type}`)}}}class qs extends Ro{async formatPromptValue(e){const t=await this.format(e);return new yd(t)}}/*!
|
|
125
125
|
* mustache.js - Logic-less {{mustache}} templates with JavaScript
|
|
126
126
|
* http://github.com/janl/mustache.js
|
|
127
127
|
*/var Wb=Object.prototype.toString,Cr=Array.isArray||function(e){return Wb.call(e)==="[object Array]"};function Io(n){return typeof n=="function"}function Jb(n){return Cr(n)?"array":typeof n}function Ss(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function kc(n,e){return n!=null&&typeof n=="object"&&e in n}function Kb(n,e){return n!=null&&typeof n!="object"&&n.hasOwnProperty&&n.hasOwnProperty(e)}var Yb=RegExp.prototype.test;function Qb(n,e){return Yb.call(n,e)}var Zb=/\S/;function Xb(n){return!Qb(Zb,n)}var e_={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function t_(n){return String(n).replace(/[&<>"'`=\/]/g,function(t){return e_[t]})}var r_=/\s*/,n_=/\s+/,Nc=/\s*=/,i_=/\s*\}/,a_=/#|\^|\/|>|\{|&|=|!/;function s_(n,e){if(!n)return[];var t=!1,r=[],i=[],a=[],s=!1,o=!1,u="",l=0;function c(){if(s&&!o)for(;a.length;)delete i[a.pop()];else a=[];s=!1,o=!1}var h,f,_;function p(I){if(typeof I=="string"&&(I=I.split(n_,2)),!Cr(I)||I.length!==2)throw new Error("Invalid tags: "+I);h=new RegExp(Ss(I[0])+"\\s*"),f=new RegExp("\\s*"+Ss(I[1])),_=new RegExp("\\s*"+Ss("}"+I[1]))}p(e||He.tags);for(var b=new yn(n),w,m,g,v,E,O;!b.eos();){if(w=b.pos,g=b.scanUntil(h),g)for(var C=0,R=g.length;C<R;++C)v=g.charAt(C),Xb(v)?(a.push(i.length),u+=v):(o=!0,t=!0,u+=" "),i.push(["text",v,w,w+1]),w+=1,v===`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as h,a as m,g as b,h as f,R as o}from"./langfuse-YA2S23SM-
|
|
1
|
+
import{f as h,a as m,g as b,h as f,R as o}from"./langfuse-YA2S23SM-CWG57icG.js";import"./zodToJsonSchema-Qxfd2wnD.js";import"./index-B7rBD_6O.js";import"./deep-compare-strict-DtUHXpbW.js";import"./v4-BKrj-4V8.js";class y extends h{constructor(){super(...arguments),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","output_parsers","default"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0})}static lc_name(){return"NoOpOutputParser"}parse(t){return Promise.resolve(t)}getFormatInstructions(){return""}}function g(e){return typeof e._llmType=="function"}function i(e){if(g(e))return e;if("bound"in e&&o.isRunnable(e.bound))return i(e.bound);if("runnable"in e&&"fallbacks"in e&&o.isRunnable(e.runnable))return i(e.runnable);if("default"in e&&o.isRunnable(e.default))return i(e.default);throw new Error("Unable to extract BaseLanguageModel from llmLike object.")}class l extends m{static lc_name(){return"LLMChain"}get inputKeys(){return this.prompt.inputVariables}get outputKeys(){return[this.outputKey]}constructor(t){if(super(t),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"prompt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"llm",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"llmKwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputKey",{enumerable:!0,configurable:!0,writable:!0,value:"text"}),Object.defineProperty(this,"outputParser",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.prompt=t.prompt,this.llm=t.llm,this.llmKwargs=t.llmKwargs,this.outputKey=t.outputKey??this.outputKey,this.outputParser=t.outputParser??new y,this.prompt.outputParser){if(t.outputParser)throw new Error("Cannot set both outputParser and prompt.outputParser");this.outputParser=this.prompt.outputParser}}getCallKeys(){return"callKeys"in this.llm?this.llm.callKeys:[]}_selectMemoryInputs(t){const r=super._selectMemoryInputs(t),u=this.getCallKeys();for(const a of u)a in t&&delete r[a];return r}async _getFinalOutput(t,r,u){let a;return this.outputParser?a=await this.outputParser.parseResultWithPrompt(t,r,u?.getChild()):a=t[0].text,a}call(t,r){return super.call(t,r)}async _call(t,r){const u={...t},a={...this.llmKwargs},p=this.getCallKeys();for(const s of p)s in t&&a&&(a[s]=t[s],delete u[s]);const n=await this.prompt.formatPromptValue(u);if("generatePrompt"in this.llm){const{generations:s}=await this.llm.generatePrompt([n],a,r?.getChild());return{[this.outputKey]:await this._getFinalOutput(s[0],n,r)}}const c=await(this.outputParser?this.llm.pipe(this.outputParser):this.llm).invoke(n,r?.getChild());return{[this.outputKey]:c}}async predict(t,r){return(await this.call(t,r))[this.outputKey]}_chainType(){return"llm"}static async deserialize(t){const{llm:r,prompt:u}=t;if(!r)throw new Error("LLMChain must have llm");if(!u)throw new Error("LLMChain must have prompt");return new l({llm:await f.deserialize(r),prompt:await b.deserialize(u)})}serialize(){const t="serialize"in this.llm?this.llm.serialize():void 0;return{_type:`${this._chainType()}_chain`,llm:t,prompt:this.prompt.serialize()}}_getNumTokens(t){return i(this.llm).getNumTokens(t)}}export{l as LLMChain};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c}from"./langfuse-YA2S23SM-
|
|
1
|
+
import{a as c}from"./langfuse-YA2S23SM-CWG57icG.js";import"./index-B7rBD_6O.js";import"./zodToJsonSchema-Qxfd2wnD.js";import"./deep-compare-strict-DtUHXpbW.js";import"./v4-BKrj-4V8.js";function y(o,e){const t=new Set;for(const i of e)o.has(i)&&t.add(i);return t}function d(o,e){const t=new Set(o);for(const i of e)t.add(i);return t}function h(o,e){const t=new Set(o);for(const i of e)t.delete(i);return t}function l(o){return Array.from(o).map(e=>`"${e}"`).join(", ")}class f extends c{static lc_name(){return"SequentialChain"}get inputKeys(){return this.inputVariables}get outputKeys(){return this.outputVariables}constructor(e){if(super(e),Object.defineProperty(this,"chains",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnAll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.chains=e.chains,this.inputVariables=e.inputVariables,this.outputVariables=e.outputVariables??[],this.outputVariables.length>0&&e.returnAll)throw new Error("Either specify variables to return using `outputVariables` or use `returnAll` param. Cannot apply both conditions at the same time.");this.returnAll=e.returnAll??!1,this._validateChains()}_validateChains(){if(this.chains.length===0)throw new Error("Sequential chain must have at least one chain.");const e=this.memory?.memoryKeys??[],t=new Set(this.inputKeys),i=new Set(e),a=y(t,i);if(a.size>0)throw new Error(`The following keys: ${l(a)} are overlapping between memory and input keys of the chain variables. This can lead to unexpected behaviour. Please use input and memory keys that don't overlap.`);const n=d(t,i);for(const r of this.chains){let s=h(new Set(r.inputKeys),n);if(r.memory&&(s=h(s,new Set(r.memory.memoryKeys))),s.size>0)throw new Error(`Missing variables for chain "${r._chainType()}": ${l(s)}. Only got the following variables: ${l(n)}.`);const u=new Set(r.outputKeys),p=y(n,u);if(p.size>0)throw new Error(`The following output variables for chain "${r._chainType()}" are overlapping: ${l(p)}. This can lead to unexpected behaviour.`);for(const m of u)n.add(m)}if(this.outputVariables.length===0)if(this.returnAll){const r=h(n,t);this.outputVariables=Array.from(r)}else this.outputVariables=this.chains[this.chains.length-1].outputKeys;else{const r=h(new Set(this.outputVariables),new Set(n));if(r.size>0)throw new Error(`The following output variables were expected to be in the final chain output but were not found: ${l(r)}.`)}}async _call(e,t){let i={};const a=e;let n=0;for(const s of this.chains){n+=1,i=await s.call(a,t?.getChild(`step_${n}`));for(const u of Object.keys(i))a[u]=i[u]}const r={};for(const s of this.outputVariables)r[s]=a[s];return r}_chainType(){return"sequential_chain"}static async deserialize(e){const t=[],i=e.input_variables,a=e.output_variables,n=e.chains;for(const r of n){const s=await c.deserialize(r);t.push(s)}return new f({chains:t,inputVariables:i,outputVariables:a})}serialize(){const e=[];for(const t of this.chains)e.push(t.serialize());return{_type:this._chainType(),input_variables:this.inputVariables,output_variables:this.outputVariables,chains:e}}}class b extends c{static lc_name(){return"SimpleSequentialChain"}get inputKeys(){return[this.inputKey]}get outputKeys(){return[this.outputKey]}constructor(e){super(e),Object.defineProperty(this,"chains",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"input"}),Object.defineProperty(this,"outputKey",{enumerable:!0,configurable:!0,writable:!0,value:"output"}),Object.defineProperty(this,"trimOutputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.chains=e.chains,this.trimOutputs=e.trimOutputs??!1,this._validateChains()}_validateChains(){for(const e of this.chains){if(e.inputKeys.filter(t=>!e.memory?.memoryKeys.includes(t)).length!==1)throw new Error(`Chains used in SimpleSequentialChain should all have one input, got ${e.inputKeys.length} for ${e._chainType()}.`);if(e.outputKeys.length!==1)throw new Error(`Chains used in SimpleSequentialChain should all have one output, got ${e.outputKeys.length} for ${e._chainType()}.`)}}async _call(e,t){let i=e[this.inputKey],a=0;for(const n of this.chains)a+=1,i=(await n.call({[n.inputKeys[0]]:i,signal:e.signal},t?.getChild(`step_${a}`)))[n.outputKeys[0]],this.trimOutputs&&(i=i.trim()),await t?.handleText(i);return{[this.outputKey]:i}}_chainType(){return"simple_sequential_chain"}static async deserialize(e){const t=[],i=e.chains;for(const a of i){const n=await c.deserialize(a);t.push(n)}return new b({chains:t})}serialize(){const e=[];for(const t of this.chains)e.push(t.serialize());return{_type:this._chainType(),chains:e}}}export{f as SequentialChain,b as SimpleSequentialChain};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as un,P as X,p as qe,v as L,a as zt,b as kr,g as ue,c as cn,d as ln,e as We,_ as dn,$ as hn,t as Gt,z as fn,f as Ge,h as pn,T as mn}from"./zodToJsonSchema-
|
|
1
|
+
import{s as un,P as X,p as qe,v as L,a as zt,b as kr,g as ue,c as cn,d as ln,e as We,_ as dn,$ as hn,t as Gt,z as fn,f as Ge,h as pn,T as mn}from"./zodToJsonSchema-Qxfd2wnD.js";import{a as Jt,o as gn,s as _n}from"./index-B7rBD_6O.js";function Cs(a,e=Rr){a=a.trim();const t=a.indexOf("```");if(t===-1)return e(a);let r=a.substring(t+3);r.startsWith(`json
|
|
2
2
|
`)?r=r.substring(5):r.startsWith("json")?r=r.substring(4):r.startsWith(`
|
|
3
3
|
`)&&(r=r.substring(1));const n=r.indexOf("```");let i=r;return n!==-1&&(i=r.substring(0,n)),e(i.trim())}function Rr(a){if(typeof a>"u")return null;try{return JSON.parse(a)}catch{}let e="";const t=[];let r=!1,n=!1;for(let i of a){if(r)i==='"'&&!n?r=!1:i===`
|
|
4
4
|
`&&!n?i="\\n":i==="\\"?n=!n:n=!1;else if(i==='"')r=!0,n=!1;else if(i==="{")t.push("}");else if(i==="[")t.push("]");else if(i==="}"||i==="]")if(t&&t[t.length-1]===i)t.pop();else return null;e+=i}r&&(e+='"');for(let i=t.length-1;i>=0;i-=1)e+=t[i];try{return JSON.parse(e)}catch{return null}}function bn(a,e){return e?.[a]||un(a)}function yn(a,e,t){const r={};for(const n in a)Object.hasOwn(a,n)&&(r[e(n,t)]=a[n]);return r}function qt(a){return Array.isArray(a)?[...a]:{...a}}function wn(a,e){const t=qt(a);for(const[r,n]of Object.entries(e)){const[i,...s]=r.split(".").reverse();let o=t;for(const u of s.reverse()){if(o[u]===void 0)break;o[u]=qt(o[u]),o=o[u]}o[i]!==void 0&&(o[i]={lc:1,type:"secret",id:[n]})}return t}function xr(a){const e=Object.getPrototypeOf(a);return typeof a.lc_name=="function"&&(typeof e.lc_name!="function"||a.lc_name()!==e.lc_name())?a.lc_name():a.name}class de{static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,xr(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(e,...t){Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lc_kwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([r])=>this.lc_serializable_keys?.includes(r))):this.lc_kwargs=e??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof de||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();const e={},t={},r=Object.keys(this.lc_kwargs).reduce((n,i)=>(n[i]=i in this?this[i]:this.lc_kwargs[i],n),{});for(let n=Object.getPrototypeOf(this);n;n=Object.getPrototypeOf(n))Object.assign(e,Reflect.get(n,"lc_aliases",this)),Object.assign(t,Reflect.get(n,"lc_secrets",this)),Object.assign(r,Reflect.get(n,"lc_attributes",this));return Object.keys(t).forEach(n=>{let i=this,s=r;const[o,...u]=n.split(".").reverse();for(const c of u.reverse()){if(!(c in i)||i[c]===void 0)return;(!(c in s)||s[c]===void 0)&&(typeof i[c]=="object"&&i[c]!=null?s[c]={}:Array.isArray(i[c])&&(s[c]=[])),i=i[c],s=s[c]}o in i&&i[o]!==void 0&&(s[o]=s[o]||i[o])}),{lc:1,type:"constructor",id:this.lc_id,kwargs:yn(Object.keys(t).length?wn(r,t):r,bn,e)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}}function Re(a){return typeof a=="object"&&a!==null&&"type"in a&&typeof a.type=="string"&&"source_type"in a&&(a.source_type==="url"||a.source_type==="base64"||a.source_type==="text"||a.source_type==="id")}function vn(a){return Re(a)&&a.source_type==="url"&&"url"in a&&typeof a.url=="string"}function En(a){return Re(a)&&a.source_type==="base64"&&"data"in a&&typeof a.data=="string"}function Sn(a){if(Re(a)){if(a.source_type==="url")return{type:"image_url",image_url:{url:a.url}};if(a.source_type==="base64"){if(!a.mime_type)throw new Error("mime_type key is required for base64 data.");return{type:"image_url",image_url:{url:`data:${a.mime_type};base64,${a.data}`}}}}throw new Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function js(a){const e=a.split(";")[0].split("/");if(e.length!==2)throw new Error(`Invalid mime type: "${a}" - does not match type/subtype format.`);const t=e[0].trim(),r=e[1].trim();if(t===""||r==="")throw new Error(`Invalid mime type: "${a}" - type or subtype is empty.`);const n={};for(const i of a.split(";").slice(1)){const s=i.split("=");if(s.length!==2)throw new Error(`Invalid parameter syntax in mime type: "${a}".`);const o=s[0].trim(),u=s[1].trim();if(o==="")throw new Error(`Invalid parameter syntax in mime type: "${a}".`);n[o]=u}return{type:t,subtype:r,parameters:n}}function Ns({dataUrl:a,asTypedArray:e=!1}){const t=a.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/);let r;if(t){r=t[1].toLowerCase();const n=e?Uint8Array.from(atob(t[2]),i=>i.charCodeAt(0)):t[2];return{mime_type:r,data:n}}}function $s(a,e){if(a.type==="text"){if(!e.fromStandardTextBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardTextBlock\` method.`);return e.fromStandardTextBlock(a)}if(a.type==="image"){if(!e.fromStandardImageBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardImageBlock\` method.`);return e.fromStandardImageBlock(a)}if(a.type==="audio"){if(!e.fromStandardAudioBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardAudioBlock\` method.`);return e.fromStandardAudioBlock(a)}if(a.type==="file"){if(!e.fromStandardFileBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardFileBlock\` method.`);return e.fromStandardFileBlock(a)}throw new Error(`Unable to convert content block type '${a.type}' to provider-specific format: not recognized.`)}function be(a,e){return typeof a=="string"?a===""?e:typeof e=="string"?a+e:Array.isArray(e)&&e.some(t=>Re(t))?[{type:"text",source_type:"text",text:a},...e]:[{type:"text",text:a},...e]:Array.isArray(e)?et(a,e)??[...a,...e]:e===""?a:Array.isArray(a)&&a.some(t=>Re(t))?[...a,{type:"file",source_type:"text",text:e}]:[...a,{type:"text",text:e}]}function On(a,e){return a==="error"||e==="error"?"error":"success"}function Tn(a,e){function t(r,n){if(typeof r!="object"||r===null||r===void 0)return r;if(n>=e)return Array.isArray(r)?"[Array]":"[Object]";if(Array.isArray(r))return r.map(s=>t(s,n+1));const i={};for(const s of Object.keys(r))i[s]=t(r[s],n+1);return i}return JSON.stringify(t(a,0),null,2)}class he extends de{get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}get text(){return typeof this.content=="string"?this.content:Array.isArray(this.content)?this.content.map(e=>typeof e=="string"?e:e.type==="text"?e.text:"").join(""):""}getType(){return this._getType()}constructor(e,t){typeof e=="string"&&(e={content:e,additional_kwargs:t,response_metadata:{}}),e.additional_kwargs||(e.additional_kwargs={}),e.response_metadata||(e.response_metadata={}),super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","messages"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"additional_kwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"response_metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.content=e.content,this.additional_kwargs=e.additional_kwargs,this.response_metadata=e.response_metadata,this.id=e.id}toDict(){return{type:this._getType(),data:this.toJSON().kwargs}}static lc_name(){return"BaseMessage"}get _printableFields(){return{id:this.id,content:this.content,name:this.name,additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata}}_updateId(e){this.id=e,this.lc_kwargs.id=e}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](e){if(e===null)return this;const t=Tn(this._printableFields,Math.max(4,e));return`${this.constructor.lc_name()} ${t}`}}function M(a,e){const t={...a};for(const[r,n]of Object.entries(e))if(t[r]==null)t[r]=n;else{if(n==null)continue;if(typeof t[r]!=typeof n||Array.isArray(t[r])!==Array.isArray(n))throw new Error(`field[${r}] already exists in the message chunk, but with a different type.`);if(typeof t[r]=="string"){if(r==="type")continue;["id","name","output_version","model_provider"].includes(r)?t[r]=n:t[r]+=n}else if(typeof t[r]=="object"&&!Array.isArray(t[r]))t[r]=M(t[r],n);else if(Array.isArray(t[r]))t[r]=et(t[r],n);else{if(t[r]===n)continue;console.warn(`field[${r}] already exists in this message chunk and value has unsupported type.`)}}return t}function et(a,e){if(!(a===void 0&&e===void 0)){if(a===void 0||e===void 0)return a||e;{const t=[...a];for(const r of e)if(typeof r=="object"&&r!==null&&"index"in r&&typeof r.index=="number"){const n=t.findIndex(i=>{const s=typeof i=="object",o="index"in i&&i.index===r.index,u="id"in i&&"id"in r&&i?.id===r?.id,c=!("id"in i)||!i?.id||!("id"in r)||!r?.id;return s&&o&&(u||c)});n!==-1&&typeof t[n]=="object"&&t[n]!==null?t[n]=M(t[n],r):t.push(r)}else{if(typeof r=="object"&&r!==null&&"text"in r&&r.text==="")continue;t.push(r)}return t}}}function In(a,e){if(!a&&!e)throw new Error("Cannot merge two undefined objects.");if(!a||!e)return a||e;if(typeof a!=typeof e)throw new Error(`Cannot merge objects of different types.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{P as c,i as m,j as h,k as p,a as u}from"./langfuse-YA2S23SM-
|
|
1
|
+
import{P as c,i as m,j as h,k as p,a as u}from"./langfuse-YA2S23SM-CWG57icG.js";import{LLMChain as l}from"./llm_chain-DT3ghCCe.js";import{StuffDocumentsChain as b}from"./combine_docs_chain-Dy29TWun.js";import"./zodToJsonSchema-Qxfd2wnD.js";import"./index-B7rBD_6O.js";import"./deep-compare-strict-DtUHXpbW.js";import"./v4-BKrj-4V8.js";class d{async getPromptAsync(e,t){return this.getPrompt(e).partial(t?.partialVariables??{})}}class f extends d{constructor(e,t=[]){super(),Object.defineProperty(this,"defaultPrompt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"conditionals",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.defaultPrompt=e,this.conditionals=t}getPrompt(e){for(const[t,n]of this.conditionals)if(t(e))return n;return this.defaultPrompt}}function y(o){return o._modelType()==="base_chat_model"}const w=new c({template:`Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.
|
|
2
2
|
|
|
3
3
|
{context}
|
|
4
4
|
|