@iflow-ai/iflow-cli 0.3.21-beta.2 → 0.3.21
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/bundle/iflow.js +6 -6
- package/package.json +1 -1
package/bundle/iflow.js
CHANGED
|
@@ -444,9 +444,9 @@ ${a}`.trim()}_serializeSingularDataPoint(e,r,n){let i="";e=LAt(e,r);let{value:o,
|
|
|
444
444
|
${i}
|
|
445
445
|
${o}
|
|
446
446
|
`}};SIe.PrometheusSerializer=UAt});var aIr=w(wIe=>{"use strict";Object.defineProperty(wIe,"__esModule",{value:!0});wIe.PrometheusExporter=void 0;var jfe=(Kt(),yt(ar)),Mro=oi(),qAt=Dx(),Lro=Ae("http"),Fro=QAt(),Uro=Ae("url"),HAt=class t extends qAt.MetricReader{static DEFAULT_OPTIONS={host:void 0,port:9464,endpoint:"/metrics",prefix:"",appendTimestamp:!1,withResourceConstantLabels:void 0};_host;_port;_baseUrl;_endpoint;_server;_prefix;_appendTimestamp;_serializer;_startServerPromise;constructor(e={},r=()=>{}){super({aggregationSelector:i=>({type:qAt.AggregationType.DEFAULT}),aggregationTemporalitySelector:i=>qAt.AggregationTemporality.CUMULATIVE,metricProducers:e.metricProducers}),this._host=e.host||process.env.OTEL_EXPORTER_PROMETHEUS_HOST||t.DEFAULT_OPTIONS.host,this._port=e.port||Number(process.env.OTEL_EXPORTER_PROMETHEUS_PORT)||t.DEFAULT_OPTIONS.port,this._prefix=e.prefix||t.DEFAULT_OPTIONS.prefix,this._appendTimestamp=typeof e.appendTimestamp=="boolean"?e.appendTimestamp:t.DEFAULT_OPTIONS.appendTimestamp;let n=e.withResourceConstantLabels||t.DEFAULT_OPTIONS.withResourceConstantLabels;this._server=(0,Lro.createServer)(this._requestHandler).unref(),this._serializer=new Fro.PrometheusSerializer(this._prefix,this._appendTimestamp,n),this._baseUrl=`http://${this._host}:${this._port}/`,this._endpoint=(e.endpoint||t.DEFAULT_OPTIONS.endpoint).replace(/^([^/])/,"/$1"),e.preventServerStart!==!0?this.startServer().then(r,i=>{jfe.diag.error(i),r(i)}):r&&queueMicrotask(r)}async onForceFlush(){}onShutdown(){return this.stopServer()}stopServer(){return this._server?new Promise(e=>{this._server.close(r=>{r?r.code!=="ERR_SERVER_NOT_RUNNING"&&(0,Mro.globalErrorHandler)(r):jfe.diag.debug("Prometheus exporter was stopped"),e()})}):(jfe.diag.debug("Prometheus stopServer() was called but server was never started."),Promise.resolve())}startServer(){return this._startServerPromise??=new Promise((e,r)=>{this._server.once("error",r),this._server.listen({port:this._port,host:this._host},()=>{jfe.diag.debug(`Prometheus exporter server started: ${this._host}:${this._port}/${this._endpoint}`),e()})}),this._startServerPromise}getMetricsRequestHandler(e,r){this._exportMetrics(r)}_requestHandler=(e,r)=>{e.url!=null&&new Uro.URL(e.url,this._baseUrl).pathname===this._endpoint?this._exportMetrics(r):this._notFound(r)};_exportMetrics=e=>{e.statusCode=200,e.setHeader("content-type","text/plain"),this.collect().then(r=>{let{resourceMetrics:n,errors:i}=r;i.length&&jfe.diag.error("PrometheusExporter: metrics collection errors",...i),e.end(this._serializer.serialize(n))},r=>{e.end(`# failed to export metrics: ${r}`)})};_notFound=e=>{e.statusCode=404,e.end()}};wIe.PrometheusExporter=HAt});var cIr=w(EK=>{"use strict";Object.defineProperty(EK,"__esModule",{value:!0});EK.PrometheusSerializer=EK.PrometheusExporter=void 0;var Qro=aIr();Object.defineProperty(EK,"PrometheusExporter",{enumerable:!0,get:function(){return Qro.PrometheusExporter}});var qro=QAt();Object.defineProperty(EK,"PrometheusSerializer",{enumerable:!0,get:function(){return qro.PrometheusSerializer}})});var lIr=w(TIe=>{"use strict";Object.defineProperty(TIe,"__esModule",{value:!0});TIe.VERSION=void 0;TIe.VERSION="0.206.0"});var dIr=w(IIe=>{"use strict";Object.defineProperty(IIe,"__esModule",{value:!0});IIe.OTLPTraceExporter=void 0;var Hro=(vx(),yt(Ex)),Gro=lIr(),jro=Nx(),uIr=(K9(),yt(MR)),GAt=class extends Hro.OTLPExporterBase{constructor(e={}){super((0,uIr.createOtlpHttpExportDelegate)((0,uIr.convertLegacyHttpOptions)(e,"TRACES","v1/traces",{"User-Agent":`OTel-OTLP-Exporter-JavaScript/${Gro.VERSION}`,"Content-Type":"application/json"}),jro.JsonTraceSerializer))}};IIe.OTLPTraceExporter=GAt});var fIr=w(DIe=>{"use strict";Object.defineProperty(DIe,"__esModule",{value:!0});DIe.OTLPTraceExporter=void 0;var Vro=dIr();Object.defineProperty(DIe,"OTLPTraceExporter",{enumerable:!0,get:function(){return Vro.OTLPTraceExporter}})});var pIr=w(RIe=>{"use strict";Object.defineProperty(RIe,"__esModule",{value:!0});RIe.OTLPTraceExporter=void 0;var $ro=fIr();Object.defineProperty(RIe,"OTLPTraceExporter",{enumerable:!0,get:function(){return $ro.OTLPTraceExporter}})});var hIr=w(BIe=>{"use strict";Object.defineProperty(BIe,"__esModule",{value:!0});BIe.OTLPTraceExporter=void 0;var Wro=pIr();Object.defineProperty(BIe,"OTLPTraceExporter",{enumerable:!0,get:function(){return Wro.OTLPTraceExporter}})});var gIr=w(NIe=>{"use strict";Object.defineProperty(NIe,"__esModule",{value:!0});NIe.OTLPTraceExporter=void 0;var mIr=pIe(),zro=Nx(),Yro=(vx(),yt(Ex)),jAt=class extends Yro.OTLPExporterBase{constructor(e={}){super((0,mIr.createOtlpGrpcExportDelegate)((0,mIr.convertLegacyOtlpGrpcOptions)(e,"TRACES"),zro.ProtobufTraceSerializer,"TraceExportService","/opentelemetry.proto.collector.trace.v1.TraceService/Export"))}};NIe.OTLPTraceExporter=jAt});var AIr=w(OIe=>{"use strict";Object.defineProperty(OIe,"__esModule",{value:!0});OIe.OTLPTraceExporter=void 0;var Kro=gIr();Object.defineProperty(OIe,"OTLPTraceExporter",{enumerable:!0,get:function(){return Kro.OTLPTraceExporter}})});var yIr=w(PIe=>{"use strict";Object.defineProperty(PIe,"__esModule",{value:!0});PIe.prepareSend=void 0;var VAt=(Kt(),yt(ar)),kIe=oi(),Jro=Ae("http"),Xro=Ae("https");function Zro(t,e){let r=new URL(t),n=Object.assign({method:"POST",headers:{"Content-Type":"application/json",...e}});return function(o,s){if(o.length===0)return VAt.diag.debug("Zipkin send with empty spans"),s({code:kIe.ExportResultCode.SUCCESS});let{request:a}=r.protocol==="http:"?Jro:Xro,c=a(r,n,d=>{let f="";d.on("data",p=>{f+=p}),d.on("end",()=>{let p=d.statusCode||0;return VAt.diag.debug(`Zipkin response status code: ${p}, body: ${f}`),p<400?s({code:kIe.ExportResultCode.SUCCESS}):s({code:kIe.ExportResultCode.FAILED,error:new Error(`Got unexpected status code from zipkin: ${p}`)})})});c.on("error",d=>s({code:kIe.ExportResultCode.FAILED,error:d}));let u=JSON.stringify(o);VAt.diag.debug(`Zipkin request payload: ${u}`),c.write(u,"utf8"),c.end()}}PIe.prepareSend=Zro});var EIr=w(MIe=>{"use strict";Object.defineProperty(MIe,"__esModule",{value:!0});MIe.prepareSend=void 0;var eno=yIr();Object.defineProperty(MIe,"prepareSend",{enumerable:!0,get:function(){return eno.prepareSend}})});var $At=w(LIe=>{"use strict";Object.defineProperty(LIe,"__esModule",{value:!0});LIe.prepareSend=void 0;var tno=EIr();Object.defineProperty(LIe,"prepareSend",{enumerable:!0,get:function(){return tno.prepareSend}})});var vIr=w(Vfe=>{"use strict";Object.defineProperty(Vfe,"__esModule",{value:!0});Vfe.SpanKind=void 0;var rno;(function(t){t.CLIENT="CLIENT",t.SERVER="SERVER",t.CONSUMER="CONSUMER",t.PRODUCER="PRODUCER"})(rno=Vfe.SpanKind||(Vfe.SpanKind={}))});var _Ir=w(Uv=>{"use strict";Object.defineProperty(Uv,"__esModule",{value:!0});Uv._toZipkinAnnotations=Uv._toZipkinTags=Uv.toZipkinSpan=Uv.defaultStatusErrorTagName=Uv.defaultStatusCodeTagName=void 0;var iB=(Kt(),yt(ar)),WAt=oi(),FIe=vIr(),nno={[iB.SpanKind.CLIENT]:FIe.SpanKind.CLIENT,[iB.SpanKind.SERVER]:FIe.SpanKind.SERVER,[iB.SpanKind.CONSUMER]:FIe.SpanKind.CONSUMER,[iB.SpanKind.PRODUCER]:FIe.SpanKind.PRODUCER,[iB.SpanKind.INTERNAL]:void 0};Uv.defaultStatusCodeTagName="otel.status_code";Uv.defaultStatusErrorTagName="error";function ino(t,e,r,n){return{traceId:t.spanContext().traceId,parentId:t.parentSpanContext?.spanId,name:t.name,id:t.spanContext().spanId,kind:nno[t.kind],timestamp:(0,WAt.hrTimeToMicroseconds)(t.startTime),duration:Math.round((0,WAt.hrTimeToMicroseconds)(t.duration)),localEndpoint:{serviceName:e},tags:bIr(t,r,n),annotations:t.events.length?CIr(t.events):void 0}}Uv.toZipkinSpan=ino;function bIr({attributes:t,resource:e,status:r,droppedAttributesCount:n,droppedEventsCount:i,droppedLinksCount:o},s,a){let c={};for(let u of Object.keys(t))c[u]=String(t[u]);return r.code!==iB.SpanStatusCode.UNSET&&(c[s]=String(iB.SpanStatusCode[r.code])),r.code===iB.SpanStatusCode.ERROR&&r.message&&(c[a]=r.message),n&&(c["otel.dropped_attributes_count"]=String(n)),i&&(c["otel.dropped_events_count"]=String(i)),o&&(c["otel.dropped_links_count"]=String(o)),Object.keys(e.attributes).forEach(u=>c[u]=String(e.attributes[u])),c}Uv._toZipkinTags=bIr;function CIr(t){return t.map(e=>({timestamp:Math.round((0,WAt.hrTimeToMicroseconds)(e.time)),value:e.name}))}Uv._toZipkinAnnotations=CIr});var xIr=w(UIe=>{"use strict";Object.defineProperty(UIe,"__esModule",{value:!0});UIe.prepareGetHeaders=void 0;function ono(t){return function(){return t()}}UIe.prepareGetHeaders=ono});var IIr=w(QIe=>{"use strict";Object.defineProperty(QIe,"__esModule",{value:!0});QIe.ZipkinExporter=void 0;var SIr=(Kt(),yt(ar)),wIr=oi(),TIr=$At(),zAt=_Ir(),YAt=(Nh(),yt(l2)),sno=xIr(),KAt=class{DEFAULT_SERVICE_NAME="OpenTelemetry Service";_statusCodeTagName;_statusDescriptionTagName;_urlStr;_send;_getHeaders;_serviceName;_isShutdown;_sendingPromises=[];constructor(e={}){this._urlStr=e.url||((0,wIr.getStringFromEnv)("OTEL_EXPORTER_ZIPKIN_ENDPOINT")??"http://localhost:9411/api/v2/spans"),this._send=(0,TIr.prepareSend)(this._urlStr,e.headers),this._serviceName=e.serviceName,this._statusCodeTagName=e.statusCodeTagName||zAt.defaultStatusCodeTagName,this._statusDescriptionTagName=e.statusDescriptionTagName||zAt.defaultStatusErrorTagName,this._isShutdown=!1,typeof e.getExportRequestHeaders=="function"?this._getHeaders=(0,sno.prepareGetHeaders)(e.getExportRequestHeaders):this._beforeSend=function(){}}export(e,r){let n=String(this._serviceName||e[0].resource.attributes[YAt.ATTR_SERVICE_NAME]||this.DEFAULT_SERVICE_NAME);if(SIr.diag.debug("Zipkin exporter export"),this._isShutdown){setTimeout(()=>r({code:wIr.ExportResultCode.FAILED,error:new Error("Exporter has been shutdown")}));return}let i=new Promise(s=>{this._sendSpans(e,n,a=>{s(),r(a)})});this._sendingPromises.push(i);let o=()=>{let s=this._sendingPromises.indexOf(i);this._sendingPromises.splice(s,1)};i.then(o,o)}shutdown(){return SIr.diag.debug("Zipkin exporter shutdown"),this._isShutdown=!0,this.forceFlush()}forceFlush(){return new Promise((e,r)=>{Promise.all(this._sendingPromises).then(()=>{e()},r)})}_beforeSend(){this._getHeaders&&(this._send=(0,TIr.prepareSend)(this._urlStr,this._getHeaders()))}_sendSpans(e,r,n){let i=e.map(o=>(0,zAt.toZipkinSpan)(o,String(o.attributes[YAt.ATTR_SERVICE_NAME]||o.resource.attributes[YAt.ATTR_SERVICE_NAME]||r),this._statusCodeTagName,this._statusDescriptionTagName));return this._beforeSend(),this._send(i,o=>{if(n)return n(o)})}};QIe.ZipkinExporter=KAt});var DIr=w(vK=>{"use strict";Object.defineProperty(vK,"__esModule",{value:!0});vK.ZipkinExporter=vK.prepareSend=void 0;var ano=$At();Object.defineProperty(vK,"prepareSend",{enumerable:!0,get:function(){return ano.prepareSend}});var cno=IIr();Object.defineProperty(vK,"ZipkinExporter",{enumerable:!0,get:function(){return cno.ZipkinExporter}})});var JAt=w(qIe=>{"use strict";Object.defineProperty(qIe,"__esModule",{value:!0});qIe.B3_DEBUG_FLAG_KEY=void 0;var lno=(Kt(),yt(ar));qIe.B3_DEBUG_FLAG_KEY=(0,lno.createContextKey)("OpenTelemetry Context Key B3 Debug Flag")});var $fe=w(S3=>{"use strict";Object.defineProperty(S3,"__esModule",{value:!0});S3.X_B3_FLAGS=S3.X_B3_PARENT_SPAN_ID=S3.X_B3_SAMPLED=S3.X_B3_SPAN_ID=S3.X_B3_TRACE_ID=S3.B3_CONTEXT_HEADER=void 0;S3.B3_CONTEXT_HEADER="b3";S3.X_B3_TRACE_ID="x-b3-traceid";S3.X_B3_SPAN_ID="x-b3-spanid";S3.X_B3_SAMPLED="x-b3-sampled";S3.X_B3_PARENT_SPAN_ID="x-b3-parentspanid";S3.X_B3_FLAGS="x-b3-flags"});var NIr=w(GIe=>{"use strict";Object.defineProperty(GIe,"__esModule",{value:!0});GIe.B3MultiPropagator=void 0;var zC=(Kt(),yt(ar)),uno=oi(),RIr=JAt(),pE=$fe(),dno=new Set([!0,"true","True","1",1]),fno=new Set([!1,"false","False","0",0]);function pno(t){return t===zC.TraceFlags.SAMPLED||t===zC.TraceFlags.NONE}function hno(t){return Array.isArray(t)?t[0]:t}function HIe(t,e,r){let n=e.get(t,r);return hno(n)}function mno(t,e){let r=HIe(t,e,pE.X_B3_TRACE_ID);return typeof r=="string"?r.padStart(32,"0"):""}function gno(t,e){let r=HIe(t,e,pE.X_B3_SPAN_ID);return typeof r=="string"?r:""}function BIr(t,e){return HIe(t,e,pE.X_B3_FLAGS)==="1"?"1":void 0}function Ano(t,e){let r=HIe(t,e,pE.X_B3_SAMPLED);if(BIr(t,e)==="1"||dno.has(r))return zC.TraceFlags.SAMPLED;if(r===void 0||fno.has(r))return zC.TraceFlags.NONE}var XAt=class{inject(e,r,n){let i=zC.trace.getSpanContext(e);if(!i||!(0,zC.isSpanContextValid)(i)||(0,uno.isTracingSuppressed)(e))return;let o=e.getValue(RIr.B3_DEBUG_FLAG_KEY);n.set(r,pE.X_B3_TRACE_ID,i.traceId),n.set(r,pE.X_B3_SPAN_ID,i.spanId),o==="1"?n.set(r,pE.X_B3_FLAGS,o):i.traceFlags!==void 0&&n.set(r,pE.X_B3_SAMPLED,(zC.TraceFlags.SAMPLED&i.traceFlags)===zC.TraceFlags.SAMPLED?"1":"0")}extract(e,r,n){let i=mno(r,n),o=gno(r,n),s=Ano(r,n),a=BIr(r,n);return(0,zC.isValidTraceId)(i)&&(0,zC.isValidSpanId)(o)&&pno(s)?(e=e.setValue(RIr.B3_DEBUG_FLAG_KEY,a),zC.trace.setSpanContext(e,{traceId:i,spanId:o,isRemote:!0,traceFlags:s})):e}fields(){return[pE.X_B3_TRACE_ID,pE.X_B3_SPAN_ID,pE.X_B3_FLAGS,pE.X_B3_SAMPLED,pE.X_B3_PARENT_SPAN_ID]}};GIe.B3MultiPropagator=XAt});var kIr=w(jIe=>{"use strict";Object.defineProperty(jIe,"__esModule",{value:!0});jIe.B3SinglePropagator=void 0;var vF=(Kt(),yt(ar)),yno=oi(),OIr=JAt(),ZAt=$fe(),Eno=/((?:[0-9a-f]{16}){1,2})-([0-9a-f]{16})(?:-([01d](?![0-9a-f])))?(?:-([0-9a-f]{16}))?/,vno="0".repeat(16),bno=new Set(["d","1"]),Cno="d";function _no(t){return t.length===32?t:`${vno}${t}`}function xno(t){return t&&bno.has(t)?vF.TraceFlags.SAMPLED:vF.TraceFlags.NONE}var e3t=class{inject(e,r,n){let i=vF.trace.getSpanContext(e);if(!i||!(0,vF.isSpanContextValid)(i)||(0,yno.isTracingSuppressed)(e))return;let o=e.getValue(OIr.B3_DEBUG_FLAG_KEY)||i.traceFlags&1,s=`${i.traceId}-${i.spanId}-${o}`;n.set(r,ZAt.B3_CONTEXT_HEADER,s)}extract(e,r,n){let i=n.get(r,ZAt.B3_CONTEXT_HEADER),o=Array.isArray(i)?i[0]:i;if(typeof o!="string")return e;let s=o.match(Eno);if(!s)return e;let[,a,c,u]=s,d=_no(a);if(!(0,vF.isValidTraceId)(d)||!(0,vF.isValidSpanId)(c))return e;let f=xno(u);return u===Cno&&(e=e.setValue(OIr.B3_DEBUG_FLAG_KEY,u)),vF.trace.setSpanContext(e,{traceId:d,spanId:c,isRemote:!0,traceFlags:f})}fields(){return[ZAt.B3_CONTEXT_HEADER]}};jIe.B3SinglePropagator=e3t});var t3t=w(Wfe=>{"use strict";Object.defineProperty(Wfe,"__esModule",{value:!0});Wfe.B3InjectEncoding=void 0;var Sno;(function(t){t[t.SINGLE_HEADER=0]="SINGLE_HEADER",t[t.MULTI_HEADER=1]="MULTI_HEADER"})(Sno=Wfe.B3InjectEncoding||(Wfe.B3InjectEncoding={}))});var PIr=w(VIe=>{"use strict";Object.defineProperty(VIe,"__esModule",{value:!0});VIe.B3Propagator=void 0;var wno=oi(),Tno=NIr(),Ino=kIr(),Dno=$fe(),Rno=t3t(),r3t=class{_b3MultiPropagator=new Tno.B3MultiPropagator;_b3SinglePropagator=new Ino.B3SinglePropagator;_inject;_fields;constructor(e={}){e.injectEncoding===Rno.B3InjectEncoding.MULTI_HEADER?(this._inject=this._b3MultiPropagator.inject,this._fields=this._b3MultiPropagator.fields()):(this._inject=this._b3SinglePropagator.inject,this._fields=this._b3SinglePropagator.fields())}inject(e,r,n){(0,wno.isTracingSuppressed)(e)||this._inject(e,r,n)}extract(e,r,n){let i=n.get(r,Dno.B3_CONTEXT_HEADER);return(Array.isArray(i)?i[0]:i)?this._b3SinglePropagator.extract(e,r,n):this._b3MultiPropagator.extract(e,r,n)}fields(){return this._fields}};VIe.B3Propagator=r3t});var MIr=w(Fm=>{"use strict";Object.defineProperty(Fm,"__esModule",{value:!0});Fm.B3InjectEncoding=Fm.X_B3_TRACE_ID=Fm.X_B3_SPAN_ID=Fm.X_B3_SAMPLED=Fm.X_B3_PARENT_SPAN_ID=Fm.X_B3_FLAGS=Fm.B3_CONTEXT_HEADER=Fm.B3Propagator=void 0;var Bno=PIr();Object.defineProperty(Fm,"B3Propagator",{enumerable:!0,get:function(){return Bno.B3Propagator}});var bK=$fe();Object.defineProperty(Fm,"B3_CONTEXT_HEADER",{enumerable:!0,get:function(){return bK.B3_CONTEXT_HEADER}});Object.defineProperty(Fm,"X_B3_FLAGS",{enumerable:!0,get:function(){return bK.X_B3_FLAGS}});Object.defineProperty(Fm,"X_B3_PARENT_SPAN_ID",{enumerable:!0,get:function(){return bK.X_B3_PARENT_SPAN_ID}});Object.defineProperty(Fm,"X_B3_SAMPLED",{enumerable:!0,get:function(){return bK.X_B3_SAMPLED}});Object.defineProperty(Fm,"X_B3_SPAN_ID",{enumerable:!0,get:function(){return bK.X_B3_SPAN_ID}});Object.defineProperty(Fm,"X_B3_TRACE_ID",{enumerable:!0,get:function(){return bK.X_B3_TRACE_ID}});var Nno=t3t();Object.defineProperty(Fm,"B3InjectEncoding",{enumerable:!0,get:function(){return Nno.B3InjectEncoding}})});var LIr=w(YC=>{"use strict";Object.defineProperty(YC,"__esModule",{value:!0});YC.JaegerPropagator=YC.UBER_BAGGAGE_HEADER_PREFIX=YC.UBER_TRACE_ID_HEADER=void 0;var bF=(Kt(),yt(ar)),Ono=oi();YC.UBER_TRACE_ID_HEADER="uber-trace-id";YC.UBER_BAGGAGE_HEADER_PREFIX="uberctx";var n3t=class{_jaegerTraceHeader;_jaegerBaggageHeaderPrefix;constructor(e){typeof e=="string"?(this._jaegerTraceHeader=e,this._jaegerBaggageHeaderPrefix=YC.UBER_BAGGAGE_HEADER_PREFIX):(this._jaegerTraceHeader=e?.customTraceHeader||YC.UBER_TRACE_ID_HEADER,this._jaegerBaggageHeaderPrefix=e?.customBaggageHeaderPrefix||YC.UBER_BAGGAGE_HEADER_PREFIX)}inject(e,r,n){let i=bF.trace.getSpanContext(e),o=bF.propagation.getBaggage(e);if(i&&(0,Ono.isTracingSuppressed)(e)===!1){let s=`0${(i.traceFlags||bF.TraceFlags.NONE).toString(16)}`;n.set(r,this._jaegerTraceHeader,`${i.traceId}:${i.spanId}:0:${s}`)}if(o)for(let[s,a]of o.getAllEntries())n.set(r,`${this._jaegerBaggageHeaderPrefix}-${s}`,encodeURIComponent(a.value))}extract(e,r,n){let i=n.get(r,this._jaegerTraceHeader),o=Array.isArray(i)?i[0]:i,s=n.keys(r).filter(u=>u.startsWith(`${this._jaegerBaggageHeaderPrefix}-`)).map(u=>{let d=n.get(r,u);return{key:u.substring(this._jaegerBaggageHeaderPrefix.length+1),value:Array.isArray(d)?d[0]:d}}),a=e;if(typeof o=="string"){let u=Pno(o);u&&(a=bF.trace.setSpanContext(a,u))}if(s.length===0)return a;let c=bF.propagation.getBaggage(e)??bF.propagation.createBaggage();for(let u of s)u.value!==void 0&&(c=c.setEntry(u.key,{value:decodeURIComponent(u.value)}));return a=bF.propagation.setBaggage(a,c),a}fields(){return[this._jaegerTraceHeader]}};YC.JaegerPropagator=n3t;var kno=/^[0-9a-f]{1,2}$/i;function Pno(t){let e=decodeURIComponent(t).split(":");if(e.length!==4)return null;let[r,n,,i]=e,o=r.padStart(32,"0"),s=n.padStart(16,"0"),a=kno.test(i)?parseInt(i,16)&1:1;return{traceId:o,spanId:s,isRemote:!0,traceFlags:a}}});var FIr=w(oB=>{"use strict";Object.defineProperty(oB,"__esModule",{value:!0});oB.UBER_TRACE_ID_HEADER=oB.UBER_BAGGAGE_HEADER_PREFIX=oB.JaegerPropagator=void 0;var i3t=LIr();Object.defineProperty(oB,"JaegerPropagator",{enumerable:!0,get:function(){return i3t.JaegerPropagator}});Object.defineProperty(oB,"UBER_BAGGAGE_HEADER_PREFIX",{enumerable:!0,get:function(){return i3t.UBER_BAGGAGE_HEADER_PREFIX}});Object.defineProperty(oB,"UBER_TRACE_ID_HEADER",{enumerable:!0,get:function(){return i3t.UBER_TRACE_ID_HEADER}})});var HIr=w(Qv=>{"use strict";Object.defineProperty(Qv,"__esModule",{value:!0});Qv.getPropagatorFromEnv=Qv.getSpanProcessorsFromEnv=Qv.getOtlpProtocolFromEnv=Qv.filterBlanksAndNulls=Qv.getResourceDetectorsFromEnv=void 0;var sB=(Kt(),yt(ar)),aB=oi(),UIr=lht(),Mno=hIr(),Lno=AIr(),Fno=DIr(),zfe=hY(),$Ie=z9e(),o3t=MIr(),Uno=FIr(),Qno="env",qno="host",Hno="os",Gno="process",jno="serviceinstance";function Vno(){let t=new Map([[Qno,zfe.envDetector],[qno,zfe.hostDetector],[Hno,zfe.osDetector],[jno,zfe.serviceInstanceIdDetector],[Gno,zfe.processDetector]]),e=(0,aB.getStringListFromEnv)("OTEL_NODE_RESOURCE_DETECTORS")??["all"];return e.includes("all")?[...t.values()].flat():e.includes("none")?[]:e.flatMap(r=>{let n=t.get(r);return n||sB.diag.warn(`Invalid resource detector "${r}" specified in the environment variable OTEL_NODE_RESOURCE_DETECTORS`),n||[]})}Qv.getResourceDetectorsFromEnv=Vno;function QIr(t){return t.map(e=>e.trim()).filter(e=>e!=="null"&&e!=="")}Qv.filterBlanksAndNulls=QIr;function qIr(){return(0,aB.getStringFromEnv)("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL")??(0,aB.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL")??"http/protobuf"}Qv.getOtlpProtocolFromEnv=qIr;function $no(){let t=qIr();switch(t){case"grpc":return new Lno.OTLPTraceExporter;case"http/json":return new Mno.OTLPTraceExporter;case"http/protobuf":return new UIr.OTLPTraceExporter;default:return sB.diag.warn(`Unsupported OTLP traces protocol: ${t}. Using http/protobuf.`),new UIr.OTLPTraceExporter}}function Wno(){try{let{JaegerExporter:t}=Ae("@opentelemetry/exporter-jaeger");return new t}catch(t){throw new Error(`Could not instantiate JaegerExporter. This could be due to the JaegerExporter's lack of support for bundling. If possible, use @opentelemetry/exporter-trace-otlp-proto instead. Original Error: ${t}`)}}function zno(){let t=new Map([["otlp",()=>$no()],["zipkin",()=>new Fno.ZipkinExporter],["console",()=>new $Ie.ConsoleSpanExporter],["jaeger",()=>Wno()]]),e=[],r=[],n=QIr(Array.from(new Set((0,aB.getStringListFromEnv)("OTEL_TRACES_EXPORTER"))));if(n[0]==="none")return sB.diag.warn('OTEL_TRACES_EXPORTER contains "none". SDK will not be initialized.'),[];n.length===0?(sB.diag.debug("OTEL_TRACES_EXPORTER is empty. Using default otlp exporter."),n=["otlp"]):n.length>1&&n.includes("none")&&(sB.diag.warn('OTEL_TRACES_EXPORTER contains "none" along with other exporters. Using default otlp exporter.'),n=["otlp"]);for(let i of n){let o=t.get(i)?.();o?e.push(o):sB.diag.warn(`Unrecognized OTEL_TRACES_EXPORTER value: ${i}.`)}for(let i of e)i instanceof $Ie.ConsoleSpanExporter?r.push(new $Ie.SimpleSpanProcessor(i)):r.push(new $Ie.BatchSpanProcessor(i));return e.length===0&&sB.diag.warn("Unable to set up trace exporter(s) due to invalid exporter and/or protocol values."),r}Qv.getSpanProcessorsFromEnv=zno;function Yno(){let t=(0,aB.getStringListFromEnv)("OTEL_PROPAGATORS");if(t==null)return;let e=new Map([["tracecontext",()=>new aB.W3CTraceContextPropagator],["baggage",()=>new aB.W3CBaggagePropagator],["b3",()=>new o3t.B3Propagator],["b3multi",()=>new o3t.B3Propagator({injectEncoding:o3t.B3InjectEncoding.MULTI_HEADER})],["jaeger",()=>new Uno.JaegerPropagator]]),r=Array.from(new Set(t)),i=r.map(o=>{let s=e.get(o)?.();if(!s){sB.diag.warn(`Propagator "${o}" requested through environment variable is unavailable.`);return}return s}).reduce((o,s)=>(s&&o.push(s),o),[]);return i.length===0?null:r.length===1?i[0]:new aB.CompositePropagator({propagators:i})}Qv.getPropagatorFromEnv=Yno});var VIr=w(WIe=>{"use strict";Object.defineProperty(WIe,"__esModule",{value:!0});WIe.NodeSDK=void 0;var G1=(Kt(),yt(ar)),Kno=uY(),Jno=I8r(),CK=hY(),Yfe=zht(),Xno=Aht(),Zno=Y7r(),s3t=tIr(),eio=iIr(),GIr=mht(),tio=w8e(),rio=cIr(),CF=Dx(),nio=z9e(),iio=_9e(),oio=(Nh(),yt(l2)),cB=oi(),a3t=HIr();function jIr(t,e){return parseInt(process.env[t]||"")||e}function sio(){let t=[],e=(0,cB.getStringListFromEnv)("OTEL_METRICS_EXPORTER");return e?(e.length===0&&G1.diag.debug("OTEL_METRICS_EXPORTER is empty. Using default otlp exporter."),e.includes("none")?(G1.diag.info('OTEL_METRICS_EXPORTER contains "none". Metric provider will not be initialized.'),t):(e.forEach(r=>{if(r==="otlp"){let n=process.env.OTEL_EXPORTER_OTLP_METRICS_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),i=jIr("OTEL_METRIC_EXPORT_INTERVAL",6e4),o=jIr("OTEL_METRIC_EXPORT_TIMEOUT",3e4);switch(n){case"grpc":t.push(new CF.PeriodicExportingMetricReader({exporter:new eio.OTLPMetricExporter,exportIntervalMillis:i,exportTimeoutMillis:o}));break;case"http/json":t.push(new CF.PeriodicExportingMetricReader({exporter:new tio.OTLPMetricExporter,exportIntervalMillis:i,exportTimeoutMillis:o}));break;case"http/protobuf":t.push(new CF.PeriodicExportingMetricReader({exporter:new GIr.OTLPMetricExporter,exportIntervalMillis:i,exportTimeoutMillis:o}));break;default:G1.diag.warn(`Unsupported OTLP metrics protocol: "${n}". Using http/protobuf.`),t.push(new CF.PeriodicExportingMetricReader({exporter:new GIr.OTLPMetricExporter,exportIntervalMillis:i,exportTimeoutMillis:o}))}}else r==="console"?t.push(new CF.PeriodicExportingMetricReader({exporter:new CF.ConsoleMetricExporter})):r==="prometheus"?t.push(new rio.PrometheusExporter):G1.diag.warn(`Unsupported OTEL_METRICS_EXPORTER value: "${r}". Supported values are: otlp, console, prometheus, none.`)}),t)):t}var c3t=class{_tracerProviderConfig;_loggerProviderConfig;_meterProviderConfig;_instrumentations;_resource;_resourceDetectors;_autoDetectResources;_tracerProvider;_loggerProvider;_meterProvider;_serviceName;_configuration;_disabled;constructor(e={}){(0,cB.getBooleanFromEnv)("OTEL_SDK_DISABLED")&&(this._disabled=!0);let r=(0,cB.getStringFromEnv)("OTEL_LOG_LEVEL");if(r!=null&&G1.diag.setLogger(new G1.DiagConsoleLogger,{logLevel:(0,cB.diagLogLevelFromString)(r)}),this._configuration=e,this._resource=e.resource??(0,CK.defaultResource)(),this._autoDetectResources=e.autoDetectResources??!0,this._autoDetectResources?e.resourceDetectors!=null?this._resourceDetectors=e.resourceDetectors:(0,cB.getStringFromEnv)("OTEL_NODE_RESOURCE_DETECTORS")?this._resourceDetectors=(0,a3t.getResourceDetectorsFromEnv)():this._resourceDetectors=[CK.envDetector,CK.processDetector,CK.hostDetector]:this._resourceDetectors=[],this._serviceName=e.serviceName,e.traceExporter||e.spanProcessor||e.spanProcessors){let n={};e.sampler&&(n.sampler=e.sampler),e.spanLimits&&(n.spanLimits=e.spanLimits),e.idGenerator&&(n.idGenerator=e.idGenerator),e.spanProcessor&&G1.diag.warn("The 'spanProcessor' option is deprecated. Please use 'spanProcessors' instead.");let i=e.spanProcessor??new nio.BatchSpanProcessor(e.traceExporter),o=e.spanProcessors??[i];this._tracerProviderConfig={tracerConfig:n,spanProcessors:o,contextManager:e.contextManager,textMapPropagator:e.textMapPropagator}}if(e.logRecordProcessors?this._loggerProviderConfig={logRecordProcessors:e.logRecordProcessors}:e.logRecordProcessor?(this._loggerProviderConfig={logRecordProcessors:[e.logRecordProcessor]},G1.diag.warn("The 'logRecordProcessor' option is deprecated. Please use 'logRecordProcessors' instead.")):this.configureLoggerProviderFromEnv(),e.metricReaders||e.metricReader||e.views){let n={};e.metricReaders?n.readers=e.metricReaders:e.metricReader&&(n.readers=[e.metricReader],G1.diag.warn("The 'metricReader' option is deprecated. Please use 'metricReaders' instead.")),e.views&&(n.views=e.views),this._meterProviderConfig=n}this._instrumentations=e.instrumentations?.flat()??[]}start(){if(this._disabled)return;if((0,Jno.registerInstrumentations)({instrumentations:this._instrumentations}),this._autoDetectResources){let n={detectors:this._resourceDetectors};this._resource=this._resource.merge((0,CK.detectResources)(n))}this._resource=this._serviceName===void 0?this._resource:this._resource.merge((0,CK.resourceFromAttributes)({[oio.ATTR_SERVICE_NAME]:this._serviceName}));let e=this._tracerProviderConfig?this._tracerProviderConfig.spanProcessors:(0,a3t.getSpanProcessorsFromEnv)();if(this._tracerProvider=new iio.NodeTracerProvider({...this._configuration,resource:this._resource,spanProcessors:e}),e.length>0&&this._tracerProvider.register({contextManager:this._tracerProviderConfig?.contextManager??this._configuration?.contextManager,propagator:this._tracerProviderConfig?.textMapPropagator??(0,a3t.getPropagatorFromEnv)()}),this._loggerProviderConfig){let n=new Yfe.LoggerProvider({resource:this._resource,processors:this._loggerProviderConfig.logRecordProcessors});this._loggerProvider=n,Kno.logs.setGlobalLoggerProvider(n)}let r=sio();if(this._meterProviderConfig||r.length>0){let n=[];this._meterProviderConfig?.readers&&n.push(...this._meterProviderConfig.readers),n.length===0&&r.forEach(o=>n.push(o));let i=new CF.MeterProvider({resource:this._resource,views:this._meterProviderConfig?.views??[],readers:n});this._meterProvider=i,G1.metrics.setGlobalMeterProvider(i);for(let o of this._instrumentations)o.setMeterProvider(G1.metrics.getMeterProvider())}}shutdown(){let e=[];return this._tracerProvider&&e.push(this._tracerProvider.shutdown()),this._loggerProvider&&e.push(this._loggerProvider.shutdown()),this._meterProvider&&e.push(this._meterProvider.shutdown()),Promise.all(e).then(()=>{})}configureLoggerProviderFromEnv(){let e=(0,cB.getStringListFromEnv)("OTEL_LOGS_EXPORTER")??[];if(e.length===0&&(G1.diag.debug("OTEL_LOGS_EXPORTER is empty. Using default otlp exporter."),e.push("otlp")),e.includes("none")){G1.diag.info('OTEL_LOGS_EXPORTER contains "none". Logger provider will not be initialized.');return}let r=[];e.forEach(n=>{if(n==="otlp"){let i=((0,cB.getStringFromEnv)("OTEL_EXPORTER_OTLP_LOGS_PROTOCOL")??(0,cB.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL"))?.trim();switch(i){case"grpc":r.push(new Zno.OTLPLogExporter);break;case"http/json":r.push(new Xno.OTLPLogExporter);break;case"http/protobuf":r.push(new s3t.OTLPLogExporter);break;case void 0:case"":r.push(new s3t.OTLPLogExporter);break;default:G1.diag.warn(`Unsupported OTLP logs protocol: "${i}". Using http/protobuf.`),r.push(new s3t.OTLPLogExporter)}}else n==="console"?r.push(new Yfe.ConsoleLogRecordExporter):G1.diag.warn(`Unsupported OTEL_LOGS_EXPORTER value: "${n}". Supported values are: otlp, console, none.`)}),r.length>0&&(this._loggerProviderConfig={logRecordProcessors:r.map(n=>n instanceof Yfe.ConsoleLogRecordExporter?new Yfe.SimpleLogRecordProcessor(n):new Yfe.BatchLogRecordProcessor(n))})}};WIe.NodeSDK=c3t});var $Ir=w(Jp=>{"use strict";Object.defineProperty(Jp,"__esModule",{value:!0});Jp.NodeSDK=Jp.tracing=Jp.resources=Jp.node=Jp.metrics=Jp.logs=Jp.core=Jp.contextBase=Jp.api=void 0;Jp.api=(Kt(),yt(ar));Jp.contextBase=(Kt(),yt(ar));Jp.core=oi();Jp.logs=zht();Jp.metrics=Dx();Jp.node=_9e();Jp.resources=hY();Jp.tracing=z9e();var aio=VIr();Object.defineProperty(Jp,"NodeSDK",{enumerable:!0,get:function(){return aio.NodeSDK}})});function cio(t,e){return new Promise((r,n)=>{let i=setTimeout(()=>{n(new Error(`Operation timed out after ${e} ms`))},e);t.then(r).catch(n).finally(()=>clearTimeout(i))})}var WIr,zIe,zIr=Z(()=>{"use strict";WIr=Te(Dx(),1);zIe=class extends WIr.PeriodicExportingMetricReader{_alignSeconds=[0,20,40];_intervalSeconds=20;constructor(e){if(super({...e,exportIntervalMillis:e.exportIntervalMillis??2e4}),(e.exportIntervalMillis??2e4)!==2e4)throw new Error("Aligned reader only supports 20-second intervals for 0/20/40 alignment")}onInitialized(){let e=new Date,r=e.getSeconds(),n=e.getMilliseconds(),i=this._alignSeconds.find(a=>a>=r),o;i!==void 0?o=(i-r)*1e3-n:(o=(60-r)*1e3-n,i=0),o=Math.max(0,o);let s=setTimeout(()=>{this._alignedExport(),this._interval=setInterval(()=>{this._alignedExport()},this._intervalSeconds*1e3);let a=this._interval;typeof a!="number"&&a?.unref&&a.unref()},o);typeof s!="number"&&s?.unref&&s.unref()}async _alignedExport(){let e=this._exportTimeout;try{await cio(this._doCollectAndExport(),e)}catch{}}async _doCollectAndExport(){let e=this._exportTimeout,{resourceMetrics:r,errors:n}=await this.collect({timeoutMillis:e});if(n.length>0,r.resource.asyncAttributesPending)try{await r.resource.waitForAsyncAttributes?.()}catch{}if(r.scopeMetrics.length===0)return;await this._exporter.export(r)}async onShutdown(){let e=this._interval;e&&clearInterval(e),await super.onShutdown()}}});var Kfe=w(lB=>{"use strict";Object.defineProperty(lB,"__esModule",{value:!0});lB.isTracingSuppressed=lB.unsuppressTracing=lB.suppressTracing=void 0;var lio=(Kt(),yt(ar)),l3t=(0,lio.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function uio(t){return t.setValue(l3t,!0)}lB.suppressTracing=uio;function dio(t){return t.deleteValue(l3t)}lB.unsuppressTracing=dio;function fio(t){return t.getValue(l3t)===!0}lB.isTracingSuppressed=fio});var u3t=w(h2=>{"use strict";Object.defineProperty(h2,"__esModule",{value:!0});h2.BAGGAGE_MAX_TOTAL_LENGTH=h2.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=h2.BAGGAGE_MAX_NAME_VALUE_PAIRS=h2.BAGGAGE_HEADER=h2.BAGGAGE_ITEMS_SEPARATOR=h2.BAGGAGE_PROPERTIES_SEPARATOR=h2.BAGGAGE_KEY_PAIR_SEPARATOR=void 0;h2.BAGGAGE_KEY_PAIR_SEPARATOR="=";h2.BAGGAGE_PROPERTIES_SEPARATOR=";";h2.BAGGAGE_ITEMS_SEPARATOR=",";h2.BAGGAGE_HEADER="baggage";h2.BAGGAGE_MAX_NAME_VALUE_PAIRS=180;h2.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096;h2.BAGGAGE_MAX_TOTAL_LENGTH=8192});var d3t=w(aS=>{"use strict";Object.defineProperty(aS,"__esModule",{value:!0});aS.parseKeyPairsIntoRecord=aS.parsePairKeyValue=aS.getKeyPairs=aS.serializeKeyPairs=void 0;var pio=(Kt(),yt(ar)),_F=u3t();function hio(t){return t.reduce((e,r)=>{let n=`${e}${e!==""?_F.BAGGAGE_ITEMS_SEPARATOR:""}${r}`;return n.length>_F.BAGGAGE_MAX_TOTAL_LENGTH?e:n},"")}aS.serializeKeyPairs=hio;function mio(t){return t.getAllEntries().map(([e,r])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=_F.BAGGAGE_PROPERTIES_SEPARATOR+r.metadata.toString()),n})}aS.getKeyPairs=mio;function YIr(t){let e=t.split(_F.BAGGAGE_PROPERTIES_SEPARATOR);if(e.length<=0)return;let r=e.shift();if(!r)return;let n=r.indexOf(_F.BAGGAGE_KEY_PAIR_SEPARATOR);if(n<=0)return;let i=decodeURIComponent(r.substring(0,n).trim()),o=decodeURIComponent(r.substring(n+1).trim()),s;return e.length>0&&(s=(0,pio.baggageEntryMetadataFromString)(e.join(_F.BAGGAGE_PROPERTIES_SEPARATOR))),{key:i,value:o,metadata:s}}aS.parsePairKeyValue=YIr;function gio(t){let e={};return typeof t=="string"&&t.length>0&&t.split(_F.BAGGAGE_ITEMS_SEPARATOR).forEach(r=>{let n=YIr(r);n!==void 0&&n.value.length>0&&(e[n.key]=n.value)}),e}aS.parseKeyPairsIntoRecord=gio});var KIr=w(YIe=>{"use strict";Object.defineProperty(YIe,"__esModule",{value:!0});YIe.W3CBaggagePropagator=void 0;var f3t=(Kt(),yt(ar)),Aio=Kfe(),xF=u3t(),p3t=d3t(),h3t=class{inject(e,r,n){let i=f3t.propagation.getBaggage(e);if(!i||(0,Aio.isTracingSuppressed)(e))return;let o=(0,p3t.getKeyPairs)(i).filter(a=>a.length<=xF.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,xF.BAGGAGE_MAX_NAME_VALUE_PAIRS),s=(0,p3t.serializeKeyPairs)(o);s.length>0&&n.set(r,xF.BAGGAGE_HEADER,s)}extract(e,r,n){let i=n.get(r,xF.BAGGAGE_HEADER),o=Array.isArray(i)?i.join(xF.BAGGAGE_ITEMS_SEPARATOR):i;if(!o)return e;let s={};return o.length===0||(o.split(xF.BAGGAGE_ITEMS_SEPARATOR).forEach(c=>{let u=(0,p3t.parsePairKeyValue)(c);if(u){let d={value:u.value};u.metadata&&(d.metadata=u.metadata),s[u.key]=d}}),Object.entries(s).length===0)?e:f3t.propagation.setBaggage(e,f3t.propagation.createBaggage(s))}fields(){return[xF.BAGGAGE_HEADER]}};YIe.W3CBaggagePropagator=h3t});var JIr=w(KIe=>{"use strict";Object.defineProperty(KIe,"__esModule",{value:!0});KIe.AnchoredClock=void 0;var m3t=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(e,r){this._monotonicClock=r,this._epochMillis=e.now(),this._performanceMillis=r.now()}now(){let e=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+e}};KIe.AnchoredClock=m3t});var rDr=w(uB=>{"use strict";Object.defineProperty(uB,"__esModule",{value:!0});uB.isAttributeValue=uB.isAttributeKey=uB.sanitizeAttributes=void 0;var XIr=(Kt(),yt(ar));function yio(t){let e={};if(typeof t!="object"||t==null)return e;for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(!ZIr(r)){XIr.diag.warn(`Invalid attribute key: ${r}`);continue}let n=t[r];if(!eDr(n)){XIr.diag.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?e[r]=n.slice():e[r]=n}return e}uB.sanitizeAttributes=yio;function ZIr(t){return typeof t=="string"&&t!==""}uB.isAttributeKey=ZIr;function eDr(t){return t==null?!0:Array.isArray(t)?Eio(t):tDr(typeof t)}uB.isAttributeValue=eDr;function Eio(t){let e;for(let r of t){if(r==null)continue;let n=typeof r;if(n!==e){if(!e){if(tDr(n)){e=n;continue}return!1}return!1}}return!0}function tDr(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}});var g3t=w(JIe=>{"use strict";Object.defineProperty(JIe,"__esModule",{value:!0});JIe.loggingErrorHandler=void 0;var vio=(Kt(),yt(ar));function bio(){return t=>{vio.diag.error(Cio(t))}}JIe.loggingErrorHandler=bio;function Cio(t){return typeof t=="string"?t:JSON.stringify(_io(t))}function _io(t){let e={},r=t;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(e[n])return;let i=r[n];i&&(e[n]=String(i))}),r=Object.getPrototypeOf(r);return e}});var iDr=w(_K=>{"use strict";Object.defineProperty(_K,"__esModule",{value:!0});_K.globalErrorHandler=_K.setGlobalErrorHandler=void 0;var xio=g3t(),nDr=(0,xio.loggingErrorHandler)();function Sio(t){nDr=t}_K.setGlobalErrorHandler=Sio;function wio(t){try{nDr(t)}catch{}}_K.globalErrorHandler=wio});var cDr=w(cS=>{"use strict";Object.defineProperty(cS,"__esModule",{value:!0});cS.getStringListFromEnv=cS.getBooleanFromEnv=cS.getStringFromEnv=cS.getNumberFromEnv=void 0;var oDr=(Kt(),yt(ar)),sDr=Ae("util");function Tio(t){let e=process.env[t];if(e==null||e.trim()==="")return;let r=Number(e);if(isNaN(r)){oDr.diag.warn(`Unknown value ${(0,sDr.inspect)(e)} for ${t}, expected a number, using defaults`);return}return r}cS.getNumberFromEnv=Tio;function aDr(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}cS.getStringFromEnv=aDr;function Iio(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||oDr.diag.warn(`Unknown value ${(0,sDr.inspect)(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}cS.getBooleanFromEnv=Iio;function Dio(t){return aDr(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}cS.getStringListFromEnv=Dio});var lDr=w(XIe=>{"use strict";Object.defineProperty(XIe,"__esModule",{value:!0});XIe._globalThis=void 0;XIe._globalThis=typeof globalThis=="object"?globalThis:global});var uDr=w(ZIe=>{"use strict";Object.defineProperty(ZIe,"__esModule",{value:!0});ZIe.otperformance=void 0;var Rio=Ae("perf_hooks");ZIe.otperformance=Rio.performance});var dDr=w(eDe=>{"use strict";Object.defineProperty(eDe,"__esModule",{value:!0});eDe.VERSION=void 0;eDe.VERSION="2.2.0"});var fDr=w(tDe=>{"use strict";Object.defineProperty(tDe,"__esModule",{value:!0});tDe.ATTR_PROCESS_RUNTIME_NAME=void 0;tDe.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name"});var pDr=w(nDe=>{"use strict";Object.defineProperty(nDe,"__esModule",{value:!0});nDe.SDK_INFO=void 0;var Bio=dDr(),rDe=(Nh(),yt(l2)),Nio=fDr();nDe.SDK_INFO={[rDe.ATTR_TELEMETRY_SDK_NAME]:"opentelemetry",[Nio.ATTR_PROCESS_RUNTIME_NAME]:"node",[rDe.ATTR_TELEMETRY_SDK_LANGUAGE]:rDe.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[rDe.ATTR_TELEMETRY_SDK_VERSION]:Bio.VERSION}});var hDr=w(m2=>{"use strict";Object.defineProperty(m2,"__esModule",{value:!0});m2.SDK_INFO=m2.otperformance=m2._globalThis=m2.getStringListFromEnv=m2.getNumberFromEnv=m2.getBooleanFromEnv=m2.getStringFromEnv=void 0;var iDe=cDr();Object.defineProperty(m2,"getStringFromEnv",{enumerable:!0,get:function(){return iDe.getStringFromEnv}});Object.defineProperty(m2,"getBooleanFromEnv",{enumerable:!0,get:function(){return iDe.getBooleanFromEnv}});Object.defineProperty(m2,"getNumberFromEnv",{enumerable:!0,get:function(){return iDe.getNumberFromEnv}});Object.defineProperty(m2,"getStringListFromEnv",{enumerable:!0,get:function(){return iDe.getStringListFromEnv}});var Oio=lDr();Object.defineProperty(m2,"_globalThis",{enumerable:!0,get:function(){return Oio._globalThis}});var kio=uDr();Object.defineProperty(m2,"otperformance",{enumerable:!0,get:function(){return kio.otperformance}});var Pio=pDr();Object.defineProperty(m2,"SDK_INFO",{enumerable:!0,get:function(){return Pio.SDK_INFO}})});var A3t=w(g2=>{"use strict";Object.defineProperty(g2,"__esModule",{value:!0});g2.getStringListFromEnv=g2.getNumberFromEnv=g2.getStringFromEnv=g2.getBooleanFromEnv=g2.otperformance=g2._globalThis=g2.SDK_INFO=void 0;var SF=hDr();Object.defineProperty(g2,"SDK_INFO",{enumerable:!0,get:function(){return SF.SDK_INFO}});Object.defineProperty(g2,"_globalThis",{enumerable:!0,get:function(){return SF._globalThis}});Object.defineProperty(g2,"otperformance",{enumerable:!0,get:function(){return SF.otperformance}});Object.defineProperty(g2,"getBooleanFromEnv",{enumerable:!0,get:function(){return SF.getBooleanFromEnv}});Object.defineProperty(g2,"getStringFromEnv",{enumerable:!0,get:function(){return SF.getStringFromEnv}});Object.defineProperty(g2,"getNumberFromEnv",{enumerable:!0,get:function(){return SF.getNumberFromEnv}});Object.defineProperty(g2,"getStringListFromEnv",{enumerable:!0,get:function(){return SF.getStringListFromEnv}})});var yDr=w(pu=>{"use strict";Object.defineProperty(pu,"__esModule",{value:!0});pu.addHrTimes=pu.isTimeInput=pu.isTimeInputHrTime=pu.hrTimeToMicroseconds=pu.hrTimeToMilliseconds=pu.hrTimeToNanoseconds=pu.hrTimeToTimeStamp=pu.hrTimeDuration=pu.timeInputToHrTime=pu.hrTime=pu.getTimeOrigin=pu.millisToHrTime=void 0;var y3t=A3t(),mDr=9,Mio=6,Lio=Math.pow(10,Mio),oDe=Math.pow(10,mDr);function Jfe(t){let e=t/1e3,r=Math.trunc(e),n=Math.round(t%1e3*Lio);return[r,n]}pu.millisToHrTime=Jfe;function E3t(){let t=y3t.otperformance.timeOrigin;if(typeof t!="number"){let e=y3t.otperformance;t=e.timing&&e.timing.fetchStart}return t}pu.getTimeOrigin=E3t;function gDr(t){let e=Jfe(E3t()),r=Jfe(typeof t=="number"?t:y3t.otperformance.now());return ADr(e,r)}pu.hrTime=gDr;function Fio(t){if(v3t(t))return t;if(typeof t=="number")return t<E3t()?gDr(t):Jfe(t);if(t instanceof Date)return Jfe(t.getTime());throw TypeError("Invalid input type")}pu.timeInputToHrTime=Fio;function Uio(t,e){let r=e[0]-t[0],n=e[1]-t[1];return n<0&&(r-=1,n+=oDe),[r,n]}pu.hrTimeDuration=Uio;function Qio(t){let e=mDr,r=`${"0".repeat(e)}${t[1]}Z`,n=r.substring(r.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",n)}pu.hrTimeToTimeStamp=Qio;function qio(t){return t[0]*oDe+t[1]}pu.hrTimeToNanoseconds=qio;function Hio(t){return t[0]*1e3+t[1]/1e6}pu.hrTimeToMilliseconds=Hio;function Gio(t){return t[0]*1e6+t[1]/1e3}pu.hrTimeToMicroseconds=Gio;function v3t(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}pu.isTimeInputHrTime=v3t;function jio(t){return v3t(t)||typeof t=="number"||t instanceof Date}pu.isTimeInput=jio;function ADr(t,e){let r=[t[0]+e[0],t[1]+e[1]];return r[1]>=oDe&&(r[1]-=oDe,r[0]+=1),r}pu.addHrTimes=ADr});var EDr=w(sDe=>{"use strict";Object.defineProperty(sDe,"__esModule",{value:!0});sDe.unrefTimer=void 0;function Vio(t){typeof t!="number"&&t.unref()}sDe.unrefTimer=Vio});var vDr=w(Xfe=>{"use strict";Object.defineProperty(Xfe,"__esModule",{value:!0});Xfe.ExportResultCode=void 0;var $io;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})($io=Xfe.ExportResultCode||(Xfe.ExportResultCode={}))});var CDr=w(aDe=>{"use strict";Object.defineProperty(aDe,"__esModule",{value:!0});aDe.CompositePropagator=void 0;var bDr=(Kt(),yt(ar)),b3t=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(r=>typeof r.fields=="function"?r.fields():[]).reduce((r,n)=>r.concat(n),[])))}inject(e,r,n){for(let i of this._propagators)try{i.inject(e,r,n)}catch(o){bDr.diag.warn(`Failed to inject with ${i.constructor.name}. Err: ${o.message}`)}}extract(e,r,n){return this._propagators.reduce((i,o)=>{try{return o.extract(i,r,n)}catch(s){bDr.diag.warn(`Failed to extract with ${o.constructor.name}. Err: ${s.message}`)}return i},e)}fields(){return this._fields.slice()}};aDe.CompositePropagator=b3t});var _Dr=w(xK=>{"use strict";Object.defineProperty(xK,"__esModule",{value:!0});xK.validateValue=xK.validateKey=void 0;var C3t="[_0-9a-z-*/]",Wio=`[a-z]${C3t}{0,255}`,zio=`[a-z0-9]${C3t}{0,240}@[a-z]${C3t}{0,13}`,Yio=new RegExp(`^(?:${Wio}|${zio})$`),Kio=/^[ -~]{0,255}[!-~]$/,Jio=/,|=/;function Xio(t){return Yio.test(t)}xK.validateKey=Xio;function Zio(t){return Kio.test(t)&&!Jio.test(t)}xK.validateValue=Zio});var x3t=w(cDe=>{"use strict";Object.defineProperty(cDe,"__esModule",{value:!0});cDe.TraceState=void 0;var xDr=_Dr(),SDr=32,eoo=512,wDr=",",TDr="=",_3t=class t{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,r){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,r),n}unset(e){let r=this._clone();return r._internalState.delete(e),r}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,r)=>(e.push(r+TDr+this.get(r)),e),[]).join(wDr)}_parse(e){e.length>eoo||(this._internalState=e.split(wDr).reverse().reduce((r,n)=>{let i=n.trim(),o=i.indexOf(TDr);if(o!==-1){let s=i.slice(0,o),a=i.slice(o+1,n.length);(0,xDr.validateKey)(s)&&(0,xDr.validateValue)(a)&&r.set(s,a)}return r},new Map),this._internalState.size>SDr&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,SDr))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}};cDe.TraceState=_3t});var DDr=w(A2=>{"use strict";Object.defineProperty(A2,"__esModule",{value:!0});A2.W3CTraceContextPropagator=A2.parseTraceParent=A2.TRACE_STATE_HEADER=A2.TRACE_PARENT_HEADER=void 0;var lDe=(Kt(),yt(ar)),too=Kfe(),roo=x3t();A2.TRACE_PARENT_HEADER="traceparent";A2.TRACE_STATE_HEADER="tracestate";var noo="00",ioo="(?!ff)[\\da-f]{2}",ooo="(?![0]{32})[\\da-f]{32}",soo="(?![0]{16})[\\da-f]{16}",aoo="[\\da-f]{2}",coo=new RegExp(`^\\s?(${ioo})-(${ooo})-(${soo})-(${aoo})(-.*)?\\s?$`);function IDr(t){let e=coo.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}A2.parseTraceParent=IDr;var S3t=class{inject(e,r,n){let i=lDe.trace.getSpanContext(e);if(!i||(0,too.isTracingSuppressed)(e)||!(0,lDe.isSpanContextValid)(i))return;let o=`${noo}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||lDe.TraceFlags.NONE).toString(16)}`;n.set(r,A2.TRACE_PARENT_HEADER,o),i.traceState&&n.set(r,A2.TRACE_STATE_HEADER,i.traceState.serialize())}extract(e,r,n){let i=n.get(r,A2.TRACE_PARENT_HEADER);if(!i)return e;let o=Array.isArray(i)?i[0]:i;if(typeof o!="string")return e;let s=IDr(o);if(!s)return e;s.isRemote=!0;let a=n.get(r,A2.TRACE_STATE_HEADER);if(a){let c=Array.isArray(a)?a.join(","):a;s.traceState=new roo.TraceState(typeof c=="string"?c:void 0)}return lDe.trace.setSpanContext(e,s)}fields(){return[A2.TRACE_PARENT_HEADER,A2.TRACE_STATE_HEADER]}};A2.W3CTraceContextPropagator=S3t});var RDr=w(KC=>{"use strict";Object.defineProperty(KC,"__esModule",{value:!0});KC.getRPCMetadata=KC.deleteRPCMetadata=KC.setRPCMetadata=KC.RPCType=void 0;var loo=(Kt(),yt(ar)),w3t=(0,loo.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"),uoo;(function(t){t.HTTP="http"})(uoo=KC.RPCType||(KC.RPCType={}));function doo(t,e){return t.setValue(w3t,e)}KC.setRPCMetadata=doo;function foo(t){return t.deleteValue(w3t)}KC.deleteRPCMetadata=foo;function poo(t){return t.getValue(w3t)}KC.getRPCMetadata=poo});var PDr=w(uDe=>{"use strict";Object.defineProperty(uDe,"__esModule",{value:!0});uDe.isPlainObject=void 0;var hoo="[object Object]",moo="[object Null]",goo="[object Undefined]",Aoo=Function.prototype,BDr=Aoo.toString,yoo=BDr.call(Object),Eoo=Object.getPrototypeOf,NDr=Object.prototype,ODr=NDr.hasOwnProperty,wF=Symbol?Symbol.toStringTag:void 0,kDr=NDr.toString;function voo(t){if(!boo(t)||Coo(t)!==hoo)return!1;let e=Eoo(t);if(e===null)return!0;let r=ODr.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&BDr.call(r)===yoo}uDe.isPlainObject=voo;function boo(t){return t!=null&&typeof t=="object"}function Coo(t){return t==null?t===void 0?goo:moo:wF&&wF in Object(t)?_oo(t):xoo(t)}function _oo(t){let e=ODr.call(t,wF),r=t[wF],n=!1;try{t[wF]=void 0,n=!0}catch{}let i=kDr.call(t);return n&&(e?t[wF]=r:delete t[wF]),i}function xoo(t){return kDr.call(t)}});var QDr=w(pDe=>{"use strict";Object.defineProperty(pDe,"__esModule",{value:!0});pDe.merge=void 0;var MDr=PDr(),Soo=20;function woo(...t){let e=t.shift(),r=new WeakMap;for(;t.length>0;)e=FDr(e,t.shift(),0,r);return e}pDe.merge=woo;function T3t(t){return fDe(t)?t.slice():t}function FDr(t,e,r=0,n){let i;if(!(r>Soo)){if(r++,dDe(t)||dDe(e)||UDr(e))i=T3t(e);else if(fDe(t)){if(i=t.slice(),fDe(e))for(let o=0,s=e.length;o<s;o++)i.push(T3t(e[o]));else if(Zfe(e)){let o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){let c=o[s];i[c]=T3t(e[c])}}}else if(Zfe(t))if(Zfe(e)){if(!Too(t,e))return e;i=Object.assign({},t);let o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){let c=o[s],u=e[c];if(dDe(u))typeof u>"u"?delete i[c]:i[c]=u;else{let d=i[c],f=u;if(LDr(t,c,n)||LDr(e,c,n))delete i[c];else{if(Zfe(d)&&Zfe(f)){let p=n.get(d)||[],h=n.get(f)||[];p.push({obj:t,key:c}),h.push({obj:e,key:c}),n.set(d,p),n.set(f,h)}i[c]=FDr(i[c],u,r,n)}}}}else i=e;return i}}function LDr(t,e,r){let n=r.get(t[e])||[];for(let i=0,o=n.length;i<o;i++){let s=n[i];if(s.key===e&&s.obj===t)return!0}return!1}function fDe(t){return Array.isArray(t)}function UDr(t){return typeof t=="function"}function Zfe(t){return!dDe(t)&&!fDe(t)&&!UDr(t)&&typeof t=="object"}function dDe(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function Too(t,e){return!(!(0,MDr.isPlainObject)(t)||!(0,MDr.isPlainObject)(e))}});var qDr=w(SK=>{"use strict";Object.defineProperty(SK,"__esModule",{value:!0});SK.callWithTimeout=SK.TimeoutError=void 0;var hDe=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};SK.TimeoutError=hDe;function Ioo(t,e){let r,n=new Promise(function(o,s){r=setTimeout(function(){s(new hDe("Operation timed out."))},e)});return Promise.race([t,n]).then(i=>(clearTimeout(r),i),i=>{throw clearTimeout(r),i})}SK.callWithTimeout=Ioo});var GDr=w(wK=>{"use strict";Object.defineProperty(wK,"__esModule",{value:!0});wK.isUrlIgnored=wK.urlMatches=void 0;function HDr(t,e){return typeof e=="string"?t===e:!!t.match(e)}wK.urlMatches=HDr;function Doo(t,e){if(!e)return!1;for(let r of e)if(HDr(t,r))return!0;return!1}wK.isUrlIgnored=Doo});var jDr=w(mDe=>{"use strict";Object.defineProperty(mDe,"__esModule",{value:!0});mDe.Deferred=void 0;var I3t=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};mDe.Deferred=I3t});var VDr=w(gDe=>{"use strict";Object.defineProperty(gDe,"__esModule",{value:!0});gDe.BindOnceFuture=void 0;var Roo=jDr(),D3t=class{_callback;_that;_isCalled=!1;_deferred=new Roo.Deferred;constructor(e,r){this._callback=e,this._that=r}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}};gDe.BindOnceFuture=D3t});var WDr=w(ADe=>{"use strict";Object.defineProperty(ADe,"__esModule",{value:!0});ADe.diagLogLevelFromString=void 0;var dT=(Kt(),yt(ar)),$Dr={ALL:dT.DiagLogLevel.ALL,VERBOSE:dT.DiagLogLevel.VERBOSE,DEBUG:dT.DiagLogLevel.DEBUG,INFO:dT.DiagLogLevel.INFO,WARN:dT.DiagLogLevel.WARN,ERROR:dT.DiagLogLevel.ERROR,NONE:dT.DiagLogLevel.NONE};function Boo(t){if(t==null)return;let e=$Dr[t.toUpperCase()];return e??(dT.diag.warn(`Unknown log level "${t}", expected one of ${Object.keys($Dr)}, using default`),dT.DiagLogLevel.INFO)}ADe.diagLogLevelFromString=Boo});var YDr=w(yDe=>{"use strict";Object.defineProperty(yDe,"__esModule",{value:!0});yDe._export=void 0;var zDr=(Kt(),yt(ar)),Noo=Kfe();function Ooo(t,e){return new Promise(r=>{zDr.context.with((0,Noo.suppressTracing)(zDr.context.active()),()=>{t.export(e,n=>{r(n)})})})}yDe._export=Ooo});var B3t=w(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.internal=Mr.diagLogLevelFromString=Mr.BindOnceFuture=Mr.urlMatches=Mr.isUrlIgnored=Mr.callWithTimeout=Mr.TimeoutError=Mr.merge=Mr.TraceState=Mr.unsuppressTracing=Mr.suppressTracing=Mr.isTracingSuppressed=Mr.setRPCMetadata=Mr.getRPCMetadata=Mr.deleteRPCMetadata=Mr.RPCType=Mr.parseTraceParent=Mr.W3CTraceContextPropagator=Mr.TRACE_STATE_HEADER=Mr.TRACE_PARENT_HEADER=Mr.CompositePropagator=Mr.otperformance=Mr.getStringListFromEnv=Mr.getNumberFromEnv=Mr.getBooleanFromEnv=Mr.getStringFromEnv=Mr._globalThis=Mr.SDK_INFO=Mr.parseKeyPairsIntoRecord=Mr.ExportResultCode=Mr.unrefTimer=Mr.timeInputToHrTime=Mr.millisToHrTime=Mr.isTimeInputHrTime=Mr.isTimeInput=Mr.hrTimeToTimeStamp=Mr.hrTimeToNanoseconds=Mr.hrTimeToMilliseconds=Mr.hrTimeToMicroseconds=Mr.hrTimeDuration=Mr.hrTime=Mr.getTimeOrigin=Mr.addHrTimes=Mr.loggingErrorHandler=Mr.setGlobalErrorHandler=Mr.globalErrorHandler=Mr.sanitizeAttributes=Mr.isAttributeValue=Mr.AnchoredClock=Mr.W3CBaggagePropagator=void 0;var koo=KIr();Object.defineProperty(Mr,"W3CBaggagePropagator",{enumerable:!0,get:function(){return koo.W3CBaggagePropagator}});var Poo=JIr();Object.defineProperty(Mr,"AnchoredClock",{enumerable:!0,get:function(){return Poo.AnchoredClock}});var KDr=rDr();Object.defineProperty(Mr,"isAttributeValue",{enumerable:!0,get:function(){return KDr.isAttributeValue}});Object.defineProperty(Mr,"sanitizeAttributes",{enumerable:!0,get:function(){return KDr.sanitizeAttributes}});var JDr=iDr();Object.defineProperty(Mr,"globalErrorHandler",{enumerable:!0,get:function(){return JDr.globalErrorHandler}});Object.defineProperty(Mr,"setGlobalErrorHandler",{enumerable:!0,get:function(){return JDr.setGlobalErrorHandler}});var Moo=g3t();Object.defineProperty(Mr,"loggingErrorHandler",{enumerable:!0,get:function(){return Moo.loggingErrorHandler}});var qv=yDr();Object.defineProperty(Mr,"addHrTimes",{enumerable:!0,get:function(){return qv.addHrTimes}});Object.defineProperty(Mr,"getTimeOrigin",{enumerable:!0,get:function(){return qv.getTimeOrigin}});Object.defineProperty(Mr,"hrTime",{enumerable:!0,get:function(){return qv.hrTime}});Object.defineProperty(Mr,"hrTimeDuration",{enumerable:!0,get:function(){return qv.hrTimeDuration}});Object.defineProperty(Mr,"hrTimeToMicroseconds",{enumerable:!0,get:function(){return qv.hrTimeToMicroseconds}});Object.defineProperty(Mr,"hrTimeToMilliseconds",{enumerable:!0,get:function(){return qv.hrTimeToMilliseconds}});Object.defineProperty(Mr,"hrTimeToNanoseconds",{enumerable:!0,get:function(){return qv.hrTimeToNanoseconds}});Object.defineProperty(Mr,"hrTimeToTimeStamp",{enumerable:!0,get:function(){return qv.hrTimeToTimeStamp}});Object.defineProperty(Mr,"isTimeInput",{enumerable:!0,get:function(){return qv.isTimeInput}});Object.defineProperty(Mr,"isTimeInputHrTime",{enumerable:!0,get:function(){return qv.isTimeInputHrTime}});Object.defineProperty(Mr,"millisToHrTime",{enumerable:!0,get:function(){return qv.millisToHrTime}});Object.defineProperty(Mr,"timeInputToHrTime",{enumerable:!0,get:function(){return qv.timeInputToHrTime}});var Loo=EDr();Object.defineProperty(Mr,"unrefTimer",{enumerable:!0,get:function(){return Loo.unrefTimer}});var Foo=vDr();Object.defineProperty(Mr,"ExportResultCode",{enumerable:!0,get:function(){return Foo.ExportResultCode}});var Uoo=d3t();Object.defineProperty(Mr,"parseKeyPairsIntoRecord",{enumerable:!0,get:function(){return Uoo.parseKeyPairsIntoRecord}});var TF=A3t();Object.defineProperty(Mr,"SDK_INFO",{enumerable:!0,get:function(){return TF.SDK_INFO}});Object.defineProperty(Mr,"_globalThis",{enumerable:!0,get:function(){return TF._globalThis}});Object.defineProperty(Mr,"getStringFromEnv",{enumerable:!0,get:function(){return TF.getStringFromEnv}});Object.defineProperty(Mr,"getBooleanFromEnv",{enumerable:!0,get:function(){return TF.getBooleanFromEnv}});Object.defineProperty(Mr,"getNumberFromEnv",{enumerable:!0,get:function(){return TF.getNumberFromEnv}});Object.defineProperty(Mr,"getStringListFromEnv",{enumerable:!0,get:function(){return TF.getStringListFromEnv}});Object.defineProperty(Mr,"otperformance",{enumerable:!0,get:function(){return TF.otperformance}});var Qoo=CDr();Object.defineProperty(Mr,"CompositePropagator",{enumerable:!0,get:function(){return Qoo.CompositePropagator}});var EDe=DDr();Object.defineProperty(Mr,"TRACE_PARENT_HEADER",{enumerable:!0,get:function(){return EDe.TRACE_PARENT_HEADER}});Object.defineProperty(Mr,"TRACE_STATE_HEADER",{enumerable:!0,get:function(){return EDe.TRACE_STATE_HEADER}});Object.defineProperty(Mr,"W3CTraceContextPropagator",{enumerable:!0,get:function(){return EDe.W3CTraceContextPropagator}});Object.defineProperty(Mr,"parseTraceParent",{enumerable:!0,get:function(){return EDe.parseTraceParent}});var vDe=RDr();Object.defineProperty(Mr,"RPCType",{enumerable:!0,get:function(){return vDe.RPCType}});Object.defineProperty(Mr,"deleteRPCMetadata",{enumerable:!0,get:function(){return vDe.deleteRPCMetadata}});Object.defineProperty(Mr,"getRPCMetadata",{enumerable:!0,get:function(){return vDe.getRPCMetadata}});Object.defineProperty(Mr,"setRPCMetadata",{enumerable:!0,get:function(){return vDe.setRPCMetadata}});var R3t=Kfe();Object.defineProperty(Mr,"isTracingSuppressed",{enumerable:!0,get:function(){return R3t.isTracingSuppressed}});Object.defineProperty(Mr,"suppressTracing",{enumerable:!0,get:function(){return R3t.suppressTracing}});Object.defineProperty(Mr,"unsuppressTracing",{enumerable:!0,get:function(){return R3t.unsuppressTracing}});var qoo=x3t();Object.defineProperty(Mr,"TraceState",{enumerable:!0,get:function(){return qoo.TraceState}});var Hoo=QDr();Object.defineProperty(Mr,"merge",{enumerable:!0,get:function(){return Hoo.merge}});var XDr=qDr();Object.defineProperty(Mr,"TimeoutError",{enumerable:!0,get:function(){return XDr.TimeoutError}});Object.defineProperty(Mr,"callWithTimeout",{enumerable:!0,get:function(){return XDr.callWithTimeout}});var ZDr=GDr();Object.defineProperty(Mr,"isUrlIgnored",{enumerable:!0,get:function(){return ZDr.isUrlIgnored}});Object.defineProperty(Mr,"urlMatches",{enumerable:!0,get:function(){return ZDr.urlMatches}});var Goo=VDr();Object.defineProperty(Mr,"BindOnceFuture",{enumerable:!0,get:function(){return Goo.BindOnceFuture}});var joo=WDr();Object.defineProperty(Mr,"diagLogLevelFromString",{enumerable:!0,get:function(){return joo.diagLogLevelFromString}});var Voo=YDr();Mr.internal={_export:Voo._export}});var eRr=w(bDe=>{"use strict";Object.defineProperty(bDe,"__esModule",{value:!0});bDe.defaultServiceName=void 0;function $oo(){return`unknown_service:${process.argv0}`}bDe.defaultServiceName=$oo});var tRr=w(CDe=>{"use strict";Object.defineProperty(CDe,"__esModule",{value:!0});CDe.defaultServiceName=void 0;var Woo=eRr();Object.defineProperty(CDe,"defaultServiceName",{enumerable:!0,get:function(){return Woo.defaultServiceName}})});var N3t=w(_De=>{"use strict";Object.defineProperty(_De,"__esModule",{value:!0});_De.defaultServiceName=void 0;var zoo=tRr();Object.defineProperty(_De,"defaultServiceName",{enumerable:!0,get:function(){return zoo.defaultServiceName}})});var rRr=w(TK=>{"use strict";Object.defineProperty(TK,"__esModule",{value:!0});TK.identity=TK.isPromiseLike=void 0;var Yoo=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";TK.isPromiseLike=Yoo;function Koo(t){return t}TK.identity=Koo});var P3t=w(lS=>{"use strict";Object.defineProperty(lS,"__esModule",{value:!0});lS.defaultResource=lS.emptyResource=lS.resourceFromDetectedResource=lS.resourceFromAttributes=void 0;var tpe=(Kt(),yt(ar)),O3t=B3t(),IF=(Nh(),yt(l2)),Joo=N3t(),epe=rRr(),xDe=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,r){let n=new t({},r);return n._rawAttributes=nRr(e),n._asyncAttributesPending=e.filter(([i,o])=>(0,epe.isPromiseLike)(o)).length>0,n}constructor(e,r){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([i,o])=>((0,epe.isPromiseLike)(o)&&(this._asyncAttributesPending=!0),[i,o])),this._rawAttributes=nRr(this._rawAttributes),this._schemaUrl=tso(r?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[r,n]=this._rawAttributes[e];this._rawAttributes[e]=[r,(0,epe.isPromiseLike)(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&tpe.diag.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[r,n]of this._rawAttributes){if((0,epe.isPromiseLike)(n)){tpe.diag.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(e[r]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){if(e==null)return this;let r=rso(this,e),n=r?{schemaUrl:r}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],n)}};function k3t(t,e){return xDe.FromAttributeList(Object.entries(t),e)}lS.resourceFromAttributes=k3t;function Xoo(t,e){return new xDe(t,e)}lS.resourceFromDetectedResource=Xoo;function Zoo(){return k3t({})}lS.emptyResource=Zoo;function eso(){return k3t({[IF.ATTR_SERVICE_NAME]:(0,Joo.defaultServiceName)(),[IF.ATTR_TELEMETRY_SDK_LANGUAGE]:O3t.SDK_INFO[IF.ATTR_TELEMETRY_SDK_LANGUAGE],[IF.ATTR_TELEMETRY_SDK_NAME]:O3t.SDK_INFO[IF.ATTR_TELEMETRY_SDK_NAME],[IF.ATTR_TELEMETRY_SDK_VERSION]:O3t.SDK_INFO[IF.ATTR_TELEMETRY_SDK_VERSION]})}lS.defaultResource=eso;function nRr(t){return t.map(([e,r])=>(0,epe.isPromiseLike)(r)?[e,r.catch(n=>{tpe.diag.debug("promise rejection for resource attribute: %s - %s",e,n)})]:[e,r])}function tso(t){if(typeof t=="string"||t===void 0)return t;tpe.diag.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function rso(t,e){let r=t?.schemaUrl,n=e?.schemaUrl,i=r===void 0||r==="",o=n===void 0||n==="";if(i)return n;if(o||r===n)return r;tpe.diag.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}});var oRr=w(SDe=>{"use strict";Object.defineProperty(SDe,"__esModule",{value:!0});SDe.detectResources=void 0;var iRr=(Kt(),yt(ar)),M3t=P3t(),nso=(t={})=>(t.detectors||[]).map(r=>{try{let n=(0,M3t.resourceFromDetectedResource)(r.detect(t));return iRr.diag.debug(`${r.constructor.name} found resource.`,n),n}catch(n){return iRr.diag.debug(`${r.constructor.name} failed: ${n.message}`),(0,M3t.emptyResource)()}}).reduce((r,n)=>r.merge(n),(0,M3t.emptyResource)());SDe.detectResources=nso});var aRr=w(wDe=>{"use strict";Object.defineProperty(wDe,"__esModule",{value:!0});wDe.envDetector=void 0;var iso=(Kt(),yt(ar)),oso=(Nh(),yt(l2)),sRr=B3t(),L3t=class{_MAX_LENGTH=255;_COMMA_SEPARATOR=",";_LABEL_KEY_VALUE_SPLITTER="=";_ERROR_MESSAGE_INVALID_CHARS="should be a ASCII string with a length greater than 0 and not exceed "+this._MAX_LENGTH+" characters.";_ERROR_MESSAGE_INVALID_VALUE="should be a ASCII string with a length not exceed "+this._MAX_LENGTH+" characters.";detect(e){let r={},n=(0,sRr.getStringFromEnv)("OTEL_RESOURCE_ATTRIBUTES"),i=(0,sRr.getStringFromEnv)("OTEL_SERVICE_NAME");if(n)try{let o=this._parseResourceAttributes(n);Object.assign(r,o)}catch(o){iso.diag.debug(`EnvDetector failed: ${o.message}`)}return i&&(r[oso.ATTR_SERVICE_NAME]=i),{attributes:r}}_parseResourceAttributes(e){if(!e)return{};let r={},n=e.split(this._COMMA_SEPARATOR,-1);for(let i of n){let o=i.split(this._LABEL_KEY_VALUE_SPLITTER,-1);if(o.length!==2)continue;let[s,a]=o;if(s=s.trim(),a=a.trim().split(/^"|"$/).join(""),!this._isValidAndNotEmpty(s))throw new Error(`Attribute key ${this._ERROR_MESSAGE_INVALID_CHARS}`);if(!this._isValid(a))throw new Error(`Attribute value ${this._ERROR_MESSAGE_INVALID_VALUE}`);r[s]=decodeURIComponent(a)}return r}_isValid(e){return e.length<=this._MAX_LENGTH&&this._isBaggageOctetString(e)}_isBaggageOctetString(e){for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n<33||n===44||n===59||n===92||n>126)return!1}return!0}_isValidAndNotEmpty(e){return e.length>0&&this._isValid(e)}};wDe.envDetector=new L3t});var rpe=w(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.ATTR_WEBENGINE_VERSION=Bn.ATTR_WEBENGINE_NAME=Bn.ATTR_WEBENGINE_DESCRIPTION=Bn.ATTR_SERVICE_NAMESPACE=Bn.ATTR_SERVICE_INSTANCE_ID=Bn.ATTR_PROCESS_RUNTIME_VERSION=Bn.ATTR_PROCESS_RUNTIME_NAME=Bn.ATTR_PROCESS_RUNTIME_DESCRIPTION=Bn.ATTR_PROCESS_PID=Bn.ATTR_PROCESS_OWNER=Bn.ATTR_PROCESS_EXECUTABLE_PATH=Bn.ATTR_PROCESS_EXECUTABLE_NAME=Bn.ATTR_PROCESS_COMMAND_ARGS=Bn.ATTR_PROCESS_COMMAND=Bn.ATTR_OS_VERSION=Bn.ATTR_OS_TYPE=Bn.ATTR_K8S_POD_NAME=Bn.ATTR_K8S_NAMESPACE_NAME=Bn.ATTR_K8S_DEPLOYMENT_NAME=Bn.ATTR_K8S_CLUSTER_NAME=Bn.ATTR_HOST_TYPE=Bn.ATTR_HOST_NAME=Bn.ATTR_HOST_IMAGE_VERSION=Bn.ATTR_HOST_IMAGE_NAME=Bn.ATTR_HOST_IMAGE_ID=Bn.ATTR_HOST_ID=Bn.ATTR_HOST_ARCH=Bn.ATTR_CONTAINER_NAME=Bn.ATTR_CONTAINER_IMAGE_TAGS=Bn.ATTR_CONTAINER_IMAGE_NAME=Bn.ATTR_CONTAINER_ID=Bn.ATTR_CLOUD_REGION=Bn.ATTR_CLOUD_PROVIDER=Bn.ATTR_CLOUD_AVAILABILITY_ZONE=Bn.ATTR_CLOUD_ACCOUNT_ID=void 0;Bn.ATTR_CLOUD_ACCOUNT_ID="cloud.account.id";Bn.ATTR_CLOUD_AVAILABILITY_ZONE="cloud.availability_zone";Bn.ATTR_CLOUD_PROVIDER="cloud.provider";Bn.ATTR_CLOUD_REGION="cloud.region";Bn.ATTR_CONTAINER_ID="container.id";Bn.ATTR_CONTAINER_IMAGE_NAME="container.image.name";Bn.ATTR_CONTAINER_IMAGE_TAGS="container.image.tags";Bn.ATTR_CONTAINER_NAME="container.name";Bn.ATTR_HOST_ARCH="host.arch";Bn.ATTR_HOST_ID="host.id";Bn.ATTR_HOST_IMAGE_ID="host.image.id";Bn.ATTR_HOST_IMAGE_NAME="host.image.name";Bn.ATTR_HOST_IMAGE_VERSION="host.image.version";Bn.ATTR_HOST_NAME="host.name";Bn.ATTR_HOST_TYPE="host.type";Bn.ATTR_K8S_CLUSTER_NAME="k8s.cluster.name";Bn.ATTR_K8S_DEPLOYMENT_NAME="k8s.deployment.name";Bn.ATTR_K8S_NAMESPACE_NAME="k8s.namespace.name";Bn.ATTR_K8S_POD_NAME="k8s.pod.name";Bn.ATTR_OS_TYPE="os.type";Bn.ATTR_OS_VERSION="os.version";Bn.ATTR_PROCESS_COMMAND="process.command";Bn.ATTR_PROCESS_COMMAND_ARGS="process.command_args";Bn.ATTR_PROCESS_EXECUTABLE_NAME="process.executable.name";Bn.ATTR_PROCESS_EXECUTABLE_PATH="process.executable.path";Bn.ATTR_PROCESS_OWNER="process.owner";Bn.ATTR_PROCESS_PID="process.pid";Bn.ATTR_PROCESS_RUNTIME_DESCRIPTION="process.runtime.description";Bn.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name";Bn.ATTR_PROCESS_RUNTIME_VERSION="process.runtime.version";Bn.ATTR_SERVICE_INSTANCE_ID="service.instance.id";Bn.ATTR_SERVICE_NAMESPACE="service.namespace";Bn.ATTR_WEBENGINE_DESCRIPTION="webengine.description";Bn.ATTR_WEBENGINE_NAME="webengine.name";Bn.ATTR_WEBENGINE_VERSION="webengine.version"});var IDe=w(TDe=>{"use strict";Object.defineProperty(TDe,"__esModule",{value:!0});TDe.execAsync=void 0;var sso=Ae("child_process"),aso=Ae("util");TDe.execAsync=aso.promisify(sso.exec)});var cRr=w(DDe=>{"use strict";Object.defineProperty(DDe,"__esModule",{value:!0});DDe.getMachineId=void 0;var cso=IDe(),lso=(Kt(),yt(ar));async function uso(){try{let e=(await(0,cso.execAsync)('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split(`
|
|
447
|
-
`).find(n=>n.includes("IOPlatformUUID"));if(!e)return;let r=e.split('" = "');if(r.length===2)return r[1].slice(0,-1)}catch(t){lso.diag.debug(`error reading machine id: ${t}`)}}DDe.getMachineId=uso});var lRr=w(RDe=>{"use strict";Object.defineProperty(RDe,"__esModule",{value:!0});RDe.getMachineId=void 0;var dso=Ae("fs"),fso=(Kt(),yt(ar));async function pso(){let t=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let e of t)try{return(await dso.promises.readFile(e,{encoding:"utf8"})).trim()}catch(r){fso.diag.debug(`error reading machine id: ${r}`)}}RDe.getMachineId=pso});var dRr=w(BDe=>{"use strict";Object.defineProperty(BDe,"__esModule",{value:!0});BDe.getMachineId=void 0;var hso=Ae("fs"),mso=IDe(),uRr=(Kt(),yt(ar));async function gso(){try{return(await hso.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(t){uRr.diag.debug(`error reading machine id: ${t}`)}try{return(await(0,mso.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(t){uRr.diag.debug(`error reading machine id: ${t}`)}}BDe.getMachineId=gso});var pRr=w(NDe=>{"use strict";Object.defineProperty(NDe,"__esModule",{value:!0});NDe.getMachineId=void 0;var fRr=Ae("process"),Aso=IDe(),yso=(Kt(),yt(ar));async function Eso(){let t="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",e="%windir%\\System32\\REG.exe";fRr.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in fRr.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{let n=(await(0,Aso.execAsync)(`${e} ${t}`)).stdout.split("REG_SZ");if(n.length===2)return n[1].trim()}catch(r){yso.diag.debug(`error reading machine id: ${r}`)}}NDe.getMachineId=Eso});var hRr=w(ODe=>{"use strict";Object.defineProperty(ODe,"__esModule",{value:!0});ODe.getMachineId=void 0;var vso=(Kt(),yt(ar));async function bso(){vso.diag.debug("could not read machine-id: unsupported platform")}ODe.getMachineId=bso});var mRr=w(kDe=>{"use strict";Object.defineProperty(kDe,"__esModule",{value:!0});kDe.getMachineId=void 0;var Cso=Ae("process"),DF;async function _so(){if(!DF)switch(Cso.platform){case"darwin":DF=(await Promise.resolve().then(()=>Te(cRr()))).getMachineId;break;case"linux":DF=(await Promise.resolve().then(()=>Te(lRr()))).getMachineId;break;case"freebsd":DF=(await Promise.resolve().then(()=>Te(dRr()))).getMachineId;break;case"win32":DF=(await Promise.resolve().then(()=>Te(pRr()))).getMachineId;break;default:DF=(await Promise.resolve().then(()=>Te(hRr()))).getMachineId;break}return DF()}kDe.getMachineId=_so});var F3t=w(IK=>{"use strict";Object.defineProperty(IK,"__esModule",{value:!0});IK.normalizeType=IK.normalizeArch=void 0;var xso=t=>{switch(t){case"arm":return"arm32";case"ppc":return"ppc32";case"x64":return"amd64";default:return t}};IK.normalizeArch=xso;var Sso=t=>{switch(t){case"sunos":return"solaris";case"win32":return"windows";default:return t}};IK.normalizeType=Sso});var ARr=w(PDe=>{"use strict";Object.defineProperty(PDe,"__esModule",{value:!0});PDe.hostDetector=void 0;var U3t=rpe(),gRr=Ae("os"),wso=mRr(),Tso=F3t(),Q3t=class{detect(e){return{attributes:{[U3t.ATTR_HOST_NAME]:(0,gRr.hostname)(),[U3t.ATTR_HOST_ARCH]:(0,Tso.normalizeArch)((0,gRr.arch)()),[U3t.ATTR_HOST_ID]:(0,wso.getMachineId)()}}}};PDe.hostDetector=new Q3t});var vRr=w(MDe=>{"use strict";Object.defineProperty(MDe,"__esModule",{value:!0});MDe.osDetector=void 0;var yRr=rpe(),ERr=Ae("os"),Iso=F3t(),q3t=class{detect(e){return{attributes:{[yRr.ATTR_OS_TYPE]:(0,Iso.normalizeType)((0,ERr.platform)()),[yRr.ATTR_OS_VERSION]:(0,ERr.release)()}}}};MDe.osDetector=new q3t});var bRr=w(LDe=>{"use strict";Object.defineProperty(LDe,"__esModule",{value:!0});LDe.processDetector=void 0;var Dso=(Kt(),yt(ar)),fT=rpe(),Rso=Ae("os"),H3t=class{detect(e){let r={[fT.ATTR_PROCESS_PID]:process.pid,[fT.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[fT.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[fT.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[fT.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[fT.ATTR_PROCESS_RUNTIME_NAME]:"nodejs",[fT.ATTR_PROCESS_RUNTIME_DESCRIPTION]:"Node.js"};process.argv.length>1&&(r[fT.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let n=Rso.userInfo();r[fT.ATTR_PROCESS_OWNER]=n.username}catch(n){Dso.diag.debug(`error obtaining process owner: ${n}`)}return{attributes:r}}};LDe.processDetector=new H3t});var CRr=w(FDe=>{"use strict";Object.defineProperty(FDe,"__esModule",{value:!0});FDe.serviceInstanceIdDetector=void 0;var Bso=rpe(),Nso=Ae("crypto"),G3t=class{detect(e){return{attributes:{[Bso.ATTR_SERVICE_INSTANCE_ID]:(0,Nso.randomUUID)()}}}};FDe.serviceInstanceIdDetector=new G3t});var _Rr=w(uS=>{"use strict";Object.defineProperty(uS,"__esModule",{value:!0});uS.serviceInstanceIdDetector=uS.processDetector=uS.osDetector=uS.hostDetector=void 0;var Oso=ARr();Object.defineProperty(uS,"hostDetector",{enumerable:!0,get:function(){return Oso.hostDetector}});var kso=vRr();Object.defineProperty(uS,"osDetector",{enumerable:!0,get:function(){return kso.osDetector}});var Pso=bRr();Object.defineProperty(uS,"processDetector",{enumerable:!0,get:function(){return Pso.processDetector}});var Mso=CRr();Object.defineProperty(uS,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Mso.serviceInstanceIdDetector}})});var xRr=w(dS=>{"use strict";Object.defineProperty(dS,"__esModule",{value:!0});dS.serviceInstanceIdDetector=dS.processDetector=dS.osDetector=dS.hostDetector=void 0;var UDe=_Rr();Object.defineProperty(dS,"hostDetector",{enumerable:!0,get:function(){return UDe.hostDetector}});Object.defineProperty(dS,"osDetector",{enumerable:!0,get:function(){return UDe.osDetector}});Object.defineProperty(dS,"processDetector",{enumerable:!0,get:function(){return UDe.processDetector}});Object.defineProperty(dS,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return UDe.serviceInstanceIdDetector}})});var SRr=w(DK=>{"use strict";Object.defineProperty(DK,"__esModule",{value:!0});DK.noopDetector=DK.NoopDetector=void 0;var QDe=class{detect(){return{attributes:{}}}};DK.NoopDetector=QDe;DK.noopDetector=new QDe});var wRr=w(w3=>{"use strict";Object.defineProperty(w3,"__esModule",{value:!0});w3.noopDetector=w3.serviceInstanceIdDetector=w3.processDetector=w3.osDetector=w3.hostDetector=w3.envDetector=void 0;var Lso=aRr();Object.defineProperty(w3,"envDetector",{enumerable:!0,get:function(){return Lso.envDetector}});var qDe=xRr();Object.defineProperty(w3,"hostDetector",{enumerable:!0,get:function(){return qDe.hostDetector}});Object.defineProperty(w3,"osDetector",{enumerable:!0,get:function(){return qDe.osDetector}});Object.defineProperty(w3,"processDetector",{enumerable:!0,get:function(){return qDe.processDetector}});Object.defineProperty(w3,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return qDe.serviceInstanceIdDetector}});var Fso=SRr();Object.defineProperty(w3,"noopDetector",{enumerable:!0,get:function(){return Fso.noopDetector}})});var V3t=w(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});Df.defaultServiceName=Df.emptyResource=Df.defaultResource=Df.resourceFromAttributes=Df.serviceInstanceIdDetector=Df.processDetector=Df.osDetector=Df.hostDetector=Df.envDetector=Df.detectResources=void 0;var Uso=oRr();Object.defineProperty(Df,"detectResources",{enumerable:!0,get:function(){return Uso.detectResources}});var npe=wRr();Object.defineProperty(Df,"envDetector",{enumerable:!0,get:function(){return npe.envDetector}});Object.defineProperty(Df,"hostDetector",{enumerable:!0,get:function(){return npe.hostDetector}});Object.defineProperty(Df,"osDetector",{enumerable:!0,get:function(){return npe.osDetector}});Object.defineProperty(Df,"processDetector",{enumerable:!0,get:function(){return npe.processDetector}});Object.defineProperty(Df,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return npe.serviceInstanceIdDetector}});var j3t=P3t();Object.defineProperty(Df,"resourceFromAttributes",{enumerable:!0,get:function(){return j3t.resourceFromAttributes}});Object.defineProperty(Df,"defaultResource",{enumerable:!0,get:function(){return j3t.defaultResource}});Object.defineProperty(Df,"emptyResource",{enumerable:!0,get:function(){return j3t.emptyResource}});var Qso=N3t();Object.defineProperty(Df,"defaultServiceName",{enumerable:!0,get:function(){return Qso.defaultServiceName}})});var TRr=w(ipe=>{"use strict";Object.defineProperty(ipe,"__esModule",{value:!0});ipe.SeverityNumber=void 0;var qso;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(qso=ipe.SeverityNumber||(ipe.SeverityNumber={}))});var GDe=w(RK=>{"use strict";Object.defineProperty(RK,"__esModule",{value:!0});RK.NOOP_LOGGER=RK.NoopLogger=void 0;var HDe=class{emit(e){}};RK.NoopLogger=HDe;RK.NOOP_LOGGER=new HDe});var VDe=w(BK=>{"use strict";Object.defineProperty(BK,"__esModule",{value:!0});BK.NOOP_LOGGER_PROVIDER=BK.NoopLoggerProvider=void 0;var Hso=GDe(),jDe=class{getLogger(e,r,n){return new Hso.NoopLogger}};BK.NoopLoggerProvider=jDe;BK.NOOP_LOGGER_PROVIDER=new jDe});var W3t=w($De=>{"use strict";Object.defineProperty($De,"__esModule",{value:!0});$De.ProxyLogger=void 0;var Gso=GDe(),$3t=class{constructor(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Gso.NOOP_LOGGER}};$De.ProxyLogger=$3t});var Y3t=w(WDe=>{"use strict";Object.defineProperty(WDe,"__esModule",{value:!0});WDe.ProxyLoggerProvider=void 0;var jso=VDe(),Vso=W3t(),z3t=class{getLogger(e,r,n){var i;return(i=this._getDelegateLogger(e,r,n))!==null&&i!==void 0?i:new Vso.ProxyLogger(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:jso.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(e,r,n)}};WDe.ProxyLoggerProvider=z3t});var IRr=w(zDe=>{"use strict";Object.defineProperty(zDe,"__esModule",{value:!0});zDe._globalThis=void 0;zDe._globalThis=typeof globalThis=="object"?globalThis:global});var DRr=w(YDe=>{"use strict";Object.defineProperty(YDe,"__esModule",{value:!0});YDe._globalThis=void 0;var $so=IRr();Object.defineProperty(YDe,"_globalThis",{enumerable:!0,get:function(){return $so._globalThis}})});var RRr=w(KDe=>{"use strict";Object.defineProperty(KDe,"__esModule",{value:!0});KDe._globalThis=void 0;var Wso=DRr();Object.defineProperty(KDe,"_globalThis",{enumerable:!0,get:function(){return Wso._globalThis}})});var BRr=w(fS=>{"use strict";Object.defineProperty(fS,"__esModule",{value:!0});fS.API_BACKWARDS_COMPATIBILITY_VERSION=fS.makeGetter=fS._global=fS.GLOBAL_LOGS_API_KEY=void 0;var zso=RRr();fS.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");fS._global=zso._globalThis;function Yso(t,e,r){return n=>n===t?e:r}fS.makeGetter=Yso;fS.API_BACKWARDS_COMPATIBILITY_VERSION=1});var ORr=w(JDe=>{"use strict";Object.defineProperty(JDe,"__esModule",{value:!0});JDe.LogsAPI=void 0;var Hv=BRr(),Kso=VDe(),NRr=Y3t(),K3t=class t{constructor(){this._proxyLoggerProvider=new NRr.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return Hv._global[Hv.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(Hv._global[Hv.GLOBAL_LOGS_API_KEY]=(0,Hv.makeGetter)(Hv.API_BACKWARDS_COMPATIBILITY_VERSION,e,Kso.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=Hv._global[Hv.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(Hv._global,Hv.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete Hv._global[Hv.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new NRr.ProxyLoggerProvider}};JDe.LogsAPI=K3t});var MRr=w(Um=>{"use strict";Object.defineProperty(Um,"__esModule",{value:!0});Um.logs=Um.ProxyLoggerProvider=Um.ProxyLogger=Um.NoopLoggerProvider=Um.NOOP_LOGGER_PROVIDER=Um.NoopLogger=Um.NOOP_LOGGER=Um.SeverityNumber=void 0;var Jso=TRr();Object.defineProperty(Um,"SeverityNumber",{enumerable:!0,get:function(){return Jso.SeverityNumber}});var kRr=GDe();Object.defineProperty(Um,"NOOP_LOGGER",{enumerable:!0,get:function(){return kRr.NOOP_LOGGER}});Object.defineProperty(Um,"NoopLogger",{enumerable:!0,get:function(){return kRr.NoopLogger}});var PRr=VDe();Object.defineProperty(Um,"NOOP_LOGGER_PROVIDER",{enumerable:!0,get:function(){return PRr.NOOP_LOGGER_PROVIDER}});Object.defineProperty(Um,"NoopLoggerProvider",{enumerable:!0,get:function(){return PRr.NoopLoggerProvider}});var Xso=W3t();Object.defineProperty(Um,"ProxyLogger",{enumerable:!0,get:function(){return Xso.ProxyLogger}});var Zso=Y3t();Object.defineProperty(Um,"ProxyLoggerProvider",{enumerable:!0,get:function(){return Zso.ProxyLoggerProvider}});var eao=ORr();Um.logs=eao.LogsAPI.getInstance()});var ope=w(dB=>{"use strict";Object.defineProperty(dB,"__esModule",{value:!0});dB.isTracingSuppressed=dB.unsuppressTracing=dB.suppressTracing=void 0;var tao=(Kt(),yt(ar)),J3t=(0,tao.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function rao(t){return t.setValue(J3t,!0)}dB.suppressTracing=rao;function nao(t){return t.deleteValue(J3t)}dB.unsuppressTracing=nao;function iao(t){return t.getValue(J3t)===!0}dB.isTracingSuppressed=iao});var X3t=w(y2=>{"use strict";Object.defineProperty(y2,"__esModule",{value:!0});y2.BAGGAGE_MAX_TOTAL_LENGTH=y2.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=y2.BAGGAGE_MAX_NAME_VALUE_PAIRS=y2.BAGGAGE_HEADER=y2.BAGGAGE_ITEMS_SEPARATOR=y2.BAGGAGE_PROPERTIES_SEPARATOR=y2.BAGGAGE_KEY_PAIR_SEPARATOR=void 0;y2.BAGGAGE_KEY_PAIR_SEPARATOR="=";y2.BAGGAGE_PROPERTIES_SEPARATOR=";";y2.BAGGAGE_ITEMS_SEPARATOR=",";y2.BAGGAGE_HEADER="baggage";y2.BAGGAGE_MAX_NAME_VALUE_PAIRS=180;y2.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096;y2.BAGGAGE_MAX_TOTAL_LENGTH=8192});var Z3t=w(pS=>{"use strict";Object.defineProperty(pS,"__esModule",{value:!0});pS.parseKeyPairsIntoRecord=pS.parsePairKeyValue=pS.getKeyPairs=pS.serializeKeyPairs=void 0;var oao=(Kt(),yt(ar)),RF=X3t();function sao(t){return t.reduce((e,r)=>{let n=`${e}${e!==""?RF.BAGGAGE_ITEMS_SEPARATOR:""}${r}`;return n.length>RF.BAGGAGE_MAX_TOTAL_LENGTH?e:n},"")}pS.serializeKeyPairs=sao;function aao(t){return t.getAllEntries().map(([e,r])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=RF.BAGGAGE_PROPERTIES_SEPARATOR+r.metadata.toString()),n})}pS.getKeyPairs=aao;function LRr(t){let e=t.split(RF.BAGGAGE_PROPERTIES_SEPARATOR);if(e.length<=0)return;let r=e.shift();if(!r)return;let n=r.indexOf(RF.BAGGAGE_KEY_PAIR_SEPARATOR);if(n<=0)return;let i=decodeURIComponent(r.substring(0,n).trim()),o=decodeURIComponent(r.substring(n+1).trim()),s;return e.length>0&&(s=(0,oao.baggageEntryMetadataFromString)(e.join(RF.BAGGAGE_PROPERTIES_SEPARATOR))),{key:i,value:o,metadata:s}}pS.parsePairKeyValue=LRr;function cao(t){let e={};return typeof t=="string"&&t.length>0&&t.split(RF.BAGGAGE_ITEMS_SEPARATOR).forEach(r=>{let n=LRr(r);n!==void 0&&n.value.length>0&&(e[n.key]=n.value)}),e}pS.parseKeyPairsIntoRecord=cao});var FRr=w(XDe=>{"use strict";Object.defineProperty(XDe,"__esModule",{value:!0});XDe.W3CBaggagePropagator=void 0;var eyt=(Kt(),yt(ar)),lao=ope(),BF=X3t(),tyt=Z3t(),ryt=class{inject(e,r,n){let i=eyt.propagation.getBaggage(e);if(!i||(0,lao.isTracingSuppressed)(e))return;let o=(0,tyt.getKeyPairs)(i).filter(a=>a.length<=BF.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,BF.BAGGAGE_MAX_NAME_VALUE_PAIRS),s=(0,tyt.serializeKeyPairs)(o);s.length>0&&n.set(r,BF.BAGGAGE_HEADER,s)}extract(e,r,n){let i=n.get(r,BF.BAGGAGE_HEADER),o=Array.isArray(i)?i.join(BF.BAGGAGE_ITEMS_SEPARATOR):i;if(!o)return e;let s={};return o.length===0||(o.split(BF.BAGGAGE_ITEMS_SEPARATOR).forEach(c=>{let u=(0,tyt.parsePairKeyValue)(c);if(u){let d={value:u.value};u.metadata&&(d.metadata=u.metadata),s[u.key]=d}}),Object.entries(s).length===0)?e:eyt.propagation.setBaggage(e,eyt.propagation.createBaggage(s))}fields(){return[BF.BAGGAGE_HEADER]}};XDe.W3CBaggagePropagator=ryt});var URr=w(ZDe=>{"use strict";Object.defineProperty(ZDe,"__esModule",{value:!0});ZDe.AnchoredClock=void 0;var nyt=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(e,r){this._monotonicClock=r,this._epochMillis=e.now(),this._performanceMillis=r.now()}now(){let e=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+e}};ZDe.AnchoredClock=nyt});var jRr=w(fB=>{"use strict";Object.defineProperty(fB,"__esModule",{value:!0});fB.isAttributeValue=fB.isAttributeKey=fB.sanitizeAttributes=void 0;var QRr=(Kt(),yt(ar));function uao(t){let e={};if(typeof t!="object"||t==null)return e;for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(!qRr(r)){QRr.diag.warn(`Invalid attribute key: ${r}`);continue}let n=t[r];if(!HRr(n)){QRr.diag.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?e[r]=n.slice():e[r]=n}return e}fB.sanitizeAttributes=uao;function qRr(t){return typeof t=="string"&&t!==""}fB.isAttributeKey=qRr;function HRr(t){return t==null?!0:Array.isArray(t)?dao(t):GRr(typeof t)}fB.isAttributeValue=HRr;function dao(t){let e;for(let r of t){if(r==null)continue;let n=typeof r;if(n!==e){if(!e){if(GRr(n)){e=n;continue}return!1}return!1}}return!0}function GRr(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}});var iyt=w(eRe=>{"use strict";Object.defineProperty(eRe,"__esModule",{value:!0});eRe.loggingErrorHandler=void 0;var fao=(Kt(),yt(ar));function pao(){return t=>{fao.diag.error(hao(t))}}eRe.loggingErrorHandler=pao;function hao(t){return typeof t=="string"?t:JSON.stringify(mao(t))}function mao(t){let e={},r=t;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(e[n])return;let i=r[n];i&&(e[n]=String(i))}),r=Object.getPrototypeOf(r);return e}});var $Rr=w(NK=>{"use strict";Object.defineProperty(NK,"__esModule",{value:!0});NK.globalErrorHandler=NK.setGlobalErrorHandler=void 0;var gao=iyt(),VRr=(0,gao.loggingErrorHandler)();function Aao(t){VRr=t}NK.setGlobalErrorHandler=Aao;function yao(t){try{VRr(t)}catch{}}NK.globalErrorHandler=yao});var KRr=w(hS=>{"use strict";Object.defineProperty(hS,"__esModule",{value:!0});hS.getStringListFromEnv=hS.getBooleanFromEnv=hS.getStringFromEnv=hS.getNumberFromEnv=void 0;var WRr=(Kt(),yt(ar)),zRr=Ae("util");function Eao(t){let e=process.env[t];if(e==null||e.trim()==="")return;let r=Number(e);if(isNaN(r)){WRr.diag.warn(`Unknown value ${(0,zRr.inspect)(e)} for ${t}, expected a number, using defaults`);return}return r}hS.getNumberFromEnv=Eao;function YRr(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}hS.getStringFromEnv=YRr;function vao(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||WRr.diag.warn(`Unknown value ${(0,zRr.inspect)(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}hS.getBooleanFromEnv=vao;function bao(t){return YRr(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}hS.getStringListFromEnv=bao});var JRr=w(tRe=>{"use strict";Object.defineProperty(tRe,"__esModule",{value:!0});tRe._globalThis=void 0;tRe._globalThis=typeof globalThis=="object"?globalThis:global});var XRr=w(rRe=>{"use strict";Object.defineProperty(rRe,"__esModule",{value:!0});rRe.otperformance=void 0;var Cao=Ae("perf_hooks");rRe.otperformance=Cao.performance});var ZRr=w(nRe=>{"use strict";Object.defineProperty(nRe,"__esModule",{value:!0});nRe.VERSION=void 0;nRe.VERSION="2.2.0"});var eBr=w(iRe=>{"use strict";Object.defineProperty(iRe,"__esModule",{value:!0});iRe.ATTR_PROCESS_RUNTIME_NAME=void 0;iRe.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name"});var tBr=w(sRe=>{"use strict";Object.defineProperty(sRe,"__esModule",{value:!0});sRe.SDK_INFO=void 0;var _ao=ZRr(),oRe=(Nh(),yt(l2)),xao=eBr();sRe.SDK_INFO={[oRe.ATTR_TELEMETRY_SDK_NAME]:"opentelemetry",[xao.ATTR_PROCESS_RUNTIME_NAME]:"node",[oRe.ATTR_TELEMETRY_SDK_LANGUAGE]:oRe.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[oRe.ATTR_TELEMETRY_SDK_VERSION]:_ao.VERSION}});var rBr=w(E2=>{"use strict";Object.defineProperty(E2,"__esModule",{value:!0});E2.SDK_INFO=E2.otperformance=E2._globalThis=E2.getStringListFromEnv=E2.getNumberFromEnv=E2.getBooleanFromEnv=E2.getStringFromEnv=void 0;var aRe=KRr();Object.defineProperty(E2,"getStringFromEnv",{enumerable:!0,get:function(){return aRe.getStringFromEnv}});Object.defineProperty(E2,"getBooleanFromEnv",{enumerable:!0,get:function(){return aRe.getBooleanFromEnv}});Object.defineProperty(E2,"getNumberFromEnv",{enumerable:!0,get:function(){return aRe.getNumberFromEnv}});Object.defineProperty(E2,"getStringListFromEnv",{enumerable:!0,get:function(){return aRe.getStringListFromEnv}});var Sao=JRr();Object.defineProperty(E2,"_globalThis",{enumerable:!0,get:function(){return Sao._globalThis}});var wao=XRr();Object.defineProperty(E2,"otperformance",{enumerable:!0,get:function(){return wao.otperformance}});var Tao=tBr();Object.defineProperty(E2,"SDK_INFO",{enumerable:!0,get:function(){return Tao.SDK_INFO}})});var oyt=w(v2=>{"use strict";Object.defineProperty(v2,"__esModule",{value:!0});v2.getStringListFromEnv=v2.getNumberFromEnv=v2.getStringFromEnv=v2.getBooleanFromEnv=v2.otperformance=v2._globalThis=v2.SDK_INFO=void 0;var NF=rBr();Object.defineProperty(v2,"SDK_INFO",{enumerable:!0,get:function(){return NF.SDK_INFO}});Object.defineProperty(v2,"_globalThis",{enumerable:!0,get:function(){return NF._globalThis}});Object.defineProperty(v2,"otperformance",{enumerable:!0,get:function(){return NF.otperformance}});Object.defineProperty(v2,"getBooleanFromEnv",{enumerable:!0,get:function(){return NF.getBooleanFromEnv}});Object.defineProperty(v2,"getStringFromEnv",{enumerable:!0,get:function(){return NF.getStringFromEnv}});Object.defineProperty(v2,"getNumberFromEnv",{enumerable:!0,get:function(){return NF.getNumberFromEnv}});Object.defineProperty(v2,"getStringListFromEnv",{enumerable:!0,get:function(){return NF.getStringListFromEnv}})});var sBr=w(hu=>{"use strict";Object.defineProperty(hu,"__esModule",{value:!0});hu.addHrTimes=hu.isTimeInput=hu.isTimeInputHrTime=hu.hrTimeToMicroseconds=hu.hrTimeToMilliseconds=hu.hrTimeToNanoseconds=hu.hrTimeToTimeStamp=hu.hrTimeDuration=hu.timeInputToHrTime=hu.hrTime=hu.getTimeOrigin=hu.millisToHrTime=void 0;var syt=oyt(),nBr=9,Iao=6,Dao=Math.pow(10,Iao),cRe=Math.pow(10,nBr);function spe(t){let e=t/1e3,r=Math.trunc(e),n=Math.round(t%1e3*Dao);return[r,n]}hu.millisToHrTime=spe;function ayt(){let t=syt.otperformance.timeOrigin;if(typeof t!="number"){let e=syt.otperformance;t=e.timing&&e.timing.fetchStart}return t}hu.getTimeOrigin=ayt;function iBr(t){let e=spe(ayt()),r=spe(typeof t=="number"?t:syt.otperformance.now());return oBr(e,r)}hu.hrTime=iBr;function Rao(t){if(cyt(t))return t;if(typeof t=="number")return t<ayt()?iBr(t):spe(t);if(t instanceof Date)return spe(t.getTime());throw TypeError("Invalid input type")}hu.timeInputToHrTime=Rao;function Bao(t,e){let r=e[0]-t[0],n=e[1]-t[1];return n<0&&(r-=1,n+=cRe),[r,n]}hu.hrTimeDuration=Bao;function Nao(t){let e=nBr,r=`${"0".repeat(e)}${t[1]}Z`,n=r.substring(r.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",n)}hu.hrTimeToTimeStamp=Nao;function Oao(t){return t[0]*cRe+t[1]}hu.hrTimeToNanoseconds=Oao;function kao(t){return t[0]*1e3+t[1]/1e6}hu.hrTimeToMilliseconds=kao;function Pao(t){return t[0]*1e6+t[1]/1e3}hu.hrTimeToMicroseconds=Pao;function cyt(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}hu.isTimeInputHrTime=cyt;function Mao(t){return cyt(t)||typeof t=="number"||t instanceof Date}hu.isTimeInput=Mao;function oBr(t,e){let r=[t[0]+e[0],t[1]+e[1]];return r[1]>=cRe&&(r[1]-=cRe,r[0]+=1),r}hu.addHrTimes=oBr});var aBr=w(lRe=>{"use strict";Object.defineProperty(lRe,"__esModule",{value:!0});lRe.unrefTimer=void 0;function Lao(t){typeof t!="number"&&t.unref()}lRe.unrefTimer=Lao});var cBr=w(ape=>{"use strict";Object.defineProperty(ape,"__esModule",{value:!0});ape.ExportResultCode=void 0;var Fao;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(Fao=ape.ExportResultCode||(ape.ExportResultCode={}))});var uBr=w(uRe=>{"use strict";Object.defineProperty(uRe,"__esModule",{value:!0});uRe.CompositePropagator=void 0;var lBr=(Kt(),yt(ar)),lyt=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(r=>typeof r.fields=="function"?r.fields():[]).reduce((r,n)=>r.concat(n),[])))}inject(e,r,n){for(let i of this._propagators)try{i.inject(e,r,n)}catch(o){lBr.diag.warn(`Failed to inject with ${i.constructor.name}. Err: ${o.message}`)}}extract(e,r,n){return this._propagators.reduce((i,o)=>{try{return o.extract(i,r,n)}catch(s){lBr.diag.warn(`Failed to extract with ${o.constructor.name}. Err: ${s.message}`)}return i},e)}fields(){return this._fields.slice()}};uRe.CompositePropagator=lyt});var dBr=w(OK=>{"use strict";Object.defineProperty(OK,"__esModule",{value:!0});OK.validateValue=OK.validateKey=void 0;var uyt="[_0-9a-z-*/]",Uao=`[a-z]${uyt}{0,255}`,Qao=`[a-z0-9]${uyt}{0,240}@[a-z]${uyt}{0,13}`,qao=new RegExp(`^(?:${Uao}|${Qao})$`),Hao=/^[ -~]{0,255}[!-~]$/,Gao=/,|=/;function jao(t){return qao.test(t)}OK.validateKey=jao;function Vao(t){return Hao.test(t)&&!Gao.test(t)}OK.validateValue=Vao});var fyt=w(dRe=>{"use strict";Object.defineProperty(dRe,"__esModule",{value:!0});dRe.TraceState=void 0;var fBr=dBr(),pBr=32,$ao=512,hBr=",",mBr="=",dyt=class t{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,r){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,r),n}unset(e){let r=this._clone();return r._internalState.delete(e),r}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,r)=>(e.push(r+mBr+this.get(r)),e),[]).join(hBr)}_parse(e){e.length>$ao||(this._internalState=e.split(hBr).reverse().reduce((r,n)=>{let i=n.trim(),o=i.indexOf(mBr);if(o!==-1){let s=i.slice(0,o),a=i.slice(o+1,n.length);(0,fBr.validateKey)(s)&&(0,fBr.validateValue)(a)&&r.set(s,a)}return r},new Map),this._internalState.size>pBr&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,pBr))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}};dRe.TraceState=dyt});var ABr=w(b2=>{"use strict";Object.defineProperty(b2,"__esModule",{value:!0});b2.W3CTraceContextPropagator=b2.parseTraceParent=b2.TRACE_STATE_HEADER=b2.TRACE_PARENT_HEADER=void 0;var fRe=(Kt(),yt(ar)),Wao=ope(),zao=fyt();b2.TRACE_PARENT_HEADER="traceparent";b2.TRACE_STATE_HEADER="tracestate";var Yao="00",Kao="(?!ff)[\\da-f]{2}",Jao="(?![0]{32})[\\da-f]{32}",Xao="(?![0]{16})[\\da-f]{16}",Zao="[\\da-f]{2}",eco=new RegExp(`^\\s?(${Kao})-(${Jao})-(${Xao})-(${Zao})(-.*)?\\s?$`);function gBr(t){let e=eco.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}b2.parseTraceParent=gBr;var pyt=class{inject(e,r,n){let i=fRe.trace.getSpanContext(e);if(!i||(0,Wao.isTracingSuppressed)(e)||!(0,fRe.isSpanContextValid)(i))return;let o=`${Yao}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||fRe.TraceFlags.NONE).toString(16)}`;n.set(r,b2.TRACE_PARENT_HEADER,o),i.traceState&&n.set(r,b2.TRACE_STATE_HEADER,i.traceState.serialize())}extract(e,r,n){let i=n.get(r,b2.TRACE_PARENT_HEADER);if(!i)return e;let o=Array.isArray(i)?i[0]:i;if(typeof o!="string")return e;let s=gBr(o);if(!s)return e;s.isRemote=!0;let a=n.get(r,b2.TRACE_STATE_HEADER);if(a){let c=Array.isArray(a)?a.join(","):a;s.traceState=new zao.TraceState(typeof c=="string"?c:void 0)}return fRe.trace.setSpanContext(e,s)}fields(){return[b2.TRACE_PARENT_HEADER,b2.TRACE_STATE_HEADER]}};b2.W3CTraceContextPropagator=pyt});var yBr=w(JC=>{"use strict";Object.defineProperty(JC,"__esModule",{value:!0});JC.getRPCMetadata=JC.deleteRPCMetadata=JC.setRPCMetadata=JC.RPCType=void 0;var tco=(Kt(),yt(ar)),hyt=(0,tco.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"),rco;(function(t){t.HTTP="http"})(rco=JC.RPCType||(JC.RPCType={}));function nco(t,e){return t.setValue(hyt,e)}JC.setRPCMetadata=nco;function ico(t){return t.deleteValue(hyt)}JC.deleteRPCMetadata=ico;function oco(t){return t.getValue(hyt)}JC.getRPCMetadata=oco});var _Br=w(pRe=>{"use strict";Object.defineProperty(pRe,"__esModule",{value:!0});pRe.isPlainObject=void 0;var sco="[object Object]",aco="[object Null]",cco="[object Undefined]",lco=Function.prototype,EBr=lco.toString,uco=EBr.call(Object),dco=Object.getPrototypeOf,vBr=Object.prototype,bBr=vBr.hasOwnProperty,OF=Symbol?Symbol.toStringTag:void 0,CBr=vBr.toString;function fco(t){if(!pco(t)||hco(t)!==sco)return!1;let e=dco(t);if(e===null)return!0;let r=bBr.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&EBr.call(r)===uco}pRe.isPlainObject=fco;function pco(t){return t!=null&&typeof t=="object"}function hco(t){return t==null?t===void 0?cco:aco:OF&&OF in Object(t)?mco(t):gco(t)}function mco(t){let e=bBr.call(t,OF),r=t[OF],n=!1;try{t[OF]=void 0,n=!0}catch{}let i=CBr.call(t);return n&&(e?t[OF]=r:delete t[OF]),i}function gco(t){return CBr.call(t)}});var IBr=w(gRe=>{"use strict";Object.defineProperty(gRe,"__esModule",{value:!0});gRe.merge=void 0;var xBr=_Br(),Aco=20;function yco(...t){let e=t.shift(),r=new WeakMap;for(;t.length>0;)e=wBr(e,t.shift(),0,r);return e}gRe.merge=yco;function myt(t){return mRe(t)?t.slice():t}function wBr(t,e,r=0,n){let i;if(!(r>Aco)){if(r++,hRe(t)||hRe(e)||TBr(e))i=myt(e);else if(mRe(t)){if(i=t.slice(),mRe(e))for(let o=0,s=e.length;o<s;o++)i.push(myt(e[o]));else if(cpe(e)){let o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){let c=o[s];i[c]=myt(e[c])}}}else if(cpe(t))if(cpe(e)){if(!Eco(t,e))return e;i=Object.assign({},t);let o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){let c=o[s],u=e[c];if(hRe(u))typeof u>"u"?delete i[c]:i[c]=u;else{let d=i[c],f=u;if(SBr(t,c,n)||SBr(e,c,n))delete i[c];else{if(cpe(d)&&cpe(f)){let p=n.get(d)||[],h=n.get(f)||[];p.push({obj:t,key:c}),h.push({obj:e,key:c}),n.set(d,p),n.set(f,h)}i[c]=wBr(i[c],u,r,n)}}}}else i=e;return i}}function SBr(t,e,r){let n=r.get(t[e])||[];for(let i=0,o=n.length;i<o;i++){let s=n[i];if(s.key===e&&s.obj===t)return!0}return!1}function mRe(t){return Array.isArray(t)}function TBr(t){return typeof t=="function"}function cpe(t){return!hRe(t)&&!mRe(t)&&!TBr(t)&&typeof t=="object"}function hRe(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function Eco(t,e){return!(!(0,xBr.isPlainObject)(t)||!(0,xBr.isPlainObject)(e))}});var DBr=w(kK=>{"use strict";Object.defineProperty(kK,"__esModule",{value:!0});kK.callWithTimeout=kK.TimeoutError=void 0;var ARe=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};kK.TimeoutError=ARe;function vco(t,e){let r,n=new Promise(function(o,s){r=setTimeout(function(){s(new ARe("Operation timed out."))},e)});return Promise.race([t,n]).then(i=>(clearTimeout(r),i),i=>{throw clearTimeout(r),i})}kK.callWithTimeout=vco});var BBr=w(PK=>{"use strict";Object.defineProperty(PK,"__esModule",{value:!0});PK.isUrlIgnored=PK.urlMatches=void 0;function RBr(t,e){return typeof e=="string"?t===e:!!t.match(e)}PK.urlMatches=RBr;function bco(t,e){if(!e)return!1;for(let r of e)if(RBr(t,r))return!0;return!1}PK.isUrlIgnored=bco});var NBr=w(yRe=>{"use strict";Object.defineProperty(yRe,"__esModule",{value:!0});yRe.Deferred=void 0;var gyt=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};yRe.Deferred=gyt});var OBr=w(ERe=>{"use strict";Object.defineProperty(ERe,"__esModule",{value:!0});ERe.BindOnceFuture=void 0;var Cco=NBr(),Ayt=class{_callback;_that;_isCalled=!1;_deferred=new Cco.Deferred;constructor(e,r){this._callback=e,this._that=r}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}};ERe.BindOnceFuture=Ayt});var PBr=w(vRe=>{"use strict";Object.defineProperty(vRe,"__esModule",{value:!0});vRe.diagLogLevelFromString=void 0;var pT=(Kt(),yt(ar)),kBr={ALL:pT.DiagLogLevel.ALL,VERBOSE:pT.DiagLogLevel.VERBOSE,DEBUG:pT.DiagLogLevel.DEBUG,INFO:pT.DiagLogLevel.INFO,WARN:pT.DiagLogLevel.WARN,ERROR:pT.DiagLogLevel.ERROR,NONE:pT.DiagLogLevel.NONE};function _co(t){if(t==null)return;let e=kBr[t.toUpperCase()];return e??(pT.diag.warn(`Unknown log level "${t}", expected one of ${Object.keys(kBr)}, using default`),pT.DiagLogLevel.INFO)}vRe.diagLogLevelFromString=_co});var LBr=w(bRe=>{"use strict";Object.defineProperty(bRe,"__esModule",{value:!0});bRe._export=void 0;var MBr=(Kt(),yt(ar)),xco=ope();function Sco(t,e){return new Promise(r=>{MBr.context.with((0,xco.suppressTracing)(MBr.context.active()),()=>{t.export(e,n=>{r(n)})})})}bRe._export=Sco});var hT=w(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.internal=Lr.diagLogLevelFromString=Lr.BindOnceFuture=Lr.urlMatches=Lr.isUrlIgnored=Lr.callWithTimeout=Lr.TimeoutError=Lr.merge=Lr.TraceState=Lr.unsuppressTracing=Lr.suppressTracing=Lr.isTracingSuppressed=Lr.setRPCMetadata=Lr.getRPCMetadata=Lr.deleteRPCMetadata=Lr.RPCType=Lr.parseTraceParent=Lr.W3CTraceContextPropagator=Lr.TRACE_STATE_HEADER=Lr.TRACE_PARENT_HEADER=Lr.CompositePropagator=Lr.otperformance=Lr.getStringListFromEnv=Lr.getNumberFromEnv=Lr.getBooleanFromEnv=Lr.getStringFromEnv=Lr._globalThis=Lr.SDK_INFO=Lr.parseKeyPairsIntoRecord=Lr.ExportResultCode=Lr.unrefTimer=Lr.timeInputToHrTime=Lr.millisToHrTime=Lr.isTimeInputHrTime=Lr.isTimeInput=Lr.hrTimeToTimeStamp=Lr.hrTimeToNanoseconds=Lr.hrTimeToMilliseconds=Lr.hrTimeToMicroseconds=Lr.hrTimeDuration=Lr.hrTime=Lr.getTimeOrigin=Lr.addHrTimes=Lr.loggingErrorHandler=Lr.setGlobalErrorHandler=Lr.globalErrorHandler=Lr.sanitizeAttributes=Lr.isAttributeValue=Lr.AnchoredClock=Lr.W3CBaggagePropagator=void 0;var wco=FRr();Object.defineProperty(Lr,"W3CBaggagePropagator",{enumerable:!0,get:function(){return wco.W3CBaggagePropagator}});var Tco=URr();Object.defineProperty(Lr,"AnchoredClock",{enumerable:!0,get:function(){return Tco.AnchoredClock}});var FBr=jRr();Object.defineProperty(Lr,"isAttributeValue",{enumerable:!0,get:function(){return FBr.isAttributeValue}});Object.defineProperty(Lr,"sanitizeAttributes",{enumerable:!0,get:function(){return FBr.sanitizeAttributes}});var UBr=$Rr();Object.defineProperty(Lr,"globalErrorHandler",{enumerable:!0,get:function(){return UBr.globalErrorHandler}});Object.defineProperty(Lr,"setGlobalErrorHandler",{enumerable:!0,get:function(){return UBr.setGlobalErrorHandler}});var Ico=iyt();Object.defineProperty(Lr,"loggingErrorHandler",{enumerable:!0,get:function(){return Ico.loggingErrorHandler}});var Gv=sBr();Object.defineProperty(Lr,"addHrTimes",{enumerable:!0,get:function(){return Gv.addHrTimes}});Object.defineProperty(Lr,"getTimeOrigin",{enumerable:!0,get:function(){return Gv.getTimeOrigin}});Object.defineProperty(Lr,"hrTime",{enumerable:!0,get:function(){return Gv.hrTime}});Object.defineProperty(Lr,"hrTimeDuration",{enumerable:!0,get:function(){return Gv.hrTimeDuration}});Object.defineProperty(Lr,"hrTimeToMicroseconds",{enumerable:!0,get:function(){return Gv.hrTimeToMicroseconds}});Object.defineProperty(Lr,"hrTimeToMilliseconds",{enumerable:!0,get:function(){return Gv.hrTimeToMilliseconds}});Object.defineProperty(Lr,"hrTimeToNanoseconds",{enumerable:!0,get:function(){return Gv.hrTimeToNanoseconds}});Object.defineProperty(Lr,"hrTimeToTimeStamp",{enumerable:!0,get:function(){return Gv.hrTimeToTimeStamp}});Object.defineProperty(Lr,"isTimeInput",{enumerable:!0,get:function(){return Gv.isTimeInput}});Object.defineProperty(Lr,"isTimeInputHrTime",{enumerable:!0,get:function(){return Gv.isTimeInputHrTime}});Object.defineProperty(Lr,"millisToHrTime",{enumerable:!0,get:function(){return Gv.millisToHrTime}});Object.defineProperty(Lr,"timeInputToHrTime",{enumerable:!0,get:function(){return Gv.timeInputToHrTime}});var Dco=aBr();Object.defineProperty(Lr,"unrefTimer",{enumerable:!0,get:function(){return Dco.unrefTimer}});var Rco=cBr();Object.defineProperty(Lr,"ExportResultCode",{enumerable:!0,get:function(){return Rco.ExportResultCode}});var Bco=Z3t();Object.defineProperty(Lr,"parseKeyPairsIntoRecord",{enumerable:!0,get:function(){return Bco.parseKeyPairsIntoRecord}});var kF=oyt();Object.defineProperty(Lr,"SDK_INFO",{enumerable:!0,get:function(){return kF.SDK_INFO}});Object.defineProperty(Lr,"_globalThis",{enumerable:!0,get:function(){return kF._globalThis}});Object.defineProperty(Lr,"getStringFromEnv",{enumerable:!0,get:function(){return kF.getStringFromEnv}});Object.defineProperty(Lr,"getBooleanFromEnv",{enumerable:!0,get:function(){return kF.getBooleanFromEnv}});Object.defineProperty(Lr,"getNumberFromEnv",{enumerable:!0,get:function(){return kF.getNumberFromEnv}});Object.defineProperty(Lr,"getStringListFromEnv",{enumerable:!0,get:function(){return kF.getStringListFromEnv}});Object.defineProperty(Lr,"otperformance",{enumerable:!0,get:function(){return kF.otperformance}});var Nco=uBr();Object.defineProperty(Lr,"CompositePropagator",{enumerable:!0,get:function(){return Nco.CompositePropagator}});var CRe=ABr();Object.defineProperty(Lr,"TRACE_PARENT_HEADER",{enumerable:!0,get:function(){return CRe.TRACE_PARENT_HEADER}});Object.defineProperty(Lr,"TRACE_STATE_HEADER",{enumerable:!0,get:function(){return CRe.TRACE_STATE_HEADER}});Object.defineProperty(Lr,"W3CTraceContextPropagator",{enumerable:!0,get:function(){return CRe.W3CTraceContextPropagator}});Object.defineProperty(Lr,"parseTraceParent",{enumerable:!0,get:function(){return CRe.parseTraceParent}});var _Re=yBr();Object.defineProperty(Lr,"RPCType",{enumerable:!0,get:function(){return _Re.RPCType}});Object.defineProperty(Lr,"deleteRPCMetadata",{enumerable:!0,get:function(){return _Re.deleteRPCMetadata}});Object.defineProperty(Lr,"getRPCMetadata",{enumerable:!0,get:function(){return _Re.getRPCMetadata}});Object.defineProperty(Lr,"setRPCMetadata",{enumerable:!0,get:function(){return _Re.setRPCMetadata}});var yyt=ope();Object.defineProperty(Lr,"isTracingSuppressed",{enumerable:!0,get:function(){return yyt.isTracingSuppressed}});Object.defineProperty(Lr,"suppressTracing",{enumerable:!0,get:function(){return yyt.suppressTracing}});Object.defineProperty(Lr,"unsuppressTracing",{enumerable:!0,get:function(){return yyt.unsuppressTracing}});var Oco=fyt();Object.defineProperty(Lr,"TraceState",{enumerable:!0,get:function(){return Oco.TraceState}});var kco=IBr();Object.defineProperty(Lr,"merge",{enumerable:!0,get:function(){return kco.merge}});var QBr=DBr();Object.defineProperty(Lr,"TimeoutError",{enumerable:!0,get:function(){return QBr.TimeoutError}});Object.defineProperty(Lr,"callWithTimeout",{enumerable:!0,get:function(){return QBr.callWithTimeout}});var qBr=BBr();Object.defineProperty(Lr,"isUrlIgnored",{enumerable:!0,get:function(){return qBr.isUrlIgnored}});Object.defineProperty(Lr,"urlMatches",{enumerable:!0,get:function(){return qBr.urlMatches}});var Pco=OBr();Object.defineProperty(Lr,"BindOnceFuture",{enumerable:!0,get:function(){return Pco.BindOnceFuture}});var Mco=PBr();Object.defineProperty(Lr,"diagLogLevelFromString",{enumerable:!0,get:function(){return Mco.diagLogLevelFromString}});var Lco=LBr();Lr.internal={_export:Lco._export}});var HBr=w(SRe=>{"use strict";Object.defineProperty(SRe,"__esModule",{value:!0});SRe.LogRecordImpl=void 0;var PF=(Kt(),yt(ar)),xRe=hT(),Eyt=class{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;totalAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this.totalAttributesCount-Object.keys(this.attributes).length}constructor(e,r,n){let{timestamp:i,observedTimestamp:o,eventName:s,severityNumber:a,severityText:c,body:u,attributes:d={},context:f}=n,p=Date.now();if(this.hrTime=(0,xRe.timeInputToHrTime)(i??p),this.hrTimeObserved=(0,xRe.timeInputToHrTime)(o??p),f){let h=PF.trace.getSpanContext(f);h&&PF.isSpanContextValid(h)&&(this.spanContext=h)}this.severityNumber=a,this.severityText=c,this.body=u,this.resource=e.resource,this.instrumentationScope=r,this._logRecordLimits=e.logRecordLimits,this._eventName=s,this.setAttributes(d)}setAttribute(e,r){return this._isLogRecordReadonly()?this:r===null?this:e.length===0?(PF.diag.warn(`Invalid attribute key: ${e}`),this):!(0,xRe.isAttributeValue)(r)&&!(typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length>0)?(PF.diag.warn(`Invalid attribute value set for key: ${e}`),this):(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,e)?(this.droppedAttributesCount===1&&PF.diag.warn("Dropping extra attributes."),this):((0,xRe.isAttributeValue)(r)?this.attributes[e]=this._truncateToSize(r):this.attributes[e]=r,this))}setAttributes(e){for(let[r,n]of Object.entries(e))this.setAttribute(r,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let r=this._logRecordLimits.attributeValueLengthLimit;return r<=0?(PF.diag.warn(`Attribute value limit must be positive, got ${r}`),e):typeof e=="string"?this._truncateToLimitUtil(e,r):Array.isArray(e)?e.map(n=>typeof n=="string"?this._truncateToLimitUtil(n,r):n):e}_truncateToLimitUtil(e,r){return e.length<=r?e:e.substring(0,r)}_isLogRecordReadonly(){return this._isReadonly&&PF.diag.warn("Can not execute the operation on emitted log record"),this._isReadonly}};SRe.LogRecordImpl=Eyt});var GBr=w(wRe=>{"use strict";Object.defineProperty(wRe,"__esModule",{value:!0});wRe.Logger=void 0;var Fco=(Kt(),yt(ar)),Uco=HBr(),vyt=class{instrumentationScope;_sharedState;constructor(e,r){this.instrumentationScope=e,this._sharedState=r}emit(e){let r=e.context||Fco.context.active(),n=new Uco.LogRecordImpl(this._sharedState,this.instrumentationScope,{context:r,...e});this._sharedState.activeProcessor.onEmit(n,r),n._makeReadonly()}};wRe.Logger=vyt});var jBr=w(LK=>{"use strict";Object.defineProperty(LK,"__esModule",{value:!0});LK.reconfigureLimits=LK.loadDefaultConfig=void 0;var MK=hT();function Qco(){return{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:(0,MK.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,MK.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT")??128},includeTraceContext:!0}}LK.loadDefaultConfig=Qco;function qco(t){return{attributeCountLimit:t.attributeCountLimit??(0,MK.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT")??(0,MK.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??128,attributeValueLengthLimit:t.attributeValueLengthLimit??(0,MK.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT")??(0,MK.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0}}LK.reconfigureLimits=qco});var Cyt=w(TRe=>{"use strict";Object.defineProperty(TRe,"__esModule",{value:!0});TRe.NoopLogRecordProcessor=void 0;var byt=class{forceFlush(){return Promise.resolve()}onEmit(e,r){}shutdown(){return Promise.resolve()}};TRe.NoopLogRecordProcessor=byt});var VBr=w(IRe=>{"use strict";Object.defineProperty(IRe,"__esModule",{value:!0});IRe.MultiLogRecordProcessor=void 0;var Hco=hT(),_yt=class{processors;forceFlushTimeoutMillis;constructor(e,r){this.processors=e,this.forceFlushTimeoutMillis=r}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(r=>(0,Hco.callWithTimeout)(r.forceFlush(),e)))}onEmit(e,r){this.processors.forEach(n=>n.onEmit(e,r))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}};IRe.MultiLogRecordProcessor=_yt});var $Br=w(DRe=>{"use strict";Object.defineProperty(DRe,"__esModule",{value:!0});DRe.LoggerProviderSharedState=void 0;var Gco=Cyt(),jco=VBr(),xyt=class{resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];constructor(e,r,n,i){this.resource=e,this.forceFlushTimeoutMillis=r,this.logRecordLimits=n,this.processors=i,i.length>0?(this.registeredLogRecordProcessors=i,this.activeProcessor=new jco.MultiLogRecordProcessor(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Gco.NoopLogRecordProcessor}};DRe.LoggerProviderSharedState=xyt});var YBr=w(MF=>{"use strict";Object.defineProperty(MF,"__esModule",{value:!0});MF.LoggerProvider=MF.DEFAULT_LOGGER_NAME=void 0;var RRe=(Kt(),yt(ar)),Vco=MRr(),$co=V3t(),WBr=hT(),Wco=GBr(),zBr=jBr(),zco=$Br();MF.DEFAULT_LOGGER_NAME="unknown";var Syt=class{_shutdownOnce;_sharedState;constructor(e={}){let r=(0,WBr.merge)({},(0,zBr.loadDefaultConfig)(),e),n=e.resource??(0,$co.defaultResource)();this._sharedState=new zco.LoggerProviderSharedState(n,r.forceFlushTimeoutMillis,(0,zBr.reconfigureLimits)(r.logRecordLimits),e?.processors??[]),this._shutdownOnce=new WBr.BindOnceFuture(this._shutdown,this)}getLogger(e,r,n){if(this._shutdownOnce.isCalled)return RRe.diag.warn("A shutdown LoggerProvider cannot provide a Logger"),Vco.NOOP_LOGGER;e||RRe.diag.warn("Logger requested without instrumentation scope name.");let i=e||MF.DEFAULT_LOGGER_NAME,o=`${i}@${r||""}:${n?.schemaUrl||""}`;return this._sharedState.loggers.has(o)||this._sharedState.loggers.set(o,new Wco.Logger({name:i,version:r,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(o)}forceFlush(){return this._shutdownOnce.isCalled?(RRe.diag.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(RRe.diag.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};MF.LoggerProvider=Syt});var JBr=w(BRe=>{"use strict";Object.defineProperty(BRe,"__esModule",{value:!0});BRe.ConsoleLogRecordExporter=void 0;var KBr=hT(),wyt=class{export(e,r){this._sendLogRecords(e,r)}shutdown(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:(0,KBr.hrTimeToMicroseconds)(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,body:e.body,attributes:e.attributes}}_sendLogRecords(e,r){for(let n of e)console.dir(this._exportInfo(n),{depth:3});r?.({code:KBr.ExportResultCode.SUCCESS})}};BRe.ConsoleLogRecordExporter=wyt});var XBr=w(NRe=>{"use strict";Object.defineProperty(NRe,"__esModule",{value:!0});NRe.SimpleLogRecordProcessor=void 0;var FK=hT(),Tyt=class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new FK.BindOnceFuture(this._shutdown,this),this._unresolvedExports=new Set}onEmit(e){if(this._shutdownOnce.isCalled)return;let r=()=>FK.internal._export(this._exporter,[e]).then(n=>{n.code!==FK.ExportResultCode.SUCCESS&&(0,FK.globalErrorHandler)(n.error??new Error(`SimpleLogRecordProcessor: log record export failed (status ${n})`))}).catch(FK.globalErrorHandler);if(e.resource.asyncAttributesPending){let n=e.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(n),r()),FK.globalErrorHandler);n!=null&&this._unresolvedExports.add(n)}else r()}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports))}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}};NRe.SimpleLogRecordProcessor=Tyt});var eNr=w(ORe=>{"use strict";Object.defineProperty(ORe,"__esModule",{value:!0});ORe.InMemoryLogRecordExporter=void 0;var ZBr=hT(),Iyt=class{_finishedLogRecords=[];_stopped=!1;export(e,r){if(this._stopped)return r({code:ZBr.ExportResultCode.FAILED,error:new Error("Exporter has been stopped")});this._finishedLogRecords.push(...e),r({code:ZBr.ExportResultCode.SUCCESS})}shutdown(){return this._stopped=!0,this.reset(),Promise.resolve()}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}};ORe.InMemoryLogRecordExporter=Iyt});var tNr=w(kRe=>{"use strict";Object.defineProperty(kRe,"__esModule",{value:!0});kRe.BatchLogRecordProcessorBase=void 0;var Yco=(Kt(),yt(ar)),jv=hT(),Dyt=class{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_isExporting=!1;_finishedLogRecords=[];_timer;_shutdownOnce;constructor(e,r){this._exporter=e,this._maxExportBatchSize=r?.maxExportBatchSize??(0,jv.getNumberFromEnv)("OTEL_BLRP_MAX_EXPORT_BATCH_SIZE")??512,this._maxQueueSize=r?.maxQueueSize??(0,jv.getNumberFromEnv)("OTEL_BLRP_MAX_QUEUE_SIZE")??2048,this._scheduledDelayMillis=r?.scheduledDelayMillis??(0,jv.getNumberFromEnv)("OTEL_BLRP_SCHEDULE_DELAY")??5e3,this._exportTimeoutMillis=r?.exportTimeoutMillis??(0,jv.getNumberFromEnv)("OTEL_BLRP_EXPORT_TIMEOUT")??3e4,this._shutdownOnce=new jv.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(Yco.diag.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,r)=>{let n=[],i=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let o=0;o<i;o++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedLogRecords.length===0?Promise.resolve():new Promise((e,r)=>{(0,jv.callWithTimeout)(this._export(this._finishedLogRecords.splice(0,this._maxExportBatchSize)),this._exportTimeoutMillis).then(()=>e()).catch(r)})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().then(()=>{this._isExporting=!1,this._finishedLogRecords.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(r=>{this._isExporting=!1,(0,jv.globalErrorHandler)(r)})};if(this._finishedLogRecords.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}_export(e){let r=()=>jv.internal._export(this._exporter,e).then(i=>{i.code!==jv.ExportResultCode.SUCCESS&&(0,jv.globalErrorHandler)(i.error??new Error(`BatchLogRecordProcessor: log record export failed (status ${i})`))}).catch(jv.globalErrorHandler),n=e.map(i=>i.resource).filter(i=>i.asyncAttributesPending);return n.length===0?r():Promise.all(n.map(i=>i.waitForAsyncAttributes?.())).then(r,jv.globalErrorHandler)}};kRe.BatchLogRecordProcessorBase=Dyt});var rNr=w(PRe=>{"use strict";Object.defineProperty(PRe,"__esModule",{value:!0});PRe.BatchLogRecordProcessor=void 0;var Kco=tNr(),Ryt=class extends Kco.BatchLogRecordProcessorBase{onShutdown(){}};PRe.BatchLogRecordProcessor=Ryt});var nNr=w(MRe=>{"use strict";Object.defineProperty(MRe,"__esModule",{value:!0});MRe.BatchLogRecordProcessor=void 0;var Jco=rNr();Object.defineProperty(MRe,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return Jco.BatchLogRecordProcessor}})});var iNr=w(LRe=>{"use strict";Object.defineProperty(LRe,"__esModule",{value:!0});LRe.BatchLogRecordProcessor=void 0;var Xco=nNr();Object.defineProperty(LRe,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return Xco.BatchLogRecordProcessor}})});var oNr=w(T3=>{"use strict";Object.defineProperty(T3,"__esModule",{value:!0});T3.BatchLogRecordProcessor=T3.InMemoryLogRecordExporter=T3.SimpleLogRecordProcessor=T3.ConsoleLogRecordExporter=T3.NoopLogRecordProcessor=T3.LoggerProvider=void 0;var Zco=YBr();Object.defineProperty(T3,"LoggerProvider",{enumerable:!0,get:function(){return Zco.LoggerProvider}});var elo=Cyt();Object.defineProperty(T3,"NoopLogRecordProcessor",{enumerable:!0,get:function(){return elo.NoopLogRecordProcessor}});var tlo=JBr();Object.defineProperty(T3,"ConsoleLogRecordExporter",{enumerable:!0,get:function(){return tlo.ConsoleLogRecordExporter}});var rlo=XBr();Object.defineProperty(T3,"SimpleLogRecordProcessor",{enumerable:!0,get:function(){return rlo.SimpleLogRecordProcessor}});var nlo=eNr();Object.defineProperty(T3,"InMemoryLogRecordExporter",{enumerable:!0,get:function(){return nlo.InMemoryLogRecordExporter}});var ilo=iNr();Object.defineProperty(T3,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return ilo.BatchLogRecordProcessor}})});var Z0,sNr,lpe,aNr,upe,dpe,cNr,lNr,uNr,dNr,fNr,pNr,hNr,mNr,gNr,ANr,yNr,ENr,vNr,bNr,CNr,_Nr,xNr,SNr,wNr,TNr,INr,DNr,fpe=Z(()=>{"use strict";Z0="iflow-cli",sNr="iflow_cli.user_prompt",lpe="iflow_cli.tool_call",aNr="iflow_cli.api_request",upe="iflow_cli.api_error",dpe="iflow_cli.api_response",cNr="iflow_cli.config",lNr="iflow_cli.flash_fallback",uNr="iflow_cli.next_speaker_check",dNr="iflow_cli.slash_command",fNr="iflow_cli.tool.call.count",pNr="iflow_cli.tool.call.latency",hNr="iflow_cli.mcp.tool.call.count",mNr="iflow_cli.mcp.tool.call.latency",gNr="iflow_cli.builtin.tool.call.count",ANr="iflow_cli.builtin.tool.call.latency",yNr="gen_ai.client.operation",ENr="gen_ai.client.operation.duration",vNr="gen_ai.client.token.usage",bNr="iflow_cli.session.count",CNr="iflow_cli.file.operation.count",_Nr="iflow_cli.user_request.count",xNr="iflow_cli.user_request.latency",SNr="iflow_cli.user_experience.success",wNr="iflow_cli.user.identity",TNr="iflow_cli.scheduler.lock.error",INr="iflow_cli.mcp.connect.count",DNr="iflow_cli.loop.detection.count"});import olo from"os";function RNr(){try{let t=olo.networkInterfaces();for(let e of Object.keys(t)){let r=t[e];if(r){for(let n of r)if(n.family==="IPv4"&&!n.internal)return n.address}}return"127.0.0.1"}catch{return"127.0.0.1"}}var BNr=Z(()=>{"use strict"});var UK,QK,qK,HK,GK,jK,VK,$K,WK,zK,XC,ZC,NNr=Z(()=>{"use strict";UK="iflow_cli.cpu.usage_percentage",QK="iflow_cli.cpu.user_percentage",qK="iflow_cli.cpu.system_percentage",HK="iflow_cli.cpu.cores",GK="iflow_cli.memory.heap_used",jK="iflow_cli.memory.heap_total",VK="iflow_cli.memory.rss",$K="iflow_cli.memory.external",WK="iflow_cli.memory.system_usage_percentage",zK="iflow_cli.memory.process_usage_percentage",XC={[UK]:"CPU usage percentage",[QK]:"CPU user time percentage",[qK]:"CPU system time percentage",[HK]:"Number of CPU cores",[GK]:"Heap memory used in bytes",[jK]:"Heap memory total in bytes",[VK]:"Resident Set Size in bytes",[$K]:"External memory in bytes",[WK]:"System memory usage percentage",[zK]:"Process memory usage percentage relative to Node.js limits"},ZC={[UK]:"percent",[QK]:"percent",[qK]:"percent",[HK]:"cores",[GK]:"bytes",[jK]:"bytes",[VK]:"bytes",[$K]:"bytes",[WK]:"percent",[zK]:"percent"}});import*as e5 from"os";var FRe,ONr=Z(()=>{"use strict";NNr();FRe=class{meter;options;lastCpuMeasurement;lastMeasureTime;cpuCores;totalSystemMemory;nodeJSMemoryLimit;cpuUsageGauge;cpuUserGauge;cpuSystemGauge;cpuCoresGauge;memoryHeapUsedGauge;memoryHeapTotalGauge;memoryRssGauge;memoryExternalGauge;memorySystemUsageGauge;memoryProcessUsageGauge;constructor(e,r={}){this.meter=e,this.options={enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0,...r},this.lastCpuMeasurement=process.cpuUsage(),this.lastMeasureTime=Date.now(),this.cpuCores=e5.cpus().length,this.totalSystemMemory=e5.totalmem(),this.nodeJSMemoryLimit=this.getNodeJSMemoryLimit(),this.initializeMetrics()}getCurrentCpuMetrics(){try{let e=process.cpuUsage(this.lastCpuMeasurement),r=Date.now(),n=r-this.lastMeasureTime;if(this.lastCpuMeasurement=process.cpuUsage(),this.lastMeasureTime=r,n<=0)return{usage:0,user:0,system:0,cores:this.cpuCores};let i=Math.max(0,e.user+e.system),o=Math.max(0,e.user),s=Math.max(0,e.system),a=i/(n*1e3)*100,c=o/(n*1e3)*100,u=s/(n*1e3)*100,d=Number.isFinite(a)?Math.min(100,Math.max(0,a)):0,f=Number.isFinite(c)?Math.min(100,Math.max(0,c)):0,p=Number.isFinite(u)?Math.min(100,Math.max(0,u)):0;return{usage:d,user:f,system:p,cores:this.cpuCores}}catch{return{usage:0,user:0,system:0,cores:this.cpuCores}}}getCurrentMemoryMetrics(){try{let e=process.memoryUsage(),r=e5.freemem(),i=(this.totalSystemMemory-r)/this.totalSystemMemory*100,o=e.rss/this.nodeJSMemoryLimit*100;return{heapUsed:e.heapUsed,heapTotal:e.heapTotal,rss:e.rss,external:e.external,systemUsage:Math.min(100,Math.max(0,i)),processUsage:Math.min(100,Math.max(0,o))}}catch{return{heapUsed:0,heapTotal:0,rss:0,external:0,systemUsage:0,processUsage:0}}}initializeMetrics(){let e=e5.platform(),r=e5.arch(),n=process.version;this.options.enableCpuMetrics&&(this.cpuUsageGauge=this.meter.createObservableGauge(UK,{description:XC[UK],unit:ZC[UK]}),this.cpuUserGauge=this.meter.createObservableGauge(QK,{description:XC[QK],unit:ZC[QK]}),this.cpuSystemGauge=this.meter.createObservableGauge(qK,{description:XC[qK],unit:ZC[qK]}),this.cpuCoresGauge=this.meter.createObservableGauge(HK,{description:XC[HK],unit:ZC[HK]}),this.cpuUsageGauge.addCallback(i=>{let o=this.getCurrentCpuMetrics();i.observe(o.usage,{platform:e,arch:r,node_version:n})}),this.cpuUserGauge.addCallback(i=>{let o=this.getCurrentCpuMetrics();i.observe(o.user,{platform:e,arch:r,node_version:n})}),this.cpuSystemGauge.addCallback(i=>{let o=this.getCurrentCpuMetrics();i.observe(o.system,{platform:e,arch:r,node_version:n})}),this.cpuCoresGauge?.addCallback(i=>{i.observe(this.cpuCores,{platform:e,arch:r})})),this.options.enableMemoryMetrics&&(this.memoryHeapUsedGauge=this.meter.createObservableGauge(GK,{description:XC[GK],unit:ZC[GK]}),this.memoryHeapTotalGauge=this.meter.createObservableGauge(jK,{description:XC[jK],unit:ZC[jK]}),this.memoryRssGauge=this.meter.createObservableGauge(VK,{description:XC[VK],unit:ZC[VK]}),this.memoryExternalGauge=this.meter.createObservableGauge($K,{description:XC[$K],unit:ZC[$K]}),this.memorySystemUsageGauge=this.meter.createObservableGauge(WK,{description:XC[WK],unit:ZC[WK]}),this.memoryProcessUsageGauge=this.meter.createObservableGauge(zK,{description:XC[zK],unit:ZC[zK]}),this.memoryHeapUsedGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.heapUsed,{platform:e,arch:r,node_version:n})}),this.memoryHeapTotalGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.heapTotal,{platform:e,arch:r,node_version:n})}),this.memoryRssGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.rss,{platform:e,arch:r,node_version:n})}),this.memoryExternalGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.external,{platform:e,arch:r,node_version:n})}),this.memorySystemUsageGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.systemUsage,{platform:e,arch:r,node_version:n})}),this.memoryProcessUsageGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.processUsage,{platform:e,arch:r,node_version:n,memory_limit_mb:Math.round(this.nodeJSMemoryLimit/(1024*1024)).toString()})}))}getNodeJSMemoryLimit(){let e=process.execArgv.find(i=>i.startsWith("--max-old-space-size="))?.split("=")[1];if(e){let i=parseInt(e,10);if(!isNaN(i)&&i>0)return i*1024*1024}let r=process.execArgv.find(i=>i.startsWith("--max_old_space_size="))?.split("=")[1];if(r){let i=parseInt(r,10);if(!isNaN(i)&&i>0)return i*1024*1024}let n=e5.arch();return n==="x64"||n==="arm64"?1400*1024*1024:700*1024*1024}}});function kNr(t,e={}){if(URe)return URe;let r={enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0,...e};return URe=new FRe(t,r),URe}var URe,PNr=Z(()=>{"use strict";ONr();URe=null});import*as YK from"os";import*as QRe from"fs";function Ph(t){let e="0.3.21-beta.2",r=process.env.IFLOW_ENV||"normal",n={darwin:"macOS",win32:"Windows",linux:"Linux",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX"},i=YK.platform(),o=n[i]||i,s="unknown";try{if(i==="darwin")s=YK.release();else if(i==="linux")try{if(QRe.existsSync("/etc/os-release")){let p=QRe.readFileSync("/etc/os-release","utf8").match(/^PRETTY_NAME="(.+)"/m);p&&(s=p[1])}}catch{s=YK.release()}else i==="win32"&&(s=YK.release())}catch{s="unknown"}let a={name:"Node.js",version:process.version,architecture:process.arch},c=t.getModel()||"unknown",u=!1,d=t.getContentGeneratorConfig?.();if(d){let f=d.authType,p=d.baseUrl||"";(f===zt.LOGIN_WITH_IFLOW||f===zt.IFLOW||f===zt.OPENAI_COMPATIBLE&&p.includes("apis.iflow.cn"))&&(u=!0)}return{app_name:Z0,tenant__:"gen_ai",version:e,platform:o,os_model:s,runtime_name:a.name,runtime_version:a.version,runtime_architecture:a.architecture,model_name:c,is_iflow_open_user:String(u),ip:RNr(),iflow_env:r}}function MNr(){return Byt||(Byt=Wue.getMeter(Z0)),Byt}function LNr(){if(C2)return;let t=MNr();if(t){try{kNr(t,{enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0})}catch{}Nyt=t.createHistogram(fNr,{description:"Counts tool calls, tagged by function name and success.",unit:"count",valueType:Qu.INT}),Oyt=t.createHistogram(pNr,{description:"Latency of tool calls in milliseconds.",unit:"ms",valueType:Qu.INT}),kyt=t.createHistogram(hNr,{description:"Counts MCP tool calls, tagged by function name and success.",unit:"count",valueType:Qu.INT}),Pyt=t.createHistogram(mNr,{description:"Latency of MCP tool calls in milliseconds.",unit:"ms",valueType:Qu.INT}),Myt=t.createHistogram(gNr,{description:"Counts built-in tool calls, tagged by function name and success.",unit:"count",valueType:Qu.INT}),Lyt=t.createHistogram(ANr,{description:"Latency of built-in tool calls in milliseconds.",unit:"ms",valueType:Qu.INT}),ppe=t.createHistogram(yNr,{description:"Counts API requests, tagged by model and status.",unit:"count",valueType:Qu.INT}),hpe=t.createHistogram(ENr,{description:"Latency of API requests in milliseconds.",unit:"ms",valueType:Qu.INT}),Fyt=t.createHistogram(vNr,{description:"Counts the total number of tokens used.",unit:"tokens",valueType:Qu.INT}),Uyt=t.createHistogram(CNr,{description:"Counts file operations (create, read, update).",unit:"count",valueType:Qu.INT}),Qyt=t.createHistogram(_Nr,{description:"Counts user requests from prompt to completion.",unit:"count",valueType:Qu.INT}),qyt=t.createHistogram(xNr,{description:"End-to-end latency of user requests in milliseconds.",unit:"ms",valueType:Qu.INT}),Hyt=t.createHistogram(SNr,{description:"User experience success rate - counts successful user experiences including retries and fixes.",unit:"count",valueType:Qu.INT}),Gyt=t.createHistogram(wNr,{description:"User identity for tracking unique installations.",unit:"count",valueType:Qu.INT}),jyt=t.createHistogram(TNr,{description:"Counts tool scheduler lock errors when new calls are blocked by running calls.",unit:"count",valueType:Qu.INT}),Vyt=t.createHistogram(INr,{description:"Counts MCP connection attempts and their success/failure status.",unit:"count",valueType:Qu.INT}),$yt=t.createHistogram(DNr,{description:"Counts loop detection events by loop type.",unit:"count",valueType:Qu.INT}),C2=!0}}function qRe(t){let e=MNr();if(!e||!C2)return;e.createHistogram(bNr,{description:"Count of CLI sessions started.",unit:"count",valueType:Qu.INT}).record(1,Ph(t))}function FNr(t,e,r,n,i,o){if(!Nyt||!Oyt||!C2)return;let s={...Ph(t),function_name:e??"unknown",success:String(n),decision:i??"unknown"};Nyt.record(1,s),Oyt.record(r,{...Ph(t),function_name:e??"unknown",tool_type:o??"unknown"})}function UNr(t,e,r,n,i,o){if(!kyt||!Pyt||!C2)return;let s={...Ph(t),function_name:e??"unknown",success:String(n),decision:i??"unknown"};o&&(s.execution_context=o),kyt.record(1,s),Pyt.record(r,{...Ph(t),function_name:e??"unknown",execution_context:o??"unknown"})}function QNr(t,e,r,n,i,o){if(!Myt||!Lyt||!C2)return;let s={...Ph(t),function_name:e??"unknown",success:String(n),decision:i??"unknown"};o&&(s.execution_context=o),Myt.record(1,s),Lyt.record(r,{...Ph(t),function_name:e??"unknown",execution_context:o??"unknown"})}function KK(t,e,r,n){!Fyt||!C2||Fyt.record(r,{...Ph(t),model:e??"unknown",type:n??"unknown"})}function qNr(t,e,r,n,i,o,s,a){if(!ppe||!hpe||!C2)return;let c={...Ph(t),model:e??"unknown",status_code:String(n??(i?"error":"ok"))};s!==void 0&&(c.http_status_code=String(s)),a!==void 0&&(c.business_code=String(a)),o&&(c.finish_reason=o),ppe.record(1,c);let u={...Ph(t),model:e??"unknown",http_status_code:String(s??200),finish_reason:o??"unknown"};a!=null&&(u.business_code=String(a)),hpe.record(r,u)}function HNr(t,e,r,n,i,o,s){if(!ppe||!hpe||!C2)return;let a={...Ph(t),model:e??"unknown",status_code:String(n??"error"),error:i??"unknown"};o!==void 0&&(a.http_status_code=String(o)),s!==void 0&&(a.business_code=String(s)),ppe.record(1,a);let c={...Ph(t),model:e??"unknown",http_status_code:String(o??0),error:i??"unknown"};s!=null&&(c.business_code=String(s)),hpe.record(r,c)}function LF(t,e,r,n,i){if(!Uyt||!C2)return;let o={...Ph(t),operation:e};r!==void 0&&(o.lines=String(r)),n!==void 0&&(o.mimetype=n),i!==void 0&&(o.extension=i),Uyt.record(1,o)}function GNr(t,e,r,n,i){if(!Qyt||!qyt||!C2)return;let o={...Ph(t),prompt_id:e,success:String(n)};i&&(o.error=i),Qyt.record(1,o),qyt.record(r,o)}function Wyt(t,e,r=!1,n=!1,i){if(!Hyt||!C2)return;let o={...Ph(t),success:String(e),had_retries:String(r),had_fixes:String(n)};i&&(o.final_error=i),Hyt.record(1,o)}function jNr(t,e){if(!Gyt||!C2)return;let r={...Ph(t),user_id:e};Gyt.record(1,r)}function VNr(t,e,r){if(!jyt||!C2)return;let n={...Ph(t),running_calls_count:String(e)};r.forEach((i,o)=>{n[`call_${o}_name`]=i.name,n[`call_${o}_status`]=i.status}),jyt.record(1,n)}function zyt(t,e,r,n,i){if(!Vyt||!C2)return;let o={...Ph(t),server_name:e,success:String(r)};n&&(o.error_type=n),i&&(o.transport_type=i),Vyt.record(1,o)}function $Nr(t,e,r){if(!$yt||!C2)return;let n={...Ph(t),loop_type:e,prompt_id:r};$yt.record(1,n)}var mT,Byt,Nyt,Oyt,kyt,Pyt,Myt,Lyt,ppe,hpe,Fyt,Uyt,Qyt,qyt,Hyt,Gyt,jyt,Vyt,$yt,C2,Vv=Z(()=>{"use strict";Kt();BNr();fpe();rE();PNr();(function(t){t.CREATE="create",t.READ="read",t.UPDATE="update"})(mT||(mT={}));C2=!1});var Do,yn,Ro,Bo,Id=Z(()=>{"use strict";Do=class{name;displayName;description;icon;kind;parameterSchema;isOutputMarkdown;canUpdateOutput;aliases;constructor(e,r,n,i,o,s,a=!0,c=!1,u=[]){this.name=e,this.displayName=r,this.description=n,this.icon=i,this.kind=o,this.parameterSchema=s,this.isOutputMarkdown=a,this.canUpdateOutput=c,this.aliases=u}get schema(){return{name:this.name,description:this.description,parameters:this.parameterSchema}}validateToolParams(e){return null}getDescription(e){return JSON.stringify(e)}shouldConfirmExecute(e,r){return Promise.resolve(!1)}toolLocations(e){return[]}};(function(t){t.ProceedOnce="proceed_once",t.ProceedAlways="proceed_always",t.ProceedAlwaysServer="proceed_always_server",t.ProceedAlwaysTool="proceed_always_tool",t.ModifyWithEditor="modify_with_editor",t.Cancel="cancel"})(yn||(yn={}));(function(t){t.FileSearch="fileSearch",t.Folder="folder",t.Globe="globe",t.Hammer="hammer",t.LightBulb="lightBulb",t.Pencil="pencil",t.Regex="regex",t.Terminal="terminal"})(Ro||(Ro={}));(function(t){t.Read="read",t.Edit="edit",t.Delete="delete",t.Move="move",t.Search="search",t.Execute="execute",t.Think="think",t.Fetch="fetch",t.Other="other"})(Bo||(Bo={}))});function slo(t){switch(t){case yn.ProceedOnce:case yn.ProceedAlways:case yn.ProceedAlwaysServer:case yn.ProceedAlwaysTool:return $v.ACCEPT;case yn.ModifyWithEditor:return $v.MODIFY;case yn.Cancel:default:return $v.REJECT}}var $v,JK,XK,ZK,eJ,tJ,j1,rJ,nJ,Wv,iJ,HRe,oJ,GRe,gT=Z(()=>{"use strict";Id();rE();(function(t){t.ACCEPT="accept",t.REJECT="reject",t.MODIFY="modify"})($v||($v={}));JK=class{"event.name";"event.timestamp";model;embedding_model;sandbox_enabled;core_tools_enabled;approval_mode;api_key_enabled;vertex_ai_enabled;debug_enabled;mcp_servers;telemetry_enabled;telemetry_log_user_prompts_enabled;file_filtering_respect_git_ignore;constructor(e){let r=e.getContentGeneratorConfig(),n=e.getMcpServers(),i=!1,o=!1;r&&r.authType&&(i=r.authType===zt.IFLOW,o=r.authType===zt.AONE),this["event.name"]="cli_config",this.model=e.getModel(),this.embedding_model=e.getEmbeddingModel(),this.sandbox_enabled=typeof e.getSandbox()=="string"||!!e.getSandbox(),this.core_tools_enabled=(e.getCoreTools()??[]).join(","),this.approval_mode=e.getApprovalMode(),this.api_key_enabled=i||o,this.vertex_ai_enabled=o,this.debug_enabled=e.getDebugMode(),this.mcp_servers=n?Object.keys(n).join(","):"",this.telemetry_enabled=e.getTelemetryEnabled(),this.telemetry_log_user_prompts_enabled=e.getTelemetryLogPromptsEnabled(),this.file_filtering_respect_git_ignore=e.getFileFilteringRespectGitIgnore()}},XK=class{"event.name";"event.timestamp";session_id;constructor(e){this["event.name"]="end_session",this["event.timestamp"]=new Date().toISOString(),this.session_id=e?.getSessionId()}},ZK=class{"event.name";"event.timestamp";prompt_length;prompt_id;auth_type;prompt;constructor(e,r,n,i){this["event.name"]="user_prompt",this["event.timestamp"]=new Date().toISOString(),this.prompt_length=e,this.prompt_id=r,this.auth_type=n,this.prompt=i}},eJ=class{"event.name";"event.timestamp";function_name;function_args;duration_ms;success;decision;error;error_type;prompt_id;server_name;constructor(e){this["event.name"]="tool_call",this["event.timestamp"]=new Date().toISOString(),this.function_name=e.request.name,this.function_args=JSON.stringify(e.request.args),this.duration_ms=e.durationMs??0,this.success=e.status==="success",this.decision=e.outcome?slo(e.outcome):void 0,this.error=e.response.error?.message,this.error_type=e.response.errorType,this.prompt_id=e.request.prompt_id,"tool"in e&&e.tool&&"serverName"in e.tool&&(this.server_name=e.tool.serverName)}},tJ=class{"event.name";"event.timestamp";model;prompt_id;request_text;constructor(e,r,n){this["event.name"]="api_request",this["event.timestamp"]=new Date().toISOString(),this.model=e,this.prompt_id=r,this.request_text=n}},j1=class{"event.name";"event.timestamp";model;error;error_type;status_code;http_status_code;business_code;duration_ms;prompt_id;auth_type;constructor(e,r,n,i,o,s,a,c,u){this["event.name"]="api_error",this["event.timestamp"]=new Date().toISOString(),this.model=e,this.error=r,this.error_type=s,this.status_code=a,this.http_status_code=c,this.business_code=u,this.duration_ms=n,this.prompt_id=i,this.auth_type=o}},rJ=class{"event.name";"event.timestamp";model;status_code;http_status_code;business_code;duration_ms;error;input_token_count;output_token_count;cached_content_token_count;thoughts_token_count;tool_token_count;total_token_count;response_text;prompt_id;auth_type;finish_reason;constructor(e,r,n,i,o,s,a,c,u,d){this["event.name"]="api_response",this["event.timestamp"]=new Date().toISOString(),this.model=e,this.duration_ms=r,this.status_code=200,this.http_status_code=u||200,this.business_code=d,this.input_token_count=o?.promptTokenCount??0,this.output_token_count=o?.candidatesTokenCount??0,this.cached_content_token_count=o?.cachedContentTokenCount??0,this.thoughts_token_count=o?.thoughtsTokenCount??0,this.tool_token_count=o?.toolUsePromptTokenCount??0,this.total_token_count=o?.totalTokenCount??0,this.response_text=s,this.error=a,this.prompt_id=n,this.auth_type=i,this.finish_reason=c}},nJ=class{"event.name";"event.timestamp";auth_type;constructor(e){this["event.name"]="flash_fallback",this["event.timestamp"]=new Date().toISOString(),this.auth_type=e}};(function(t){t.CONSECUTIVE_IDENTICAL_TOOL_CALLS="consecutive_identical_tool_calls",t.CHANTING_IDENTICAL_SENTENCES="chanting_identical_sentences",t.LLM_DETECTED_LOOP="llm_detected_loop"})(Wv||(Wv={}));iJ=class{"event.name";"event.timestamp";loop_type;prompt_id;constructor(e,r){this["event.name"]="loop_detected",this["event.timestamp"]=new Date().toISOString(),this.loop_type=e,this.prompt_id=r}},HRe=class{"event.name";"event.timestamp";prompt_id;finish_reason;result;constructor(e,r,n){this["event.name"]="next_speaker_check",this["event.timestamp"]=new Date().toISOString(),this.prompt_id=e,this.finish_reason=r,this.result=n}},oJ=class{"event.name";"event.timestamp";command;subcommand;constructor(e,r){this["event.name"]="slash_command",this["event.timestamp"]=new Date().toISOString(),this.command=e,this.subcommand=r}},GRe=class{"event.name";"event.timestamp";model;constructor(e){this["event.name"]="malformed_json_response",this["event.timestamp"]=new Date().toISOString(),this.model=e}}});var hi,WNr=Z(()=>{"use strict";(function(t){t[t.IFLOW_CLI_KEY_UNKNOWN=0]="IFLOW_CLI_KEY_UNKNOWN",t[t.IFLOW_CLI_START_SESSION_MODEL=1]="IFLOW_CLI_START_SESSION_MODEL",t[t.IFLOW_CLI_START_SESSION_EMBEDDING_MODEL=2]="IFLOW_CLI_START_SESSION_EMBEDDING_MODEL",t[t.IFLOW_CLI_START_SESSION_SANDBOX=3]="IFLOW_CLI_START_SESSION_SANDBOX",t[t.IFLOW_CLI_START_SESSION_CORE_TOOLS=4]="IFLOW_CLI_START_SESSION_CORE_TOOLS",t[t.IFLOW_CLI_START_SESSION_APPROVAL_MODE=5]="IFLOW_CLI_START_SESSION_APPROVAL_MODE",t[t.IFLOW_CLI_START_SESSION_API_KEY_ENABLED=6]="IFLOW_CLI_START_SESSION_API_KEY_ENABLED",t[t.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED=7]="IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED",t[t.IFLOW_CLI_START_SESSION_DEBUG_MODE_ENABLED=8]="IFLOW_CLI_START_SESSION_DEBUG_MODE_ENABLED",t[t.IFLOW_CLI_START_SESSION_MCP_SERVERS=9]="IFLOW_CLI_START_SESSION_MCP_SERVERS",t[t.IFLOW_CLI_START_SESSION_TELEMETRY_ENABLED=10]="IFLOW_CLI_START_SESSION_TELEMETRY_ENABLED",t[t.IFLOW_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED=11]="IFLOW_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED",t[t.IFLOW_CLI_START_SESSION_RESPECT_GITIGNORE=12]="IFLOW_CLI_START_SESSION_RESPECT_GITIGNORE",t[t.IFLOW_CLI_USER_PROMPT_LENGTH=13]="IFLOW_CLI_USER_PROMPT_LENGTH",t[t.IFLOW_CLI_TOOL_CALL_NAME=14]="IFLOW_CLI_TOOL_CALL_NAME",t[t.IFLOW_CLI_TOOL_CALL_DECISION=15]="IFLOW_CLI_TOOL_CALL_DECISION",t[t.IFLOW_CLI_TOOL_CALL_SUCCESS=16]="IFLOW_CLI_TOOL_CALL_SUCCESS",t[t.IFLOW_CLI_TOOL_CALL_DURATION_MS=17]="IFLOW_CLI_TOOL_CALL_DURATION_MS",t[t.IFLOW_CLI_TOOL_ERROR_MESSAGE=18]="IFLOW_CLI_TOOL_ERROR_MESSAGE",t[t.IFLOW_CLI_TOOL_CALL_ERROR_TYPE=19]="IFLOW_CLI_TOOL_CALL_ERROR_TYPE",t[t.IFLOW_CLI_API_REQUEST_MODEL=20]="IFLOW_CLI_API_REQUEST_MODEL",t[t.IFLOW_CLI_API_RESPONSE_MODEL=21]="IFLOW_CLI_API_RESPONSE_MODEL",t[t.IFLOW_CLI_API_RESPONSE_STATUS_CODE=22]="IFLOW_CLI_API_RESPONSE_STATUS_CODE",t[t.IFLOW_CLI_API_RESPONSE_DURATION_MS=23]="IFLOW_CLI_API_RESPONSE_DURATION_MS",t[t.IFLOW_CLI_API_ERROR_MESSAGE=24]="IFLOW_CLI_API_ERROR_MESSAGE",t[t.IFLOW_CLI_API_RESPONSE_INPUT_TOKEN_COUNT=25]="IFLOW_CLI_API_RESPONSE_INPUT_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT=26]="IFLOW_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_CACHED_TOKEN_COUNT=27]="IFLOW_CLI_API_RESPONSE_CACHED_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_THINKING_TOKEN_COUNT=28]="IFLOW_CLI_API_RESPONSE_THINKING_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_TOOL_TOKEN_COUNT=29]="IFLOW_CLI_API_RESPONSE_TOOL_TOKEN_COUNT",t[t.IFLOW_CLI_API_ERROR_MODEL=30]="IFLOW_CLI_API_ERROR_MODEL",t[t.IFLOW_CLI_API_ERROR_TYPE=31]="IFLOW_CLI_API_ERROR_TYPE",t[t.IFLOW_CLI_API_ERROR_STATUS_CODE=32]="IFLOW_CLI_API_ERROR_STATUS_CODE",t[t.IFLOW_CLI_API_ERROR_DURATION_MS=33]="IFLOW_CLI_API_ERROR_DURATION_MS",t[t.IFLOW_CLI_END_SESSION_ID=34]="IFLOW_CLI_END_SESSION_ID",t[t.IFLOW_CLI_PROMPT_ID=35]="IFLOW_CLI_PROMPT_ID",t[t.IFLOW_CLI_AUTH_TYPE=36]="IFLOW_CLI_AUTH_TYPE",t[t.IFLOW_CLI_GOOGLE_ACCOUNTS_COUNT=37]="IFLOW_CLI_GOOGLE_ACCOUNTS_COUNT",t[t.IFLOW_CLI_SURFACE=39]="IFLOW_CLI_SURFACE",t[t.IFLOW_CLI_SESSION_ID=40]="IFLOW_CLI_SESSION_ID",t[t.IFLOW_CLI_LOOP_DETECTED_TYPE=38]="IFLOW_CLI_LOOP_DETECTED_TYPE",t[t.IFLOW_CLI_SLASH_COMMAND_NAME=41]="IFLOW_CLI_SLASH_COMMAND_NAME",t[t.IFLOW_CLI_SLASH_COMMAND_SUBCOMMAND=42]="IFLOW_CLI_SLASH_COMMAND_SUBCOMMAND",t[t.IFLOW_CLI_RESPONSE_FINISH_REASON=43]="IFLOW_CLI_RESPONSE_FINISH_REASON",t[t.IFLOW_CLI_NEXT_SPEAKER_CHECK_RESULT=44]="IFLOW_CLI_NEXT_SPEAKER_CHECK_RESULT",t[t.IFLOW_CLI_MALFORMED_JSON_RESPONSE_MODEL=45]="IFLOW_CLI_MALFORMED_JSON_RESPONSE_MODEL"})(hi||(hi={}))});function FF(t,e){let r=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof i=="object"&&i!==null){if(r.has(i))return"[Circular]";r.add(i)}return i},e)}var jRe=Z(()=>{"use strict";});import mS,{dirname as alo,join as Yyt}from"node:path";import VRe from"os";import*as zNr from"crypto";import{fileURLToPath as clo}from"node:url";import llo from"node:fs";function gS(t){let e=VRe.homedir();return t.startsWith(e)?t.replace(e,"~"):t}function Ac(t,e=35){if(t.length<=e)return t;let n=mS.parse(t).root,i=mS.sep,s=t.substring(n.length).split(i).filter(h=>h!=="");if(s.length<=1){let h=Math.floor((e-3)/2);if(h<=0)return t.substring(0,e-3)+"...";let m=t.substring(0,h),g=t.substring(t.length-h);return`${m}...${g}`}let a=s[0],c=s[s.length-1],u=n+a,d=[],f=i.length+c.length;for(let h=s.length-2;h>=0;h--){let m=s[h],g=f+i.length+m.length;if(g<=e)d.unshift(m),f=g;else break}let p=d.join(i)+i+c;return f>e?p:(p=u+i+p,p.length>e?"..."+p.substring(p.length-e-3):p)}function Dd(t,e){let r=mS.resolve(t),n=mS.resolve(e);return mS.relative(n,r)||"."}function sJ(t){let e="";for(let r=0;r<t.length;r++)t[r]===" "&&(r===0||t[r-1]!=="\\")?e+="\\ ":e+=t[r];return e}function AT(t){return t.replace(/\\(.)/g,"$1")}function $Re(t){return zNr.createHash("sha256").update(t).digest("hex")}function V1(t){let e=$Re(t);return mS.join(VRe.homedir(),Qm,ulo,e)}function WRe(){return mS.join(VRe.homedir(),Qm,YNr)}function zRe(t){return mS.join(t,Qm,YNr)}function YRe(){if(process.env.USE_BUILTIN_RIPGREP==="0")return"rg";let t=alo(clo(import.meta.url)),e=[Yyt(t,"..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`),Yyt(t,"..","..","..","..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`),Yyt(t,"..","..","..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`)];for(let r of e)try{if(llo.existsSync(r))return r}catch{}return e[0]}function mpe(t,e){let n=VRe.platform()==="win32"?mS.win32:mS,i=n.relative(t,e);return!i.startsWith(`..${n.sep}`)&&i!==".."&&!n.isAbsolute(i)}var Qm,Kyt,ulo,YNr,Rd=Z(()=>{"use strict";Qm=".iflow",Kyt="google_accounts.json",ulo="tmp",YNr="commands"});import dlo from"node:path";import{promises as UMa,existsSync as KNr,readFileSync as JNr}from"node:fs";import*as XNr from"os";function ZNr(){return dlo.join(XNr.homedir(),Qm,Kyt)}function eOr(){try{let t=ZNr();if(KNr(t)){let e=JNr(t,"utf-8").trim();return e?JSON.parse(e).active:null}return null}catch(t){return console.debug("Error reading cached Google Account:",t),null}}function tOr(){try{let t=ZNr();if(!KNr(t))return 0;let e=JNr(t,"utf-8").trim();if(!e)return 0;let r=JSON.parse(e),n=r.old.length;return r.active&&n++,n}catch(t){return console.debug("Error reading lifetime Google Accounts:",t),0}}var rOr=Z(()=>{"use strict";Rd();});import*as nOr from"os";import*as yT from"fs";import*as Zyt from"path";import{randomUUID as flo}from"crypto";function hlo(){yT.existsSync(Jyt)||yT.mkdirSync(Jyt,{recursive:!0})}function mlo(){return yT.existsSync(Xyt)&&yT.readFileSync(Xyt,"utf-8").trim()||null}function glo(t){yT.writeFileSync(Xyt,t,"utf-8")}function KRe(){try{hlo();let t=mlo();return t||(t=flo(),glo(t)),t}catch(t){return console.error("Error accessing installation ID file, generating ephemeral ID:",t),"123456789"}}var plo,Jyt,Xyt,eEt=Z(()=>{"use strict";Rd();plo=nOr.homedir()??"",Jyt=Zyt.join(plo,Qm),Xyt=Zyt.join(Jyt,"installation_id")});var iOr,Alo,ylo,Elo,vlo,blo,Clo,_lo,xlo,Slo,wlo,Tlo,Ilo,Mh,gpe=Z(()=>{"use strict";iOr=Te(Wct(),1);gT();WNr();jRe();rOr();eEt();Alo="start_session",ylo="new_prompt",Elo="tool_call",vlo="api_request",blo="api_response",Clo="api_error",_lo="end_session",xlo="flash_fallback",Slo="loop_detected",wlo="next_speaker_check",Tlo="slash_command",Ilo="malformed_json_response",Mh=class t{static instance;config;events=[];last_flush_time=Date.now();flush_interval_ms=1e3*60;constructor(e){this.config=e}static getInstance(e){if(!(e===void 0||!e?.getUsageStatisticsEnabled()))return t.instance||(t.instance=new t(e)),t.instance}enqueueLogEvent(e){this.events.push([{event_time_ms:Date.now(),source_extension_json:FF(e)}])}createLogEvent(e,r){let n=eOr(),i=tOr();r.push({iflow_cli_key:hi.IFLOW_CLI_GOOGLE_ACCOUNTS_COUNT,value:i.toString()});let o={console_type:"IFLOW_CLI",application:102,event_name:e,event_metadata:[r]};return n?o.client_email=n:o.client_install_id=KRe(),o}flushIfNeeded(){Date.now()-this.last_flush_time<this.flush_interval_ms||this.flushToClearcut().catch(e=>{console.debug("Error flushing to Clearcut:",e)})}async flushToClearcut(){return this.config?.getDebugMode()&&console.log("Telemetry disabled - not sending log events to Clearcut."),this.events.length=0,this.last_flush_time=Date.now(),Promise.resolve({})}decodeLogResponse(e){if(e.length<1||e.readUInt8(0)!==8)return;let r=BigInt(0),n=!0;for(let o=1;n&&o<e.length;o++){let s=e.readUInt8(o);r|=BigInt(s&127)<<BigInt(7*(o-1)),n=(s&128)!==0}return n?void 0:{nextRequestWaitMs:Number(r)}}logStartSessionEvent(e){let r=process.env.SURFACE||"SURFACE_NOT_SET",n=[{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_MODEL,value:e.model},{iflow_cli_key:hi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_EMBEDDING_MODEL,value:e.embedding_model},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_SANDBOX,value:e.sandbox_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_CORE_TOOLS,value:e.core_tools_enabled},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_APPROVAL_MODE,value:e.approval_mode},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_API_KEY_ENABLED,value:e.api_key_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_DEBUG_MODE_ENABLED,value:e.debug_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_MCP_SERVERS,value:e.mcp_servers},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_TELEMETRY_ENABLED,value:e.telemetry_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED,value:e.telemetry_log_user_prompts_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_SURFACE,value:r}];this.enqueueLogEvent(this.createLogEvent(Alo,n)),this.flushToClearcut().catch(i=>{console.debug("Error flushing to Clearcut:",i)})}logNewPromptEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_USER_PROMPT_LENGTH,value:JSON.stringify(e.prompt_length)},{iflow_cli_key:hi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.enqueueLogEvent(this.createLogEvent(ylo,r)),this.flushIfNeeded()}logToolCallEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_TOOL_CALL_NAME,value:JSON.stringify(e.function_name)},{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_TOOL_CALL_DECISION,value:JSON.stringify(e.decision)},{iflow_cli_key:hi.IFLOW_CLI_TOOL_CALL_SUCCESS,value:JSON.stringify(e.success)},{iflow_cli_key:hi.IFLOW_CLI_TOOL_CALL_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:hi.IFLOW_CLI_TOOL_ERROR_MESSAGE,value:JSON.stringify(e.error)},{iflow_cli_key:hi.IFLOW_CLI_TOOL_CALL_ERROR_TYPE,value:JSON.stringify(e.error_type)}],n=this.createLogEvent(Elo,r);this.enqueueLogEvent(n),this.flushIfNeeded()}logApiRequestEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_API_REQUEST_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)}];this.enqueueLogEvent(this.createLogEvent(vlo,r)),this.flushIfNeeded()}logApiResponseEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_STATUS_CODE,value:JSON.stringify(e.status_code)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:hi.IFLOW_CLI_API_ERROR_MESSAGE,value:JSON.stringify(e.error)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_INPUT_TOKEN_COUNT,value:JSON.stringify(e.input_token_count)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT,value:JSON.stringify(e.output_token_count)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_CACHED_TOKEN_COUNT,value:JSON.stringify(e.cached_content_token_count)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_THINKING_TOKEN_COUNT,value:JSON.stringify(e.thoughts_token_count)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_TOOL_TOKEN_COUNT,value:JSON.stringify(e.tool_token_count)},{iflow_cli_key:hi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.enqueueLogEvent(this.createLogEvent(blo,r)),this.flushIfNeeded()}logApiErrorEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_API_ERROR_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_API_ERROR_TYPE,value:JSON.stringify(e.error_type)},{iflow_cli_key:hi.IFLOW_CLI_API_ERROR_STATUS_CODE,value:JSON.stringify(e.status_code)},{iflow_cli_key:hi.IFLOW_CLI_API_ERROR_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:hi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.enqueueLogEvent(this.createLogEvent(Clo,r)),this.flushIfNeeded()}logFlashFallbackEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)},{iflow_cli_key:hi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.enqueueLogEvent(this.createLogEvent(xlo,r)),this.flushToClearcut().catch(n=>{console.debug("Error flushing to Clearcut:",n)})}logLoopDetectedEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_LOOP_DETECTED_TYPE,value:JSON.stringify(e.loop_type)}];this.enqueueLogEvent(this.createLogEvent(Slo,r)),this.flushIfNeeded()}logNextSpeakerCheck(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_RESPONSE_FINISH_REASON,value:JSON.stringify(e.finish_reason)},{iflow_cli_key:hi.IFLOW_CLI_NEXT_SPEAKER_CHECK_RESULT,value:JSON.stringify(e.result)},{iflow_cli_key:hi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.enqueueLogEvent(this.createLogEvent(wlo,r)),this.flushIfNeeded()}logSlashCommandEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_SLASH_COMMAND_NAME,value:JSON.stringify(e.command)}];e.subcommand&&r.push({iflow_cli_key:hi.IFLOW_CLI_SLASH_COMMAND_SUBCOMMAND,value:JSON.stringify(e.subcommand)}),this.enqueueLogEvent(this.createLogEvent(Tlo,r)),this.flushIfNeeded()}logMalformedJsonResponseEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_MALFORMED_JSON_RESPONSE_MODEL,value:JSON.stringify(e.model)}];this.enqueueLogEvent(this.createLogEvent(Ilo,r)),this.flushIfNeeded()}logEndSessionEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_SESSION_ID,value:e?.session_id?.toString()??""}];this.enqueueLogEvent(this.createLogEvent(_lo,r)),this.flushToClearcut().catch(n=>{console.debug("Error flushing to Clearcut:",n)})}getProxyAgent(){let e=this.config?.getProxy();if(e){if(e.startsWith("http"))return new iOr.HttpsProxyAgent(e);throw new Error("Unsupported proxy type")}}shutdown(){let e=new XK(this.config);this.logEndSessionEvent(e)}}});import*as oOr from"node:fs";var UF,sOr,Ape,JRe,XRe,ZRe,aOr=Z(()=>{"use strict";UF=Te(oi(),1),sOr=Te(Dx(),1);Ape=class{writeStream;constructor(e){this.writeStream=oOr.createWriteStream(e,{flags:"a"})}serialize(e){let r=new WeakSet;return JSON.stringify(e,(i,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[Circular]";r.add(o)}return o},2)+`
|
|
447
|
+
`).find(n=>n.includes("IOPlatformUUID"));if(!e)return;let r=e.split('" = "');if(r.length===2)return r[1].slice(0,-1)}catch(t){lso.diag.debug(`error reading machine id: ${t}`)}}DDe.getMachineId=uso});var lRr=w(RDe=>{"use strict";Object.defineProperty(RDe,"__esModule",{value:!0});RDe.getMachineId=void 0;var dso=Ae("fs"),fso=(Kt(),yt(ar));async function pso(){let t=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let e of t)try{return(await dso.promises.readFile(e,{encoding:"utf8"})).trim()}catch(r){fso.diag.debug(`error reading machine id: ${r}`)}}RDe.getMachineId=pso});var dRr=w(BDe=>{"use strict";Object.defineProperty(BDe,"__esModule",{value:!0});BDe.getMachineId=void 0;var hso=Ae("fs"),mso=IDe(),uRr=(Kt(),yt(ar));async function gso(){try{return(await hso.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(t){uRr.diag.debug(`error reading machine id: ${t}`)}try{return(await(0,mso.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(t){uRr.diag.debug(`error reading machine id: ${t}`)}}BDe.getMachineId=gso});var pRr=w(NDe=>{"use strict";Object.defineProperty(NDe,"__esModule",{value:!0});NDe.getMachineId=void 0;var fRr=Ae("process"),Aso=IDe(),yso=(Kt(),yt(ar));async function Eso(){let t="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",e="%windir%\\System32\\REG.exe";fRr.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in fRr.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{let n=(await(0,Aso.execAsync)(`${e} ${t}`)).stdout.split("REG_SZ");if(n.length===2)return n[1].trim()}catch(r){yso.diag.debug(`error reading machine id: ${r}`)}}NDe.getMachineId=Eso});var hRr=w(ODe=>{"use strict";Object.defineProperty(ODe,"__esModule",{value:!0});ODe.getMachineId=void 0;var vso=(Kt(),yt(ar));async function bso(){vso.diag.debug("could not read machine-id: unsupported platform")}ODe.getMachineId=bso});var mRr=w(kDe=>{"use strict";Object.defineProperty(kDe,"__esModule",{value:!0});kDe.getMachineId=void 0;var Cso=Ae("process"),DF;async function _so(){if(!DF)switch(Cso.platform){case"darwin":DF=(await Promise.resolve().then(()=>Te(cRr()))).getMachineId;break;case"linux":DF=(await Promise.resolve().then(()=>Te(lRr()))).getMachineId;break;case"freebsd":DF=(await Promise.resolve().then(()=>Te(dRr()))).getMachineId;break;case"win32":DF=(await Promise.resolve().then(()=>Te(pRr()))).getMachineId;break;default:DF=(await Promise.resolve().then(()=>Te(hRr()))).getMachineId;break}return DF()}kDe.getMachineId=_so});var F3t=w(IK=>{"use strict";Object.defineProperty(IK,"__esModule",{value:!0});IK.normalizeType=IK.normalizeArch=void 0;var xso=t=>{switch(t){case"arm":return"arm32";case"ppc":return"ppc32";case"x64":return"amd64";default:return t}};IK.normalizeArch=xso;var Sso=t=>{switch(t){case"sunos":return"solaris";case"win32":return"windows";default:return t}};IK.normalizeType=Sso});var ARr=w(PDe=>{"use strict";Object.defineProperty(PDe,"__esModule",{value:!0});PDe.hostDetector=void 0;var U3t=rpe(),gRr=Ae("os"),wso=mRr(),Tso=F3t(),Q3t=class{detect(e){return{attributes:{[U3t.ATTR_HOST_NAME]:(0,gRr.hostname)(),[U3t.ATTR_HOST_ARCH]:(0,Tso.normalizeArch)((0,gRr.arch)()),[U3t.ATTR_HOST_ID]:(0,wso.getMachineId)()}}}};PDe.hostDetector=new Q3t});var vRr=w(MDe=>{"use strict";Object.defineProperty(MDe,"__esModule",{value:!0});MDe.osDetector=void 0;var yRr=rpe(),ERr=Ae("os"),Iso=F3t(),q3t=class{detect(e){return{attributes:{[yRr.ATTR_OS_TYPE]:(0,Iso.normalizeType)((0,ERr.platform)()),[yRr.ATTR_OS_VERSION]:(0,ERr.release)()}}}};MDe.osDetector=new q3t});var bRr=w(LDe=>{"use strict";Object.defineProperty(LDe,"__esModule",{value:!0});LDe.processDetector=void 0;var Dso=(Kt(),yt(ar)),fT=rpe(),Rso=Ae("os"),H3t=class{detect(e){let r={[fT.ATTR_PROCESS_PID]:process.pid,[fT.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[fT.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[fT.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[fT.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[fT.ATTR_PROCESS_RUNTIME_NAME]:"nodejs",[fT.ATTR_PROCESS_RUNTIME_DESCRIPTION]:"Node.js"};process.argv.length>1&&(r[fT.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let n=Rso.userInfo();r[fT.ATTR_PROCESS_OWNER]=n.username}catch(n){Dso.diag.debug(`error obtaining process owner: ${n}`)}return{attributes:r}}};LDe.processDetector=new H3t});var CRr=w(FDe=>{"use strict";Object.defineProperty(FDe,"__esModule",{value:!0});FDe.serviceInstanceIdDetector=void 0;var Bso=rpe(),Nso=Ae("crypto"),G3t=class{detect(e){return{attributes:{[Bso.ATTR_SERVICE_INSTANCE_ID]:(0,Nso.randomUUID)()}}}};FDe.serviceInstanceIdDetector=new G3t});var _Rr=w(uS=>{"use strict";Object.defineProperty(uS,"__esModule",{value:!0});uS.serviceInstanceIdDetector=uS.processDetector=uS.osDetector=uS.hostDetector=void 0;var Oso=ARr();Object.defineProperty(uS,"hostDetector",{enumerable:!0,get:function(){return Oso.hostDetector}});var kso=vRr();Object.defineProperty(uS,"osDetector",{enumerable:!0,get:function(){return kso.osDetector}});var Pso=bRr();Object.defineProperty(uS,"processDetector",{enumerable:!0,get:function(){return Pso.processDetector}});var Mso=CRr();Object.defineProperty(uS,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Mso.serviceInstanceIdDetector}})});var xRr=w(dS=>{"use strict";Object.defineProperty(dS,"__esModule",{value:!0});dS.serviceInstanceIdDetector=dS.processDetector=dS.osDetector=dS.hostDetector=void 0;var UDe=_Rr();Object.defineProperty(dS,"hostDetector",{enumerable:!0,get:function(){return UDe.hostDetector}});Object.defineProperty(dS,"osDetector",{enumerable:!0,get:function(){return UDe.osDetector}});Object.defineProperty(dS,"processDetector",{enumerable:!0,get:function(){return UDe.processDetector}});Object.defineProperty(dS,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return UDe.serviceInstanceIdDetector}})});var SRr=w(DK=>{"use strict";Object.defineProperty(DK,"__esModule",{value:!0});DK.noopDetector=DK.NoopDetector=void 0;var QDe=class{detect(){return{attributes:{}}}};DK.NoopDetector=QDe;DK.noopDetector=new QDe});var wRr=w(w3=>{"use strict";Object.defineProperty(w3,"__esModule",{value:!0});w3.noopDetector=w3.serviceInstanceIdDetector=w3.processDetector=w3.osDetector=w3.hostDetector=w3.envDetector=void 0;var Lso=aRr();Object.defineProperty(w3,"envDetector",{enumerable:!0,get:function(){return Lso.envDetector}});var qDe=xRr();Object.defineProperty(w3,"hostDetector",{enumerable:!0,get:function(){return qDe.hostDetector}});Object.defineProperty(w3,"osDetector",{enumerable:!0,get:function(){return qDe.osDetector}});Object.defineProperty(w3,"processDetector",{enumerable:!0,get:function(){return qDe.processDetector}});Object.defineProperty(w3,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return qDe.serviceInstanceIdDetector}});var Fso=SRr();Object.defineProperty(w3,"noopDetector",{enumerable:!0,get:function(){return Fso.noopDetector}})});var V3t=w(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});Df.defaultServiceName=Df.emptyResource=Df.defaultResource=Df.resourceFromAttributes=Df.serviceInstanceIdDetector=Df.processDetector=Df.osDetector=Df.hostDetector=Df.envDetector=Df.detectResources=void 0;var Uso=oRr();Object.defineProperty(Df,"detectResources",{enumerable:!0,get:function(){return Uso.detectResources}});var npe=wRr();Object.defineProperty(Df,"envDetector",{enumerable:!0,get:function(){return npe.envDetector}});Object.defineProperty(Df,"hostDetector",{enumerable:!0,get:function(){return npe.hostDetector}});Object.defineProperty(Df,"osDetector",{enumerable:!0,get:function(){return npe.osDetector}});Object.defineProperty(Df,"processDetector",{enumerable:!0,get:function(){return npe.processDetector}});Object.defineProperty(Df,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return npe.serviceInstanceIdDetector}});var j3t=P3t();Object.defineProperty(Df,"resourceFromAttributes",{enumerable:!0,get:function(){return j3t.resourceFromAttributes}});Object.defineProperty(Df,"defaultResource",{enumerable:!0,get:function(){return j3t.defaultResource}});Object.defineProperty(Df,"emptyResource",{enumerable:!0,get:function(){return j3t.emptyResource}});var Qso=N3t();Object.defineProperty(Df,"defaultServiceName",{enumerable:!0,get:function(){return Qso.defaultServiceName}})});var TRr=w(ipe=>{"use strict";Object.defineProperty(ipe,"__esModule",{value:!0});ipe.SeverityNumber=void 0;var qso;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(qso=ipe.SeverityNumber||(ipe.SeverityNumber={}))});var GDe=w(RK=>{"use strict";Object.defineProperty(RK,"__esModule",{value:!0});RK.NOOP_LOGGER=RK.NoopLogger=void 0;var HDe=class{emit(e){}};RK.NoopLogger=HDe;RK.NOOP_LOGGER=new HDe});var VDe=w(BK=>{"use strict";Object.defineProperty(BK,"__esModule",{value:!0});BK.NOOP_LOGGER_PROVIDER=BK.NoopLoggerProvider=void 0;var Hso=GDe(),jDe=class{getLogger(e,r,n){return new Hso.NoopLogger}};BK.NoopLoggerProvider=jDe;BK.NOOP_LOGGER_PROVIDER=new jDe});var W3t=w($De=>{"use strict";Object.defineProperty($De,"__esModule",{value:!0});$De.ProxyLogger=void 0;var Gso=GDe(),$3t=class{constructor(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Gso.NOOP_LOGGER}};$De.ProxyLogger=$3t});var Y3t=w(WDe=>{"use strict";Object.defineProperty(WDe,"__esModule",{value:!0});WDe.ProxyLoggerProvider=void 0;var jso=VDe(),Vso=W3t(),z3t=class{getLogger(e,r,n){var i;return(i=this._getDelegateLogger(e,r,n))!==null&&i!==void 0?i:new Vso.ProxyLogger(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:jso.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(e,r,n)}};WDe.ProxyLoggerProvider=z3t});var IRr=w(zDe=>{"use strict";Object.defineProperty(zDe,"__esModule",{value:!0});zDe._globalThis=void 0;zDe._globalThis=typeof globalThis=="object"?globalThis:global});var DRr=w(YDe=>{"use strict";Object.defineProperty(YDe,"__esModule",{value:!0});YDe._globalThis=void 0;var $so=IRr();Object.defineProperty(YDe,"_globalThis",{enumerable:!0,get:function(){return $so._globalThis}})});var RRr=w(KDe=>{"use strict";Object.defineProperty(KDe,"__esModule",{value:!0});KDe._globalThis=void 0;var Wso=DRr();Object.defineProperty(KDe,"_globalThis",{enumerable:!0,get:function(){return Wso._globalThis}})});var BRr=w(fS=>{"use strict";Object.defineProperty(fS,"__esModule",{value:!0});fS.API_BACKWARDS_COMPATIBILITY_VERSION=fS.makeGetter=fS._global=fS.GLOBAL_LOGS_API_KEY=void 0;var zso=RRr();fS.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");fS._global=zso._globalThis;function Yso(t,e,r){return n=>n===t?e:r}fS.makeGetter=Yso;fS.API_BACKWARDS_COMPATIBILITY_VERSION=1});var ORr=w(JDe=>{"use strict";Object.defineProperty(JDe,"__esModule",{value:!0});JDe.LogsAPI=void 0;var Hv=BRr(),Kso=VDe(),NRr=Y3t(),K3t=class t{constructor(){this._proxyLoggerProvider=new NRr.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return Hv._global[Hv.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(Hv._global[Hv.GLOBAL_LOGS_API_KEY]=(0,Hv.makeGetter)(Hv.API_BACKWARDS_COMPATIBILITY_VERSION,e,Kso.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=Hv._global[Hv.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(Hv._global,Hv.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete Hv._global[Hv.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new NRr.ProxyLoggerProvider}};JDe.LogsAPI=K3t});var MRr=w(Um=>{"use strict";Object.defineProperty(Um,"__esModule",{value:!0});Um.logs=Um.ProxyLoggerProvider=Um.ProxyLogger=Um.NoopLoggerProvider=Um.NOOP_LOGGER_PROVIDER=Um.NoopLogger=Um.NOOP_LOGGER=Um.SeverityNumber=void 0;var Jso=TRr();Object.defineProperty(Um,"SeverityNumber",{enumerable:!0,get:function(){return Jso.SeverityNumber}});var kRr=GDe();Object.defineProperty(Um,"NOOP_LOGGER",{enumerable:!0,get:function(){return kRr.NOOP_LOGGER}});Object.defineProperty(Um,"NoopLogger",{enumerable:!0,get:function(){return kRr.NoopLogger}});var PRr=VDe();Object.defineProperty(Um,"NOOP_LOGGER_PROVIDER",{enumerable:!0,get:function(){return PRr.NOOP_LOGGER_PROVIDER}});Object.defineProperty(Um,"NoopLoggerProvider",{enumerable:!0,get:function(){return PRr.NoopLoggerProvider}});var Xso=W3t();Object.defineProperty(Um,"ProxyLogger",{enumerable:!0,get:function(){return Xso.ProxyLogger}});var Zso=Y3t();Object.defineProperty(Um,"ProxyLoggerProvider",{enumerable:!0,get:function(){return Zso.ProxyLoggerProvider}});var eao=ORr();Um.logs=eao.LogsAPI.getInstance()});var ope=w(dB=>{"use strict";Object.defineProperty(dB,"__esModule",{value:!0});dB.isTracingSuppressed=dB.unsuppressTracing=dB.suppressTracing=void 0;var tao=(Kt(),yt(ar)),J3t=(0,tao.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function rao(t){return t.setValue(J3t,!0)}dB.suppressTracing=rao;function nao(t){return t.deleteValue(J3t)}dB.unsuppressTracing=nao;function iao(t){return t.getValue(J3t)===!0}dB.isTracingSuppressed=iao});var X3t=w(y2=>{"use strict";Object.defineProperty(y2,"__esModule",{value:!0});y2.BAGGAGE_MAX_TOTAL_LENGTH=y2.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=y2.BAGGAGE_MAX_NAME_VALUE_PAIRS=y2.BAGGAGE_HEADER=y2.BAGGAGE_ITEMS_SEPARATOR=y2.BAGGAGE_PROPERTIES_SEPARATOR=y2.BAGGAGE_KEY_PAIR_SEPARATOR=void 0;y2.BAGGAGE_KEY_PAIR_SEPARATOR="=";y2.BAGGAGE_PROPERTIES_SEPARATOR=";";y2.BAGGAGE_ITEMS_SEPARATOR=",";y2.BAGGAGE_HEADER="baggage";y2.BAGGAGE_MAX_NAME_VALUE_PAIRS=180;y2.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096;y2.BAGGAGE_MAX_TOTAL_LENGTH=8192});var Z3t=w(pS=>{"use strict";Object.defineProperty(pS,"__esModule",{value:!0});pS.parseKeyPairsIntoRecord=pS.parsePairKeyValue=pS.getKeyPairs=pS.serializeKeyPairs=void 0;var oao=(Kt(),yt(ar)),RF=X3t();function sao(t){return t.reduce((e,r)=>{let n=`${e}${e!==""?RF.BAGGAGE_ITEMS_SEPARATOR:""}${r}`;return n.length>RF.BAGGAGE_MAX_TOTAL_LENGTH?e:n},"")}pS.serializeKeyPairs=sao;function aao(t){return t.getAllEntries().map(([e,r])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=RF.BAGGAGE_PROPERTIES_SEPARATOR+r.metadata.toString()),n})}pS.getKeyPairs=aao;function LRr(t){let e=t.split(RF.BAGGAGE_PROPERTIES_SEPARATOR);if(e.length<=0)return;let r=e.shift();if(!r)return;let n=r.indexOf(RF.BAGGAGE_KEY_PAIR_SEPARATOR);if(n<=0)return;let i=decodeURIComponent(r.substring(0,n).trim()),o=decodeURIComponent(r.substring(n+1).trim()),s;return e.length>0&&(s=(0,oao.baggageEntryMetadataFromString)(e.join(RF.BAGGAGE_PROPERTIES_SEPARATOR))),{key:i,value:o,metadata:s}}pS.parsePairKeyValue=LRr;function cao(t){let e={};return typeof t=="string"&&t.length>0&&t.split(RF.BAGGAGE_ITEMS_SEPARATOR).forEach(r=>{let n=LRr(r);n!==void 0&&n.value.length>0&&(e[n.key]=n.value)}),e}pS.parseKeyPairsIntoRecord=cao});var FRr=w(XDe=>{"use strict";Object.defineProperty(XDe,"__esModule",{value:!0});XDe.W3CBaggagePropagator=void 0;var eyt=(Kt(),yt(ar)),lao=ope(),BF=X3t(),tyt=Z3t(),ryt=class{inject(e,r,n){let i=eyt.propagation.getBaggage(e);if(!i||(0,lao.isTracingSuppressed)(e))return;let o=(0,tyt.getKeyPairs)(i).filter(a=>a.length<=BF.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,BF.BAGGAGE_MAX_NAME_VALUE_PAIRS),s=(0,tyt.serializeKeyPairs)(o);s.length>0&&n.set(r,BF.BAGGAGE_HEADER,s)}extract(e,r,n){let i=n.get(r,BF.BAGGAGE_HEADER),o=Array.isArray(i)?i.join(BF.BAGGAGE_ITEMS_SEPARATOR):i;if(!o)return e;let s={};return o.length===0||(o.split(BF.BAGGAGE_ITEMS_SEPARATOR).forEach(c=>{let u=(0,tyt.parsePairKeyValue)(c);if(u){let d={value:u.value};u.metadata&&(d.metadata=u.metadata),s[u.key]=d}}),Object.entries(s).length===0)?e:eyt.propagation.setBaggage(e,eyt.propagation.createBaggage(s))}fields(){return[BF.BAGGAGE_HEADER]}};XDe.W3CBaggagePropagator=ryt});var URr=w(ZDe=>{"use strict";Object.defineProperty(ZDe,"__esModule",{value:!0});ZDe.AnchoredClock=void 0;var nyt=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(e,r){this._monotonicClock=r,this._epochMillis=e.now(),this._performanceMillis=r.now()}now(){let e=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+e}};ZDe.AnchoredClock=nyt});var jRr=w(fB=>{"use strict";Object.defineProperty(fB,"__esModule",{value:!0});fB.isAttributeValue=fB.isAttributeKey=fB.sanitizeAttributes=void 0;var QRr=(Kt(),yt(ar));function uao(t){let e={};if(typeof t!="object"||t==null)return e;for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(!qRr(r)){QRr.diag.warn(`Invalid attribute key: ${r}`);continue}let n=t[r];if(!HRr(n)){QRr.diag.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?e[r]=n.slice():e[r]=n}return e}fB.sanitizeAttributes=uao;function qRr(t){return typeof t=="string"&&t!==""}fB.isAttributeKey=qRr;function HRr(t){return t==null?!0:Array.isArray(t)?dao(t):GRr(typeof t)}fB.isAttributeValue=HRr;function dao(t){let e;for(let r of t){if(r==null)continue;let n=typeof r;if(n!==e){if(!e){if(GRr(n)){e=n;continue}return!1}return!1}}return!0}function GRr(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}});var iyt=w(eRe=>{"use strict";Object.defineProperty(eRe,"__esModule",{value:!0});eRe.loggingErrorHandler=void 0;var fao=(Kt(),yt(ar));function pao(){return t=>{fao.diag.error(hao(t))}}eRe.loggingErrorHandler=pao;function hao(t){return typeof t=="string"?t:JSON.stringify(mao(t))}function mao(t){let e={},r=t;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(e[n])return;let i=r[n];i&&(e[n]=String(i))}),r=Object.getPrototypeOf(r);return e}});var $Rr=w(NK=>{"use strict";Object.defineProperty(NK,"__esModule",{value:!0});NK.globalErrorHandler=NK.setGlobalErrorHandler=void 0;var gao=iyt(),VRr=(0,gao.loggingErrorHandler)();function Aao(t){VRr=t}NK.setGlobalErrorHandler=Aao;function yao(t){try{VRr(t)}catch{}}NK.globalErrorHandler=yao});var KRr=w(hS=>{"use strict";Object.defineProperty(hS,"__esModule",{value:!0});hS.getStringListFromEnv=hS.getBooleanFromEnv=hS.getStringFromEnv=hS.getNumberFromEnv=void 0;var WRr=(Kt(),yt(ar)),zRr=Ae("util");function Eao(t){let e=process.env[t];if(e==null||e.trim()==="")return;let r=Number(e);if(isNaN(r)){WRr.diag.warn(`Unknown value ${(0,zRr.inspect)(e)} for ${t}, expected a number, using defaults`);return}return r}hS.getNumberFromEnv=Eao;function YRr(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}hS.getStringFromEnv=YRr;function vao(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||WRr.diag.warn(`Unknown value ${(0,zRr.inspect)(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}hS.getBooleanFromEnv=vao;function bao(t){return YRr(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}hS.getStringListFromEnv=bao});var JRr=w(tRe=>{"use strict";Object.defineProperty(tRe,"__esModule",{value:!0});tRe._globalThis=void 0;tRe._globalThis=typeof globalThis=="object"?globalThis:global});var XRr=w(rRe=>{"use strict";Object.defineProperty(rRe,"__esModule",{value:!0});rRe.otperformance=void 0;var Cao=Ae("perf_hooks");rRe.otperformance=Cao.performance});var ZRr=w(nRe=>{"use strict";Object.defineProperty(nRe,"__esModule",{value:!0});nRe.VERSION=void 0;nRe.VERSION="2.2.0"});var eBr=w(iRe=>{"use strict";Object.defineProperty(iRe,"__esModule",{value:!0});iRe.ATTR_PROCESS_RUNTIME_NAME=void 0;iRe.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name"});var tBr=w(sRe=>{"use strict";Object.defineProperty(sRe,"__esModule",{value:!0});sRe.SDK_INFO=void 0;var _ao=ZRr(),oRe=(Nh(),yt(l2)),xao=eBr();sRe.SDK_INFO={[oRe.ATTR_TELEMETRY_SDK_NAME]:"opentelemetry",[xao.ATTR_PROCESS_RUNTIME_NAME]:"node",[oRe.ATTR_TELEMETRY_SDK_LANGUAGE]:oRe.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[oRe.ATTR_TELEMETRY_SDK_VERSION]:_ao.VERSION}});var rBr=w(E2=>{"use strict";Object.defineProperty(E2,"__esModule",{value:!0});E2.SDK_INFO=E2.otperformance=E2._globalThis=E2.getStringListFromEnv=E2.getNumberFromEnv=E2.getBooleanFromEnv=E2.getStringFromEnv=void 0;var aRe=KRr();Object.defineProperty(E2,"getStringFromEnv",{enumerable:!0,get:function(){return aRe.getStringFromEnv}});Object.defineProperty(E2,"getBooleanFromEnv",{enumerable:!0,get:function(){return aRe.getBooleanFromEnv}});Object.defineProperty(E2,"getNumberFromEnv",{enumerable:!0,get:function(){return aRe.getNumberFromEnv}});Object.defineProperty(E2,"getStringListFromEnv",{enumerable:!0,get:function(){return aRe.getStringListFromEnv}});var Sao=JRr();Object.defineProperty(E2,"_globalThis",{enumerable:!0,get:function(){return Sao._globalThis}});var wao=XRr();Object.defineProperty(E2,"otperformance",{enumerable:!0,get:function(){return wao.otperformance}});var Tao=tBr();Object.defineProperty(E2,"SDK_INFO",{enumerable:!0,get:function(){return Tao.SDK_INFO}})});var oyt=w(v2=>{"use strict";Object.defineProperty(v2,"__esModule",{value:!0});v2.getStringListFromEnv=v2.getNumberFromEnv=v2.getStringFromEnv=v2.getBooleanFromEnv=v2.otperformance=v2._globalThis=v2.SDK_INFO=void 0;var NF=rBr();Object.defineProperty(v2,"SDK_INFO",{enumerable:!0,get:function(){return NF.SDK_INFO}});Object.defineProperty(v2,"_globalThis",{enumerable:!0,get:function(){return NF._globalThis}});Object.defineProperty(v2,"otperformance",{enumerable:!0,get:function(){return NF.otperformance}});Object.defineProperty(v2,"getBooleanFromEnv",{enumerable:!0,get:function(){return NF.getBooleanFromEnv}});Object.defineProperty(v2,"getStringFromEnv",{enumerable:!0,get:function(){return NF.getStringFromEnv}});Object.defineProperty(v2,"getNumberFromEnv",{enumerable:!0,get:function(){return NF.getNumberFromEnv}});Object.defineProperty(v2,"getStringListFromEnv",{enumerable:!0,get:function(){return NF.getStringListFromEnv}})});var sBr=w(hu=>{"use strict";Object.defineProperty(hu,"__esModule",{value:!0});hu.addHrTimes=hu.isTimeInput=hu.isTimeInputHrTime=hu.hrTimeToMicroseconds=hu.hrTimeToMilliseconds=hu.hrTimeToNanoseconds=hu.hrTimeToTimeStamp=hu.hrTimeDuration=hu.timeInputToHrTime=hu.hrTime=hu.getTimeOrigin=hu.millisToHrTime=void 0;var syt=oyt(),nBr=9,Iao=6,Dao=Math.pow(10,Iao),cRe=Math.pow(10,nBr);function spe(t){let e=t/1e3,r=Math.trunc(e),n=Math.round(t%1e3*Dao);return[r,n]}hu.millisToHrTime=spe;function ayt(){let t=syt.otperformance.timeOrigin;if(typeof t!="number"){let e=syt.otperformance;t=e.timing&&e.timing.fetchStart}return t}hu.getTimeOrigin=ayt;function iBr(t){let e=spe(ayt()),r=spe(typeof t=="number"?t:syt.otperformance.now());return oBr(e,r)}hu.hrTime=iBr;function Rao(t){if(cyt(t))return t;if(typeof t=="number")return t<ayt()?iBr(t):spe(t);if(t instanceof Date)return spe(t.getTime());throw TypeError("Invalid input type")}hu.timeInputToHrTime=Rao;function Bao(t,e){let r=e[0]-t[0],n=e[1]-t[1];return n<0&&(r-=1,n+=cRe),[r,n]}hu.hrTimeDuration=Bao;function Nao(t){let e=nBr,r=`${"0".repeat(e)}${t[1]}Z`,n=r.substring(r.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",n)}hu.hrTimeToTimeStamp=Nao;function Oao(t){return t[0]*cRe+t[1]}hu.hrTimeToNanoseconds=Oao;function kao(t){return t[0]*1e3+t[1]/1e6}hu.hrTimeToMilliseconds=kao;function Pao(t){return t[0]*1e6+t[1]/1e3}hu.hrTimeToMicroseconds=Pao;function cyt(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}hu.isTimeInputHrTime=cyt;function Mao(t){return cyt(t)||typeof t=="number"||t instanceof Date}hu.isTimeInput=Mao;function oBr(t,e){let r=[t[0]+e[0],t[1]+e[1]];return r[1]>=cRe&&(r[1]-=cRe,r[0]+=1),r}hu.addHrTimes=oBr});var aBr=w(lRe=>{"use strict";Object.defineProperty(lRe,"__esModule",{value:!0});lRe.unrefTimer=void 0;function Lao(t){typeof t!="number"&&t.unref()}lRe.unrefTimer=Lao});var cBr=w(ape=>{"use strict";Object.defineProperty(ape,"__esModule",{value:!0});ape.ExportResultCode=void 0;var Fao;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(Fao=ape.ExportResultCode||(ape.ExportResultCode={}))});var uBr=w(uRe=>{"use strict";Object.defineProperty(uRe,"__esModule",{value:!0});uRe.CompositePropagator=void 0;var lBr=(Kt(),yt(ar)),lyt=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(r=>typeof r.fields=="function"?r.fields():[]).reduce((r,n)=>r.concat(n),[])))}inject(e,r,n){for(let i of this._propagators)try{i.inject(e,r,n)}catch(o){lBr.diag.warn(`Failed to inject with ${i.constructor.name}. Err: ${o.message}`)}}extract(e,r,n){return this._propagators.reduce((i,o)=>{try{return o.extract(i,r,n)}catch(s){lBr.diag.warn(`Failed to extract with ${o.constructor.name}. Err: ${s.message}`)}return i},e)}fields(){return this._fields.slice()}};uRe.CompositePropagator=lyt});var dBr=w(OK=>{"use strict";Object.defineProperty(OK,"__esModule",{value:!0});OK.validateValue=OK.validateKey=void 0;var uyt="[_0-9a-z-*/]",Uao=`[a-z]${uyt}{0,255}`,Qao=`[a-z0-9]${uyt}{0,240}@[a-z]${uyt}{0,13}`,qao=new RegExp(`^(?:${Uao}|${Qao})$`),Hao=/^[ -~]{0,255}[!-~]$/,Gao=/,|=/;function jao(t){return qao.test(t)}OK.validateKey=jao;function Vao(t){return Hao.test(t)&&!Gao.test(t)}OK.validateValue=Vao});var fyt=w(dRe=>{"use strict";Object.defineProperty(dRe,"__esModule",{value:!0});dRe.TraceState=void 0;var fBr=dBr(),pBr=32,$ao=512,hBr=",",mBr="=",dyt=class t{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,r){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,r),n}unset(e){let r=this._clone();return r._internalState.delete(e),r}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,r)=>(e.push(r+mBr+this.get(r)),e),[]).join(hBr)}_parse(e){e.length>$ao||(this._internalState=e.split(hBr).reverse().reduce((r,n)=>{let i=n.trim(),o=i.indexOf(mBr);if(o!==-1){let s=i.slice(0,o),a=i.slice(o+1,n.length);(0,fBr.validateKey)(s)&&(0,fBr.validateValue)(a)&&r.set(s,a)}return r},new Map),this._internalState.size>pBr&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,pBr))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}};dRe.TraceState=dyt});var ABr=w(b2=>{"use strict";Object.defineProperty(b2,"__esModule",{value:!0});b2.W3CTraceContextPropagator=b2.parseTraceParent=b2.TRACE_STATE_HEADER=b2.TRACE_PARENT_HEADER=void 0;var fRe=(Kt(),yt(ar)),Wao=ope(),zao=fyt();b2.TRACE_PARENT_HEADER="traceparent";b2.TRACE_STATE_HEADER="tracestate";var Yao="00",Kao="(?!ff)[\\da-f]{2}",Jao="(?![0]{32})[\\da-f]{32}",Xao="(?![0]{16})[\\da-f]{16}",Zao="[\\da-f]{2}",eco=new RegExp(`^\\s?(${Kao})-(${Jao})-(${Xao})-(${Zao})(-.*)?\\s?$`);function gBr(t){let e=eco.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}b2.parseTraceParent=gBr;var pyt=class{inject(e,r,n){let i=fRe.trace.getSpanContext(e);if(!i||(0,Wao.isTracingSuppressed)(e)||!(0,fRe.isSpanContextValid)(i))return;let o=`${Yao}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||fRe.TraceFlags.NONE).toString(16)}`;n.set(r,b2.TRACE_PARENT_HEADER,o),i.traceState&&n.set(r,b2.TRACE_STATE_HEADER,i.traceState.serialize())}extract(e,r,n){let i=n.get(r,b2.TRACE_PARENT_HEADER);if(!i)return e;let o=Array.isArray(i)?i[0]:i;if(typeof o!="string")return e;let s=gBr(o);if(!s)return e;s.isRemote=!0;let a=n.get(r,b2.TRACE_STATE_HEADER);if(a){let c=Array.isArray(a)?a.join(","):a;s.traceState=new zao.TraceState(typeof c=="string"?c:void 0)}return fRe.trace.setSpanContext(e,s)}fields(){return[b2.TRACE_PARENT_HEADER,b2.TRACE_STATE_HEADER]}};b2.W3CTraceContextPropagator=pyt});var yBr=w(JC=>{"use strict";Object.defineProperty(JC,"__esModule",{value:!0});JC.getRPCMetadata=JC.deleteRPCMetadata=JC.setRPCMetadata=JC.RPCType=void 0;var tco=(Kt(),yt(ar)),hyt=(0,tco.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"),rco;(function(t){t.HTTP="http"})(rco=JC.RPCType||(JC.RPCType={}));function nco(t,e){return t.setValue(hyt,e)}JC.setRPCMetadata=nco;function ico(t){return t.deleteValue(hyt)}JC.deleteRPCMetadata=ico;function oco(t){return t.getValue(hyt)}JC.getRPCMetadata=oco});var _Br=w(pRe=>{"use strict";Object.defineProperty(pRe,"__esModule",{value:!0});pRe.isPlainObject=void 0;var sco="[object Object]",aco="[object Null]",cco="[object Undefined]",lco=Function.prototype,EBr=lco.toString,uco=EBr.call(Object),dco=Object.getPrototypeOf,vBr=Object.prototype,bBr=vBr.hasOwnProperty,OF=Symbol?Symbol.toStringTag:void 0,CBr=vBr.toString;function fco(t){if(!pco(t)||hco(t)!==sco)return!1;let e=dco(t);if(e===null)return!0;let r=bBr.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&EBr.call(r)===uco}pRe.isPlainObject=fco;function pco(t){return t!=null&&typeof t=="object"}function hco(t){return t==null?t===void 0?cco:aco:OF&&OF in Object(t)?mco(t):gco(t)}function mco(t){let e=bBr.call(t,OF),r=t[OF],n=!1;try{t[OF]=void 0,n=!0}catch{}let i=CBr.call(t);return n&&(e?t[OF]=r:delete t[OF]),i}function gco(t){return CBr.call(t)}});var IBr=w(gRe=>{"use strict";Object.defineProperty(gRe,"__esModule",{value:!0});gRe.merge=void 0;var xBr=_Br(),Aco=20;function yco(...t){let e=t.shift(),r=new WeakMap;for(;t.length>0;)e=wBr(e,t.shift(),0,r);return e}gRe.merge=yco;function myt(t){return mRe(t)?t.slice():t}function wBr(t,e,r=0,n){let i;if(!(r>Aco)){if(r++,hRe(t)||hRe(e)||TBr(e))i=myt(e);else if(mRe(t)){if(i=t.slice(),mRe(e))for(let o=0,s=e.length;o<s;o++)i.push(myt(e[o]));else if(cpe(e)){let o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){let c=o[s];i[c]=myt(e[c])}}}else if(cpe(t))if(cpe(e)){if(!Eco(t,e))return e;i=Object.assign({},t);let o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){let c=o[s],u=e[c];if(hRe(u))typeof u>"u"?delete i[c]:i[c]=u;else{let d=i[c],f=u;if(SBr(t,c,n)||SBr(e,c,n))delete i[c];else{if(cpe(d)&&cpe(f)){let p=n.get(d)||[],h=n.get(f)||[];p.push({obj:t,key:c}),h.push({obj:e,key:c}),n.set(d,p),n.set(f,h)}i[c]=wBr(i[c],u,r,n)}}}}else i=e;return i}}function SBr(t,e,r){let n=r.get(t[e])||[];for(let i=0,o=n.length;i<o;i++){let s=n[i];if(s.key===e&&s.obj===t)return!0}return!1}function mRe(t){return Array.isArray(t)}function TBr(t){return typeof t=="function"}function cpe(t){return!hRe(t)&&!mRe(t)&&!TBr(t)&&typeof t=="object"}function hRe(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function Eco(t,e){return!(!(0,xBr.isPlainObject)(t)||!(0,xBr.isPlainObject)(e))}});var DBr=w(kK=>{"use strict";Object.defineProperty(kK,"__esModule",{value:!0});kK.callWithTimeout=kK.TimeoutError=void 0;var ARe=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};kK.TimeoutError=ARe;function vco(t,e){let r,n=new Promise(function(o,s){r=setTimeout(function(){s(new ARe("Operation timed out."))},e)});return Promise.race([t,n]).then(i=>(clearTimeout(r),i),i=>{throw clearTimeout(r),i})}kK.callWithTimeout=vco});var BBr=w(PK=>{"use strict";Object.defineProperty(PK,"__esModule",{value:!0});PK.isUrlIgnored=PK.urlMatches=void 0;function RBr(t,e){return typeof e=="string"?t===e:!!t.match(e)}PK.urlMatches=RBr;function bco(t,e){if(!e)return!1;for(let r of e)if(RBr(t,r))return!0;return!1}PK.isUrlIgnored=bco});var NBr=w(yRe=>{"use strict";Object.defineProperty(yRe,"__esModule",{value:!0});yRe.Deferred=void 0;var gyt=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};yRe.Deferred=gyt});var OBr=w(ERe=>{"use strict";Object.defineProperty(ERe,"__esModule",{value:!0});ERe.BindOnceFuture=void 0;var Cco=NBr(),Ayt=class{_callback;_that;_isCalled=!1;_deferred=new Cco.Deferred;constructor(e,r){this._callback=e,this._that=r}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}};ERe.BindOnceFuture=Ayt});var PBr=w(vRe=>{"use strict";Object.defineProperty(vRe,"__esModule",{value:!0});vRe.diagLogLevelFromString=void 0;var pT=(Kt(),yt(ar)),kBr={ALL:pT.DiagLogLevel.ALL,VERBOSE:pT.DiagLogLevel.VERBOSE,DEBUG:pT.DiagLogLevel.DEBUG,INFO:pT.DiagLogLevel.INFO,WARN:pT.DiagLogLevel.WARN,ERROR:pT.DiagLogLevel.ERROR,NONE:pT.DiagLogLevel.NONE};function _co(t){if(t==null)return;let e=kBr[t.toUpperCase()];return e??(pT.diag.warn(`Unknown log level "${t}", expected one of ${Object.keys(kBr)}, using default`),pT.DiagLogLevel.INFO)}vRe.diagLogLevelFromString=_co});var LBr=w(bRe=>{"use strict";Object.defineProperty(bRe,"__esModule",{value:!0});bRe._export=void 0;var MBr=(Kt(),yt(ar)),xco=ope();function Sco(t,e){return new Promise(r=>{MBr.context.with((0,xco.suppressTracing)(MBr.context.active()),()=>{t.export(e,n=>{r(n)})})})}bRe._export=Sco});var hT=w(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.internal=Lr.diagLogLevelFromString=Lr.BindOnceFuture=Lr.urlMatches=Lr.isUrlIgnored=Lr.callWithTimeout=Lr.TimeoutError=Lr.merge=Lr.TraceState=Lr.unsuppressTracing=Lr.suppressTracing=Lr.isTracingSuppressed=Lr.setRPCMetadata=Lr.getRPCMetadata=Lr.deleteRPCMetadata=Lr.RPCType=Lr.parseTraceParent=Lr.W3CTraceContextPropagator=Lr.TRACE_STATE_HEADER=Lr.TRACE_PARENT_HEADER=Lr.CompositePropagator=Lr.otperformance=Lr.getStringListFromEnv=Lr.getNumberFromEnv=Lr.getBooleanFromEnv=Lr.getStringFromEnv=Lr._globalThis=Lr.SDK_INFO=Lr.parseKeyPairsIntoRecord=Lr.ExportResultCode=Lr.unrefTimer=Lr.timeInputToHrTime=Lr.millisToHrTime=Lr.isTimeInputHrTime=Lr.isTimeInput=Lr.hrTimeToTimeStamp=Lr.hrTimeToNanoseconds=Lr.hrTimeToMilliseconds=Lr.hrTimeToMicroseconds=Lr.hrTimeDuration=Lr.hrTime=Lr.getTimeOrigin=Lr.addHrTimes=Lr.loggingErrorHandler=Lr.setGlobalErrorHandler=Lr.globalErrorHandler=Lr.sanitizeAttributes=Lr.isAttributeValue=Lr.AnchoredClock=Lr.W3CBaggagePropagator=void 0;var wco=FRr();Object.defineProperty(Lr,"W3CBaggagePropagator",{enumerable:!0,get:function(){return wco.W3CBaggagePropagator}});var Tco=URr();Object.defineProperty(Lr,"AnchoredClock",{enumerable:!0,get:function(){return Tco.AnchoredClock}});var FBr=jRr();Object.defineProperty(Lr,"isAttributeValue",{enumerable:!0,get:function(){return FBr.isAttributeValue}});Object.defineProperty(Lr,"sanitizeAttributes",{enumerable:!0,get:function(){return FBr.sanitizeAttributes}});var UBr=$Rr();Object.defineProperty(Lr,"globalErrorHandler",{enumerable:!0,get:function(){return UBr.globalErrorHandler}});Object.defineProperty(Lr,"setGlobalErrorHandler",{enumerable:!0,get:function(){return UBr.setGlobalErrorHandler}});var Ico=iyt();Object.defineProperty(Lr,"loggingErrorHandler",{enumerable:!0,get:function(){return Ico.loggingErrorHandler}});var Gv=sBr();Object.defineProperty(Lr,"addHrTimes",{enumerable:!0,get:function(){return Gv.addHrTimes}});Object.defineProperty(Lr,"getTimeOrigin",{enumerable:!0,get:function(){return Gv.getTimeOrigin}});Object.defineProperty(Lr,"hrTime",{enumerable:!0,get:function(){return Gv.hrTime}});Object.defineProperty(Lr,"hrTimeDuration",{enumerable:!0,get:function(){return Gv.hrTimeDuration}});Object.defineProperty(Lr,"hrTimeToMicroseconds",{enumerable:!0,get:function(){return Gv.hrTimeToMicroseconds}});Object.defineProperty(Lr,"hrTimeToMilliseconds",{enumerable:!0,get:function(){return Gv.hrTimeToMilliseconds}});Object.defineProperty(Lr,"hrTimeToNanoseconds",{enumerable:!0,get:function(){return Gv.hrTimeToNanoseconds}});Object.defineProperty(Lr,"hrTimeToTimeStamp",{enumerable:!0,get:function(){return Gv.hrTimeToTimeStamp}});Object.defineProperty(Lr,"isTimeInput",{enumerable:!0,get:function(){return Gv.isTimeInput}});Object.defineProperty(Lr,"isTimeInputHrTime",{enumerable:!0,get:function(){return Gv.isTimeInputHrTime}});Object.defineProperty(Lr,"millisToHrTime",{enumerable:!0,get:function(){return Gv.millisToHrTime}});Object.defineProperty(Lr,"timeInputToHrTime",{enumerable:!0,get:function(){return Gv.timeInputToHrTime}});var Dco=aBr();Object.defineProperty(Lr,"unrefTimer",{enumerable:!0,get:function(){return Dco.unrefTimer}});var Rco=cBr();Object.defineProperty(Lr,"ExportResultCode",{enumerable:!0,get:function(){return Rco.ExportResultCode}});var Bco=Z3t();Object.defineProperty(Lr,"parseKeyPairsIntoRecord",{enumerable:!0,get:function(){return Bco.parseKeyPairsIntoRecord}});var kF=oyt();Object.defineProperty(Lr,"SDK_INFO",{enumerable:!0,get:function(){return kF.SDK_INFO}});Object.defineProperty(Lr,"_globalThis",{enumerable:!0,get:function(){return kF._globalThis}});Object.defineProperty(Lr,"getStringFromEnv",{enumerable:!0,get:function(){return kF.getStringFromEnv}});Object.defineProperty(Lr,"getBooleanFromEnv",{enumerable:!0,get:function(){return kF.getBooleanFromEnv}});Object.defineProperty(Lr,"getNumberFromEnv",{enumerable:!0,get:function(){return kF.getNumberFromEnv}});Object.defineProperty(Lr,"getStringListFromEnv",{enumerable:!0,get:function(){return kF.getStringListFromEnv}});Object.defineProperty(Lr,"otperformance",{enumerable:!0,get:function(){return kF.otperformance}});var Nco=uBr();Object.defineProperty(Lr,"CompositePropagator",{enumerable:!0,get:function(){return Nco.CompositePropagator}});var CRe=ABr();Object.defineProperty(Lr,"TRACE_PARENT_HEADER",{enumerable:!0,get:function(){return CRe.TRACE_PARENT_HEADER}});Object.defineProperty(Lr,"TRACE_STATE_HEADER",{enumerable:!0,get:function(){return CRe.TRACE_STATE_HEADER}});Object.defineProperty(Lr,"W3CTraceContextPropagator",{enumerable:!0,get:function(){return CRe.W3CTraceContextPropagator}});Object.defineProperty(Lr,"parseTraceParent",{enumerable:!0,get:function(){return CRe.parseTraceParent}});var _Re=yBr();Object.defineProperty(Lr,"RPCType",{enumerable:!0,get:function(){return _Re.RPCType}});Object.defineProperty(Lr,"deleteRPCMetadata",{enumerable:!0,get:function(){return _Re.deleteRPCMetadata}});Object.defineProperty(Lr,"getRPCMetadata",{enumerable:!0,get:function(){return _Re.getRPCMetadata}});Object.defineProperty(Lr,"setRPCMetadata",{enumerable:!0,get:function(){return _Re.setRPCMetadata}});var yyt=ope();Object.defineProperty(Lr,"isTracingSuppressed",{enumerable:!0,get:function(){return yyt.isTracingSuppressed}});Object.defineProperty(Lr,"suppressTracing",{enumerable:!0,get:function(){return yyt.suppressTracing}});Object.defineProperty(Lr,"unsuppressTracing",{enumerable:!0,get:function(){return yyt.unsuppressTracing}});var Oco=fyt();Object.defineProperty(Lr,"TraceState",{enumerable:!0,get:function(){return Oco.TraceState}});var kco=IBr();Object.defineProperty(Lr,"merge",{enumerable:!0,get:function(){return kco.merge}});var QBr=DBr();Object.defineProperty(Lr,"TimeoutError",{enumerable:!0,get:function(){return QBr.TimeoutError}});Object.defineProperty(Lr,"callWithTimeout",{enumerable:!0,get:function(){return QBr.callWithTimeout}});var qBr=BBr();Object.defineProperty(Lr,"isUrlIgnored",{enumerable:!0,get:function(){return qBr.isUrlIgnored}});Object.defineProperty(Lr,"urlMatches",{enumerable:!0,get:function(){return qBr.urlMatches}});var Pco=OBr();Object.defineProperty(Lr,"BindOnceFuture",{enumerable:!0,get:function(){return Pco.BindOnceFuture}});var Mco=PBr();Object.defineProperty(Lr,"diagLogLevelFromString",{enumerable:!0,get:function(){return Mco.diagLogLevelFromString}});var Lco=LBr();Lr.internal={_export:Lco._export}});var HBr=w(SRe=>{"use strict";Object.defineProperty(SRe,"__esModule",{value:!0});SRe.LogRecordImpl=void 0;var PF=(Kt(),yt(ar)),xRe=hT(),Eyt=class{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;totalAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this.totalAttributesCount-Object.keys(this.attributes).length}constructor(e,r,n){let{timestamp:i,observedTimestamp:o,eventName:s,severityNumber:a,severityText:c,body:u,attributes:d={},context:f}=n,p=Date.now();if(this.hrTime=(0,xRe.timeInputToHrTime)(i??p),this.hrTimeObserved=(0,xRe.timeInputToHrTime)(o??p),f){let h=PF.trace.getSpanContext(f);h&&PF.isSpanContextValid(h)&&(this.spanContext=h)}this.severityNumber=a,this.severityText=c,this.body=u,this.resource=e.resource,this.instrumentationScope=r,this._logRecordLimits=e.logRecordLimits,this._eventName=s,this.setAttributes(d)}setAttribute(e,r){return this._isLogRecordReadonly()?this:r===null?this:e.length===0?(PF.diag.warn(`Invalid attribute key: ${e}`),this):!(0,xRe.isAttributeValue)(r)&&!(typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length>0)?(PF.diag.warn(`Invalid attribute value set for key: ${e}`),this):(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,e)?(this.droppedAttributesCount===1&&PF.diag.warn("Dropping extra attributes."),this):((0,xRe.isAttributeValue)(r)?this.attributes[e]=this._truncateToSize(r):this.attributes[e]=r,this))}setAttributes(e){for(let[r,n]of Object.entries(e))this.setAttribute(r,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let r=this._logRecordLimits.attributeValueLengthLimit;return r<=0?(PF.diag.warn(`Attribute value limit must be positive, got ${r}`),e):typeof e=="string"?this._truncateToLimitUtil(e,r):Array.isArray(e)?e.map(n=>typeof n=="string"?this._truncateToLimitUtil(n,r):n):e}_truncateToLimitUtil(e,r){return e.length<=r?e:e.substring(0,r)}_isLogRecordReadonly(){return this._isReadonly&&PF.diag.warn("Can not execute the operation on emitted log record"),this._isReadonly}};SRe.LogRecordImpl=Eyt});var GBr=w(wRe=>{"use strict";Object.defineProperty(wRe,"__esModule",{value:!0});wRe.Logger=void 0;var Fco=(Kt(),yt(ar)),Uco=HBr(),vyt=class{instrumentationScope;_sharedState;constructor(e,r){this.instrumentationScope=e,this._sharedState=r}emit(e){let r=e.context||Fco.context.active(),n=new Uco.LogRecordImpl(this._sharedState,this.instrumentationScope,{context:r,...e});this._sharedState.activeProcessor.onEmit(n,r),n._makeReadonly()}};wRe.Logger=vyt});var jBr=w(LK=>{"use strict";Object.defineProperty(LK,"__esModule",{value:!0});LK.reconfigureLimits=LK.loadDefaultConfig=void 0;var MK=hT();function Qco(){return{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:(0,MK.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,MK.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT")??128},includeTraceContext:!0}}LK.loadDefaultConfig=Qco;function qco(t){return{attributeCountLimit:t.attributeCountLimit??(0,MK.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT")??(0,MK.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??128,attributeValueLengthLimit:t.attributeValueLengthLimit??(0,MK.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT")??(0,MK.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0}}LK.reconfigureLimits=qco});var Cyt=w(TRe=>{"use strict";Object.defineProperty(TRe,"__esModule",{value:!0});TRe.NoopLogRecordProcessor=void 0;var byt=class{forceFlush(){return Promise.resolve()}onEmit(e,r){}shutdown(){return Promise.resolve()}};TRe.NoopLogRecordProcessor=byt});var VBr=w(IRe=>{"use strict";Object.defineProperty(IRe,"__esModule",{value:!0});IRe.MultiLogRecordProcessor=void 0;var Hco=hT(),_yt=class{processors;forceFlushTimeoutMillis;constructor(e,r){this.processors=e,this.forceFlushTimeoutMillis=r}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(r=>(0,Hco.callWithTimeout)(r.forceFlush(),e)))}onEmit(e,r){this.processors.forEach(n=>n.onEmit(e,r))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}};IRe.MultiLogRecordProcessor=_yt});var $Br=w(DRe=>{"use strict";Object.defineProperty(DRe,"__esModule",{value:!0});DRe.LoggerProviderSharedState=void 0;var Gco=Cyt(),jco=VBr(),xyt=class{resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];constructor(e,r,n,i){this.resource=e,this.forceFlushTimeoutMillis=r,this.logRecordLimits=n,this.processors=i,i.length>0?(this.registeredLogRecordProcessors=i,this.activeProcessor=new jco.MultiLogRecordProcessor(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Gco.NoopLogRecordProcessor}};DRe.LoggerProviderSharedState=xyt});var YBr=w(MF=>{"use strict";Object.defineProperty(MF,"__esModule",{value:!0});MF.LoggerProvider=MF.DEFAULT_LOGGER_NAME=void 0;var RRe=(Kt(),yt(ar)),Vco=MRr(),$co=V3t(),WBr=hT(),Wco=GBr(),zBr=jBr(),zco=$Br();MF.DEFAULT_LOGGER_NAME="unknown";var Syt=class{_shutdownOnce;_sharedState;constructor(e={}){let r=(0,WBr.merge)({},(0,zBr.loadDefaultConfig)(),e),n=e.resource??(0,$co.defaultResource)();this._sharedState=new zco.LoggerProviderSharedState(n,r.forceFlushTimeoutMillis,(0,zBr.reconfigureLimits)(r.logRecordLimits),e?.processors??[]),this._shutdownOnce=new WBr.BindOnceFuture(this._shutdown,this)}getLogger(e,r,n){if(this._shutdownOnce.isCalled)return RRe.diag.warn("A shutdown LoggerProvider cannot provide a Logger"),Vco.NOOP_LOGGER;e||RRe.diag.warn("Logger requested without instrumentation scope name.");let i=e||MF.DEFAULT_LOGGER_NAME,o=`${i}@${r||""}:${n?.schemaUrl||""}`;return this._sharedState.loggers.has(o)||this._sharedState.loggers.set(o,new Wco.Logger({name:i,version:r,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(o)}forceFlush(){return this._shutdownOnce.isCalled?(RRe.diag.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(RRe.diag.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};MF.LoggerProvider=Syt});var JBr=w(BRe=>{"use strict";Object.defineProperty(BRe,"__esModule",{value:!0});BRe.ConsoleLogRecordExporter=void 0;var KBr=hT(),wyt=class{export(e,r){this._sendLogRecords(e,r)}shutdown(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:(0,KBr.hrTimeToMicroseconds)(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,body:e.body,attributes:e.attributes}}_sendLogRecords(e,r){for(let n of e)console.dir(this._exportInfo(n),{depth:3});r?.({code:KBr.ExportResultCode.SUCCESS})}};BRe.ConsoleLogRecordExporter=wyt});var XBr=w(NRe=>{"use strict";Object.defineProperty(NRe,"__esModule",{value:!0});NRe.SimpleLogRecordProcessor=void 0;var FK=hT(),Tyt=class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new FK.BindOnceFuture(this._shutdown,this),this._unresolvedExports=new Set}onEmit(e){if(this._shutdownOnce.isCalled)return;let r=()=>FK.internal._export(this._exporter,[e]).then(n=>{n.code!==FK.ExportResultCode.SUCCESS&&(0,FK.globalErrorHandler)(n.error??new Error(`SimpleLogRecordProcessor: log record export failed (status ${n})`))}).catch(FK.globalErrorHandler);if(e.resource.asyncAttributesPending){let n=e.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(n),r()),FK.globalErrorHandler);n!=null&&this._unresolvedExports.add(n)}else r()}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports))}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}};NRe.SimpleLogRecordProcessor=Tyt});var eNr=w(ORe=>{"use strict";Object.defineProperty(ORe,"__esModule",{value:!0});ORe.InMemoryLogRecordExporter=void 0;var ZBr=hT(),Iyt=class{_finishedLogRecords=[];_stopped=!1;export(e,r){if(this._stopped)return r({code:ZBr.ExportResultCode.FAILED,error:new Error("Exporter has been stopped")});this._finishedLogRecords.push(...e),r({code:ZBr.ExportResultCode.SUCCESS})}shutdown(){return this._stopped=!0,this.reset(),Promise.resolve()}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}};ORe.InMemoryLogRecordExporter=Iyt});var tNr=w(kRe=>{"use strict";Object.defineProperty(kRe,"__esModule",{value:!0});kRe.BatchLogRecordProcessorBase=void 0;var Yco=(Kt(),yt(ar)),jv=hT(),Dyt=class{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_isExporting=!1;_finishedLogRecords=[];_timer;_shutdownOnce;constructor(e,r){this._exporter=e,this._maxExportBatchSize=r?.maxExportBatchSize??(0,jv.getNumberFromEnv)("OTEL_BLRP_MAX_EXPORT_BATCH_SIZE")??512,this._maxQueueSize=r?.maxQueueSize??(0,jv.getNumberFromEnv)("OTEL_BLRP_MAX_QUEUE_SIZE")??2048,this._scheduledDelayMillis=r?.scheduledDelayMillis??(0,jv.getNumberFromEnv)("OTEL_BLRP_SCHEDULE_DELAY")??5e3,this._exportTimeoutMillis=r?.exportTimeoutMillis??(0,jv.getNumberFromEnv)("OTEL_BLRP_EXPORT_TIMEOUT")??3e4,this._shutdownOnce=new jv.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(Yco.diag.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,r)=>{let n=[],i=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let o=0;o<i;o++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedLogRecords.length===0?Promise.resolve():new Promise((e,r)=>{(0,jv.callWithTimeout)(this._export(this._finishedLogRecords.splice(0,this._maxExportBatchSize)),this._exportTimeoutMillis).then(()=>e()).catch(r)})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().then(()=>{this._isExporting=!1,this._finishedLogRecords.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(r=>{this._isExporting=!1,(0,jv.globalErrorHandler)(r)})};if(this._finishedLogRecords.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}_export(e){let r=()=>jv.internal._export(this._exporter,e).then(i=>{i.code!==jv.ExportResultCode.SUCCESS&&(0,jv.globalErrorHandler)(i.error??new Error(`BatchLogRecordProcessor: log record export failed (status ${i})`))}).catch(jv.globalErrorHandler),n=e.map(i=>i.resource).filter(i=>i.asyncAttributesPending);return n.length===0?r():Promise.all(n.map(i=>i.waitForAsyncAttributes?.())).then(r,jv.globalErrorHandler)}};kRe.BatchLogRecordProcessorBase=Dyt});var rNr=w(PRe=>{"use strict";Object.defineProperty(PRe,"__esModule",{value:!0});PRe.BatchLogRecordProcessor=void 0;var Kco=tNr(),Ryt=class extends Kco.BatchLogRecordProcessorBase{onShutdown(){}};PRe.BatchLogRecordProcessor=Ryt});var nNr=w(MRe=>{"use strict";Object.defineProperty(MRe,"__esModule",{value:!0});MRe.BatchLogRecordProcessor=void 0;var Jco=rNr();Object.defineProperty(MRe,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return Jco.BatchLogRecordProcessor}})});var iNr=w(LRe=>{"use strict";Object.defineProperty(LRe,"__esModule",{value:!0});LRe.BatchLogRecordProcessor=void 0;var Xco=nNr();Object.defineProperty(LRe,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return Xco.BatchLogRecordProcessor}})});var oNr=w(T3=>{"use strict";Object.defineProperty(T3,"__esModule",{value:!0});T3.BatchLogRecordProcessor=T3.InMemoryLogRecordExporter=T3.SimpleLogRecordProcessor=T3.ConsoleLogRecordExporter=T3.NoopLogRecordProcessor=T3.LoggerProvider=void 0;var Zco=YBr();Object.defineProperty(T3,"LoggerProvider",{enumerable:!0,get:function(){return Zco.LoggerProvider}});var elo=Cyt();Object.defineProperty(T3,"NoopLogRecordProcessor",{enumerable:!0,get:function(){return elo.NoopLogRecordProcessor}});var tlo=JBr();Object.defineProperty(T3,"ConsoleLogRecordExporter",{enumerable:!0,get:function(){return tlo.ConsoleLogRecordExporter}});var rlo=XBr();Object.defineProperty(T3,"SimpleLogRecordProcessor",{enumerable:!0,get:function(){return rlo.SimpleLogRecordProcessor}});var nlo=eNr();Object.defineProperty(T3,"InMemoryLogRecordExporter",{enumerable:!0,get:function(){return nlo.InMemoryLogRecordExporter}});var ilo=iNr();Object.defineProperty(T3,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return ilo.BatchLogRecordProcessor}})});var Z0,sNr,lpe,aNr,upe,dpe,cNr,lNr,uNr,dNr,fNr,pNr,hNr,mNr,gNr,ANr,yNr,ENr,vNr,bNr,CNr,_Nr,xNr,SNr,wNr,TNr,INr,DNr,fpe=Z(()=>{"use strict";Z0="iflow-cli",sNr="iflow_cli.user_prompt",lpe="iflow_cli.tool_call",aNr="iflow_cli.api_request",upe="iflow_cli.api_error",dpe="iflow_cli.api_response",cNr="iflow_cli.config",lNr="iflow_cli.flash_fallback",uNr="iflow_cli.next_speaker_check",dNr="iflow_cli.slash_command",fNr="iflow_cli.tool.call.count",pNr="iflow_cli.tool.call.latency",hNr="iflow_cli.mcp.tool.call.count",mNr="iflow_cli.mcp.tool.call.latency",gNr="iflow_cli.builtin.tool.call.count",ANr="iflow_cli.builtin.tool.call.latency",yNr="gen_ai.client.operation",ENr="gen_ai.client.operation.duration",vNr="gen_ai.client.token.usage",bNr="iflow_cli.session.count",CNr="iflow_cli.file.operation.count",_Nr="iflow_cli.user_request.count",xNr="iflow_cli.user_request.latency",SNr="iflow_cli.user_experience.success",wNr="iflow_cli.user.identity",TNr="iflow_cli.scheduler.lock.error",INr="iflow_cli.mcp.connect.count",DNr="iflow_cli.loop.detection.count"});import olo from"os";function RNr(){try{let t=olo.networkInterfaces();for(let e of Object.keys(t)){let r=t[e];if(r){for(let n of r)if(n.family==="IPv4"&&!n.internal)return n.address}}return"127.0.0.1"}catch{return"127.0.0.1"}}var BNr=Z(()=>{"use strict"});var UK,QK,qK,HK,GK,jK,VK,$K,WK,zK,XC,ZC,NNr=Z(()=>{"use strict";UK="iflow_cli.cpu.usage_percentage",QK="iflow_cli.cpu.user_percentage",qK="iflow_cli.cpu.system_percentage",HK="iflow_cli.cpu.cores",GK="iflow_cli.memory.heap_used",jK="iflow_cli.memory.heap_total",VK="iflow_cli.memory.rss",$K="iflow_cli.memory.external",WK="iflow_cli.memory.system_usage_percentage",zK="iflow_cli.memory.process_usage_percentage",XC={[UK]:"CPU usage percentage",[QK]:"CPU user time percentage",[qK]:"CPU system time percentage",[HK]:"Number of CPU cores",[GK]:"Heap memory used in bytes",[jK]:"Heap memory total in bytes",[VK]:"Resident Set Size in bytes",[$K]:"External memory in bytes",[WK]:"System memory usage percentage",[zK]:"Process memory usage percentage relative to Node.js limits"},ZC={[UK]:"percent",[QK]:"percent",[qK]:"percent",[HK]:"cores",[GK]:"bytes",[jK]:"bytes",[VK]:"bytes",[$K]:"bytes",[WK]:"percent",[zK]:"percent"}});import*as e5 from"os";var FRe,ONr=Z(()=>{"use strict";NNr();FRe=class{meter;options;lastCpuMeasurement;lastMeasureTime;cpuCores;totalSystemMemory;nodeJSMemoryLimit;cpuUsageGauge;cpuUserGauge;cpuSystemGauge;cpuCoresGauge;memoryHeapUsedGauge;memoryHeapTotalGauge;memoryRssGauge;memoryExternalGauge;memorySystemUsageGauge;memoryProcessUsageGauge;constructor(e,r={}){this.meter=e,this.options={enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0,...r},this.lastCpuMeasurement=process.cpuUsage(),this.lastMeasureTime=Date.now(),this.cpuCores=e5.cpus().length,this.totalSystemMemory=e5.totalmem(),this.nodeJSMemoryLimit=this.getNodeJSMemoryLimit(),this.initializeMetrics()}getCurrentCpuMetrics(){try{let e=process.cpuUsage(this.lastCpuMeasurement),r=Date.now(),n=r-this.lastMeasureTime;if(this.lastCpuMeasurement=process.cpuUsage(),this.lastMeasureTime=r,n<=0)return{usage:0,user:0,system:0,cores:this.cpuCores};let i=Math.max(0,e.user+e.system),o=Math.max(0,e.user),s=Math.max(0,e.system),a=i/(n*1e3)*100,c=o/(n*1e3)*100,u=s/(n*1e3)*100,d=Number.isFinite(a)?Math.min(100,Math.max(0,a)):0,f=Number.isFinite(c)?Math.min(100,Math.max(0,c)):0,p=Number.isFinite(u)?Math.min(100,Math.max(0,u)):0;return{usage:d,user:f,system:p,cores:this.cpuCores}}catch{return{usage:0,user:0,system:0,cores:this.cpuCores}}}getCurrentMemoryMetrics(){try{let e=process.memoryUsage(),r=e5.freemem(),i=(this.totalSystemMemory-r)/this.totalSystemMemory*100,o=e.rss/this.nodeJSMemoryLimit*100;return{heapUsed:e.heapUsed,heapTotal:e.heapTotal,rss:e.rss,external:e.external,systemUsage:Math.min(100,Math.max(0,i)),processUsage:Math.min(100,Math.max(0,o))}}catch{return{heapUsed:0,heapTotal:0,rss:0,external:0,systemUsage:0,processUsage:0}}}initializeMetrics(){let e=e5.platform(),r=e5.arch(),n=process.version;this.options.enableCpuMetrics&&(this.cpuUsageGauge=this.meter.createObservableGauge(UK,{description:XC[UK],unit:ZC[UK]}),this.cpuUserGauge=this.meter.createObservableGauge(QK,{description:XC[QK],unit:ZC[QK]}),this.cpuSystemGauge=this.meter.createObservableGauge(qK,{description:XC[qK],unit:ZC[qK]}),this.cpuCoresGauge=this.meter.createObservableGauge(HK,{description:XC[HK],unit:ZC[HK]}),this.cpuUsageGauge.addCallback(i=>{let o=this.getCurrentCpuMetrics();i.observe(o.usage,{platform:e,arch:r,node_version:n})}),this.cpuUserGauge.addCallback(i=>{let o=this.getCurrentCpuMetrics();i.observe(o.user,{platform:e,arch:r,node_version:n})}),this.cpuSystemGauge.addCallback(i=>{let o=this.getCurrentCpuMetrics();i.observe(o.system,{platform:e,arch:r,node_version:n})}),this.cpuCoresGauge?.addCallback(i=>{i.observe(this.cpuCores,{platform:e,arch:r})})),this.options.enableMemoryMetrics&&(this.memoryHeapUsedGauge=this.meter.createObservableGauge(GK,{description:XC[GK],unit:ZC[GK]}),this.memoryHeapTotalGauge=this.meter.createObservableGauge(jK,{description:XC[jK],unit:ZC[jK]}),this.memoryRssGauge=this.meter.createObservableGauge(VK,{description:XC[VK],unit:ZC[VK]}),this.memoryExternalGauge=this.meter.createObservableGauge($K,{description:XC[$K],unit:ZC[$K]}),this.memorySystemUsageGauge=this.meter.createObservableGauge(WK,{description:XC[WK],unit:ZC[WK]}),this.memoryProcessUsageGauge=this.meter.createObservableGauge(zK,{description:XC[zK],unit:ZC[zK]}),this.memoryHeapUsedGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.heapUsed,{platform:e,arch:r,node_version:n})}),this.memoryHeapTotalGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.heapTotal,{platform:e,arch:r,node_version:n})}),this.memoryRssGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.rss,{platform:e,arch:r,node_version:n})}),this.memoryExternalGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.external,{platform:e,arch:r,node_version:n})}),this.memorySystemUsageGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.systemUsage,{platform:e,arch:r,node_version:n})}),this.memoryProcessUsageGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.processUsage,{platform:e,arch:r,node_version:n,memory_limit_mb:Math.round(this.nodeJSMemoryLimit/(1024*1024)).toString()})}))}getNodeJSMemoryLimit(){let e=process.execArgv.find(i=>i.startsWith("--max-old-space-size="))?.split("=")[1];if(e){let i=parseInt(e,10);if(!isNaN(i)&&i>0)return i*1024*1024}let r=process.execArgv.find(i=>i.startsWith("--max_old_space_size="))?.split("=")[1];if(r){let i=parseInt(r,10);if(!isNaN(i)&&i>0)return i*1024*1024}let n=e5.arch();return n==="x64"||n==="arm64"?1400*1024*1024:700*1024*1024}}});function kNr(t,e={}){if(URe)return URe;let r={enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0,...e};return URe=new FRe(t,r),URe}var URe,PNr=Z(()=>{"use strict";ONr();URe=null});import*as YK from"os";import*as QRe from"fs";function Ph(t){let e="0.3.21",r=process.env.IFLOW_ENV||"normal",n={darwin:"macOS",win32:"Windows",linux:"Linux",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX"},i=YK.platform(),o=n[i]||i,s="unknown";try{if(i==="darwin")s=YK.release();else if(i==="linux")try{if(QRe.existsSync("/etc/os-release")){let p=QRe.readFileSync("/etc/os-release","utf8").match(/^PRETTY_NAME="(.+)"/m);p&&(s=p[1])}}catch{s=YK.release()}else i==="win32"&&(s=YK.release())}catch{s="unknown"}let a={name:"Node.js",version:process.version,architecture:process.arch},c=t.getModel()||"unknown",u=!1,d=t.getContentGeneratorConfig?.();if(d){let f=d.authType,p=d.baseUrl||"";(f===zt.LOGIN_WITH_IFLOW||f===zt.IFLOW||f===zt.OPENAI_COMPATIBLE&&p.includes("apis.iflow.cn"))&&(u=!0)}return{app_name:Z0,tenant__:"gen_ai",version:e,platform:o,os_model:s,runtime_name:a.name,runtime_version:a.version,runtime_architecture:a.architecture,model_name:c,is_iflow_open_user:String(u),ip:RNr(),iflow_env:r}}function MNr(){return Byt||(Byt=Wue.getMeter(Z0)),Byt}function LNr(){if(C2)return;let t=MNr();if(t){try{kNr(t,{enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0})}catch{}Nyt=t.createHistogram(fNr,{description:"Counts tool calls, tagged by function name and success.",unit:"count",valueType:Qu.INT}),Oyt=t.createHistogram(pNr,{description:"Latency of tool calls in milliseconds.",unit:"ms",valueType:Qu.INT}),kyt=t.createHistogram(hNr,{description:"Counts MCP tool calls, tagged by function name and success.",unit:"count",valueType:Qu.INT}),Pyt=t.createHistogram(mNr,{description:"Latency of MCP tool calls in milliseconds.",unit:"ms",valueType:Qu.INT}),Myt=t.createHistogram(gNr,{description:"Counts built-in tool calls, tagged by function name and success.",unit:"count",valueType:Qu.INT}),Lyt=t.createHistogram(ANr,{description:"Latency of built-in tool calls in milliseconds.",unit:"ms",valueType:Qu.INT}),ppe=t.createHistogram(yNr,{description:"Counts API requests, tagged by model and status.",unit:"count",valueType:Qu.INT}),hpe=t.createHistogram(ENr,{description:"Latency of API requests in milliseconds.",unit:"ms",valueType:Qu.INT}),Fyt=t.createHistogram(vNr,{description:"Counts the total number of tokens used.",unit:"tokens",valueType:Qu.INT}),Uyt=t.createHistogram(CNr,{description:"Counts file operations (create, read, update).",unit:"count",valueType:Qu.INT}),Qyt=t.createHistogram(_Nr,{description:"Counts user requests from prompt to completion.",unit:"count",valueType:Qu.INT}),qyt=t.createHistogram(xNr,{description:"End-to-end latency of user requests in milliseconds.",unit:"ms",valueType:Qu.INT}),Hyt=t.createHistogram(SNr,{description:"User experience success rate - counts successful user experiences including retries and fixes.",unit:"count",valueType:Qu.INT}),Gyt=t.createHistogram(wNr,{description:"User identity for tracking unique installations.",unit:"count",valueType:Qu.INT}),jyt=t.createHistogram(TNr,{description:"Counts tool scheduler lock errors when new calls are blocked by running calls.",unit:"count",valueType:Qu.INT}),Vyt=t.createHistogram(INr,{description:"Counts MCP connection attempts and their success/failure status.",unit:"count",valueType:Qu.INT}),$yt=t.createHistogram(DNr,{description:"Counts loop detection events by loop type.",unit:"count",valueType:Qu.INT}),C2=!0}}function qRe(t){let e=MNr();if(!e||!C2)return;e.createHistogram(bNr,{description:"Count of CLI sessions started.",unit:"count",valueType:Qu.INT}).record(1,Ph(t))}function FNr(t,e,r,n,i,o){if(!Nyt||!Oyt||!C2)return;let s={...Ph(t),function_name:e??"unknown",success:String(n),decision:i??"unknown"};Nyt.record(1,s),Oyt.record(r,{...Ph(t),function_name:e??"unknown",tool_type:o??"unknown"})}function UNr(t,e,r,n,i,o){if(!kyt||!Pyt||!C2)return;let s={...Ph(t),function_name:e??"unknown",success:String(n),decision:i??"unknown"};o&&(s.execution_context=o),kyt.record(1,s),Pyt.record(r,{...Ph(t),function_name:e??"unknown",execution_context:o??"unknown"})}function QNr(t,e,r,n,i,o){if(!Myt||!Lyt||!C2)return;let s={...Ph(t),function_name:e??"unknown",success:String(n),decision:i??"unknown"};o&&(s.execution_context=o),Myt.record(1,s),Lyt.record(r,{...Ph(t),function_name:e??"unknown",execution_context:o??"unknown"})}function KK(t,e,r,n){!Fyt||!C2||Fyt.record(r,{...Ph(t),model:e??"unknown",type:n??"unknown"})}function qNr(t,e,r,n,i,o,s,a){if(!ppe||!hpe||!C2)return;let c={...Ph(t),model:e??"unknown",status_code:String(n??(i?"error":"ok"))};s!==void 0&&(c.http_status_code=String(s)),a!==void 0&&(c.business_code=String(a)),o&&(c.finish_reason=o),ppe.record(1,c);let u={...Ph(t),model:e??"unknown",http_status_code:String(s??200),finish_reason:o??"unknown"};a!=null&&(u.business_code=String(a)),hpe.record(r,u)}function HNr(t,e,r,n,i,o,s){if(!ppe||!hpe||!C2)return;let a={...Ph(t),model:e??"unknown",status_code:String(n??"error"),error:i??"unknown"};o!==void 0&&(a.http_status_code=String(o)),s!==void 0&&(a.business_code=String(s)),ppe.record(1,a);let c={...Ph(t),model:e??"unknown",http_status_code:String(o??0),error:i??"unknown"};s!=null&&(c.business_code=String(s)),hpe.record(r,c)}function LF(t,e,r,n,i){if(!Uyt||!C2)return;let o={...Ph(t),operation:e};r!==void 0&&(o.lines=String(r)),n!==void 0&&(o.mimetype=n),i!==void 0&&(o.extension=i),Uyt.record(1,o)}function GNr(t,e,r,n,i){if(!Qyt||!qyt||!C2)return;let o={...Ph(t),prompt_id:e,success:String(n)};i&&(o.error=i),Qyt.record(1,o),qyt.record(r,o)}function Wyt(t,e,r=!1,n=!1,i){if(!Hyt||!C2)return;let o={...Ph(t),success:String(e),had_retries:String(r),had_fixes:String(n)};i&&(o.final_error=i),Hyt.record(1,o)}function jNr(t,e){if(!Gyt||!C2)return;let r={...Ph(t),user_id:e};Gyt.record(1,r)}function VNr(t,e,r){if(!jyt||!C2)return;let n={...Ph(t),running_calls_count:String(e)};r.forEach((i,o)=>{n[`call_${o}_name`]=i.name,n[`call_${o}_status`]=i.status}),jyt.record(1,n)}function zyt(t,e,r,n,i){if(!Vyt||!C2)return;let o={...Ph(t),server_name:e,success:String(r)};n&&(o.error_type=n),i&&(o.transport_type=i),Vyt.record(1,o)}function $Nr(t,e,r){if(!$yt||!C2)return;let n={...Ph(t),loop_type:e,prompt_id:r};$yt.record(1,n)}var mT,Byt,Nyt,Oyt,kyt,Pyt,Myt,Lyt,ppe,hpe,Fyt,Uyt,Qyt,qyt,Hyt,Gyt,jyt,Vyt,$yt,C2,Vv=Z(()=>{"use strict";Kt();BNr();fpe();rE();PNr();(function(t){t.CREATE="create",t.READ="read",t.UPDATE="update"})(mT||(mT={}));C2=!1});var Do,yn,Ro,Bo,Id=Z(()=>{"use strict";Do=class{name;displayName;description;icon;kind;parameterSchema;isOutputMarkdown;canUpdateOutput;aliases;constructor(e,r,n,i,o,s,a=!0,c=!1,u=[]){this.name=e,this.displayName=r,this.description=n,this.icon=i,this.kind=o,this.parameterSchema=s,this.isOutputMarkdown=a,this.canUpdateOutput=c,this.aliases=u}get schema(){return{name:this.name,description:this.description,parameters:this.parameterSchema}}validateToolParams(e){return null}getDescription(e){return JSON.stringify(e)}shouldConfirmExecute(e,r){return Promise.resolve(!1)}toolLocations(e){return[]}};(function(t){t.ProceedOnce="proceed_once",t.ProceedAlways="proceed_always",t.ProceedAlwaysServer="proceed_always_server",t.ProceedAlwaysTool="proceed_always_tool",t.ModifyWithEditor="modify_with_editor",t.Cancel="cancel"})(yn||(yn={}));(function(t){t.FileSearch="fileSearch",t.Folder="folder",t.Globe="globe",t.Hammer="hammer",t.LightBulb="lightBulb",t.Pencil="pencil",t.Regex="regex",t.Terminal="terminal"})(Ro||(Ro={}));(function(t){t.Read="read",t.Edit="edit",t.Delete="delete",t.Move="move",t.Search="search",t.Execute="execute",t.Think="think",t.Fetch="fetch",t.Other="other"})(Bo||(Bo={}))});function slo(t){switch(t){case yn.ProceedOnce:case yn.ProceedAlways:case yn.ProceedAlwaysServer:case yn.ProceedAlwaysTool:return $v.ACCEPT;case yn.ModifyWithEditor:return $v.MODIFY;case yn.Cancel:default:return $v.REJECT}}var $v,JK,XK,ZK,eJ,tJ,j1,rJ,nJ,Wv,iJ,HRe,oJ,GRe,gT=Z(()=>{"use strict";Id();rE();(function(t){t.ACCEPT="accept",t.REJECT="reject",t.MODIFY="modify"})($v||($v={}));JK=class{"event.name";"event.timestamp";model;embedding_model;sandbox_enabled;core_tools_enabled;approval_mode;api_key_enabled;vertex_ai_enabled;debug_enabled;mcp_servers;telemetry_enabled;telemetry_log_user_prompts_enabled;file_filtering_respect_git_ignore;constructor(e){let r=e.getContentGeneratorConfig(),n=e.getMcpServers(),i=!1,o=!1;r&&r.authType&&(i=r.authType===zt.IFLOW,o=r.authType===zt.AONE),this["event.name"]="cli_config",this.model=e.getModel(),this.embedding_model=e.getEmbeddingModel(),this.sandbox_enabled=typeof e.getSandbox()=="string"||!!e.getSandbox(),this.core_tools_enabled=(e.getCoreTools()??[]).join(","),this.approval_mode=e.getApprovalMode(),this.api_key_enabled=i||o,this.vertex_ai_enabled=o,this.debug_enabled=e.getDebugMode(),this.mcp_servers=n?Object.keys(n).join(","):"",this.telemetry_enabled=e.getTelemetryEnabled(),this.telemetry_log_user_prompts_enabled=e.getTelemetryLogPromptsEnabled(),this.file_filtering_respect_git_ignore=e.getFileFilteringRespectGitIgnore()}},XK=class{"event.name";"event.timestamp";session_id;constructor(e){this["event.name"]="end_session",this["event.timestamp"]=new Date().toISOString(),this.session_id=e?.getSessionId()}},ZK=class{"event.name";"event.timestamp";prompt_length;prompt_id;auth_type;prompt;constructor(e,r,n,i){this["event.name"]="user_prompt",this["event.timestamp"]=new Date().toISOString(),this.prompt_length=e,this.prompt_id=r,this.auth_type=n,this.prompt=i}},eJ=class{"event.name";"event.timestamp";function_name;function_args;duration_ms;success;decision;error;error_type;prompt_id;server_name;constructor(e){this["event.name"]="tool_call",this["event.timestamp"]=new Date().toISOString(),this.function_name=e.request.name,this.function_args=JSON.stringify(e.request.args),this.duration_ms=e.durationMs??0,this.success=e.status==="success",this.decision=e.outcome?slo(e.outcome):void 0,this.error=e.response.error?.message,this.error_type=e.response.errorType,this.prompt_id=e.request.prompt_id,"tool"in e&&e.tool&&"serverName"in e.tool&&(this.server_name=e.tool.serverName)}},tJ=class{"event.name";"event.timestamp";model;prompt_id;request_text;constructor(e,r,n){this["event.name"]="api_request",this["event.timestamp"]=new Date().toISOString(),this.model=e,this.prompt_id=r,this.request_text=n}},j1=class{"event.name";"event.timestamp";model;error;error_type;status_code;http_status_code;business_code;duration_ms;prompt_id;auth_type;constructor(e,r,n,i,o,s,a,c,u){this["event.name"]="api_error",this["event.timestamp"]=new Date().toISOString(),this.model=e,this.error=r,this.error_type=s,this.status_code=a,this.http_status_code=c,this.business_code=u,this.duration_ms=n,this.prompt_id=i,this.auth_type=o}},rJ=class{"event.name";"event.timestamp";model;status_code;http_status_code;business_code;duration_ms;error;input_token_count;output_token_count;cached_content_token_count;thoughts_token_count;tool_token_count;total_token_count;response_text;prompt_id;auth_type;finish_reason;constructor(e,r,n,i,o,s,a,c,u,d){this["event.name"]="api_response",this["event.timestamp"]=new Date().toISOString(),this.model=e,this.duration_ms=r,this.status_code=200,this.http_status_code=u||200,this.business_code=d,this.input_token_count=o?.promptTokenCount??0,this.output_token_count=o?.candidatesTokenCount??0,this.cached_content_token_count=o?.cachedContentTokenCount??0,this.thoughts_token_count=o?.thoughtsTokenCount??0,this.tool_token_count=o?.toolUsePromptTokenCount??0,this.total_token_count=o?.totalTokenCount??0,this.response_text=s,this.error=a,this.prompt_id=n,this.auth_type=i,this.finish_reason=c}},nJ=class{"event.name";"event.timestamp";auth_type;constructor(e){this["event.name"]="flash_fallback",this["event.timestamp"]=new Date().toISOString(),this.auth_type=e}};(function(t){t.CONSECUTIVE_IDENTICAL_TOOL_CALLS="consecutive_identical_tool_calls",t.CHANTING_IDENTICAL_SENTENCES="chanting_identical_sentences",t.LLM_DETECTED_LOOP="llm_detected_loop"})(Wv||(Wv={}));iJ=class{"event.name";"event.timestamp";loop_type;prompt_id;constructor(e,r){this["event.name"]="loop_detected",this["event.timestamp"]=new Date().toISOString(),this.loop_type=e,this.prompt_id=r}},HRe=class{"event.name";"event.timestamp";prompt_id;finish_reason;result;constructor(e,r,n){this["event.name"]="next_speaker_check",this["event.timestamp"]=new Date().toISOString(),this.prompt_id=e,this.finish_reason=r,this.result=n}},oJ=class{"event.name";"event.timestamp";command;subcommand;constructor(e,r){this["event.name"]="slash_command",this["event.timestamp"]=new Date().toISOString(),this.command=e,this.subcommand=r}},GRe=class{"event.name";"event.timestamp";model;constructor(e){this["event.name"]="malformed_json_response",this["event.timestamp"]=new Date().toISOString(),this.model=e}}});var hi,WNr=Z(()=>{"use strict";(function(t){t[t.IFLOW_CLI_KEY_UNKNOWN=0]="IFLOW_CLI_KEY_UNKNOWN",t[t.IFLOW_CLI_START_SESSION_MODEL=1]="IFLOW_CLI_START_SESSION_MODEL",t[t.IFLOW_CLI_START_SESSION_EMBEDDING_MODEL=2]="IFLOW_CLI_START_SESSION_EMBEDDING_MODEL",t[t.IFLOW_CLI_START_SESSION_SANDBOX=3]="IFLOW_CLI_START_SESSION_SANDBOX",t[t.IFLOW_CLI_START_SESSION_CORE_TOOLS=4]="IFLOW_CLI_START_SESSION_CORE_TOOLS",t[t.IFLOW_CLI_START_SESSION_APPROVAL_MODE=5]="IFLOW_CLI_START_SESSION_APPROVAL_MODE",t[t.IFLOW_CLI_START_SESSION_API_KEY_ENABLED=6]="IFLOW_CLI_START_SESSION_API_KEY_ENABLED",t[t.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED=7]="IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED",t[t.IFLOW_CLI_START_SESSION_DEBUG_MODE_ENABLED=8]="IFLOW_CLI_START_SESSION_DEBUG_MODE_ENABLED",t[t.IFLOW_CLI_START_SESSION_MCP_SERVERS=9]="IFLOW_CLI_START_SESSION_MCP_SERVERS",t[t.IFLOW_CLI_START_SESSION_TELEMETRY_ENABLED=10]="IFLOW_CLI_START_SESSION_TELEMETRY_ENABLED",t[t.IFLOW_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED=11]="IFLOW_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED",t[t.IFLOW_CLI_START_SESSION_RESPECT_GITIGNORE=12]="IFLOW_CLI_START_SESSION_RESPECT_GITIGNORE",t[t.IFLOW_CLI_USER_PROMPT_LENGTH=13]="IFLOW_CLI_USER_PROMPT_LENGTH",t[t.IFLOW_CLI_TOOL_CALL_NAME=14]="IFLOW_CLI_TOOL_CALL_NAME",t[t.IFLOW_CLI_TOOL_CALL_DECISION=15]="IFLOW_CLI_TOOL_CALL_DECISION",t[t.IFLOW_CLI_TOOL_CALL_SUCCESS=16]="IFLOW_CLI_TOOL_CALL_SUCCESS",t[t.IFLOW_CLI_TOOL_CALL_DURATION_MS=17]="IFLOW_CLI_TOOL_CALL_DURATION_MS",t[t.IFLOW_CLI_TOOL_ERROR_MESSAGE=18]="IFLOW_CLI_TOOL_ERROR_MESSAGE",t[t.IFLOW_CLI_TOOL_CALL_ERROR_TYPE=19]="IFLOW_CLI_TOOL_CALL_ERROR_TYPE",t[t.IFLOW_CLI_API_REQUEST_MODEL=20]="IFLOW_CLI_API_REQUEST_MODEL",t[t.IFLOW_CLI_API_RESPONSE_MODEL=21]="IFLOW_CLI_API_RESPONSE_MODEL",t[t.IFLOW_CLI_API_RESPONSE_STATUS_CODE=22]="IFLOW_CLI_API_RESPONSE_STATUS_CODE",t[t.IFLOW_CLI_API_RESPONSE_DURATION_MS=23]="IFLOW_CLI_API_RESPONSE_DURATION_MS",t[t.IFLOW_CLI_API_ERROR_MESSAGE=24]="IFLOW_CLI_API_ERROR_MESSAGE",t[t.IFLOW_CLI_API_RESPONSE_INPUT_TOKEN_COUNT=25]="IFLOW_CLI_API_RESPONSE_INPUT_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT=26]="IFLOW_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_CACHED_TOKEN_COUNT=27]="IFLOW_CLI_API_RESPONSE_CACHED_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_THINKING_TOKEN_COUNT=28]="IFLOW_CLI_API_RESPONSE_THINKING_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_TOOL_TOKEN_COUNT=29]="IFLOW_CLI_API_RESPONSE_TOOL_TOKEN_COUNT",t[t.IFLOW_CLI_API_ERROR_MODEL=30]="IFLOW_CLI_API_ERROR_MODEL",t[t.IFLOW_CLI_API_ERROR_TYPE=31]="IFLOW_CLI_API_ERROR_TYPE",t[t.IFLOW_CLI_API_ERROR_STATUS_CODE=32]="IFLOW_CLI_API_ERROR_STATUS_CODE",t[t.IFLOW_CLI_API_ERROR_DURATION_MS=33]="IFLOW_CLI_API_ERROR_DURATION_MS",t[t.IFLOW_CLI_END_SESSION_ID=34]="IFLOW_CLI_END_SESSION_ID",t[t.IFLOW_CLI_PROMPT_ID=35]="IFLOW_CLI_PROMPT_ID",t[t.IFLOW_CLI_AUTH_TYPE=36]="IFLOW_CLI_AUTH_TYPE",t[t.IFLOW_CLI_GOOGLE_ACCOUNTS_COUNT=37]="IFLOW_CLI_GOOGLE_ACCOUNTS_COUNT",t[t.IFLOW_CLI_SURFACE=39]="IFLOW_CLI_SURFACE",t[t.IFLOW_CLI_SESSION_ID=40]="IFLOW_CLI_SESSION_ID",t[t.IFLOW_CLI_LOOP_DETECTED_TYPE=38]="IFLOW_CLI_LOOP_DETECTED_TYPE",t[t.IFLOW_CLI_SLASH_COMMAND_NAME=41]="IFLOW_CLI_SLASH_COMMAND_NAME",t[t.IFLOW_CLI_SLASH_COMMAND_SUBCOMMAND=42]="IFLOW_CLI_SLASH_COMMAND_SUBCOMMAND",t[t.IFLOW_CLI_RESPONSE_FINISH_REASON=43]="IFLOW_CLI_RESPONSE_FINISH_REASON",t[t.IFLOW_CLI_NEXT_SPEAKER_CHECK_RESULT=44]="IFLOW_CLI_NEXT_SPEAKER_CHECK_RESULT",t[t.IFLOW_CLI_MALFORMED_JSON_RESPONSE_MODEL=45]="IFLOW_CLI_MALFORMED_JSON_RESPONSE_MODEL"})(hi||(hi={}))});function FF(t,e){let r=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof i=="object"&&i!==null){if(r.has(i))return"[Circular]";r.add(i)}return i},e)}var jRe=Z(()=>{"use strict";});import mS,{dirname as alo,join as Yyt}from"node:path";import VRe from"os";import*as zNr from"crypto";import{fileURLToPath as clo}from"node:url";import llo from"node:fs";function gS(t){let e=VRe.homedir();return t.startsWith(e)?t.replace(e,"~"):t}function Ac(t,e=35){if(t.length<=e)return t;let n=mS.parse(t).root,i=mS.sep,s=t.substring(n.length).split(i).filter(h=>h!=="");if(s.length<=1){let h=Math.floor((e-3)/2);if(h<=0)return t.substring(0,e-3)+"...";let m=t.substring(0,h),g=t.substring(t.length-h);return`${m}...${g}`}let a=s[0],c=s[s.length-1],u=n+a,d=[],f=i.length+c.length;for(let h=s.length-2;h>=0;h--){let m=s[h],g=f+i.length+m.length;if(g<=e)d.unshift(m),f=g;else break}let p=d.join(i)+i+c;return f>e?p:(p=u+i+p,p.length>e?"..."+p.substring(p.length-e-3):p)}function Dd(t,e){let r=mS.resolve(t),n=mS.resolve(e);return mS.relative(n,r)||"."}function sJ(t){let e="";for(let r=0;r<t.length;r++)t[r]===" "&&(r===0||t[r-1]!=="\\")?e+="\\ ":e+=t[r];return e}function AT(t){return t.replace(/\\(.)/g,"$1")}function $Re(t){return zNr.createHash("sha256").update(t).digest("hex")}function V1(t){let e=$Re(t);return mS.join(VRe.homedir(),Qm,ulo,e)}function WRe(){return mS.join(VRe.homedir(),Qm,YNr)}function zRe(t){return mS.join(t,Qm,YNr)}function YRe(){if(process.env.USE_BUILTIN_RIPGREP==="0")return"rg";let t=alo(clo(import.meta.url)),e=[Yyt(t,"..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`),Yyt(t,"..","..","..","..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`),Yyt(t,"..","..","..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`)];for(let r of e)try{if(llo.existsSync(r))return r}catch{}return e[0]}function mpe(t,e){let n=VRe.platform()==="win32"?mS.win32:mS,i=n.relative(t,e);return!i.startsWith(`..${n.sep}`)&&i!==".."&&!n.isAbsolute(i)}var Qm,Kyt,ulo,YNr,Rd=Z(()=>{"use strict";Qm=".iflow",Kyt="google_accounts.json",ulo="tmp",YNr="commands"});import dlo from"node:path";import{promises as UMa,existsSync as KNr,readFileSync as JNr}from"node:fs";import*as XNr from"os";function ZNr(){return dlo.join(XNr.homedir(),Qm,Kyt)}function eOr(){try{let t=ZNr();if(KNr(t)){let e=JNr(t,"utf-8").trim();return e?JSON.parse(e).active:null}return null}catch(t){return console.debug("Error reading cached Google Account:",t),null}}function tOr(){try{let t=ZNr();if(!KNr(t))return 0;let e=JNr(t,"utf-8").trim();if(!e)return 0;let r=JSON.parse(e),n=r.old.length;return r.active&&n++,n}catch(t){return console.debug("Error reading lifetime Google Accounts:",t),0}}var rOr=Z(()=>{"use strict";Rd();});import*as nOr from"os";import*as yT from"fs";import*as Zyt from"path";import{randomUUID as flo}from"crypto";function hlo(){yT.existsSync(Jyt)||yT.mkdirSync(Jyt,{recursive:!0})}function mlo(){return yT.existsSync(Xyt)&&yT.readFileSync(Xyt,"utf-8").trim()||null}function glo(t){yT.writeFileSync(Xyt,t,"utf-8")}function KRe(){try{hlo();let t=mlo();return t||(t=flo(),glo(t)),t}catch(t){return console.error("Error accessing installation ID file, generating ephemeral ID:",t),"123456789"}}var plo,Jyt,Xyt,eEt=Z(()=>{"use strict";Rd();plo=nOr.homedir()??"",Jyt=Zyt.join(plo,Qm),Xyt=Zyt.join(Jyt,"installation_id")});var iOr,Alo,ylo,Elo,vlo,blo,Clo,_lo,xlo,Slo,wlo,Tlo,Ilo,Mh,gpe=Z(()=>{"use strict";iOr=Te(Wct(),1);gT();WNr();jRe();rOr();eEt();Alo="start_session",ylo="new_prompt",Elo="tool_call",vlo="api_request",blo="api_response",Clo="api_error",_lo="end_session",xlo="flash_fallback",Slo="loop_detected",wlo="next_speaker_check",Tlo="slash_command",Ilo="malformed_json_response",Mh=class t{static instance;config;events=[];last_flush_time=Date.now();flush_interval_ms=1e3*60;constructor(e){this.config=e}static getInstance(e){if(!(e===void 0||!e?.getUsageStatisticsEnabled()))return t.instance||(t.instance=new t(e)),t.instance}enqueueLogEvent(e){this.events.push([{event_time_ms:Date.now(),source_extension_json:FF(e)}])}createLogEvent(e,r){let n=eOr(),i=tOr();r.push({iflow_cli_key:hi.IFLOW_CLI_GOOGLE_ACCOUNTS_COUNT,value:i.toString()});let o={console_type:"IFLOW_CLI",application:102,event_name:e,event_metadata:[r]};return n?o.client_email=n:o.client_install_id=KRe(),o}flushIfNeeded(){Date.now()-this.last_flush_time<this.flush_interval_ms||this.flushToClearcut().catch(e=>{console.debug("Error flushing to Clearcut:",e)})}async flushToClearcut(){return this.config?.getDebugMode()&&console.log("Telemetry disabled - not sending log events to Clearcut."),this.events.length=0,this.last_flush_time=Date.now(),Promise.resolve({})}decodeLogResponse(e){if(e.length<1||e.readUInt8(0)!==8)return;let r=BigInt(0),n=!0;for(let o=1;n&&o<e.length;o++){let s=e.readUInt8(o);r|=BigInt(s&127)<<BigInt(7*(o-1)),n=(s&128)!==0}return n?void 0:{nextRequestWaitMs:Number(r)}}logStartSessionEvent(e){let r=process.env.SURFACE||"SURFACE_NOT_SET",n=[{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_MODEL,value:e.model},{iflow_cli_key:hi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_EMBEDDING_MODEL,value:e.embedding_model},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_SANDBOX,value:e.sandbox_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_CORE_TOOLS,value:e.core_tools_enabled},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_APPROVAL_MODE,value:e.approval_mode},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_API_KEY_ENABLED,value:e.api_key_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_DEBUG_MODE_ENABLED,value:e.debug_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_MCP_SERVERS,value:e.mcp_servers},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_TELEMETRY_ENABLED,value:e.telemetry_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED,value:e.telemetry_log_user_prompts_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_SURFACE,value:r}];this.enqueueLogEvent(this.createLogEvent(Alo,n)),this.flushToClearcut().catch(i=>{console.debug("Error flushing to Clearcut:",i)})}logNewPromptEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_USER_PROMPT_LENGTH,value:JSON.stringify(e.prompt_length)},{iflow_cli_key:hi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.enqueueLogEvent(this.createLogEvent(ylo,r)),this.flushIfNeeded()}logToolCallEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_TOOL_CALL_NAME,value:JSON.stringify(e.function_name)},{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_TOOL_CALL_DECISION,value:JSON.stringify(e.decision)},{iflow_cli_key:hi.IFLOW_CLI_TOOL_CALL_SUCCESS,value:JSON.stringify(e.success)},{iflow_cli_key:hi.IFLOW_CLI_TOOL_CALL_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:hi.IFLOW_CLI_TOOL_ERROR_MESSAGE,value:JSON.stringify(e.error)},{iflow_cli_key:hi.IFLOW_CLI_TOOL_CALL_ERROR_TYPE,value:JSON.stringify(e.error_type)}],n=this.createLogEvent(Elo,r);this.enqueueLogEvent(n),this.flushIfNeeded()}logApiRequestEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_API_REQUEST_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)}];this.enqueueLogEvent(this.createLogEvent(vlo,r)),this.flushIfNeeded()}logApiResponseEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_STATUS_CODE,value:JSON.stringify(e.status_code)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:hi.IFLOW_CLI_API_ERROR_MESSAGE,value:JSON.stringify(e.error)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_INPUT_TOKEN_COUNT,value:JSON.stringify(e.input_token_count)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT,value:JSON.stringify(e.output_token_count)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_CACHED_TOKEN_COUNT,value:JSON.stringify(e.cached_content_token_count)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_THINKING_TOKEN_COUNT,value:JSON.stringify(e.thoughts_token_count)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_TOOL_TOKEN_COUNT,value:JSON.stringify(e.tool_token_count)},{iflow_cli_key:hi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.enqueueLogEvent(this.createLogEvent(blo,r)),this.flushIfNeeded()}logApiErrorEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_API_ERROR_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_API_ERROR_TYPE,value:JSON.stringify(e.error_type)},{iflow_cli_key:hi.IFLOW_CLI_API_ERROR_STATUS_CODE,value:JSON.stringify(e.status_code)},{iflow_cli_key:hi.IFLOW_CLI_API_ERROR_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:hi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.enqueueLogEvent(this.createLogEvent(Clo,r)),this.flushIfNeeded()}logFlashFallbackEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)},{iflow_cli_key:hi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.enqueueLogEvent(this.createLogEvent(xlo,r)),this.flushToClearcut().catch(n=>{console.debug("Error flushing to Clearcut:",n)})}logLoopDetectedEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_LOOP_DETECTED_TYPE,value:JSON.stringify(e.loop_type)}];this.enqueueLogEvent(this.createLogEvent(Slo,r)),this.flushIfNeeded()}logNextSpeakerCheck(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_RESPONSE_FINISH_REASON,value:JSON.stringify(e.finish_reason)},{iflow_cli_key:hi.IFLOW_CLI_NEXT_SPEAKER_CHECK_RESULT,value:JSON.stringify(e.result)},{iflow_cli_key:hi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.enqueueLogEvent(this.createLogEvent(wlo,r)),this.flushIfNeeded()}logSlashCommandEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_SLASH_COMMAND_NAME,value:JSON.stringify(e.command)}];e.subcommand&&r.push({iflow_cli_key:hi.IFLOW_CLI_SLASH_COMMAND_SUBCOMMAND,value:JSON.stringify(e.subcommand)}),this.enqueueLogEvent(this.createLogEvent(Tlo,r)),this.flushIfNeeded()}logMalformedJsonResponseEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_MALFORMED_JSON_RESPONSE_MODEL,value:JSON.stringify(e.model)}];this.enqueueLogEvent(this.createLogEvent(Ilo,r)),this.flushIfNeeded()}logEndSessionEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_SESSION_ID,value:e?.session_id?.toString()??""}];this.enqueueLogEvent(this.createLogEvent(_lo,r)),this.flushToClearcut().catch(n=>{console.debug("Error flushing to Clearcut:",n)})}getProxyAgent(){let e=this.config?.getProxy();if(e){if(e.startsWith("http"))return new iOr.HttpsProxyAgent(e);throw new Error("Unsupported proxy type")}}shutdown(){let e=new XK(this.config);this.logEndSessionEvent(e)}}});import*as oOr from"node:fs";var UF,sOr,Ape,JRe,XRe,ZRe,aOr=Z(()=>{"use strict";UF=Te(oi(),1),sOr=Te(Dx(),1);Ape=class{writeStream;constructor(e){this.writeStream=oOr.createWriteStream(e,{flags:"a"})}serialize(e){let r=new WeakSet;return JSON.stringify(e,(i,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[Circular]";r.add(o)}return o},2)+`
|
|
448
448
|
`}shutdown(){return new Promise(e=>{this.writeStream.end(e)})}},JRe=class extends Ape{export(e,r){let n=e.map(i=>this.serialize(i)).join("");this.writeStream.write(n,i=>{r({code:i?UF.ExportResultCode.FAILED:UF.ExportResultCode.SUCCESS,error:i||void 0})})}},XRe=class extends Ape{export(e,r){let n=e.map(i=>this.serialize(i)).join("");this.writeStream.write(n,i=>{r({code:i?UF.ExportResultCode.FAILED:UF.ExportResultCode.SUCCESS,error:i||void 0})})}},ZRe=class extends Ape{export(e,r){let n=this.serialize(e);this.writeStream.write(n,i=>{r({code:i?UF.ExportResultCode.FAILED:UF.ExportResultCode.SUCCESS,error:i||void 0})})}getPreferredAggregationTemporality(){return sOr.AggregationTemporality.CUMULATIVE}async forceFlush(){return Promise.resolve()}}});function $1(){return aJ}function Dlo(t){if(!t)return;let e=t.replace(/^["']|["']$/g,"");try{let r=new URL(e),i=r.port==="4318"||r.protocol==="http:"||r.protocol==="https:"?"http":"grpc";return{url:i==="grpc"?r.origin:e,protocol:i}}catch(r){xf.error("Invalid OTLP endpoint URL provided:",e,r);return}}function rBe(t){if(aJ)return;let e=(0,tBe.defaultResource)().merge((0,tBe.resourceFromAttributes)({[Zdt]:Z0,[eft]:process.version,"session.id":t.getSessionId()})),r=t.getTelemetryOtlpEndpoint(),n=Dlo(r),i=!!n,o=t.getTelemetryOutfile(),s;i?s=new cOr.OTLPTraceExporter({url:`${n.url}/v1/traces`}):s=o?new JRe(o):null;let a;i&&n?a=new uOr.OTLPLogExporter({url:`${n.url}/v1/logs`}):o?a=new XRe(o):a=null;let c;i?c=new zIe({exporter:new lOr.OTLPMetricExporter({url:`${n.url}/v1/metrics`}),exportIntervalMillis:2e4}):c=o?new hOr.PeriodicExportingMetricReader({exporter:new ZRe(o),exportIntervalMillis:1e4}):null;let u={resource:e,serviceName:Z0,logRecordProcessors:[],spanProcessors:[],metricReaders:[]};s&&u.spanProcessors.push(new fOr.BatchSpanProcessor(s,{exportTimeoutMillis:1e4})),a&&u.logRecordProcessors.push(new pOr.BatchLogRecordProcessor(a,{exportTimeoutMillis:1e4})),c&&u.metricReaders.push(c),eBe=new dOr.NodeSDK({...u});try{eBe.start(),aJ=!0,LNr()}catch(d){console.error("Error starting OpenTelemetry SDK:",d)}process.on("SIGTERM",cJ),process.on("SIGINT",cJ)}async function mOr(){if(aJ)try{let{trace:t}=await Promise.resolve().then(()=>(Kt(),ar)),e=t.getTracerProvider();"forceFlush"in e&&await e.forceFlush();let{metrics:r}=await Promise.resolve().then(()=>(Kt(),ar)),n=r.getMeterProvider();"forceFlush"in n&&await n.forceFlush()}catch(t){process.env.DEBUG&&console.error("Error flushing telemetry:",t)}}async function cJ(){if(!(!aJ||!eBe))try{Mh.getInstance()?.shutdown(),await eBe.shutdown()}catch(t){console.error("Error shutting down SDK:",t)}finally{aJ=!1}}var cOr,lOr,uOr,dOr,tBe,fOr,pOr,hOr,eBe,aJ,nBe=Z(()=>{"use strict";Kt();cOr=Te(lht(),1),lOr=Te(mht(),1),uOr=Te(Aht(),1),dOr=Te($Ir(),1);zIr();Nh();tBe=Te(V3t(),1),fOr=Te(_9e(),1),pOr=Te(oNr(),1),hOr=Te(Dx(),1);fpe();Vv();gpe();aOr();process.env.DEBUG?xf.setLogger(new que,$p.DEBUG):xf.setLogger(new que,$p.NONE);aJ=!1});var gOr={};Ys(gOr,{TraceContext:()=>ET});var ET,tEt=Z(()=>{"use strict";Kt();nBe();ET=class{static rootSpan=null;static tracer=F1.getTracer("iflow-cli-tracer");static spanLock=null;static startRootSpan(e="iflow_cli_request",r=!1){return this.rootSpan&&r&&(this.rootSpan.end(),this.rootSpan=null),this.rootSpan||(this.rootSpan=this.tracer.startSpan(e)),this.rootSpan}static async withRootSpan(e,r){let n=r?this.startRootSpan(r):this.getRootSpan();return n?a2.with(F1.setSpan(a2.active(),n),async()=>{try{return await e()}catch(i){throw n.recordException(i),n.setStatus({code:Cv.ERROR,message:i.message}),i}}):e()}static startChildSpan(e){return this.tracer.startSpan(e)}static async withChildSpan(e,r,n){let i=this.startChildSpan(e);return n&&i.setAttributes(n),a2.with(F1.setSpan(a2.active(),i),async()=>{try{let o=await r();return i.setStatus({code:Cv.OK}),o}catch(o){throw i.recordException(o),i.setStatus({code:Cv.ERROR,message:o.message}),o}finally{i.end()}})}static getRootSpan(){return this.rootSpan}static async endRootSpan(){this.spanLock&&await this.spanLock,this.spanLock=(async()=>{if(this.rootSpan){let e=this.rootSpan;this.rootSpan=null,e.end();try{await mOr()}catch{}}})(),await this.spanLock,this.spanLock=null}static getActiveSpan(){return F1.getActiveSpan()}static setSpanAttributes(e){let r=this.getActiveSpan();r&&r.setAttributes(e)}static addSpanEvent(e,r){let n=this.getActiveSpan();n&&n.addEvent(e,r)}}});function ype(){let t=F1.getActiveSpan();if(t){let r=t.spanContext();if(r&&r.traceId&&r.spanId){let i=r.traceId,o=r.spanId,s=(r.traceFlags||0).toString(16).padStart(2,"0");return`00-${i}-${o}-${s}`}}return HF.getCurrentSession()?.traceparent}function Epe(t){let e=ype();return e?{...t,traceparent:e}:t}function rEt(){return ype()}async function QF(t,e,r){let n=F1.getTracer("iflow-cli"),{TraceContext:i}=await Promise.resolve().then(()=>(tEt(),gOr)),o=i.getRootSpan(),s;if(o){let a=F1.setSpan(a2.active(),o);s=a2.with(a,()=>n.startSpan(t,{attributes:e}))}else s=n.startSpan(t,{attributes:e});try{return await a2.with(F1.setSpan(a2.active(),s),r)}catch(a){throw s.recordException(a),s.setStatus({code:Cv.ERROR,message:a instanceof Error?a.message:"Unknown error"}),a}finally{s.end()}}var qF=Z(()=>{"use strict";Kt();iBe();});var oBe,HF,iBe=Z(()=>{"use strict";gdt();Adt();qF();oBe=class{currentSession=null;async startSession(e,r,n,i){let{model:o,tool:s}=i||{},a="iflow",c="cli",u=P_e(),d=Rz(),f=`${a}.${c}.${n}.${u}`,p=R0r(u,d),h=Date.now();this.currentSession={traceId:u,parent_observation_id:d,conversationId:n,sessionId:e,userId:r,pid:a,sceneId:c,sam:f,traceparent:p,startTime:h,model:o,tool:s};let m={gmkey:"AI",gokey:this.stringifyGokey({pid:a,sam:f,trace_id:u,observation_id:d,model:o,tool:s,sessionId:e,user_id:r})};return await Mue("/aitrack.lifecycle.run_started",m),this.currentSession}async endSession(){if(!this.currentSession)return;let{pid:e,sam:r,traceId:n,parent_observation_id:i,model:o,tool:s,sessionId:a,userId:c,startTime:u}=this.currentSession,d=Date.now()-u,f=Rz(),p={gmkey:"AI",gokey:this.stringifyGokey({pid:e,sam:r,trace_id:n,observation_id:f,parent_observation_id:i,duration:d,model:o,tool:s,sessionId:a,user_id:c})};await Mue("/aitrack.lifecycle.run_finished",p),this.currentSession=null}async recordError(e){if(!this.currentSession)throw new Error("No active session to record error");let{pid:r,sam:n,traceId:i,parent_observation_id:o,model:s,tool:a,sessionId:c,userId:u}=this.currentSession,d=Rz(),f="",p="";e instanceof Error?(f=e.cause?`${e.message}:${e.cause.message}`:e.message,p=e.cause?e.cause.stack||"":e.stack||""):f=String(e);let h=ype(),m=i;if(h){let A=h.split("-");A.length>=2&&(m=A[1])}let g={gmkey:"AI",gokey:this.stringifyGokey({pid:r,sam:n,trace_id:m,observation_id:d,parent_observation_id:o,error_msg:`${f}
|
|
449
|
-
${p.slice(0,500)}`,model:s,tool:a,sessionId:c,cliVer:"0.3.21
|
|
449
|
+
${p.slice(0,500)}`,model:s,tool:a,sessionId:c,cliVer:"0.3.21",user_id:u})};await Mue("/aitrack.lifecycle.run_error",g)}getCurrentSession(){return this.currentSession}stringifyGokey(e){return Object.entries(e).map(([r,n])=>`${encodeURIComponent(r)}=${encodeURIComponent(String(n))}`).join("&")}},HF=new oBe});var AOr=w((mLa,Rlo)=>{Rlo.exports={name:"systeminformation",version:"5.27.11",description:"Advanced, lightweight system and OS information library",license:"MIT",author:"Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",homepage:"https://systeminformation.io",main:"./lib/index.js",type:"commonjs",bin:{systeminformation:"lib/cli.js"},types:"./lib/index.d.ts",scripts:{test:"node ./test/test.js",testDeno:"deno run -A ./test/test.js"},files:["lib/"],keywords:["system information","sysinfo","monitor","monitoring","os","linux","osx","windows","freebsd","openbsd","netbsd","cpu","cpuload","physical cores","logical cores","processor","cores","threads","socket type","memory","file system","fsstats","diskio","block devices","netstats","network","network interfaces","network connections","network stats","iface","printer","processes","users","internet","battery","docker","docker stats","docker processes","graphics","graphic card","graphic controller","gpu","display","smart","disk layout","usb","audio","bluetooth","wifi","wifinetworks","virtual box","virtualbox","vm","backend","hardware","BIOS","chassis"],repository:{type:"git",url:"git+https://github.com/sebhildebrandt/systeminformation.git"},funding:{type:"Buy me a coffee",url:"https://www.buymeacoffee.com/systeminfo"},os:["darwin","linux","win32","freebsd","openbsd","netbsd","sunos","android"],engines:{node:">=8.0.0"}}});var Xp=w(Di=>{"use strict";var uJ=Ae("os"),n5=Ae("fs"),Blo=Ae("path"),lEt=Ae("child_process").spawn,Nlo=Ae("child_process").exec,dJ=Ae("child_process").execSync,Olo=Ae("util"),jF=process.platform,uEt=jF==="linux"||jF==="android",vOr=jF==="darwin",lBe=jF==="win32",bOr=jF==="freebsd",COr=jF==="openbsd",_Or=jF==="netbsd",nEt=0,GF="",t5="",pB=null,r5=null,dEt=process.env.WINDIR||"C:\\Windows",Lh,lJ="",vpe=[],fEt=!1,aBe="",klo="$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 ; ",oEt="--###START###--",yOr="--ERROR--",cBe="--###ENDCMD###--",sEt="--##ID##--",bpe={windowsHide:!0,maxBuffer:1024*2e4,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})},uBe={maxBuffer:1024*2e4,encoding:"UTF-8",stdio:["pipe","pipe","ignore"]};function Plo(t){let e=parseInt(t,10);return isNaN(e)&&(e=0),e}function Mlo(t){let e=!1,r="",n="";for(let i of t)i>="0"&&i<="9"||e?(e=!0,r+=i):n+=i;return[n,r]}var sBe=new String,aEt=new String().replace,cEt=new String().toLowerCase,xOr=new String().toString,SOr=new String().substr,wOr=new String().substring,TOr=new String().trim,IOr=new String().startsWith,DOr=Math.min;function Llo(t){return t&&{}.toString.call(t)==="[object Function]"}function Flo(t){let e=[],r={};for(let n=0;n<t.length;n++){let i=Object.keys(t[n]);i.sort(function(s,a){return s-a});let o="";for(let s=0;s<i.length;s++)o+=JSON.stringify(i[s]),o+=JSON.stringify(t[n][i[s]]);({}).hasOwnProperty.call(r,o)||(e.push(t[n]),r[o]=!0)}return e}function Ulo(t,e){return t.sort(function(r,n){let i="",o="";return e.forEach(function(s){i=i+r[s],o=o+n[s]}),i<o?-1:i>o?1:0})}function Qlo(){return nEt===0&&(nEt=uJ.cpus().length),nEt}function hB(t,e,r,n,i){r=r||":",e=e.toLowerCase(),n=n||!1,i=i||!1;let o="";return t.some(s=>{let a=s.toLowerCase().replace(/\t/g,"");if(n&&(a=a.trim()),a.startsWith(e)&&(!i||a.match(e+r)||a.match(e+" "+r))){let c=n?s.trim().split(r):s.split(r);if(c.length>=2)return c.shift(),o=c.join(r).trim(),!0}}),o}function qlo(t,e){return e=e||16,t.replace(/\\x([0-9A-Fa-f]{2})/g,function(){return String.fromCharCode(parseInt(arguments[1],e))})}function Hlo(t){let e="",r=0;return t.split("").forEach(n=>{n>="0"&&n<="9"?r===1&&r++:(r===0&&r++,r===1&&(e+=n))}),e}function Glo(t,e){e=e||"",t=t.toUpperCase();let r=0,n=0,i=Hlo(t),o=t.split(i);if(o.length>=2){o[2]&&(o[1]+=o[2]);let s=o[1]&&o[1].toLowerCase().indexOf("pm")>-1||o[1].toLowerCase().indexOf("p.m.")>-1||o[1].toLowerCase().indexOf("p. m.")>-1||o[1].toLowerCase().indexOf("n")>-1||o[1].toLowerCase().indexOf("ch")>-1||o[1].toLowerCase().indexOf("\xF6s")>-1||e&&o[1].toLowerCase().indexOf(e)>-1;return r=parseInt(o[0],10),n=parseInt(o[1],10),r=s&&r<12?r+12:r,("0"+r).substr(-2)+":"+("0"+n).substr(-2)}}function jlo(t,e){let r={date:"",time:""};e=e||{};let n=(e.dateFormat||"").toLowerCase(),i=e.pmDesignator||"",o=t.split(" ");if(o[0]){if(o[0].indexOf("/")>=0){let s=o[0].split("/");s.length===3&&(s[0].length===4?r.date=s[0]+"-"+("0"+s[1]).substr(-2)+"-"+("0"+s[2]).substr(-2):s[2].length===2?(n.indexOf("/d/")>-1||n.indexOf("/dd/")>-1,r.date="20"+s[2]+"-"+("0"+s[1]).substr(-2)+"-"+("0"+s[0]).substr(-2)):(t.toLowerCase().indexOf("pm")>-1||t.toLowerCase().indexOf("p.m.")>-1||t.toLowerCase().indexOf("p. m.")>-1||t.toLowerCase().indexOf("am")>-1||t.toLowerCase().indexOf("a.m.")>-1||t.toLowerCase().indexOf("a. m.")>-1||n.indexOf("/d/")>-1||n.indexOf("/dd/")>-1)&&n.indexOf("dd/")!==0?r.date=s[2]+"-"+("0"+s[0]).substr(-2)+"-"+("0"+s[1]).substr(-2):r.date=s[2]+"-"+("0"+s[1]).substr(-2)+"-"+("0"+s[0]).substr(-2))}if(o[0].indexOf(".")>=0){let s=o[0].split(".");s.length===3&&(n.indexOf(".d.")>-1||n.indexOf(".dd.")>-1?r.date=s[2]+"-"+("0"+s[0]).substr(-2)+"-"+("0"+s[1]).substr(-2):r.date=s[2]+"-"+("0"+s[1]).substr(-2)+"-"+("0"+s[0]).substr(-2))}if(o[0].indexOf("-")>=0){let s=o[0].split("-");s.length===3&&(r.date=s[0]+"-"+("0"+s[1]).substr(-2)+"-"+("0"+s[2]).substr(-2))}}if(o[1]){o.shift();let s=o.join(" ");r.time=Glo(s,i)}return r}function Vlo(t,e){let r=e>0,n=1,i=0,o=0,s=[];for(let c=0;c<t.length;c++)n<=e?(/\s/.test(t[c])&&!r&&(o=c-1,s.push({from:i,to:o+1,cap:t.substring(i,o+1)}),i=o+2,n++),r=t[c]===" "):(!/\s/.test(t[c])&&r&&(o=c-1,i<o&&s.push({from:i,to:o,cap:t.substring(i,o)}),i=o+1,n++),r=t[c]===" ");o=5e3,s.push({from:i,to:o,cap:t.substring(i,o)});let a=s.length;for(let c=0;c<a;c++)s[c].cap.replace(/\s/g,"").length===0&&c+1<a&&(s[c].to=s[c+1].to,s[c].cap=s[c].cap+s[c+1].cap,s.splice(c+1,1),a=a-1);return s}function $lo(t,e,r){for(let n=0;n<t.length;n++)if(t[n][e]===r)return n;return-1}function Wlo(){if(aBe="powershell.exe",lBe){let t=`${dEt}\\system32\\WindowsPowerShell\\v1.0\\powershell.exe`;n5.existsSync(t)&&(aBe=t)}}function ROr(){if(uJ.type()==="Windows_NT"&&!GF&&(GF=dEt+"\\system32\\wbem\\wmic.exe",!n5.existsSync(GF)))try{let t=dJ("WHERE WMIC",bpe).toString().split(`\r
|
|
450
450
|
`);t&&t.length?GF=t[0]:GF="wmic"}catch{GF="wmic"}return GF}function zlo(t){return new Promise(e=>{process.nextTick(()=>{try{BOr(ROr()+" "+t).then(r=>{e(r,"")})}catch(r){e("",r)}})})}function Ylo(){return lBe?`"${process.env.VBOX_INSTALL_PATH||process.env.VBOX_MSI_INSTALL_PATH}\\VBoxManage.exe"`:"vboxmanage"}function iEt(t){let e="",r,n="";if(t.indexOf(oEt)>=0){r=t.split(oEt);let o=r[1].split(sEt);e=o[0],o.length>1&&(t=o.slice(1).join(sEt))}t.indexOf(cBe)>=0&&(r=t.split(cBe),n=r[0]);let i=-1;for(let o=0;o<vpe.length;o++)vpe[o].id===e&&(i=o,vpe[o].callback(n));i>=0&&vpe.splice(i,1)}function Klo(){Lh||(Lh=lEt(aBe,["-NoProfile","-NoLogo","-InputFormat","Text","-NoExit","-Command","-"],{stdio:"pipe",windowsHide:!0,maxBuffer:1024*2e4,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})}),Lh&&Lh.pid&&(fEt=!0,Lh.stdout.on("data",function(t){lJ=lJ+t.toString("utf8"),t.indexOf(cBe)>=0&&(iEt(lJ),lJ="")}),Lh.stderr.on("data",function(){iEt(lJ+yOr)}),Lh.on("error",function(){iEt(lJ+yOr)}),Lh.on("close",function(){Lh&&Lh.kill()})))}function Jlo(){try{Lh&&(Lh.stdin.write("exit"+uJ.EOL),Lh.stdin.end(),fEt=!1)}catch{Lh&&Lh.kill()}Lh=null}function BOr(t){if(fEt){let e=Math.random().toString(36).substring(2,12);return new Promise(r=>{process.nextTick(()=>{function n(i){r(i)}vpe.push({id:e,cmd:t,callback:n,start:new Date});try{Lh&&Lh.pid&&Lh.stdin.write(klo+"echo "+oEt+e+sEt+"; "+uJ.EOL+t+uJ.EOL+"echo "+cBe+uJ.EOL)}catch{r("")}})})}else{let e="";return new Promise(r=>{process.nextTick(()=>{try{let n=lEt(aBe,["-NoProfile","-NoLogo","-InputFormat","Text","-ExecutionPolicy","Unrestricted","-Command",t],{stdio:"pipe",windowsHide:!0,maxBuffer:2048e4,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})});n&&!n.pid&&n.on("error",function(){r(e)}),n&&n.pid?(n.stdout.on("data",function(i){e=e+i.toString("utf8")}),n.stderr.on("data",function(){n.kill(),r(e)}),n.on("close",function(){n.kill(),r(e)}),n.on("error",function(){n.kill(),r(e)})):r(e)}catch{r(e)}})})}}function Xlo(t,e,r){let n="";return r=r||{},new Promise(i=>{process.nextTick(()=>{try{let o=lEt(t,e,r);o&&!o.pid&&o.on("error",function(){i(n)}),o&&o.pid?(o.stdout.on("data",function(s){n+=s.toString()}),o.on("close",function(){o.kill(),i(n)}),o.on("error",function(){o.kill(),i(n)})):i(n)}catch{i(n)}})})}function Zlo(){if(lBe){if(!t5)try{let r=dJ("chcp",bpe).toString().split(`\r
|
|
451
451
|
`)[0].split(":");t5=r.length>1?r[1].replace(".","").trim():""}catch{t5="437"}return t5}if(uEt||vOr||bOr||COr||_Or){if(!t5)try{let r=dJ("echo $LANG",uBe).toString().split(`\r
|
|
452
452
|
`)[0].split(".");t5=r.length>1?r[1].trim():"",t5||(t5="UTF-8")}catch{t5="UTF-8"}return t5}}function euo(){if(pB!==null)return pB;if(pB=!1,lBe)try{let t=dJ("WHERE smartctl 2>nul",bpe).toString().split(`\r
|
|
@@ -909,7 +909,7 @@ Otherwise navigate to:
|
|
|
909
909
|
|
|
910
910
|
${e}
|
|
911
911
|
|
|
912
|
-
`);try{(await o2(e)).on("error",o=>{throw new Error(`BROWSER_LAUNCH_FAILED: Failed to open browser automatically: ${o.message}. Please navigate to the URL manually.`)})}catch(i){throw new Error(`BROWSER_LAUNCH_FAILED: An unexpected error occurred while trying to open the browser: ${i}. Please navigate to the URL manually.`)}console.log("Waiting for authentication...");let n=0;for(;n<r.maxRetries;){await KPr(r.pollInterval);let i=await JPr(t,r);if(i.isSuccess()){let o=i.getPrivateToken();return await TT.savePrivateToken(o),console.log("Aone authentication successful!"),!0}i.getError()&&console.log(`Waiting for authentication... (${n+1}/${r.maxRetries})`),n++}throw new Error("Authentication timeout. Please try again.")}async function cNe(t=new LJ){return await TT.hasValidToken()?(console.log("Using cached Aone authentication."),!0):await XPr(t)}async function _S(){return await TT.loadPrivateToken()}async function lNe(){await TT.clearPrivateToken(),console.log("Aone authentication cleared.")}async function Pho(){return await TT.hasValidToken()}async function Mho(t=new LJ){return await lNe(),await cNe(t)}var uNe=Z(()=>{"use strict";h4t();G9();WPr();zPr();YPr();});async function m4t(t,e,r,n){if(e===zt.LOGIN_WITH_IFLOW){let i=await EL(e,r),o=await RC();if(!o)throw new Error("No API key found. Please re-authenticate.");let s=r.getContentGeneratorConfig();return new eU({model:r.getModel(),apiKey:o,baseUrl:s?.baseUrl||Wpe,authType:e,debugMode:r.getDebugMode(),multimodalModelName:"qwen3-vl-plus",config:r})}if(e===zt.LOGIN_WITH_AONE){if(!await cNe())throw new Error("Aone authentication failed. Please try again.");let o=await _S();if(!o)throw new Error("No Aone private token found. Please re-authenticate.");let s=r.getContentGeneratorConfig(),a=Buffer.from(o,"utf8").toString("base64");return new eU({model:r.getModel(),apiKey:a,baseUrl:s?.baseUrl||"https://ducky.code.alibaba-inc.com/v1/openai",authType:e,debugMode:r.getDebugMode(),multimodalModelName:s?.multimodalModelName,config:r})}if(e===zt.CLOUD_SHELL){let i=await EL(e,r),o=await T0r(i);return new V9(i,o.projectId,t,n,o.userTier)}throw new Error(`Unsupported authType: ${e}`)}var g4t=Z(()=>{"use strict";rE();_R();I0r();O_e();a4t();a5();uNe();});function Lho(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function xS(t){let e=Lho(t),r=`IFLOW_${t}`;if(process.env[r])return process.env[r];let n=`IFLOW_${e}`;if(process.env[n])return process.env[n];let i=`iflow_${t}`;if(process.env[i])return process.env[i];let o=`iflow_${e}`;if(process.env[o])return process.env[o]}function Jpe(){return xS("apiKey")}function Xpe(){return xS("baseUrl")||xS("url")}function Zpe(){return xS("modelName")||xS("model")}function ZPr(t){let e=xS(t);if(e===void 0)return;let r=e.toLowerCase();if(r==="true"||r==="1"||r==="yes")return!0;if(r==="false"||r==="0"||r==="no")return!1}function eMr(t){let e=xS(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function tMr(t){let e=xS(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function dNe(){return!!(Jpe()||Xpe()||Zpe())}function A4t(){let t={},e=["theme","selectedAuthType","sandbox","toolDiscoveryCommand","toolCallCommand","mcpServerCommand","contextFileName","preferredEditor","apiKey","baseUrl","modelName","searchApiKey","multimodalModelName","memoryImportFormat"],r=["useExternalAuth","showMemoryUsage","usageStatisticsEnabled","autoConfigureMaxOldSpaceSize","hideWindowTitle","hideTips","hideBanner","vimMode","ideModeFeature","ideMode","disableAutoUpdate","skipNextSpeakerCheck","useRipgrep","debugKeystrokeLogging","pasteFromClipboard"],n=["maxSessionTurns","memoryDiscoveryMaxDirs","tokensLimit","compressionTokenThreshold","shellTimeout","temperature","topP"],i=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(o=>{let s=xS(o);s!==void 0&&(t[o]=s)}),r.forEach(o=>{let s=ZPr(o);s!==void 0&&(t[o]=s)}),n.forEach(o=>{let s=eMr(o);s!==void 0&&(t[o]=s)}),i.forEach(o=>{let s=tMr(o);s!==void 0&&(t[o]=s)}),t}function Fho(){return{apiKey:Jpe(),baseUrl:Xpe(),model:Zpe()}}var y4t=Z(()=>{"use strict";});async function E4t(t,e,r){await Tz()&&(await B_e()||console.log("OAuth2 credentials cleared due to expiration. Please authenticate when prompted."));let i=Jpe(),o=Xpe(),s=Zpe(),a=r?.apiKey||i,c=r?.baseUrl||o||Uho[e],u=r?.modelName||t.getModel()||s||AE,d={model:u,authType:e,proxy:t?.getProxy(),debugMode:t?.getDebugMode(),config:t};return e===zt.CLOUD_SHELL?d:e===zt.LOGIN_WITH_IFLOW?(d.baseUrl=c||Wpe,d.multimodalModelName="qwen3-vl-plus",a&&(d.apiKey=a),d):([...yE,zt.OPENAI_COMPATIBLE].includes(e)&&a&&(d.apiKey=a,d.baseUrl=c,d.model=u),d)}async function v4t(t,e,r){let i={headers:{"User-Agent":`iFlowCLI/0.3.21
|
|
912
|
+
`);try{(await o2(e)).on("error",o=>{throw new Error(`BROWSER_LAUNCH_FAILED: Failed to open browser automatically: ${o.message}. Please navigate to the URL manually.`)})}catch(i){throw new Error(`BROWSER_LAUNCH_FAILED: An unexpected error occurred while trying to open the browser: ${i}. Please navigate to the URL manually.`)}console.log("Waiting for authentication...");let n=0;for(;n<r.maxRetries;){await KPr(r.pollInterval);let i=await JPr(t,r);if(i.isSuccess()){let o=i.getPrivateToken();return await TT.savePrivateToken(o),console.log("Aone authentication successful!"),!0}i.getError()&&console.log(`Waiting for authentication... (${n+1}/${r.maxRetries})`),n++}throw new Error("Authentication timeout. Please try again.")}async function cNe(t=new LJ){return await TT.hasValidToken()?(console.log("Using cached Aone authentication."),!0):await XPr(t)}async function _S(){return await TT.loadPrivateToken()}async function lNe(){await TT.clearPrivateToken(),console.log("Aone authentication cleared.")}async function Pho(){return await TT.hasValidToken()}async function Mho(t=new LJ){return await lNe(),await cNe(t)}var uNe=Z(()=>{"use strict";h4t();G9();WPr();zPr();YPr();});async function m4t(t,e,r,n){if(e===zt.LOGIN_WITH_IFLOW){let i=await EL(e,r),o=await RC();if(!o)throw new Error("No API key found. Please re-authenticate.");let s=r.getContentGeneratorConfig();return new eU({model:r.getModel(),apiKey:o,baseUrl:s?.baseUrl||Wpe,authType:e,debugMode:r.getDebugMode(),multimodalModelName:"qwen3-vl-plus",config:r})}if(e===zt.LOGIN_WITH_AONE){if(!await cNe())throw new Error("Aone authentication failed. Please try again.");let o=await _S();if(!o)throw new Error("No Aone private token found. Please re-authenticate.");let s=r.getContentGeneratorConfig(),a=Buffer.from(o,"utf8").toString("base64");return new eU({model:r.getModel(),apiKey:a,baseUrl:s?.baseUrl||"https://ducky.code.alibaba-inc.com/v1/openai",authType:e,debugMode:r.getDebugMode(),multimodalModelName:s?.multimodalModelName,config:r})}if(e===zt.CLOUD_SHELL){let i=await EL(e,r),o=await T0r(i);return new V9(i,o.projectId,t,n,o.userTier)}throw new Error(`Unsupported authType: ${e}`)}var g4t=Z(()=>{"use strict";rE();_R();I0r();O_e();a4t();a5();uNe();});function Lho(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function xS(t){let e=Lho(t),r=`IFLOW_${t}`;if(process.env[r])return process.env[r];let n=`IFLOW_${e}`;if(process.env[n])return process.env[n];let i=`iflow_${t}`;if(process.env[i])return process.env[i];let o=`iflow_${e}`;if(process.env[o])return process.env[o]}function Jpe(){return xS("apiKey")}function Xpe(){return xS("baseUrl")||xS("url")}function Zpe(){return xS("modelName")||xS("model")}function ZPr(t){let e=xS(t);if(e===void 0)return;let r=e.toLowerCase();if(r==="true"||r==="1"||r==="yes")return!0;if(r==="false"||r==="0"||r==="no")return!1}function eMr(t){let e=xS(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function tMr(t){let e=xS(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function dNe(){return!!(Jpe()||Xpe()||Zpe())}function A4t(){let t={},e=["theme","selectedAuthType","sandbox","toolDiscoveryCommand","toolCallCommand","mcpServerCommand","contextFileName","preferredEditor","apiKey","baseUrl","modelName","searchApiKey","multimodalModelName","memoryImportFormat"],r=["useExternalAuth","showMemoryUsage","usageStatisticsEnabled","autoConfigureMaxOldSpaceSize","hideWindowTitle","hideTips","hideBanner","vimMode","ideModeFeature","ideMode","disableAutoUpdate","skipNextSpeakerCheck","useRipgrep","debugKeystrokeLogging","pasteFromClipboard"],n=["maxSessionTurns","memoryDiscoveryMaxDirs","tokensLimit","compressionTokenThreshold","shellTimeout","temperature","topP"],i=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(o=>{let s=xS(o);s!==void 0&&(t[o]=s)}),r.forEach(o=>{let s=ZPr(o);s!==void 0&&(t[o]=s)}),n.forEach(o=>{let s=eMr(o);s!==void 0&&(t[o]=s)}),i.forEach(o=>{let s=tMr(o);s!==void 0&&(t[o]=s)}),t}function Fho(){return{apiKey:Jpe(),baseUrl:Xpe(),model:Zpe()}}var y4t=Z(()=>{"use strict";});async function E4t(t,e,r){await Tz()&&(await B_e()||console.log("OAuth2 credentials cleared due to expiration. Please authenticate when prompted."));let i=Jpe(),o=Xpe(),s=Zpe(),a=r?.apiKey||i,c=r?.baseUrl||o||Uho[e],u=r?.modelName||t.getModel()||s||AE,d={model:u,authType:e,proxy:t?.getProxy(),debugMode:t?.getDebugMode(),config:t};return e===zt.CLOUD_SHELL?d:e===zt.LOGIN_WITH_IFLOW?(d.baseUrl=c||Wpe,d.multimodalModelName="qwen3-vl-plus",a&&(d.apiKey=a),d):([...yE,zt.OPENAI_COMPATIBLE].includes(e)&&a&&(d.apiKey=a,d.baseUrl=c,d.model=u),d)}async function v4t(t,e,r){let i={headers:{"User-Agent":`iFlowCLI/0.3.21 (${process.platform}; ${process.arch})`}};if(t.authType&&[...yE,zt.IDEA_LAB].includes(t.authType)||t.authType===zt.OPENAI_COMPATIBLE)return new eU({...t,config:e});if(t.authType===zt.LOGIN_WITH_IFLOW||t.authType===zt.LOGIN_WITH_AONE||t.authType===zt.CLOUD_SHELL)return m4t(i,t.authType,e,r);throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var zt,yE,Uho,rE=Z(()=>{"use strict";g4t();a5();a4t();y4t();_R();(function(t){t.LOGIN_WITH_IFLOW="oauth-iflow",t.LOGIN_WITH_AONE="oauth-aone",t.CLOUD_SHELL="cloud-shell",t.IFLOW="iflow",t.AONE="aone",t.IDEA_LAB="idealab",t.OPENAI_COMPATIBLE="openai-compatible"})(zt||(zt={}));yE=[zt.IFLOW,zt.AONE],Uho={[zt.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[zt.IFLOW]:Wpe,[zt.AONE]:TPr}});var fNe,rMr=Z(()=>{"use strict";fNe=class{prompts=new Map;registerPrompt(e){if(this.prompts.has(e.name)){let r=`${e.serverName}_${e.name}`;console.warn(`Prompt with name "${e.name}" is already registered. Renaming to "${r}".`),this.prompts.set(r,{...e,name:r})}else this.prompts.set(e.name,e)}getAllPrompts(){return Array.from(this.prompts.values()).sort((e,r)=>e.name.localeCompare(r.name))}getPrompt(e){return this.prompts.get(e)}getPromptsByServer(e){let r=[];for(let n of this.prompts.values())n.serverName===e&&r.push(n);return r.sort((n,i)=>n.name.localeCompare(i.name))}clear(){this.prompts.clear()}removePromptsByServer(e){for(let[r,n]of this.prompts.entries())n.serverName===e&&this.prompts.delete(r)}}});var sn,EE=Z(()=>{"use strict";(function(t){t.INVALID_TOOL_PARAMS="invalid_tool_params",t.UNKNOWN="unknown",t.UNHANDLED_EXCEPTION="unhandled_exception",t.TOOL_NOT_REGISTERED="tool_not_registered",t.EXECUTION_FAILED="execution_failed",t.FILE_NOT_FOUND="file_not_found",t.FILE_WRITE_FAILURE="file_write_failure",t.READ_CONTENT_FAILURE="read_content_failure",t.ATTEMPT_TO_CREATE_EXISTING_FILE="attempt_to_create_existing_file",t.FILE_TOO_LARGE="file_too_large",t.PERMISSION_DENIED="permission_denied",t.NO_SPACE_LEFT="no_space_left",t.TARGET_IS_DIRECTORY="target_is_directory",t.PATH_NOT_IN_WORKSPACE="path_not_in_workspace",t.SEARCH_PATH_NOT_FOUND="search_path_not_found",t.SEARCH_PATH_NOT_A_DIRECTORY="search_path_not_a_directory",t.EDIT_PREPARATION_FAILURE="edit_preparation_failure",t.EDIT_NO_OCCURRENCE_FOUND="edit_no_occurrence_found",t.EDIT_EXPECTED_OCCURRENCE_MISMATCH="edit_expected_occurrence_mismatch",t.EDIT_NO_CHANGE="edit_no_change",t.GLOB_EXECUTION_ERROR="glob_execution_error",t.GREP_EXECUTION_ERROR="grep_execution_error",t.LS_EXECUTION_ERROR="ls_execution_error",t.PATH_IS_NOT_A_DIRECTORY="path_is_not_a_directory",t.MCP_TOOL_ERROR="mcp_tool_error",t.MEMORY_TOOL_EXECUTION_ERROR="memory_tool_execution_error",t.READ_MANY_FILES_SEARCH_ERROR="read_many_files_search_error",t.DISCOVERED_TOOL_EXECUTION_ERROR="discovered_tool_execution_error",t.WEB_FETCH_NO_URL_IN_PROMPT="web_fetch_no_url_in_prompt",t.WEB_FETCH_FALLBACK_FAILED="web_fetch_fallback_failed",t.WEB_FETCH_PROCESSING_ERROR="web_fetch_processing_error",t.WEB_SEARCH_FAILED="web_search_failed",t.HOOK_BLOCKED="hook_blocked"})(sn||(sn={}))});function Qho(t){return{text:t.text}}function qho(t,e){return[{text:B.t("mcpTool.messages.mediaDataProvided",{toolName:e,type:t.type,mimeType:t.mimeType})},{inlineData:{mimeType:t.mimeType,data:t.data}}]}function Hho(t,e){let r=t.resource;if(r?.text)return{text:r.text};if(r?.blob){let n=r.mimeType||"application/octet-stream";return[{text:B.t("mcpTool.messages.embeddedResourceProvided",{toolName:e,mimeType:n})},{inlineData:{mimeType:n,data:r.blob}}]}return null}function Gho(t){return{text:B.t("mcpTool.messages.resourceLink",{title:t.title||t.name,uri:t.uri})}}function jho(t){let e=t?.[0]?.functionResponse,r=e?.response?.content,n=e?.name||"unknown tool";return Array.isArray(r)?r.flatMap(o=>{switch(o.type){case"text":return Qho(o);case"image":case"audio":return qho(o,n);case"resource":return Hho(o,n);case"resource_link":return Gho(o);default:return null}}).filter(o=>o!==null):[{text:B.t("mcpTool.errors.parseResponseFailed")}]}function Vho(t){let e=t?.[0]?.functionResponse?.response?.content;return Array.isArray(e)?e.map(n=>{switch(n.type){case"text":return n.text;case"image":return B.t("mcpTool.display.image",{mimeType:n.mimeType});case"audio":return B.t("mcpTool.display.audio",{mimeType:n.mimeType});case"resource_link":return B.t("mcpTool.display.resourceLink",{title:n.title||n.name,uri:n.uri});case"resource":return n.resource?.text?n.resource.text:B.t("mcpTool.display.embeddedResource",{mimeType:n.resource?.mimeType||B.t("mcpTool.display.unknownType")});default:return B.t("mcpTool.display.unknownContentType",{type:n.type})}}).join(`
|
|
913
913
|
`):"```json\n"+JSON.stringify(t,null,2)+"\n```"}function nMr(t){let e=t.replace(/[^a-zA-Z0-9_.-]/g,"_");return e.length>63&&(e=e.slice(0,28)+"___"+e.slice(-32)),e}var tg,ehe=Z(()=>{"use strict";jRe();EE();Id();Lc();ui();tg=class t extends Do{mcpTool;serverName;serverToolName;parameterSchemaJson;timeout;trust;static allowlist=new Set;constructor(e,r,n,i,o,s,a,c){super(c??nMr(n),`${n} (${r} MCP Server)`,i,Ro.Hammer,Bo.Other,{type:lr.OBJECT},!0,!1),this.mcpTool=e,this.serverName=r,this.serverToolName=n,this.parameterSchemaJson=o,this.timeout=s,this.trust=a}asFullyQualifiedTool(){return new t(this.mcpTool,this.serverName,this.serverToolName,this.description,this.parameterSchemaJson,this.timeout,this.trust,`${this.serverName}__${this.serverToolName}`)}get schema(){return{name:this.name,description:this.description,parametersJsonSchema:this.parameterSchemaJson}}async shouldConfirmExecute(e,r){let n=this.serverName,i=`${this.serverName}.${this.serverToolName}`;return this.trust||t.allowlist.has(n)||t.allowlist.has(i)?!1:{type:"mcp",title:B.t("mcpTool.messages.confirmExecution"),serverName:this.serverName,toolName:this.serverToolName,toolDisplayName:this.name,onConfirm:async s=>{s===yn.ProceedAlwaysServer?t.allowlist.add(n):s===yn.ProceedAlwaysTool&&t.allowlist.add(i)}}}isMCPToolError(e){let n=e?.[0]?.functionResponse?.response;if(n){let i=n?.error,o=i?.isError;if(i&&(o===!0||o==="true"))return!0}return!1}async execute(e){let{callId:r,...n}=e,i=[{name:this.serverToolName,args:n}],o=await this.mcpTool.callTool(i);if(this.isMCPToolError(o)){let a=`MCP tool '${this.serverToolName}' reported tool error for function call: ${FF(i[0])} with response: ${FF(o)}`;return{llmContent:a,returnDisplay:B.t("mcpTool.errors.toolReportedError",{toolName:this.serverToolName}),error:{message:a,type:sn.MCP_TOOL_ERROR}}}return{llmContent:jho(o),returnDisplay:Vho(o)}}}});var oMr=w((sQa,iMr)=>{"use strict";iMr.exports=function(e){return e.map(function(r){return r===""?"''":r&&typeof r=="object"?r.op.replace(/(.)/g,"\\$1"):/["\s\\]/.test(r)&&!/'/.test(r)?"'"+r.replace(/(['])/g,"\\$1")+"'":/["'\s]/.test(r)?'"'+r.replace(/(["\\$`!])/g,"\\$1")+'"':String(r).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g,"$1\\$2")}).join(" ")}});var fMr=w((aQa,dMr)=>{"use strict";var uMr="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",sMr=new RegExp("^"+uMr+"$"),aMr="|&;()<> \\t",$ho='"((\\\\"|[^"])*?)"',Who="'((\\\\'|[^'])*?)'",zho=/^#$/,cMr="'",lMr='"',b4t="$",tU="",Yho=4294967296;for(C4t=0;C4t<4;C4t++)tU+=(Yho*Math.random()).toString(16);var C4t,Kho=new RegExp("^"+tU);function Jho(t,e){for(var r=e.lastIndex,n=[],i;i=e.exec(t);)n.push(i),e.lastIndex===i.index&&(e.lastIndex+=1);return e.lastIndex=r,n}function Xho(t,e,r){var n=typeof t=="function"?t(r):t[r];return typeof n>"u"&&r!=""?n="":typeof n>"u"&&(n="$"),typeof n=="object"?e+tU+JSON.stringify(n)+tU:e+n}function Zho(t,e,r){r||(r={});var n=r.escape||"\\",i="(\\"+n+`['"`+aMr+`]|[^\\s'"`+aMr+"])+",o=new RegExp(["("+uMr+")","("+i+"|"+$ho+"|"+Who+")+"].join("|"),"g"),s=Jho(t,o);if(s.length===0)return[];e||(e={});var a=!1;return s.map(function(c){var u=c[0];if(!u||a)return;if(sMr.test(u))return{op:u};var d=!1,f=!1,p="",h=!1,m;function g(){m+=1;var E,v,C=u.charAt(m);if(C==="{"){if(m+=1,u.charAt(m)==="}")throw new Error("Bad substitution: "+u.slice(m-2,m+1));if(E=u.indexOf("}",m),E<0)throw new Error("Bad substitution: "+u.slice(m));v=u.slice(m,E),m=E}else if(/[*@#?$!_-]/.test(C))v=C,m+=1;else{var S=u.slice(m);E=S.match(/[^\w\d_]/),E?(v=S.slice(0,E.index),m+=E.index-1):(v=S,m=u.length)}return Xho(e,"",v)}for(m=0;m<u.length;m++){var A=u.charAt(m);if(h=h||!d&&(A==="*"||A==="?"),f)p+=A,f=!1;else if(d)A===d?d=!1:d==cMr?p+=A:A===n?(m+=1,A=u.charAt(m),A===lMr||A===n||A===b4t?p+=A:p+=n+A):A===b4t?p+=g():p+=A;else if(A===lMr||A===cMr)d=A;else{if(sMr.test(A))return{op:u};if(zho.test(A)){a=!0;var y={comment:t.slice(c.index+m+1)};return p.length?[p,y]:[y]}else A===n?f=!0:A===b4t?p+=g():p+=A}}return h?{op:"glob",pattern:p}:p}).reduce(function(c,u){return typeof u>"u"?c:c.concat(u)},[])}dMr.exports=function(e,r,n){var i=Zho(e,r,n);return typeof r!="function"?i:i.reduce(function(o,s){if(typeof s=="object")return o.concat(s);var a=s.split(RegExp("("+tU+".*?"+tU+")","g"));return a.length===1?o.concat(a[0]):o.concat(a.filter(Boolean).map(function(c){return Kho.test(c)?JSON.parse(c.split(tU)[1]):c}))},[])}});var pNe=w(_4t=>{"use strict";_4t.quote=oMr();_4t.parse=fMr()});var Xs,x4t,kn,SS,the=Z(()=>{(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},t.getValidEnumValues=i=>{let o=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(let s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Xs||(Xs={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(x4t||(x4t={}));kn=Xs.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),SS=t=>{switch(typeof t){case"undefined":return kn.undefined;case"string":return kn.string;case"number":return Number.isNaN(t)?kn.nan:kn.number;case"boolean":return kn.boolean;case"function":return kn.function;case"bigint":return kn.bigint;case"symbol":return kn.symbol;case"object":return Array.isArray(t)?kn.array:t===null?kn.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?kn.promise:typeof Map<"u"&&t instanceof Map?kn.map:typeof Set<"u"&&t instanceof Set?kn.set:typeof Date<"u"&&t instanceof Date?kn.date:kn.object;default:return kn.unknown}}});var jr,emo,R3,hNe=Z(()=>{the();jr=Xs.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),emo=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),R3=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Xs.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};R3.create=t=>new R3(t)});var tmo,IT,S4t=Z(()=>{hNe();the();tmo=(t,e)=>{let r;switch(t.code){case jr.invalid_type:t.received===kn.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case jr.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Xs.jsonStringifyReplacer)}`;break;case jr.unrecognized_keys:r=`Unrecognized key(s) in object: ${Xs.joinValues(t.keys,", ")}`;break;case jr.invalid_union:r="Invalid input";break;case jr.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Xs.joinValues(t.options)}`;break;case jr.invalid_enum_value:r=`Invalid enum value. Expected ${Xs.joinValues(t.options)}, received '${t.received}'`;break;case jr.invalid_arguments:r="Invalid function arguments";break;case jr.invalid_return_type:r="Invalid function return type";break;case jr.invalid_date:r="Invalid date";break;case jr.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Xs.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case jr.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case jr.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case jr.custom:r="Invalid input";break;case jr.invalid_intersection_types:r="Intersection results could not be merged";break;case jr.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case jr.not_finite:r="Number must be finite";break;default:r=e.defaultError,Xs.assertNever(t)}return{message:r}},IT=tmo});function rmo(t){pMr=t}function FJ(){return pMr}var pMr,mNe=Z(()=>{S4t();pMr=IT});function En(t,e){let r=FJ(),n=rhe({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===IT?void 0:IT].filter(i=>!!i)});t.common.issues.push(n)}var rhe,nmo,rg,Wi,rU,x2,gNe,ANe,VB,UJ,w4t=Z(()=>{mNe();S4t();rhe=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:e,defaultError:a}).message;return{...i,path:o,message:a}},nmo=[];rg=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return Wi;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return Wi;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:e.value,value:n}}},Wi=Object.freeze({status:"aborted"}),rU=t=>({status:"dirty",value:t}),x2=t=>({status:"valid",value:t}),gNe=t=>t.status==="aborted",ANe=t=>t.status==="dirty",VB=t=>t.status==="valid",UJ=t=>typeof Promise<"u"&&t instanceof Promise});var hMr=Z(()=>{});var mi,mMr=Z(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(mi||(mi={}))});function ss(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,a)=>{let{message:c}=t;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:i}}function EMr(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function vmo(t){return new RegExp(`^${EMr(t)}$`)}function vMr(t){let e=`${yMr}T${EMr(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function bmo(t,e){return!!((e==="v4"||!e)&&pmo.test(t)||(e==="v6"||!e)&&mmo.test(t))}function Cmo(t,e){if(!lmo.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function _mo(t,e){return!!((e==="v4"||!e)&&hmo.test(t)||(e==="v6"||!e)&&gmo.test(t))}function xmo(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return o%s/10**i}function QJ(t){if(t instanceof B3){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=ob.create(QJ(n))}return new B3({...t._def,shape:()=>e})}else return t instanceof BT?new BT({...t._def,type:QJ(t.element)}):t instanceof ob?ob.create(QJ(t.unwrap())):t instanceof TS?TS.create(QJ(t.unwrap())):t instanceof wS?wS.create(t.items.map(e=>QJ(e))):t}function I4t(t,e){let r=SS(t),n=SS(e);if(t===e)return{valid:!0,data:t};if(r===kn.object&&n===kn.object){let i=Xs.objectKeys(e),o=Xs.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let c=I4t(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===kn.array&&n===kn.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<t.length;o++){let s=t[o],a=e[o],c=I4t(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===kn.date&&n===kn.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function bMr(t,e){return new pU({values:t,typeName:eo.ZodEnum,...ss(e)})}function AMr(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function CMr(t,e={},r){return t?WB.create().superRefine((n,i)=>{let o=t(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=AMr(e,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!o){let s=AMr(e,n),a=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:a})}}):WB.create()}var sb,gMr,Cs,imo,omo,smo,amo,cmo,lmo,umo,dmo,fmo,T4t,pmo,hmo,mmo,gmo,Amo,ymo,yMr,Emo,$B,nU,iU,oU,sU,qJ,aU,cU,WB,RT,c5,HJ,BT,B3,lU,DT,yNe,uU,wS,ENe,GJ,jJ,vNe,dU,fU,pU,hU,zB,ab,ob,TS,mU,gU,VJ,Smo,nhe,ihe,AU,wmo,eo,Tmo,_Mr,xMr,Imo,Dmo,SMr,Rmo,Bmo,Nmo,Omo,kmo,Pmo,Mmo,Lmo,Fmo,Umo,Qmo,qmo,Hmo,Gmo,jmo,Vmo,$mo,Wmo,zmo,Ymo,Kmo,Jmo,Xmo,Zmo,e0o,t0o,r0o,n0o,i0o,o0o,s0o,a0o,c0o,l0o,wMr=Z(()=>{hNe();mNe();mMr();w4t();the();sb=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},gMr=(t,e)=>{if(VB(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new R3(t.common.issues);return this._error=r,this._error}}};Cs=class{get description(){return this._def.description}_getType(e){return SS(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:SS(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new rg,ctx:{common:e.parent.common,data:e.data,parsedType:SS(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(UJ(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:SS(e)},i=this._parseSync({data:e,path:n.path,parent:n});return gMr(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:SS(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return VB(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>VB(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:SS(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(UJ(i)?i:Promise.resolve(i));return gMr(n,o)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=e(i),a=()=>o.addIssue({code:jr.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new ab({schema:this,typeName:eo.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return ob.create(this,this._def)}nullable(){return TS.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return BT.create(this)}promise(){return zB.create(this,this._def)}or(e){return lU.create([this,e],this._def)}and(e){return uU.create(this,e,this._def)}transform(e){return new ab({...ss(this._def),schema:this,typeName:eo.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new mU({...ss(this._def),innerType:this,defaultValue:r,typeName:eo.ZodDefault})}brand(){return new nhe({typeName:eo.ZodBranded,type:this,...ss(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new gU({...ss(this._def),innerType:this,catchValue:r,typeName:eo.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ihe.create(this,e)}readonly(){return AU.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},imo=/^c[^\s-]{8,}$/i,omo=/^[0-9a-z]+$/,smo=/^[0-9A-HJKMNP-TV-Z]{26}$/i,amo=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,cmo=/^[a-z0-9_-]{21}$/i,lmo=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,umo=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,dmo=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,fmo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",pmo=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,hmo=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,mmo=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,gmo=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Amo=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ymo=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,yMr="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Emo=new RegExp(`^${yMr}$`);$B=class t extends Cs{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==kn.string){let o=this._getOrReturnCtx(e);return En(o,{code:jr.invalid_type,expected:kn.string,received:o.parsedType}),Wi}let n=new rg,i;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),En(i,{code:jr.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(i=this._getOrReturnCtx(e,i),En(i,{code:jr.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(e,i),s?En(i,{code:jr.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&En(i,{code:jr.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")dmo.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"email",code:jr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")T4t||(T4t=new RegExp(fmo,"u")),T4t.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"emoji",code:jr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")amo.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"uuid",code:jr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")cmo.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"nanoid",code:jr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")imo.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"cuid",code:jr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")omo.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"cuid2",code:jr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")smo.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"ulid",code:jr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),En(i,{validation:"url",code:jr.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"regex",code:jr.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(e,i),En(i,{code:jr.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(i=this._getOrReturnCtx(e,i),En(i,{code:jr.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),En(i,{code:jr.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?vMr(o).test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{code:jr.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?Emo.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{code:jr.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?vmo(o).test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{code:jr.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?umo.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"duration",code:jr.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?bmo(e.data,o.version)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"ip",code:jr.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?Cmo(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"jwt",code:jr.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?_mo(e.data,o.version)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"cidr",code:jr.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?Amo.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"base64",code:jr.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?ymo.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"base64url",code:jr.invalid_string,message:o.message}),n.dirty()):Xs.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:jr.invalid_string,...mi.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...mi.errToObj(e)})}url(e){return this._addCheck({kind:"url",...mi.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...mi.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...mi.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...mi.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...mi.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...mi.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...mi.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...mi.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...mi.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...mi.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...mi.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...mi.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...mi.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...mi.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...mi.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...mi.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...mi.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...mi.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...mi.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...mi.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...mi.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...mi.errToObj(r)})}nonempty(e){return this.min(1,mi.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};$B.create=t=>new $B({checks:[],typeName:eo.ZodString,coerce:t?.coerce??!1,...ss(t)});nU=class t extends Cs{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==kn.number){let o=this._getOrReturnCtx(e);return En(o,{code:jr.invalid_type,expected:kn.number,received:o.parsedType}),Wi}let n,i=new rg;for(let o of this._def.checks)o.kind==="int"?Xs.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),En(n,{code:jr.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),En(n,{code:jr.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),En(n,{code:jr.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?xmo(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),En(n,{code:jr.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),En(n,{code:jr.not_finite,message:o.message}),i.dirty()):Xs.assertNever(o);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,mi.toString(r))}gt(e,r){return this.setLimit("min",e,!1,mi.toString(r))}lte(e,r){return this.setLimit("max",e,!0,mi.toString(r))}lt(e,r){return this.setLimit("max",e,!1,mi.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:mi.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:mi.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:mi.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:mi.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:mi.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:mi.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:mi.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:mi.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:mi.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:mi.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Xs.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};nU.create=t=>new nU({checks:[],typeName:eo.ZodNumber,coerce:t?.coerce||!1,...ss(t)});iU=class t extends Cs{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==kn.bigint)return this._getInvalidInput(e);let n,i=new rg;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),En(n,{code:jr.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),En(n,{code:jr.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),En(n,{code:jr.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Xs.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return En(r,{code:jr.invalid_type,expected:kn.bigint,received:r.parsedType}),Wi}gte(e,r){return this.setLimit("min",e,!0,mi.toString(r))}gt(e,r){return this.setLimit("min",e,!1,mi.toString(r))}lte(e,r){return this.setLimit("max",e,!0,mi.toString(r))}lt(e,r){return this.setLimit("max",e,!1,mi.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:mi.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:mi.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:mi.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:mi.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:mi.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:mi.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};iU.create=t=>new iU({checks:[],typeName:eo.ZodBigInt,coerce:t?.coerce??!1,...ss(t)});oU=class extends Cs{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==kn.boolean){let n=this._getOrReturnCtx(e);return En(n,{code:jr.invalid_type,expected:kn.boolean,received:n.parsedType}),Wi}return x2(e.data)}};oU.create=t=>new oU({typeName:eo.ZodBoolean,coerce:t?.coerce||!1,...ss(t)});sU=class t extends Cs{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==kn.date){let o=this._getOrReturnCtx(e);return En(o,{code:jr.invalid_type,expected:kn.date,received:o.parsedType}),Wi}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return En(o,{code:jr.invalid_date}),Wi}let n=new rg,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),En(i,{code:jr.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(i=this._getOrReturnCtx(e,i),En(i,{code:jr.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):Xs.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:mi.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:mi.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};sU.create=t=>new sU({checks:[],coerce:t?.coerce||!1,typeName:eo.ZodDate,...ss(t)});qJ=class extends Cs{_parse(e){if(this._getType(e)!==kn.symbol){let n=this._getOrReturnCtx(e);return En(n,{code:jr.invalid_type,expected:kn.symbol,received:n.parsedType}),Wi}return x2(e.data)}};qJ.create=t=>new qJ({typeName:eo.ZodSymbol,...ss(t)});aU=class extends Cs{_parse(e){if(this._getType(e)!==kn.undefined){let n=this._getOrReturnCtx(e);return En(n,{code:jr.invalid_type,expected:kn.undefined,received:n.parsedType}),Wi}return x2(e.data)}};aU.create=t=>new aU({typeName:eo.ZodUndefined,...ss(t)});cU=class extends Cs{_parse(e){if(this._getType(e)!==kn.null){let n=this._getOrReturnCtx(e);return En(n,{code:jr.invalid_type,expected:kn.null,received:n.parsedType}),Wi}return x2(e.data)}};cU.create=t=>new cU({typeName:eo.ZodNull,...ss(t)});WB=class extends Cs{constructor(){super(...arguments),this._any=!0}_parse(e){return x2(e.data)}};WB.create=t=>new WB({typeName:eo.ZodAny,...ss(t)});RT=class extends Cs{constructor(){super(...arguments),this._unknown=!0}_parse(e){return x2(e.data)}};RT.create=t=>new RT({typeName:eo.ZodUnknown,...ss(t)});c5=class extends Cs{_parse(e){let r=this._getOrReturnCtx(e);return En(r,{code:jr.invalid_type,expected:kn.never,received:r.parsedType}),Wi}};c5.create=t=>new c5({typeName:eo.ZodNever,...ss(t)});HJ=class extends Cs{_parse(e){if(this._getType(e)!==kn.undefined){let n=this._getOrReturnCtx(e);return En(n,{code:jr.invalid_type,expected:kn.void,received:n.parsedType}),Wi}return x2(e.data)}};HJ.create=t=>new HJ({typeName:eo.ZodVoid,...ss(t)});BT=class t extends Cs{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==kn.array)return En(r,{code:jr.invalid_type,expected:kn.array,received:r.parsedType}),Wi;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(En(r,{code:s?jr.too_big:jr.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(En(r,{code:jr.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(En(r,{code:jr.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new sb(r,s,r.path,a)))).then(s=>rg.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new sb(r,s,r.path,a)));return rg.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:mi.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:mi.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:mi.toString(r)}})}nonempty(e){return this.min(1,e)}};BT.create=(t,e)=>new BT({type:t,minLength:null,maxLength:null,exactLength:null,typeName:eo.ZodArray,...ss(e)});B3=class t extends Cs{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Xs.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==kn.object){let u=this._getOrReturnCtx(e);return En(u,{code:jr.invalid_type,expected:kn.object,received:u.parsedType}),Wi}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof c5&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let d=o[u],f=i.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new sb(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof c5){let u=this._def.unknownKeys;if(u==="passthrough")for(let d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:i.data[d]}});else if(u==="strict")a.length>0&&(En(i,{code:jr.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let d of a){let f=i.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new sb(i,f,i.path,d)),alwaysSet:d in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let d of c){let f=await d.key,p=await d.value;u.push({key:f,value:p,alwaysSet:d.alwaysSet})}return u}).then(u=>rg.mergeObjectSync(n,u)):rg.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return mi.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:mi.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:eo.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of Xs.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of Xs.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return QJ(this)}partial(e){let r={};for(let n of Xs.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of Xs.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof ob;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return bMr(Xs.objectKeys(this.shape))}};B3.create=(t,e)=>new B3({shape:()=>t,unknownKeys:"strip",catchall:c5.create(),typeName:eo.ZodObject,...ss(e)});B3.strictCreate=(t,e)=>new B3({shape:()=>t,unknownKeys:"strict",catchall:c5.create(),typeName:eo.ZodObject,...ss(e)});B3.lazycreate=(t,e)=>new B3({shape:t,unknownKeys:"strip",catchall:c5.create(),typeName:eo.ZodObject,...ss(e)});lU=class extends Cs{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new R3(a.ctx.common.issues));return En(r,{code:jr.invalid_union,unionErrors:s}),Wi}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!o&&(o={result:d,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new R3(c));return En(r,{code:jr.invalid_union,unionErrors:a}),Wi}}get options(){return this._def.options}};lU.create=(t,e)=>new lU({options:t,typeName:eo.ZodUnion,...ss(e)});DT=t=>t instanceof dU?DT(t.schema):t instanceof ab?DT(t.innerType()):t instanceof fU?[t.value]:t instanceof pU?t.options:t instanceof hU?Xs.objectValues(t.enum):t instanceof mU?DT(t._def.innerType):t instanceof aU?[void 0]:t instanceof cU?[null]:t instanceof ob?[void 0,...DT(t.unwrap())]:t instanceof TS?[null,...DT(t.unwrap())]:t instanceof nhe||t instanceof AU?DT(t.unwrap()):t instanceof gU?DT(t._def.innerType):[],yNe=class t extends Cs{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==kn.object)return En(r,{code:jr.invalid_type,expected:kn.object,received:r.parsedType}),Wi;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(En(r,{code:jr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Wi)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let o of r){let s=DT(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,o)}}return new t({typeName:eo.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...ss(n)})}};uU=class extends Cs{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(o,s)=>{if(gNe(o)||gNe(s))return Wi;let a=I4t(o.value,s.value);return a.valid?((ANe(o)||ANe(s))&&r.dirty(),{status:r.value,value:a.data}):(En(n,{code:jr.invalid_intersection_types}),Wi)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};uU.create=(t,e,r)=>new uU({left:t,right:e,typeName:eo.ZodIntersection,...ss(r)});wS=class t extends Cs{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==kn.array)return En(n,{code:jr.invalid_type,expected:kn.array,received:n.parsedType}),Wi;if(n.data.length<this._def.items.length)return En(n,{code:jr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Wi;!this._def.rest&&n.data.length>this._def.items.length&&(En(n,{code:jr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new sb(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>rg.mergeArray(r,s)):rg.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};wS.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new wS({items:t,typeName:eo.ZodTuple,rest:null,...ss(e)})};ENe=class t extends Cs{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==kn.object)return En(n,{code:jr.invalid_type,expected:kn.object,received:n.parsedType}),Wi;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new sb(n,a,n.path,a)),value:s._parse(new sb(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?rg.mergeObjectAsync(r,i):rg.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Cs?new t({keyType:e,valueType:r,typeName:eo.ZodRecord,...ss(n)}):new t({keyType:$B.create(),valueType:e,typeName:eo.ZodRecord,...ss(r)})}},GJ=class extends Cs{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==kn.map)return En(n,{code:jr.invalid_type,expected:kn.map,received:n.parsedType}),Wi;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new sb(n,a,n.path,[u,"key"])),value:o._parse(new sb(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return Wi;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return Wi;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}}}};GJ.create=(t,e,r)=>new GJ({valueType:e,keyType:t,typeName:eo.ZodMap,...ss(r)});jJ=class t extends Cs{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==kn.set)return En(n,{code:jr.invalid_type,expected:kn.set,received:n.parsedType}),Wi;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(En(n,{code:jr.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(En(n,{code:jr.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(c){let u=new Set;for(let d of c){if(d.status==="aborted")return Wi;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new sb(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:mi.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:mi.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};jJ.create=(t,e)=>new jJ({valueType:t,minSize:null,maxSize:null,typeName:eo.ZodSet,...ss(e)});vNe=class t extends Cs{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==kn.function)return En(r,{code:jr.invalid_type,expected:kn.function,received:r.parsedType}),Wi;function n(a,c){return rhe({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,FJ(),IT].filter(u=>!!u),issueData:{code:jr.invalid_arguments,argumentsError:c}})}function i(a,c){return rhe({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,FJ(),IT].filter(u=>!!u),issueData:{code:jr.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof zB){let a=this;return x2(async function(...c){let u=new R3([]),d=await a._def.args.parseAsync(c,o).catch(h=>{throw u.addIssue(n(c,h)),u}),f=await Reflect.apply(s,this,d);return await a._def.returns._def.type.parseAsync(f,o).catch(h=>{throw u.addIssue(i(f,h)),u})})}else{let a=this;return x2(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new R3([n(c,u.error)]);let d=Reflect.apply(s,this,u.data),f=a._def.returns.safeParse(d,o);if(!f.success)throw new R3([i(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:wS.create(e).rest(RT.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||wS.create([]).rest(RT.create()),returns:r||RT.create(),typeName:eo.ZodFunction,...ss(n)})}},dU=class extends Cs{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};dU.create=(t,e)=>new dU({getter:t,typeName:eo.ZodLazy,...ss(e)});fU=class extends Cs{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return En(r,{received:r.data,code:jr.invalid_literal,expected:this._def.value}),Wi}return{status:"valid",value:e.data}}get value(){return this._def.value}};fU.create=(t,e)=>new fU({value:t,typeName:eo.ZodLiteral,...ss(e)});pU=class t extends Cs{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return En(r,{expected:Xs.joinValues(n),received:r.parsedType,code:jr.invalid_type}),Wi}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return En(r,{received:r.data,code:jr.invalid_enum_value,options:n}),Wi}return x2(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};pU.create=bMr;hU=class extends Cs{_parse(e){let r=Xs.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==kn.string&&n.parsedType!==kn.number){let i=Xs.objectValues(r);return En(n,{expected:Xs.joinValues(i),received:n.parsedType,code:jr.invalid_type}),Wi}if(this._cache||(this._cache=new Set(Xs.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Xs.objectValues(r);return En(n,{received:n.data,code:jr.invalid_enum_value,options:i}),Wi}return x2(e.data)}get enum(){return this._def.values}};hU.create=(t,e)=>new hU({values:t,typeName:eo.ZodNativeEnum,...ss(e)});zB=class extends Cs{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==kn.promise&&r.common.async===!1)return En(r,{code:jr.invalid_type,expected:kn.promise,received:r.parsedType}),Wi;let n=r.parsedType===kn.promise?r.data:Promise.resolve(r.data);return x2(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};zB.create=(t,e)=>new zB({type:t,typeName:eo.ZodPromise,...ss(e)});ab=class extends Cs{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===eo.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{En(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return Wi;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?Wi:c.status==="dirty"?rU(c.value):r.value==="dirty"?rU(c.value):c});{if(r.value==="aborted")return Wi;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?Wi:a.status==="dirty"?rU(a.value):r.value==="dirty"?rU(a.value):a}}if(i.type==="refinement"){let s=a=>{let c=i.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Wi:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Wi:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!VB(s))return Wi;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>VB(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):Wi);Xs.assertNever(i)}};ab.create=(t,e,r)=>new ab({schema:t,typeName:eo.ZodEffects,effect:e,...ss(r)});ab.createWithPreprocess=(t,e,r)=>new ab({schema:e,effect:{type:"preprocess",transform:t},typeName:eo.ZodEffects,...ss(r)});ob=class extends Cs{_parse(e){return this._getType(e)===kn.undefined?x2(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ob.create=(t,e)=>new ob({innerType:t,typeName:eo.ZodOptional,...ss(e)});TS=class extends Cs{_parse(e){return this._getType(e)===kn.null?x2(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};TS.create=(t,e)=>new TS({innerType:t,typeName:eo.ZodNullable,...ss(e)});mU=class extends Cs{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===kn.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};mU.create=(t,e)=>new mU({innerType:t,typeName:eo.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ss(e)});gU=class extends Cs{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return UJ(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new R3(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new R3(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};gU.create=(t,e)=>new gU({innerType:t,typeName:eo.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ss(e)});VJ=class extends Cs{_parse(e){if(this._getType(e)!==kn.nan){let n=this._getOrReturnCtx(e);return En(n,{code:jr.invalid_type,expected:kn.nan,received:n.parsedType}),Wi}return{status:"valid",value:e.data}}};VJ.create=t=>new VJ({typeName:eo.ZodNaN,...ss(t)});Smo=Symbol("zod_brand"),nhe=class extends Cs{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},ihe=class t extends Cs{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Wi:o.status==="dirty"?(r.dirty(),rU(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Wi:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:eo.ZodPipeline})}},AU=class extends Cs{_parse(e){let r=this._def.innerType._parse(e),n=i=>(VB(i)&&(i.value=Object.freeze(i.value)),i);return UJ(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};AU.create=(t,e)=>new AU({innerType:t,typeName:eo.ZodReadonly,...ss(e)});wmo={object:B3.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(eo||(eo={}));Tmo=(t,e={message:`Input not instance of ${t.name}`})=>CMr(r=>r instanceof t,e),_Mr=$B.create,xMr=nU.create,Imo=VJ.create,Dmo=iU.create,SMr=oU.create,Rmo=sU.create,Bmo=qJ.create,Nmo=aU.create,Omo=cU.create,kmo=WB.create,Pmo=RT.create,Mmo=c5.create,Lmo=HJ.create,Fmo=BT.create,Umo=B3.create,Qmo=B3.strictCreate,qmo=lU.create,Hmo=yNe.create,Gmo=uU.create,jmo=wS.create,Vmo=ENe.create,$mo=GJ.create,Wmo=jJ.create,zmo=vNe.create,Ymo=dU.create,Kmo=fU.create,Jmo=pU.create,Xmo=hU.create,Zmo=zB.create,e0o=ab.create,t0o=ob.create,r0o=TS.create,n0o=ab.createWithPreprocess,i0o=ihe.create,o0o=()=>_Mr().optional(),s0o=()=>xMr().optional(),a0o=()=>SMr().optional(),c0o={string:(t=>$B.create({...t,coerce:!0})),number:(t=>nU.create({...t,coerce:!0})),boolean:(t=>oU.create({...t,coerce:!0})),bigint:(t=>iU.create({...t,coerce:!0})),date:(t=>sU.create({...t,coerce:!0}))},l0o=Wi});var oe={};Ys(oe,{BRAND:()=>Smo,DIRTY:()=>rU,EMPTY_PATH:()=>nmo,INVALID:()=>Wi,NEVER:()=>l0o,OK:()=>x2,ParseStatus:()=>rg,Schema:()=>Cs,ZodAny:()=>WB,ZodArray:()=>BT,ZodBigInt:()=>iU,ZodBoolean:()=>oU,ZodBranded:()=>nhe,ZodCatch:()=>gU,ZodDate:()=>sU,ZodDefault:()=>mU,ZodDiscriminatedUnion:()=>yNe,ZodEffects:()=>ab,ZodEnum:()=>pU,ZodError:()=>R3,ZodFirstPartyTypeKind:()=>eo,ZodFunction:()=>vNe,ZodIntersection:()=>uU,ZodIssueCode:()=>jr,ZodLazy:()=>dU,ZodLiteral:()=>fU,ZodMap:()=>GJ,ZodNaN:()=>VJ,ZodNativeEnum:()=>hU,ZodNever:()=>c5,ZodNull:()=>cU,ZodNullable:()=>TS,ZodNumber:()=>nU,ZodObject:()=>B3,ZodOptional:()=>ob,ZodParsedType:()=>kn,ZodPipeline:()=>ihe,ZodPromise:()=>zB,ZodReadonly:()=>AU,ZodRecord:()=>ENe,ZodSchema:()=>Cs,ZodSet:()=>jJ,ZodString:()=>$B,ZodSymbol:()=>qJ,ZodTransformer:()=>ab,ZodTuple:()=>wS,ZodType:()=>Cs,ZodUndefined:()=>aU,ZodUnion:()=>lU,ZodUnknown:()=>RT,ZodVoid:()=>HJ,addIssueToContext:()=>En,any:()=>kmo,array:()=>Fmo,bigint:()=>Dmo,boolean:()=>SMr,coerce:()=>c0o,custom:()=>CMr,date:()=>Rmo,datetimeRegex:()=>vMr,defaultErrorMap:()=>IT,discriminatedUnion:()=>Hmo,effect:()=>e0o,enum:()=>Jmo,function:()=>zmo,getErrorMap:()=>FJ,getParsedType:()=>SS,instanceof:()=>Tmo,intersection:()=>Gmo,isAborted:()=>gNe,isAsync:()=>UJ,isDirty:()=>ANe,isValid:()=>VB,late:()=>wmo,lazy:()=>Ymo,literal:()=>Kmo,makeIssue:()=>rhe,map:()=>$mo,nan:()=>Imo,nativeEnum:()=>Xmo,never:()=>Mmo,null:()=>Omo,nullable:()=>r0o,number:()=>xMr,object:()=>Umo,objectUtil:()=>x4t,oboolean:()=>a0o,onumber:()=>s0o,optional:()=>t0o,ostring:()=>o0o,pipeline:()=>i0o,preprocess:()=>n0o,promise:()=>Zmo,quotelessJson:()=>emo,record:()=>Vmo,set:()=>Wmo,setErrorMap:()=>rmo,strictObject:()=>Qmo,string:()=>_Mr,symbol:()=>Bmo,transformer:()=>e0o,tuple:()=>jmo,undefined:()=>Nmo,union:()=>qmo,unknown:()=>Pmo,util:()=>Xs,void:()=>Lmo});var D4t=Z(()=>{mNe();w4t();hMr();the();wMr();hNe()});var YB=Z(()=>{D4t();D4t()});var $J,TMr,bNe,IMr,DMr,u0o,ub,N3,ohe,IS,db,CNe,RMr,_Ne,BMr,NMr,OMr,she,cb,kMr,PMr,KB,yU,xNe,d0o,ahe,che,MMr,f0o,p0o,h0o,R4t,LMr,FMr,SNe,m0o,wNe,TNe,INe,UMr,QMr,B4t,qMr,HMr,g0o,A0o,N4t,y0o,O4t,E0o,k4t,v0o,b0o,C0o,_0o,x0o,S0o,w0o,lhe,T0o,P4t,M4t,L4t,I0o,D0o,GMr,R0o,uhe,B0o,N0o,O0o,k0o,F4t,DNe,MQa,P0o,M0o,jMr,L0o,F0o,U0o,Q0o,q0o,H0o,G0o,j0o,V0o,$0o,W0o,z0o,Y0o,K0o,J0o,X0o,Z0o,U4t,ego,RNe,tgo,rgo,LQa,FQa,UQa,QQa,qQa,HQa,lb,JB=Z(()=>{YB();$J="2025-06-18",TMr=[$J,"2025-03-26","2024-11-05","2024-10-07"],bNe="2.0",IMr=oe.union([oe.string(),oe.number().int()]),DMr=oe.string(),u0o=oe.object({progressToken:oe.optional(IMr)}).passthrough(),ub=oe.object({_meta:oe.optional(u0o)}).passthrough(),N3=oe.object({method:oe.string(),params:oe.optional(ub)}),ohe=oe.object({_meta:oe.optional(oe.object({}).passthrough())}).passthrough(),IS=oe.object({method:oe.string(),params:oe.optional(ohe)}),db=oe.object({_meta:oe.optional(oe.object({}).passthrough())}).passthrough(),CNe=oe.union([oe.string(),oe.number().int()]),RMr=oe.object({jsonrpc:oe.literal(bNe),id:CNe}).merge(N3).strict(),_Ne=t=>RMr.safeParse(t).success,BMr=oe.object({jsonrpc:oe.literal(bNe)}).merge(IS).strict(),NMr=t=>BMr.safeParse(t).success,OMr=oe.object({jsonrpc:oe.literal(bNe),id:CNe,result:db}).strict(),she=t=>OMr.safeParse(t).success;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"})(cb||(cb={}));kMr=oe.object({jsonrpc:oe.literal(bNe),id:CNe,error:oe.object({code:oe.number().int(),message:oe.string(),data:oe.optional(oe.unknown())})}).strict(),PMr=t=>kMr.safeParse(t).success,KB=oe.union([RMr,BMr,OMr,kMr]),yU=db.strict(),xNe=IS.extend({method:oe.literal("notifications/cancelled"),params:ohe.extend({requestId:CNe,reason:oe.string().optional()})}),d0o=oe.object({src:oe.string(),mimeType:oe.optional(oe.string()),sizes:oe.optional(oe.array(oe.string()))}).passthrough(),ahe=oe.object({icons:oe.array(d0o).optional()}).passthrough(),che=oe.object({name:oe.string(),title:oe.optional(oe.string())}).passthrough(),MMr=che.extend({version:oe.string(),websiteUrl:oe.optional(oe.string())}).merge(ahe),f0o=oe.object({experimental:oe.optional(oe.object({}).passthrough()),sampling:oe.optional(oe.object({}).passthrough()),elicitation:oe.optional(oe.object({}).passthrough()),roots:oe.optional(oe.object({listChanged:oe.optional(oe.boolean())}).passthrough())}).passthrough(),p0o=N3.extend({method:oe.literal("initialize"),params:ub.extend({protocolVersion:oe.string(),capabilities:f0o,clientInfo:MMr})}),h0o=oe.object({experimental:oe.optional(oe.object({}).passthrough()),logging:oe.optional(oe.object({}).passthrough()),completions:oe.optional(oe.object({}).passthrough()),prompts:oe.optional(oe.object({listChanged:oe.optional(oe.boolean())}).passthrough()),resources:oe.optional(oe.object({subscribe:oe.optional(oe.boolean()),listChanged:oe.optional(oe.boolean())}).passthrough()),tools:oe.optional(oe.object({listChanged:oe.optional(oe.boolean())}).passthrough())}).passthrough(),R4t=db.extend({protocolVersion:oe.string(),capabilities:h0o,serverInfo:MMr,instructions:oe.optional(oe.string())}),LMr=IS.extend({method:oe.literal("notifications/initialized")}),FMr=t=>LMr.safeParse(t).success,SNe=N3.extend({method:oe.literal("ping")}),m0o=oe.object({progress:oe.number(),total:oe.optional(oe.number()),message:oe.optional(oe.string())}).passthrough(),wNe=IS.extend({method:oe.literal("notifications/progress"),params:ohe.merge(m0o).extend({progressToken:IMr})}),TNe=N3.extend({params:ub.extend({cursor:oe.optional(DMr)}).optional()}),INe=db.extend({nextCursor:oe.optional(DMr)}),UMr=oe.object({uri:oe.string(),mimeType:oe.optional(oe.string()),_meta:oe.optional(oe.object({}).passthrough())}).passthrough(),QMr=UMr.extend({text:oe.string()}),B4t=oe.string().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),qMr=UMr.extend({blob:B4t}),HMr=che.extend({uri:oe.string(),description:oe.optional(oe.string()),mimeType:oe.optional(oe.string()),_meta:oe.optional(oe.object({}).passthrough())}).merge(ahe),g0o=che.extend({uriTemplate:oe.string(),description:oe.optional(oe.string()),mimeType:oe.optional(oe.string()),_meta:oe.optional(oe.object({}).passthrough())}).merge(ahe),A0o=TNe.extend({method:oe.literal("resources/list")}),N4t=INe.extend({resources:oe.array(HMr)}),y0o=TNe.extend({method:oe.literal("resources/templates/list")}),O4t=INe.extend({resourceTemplates:oe.array(g0o)}),E0o=N3.extend({method:oe.literal("resources/read"),params:ub.extend({uri:oe.string()})}),k4t=db.extend({contents:oe.array(oe.union([QMr,qMr]))}),v0o=IS.extend({method:oe.literal("notifications/resources/list_changed")}),b0o=N3.extend({method:oe.literal("resources/subscribe"),params:ub.extend({uri:oe.string()})}),C0o=N3.extend({method:oe.literal("resources/unsubscribe"),params:ub.extend({uri:oe.string()})}),_0o=IS.extend({method:oe.literal("notifications/resources/updated"),params:ohe.extend({uri:oe.string()})}),x0o=oe.object({name:oe.string(),description:oe.optional(oe.string()),required:oe.optional(oe.boolean())}).passthrough(),S0o=che.extend({description:oe.optional(oe.string()),arguments:oe.optional(oe.array(x0o)),_meta:oe.optional(oe.object({}).passthrough())}).merge(ahe),w0o=TNe.extend({method:oe.literal("prompts/list")}),lhe=INe.extend({prompts:oe.array(S0o)}),T0o=N3.extend({method:oe.literal("prompts/get"),params:ub.extend({name:oe.string(),arguments:oe.optional(oe.record(oe.string()))})}),P4t=oe.object({type:oe.literal("text"),text:oe.string(),_meta:oe.optional(oe.object({}).passthrough())}).passthrough(),M4t=oe.object({type:oe.literal("image"),data:B4t,mimeType:oe.string(),_meta:oe.optional(oe.object({}).passthrough())}).passthrough(),L4t=oe.object({type:oe.literal("audio"),data:B4t,mimeType:oe.string(),_meta:oe.optional(oe.object({}).passthrough())}).passthrough(),I0o=oe.object({type:oe.literal("resource"),resource:oe.union([QMr,qMr]),_meta:oe.optional(oe.object({}).passthrough())}).passthrough(),D0o=HMr.extend({type:oe.literal("resource_link")}),GMr=oe.union([P4t,M4t,L4t,D0o,I0o]),R0o=oe.object({role:oe.enum(["user","assistant"]),content:GMr}).passthrough(),uhe=db.extend({description:oe.optional(oe.string()),messages:oe.array(R0o)}),B0o=IS.extend({method:oe.literal("notifications/prompts/list_changed")}),N0o=oe.object({title:oe.optional(oe.string()),readOnlyHint:oe.optional(oe.boolean()),destructiveHint:oe.optional(oe.boolean()),idempotentHint:oe.optional(oe.boolean()),openWorldHint:oe.optional(oe.boolean())}).passthrough(),O0o=che.extend({description:oe.optional(oe.string()),inputSchema:oe.object({type:oe.literal("object"),properties:oe.optional(oe.object({}).passthrough()),required:oe.optional(oe.array(oe.string()))}).passthrough(),outputSchema:oe.optional(oe.object({type:oe.literal("object"),properties:oe.optional(oe.object({}).passthrough()),required:oe.optional(oe.array(oe.string()))}).passthrough()),annotations:oe.optional(N0o),_meta:oe.optional(oe.object({}).passthrough())}).merge(ahe),k0o=TNe.extend({method:oe.literal("tools/list")}),F4t=INe.extend({tools:oe.array(O0o)}),DNe=db.extend({content:oe.array(GMr).default([]),structuredContent:oe.object({}).passthrough().optional(),isError:oe.optional(oe.boolean())}),MQa=DNe.or(db.extend({toolResult:oe.unknown()})),P0o=N3.extend({method:oe.literal("tools/call"),params:ub.extend({name:oe.string(),arguments:oe.optional(oe.record(oe.unknown()))})}),M0o=IS.extend({method:oe.literal("notifications/tools/list_changed")}),jMr=oe.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),L0o=N3.extend({method:oe.literal("logging/setLevel"),params:ub.extend({level:jMr})}),F0o=IS.extend({method:oe.literal("notifications/message"),params:ohe.extend({level:jMr,logger:oe.optional(oe.string()),data:oe.unknown()})}),U0o=oe.object({name:oe.string().optional()}).passthrough(),Q0o=oe.object({hints:oe.optional(oe.array(U0o)),costPriority:oe.optional(oe.number().min(0).max(1)),speedPriority:oe.optional(oe.number().min(0).max(1)),intelligencePriority:oe.optional(oe.number().min(0).max(1))}).passthrough(),q0o=oe.object({role:oe.enum(["user","assistant"]),content:oe.union([P4t,M4t,L4t])}).passthrough(),H0o=N3.extend({method:oe.literal("sampling/createMessage"),params:ub.extend({messages:oe.array(q0o),systemPrompt:oe.optional(oe.string()),includeContext:oe.optional(oe.enum(["none","thisServer","allServers"])),temperature:oe.optional(oe.number()),maxTokens:oe.number().int(),stopSequences:oe.optional(oe.array(oe.string())),metadata:oe.optional(oe.object({}).passthrough()),modelPreferences:oe.optional(Q0o)})}),G0o=db.extend({model:oe.string(),stopReason:oe.optional(oe.enum(["endTurn","stopSequence","maxTokens"]).or(oe.string())),role:oe.enum(["user","assistant"]),content:oe.discriminatedUnion("type",[P4t,M4t,L4t])}),j0o=oe.object({type:oe.literal("boolean"),title:oe.optional(oe.string()),description:oe.optional(oe.string()),default:oe.optional(oe.boolean())}).passthrough(),V0o=oe.object({type:oe.literal("string"),title:oe.optional(oe.string()),description:oe.optional(oe.string()),minLength:oe.optional(oe.number()),maxLength:oe.optional(oe.number()),format:oe.optional(oe.enum(["email","uri","date","date-time"]))}).passthrough(),$0o=oe.object({type:oe.enum(["number","integer"]),title:oe.optional(oe.string()),description:oe.optional(oe.string()),minimum:oe.optional(oe.number()),maximum:oe.optional(oe.number())}).passthrough(),W0o=oe.object({type:oe.literal("string"),title:oe.optional(oe.string()),description:oe.optional(oe.string()),enum:oe.array(oe.string()),enumNames:oe.optional(oe.array(oe.string()))}).passthrough(),z0o=oe.union([j0o,V0o,$0o,W0o]),Y0o=N3.extend({method:oe.literal("elicitation/create"),params:ub.extend({message:oe.string(),requestedSchema:oe.object({type:oe.literal("object"),properties:oe.record(oe.string(),z0o),required:oe.optional(oe.array(oe.string()))}).passthrough()})}),K0o=db.extend({action:oe.enum(["accept","decline","cancel"]),content:oe.optional(oe.record(oe.string(),oe.unknown()))}),J0o=oe.object({type:oe.literal("ref/resource"),uri:oe.string()}).passthrough(),X0o=oe.object({type:oe.literal("ref/prompt"),name:oe.string()}).passthrough(),Z0o=N3.extend({method:oe.literal("completion/complete"),params:ub.extend({ref:oe.union([X0o,J0o]),argument:oe.object({name:oe.string(),value:oe.string()}).passthrough(),context:oe.optional(oe.object({arguments:oe.optional(oe.record(oe.string(),oe.string()))}))})}),U4t=db.extend({completion:oe.object({values:oe.array(oe.string()).max(100),total:oe.optional(oe.number().int()),hasMore:oe.optional(oe.boolean())}).passthrough()}),ego=oe.object({uri:oe.string().startsWith("file://"),name:oe.optional(oe.string()),_meta:oe.optional(oe.object({}).passthrough())}).passthrough(),RNe=N3.extend({method:oe.literal("roots/list")}),tgo=db.extend({roots:oe.array(ego)}),rgo=IS.extend({method:oe.literal("notifications/roots/list_changed")}),LQa=oe.union([SNe,p0o,Z0o,L0o,T0o,w0o,A0o,y0o,E0o,b0o,C0o,P0o,k0o]),FQa=oe.union([xNe,wNe,LMr,rgo]),UQa=oe.union([yU,G0o,K0o,tgo]),QQa=oe.union([SNe,H0o,Y0o,RNe]),qQa=oe.union([xNe,wNe,F0o,_0o,v0o,M0o,B0o]),HQa=oe.union([yU,R4t,U4t,uhe,lhe,N4t,O4t,k4t,DNe,F4t]),lb=class extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}}});function VMr(t,e){return Object.entries(e).reduce((r,[n,i])=>(i&&typeof i=="object"?r[n]=r[n]?{...r[n],...i}:i:r[n]=i,r),{...t})}var ngo,BNe,$Mr=Z(()=>{JB();ngo=6e4,BNe=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(xNe,r=>{let n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(wNe,r=>{this._onprogress(r)}),this.setRequestHandler(SNe,r=>({}))}_setupTimeout(e,r,n,i,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:o,onTimeout:i})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new lb(cb.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,i;this._transport=e;let o=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{o?.(),this._onclose()};let s=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=c=>{s?.(c),this._onerror(c)};let a=(i=this._transport)===null||i===void 0?void 0:i.onmessage;this._transport.onmessage=(c,u)=>{a?.(c,u),she(c)||PMr(c)?this._onresponse(c):_Ne(c)?this._onrequest(c,u):NMr(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let n=new lb(cb.ConnectionClosed,"Connection closed");for(let i of r.values())i(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,r){var n,i;let o=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,s=this._transport;if(o===void 0){s?.send({jsonrpc:"2.0",id:e.id,error:{code:cb.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let c={signal:a.signal,sessionId:s?.sessionId,_meta:(i=e.params)===null||i===void 0?void 0:i._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,d,f)=>this.request(u,d,{...f,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>o(e,c)).then(u=>{if(!a.signal.aborted)return s?.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var d;if(!a.signal.aborted)return s?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:cb.InternalError,message:(d=u.message)!==null&&d!==void 0?d:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,i=Number(r),o=this._progressHandlers.get(i);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(i),a=this._timeoutInfo.get(i);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(c){s(c);return}o(n)}_onresponse(e){let r=Number(e.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),she(e))n(e);else{let i=new lb(e.error.code,e.error.message,e.error.data);n(i)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,n){let{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}=n??{};return new Promise((a,c)=>{var u,d,f,p,h,m;if(!this._transport){c(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(d=n?.signal)===null||d===void 0||d.throwIfAborted();let g=this._requestMessageId++,A={...e,jsonrpc:"2.0",id:g};n?.onprogress&&(this._progressHandlers.set(g,n.onprogress),A.params={...e.params,_meta:{...((f=e.params)===null||f===void 0?void 0:f._meta)||{},progressToken:g}});let y=C=>{var S;this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),(S=this._transport)===null||S===void 0||S.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(C)}},{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(R=>this._onerror(new Error(`Failed to send cancellation: ${R}`))),c(C)};this._responseHandlers.set(g,C=>{var S;if(!(!((S=n?.signal)===null||S===void 0)&&S.aborted)){if(C instanceof Error)return c(C);try{let R=r.parse(C.result);a(R)}catch(R){c(R)}}}),(p=n?.signal)===null||p===void 0||p.addEventListener("abort",()=>{var C;y((C=n?.signal)===null||C===void 0?void 0:C.reason)});let E=(h=n?.timeout)!==null&&h!==void 0?h:ngo,v=()=>y(new lb(cb.RequestTimeout,"Request timed out",{timeout:E}));this._setupTimeout(g,E,n?.maxTotalTimeout,v,(m=n?.resetTimeoutOnProgress)!==null&&m!==void 0?m:!1),this._transport.send(A,{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(C=>{this._cleanupTimeout(g),c(C)})})}async notification(e,r){var n,i;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((i=(n=this._options)===null||n===void 0?void 0:n.debouncedNotificationMethods)!==null&&i!==void 0?i:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let u={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(u,r).catch(d=>this._onerror(d))});return}let a={...e,jsonrpc:"2.0"};await this._transport.send(a,r)}setRequestHandler(e,r){let n=e.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,o)=>Promise.resolve(r(e.parse(i),o)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){this._notificationHandlers.set(e.shape.method.value,n=>Promise.resolve(r(e.parse(n))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}});var phe=w(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});Qa.regexpCode=Qa.getEsmExportName=Qa.getProperty=Qa.safeStringify=Qa.stringify=Qa.strConcat=Qa.addCodeArg=Qa.str=Qa._=Qa.nil=Qa._Code=Qa.Name=Qa.IDENTIFIER=Qa._CodeOrName=void 0;var dhe=class{};Qa._CodeOrName=dhe;Qa.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var EU=class extends dhe{constructor(e){if(super(),!Qa.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Qa.Name=EU;var fb=class extends dhe{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof EU&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Qa._Code=fb;Qa.nil=new fb("");function WMr(t,...e){let r=[t[0]],n=0;for(;n<e.length;)q4t(r,e[n]),r.push(t[++n]);return new fb(r)}Qa._=WMr;var Q4t=new fb("+");function zMr(t,...e){let r=[fhe(t[0])],n=0;for(;n<e.length;)r.push(Q4t),q4t(r,e[n]),r.push(Q4t,fhe(t[++n]));return igo(r),new fb(r)}Qa.str=zMr;function q4t(t,e){e instanceof fb?t.push(...e._items):e instanceof EU?t.push(e):t.push(ago(e))}Qa.addCodeArg=q4t;function igo(t){let e=1;for(;e<t.length-1;){if(t[e]===Q4t){let r=ogo(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function ogo(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof EU||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof EU))return`"${t}${e.slice(1)}`}function sgo(t,e){return e.emptyStr()?t:t.emptyStr()?e:zMr`${t}${e}`}Qa.strConcat=sgo;function ago(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:fhe(Array.isArray(t)?t.join(","):t)}function cgo(t){return new fb(fhe(t))}Qa.stringify=cgo;function fhe(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Qa.safeStringify=fhe;function lgo(t){return typeof t=="string"&&Qa.IDENTIFIER.test(t)?new fb(`.${t}`):WMr`[${t}]`}Qa.getProperty=lgo;function ugo(t){if(typeof t=="string"&&Qa.IDENTIFIER.test(t))return new fb(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}Qa.getEsmExportName=ugo;function dgo(t){return new fb(t.toString())}Qa.regexpCode=dgo});var j4t=w(k3=>{"use strict";Object.defineProperty(k3,"__esModule",{value:!0});k3.ValueScope=k3.ValueScopeName=k3.Scope=k3.varKinds=k3.UsedValueState=void 0;var O3=phe(),H4t=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},NNe;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(NNe||(k3.UsedValueState=NNe={}));k3.varKinds={const:new O3.Name("const"),let:new O3.Name("let"),var:new O3.Name("var")};var ONe=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof O3.Name?e:this.name(e)}name(e){return new O3.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};k3.Scope=ONe;var kNe=class extends O3.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,O3._)`.${new O3.Name(r)}[${n}]`}};k3.ValueScopeName=kNe;var fgo=(0,O3._)`\n`,G4t=class extends ONe{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?fgo:O3.nil}}get(){return this._scope}name(e){return new kNe(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:o}=i,s=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[o];if(a){let d=a.get(s);if(d)return d}else a=this._values[o]=new Map;a.set(s,i);let c=this._scope[o]||(this._scope[o]=[]),u=c.length;return c[u]=r.ref,i.setValue(r,{property:o,itemIndex:u}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,O3._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let o=O3.nil;for(let s in e){let a=e[s];if(!a)continue;let c=n[s]=n[s]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,NNe.Started);let d=r(u);if(d){let f=this.opts.es5?k3.varKinds.var:k3.varKinds.const;o=(0,O3._)`${o}${f} ${u} = ${d};${this.opts._n}`}else if(d=i?.(u))o=(0,O3._)`${o}${d}${this.opts._n}`;else throw new H4t(u);c.set(u,NNe.Completed)})}return o}};k3.ValueScope=G4t});var _s=w(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});Ls.or=Ls.and=Ls.not=Ls.CodeGen=Ls.operators=Ls.varKinds=Ls.ValueScopeName=Ls.ValueScope=Ls.Scope=Ls.Name=Ls.regexpCode=Ls.stringify=Ls.getProperty=Ls.nil=Ls.strConcat=Ls.str=Ls._=void 0;var ga=phe(),l5=j4t(),XB=phe();Object.defineProperty(Ls,"_",{enumerable:!0,get:function(){return XB._}});Object.defineProperty(Ls,"str",{enumerable:!0,get:function(){return XB.str}});Object.defineProperty(Ls,"strConcat",{enumerable:!0,get:function(){return XB.strConcat}});Object.defineProperty(Ls,"nil",{enumerable:!0,get:function(){return XB.nil}});Object.defineProperty(Ls,"getProperty",{enumerable:!0,get:function(){return XB.getProperty}});Object.defineProperty(Ls,"stringify",{enumerable:!0,get:function(){return XB.stringify}});Object.defineProperty(Ls,"regexpCode",{enumerable:!0,get:function(){return XB.regexpCode}});Object.defineProperty(Ls,"Name",{enumerable:!0,get:function(){return XB.Name}});var FNe=j4t();Object.defineProperty(Ls,"Scope",{enumerable:!0,get:function(){return FNe.Scope}});Object.defineProperty(Ls,"ValueScope",{enumerable:!0,get:function(){return FNe.ValueScope}});Object.defineProperty(Ls,"ValueScopeName",{enumerable:!0,get:function(){return FNe.ValueScopeName}});Object.defineProperty(Ls,"varKinds",{enumerable:!0,get:function(){return FNe.varKinds}});Ls.operators={GT:new ga._Code(">"),GTE:new ga._Code(">="),LT:new ga._Code("<"),LTE:new ga._Code("<="),EQ:new ga._Code("==="),NEQ:new ga._Code("!=="),NOT:new ga._Code("!"),OR:new ga._Code("||"),AND:new ga._Code("&&"),ADD:new ga._Code("+")};var NT=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},V4t=class extends NT{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?l5.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=zJ(this.rhs,e,r)),this}get names(){return this.rhs instanceof ga._CodeOrName?this.rhs.names:{}}},PNe=class extends NT{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof ga.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=zJ(this.rhs,e,r),this}get names(){let e=this.lhs instanceof ga.Name?{}:{...this.lhs.names};return LNe(e,this.rhs)}},$4t=class extends PNe{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},W4t=class extends NT{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},z4t=class extends NT{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Y4t=class extends NT{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},K4t=class extends NT{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=zJ(this.code,e,r),this}get names(){return this.code instanceof ga._CodeOrName?this.code.names:{}}},hhe=class extends NT{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let o=n[i];o.optimizeNames(e,r)||(pgo(e,o.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>CU(e,r.names),{})}},OT=class extends hhe{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},J4t=class extends hhe{},WJ=class extends OT{};WJ.kind="else";var vU=class t extends OT{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new WJ(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(YMr(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=zJ(this.condition,e,r),this}get names(){let e=super.names;return LNe(e,this.condition),this.else&&CU(e,this.else.names),e}};vU.kind="if";var bU=class extends OT{};bU.kind="for";var X4t=class extends bU{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=zJ(this.iteration,e,r),this}get names(){return CU(super.names,this.iteration.names)}},Z4t=class extends bU{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?l5.varKinds.var:this.varKind,{name:n,from:i,to:o}=this;return`for(${r} ${n}=${i}; ${n}<${o}; ${n}++)`+super.render(e)}get names(){let e=LNe(super.names,this.from);return LNe(e,this.to)}},MNe=class extends bU{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=zJ(this.iterable,e,r),this}get names(){return CU(super.names,this.iterable.names)}},mhe=class extends OT{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};mhe.kind="func";var ghe=class extends hhe{render(e){return"return "+super.render(e)}};ghe.kind="return";var evt=class extends OT{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&CU(e,this.catch.names),this.finally&&CU(e,this.finally.names),e}},Ahe=class extends OT{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Ahe.kind="catch";var yhe=class extends OT{render(e){return"finally"+super.render(e)}};yhe.kind="finally";var tvt=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
914
914
|
`:""},this._extScope=e,this._scope=new l5.Scope({parent:e}),this._nodes=[new J4t]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let o=this._scope.toName(r);return n!==void 0&&i&&(this._constants[o.str]=n),this._leafNode(new V4t(e,o,n)),o}const(e,r,n){return this._def(l5.varKinds.const,e,r,n)}let(e,r,n){return this._def(l5.varKinds.let,e,r,n)}var(e,r,n){return this._def(l5.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new PNe(e,r,n))}add(e,r){return this._leafNode(new $4t(e,Ls.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==ga.nil&&this._leafNode(new K4t(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,ga.addCodeArg)(r,i));return r.push("}"),new ga._Code(r)}if(e,r,n){if(this._blockNode(new vU(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new vU(e))}else(){return this._elseNode(new WJ)}endIf(){return this._endBlockNode(vU,WJ)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new X4t(e),r)}forRange(e,r,n,i,o=this.opts.es5?l5.varKinds.var:l5.varKinds.let){let s=this._scope.toName(e);return this._for(new Z4t(o,s,r,n),()=>i(s))}forOf(e,r,n,i=l5.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let s=r instanceof ga.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,ga._)`${s}.length`,a=>{this.var(o,(0,ga._)`${s}[${a}]`),n(o)})}return this._for(new MNe("of",i,o,r),()=>n(o))}forIn(e,r,n,i=this.opts.es5?l5.varKinds.var:l5.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,ga._)`Object.keys(${r})`,n);let o=this._scope.toName(e);return this._for(new MNe("in",i,o,r),()=>n(o))}endFor(){return this._endBlockNode(bU)}label(e){return this._leafNode(new W4t(e))}break(e){return this._leafNode(new z4t(e))}return(e){let r=new ghe;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(ghe)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new evt;if(this._blockNode(i),this.code(e),r){let o=this.name("e");this._currNode=i.catch=new Ahe(o),r(o)}return n&&(this._currNode=i.finally=new yhe,this.code(n)),this._endBlockNode(Ahe,yhe)}throw(e){return this._leafNode(new Y4t(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=ga.nil,n,i){return this._blockNode(new mhe(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(mhe)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof vU))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};Ls.CodeGen=tvt;function CU(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function LNe(t,e){return e instanceof ga._CodeOrName?CU(t,e.names):t}function zJ(t,e,r){if(t instanceof ga.Name)return n(t);if(!i(t))return t;return new ga._Code(t._items.reduce((o,s)=>(s instanceof ga.Name&&(s=n(s)),s instanceof ga._Code?o.push(...s._items):o.push(s),o),[]));function n(o){let s=r[o.str];return s===void 0||e[o.str]!==1?o:(delete e[o.str],s)}function i(o){return o instanceof ga._Code&&o._items.some(s=>s instanceof ga.Name&&e[s.str]===1&&r[s.str]!==void 0)}}function pgo(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function YMr(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,ga._)`!${rvt(t)}`}Ls.not=YMr;var hgo=KMr(Ls.operators.AND);function mgo(...t){return t.reduce(hgo)}Ls.and=mgo;var ggo=KMr(Ls.operators.OR);function Ago(...t){return t.reduce(ggo)}Ls.or=Ago;function KMr(t){return(e,r)=>e===ga.nil?r:r===ga.nil?e:(0,ga._)`${rvt(e)} ${t} ${rvt(r)}`}function rvt(t){return t instanceof ga.Name?t:(0,ga._)`(${t})`}});var qa=w(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});qs.checkStrictMode=qs.getErrorPath=qs.Type=qs.useFunc=qs.setEvaluated=qs.evaluatedPropsToName=qs.mergeEvaluated=qs.eachItem=qs.unescapeJsonPointer=qs.escapeJsonPointer=qs.escapeFragment=qs.unescapeFragment=qs.schemaRefOrVal=qs.schemaHasRulesButRef=qs.schemaHasRules=qs.checkUnknownRules=qs.alwaysValidSchema=qs.toHash=void 0;var Ql=_s(),ygo=phe();function Ego(t){let e={};for(let r of t)e[r]=!0;return e}qs.toHash=Ego;function vgo(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(ZMr(t,e),!eLr(e,t.self.RULES.all))}qs.alwaysValidSchema=vgo;function ZMr(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let o in e)i[o]||nLr(t,`unknown keyword: "${o}"`)}qs.checkUnknownRules=ZMr;function eLr(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}qs.schemaHasRules=eLr;function bgo(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}qs.schemaHasRulesButRef=bgo;function Cgo({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Ql._)`${r}`}return(0,Ql._)`${t}${e}${(0,Ql.getProperty)(n)}`}qs.schemaRefOrVal=Cgo;function _go(t){return tLr(decodeURIComponent(t))}qs.unescapeFragment=_go;function xgo(t){return encodeURIComponent(ivt(t))}qs.escapeFragment=xgo;function ivt(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}qs.escapeJsonPointer=ivt;function tLr(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}qs.unescapeJsonPointer=tLr;function Sgo(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}qs.eachItem=Sgo;function JMr({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,o,s,a)=>{let c=s===void 0?o:s instanceof Ql.Name?(o instanceof Ql.Name?t(i,o,s):e(i,o,s),s):o instanceof Ql.Name?(e(i,s,o),o):r(o,s);return a===Ql.Name&&!(c instanceof Ql.Name)?n(i,c):c}}qs.mergeEvaluated={props:JMr({mergeNames:(t,e,r)=>t.if((0,Ql._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,Ql._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,Ql._)`${r} || {}`).code((0,Ql._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,Ql._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,Ql._)`${r} || {}`),ovt(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:rLr}),items:JMr({mergeNames:(t,e,r)=>t.if((0,Ql._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,Ql._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,Ql._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,Ql._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function rLr(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,Ql._)`{}`);return e!==void 0&&ovt(t,r,e),r}qs.evaluatedPropsToName=rLr;function ovt(t,e,r){Object.keys(r).forEach(n=>t.assign((0,Ql._)`${e}${(0,Ql.getProperty)(n)}`,!0))}qs.setEvaluated=ovt;var XMr={};function wgo(t,e){return t.scopeValue("func",{ref:e,code:XMr[e.code]||(XMr[e.code]=new ygo._Code(e.code))})}qs.useFunc=wgo;var nvt;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(nvt||(qs.Type=nvt={}));function Tgo(t,e,r){if(t instanceof Ql.Name){let n=e===nvt.Num;return r?n?(0,Ql._)`"[" + ${t} + "]"`:(0,Ql._)`"['" + ${t} + "']"`:n?(0,Ql._)`"/" + ${t}`:(0,Ql._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Ql.getProperty)(t).toString():"/"+ivt(t)}qs.getErrorPath=Tgo;function nLr(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}qs.checkStrictMode=nLr});var kT=w(svt=>{"use strict";Object.defineProperty(svt,"__esModule",{value:!0});var S2=_s(),Igo={data:new S2.Name("data"),valCxt:new S2.Name("valCxt"),instancePath:new S2.Name("instancePath"),parentData:new S2.Name("parentData"),parentDataProperty:new S2.Name("parentDataProperty"),rootData:new S2.Name("rootData"),dynamicAnchors:new S2.Name("dynamicAnchors"),vErrors:new S2.Name("vErrors"),errors:new S2.Name("errors"),this:new S2.Name("this"),self:new S2.Name("self"),scope:new S2.Name("scope"),json:new S2.Name("json"),jsonPos:new S2.Name("jsonPos"),jsonLen:new S2.Name("jsonLen"),jsonPart:new S2.Name("jsonPart")};svt.default=Igo});var Ehe=w(w2=>{"use strict";Object.defineProperty(w2,"__esModule",{value:!0});w2.extendErrors=w2.resetErrorsCount=w2.reportExtraError=w2.reportError=w2.keyword$DataError=w2.keywordError=void 0;var Ra=_s(),UNe=qa(),Y1=kT();w2.keywordError={message:({keyword:t})=>(0,Ra.str)`must pass "${t}" keyword validation`};w2.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,Ra.str)`"${t}" keyword must be ${e} ($data)`:(0,Ra.str)`"${t}" keyword is invalid ($data)`};function Dgo(t,e=w2.keywordError,r,n){let{it:i}=t,{gen:o,compositeRule:s,allErrors:a}=i,c=sLr(t,e,r);n??(s||a)?iLr(o,c):oLr(i,(0,Ra._)`[${c}]`)}w2.reportError=Dgo;function Rgo(t,e=w2.keywordError,r){let{it:n}=t,{gen:i,compositeRule:o,allErrors:s}=n,a=sLr(t,e,r);iLr(i,a),o||s||oLr(n,Y1.default.vErrors)}w2.reportExtraError=Rgo;function Bgo(t,e){t.assign(Y1.default.errors,e),t.if((0,Ra._)`${Y1.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,Ra._)`${Y1.default.vErrors}.length`,e),()=>t.assign(Y1.default.vErrors,null)))}w2.resetErrorsCount=Bgo;function Ngo({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:o}){if(i===void 0)throw new Error("ajv implementation error");let s=t.name("err");t.forRange("i",i,Y1.default.errors,a=>{t.const(s,(0,Ra._)`${Y1.default.vErrors}[${a}]`),t.if((0,Ra._)`${s}.instancePath === undefined`,()=>t.assign((0,Ra._)`${s}.instancePath`,(0,Ra.strConcat)(Y1.default.instancePath,o.errorPath))),t.assign((0,Ra._)`${s}.schemaPath`,(0,Ra.str)`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign((0,Ra._)`${s}.schema`,r),t.assign((0,Ra._)`${s}.data`,n))})}w2.extendErrors=Ngo;function iLr(t,e){let r=t.const("err",e);t.if((0,Ra._)`${Y1.default.vErrors} === null`,()=>t.assign(Y1.default.vErrors,(0,Ra._)`[${r}]`),(0,Ra._)`${Y1.default.vErrors}.push(${r})`),t.code((0,Ra._)`${Y1.default.errors}++`)}function oLr(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,Ra._)`new ${t.ValidationError}(${e})`):(r.assign((0,Ra._)`${n}.errors`,e),r.return(!1))}var _U={keyword:new Ra.Name("keyword"),schemaPath:new Ra.Name("schemaPath"),params:new Ra.Name("params"),propertyName:new Ra.Name("propertyName"),message:new Ra.Name("message"),schema:new Ra.Name("schema"),parentSchema:new Ra.Name("parentSchema")};function sLr(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,Ra._)`{}`:Ogo(t,e,r)}function Ogo(t,e,r={}){let{gen:n,it:i}=t,o=[kgo(i,r),Pgo(t,r)];return Mgo(t,e,o),n.object(...o)}function kgo({errorPath:t},{instancePath:e}){let r=e?(0,Ra.str)`${t}${(0,UNe.getErrorPath)(e,UNe.Type.Str)}`:t;return[Y1.default.instancePath,(0,Ra.strConcat)(Y1.default.instancePath,r)]}function Pgo({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,Ra.str)`${e}/${t}`;return r&&(i=(0,Ra.str)`${i}${(0,UNe.getErrorPath)(r,UNe.Type.Str)}`),[_U.schemaPath,i]}function Mgo(t,{params:e,message:r},n){let{keyword:i,data:o,schemaValue:s,it:a}=t,{opts:c,propertyName:u,topSchemaRef:d,schemaPath:f}=a;n.push([_U.keyword,i],[_U.params,typeof e=="function"?e(t):e||(0,Ra._)`{}`]),c.messages&&n.push([_U.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([_U.schema,s],[_U.parentSchema,(0,Ra._)`${d}${f}`],[Y1.default.data,o]),u&&n.push([_U.propertyName,u])}});var cLr=w(YJ=>{"use strict";Object.defineProperty(YJ,"__esModule",{value:!0});YJ.boolOrEmptySchema=YJ.topBoolOrEmptySchema=void 0;var Lgo=Ehe(),Fgo=_s(),Ugo=kT(),Qgo={message:"boolean schema is false"};function qgo(t){let{gen:e,schema:r,validateName:n}=t;r===!1?aLr(t,!1):typeof r=="object"&&r.$async===!0?e.return(Ugo.default.data):(e.assign((0,Fgo._)`${n}.errors`,null),e.return(!0))}YJ.topBoolOrEmptySchema=qgo;function Hgo(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),aLr(t)):r.var(e,!0)}YJ.boolOrEmptySchema=Hgo;function aLr(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Lgo.reportError)(i,Qgo,void 0,e)}});var avt=w(KJ=>{"use strict";Object.defineProperty(KJ,"__esModule",{value:!0});KJ.getRules=KJ.isJSONType=void 0;var Ggo=["string","number","integer","boolean","null","object","array"],jgo=new Set(Ggo);function Vgo(t){return typeof t=="string"&&jgo.has(t)}KJ.isJSONType=Vgo;function $go(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}KJ.getRules=$go});var cvt=w(ZB=>{"use strict";Object.defineProperty(ZB,"__esModule",{value:!0});ZB.shouldUseRule=ZB.shouldUseGroup=ZB.schemaHasRulesForType=void 0;function Wgo({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&lLr(t,n)}ZB.schemaHasRulesForType=Wgo;function lLr(t,e){return e.rules.some(r=>uLr(t,r))}ZB.shouldUseGroup=lLr;function uLr(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}ZB.shouldUseRule=uLr});var vhe=w(T2=>{"use strict";Object.defineProperty(T2,"__esModule",{value:!0});T2.reportTypeError=T2.checkDataTypes=T2.checkDataType=T2.coerceAndCheckDataType=T2.getJSONTypes=T2.getSchemaTypes=T2.DataType=void 0;var zgo=avt(),Ygo=cvt(),Kgo=Ehe(),gs=_s(),dLr=qa(),JJ;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(JJ||(T2.DataType=JJ={}));function Jgo(t){let e=fLr(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}T2.getSchemaTypes=Jgo;function fLr(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(zgo.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}T2.getJSONTypes=fLr;function Xgo(t,e){let{gen:r,data:n,opts:i}=t,o=Zgo(e,i.coerceTypes),s=e.length>0&&!(o.length===0&&e.length===1&&(0,Ygo.schemaHasRulesForType)(t,e[0]));if(s){let a=uvt(e,n,i.strictNumbers,JJ.Wrong);r.if(a,()=>{o.length?e2o(t,e,o):dvt(t)})}return s}T2.coerceAndCheckDataType=Xgo;var pLr=new Set(["string","number","integer","boolean","null"]);function Zgo(t,e){return e?t.filter(r=>pLr.has(r)||e==="array"&&r==="array"):[]}function e2o(t,e,r){let{gen:n,data:i,opts:o}=t,s=n.let("dataType",(0,gs._)`typeof ${i}`),a=n.let("coerced",(0,gs._)`undefined`);o.coerceTypes==="array"&&n.if((0,gs._)`${s} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,gs._)`${i}[0]`).assign(s,(0,gs._)`typeof ${i}`).if(uvt(e,i,o.strictNumbers),()=>n.assign(a,i))),n.if((0,gs._)`${a} !== undefined`);for(let u of r)(pLr.has(u)||u==="array"&&o.coerceTypes==="array")&&c(u);n.else(),dvt(t),n.endIf(),n.if((0,gs._)`${a} !== undefined`,()=>{n.assign(i,a),t2o(t,a)});function c(u){switch(u){case"string":n.elseIf((0,gs._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,gs._)`"" + ${i}`).elseIf((0,gs._)`${i} === null`).assign(a,(0,gs._)`""`);return;case"number":n.elseIf((0,gs._)`${s} == "boolean" || ${i} === null
|
|
915
915
|
|| (${s} == "string" && ${i} && ${i} == +${i})`).assign(a,(0,gs._)`+${i}`);return;case"integer":n.elseIf((0,gs._)`${s} === "boolean" || ${i} === null
|
|
@@ -923,7 +923,7 @@ ${e}
|
|
|
923
923
|
`;break;case"id":a=A.includes("\0")?void 0:A;break;case"retry":/^\d+$/.test(A)?n(parseInt(A,10)):r(new EOe(`Invalid \`retry\` value: "${A}"`,{type:"invalid-retry",value:A,line:y}));break;default:r(new EOe(`Unknown field "${g.length>20?`${g.slice(0,20)}\u2026`:g}"`,{type:"unknown-field",field:g,value:A,line:y}));break}}function h(){c.length>0&&e({id:a,event:u||void 0,data:c.endsWith(`
|
|
924
924
|
`)?c.slice(0,-1):c}),a=void 0,c="",u=""}function m(g={}){o&&g.consume&&f(o),s=!0,a=void 0,c="",u="",o=""}return{feed:d,reset:m}}function SEo(t){let e=[],r="",n=0;for(;n<t.length;){let i=t.indexOf("\r",n),o=t.indexOf(`
|
|
925
925
|
`,n),s=-1;if(i!==-1&&o!==-1?s=Math.min(i,o):i!==-1?i===t.length-1?s=-1:s=i:o!==-1&&(s=o),s===-1){r=t.slice(n);break}else{let a=t.slice(n,s);e.push(a),n=s+1,t[n-1]==="\r"&&t[n]===`
|
|
926
|
-
`&&n++}}return[e,r]}var EOe,Hbt=Z(()=>{EOe=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}});function wEo(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Gbt(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Gbt).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Gbt(t.cause)}`:t.message:`${t}`}function wQr(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}function TEo(){let t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var COe,IQr,Jbt,Zs,Uh,Bd,LT,L3,DU,pX,bOe,_Oe,Hhe,gX,Ghe,sN,hX,AX,mX,Qhe,h5,jbt,Vbt,$bt,TQr,Wbt,zbt,qhe,Ybt,Kbt,RU,DQr=Z(()=>{Hbt();COe=class extends Event{constructor(e,r){var n,i;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(i=r?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(wQr(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(wQr(this),r)}};IQr=t=>{throw TypeError(t)},Jbt=(t,e,r)=>e.has(t)||IQr("Cannot "+r),Zs=(t,e,r)=>(Jbt(t,e,"read from private field"),r?r.call(t):e.get(t)),Uh=(t,e,r)=>e.has(t)?IQr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Bd=(t,e,r,n)=>(Jbt(t,e,"write to private field"),e.set(t,r),r),LT=(t,e,r)=>(Jbt(t,e,"access private method"),r),RU=class extends EventTarget{constructor(e,r){var n,i;super(),Uh(this,h5),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Uh(this,L3),Uh(this,DU),Uh(this,pX),Uh(this,bOe),Uh(this,_Oe),Uh(this,Hhe),Uh(this,gX),Uh(this,Ghe,null),Uh(this,sN),Uh(this,hX),Uh(this,AX,null),Uh(this,mX,null),Uh(this,Qhe,null),Uh(this,Vbt,async o=>{var s;Zs(this,hX).reset();let{body:a,redirected:c,status:u,headers:d}=o;if(u===204){LT(this,h5,qhe).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?Bd(this,pX,new URL(o.url)):Bd(this,pX,void 0),u!==200){LT(this,h5,qhe).call(this,`Non-200 status code (${u})`,u);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){LT(this,h5,qhe).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Zs(this,L3)===this.CLOSED)return;Bd(this,L3,this.OPEN);let f=new Event("open");if((s=Zs(this,Qhe))==null||s.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){LT(this,h5,qhe).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}let p=new TextDecoder,h=a.getReader(),m=!0;do{let{done:g,value:A}=await h.read();A&&Zs(this,hX).feed(p.decode(A,{stream:!g})),g&&(m=!1,Zs(this,hX).reset(),LT(this,h5,Ybt).call(this))}while(m)}),Uh(this,$bt,o=>{Bd(this,sN,void 0),!(o.name==="AbortError"||o.type==="aborted")&<(this,h5,Ybt).call(this,Gbt(o))}),Uh(this,Wbt,o=>{typeof o.id=="string"&&Bd(this,Ghe,o.id);let s=new MessageEvent(o.event||"message",{data:o.data,origin:Zs(this,pX)?Zs(this,pX).origin:Zs(this,DU).origin,lastEventId:o.id||""});Zs(this,mX)&&(!o.event||o.event==="message")&&Zs(this,mX).call(this,s),this.dispatchEvent(s)}),Uh(this,zbt,o=>{Bd(this,Hhe,o)}),Uh(this,Kbt,()=>{Bd(this,gX,void 0),Zs(this,L3)===this.CONNECTING&<(this,h5,jbt).call(this)});try{if(e instanceof URL)Bd(this,DU,e);else if(typeof e=="string")Bd(this,DU,new URL(e,TEo()));else throw new Error("Invalid URL")}catch{throw wEo("An invalid or illegal string was specified")}Bd(this,hX,vOe({onEvent:Zs(this,Wbt),onRetry:Zs(this,zbt)})),Bd(this,L3,this.CONNECTING),Bd(this,Hhe,3e3),Bd(this,_Oe,(n=r?.fetch)!=null?n:globalThis.fetch),Bd(this,bOe,(i=r?.withCredentials)!=null?i:!1),LT(this,h5,jbt).call(this)}get readyState(){return Zs(this,L3)}get url(){return Zs(this,DU).href}get withCredentials(){return Zs(this,bOe)}get onerror(){return Zs(this,AX)}set onerror(e){Bd(this,AX,e)}get onmessage(){return Zs(this,mX)}set onmessage(e){Bd(this,mX,e)}get onopen(){return Zs(this,Qhe)}set onopen(e){Bd(this,Qhe,e)}addEventListener(e,r,n){let i=r;super.addEventListener(e,i,n)}removeEventListener(e,r,n){let i=r;super.removeEventListener(e,i,n)}close(){Zs(this,gX)&&clearTimeout(Zs(this,gX)),Zs(this,L3)!==this.CLOSED&&(Zs(this,sN)&&Zs(this,sN).abort(),Bd(this,L3,this.CLOSED),Bd(this,sN,void 0))}};L3=new WeakMap,DU=new WeakMap,pX=new WeakMap,bOe=new WeakMap,_Oe=new WeakMap,Hhe=new WeakMap,gX=new WeakMap,Ghe=new WeakMap,sN=new WeakMap,hX=new WeakMap,AX=new WeakMap,mX=new WeakMap,Qhe=new WeakMap,h5=new WeakSet,jbt=function(){Bd(this,L3,this.CONNECTING),Bd(this,sN,new AbortController),Zs(this,_Oe)(Zs(this,DU),LT(this,h5,TQr).call(this)).then(Zs(this,Vbt)).catch(Zs(this,$bt))},Vbt=new WeakMap,$bt=new WeakMap,TQr=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Zs(this,Ghe)?{"Last-Event-ID":Zs(this,Ghe)}:void 0},cache:"no-store",signal:(t=Zs(this,sN))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Wbt=new WeakMap,zbt=new WeakMap,qhe=function(t,e){var r;Zs(this,L3)!==this.CLOSED&&Bd(this,L3,this.CLOSED);let n=new COe("error",{code:e,message:t});(r=Zs(this,AX))==null||r.call(this,n),this.dispatchEvent(n)},Ybt=function(t,e){var r;if(Zs(this,L3)===this.CLOSED)return;Bd(this,L3,this.CONNECTING);let n=new COe("error",{code:e,message:t});(r=Zs(this,AX))==null||r.call(this,n),this.dispatchEvent(n),Bd(this,gX,setTimeout(Zs(this,Kbt),Zs(this,Hhe)))},Kbt=new WeakMap,RU.CONNECTING=0,RU.OPEN=1,RU.CLOSED=2});async function IEo(t){return(await Xbt).getRandomValues(new Uint8Array(t))}async function DEo(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await IEo(t);for(let i=0;i<t;i++){let o=n[i]%e.length;r+=e[o]}return r}async function REo(t){return await DEo(t)}async function BEo(t){let e=await(await Xbt).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Zbt(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await REo(t),r=await BEo(e);return{code_verifier:e,code_challenge:r}}var Xbt,RQr=Z(()=>{Xbt=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto)});var og,NQr,e6t,NEo,OQr,t6t,kQr,BQr,OEo,kEo,PQr,LHa,FHa,r6t=Z(()=>{YB();og=oe.string().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:oe.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),oe.NEVER}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),NQr=oe.object({resource:oe.string().url(),authorization_servers:oe.array(og).optional(),jwks_uri:oe.string().url().optional(),scopes_supported:oe.array(oe.string()).optional(),bearer_methods_supported:oe.array(oe.string()).optional(),resource_signing_alg_values_supported:oe.array(oe.string()).optional(),resource_name:oe.string().optional(),resource_documentation:oe.string().optional(),resource_policy_uri:oe.string().url().optional(),resource_tos_uri:oe.string().url().optional(),tls_client_certificate_bound_access_tokens:oe.boolean().optional(),authorization_details_types_supported:oe.array(oe.string()).optional(),dpop_signing_alg_values_supported:oe.array(oe.string()).optional(),dpop_bound_access_tokens_required:oe.boolean().optional()}).passthrough(),e6t=oe.object({issuer:oe.string(),authorization_endpoint:og,token_endpoint:og,registration_endpoint:og.optional(),scopes_supported:oe.array(oe.string()).optional(),response_types_supported:oe.array(oe.string()),response_modes_supported:oe.array(oe.string()).optional(),grant_types_supported:oe.array(oe.string()).optional(),token_endpoint_auth_methods_supported:oe.array(oe.string()).optional(),token_endpoint_auth_signing_alg_values_supported:oe.array(oe.string()).optional(),service_documentation:og.optional(),revocation_endpoint:og.optional(),revocation_endpoint_auth_methods_supported:oe.array(oe.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:oe.array(oe.string()).optional(),introspection_endpoint:oe.string().optional(),introspection_endpoint_auth_methods_supported:oe.array(oe.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:oe.array(oe.string()).optional(),code_challenge_methods_supported:oe.array(oe.string()).optional()}).passthrough(),NEo=oe.object({issuer:oe.string(),authorization_endpoint:og,token_endpoint:og,userinfo_endpoint:og.optional(),jwks_uri:og,registration_endpoint:og.optional(),scopes_supported:oe.array(oe.string()).optional(),response_types_supported:oe.array(oe.string()),response_modes_supported:oe.array(oe.string()).optional(),grant_types_supported:oe.array(oe.string()).optional(),acr_values_supported:oe.array(oe.string()).optional(),subject_types_supported:oe.array(oe.string()),id_token_signing_alg_values_supported:oe.array(oe.string()),id_token_encryption_alg_values_supported:oe.array(oe.string()).optional(),id_token_encryption_enc_values_supported:oe.array(oe.string()).optional(),userinfo_signing_alg_values_supported:oe.array(oe.string()).optional(),userinfo_encryption_alg_values_supported:oe.array(oe.string()).optional(),userinfo_encryption_enc_values_supported:oe.array(oe.string()).optional(),request_object_signing_alg_values_supported:oe.array(oe.string()).optional(),request_object_encryption_alg_values_supported:oe.array(oe.string()).optional(),request_object_encryption_enc_values_supported:oe.array(oe.string()).optional(),token_endpoint_auth_methods_supported:oe.array(oe.string()).optional(),token_endpoint_auth_signing_alg_values_supported:oe.array(oe.string()).optional(),display_values_supported:oe.array(oe.string()).optional(),claim_types_supported:oe.array(oe.string()).optional(),claims_supported:oe.array(oe.string()).optional(),service_documentation:oe.string().optional(),claims_locales_supported:oe.array(oe.string()).optional(),ui_locales_supported:oe.array(oe.string()).optional(),claims_parameter_supported:oe.boolean().optional(),request_parameter_supported:oe.boolean().optional(),request_uri_parameter_supported:oe.boolean().optional(),require_request_uri_registration:oe.boolean().optional(),op_policy_uri:og.optional(),op_tos_uri:og.optional()}).passthrough(),OQr=NEo.merge(e6t.pick({code_challenge_methods_supported:!0})),t6t=oe.object({access_token:oe.string(),id_token:oe.string().optional(),token_type:oe.string(),expires_in:oe.number().optional(),scope:oe.string().optional(),refresh_token:oe.string().optional()}).strip(),kQr=oe.object({error:oe.string(),error_description:oe.string().optional(),error_uri:oe.string().optional()}),BQr=og.optional().or(oe.literal("").transform(()=>{})),OEo=oe.object({redirect_uris:oe.array(og),token_endpoint_auth_method:oe.string().optional(),grant_types:oe.array(oe.string()).optional(),response_types:oe.array(oe.string()).optional(),client_name:oe.string().optional(),client_uri:og.optional(),logo_uri:BQr,scope:oe.string().optional(),contacts:oe.array(oe.string()).optional(),tos_uri:BQr,policy_uri:oe.string().optional(),jwks_uri:og.optional(),jwks:oe.any().optional(),software_id:oe.string().optional(),software_version:oe.string().optional(),software_statement:oe.string().optional()}).strip(),kEo=oe.object({client_id:oe.string(),client_secret:oe.string().optional(),client_id_issued_at:oe.number().optional(),client_secret_expires_at:oe.number().optional()}).strip(),PQr=OEo.merge(kEo),LHa=oe.object({error:oe.string(),error_description:oe.string().optional()}).strip(),FHa=oe.object({token:oe.string(),token_type_hint:oe.string().optional()}).strip()});function MQr(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function LQr({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",o=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return i.startsWith(o)}var FQr=Z(()=>{});var th,jhe,BU,NU,OU,Vhe,$he,Whe,FT,zhe,Yhe,Khe,Jhe,Xhe,Zhe,eme,tme,UQr,QQr=Z(()=>{th=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},jhe=class extends th{};jhe.errorCode="invalid_request";BU=class extends th{};BU.errorCode="invalid_client";NU=class extends th{};NU.errorCode="invalid_grant";OU=class extends th{};OU.errorCode="unauthorized_client";Vhe=class extends th{};Vhe.errorCode="unsupported_grant_type";$he=class extends th{};$he.errorCode="invalid_scope";Whe=class extends th{};Whe.errorCode="access_denied";FT=class extends th{};FT.errorCode="server_error";zhe=class extends th{};zhe.errorCode="temporarily_unavailable";Yhe=class extends th{};Yhe.errorCode="unsupported_response_type";Khe=class extends th{};Khe.errorCode="unsupported_token_type";Jhe=class extends th{};Jhe.errorCode="invalid_token";Xhe=class extends th{};Xhe.errorCode="method_not_allowed";Zhe=class extends th{};Zhe.errorCode="too_many_requests";eme=class extends th{};eme.errorCode="invalid_client_metadata";tme=class extends th{};tme.errorCode="insufficient_scope";UQr={[jhe.errorCode]:jhe,[BU.errorCode]:BU,[NU.errorCode]:NU,[OU.errorCode]:OU,[Vhe.errorCode]:Vhe,[$he.errorCode]:$he,[Whe.errorCode]:Whe,[FT.errorCode]:FT,[zhe.errorCode]:zhe,[Yhe.errorCode]:Yhe,[Khe.errorCode]:Khe,[Jhe.errorCode]:Jhe,[Xhe.errorCode]:Xhe,[Zhe.errorCode]:Zhe,[eme.errorCode]:eme,[tme.errorCode]:tme}});function PEo(t){return["client_secret_basic","client_secret_post","none"].includes(t)}function HQr(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":"token_endpoint_auth_method"in t&&t.token_endpoint_auth_method&&PEo(t.token_endpoint_auth_method)&&e.includes(t.token_endpoint_auth_method)?t.token_endpoint_auth_method:r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function GQr(t,e,r,n){let{client_id:i,client_secret:o}=e;switch(t){case"client_secret_basic":MEo(i,o,r);return;case"client_secret_post":LEo(i,o,n);return;case"none":FEo(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function MEo(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function LEo(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function FEo(t,e){e.set("client_id",t)}async function s6t(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=kQr.parse(JSON.parse(r)),{error:i,error_description:o,error_uri:s}=n,a=UQr[i]||FT;return new a(o||"",s)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new FT(i)}}async function aN(t,e){var r,n;try{return await o6t(t,e)}catch(i){if(i instanceof BU||i instanceof OU)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await o6t(t,e);if(i instanceof NU)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await o6t(t,e);throw i}}async function o6t(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:o}){let s,a;try{s=await QEo(e,{resourceMetadataUrl:i},o),s.authorization_servers&&s.authorization_servers.length>0&&(a=s.authorization_servers[0])}catch{}a||(a=e);let c=await UEo(e,t,s),u=await VEo(a,{fetchFn:o}),d=await Promise.resolve(t.clientInformation());if(!d){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let g=await WEo(a,{metadata:u,clientMetadata:t.clientMetadata,fetchFn:o});await t.saveClientInformation(g),d=g}if(r!==void 0){let g=await t.codeVerifier(),A=await c6t(a,{metadata:u,clientInformation:d,authorizationCode:r,codeVerifier:g,redirectUri:t.redirectUrl,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(A),"AUTHORIZED"}let f=await t.tokens();if(f?.refresh_token)try{let g=await l6t(a,{metadata:u,clientInformation:d,refreshToken:f.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(g),"AUTHORIZED"}catch(g){if(!(!(g instanceof th)||g instanceof FT))throw g}let p=t.state?await t.state():void 0,{authorizationUrl:h,codeVerifier:m}=await $Eo(a,{metadata:u,clientInformation:d,state:p,redirectUrl:t.redirectUrl,scope:n||t.clientMetadata.scope,resource:c});return await t.saveCodeVerifier(m),await t.redirectToAuthorization(h),"REDIRECT"}async function UEo(t,e,r){let n=MQr(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!LQr({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function rme(t){let e=t.headers.get("WWW-Authenticate");if(!e)return{};let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let o=/resource_metadata="([^"]*)"/.exec(e),a=/scope="([^"]*)"/.exec(e),c;if(o)try{c=new URL(o[1])}catch{}let u=a?.[1]||void 0;return{resourceMetadataUrl:c,scope:u}}async function QEo(t,e,r=fetch){let n=await GEo(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return NQr.parse(await n.json())}async function a6t(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?a6t(t,void 0,r):void 0;throw n}}function qEo(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function qQr(t,e,r=fetch){return await a6t(t,{"MCP-Protocol-Version":e},r)}function HEo(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function GEo(t,e,r,n){var i,o;let s=new URL(t),a=(i=n?.protocolVersion)!==null&&i!==void 0?i:$J,c;if(n?.metadataUrl)c=new URL(n.metadataUrl);else{let d=qEo(e,s.pathname);c=new URL(d,(o=n?.metadataServerUrl)!==null&&o!==void 0?o:s),c.search=s.search}let u=await qQr(c,a,r);if(!n?.metadataUrl&&HEo(u,s.pathname)){let d=new URL(`/.well-known/${e}`,s);u=await qQr(d,a,r)}return u}function jEo(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let i=e.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${i}`,e.origin),type:"oidc"}),n.push({url:new URL(`${i}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function VEo(t,{fetchFn:e=fetch,protocolVersion:r=$J}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},i=jEo(t);for(let{url:o,type:s}of i){let a=await a6t(o,n,e);if(a){if(!a.ok){if(a.status>=400&&a.status<500)continue;throw new Error(`HTTP ${a.status} trying to load ${s==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`)}return s==="oauth"?e6t.parse(await a.json()):OQr.parse(await a.json())}}}async function $Eo(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:i,state:o,resource:s}){let a;if(e){if(a=new URL(e.authorization_endpoint),!e.response_types_supported.includes(n6t))throw new Error(`Incompatible auth server: does not support response type ${n6t}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(i6t))throw new Error(`Incompatible auth server: does not support code challenge method ${i6t}`)}else a=new URL("/authorize",t);let c=await Zbt(),u=c.code_verifier,d=c.code_challenge;return a.searchParams.set("response_type",n6t),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",d),a.searchParams.set("code_challenge_method",i6t),a.searchParams.set("redirect_uri",String(n)),o&&a.searchParams.set("state",o),i&&a.searchParams.set("scope",i),i?.includes("offline_access")&&a.searchParams.append("prompt","consent"),s&&a.searchParams.set("resource",s.href),{authorizationUrl:a,codeVerifier:u}}async function c6t(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:i,redirectUri:o,resource:s,addClientAuthentication:a,fetchFn:c}){var u;let d="authorization_code",f=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t);if(e?.grant_types_supported&&!e.grant_types_supported.includes(d))throw new Error(`Incompatible auth server: does not support grant type ${d}`);let p=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),h=new URLSearchParams({grant_type:d,code:n,code_verifier:i,redirect_uri:String(o)});if(a)a(p,h,t,e);else{let g=(u=e?.token_endpoint_auth_methods_supported)!==null&&u!==void 0?u:[],A=HQr(r,g);GQr(A,r,p,h)}s&&h.set("resource",s.href);let m=await(c??fetch)(f,{method:"POST",headers:p,body:h});if(!m.ok)throw await s6t(m);return t6t.parse(await m.json())}async function l6t(t,{metadata:e,clientInformation:r,refreshToken:n,resource:i,addClientAuthentication:o,fetchFn:s}){var a;let c="refresh_token",u;if(e){if(u=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(c))throw new Error(`Incompatible auth server: does not support grant type ${c}`)}else u=new URL("/token",t);let d=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),f=new URLSearchParams({grant_type:c,refresh_token:n});if(o)o(d,f,t,e);else{let h=(a=e?.token_endpoint_auth_methods_supported)!==null&&a!==void 0?a:[],m=HQr(r,h);GQr(m,r,d,f)}i&&f.set("resource",i.href);let p=await(s??fetch)(u,{method:"POST",headers:d,body:f});if(!p.ok)throw await s6t(p);return t6t.parse({refresh_token:n,...await p.json()})}async function WEo(t,{metadata:e,clientMetadata:r,fetchFn:n}){let i;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(e.registration_endpoint)}else i=new URL("/register",t);let o=await(n??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw await s6t(o);return PQr.parse(await o.json())}var F3,n6t,i6t,xOe=Z(()=>{RQr();JB();r6t();r6t();FQr();QQr();F3=class extends Error{constructor(e){super(e??"Unauthorized")}};n6t="code",i6t="S256"});var u6t,yX,jQr=Z(()=>{DQr();JB();xOe();u6t=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},yX=class{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch}async _authThenStart(){var e;if(!this._authProvider)throw new F3("No auth provider");let r;try{r=await aN(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new F3;return await this._startOrAuth()}async _commonHeaders(){var e;let r={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(r.Authorization=`Bearer ${n.access_token}`)}return this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion),new Headers({...r,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_startOrAuth(){var e,r,n;let i=(n=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&n!==void 0?n:fetch;return new Promise((o,s)=>{this._eventSource=new RU(this._url.href,{...this._eventSourceInit,fetch:async(a,c)=>{let u=await this._commonHeaders();u.set("Accept","text/event-stream");let d=await i(a,{...c,headers:u});if(d.status===401&&d.headers.has("www-authenticate")){let{resourceMetadataUrl:f,scope:p}=rme(d);this._resourceMetadataUrl=f,this._scope=p}return d}}),this._abortController=new AbortController,this._eventSource.onerror=a=>{var c;if(a.code===401&&this._authProvider){this._authThenStart().then(o,s);return}let u=new u6t(a.code,a.message,a);s(u),(c=this.onerror)===null||c===void 0||c.call(this,u)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",a=>{var c;let u=a;try{if(this._endpoint=new URL(u.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(d){s(d),(c=this.onerror)===null||c===void 0||c.call(this,d),this.close();return}o()}),this._eventSource.onmessage=a=>{var c,u;let d=a,f;try{f=KB.parse(JSON.parse(d.data))}catch(p){(c=this.onerror)===null||c===void 0||c.call(this,p);return}(u=this.onmessage)===null||u===void 0||u.call(this,f)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new F3("No auth provider");if(await aN(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new F3("Failed to authorize")}async close(){var e,r,n;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(e){var r,n,i;if(!this._endpoint)throw new Error("Not connected");try{let o=await this._commonHeaders();o.set("content-type","application/json");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},a=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,s);if(!a.ok){if(a.status===401&&this._authProvider){let{resourceMetadataUrl:u,scope:d}=rme(a);if(this._resourceMetadataUrl=u,this._scope=d,await aN(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new F3;return this.send(e)}let c=await a.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${a.status}): ${c}`)}}catch(o){throw(i=this.onerror)===null||i===void 0||i.call(this,o),o}}setProtocolVersion(e){this._protocolVersion=e}}});var SOe,VQr=Z(()=>{Hbt();SOe=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(o){i=vOe({onEvent:s=>{o.enqueue(s)},onError(s){e==="terminate"?o.error(s):typeof e=="function"&&e(s)},onRetry:r,onComment:n})},transform(o){i.feed(o)}})}}});var zEo,EX,cN,d6t=Z(()=>{JB();xOe();VQr();zEo={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},EX=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},cN=class{constructor(e,r){var n;this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._sessionId=r?.sessionId,this._reconnectionOptions=(n=r?.reconnectionOptions)!==null&&n!==void 0?n:zEo}async _authThenStart(){var e;if(!this._authProvider)throw new F3("No auth provider");let r;try{r=await aN(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new F3;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let r={};if(this._authProvider){let i=await this._authProvider.tokens();i&&(r.Authorization=`Bearer ${i.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,i;let{resumptionToken:o}=e;try{let s=await this._commonHeaders();s.set("Accept","text/event-stream"),o&&s.set("last-event-id",o);let a=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:s,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal});if(!a.ok){if(a.status===401&&this._authProvider)return await this._authThenStart();if(a.status===405)return;throw new EX(a.status,`Failed to open SSE stream: ${a.statusText}`)}this._handleSseStream(a.body,e,!0)}catch(s){throw(i=this.onerror)===null||i===void 0||i.call(this,s),s}}_getNextReconnectionDelay(e){let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,i=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),i)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,r=0){var n;let i=this._reconnectionOptions.maxRetries;if(i>0&&r>=i){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${i}) exceeded.`));return}let o=this._getNextReconnectionDelay(r);setTimeout(()=>{this._startOrAuthSse(e).catch(s=>{var a;(a=this.onerror)===null||a===void 0||a.call(this,new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(e,r+1)})},o)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:i,replayMessageId:o}=r,s;(async()=>{var c,u,d,f;try{let p=e.pipeThrough(new TextDecoderStream).pipeThrough(new SOe).getReader();for(;;){let{value:h,done:m}=await p.read();if(m)break;if(h.id&&(s=h.id,i?.(h.id)),!h.event||h.event==="message")try{let g=KB.parse(JSON.parse(h.data));o!==void 0&&she(g)&&(g.id=o),(c=this.onmessage)===null||c===void 0||c.call(this,g)}catch(g){(u=this.onerror)===null||u===void 0||u.call(this,g)}}}catch(p){if((d=this.onerror)===null||d===void 0||d.call(this,new Error(`SSE stream disconnected: ${p}`)),n&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:o},0)}catch(h){(f=this.onerror)===null||f===void 0||f.call(this,new Error(`Failed to reconnect: ${h instanceof Error?h.message:String(h)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new F3("No auth provider");if(await aN(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new F3("Failed to authorize")}async close(){var e,r;(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var n,i,o,s;try{let{resumptionToken:a,onresumptiontoken:c}=r||{};if(a){this._startOrAuthSse({resumptionToken:a,replayMessageId:_Ne(e)?e.id:void 0}).catch(A=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,A)});return}let u=await this._commonHeaders();u.set("content-type","application/json"),u.set("accept","application/json, text/event-stream");let d={...this._requestInit,method:"POST",headers:u,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},f=await((i=this._fetch)!==null&&i!==void 0?i:fetch)(this._url,d),p=f.headers.get("mcp-session-id");if(p&&(this._sessionId=p),!f.ok){if(f.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new EX(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:y,scope:E}=rme(f);if(this._resourceMetadataUrl=y,this._scope=E,await aN(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new F3;return this._hasCompletedAuthFlow=!0,this.send(e)}let A=await f.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${f.status}): ${A}`)}if(this._hasCompletedAuthFlow=!1,f.status===202){FMr(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(A=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,A)});return}let m=(Array.isArray(e)?e:[e]).filter(A=>"method"in A&&"id"in A&&A.id!==void 0).length>0,g=f.headers.get("content-type");if(m)if(g?.includes("text/event-stream"))this._handleSseStream(f.body,{onresumptiontoken:c},!1);else if(g?.includes("application/json")){let A=await f.json(),y=Array.isArray(A)?A.map(E=>KB.parse(E)):[KB.parse(A)];for(let E of y)(o=this.onmessage)===null||o===void 0||o.call(this,E)}else throw new EX(-1,`Unexpected content type: ${g}`)}catch(a){throw(s=this.onerror)===null||s===void 0||s.call(this,a),a}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n;if(this._sessionId)try{let i=await this._commonHeaders(),o={...this._requestInit,method:"DELETE",headers:i,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},s=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,o);if(!s.ok&&s.status!==405)throw new EX(s.status,`Failed to terminate session: ${s.statusText}`);this._sessionId=void 0}catch(i){throw(n=this.onerror)===null||n===void 0||n.call(this,i),i}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}}});import{readFile as YEo}from"node:fs/promises";var nme,ime,kU,f6t=Z(()=>{"use strict";Qle();xOe();ui();(function(t){t.CLI_CONNECT="cli_connect",t.PING="ping",t.GET_ACTIVE_FILE="get_active_file",t.GET_FILE_CONTENT="get_file_content",t.GET_SELECTED_TEXT="get_selected_text",t.SHOW_DIFF="show_diff"})(nme||(nme={}));ime=class extends Error{code;constructor(e,r){super(r),this.code=e}},kU=class{_websocket;_url;_authProvider;_websocketOptions;_WebSocket;_protocolVersion;_isClosed=!1;_specialIds=new Set;onclose;onerror;onmessage;sessionId;constructor(e,r){this._url=e,this._authProvider=r?.authProvider,this._websocketOptions=r?.websocketOptions,this._WebSocket=r?.WebSocket||ZM.default}async start(){if(this._isClosed)throw new Error(B.t("websocketClient.errors.transportClosed"));let e=null;if(this._authProvider)try{let i=await this._authProvider.tokens();i?.access_token&&(e=i.access_token)}catch(i){try{let o=await this._authProvider.clientInformation();if(o){let s=await this._authProvider.tokens();if(s?.refresh_token){let a=await l6t(this._url,{clientInformation:o,refreshToken:s.refresh_token,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(a),a?.access_token&&(e=a.access_token)}}}catch{if(this._authProvider.redirectToAuthorization){let s=this._authProvider.redirectUrl;throw await this._authProvider.redirectToAuthorization(typeof s=="string"?new URL(s):s),new Error(B.t("websocketClient.errors.unauthorizedOAuth"))}throw i}}let r={...this._websocketOptions?.headers};e&&(r.Authorization=`Bearer ${e}`),this._protocolVersion&&(r["MCP-Protocol-Version"]=this._protocolVersion);let n=new URL(this._url.toString());return n.protocol==="http:"?n.protocol="ws:":n.protocol==="https:"&&(n.protocol="wss:"),new Promise((i,o)=>{try{let s={headers:r};this._websocket=new this._WebSocket(n.toString(),s),this._websocket.on("open",()=>{i()}),this._websocket.on("error",a=>{let c=a.code!==void 0?a.code:void 0;o(new ime(c,`WebSocket error: ${a.message}`))}),this._websocket.on("message",async a=>{try{let c=a.toString(),u=JSON.parse(c);if(this._specialIds.has(Number(u.id))||u.type==="welcome")return;this.onmessage?.(await this._transformResponse(u))}catch(c){this.onerror?.(new Error(`Failed to parse WebSocket message: ${c instanceof Error?c.message:String(c)}`))}}),this._websocket.on("close",()=>{this._isClosed||(this._isClosed=!0,this.onclose?.())})}catch(s){o(new ime(void 0,`Failed to create WebSocket: ${s}`))}})}async finishAuth(e){if(!this._authProvider)throw new Error(B.t("websocketClient.errors.noAuthProvider"));try{let r=await this._authProvider.clientInformation();if(r){let n=this._authProvider.redirectUrl.toString(),i=await c6t(this._url,{clientInformation:r,authorizationCode:e,codeVerifier:await this._authProvider.codeVerifier(),redirectUri:n,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(i)}else throw new Error(B.t("websocketClient.errors.clientInfoNotAvailable"))}catch(r){throw new Error(`Failed to exchange authorization code for access token: ${r}`)}}async close(){this._isClosed=!0,this._websocket&&this._websocket.readyState===ZM.default.OPEN?this._websocket.close():this.onclose?.()}async send(e){if(this._isClosed)throw new Error(B.t("websocketClient.errors.transportClosed"));if(!this._websocket)throw new Error(B.t("websocketClient.errors.transportNotStarted"));if(this._websocket.readyState!==ZM.default.OPEN)throw new Error(B.t("websocketClient.errors.websocketNotOpen"));try{if(e.method==="notifications/initialized")return;let r=await this._transformRequest(e),n=JSON.stringify(r);this._websocket.send(n)}catch(r){throw new ime(void 0,`Failed to send message: ${r instanceof Error?r.message:String(r)}`)}}async _transformRequest(e){if(e.method==="initialize")return{type:nme.CLI_CONNECT,id:e.id,timestamp:Date.now(),payload:{clientInfo:{version:"0.3.21-beta.2",platform:process.platform,workingDirectory:process.cwd()}}};if(e.method==="tools/call"&&e.params?.name==="openDiff"){let{arguments:r}=e.params||{},{filePath:n,newContent:i}=r||{};return{type:nme.SHOW_DIFF,id:e.id,timestamp:Date.now(),payload:{originalText:await YEo(n,"utf8"),modifiedText:i}}}return e}async _transformResponse(e){if(e.type==="connection_ack")return{jsonrpc:"2.0",id:e.id,result:{protocolVersion:"2024-11-05",capabilities:{logging:{},prompts:{},resources:{},tools:{}},serverInfo:{name:"JetBrains Plugin Server",title:"JetBrains Plugin Server",version:"1.0.0"}}};if(e.type==="selection_changed"){let r=await this._getSelectedText();return{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0,selectedText:r}]}}}}return e.type==="active_file_changed"?{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0}]}}}:e}async _getSelectedText(){if(!this._websocket)return"";let e=performance.now();return this._specialIds.add(e),this._websocket.send(JSON.stringify({type:nme.GET_SELECTED_TEXT,id:e,timestamp:Date.now()})),new Promise((r,n)=>{this._websocket.once("message",i=>{try{let o=JSON.parse(i.toString());Number(o.id)===e&&(this._specialIds.delete(e),o.payload.success?r(o.payload.data.text):n(o.payload.error))}catch{r("")}})})}setProtocolVersion(e){this._protocolVersion=e}}});var $Qr,wOe,WQr=Z(()=>{"use strict";$Qr=Te(y_e(),1);ui();wOe=class{config;auth;redirectUrl="";clientMetadata={client_name:"iFlow CLI (Google ADC)",redirect_uris:[],grant_types:[],response_types:[],token_endpoint_auth_method:"none"};_clientInformation;constructor(e){this.config=e;let r=this.config?.oauth?.scopes;if(!r||r.length===0)throw new Error(B.t("mcp.auth.scopesRequired"));this.auth=new $Qr.GoogleAuth({scopes:r})}clientInformation(){return this._clientInformation}saveClientInformation(e){this._clientInformation=e}async tokens(){let r=await(await this.auth.getClient()).getAccessToken();if(!r.token){console.error(B.t("mcp.auth.failedToGetAccessToken"));return}return{access_token:r.token,token_type:"Bearer"}}saveTokens(e){}redirectToAuthorization(e){}saveCodeVerifier(e){}codeVerifier(){return""}}});import{execFile as KEo}from"node:child_process";import{promisify as JEo}from"node:util";import{platform as XEo}from"node:os";import{URL as ZEo}from"node:url";function e4o(t){let e;try{e=new ZEo(t)}catch{throw new Error(`Invalid URL: ${t}`)}if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error(`Unsafe protocol: ${e.protocol}. Only HTTP and HTTPS are allowed.`);if(/[\r\n\x00-\x1f]/.test(t))throw new Error("URL contains invalid characters")}async function YQr(t){e4o(t);let e=XEo(),r,n;switch(e){case"darwin":r="open",n=[t];break;case"win32":r="powershell.exe",n=["-NoProfile","-NonInteractive","-WindowStyle","Hidden","-Command",`Start-Process '${t.replace(/'/g,"''")}'`];break;case"linux":case"freebsd":case"openbsd":r="xdg-open",n=[t];break;default:throw new Error(`Unsupported platform: ${e}`)}let i={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};try{await zQr(r,n,i)}catch(o){if((e==="linux"||e==="freebsd"||e==="openbsd")&&r==="xdg-open"){let s=["gnome-open","kde-open","firefox","chromium","google-chrome"];for(let a of s)try{await zQr(a,[t],i);return}catch{continue}}throw new Error(`Failed to open browser: ${o instanceof Error?o.message:"Unknown error"}`)}}var zQr,KQr=Z(()=>{"use strict";zQr=JEo(KEo)});function Oo(t){return t instanceof Error&&"code"in t}function gr(t){if(t instanceof Error)return t.message;try{return String(t)}catch{return"Failed to get error details"}}function p6t(t){if(t&&typeof t=="object"&&"response"in t){let r=t4o(t);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new IOe(r.error.message);case 401:return new lN(r.error.message);case 403:return new TOe(r.error.message);default:}}return t}function t4o(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}var TOe,lN,IOe,Vu=Z(()=>{"use strict";TOe=class extends Error{},lN=class extends Error{},IOe=class extends Error{}});import{promises as vX}from"node:fs";import*as DOe from"node:path";import*as JQr from"node:os";var Hm,ROe=Z(()=>{"use strict";Vu();ui();Hm=class{static TOKEN_FILE="mcp-oauth-tokens.json";static CONFIG_DIR=".iflow";static getTokenFilePath(){let e=JQr.homedir();return DOe.join(e,this.CONFIG_DIR,this.TOKEN_FILE)}static async ensureConfigDir(){let e=DOe.dirname(this.getTokenFilePath());await vX.mkdir(e,{recursive:!0})}static async loadTokens(){let e=new Map;try{let r=this.getTokenFilePath(),n=await vX.readFile(r,"utf-8"),i=JSON.parse(n);for(let o of i)e.set(o.serverName,o)}catch(r){r.code!=="ENOENT"&&console.error(B.t("mcp.tokenStorage.errors.failedToLoadTokens",{error:gr(r)}))}return e}static async saveToken(e,r,n,i,o){await this.ensureConfigDir();let s=await this.loadTokens(),a={serverName:e,token:r,clientId:n,tokenUrl:i,mcpServerUrl:o,updatedAt:Date.now()};s.set(e,a);let c=Array.from(s.values()),u=this.getTokenFilePath();try{await vX.writeFile(u,JSON.stringify(c,null,2),{mode:384})}catch(d){throw console.error(B.t("mcp.tokenStorage.errors.failedToSaveToken",{error:gr(d)})),d}}static async getToken(e){return(await this.loadTokens()).get(e)||null}static async removeToken(e){let r=await this.loadTokens();if(r.delete(e)){let n=Array.from(r.values()),i=this.getTokenFilePath();try{n.length===0?await vX.unlink(i):await vX.writeFile(i,JSON.stringify(n,null,2),{mode:384})}catch(o){console.error(B.t("mcp.tokenStorage.errors.failedToRemoveToken",{error:gr(o)}))}}}static isTokenExpired(e){if(!e.expiresAt)return!1;let r=300*1e3;return Date.now()+r>=e.expiresAt}static async clearAllTokens(){try{let e=this.getTokenFilePath();await vX.unlink(e)}catch(e){e.code!=="ENOENT"&&console.error(B.t("mcp.tokenStorage.errors.failedToClearTokens",{error:gr(e)}))}}}});var Gm,BOe=Z(()=>{"use strict";Vu();ui();Gm=class{static buildWellKnownUrls(e){let r=new URL(e),n=`${r.protocol}//${r.host}`;return{protectedResource:new URL("/.well-known/oauth-protected-resource",n).toString(),authorizationServer:new URL("/.well-known/oauth-authorization-server",n).toString()}}static async fetchProtectedResourceMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch protected resource metadata from ${e}: ${gr(r)}`),null}}static async fetchAuthorizationServerMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch authorization server metadata from ${e}: ${gr(r)}`),null}}static metadataToOAuthConfig(e){return{authorizationUrl:e.authorization_endpoint,tokenUrl:e.token_endpoint,scopes:e.scopes_supported||[]}}static async discoverOAuthConfig(e){try{let r=this.buildWellKnownUrls(e),n=await this.fetchProtectedResourceMetadata(r.protectedResource);if(n?.authorization_servers?.length){let o=n.authorization_servers[0],s=new URL("/.well-known/oauth-authorization-server",o).toString(),a=await this.fetchAuthorizationServerMetadata(s);if(a){let c=this.metadataToOAuthConfig(a);return a.registration_endpoint&&console.log(B.t("mcp.oauth.discovery.dynamicRegistrationSupported"),a.registration_endpoint),c}}console.debug(`Trying OAuth discovery fallback at ${r.authorizationServer}`);let i=await this.fetchAuthorizationServerMetadata(r.authorizationServer);if(i){let o=this.metadataToOAuthConfig(i);return i.registration_endpoint&&console.log(B.t("mcp.oauth.discovery.dynamicRegistrationSupported"),i.registration_endpoint),o}return null}catch(r){return console.debug(`Failed to discover OAuth configuration: ${gr(r)}`),null}}static parseWWWAuthenticateHeader(e){let r=e.match(/resource_metadata="([^"]+)"/);return r?r[1]:null}static async discoverOAuthFromWWWAuthenticate(e){let r=this.parseWWWAuthenticateHeader(e);if(!r)return null;console.log(B.t("mcp.oauth.discovery.foundResourceMetadataUri",{uri:r}));let n=await this.fetchProtectedResourceMetadata(r);if(!n?.authorization_servers?.length)return null;let i=n.authorization_servers[0],o=new URL("/.well-known/oauth-authorization-server",i).toString(),s=await this.fetchAuthorizationServerMetadata(o);return s?(console.log(B.t("mcp.oauth.discovery.configDiscoveredFromWwwAuth")),this.metadataToOAuthConfig(s)):null}static extractBaseUrl(e){let r=new URL(e);return`${r.protocol}//${r.host}`}static isSSEEndpoint(e){return e.includes("/sse")||!e.includes("/mcp")}static buildResourceParameter(e){let r=new URL(e);return`${r.protocol}//${r.host}`}}});import*as XQr from"node:http";import*as ome from"node:crypto";import{URL as h6t}from"node:url";var bE,m6t=Z(()=>{"use strict";KQr();ROe();Vu();BOe();ui();bE=class{static REDIRECT_PORT=7777;static REDIRECT_PATH="/oauth/callback";static HTTP_OK=200;static HTTP_REDIRECT=302;static async registerClient(e,r){let i={client_name:"iFlow CLI MCP Client",redirect_uris:[r.redirectUri||`http://localhost:${this.REDIRECT_PORT}${this.REDIRECT_PATH}`],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"none",code_challenge_method:["S256"],scope:r.scopes?.join(" ")||""},o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok){let s=await o.text();throw new Error(B.t("mcp.auth.clientRegistrationFailed",{status:o.status,statusText:o.statusText,error:s}))}return await o.json()}static async discoverOAuthFromMCPServer(e){let r=Gm.extractBaseUrl(e);return Gm.discoverOAuthConfig(r)}static generatePKCEParams(){let e=ome.randomBytes(32).toString("base64url"),r=ome.createHash("sha256").update(e).digest("base64url"),n=ome.randomBytes(16).toString("base64url");return{codeVerifier:e,codeChallenge:r,state:n}}static async startCallbackServer(e){return new Promise((r,n)=>{let i=XQr.createServer(async(o,s)=>{try{let a=new h6t(o.url,`http://localhost:${this.REDIRECT_PORT}`);if(a.pathname!==this.REDIRECT_PATH){s.writeHead(404),s.end(B.t("mcp.ui.notFound"));return}let c=a.searchParams.get("code"),u=a.searchParams.get("state"),d=a.searchParams.get("error");if(d){s.writeHead(this.HTTP_OK,{"Content-Type":"text/html"}),s.end(`
|
|
926
|
+
`&&n++}}return[e,r]}var EOe,Hbt=Z(()=>{EOe=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}});function wEo(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Gbt(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Gbt).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Gbt(t.cause)}`:t.message:`${t}`}function wQr(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}function TEo(){let t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var COe,IQr,Jbt,Zs,Uh,Bd,LT,L3,DU,pX,bOe,_Oe,Hhe,gX,Ghe,sN,hX,AX,mX,Qhe,h5,jbt,Vbt,$bt,TQr,Wbt,zbt,qhe,Ybt,Kbt,RU,DQr=Z(()=>{Hbt();COe=class extends Event{constructor(e,r){var n,i;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(i=r?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(wQr(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(wQr(this),r)}};IQr=t=>{throw TypeError(t)},Jbt=(t,e,r)=>e.has(t)||IQr("Cannot "+r),Zs=(t,e,r)=>(Jbt(t,e,"read from private field"),r?r.call(t):e.get(t)),Uh=(t,e,r)=>e.has(t)?IQr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Bd=(t,e,r,n)=>(Jbt(t,e,"write to private field"),e.set(t,r),r),LT=(t,e,r)=>(Jbt(t,e,"access private method"),r),RU=class extends EventTarget{constructor(e,r){var n,i;super(),Uh(this,h5),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Uh(this,L3),Uh(this,DU),Uh(this,pX),Uh(this,bOe),Uh(this,_Oe),Uh(this,Hhe),Uh(this,gX),Uh(this,Ghe,null),Uh(this,sN),Uh(this,hX),Uh(this,AX,null),Uh(this,mX,null),Uh(this,Qhe,null),Uh(this,Vbt,async o=>{var s;Zs(this,hX).reset();let{body:a,redirected:c,status:u,headers:d}=o;if(u===204){LT(this,h5,qhe).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?Bd(this,pX,new URL(o.url)):Bd(this,pX,void 0),u!==200){LT(this,h5,qhe).call(this,`Non-200 status code (${u})`,u);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){LT(this,h5,qhe).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Zs(this,L3)===this.CLOSED)return;Bd(this,L3,this.OPEN);let f=new Event("open");if((s=Zs(this,Qhe))==null||s.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){LT(this,h5,qhe).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}let p=new TextDecoder,h=a.getReader(),m=!0;do{let{done:g,value:A}=await h.read();A&&Zs(this,hX).feed(p.decode(A,{stream:!g})),g&&(m=!1,Zs(this,hX).reset(),LT(this,h5,Ybt).call(this))}while(m)}),Uh(this,$bt,o=>{Bd(this,sN,void 0),!(o.name==="AbortError"||o.type==="aborted")&<(this,h5,Ybt).call(this,Gbt(o))}),Uh(this,Wbt,o=>{typeof o.id=="string"&&Bd(this,Ghe,o.id);let s=new MessageEvent(o.event||"message",{data:o.data,origin:Zs(this,pX)?Zs(this,pX).origin:Zs(this,DU).origin,lastEventId:o.id||""});Zs(this,mX)&&(!o.event||o.event==="message")&&Zs(this,mX).call(this,s),this.dispatchEvent(s)}),Uh(this,zbt,o=>{Bd(this,Hhe,o)}),Uh(this,Kbt,()=>{Bd(this,gX,void 0),Zs(this,L3)===this.CONNECTING&<(this,h5,jbt).call(this)});try{if(e instanceof URL)Bd(this,DU,e);else if(typeof e=="string")Bd(this,DU,new URL(e,TEo()));else throw new Error("Invalid URL")}catch{throw wEo("An invalid or illegal string was specified")}Bd(this,hX,vOe({onEvent:Zs(this,Wbt),onRetry:Zs(this,zbt)})),Bd(this,L3,this.CONNECTING),Bd(this,Hhe,3e3),Bd(this,_Oe,(n=r?.fetch)!=null?n:globalThis.fetch),Bd(this,bOe,(i=r?.withCredentials)!=null?i:!1),LT(this,h5,jbt).call(this)}get readyState(){return Zs(this,L3)}get url(){return Zs(this,DU).href}get withCredentials(){return Zs(this,bOe)}get onerror(){return Zs(this,AX)}set onerror(e){Bd(this,AX,e)}get onmessage(){return Zs(this,mX)}set onmessage(e){Bd(this,mX,e)}get onopen(){return Zs(this,Qhe)}set onopen(e){Bd(this,Qhe,e)}addEventListener(e,r,n){let i=r;super.addEventListener(e,i,n)}removeEventListener(e,r,n){let i=r;super.removeEventListener(e,i,n)}close(){Zs(this,gX)&&clearTimeout(Zs(this,gX)),Zs(this,L3)!==this.CLOSED&&(Zs(this,sN)&&Zs(this,sN).abort(),Bd(this,L3,this.CLOSED),Bd(this,sN,void 0))}};L3=new WeakMap,DU=new WeakMap,pX=new WeakMap,bOe=new WeakMap,_Oe=new WeakMap,Hhe=new WeakMap,gX=new WeakMap,Ghe=new WeakMap,sN=new WeakMap,hX=new WeakMap,AX=new WeakMap,mX=new WeakMap,Qhe=new WeakMap,h5=new WeakSet,jbt=function(){Bd(this,L3,this.CONNECTING),Bd(this,sN,new AbortController),Zs(this,_Oe)(Zs(this,DU),LT(this,h5,TQr).call(this)).then(Zs(this,Vbt)).catch(Zs(this,$bt))},Vbt=new WeakMap,$bt=new WeakMap,TQr=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Zs(this,Ghe)?{"Last-Event-ID":Zs(this,Ghe)}:void 0},cache:"no-store",signal:(t=Zs(this,sN))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Wbt=new WeakMap,zbt=new WeakMap,qhe=function(t,e){var r;Zs(this,L3)!==this.CLOSED&&Bd(this,L3,this.CLOSED);let n=new COe("error",{code:e,message:t});(r=Zs(this,AX))==null||r.call(this,n),this.dispatchEvent(n)},Ybt=function(t,e){var r;if(Zs(this,L3)===this.CLOSED)return;Bd(this,L3,this.CONNECTING);let n=new COe("error",{code:e,message:t});(r=Zs(this,AX))==null||r.call(this,n),this.dispatchEvent(n),Bd(this,gX,setTimeout(Zs(this,Kbt),Zs(this,Hhe)))},Kbt=new WeakMap,RU.CONNECTING=0,RU.OPEN=1,RU.CLOSED=2});async function IEo(t){return(await Xbt).getRandomValues(new Uint8Array(t))}async function DEo(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await IEo(t);for(let i=0;i<t;i++){let o=n[i]%e.length;r+=e[o]}return r}async function REo(t){return await DEo(t)}async function BEo(t){let e=await(await Xbt).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Zbt(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await REo(t),r=await BEo(e);return{code_verifier:e,code_challenge:r}}var Xbt,RQr=Z(()=>{Xbt=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto)});var og,NQr,e6t,NEo,OQr,t6t,kQr,BQr,OEo,kEo,PQr,LHa,FHa,r6t=Z(()=>{YB();og=oe.string().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:oe.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),oe.NEVER}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),NQr=oe.object({resource:oe.string().url(),authorization_servers:oe.array(og).optional(),jwks_uri:oe.string().url().optional(),scopes_supported:oe.array(oe.string()).optional(),bearer_methods_supported:oe.array(oe.string()).optional(),resource_signing_alg_values_supported:oe.array(oe.string()).optional(),resource_name:oe.string().optional(),resource_documentation:oe.string().optional(),resource_policy_uri:oe.string().url().optional(),resource_tos_uri:oe.string().url().optional(),tls_client_certificate_bound_access_tokens:oe.boolean().optional(),authorization_details_types_supported:oe.array(oe.string()).optional(),dpop_signing_alg_values_supported:oe.array(oe.string()).optional(),dpop_bound_access_tokens_required:oe.boolean().optional()}).passthrough(),e6t=oe.object({issuer:oe.string(),authorization_endpoint:og,token_endpoint:og,registration_endpoint:og.optional(),scopes_supported:oe.array(oe.string()).optional(),response_types_supported:oe.array(oe.string()),response_modes_supported:oe.array(oe.string()).optional(),grant_types_supported:oe.array(oe.string()).optional(),token_endpoint_auth_methods_supported:oe.array(oe.string()).optional(),token_endpoint_auth_signing_alg_values_supported:oe.array(oe.string()).optional(),service_documentation:og.optional(),revocation_endpoint:og.optional(),revocation_endpoint_auth_methods_supported:oe.array(oe.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:oe.array(oe.string()).optional(),introspection_endpoint:oe.string().optional(),introspection_endpoint_auth_methods_supported:oe.array(oe.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:oe.array(oe.string()).optional(),code_challenge_methods_supported:oe.array(oe.string()).optional()}).passthrough(),NEo=oe.object({issuer:oe.string(),authorization_endpoint:og,token_endpoint:og,userinfo_endpoint:og.optional(),jwks_uri:og,registration_endpoint:og.optional(),scopes_supported:oe.array(oe.string()).optional(),response_types_supported:oe.array(oe.string()),response_modes_supported:oe.array(oe.string()).optional(),grant_types_supported:oe.array(oe.string()).optional(),acr_values_supported:oe.array(oe.string()).optional(),subject_types_supported:oe.array(oe.string()),id_token_signing_alg_values_supported:oe.array(oe.string()),id_token_encryption_alg_values_supported:oe.array(oe.string()).optional(),id_token_encryption_enc_values_supported:oe.array(oe.string()).optional(),userinfo_signing_alg_values_supported:oe.array(oe.string()).optional(),userinfo_encryption_alg_values_supported:oe.array(oe.string()).optional(),userinfo_encryption_enc_values_supported:oe.array(oe.string()).optional(),request_object_signing_alg_values_supported:oe.array(oe.string()).optional(),request_object_encryption_alg_values_supported:oe.array(oe.string()).optional(),request_object_encryption_enc_values_supported:oe.array(oe.string()).optional(),token_endpoint_auth_methods_supported:oe.array(oe.string()).optional(),token_endpoint_auth_signing_alg_values_supported:oe.array(oe.string()).optional(),display_values_supported:oe.array(oe.string()).optional(),claim_types_supported:oe.array(oe.string()).optional(),claims_supported:oe.array(oe.string()).optional(),service_documentation:oe.string().optional(),claims_locales_supported:oe.array(oe.string()).optional(),ui_locales_supported:oe.array(oe.string()).optional(),claims_parameter_supported:oe.boolean().optional(),request_parameter_supported:oe.boolean().optional(),request_uri_parameter_supported:oe.boolean().optional(),require_request_uri_registration:oe.boolean().optional(),op_policy_uri:og.optional(),op_tos_uri:og.optional()}).passthrough(),OQr=NEo.merge(e6t.pick({code_challenge_methods_supported:!0})),t6t=oe.object({access_token:oe.string(),id_token:oe.string().optional(),token_type:oe.string(),expires_in:oe.number().optional(),scope:oe.string().optional(),refresh_token:oe.string().optional()}).strip(),kQr=oe.object({error:oe.string(),error_description:oe.string().optional(),error_uri:oe.string().optional()}),BQr=og.optional().or(oe.literal("").transform(()=>{})),OEo=oe.object({redirect_uris:oe.array(og),token_endpoint_auth_method:oe.string().optional(),grant_types:oe.array(oe.string()).optional(),response_types:oe.array(oe.string()).optional(),client_name:oe.string().optional(),client_uri:og.optional(),logo_uri:BQr,scope:oe.string().optional(),contacts:oe.array(oe.string()).optional(),tos_uri:BQr,policy_uri:oe.string().optional(),jwks_uri:og.optional(),jwks:oe.any().optional(),software_id:oe.string().optional(),software_version:oe.string().optional(),software_statement:oe.string().optional()}).strip(),kEo=oe.object({client_id:oe.string(),client_secret:oe.string().optional(),client_id_issued_at:oe.number().optional(),client_secret_expires_at:oe.number().optional()}).strip(),PQr=OEo.merge(kEo),LHa=oe.object({error:oe.string(),error_description:oe.string().optional()}).strip(),FHa=oe.object({token:oe.string(),token_type_hint:oe.string().optional()}).strip()});function MQr(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function LQr({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",o=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return i.startsWith(o)}var FQr=Z(()=>{});var th,jhe,BU,NU,OU,Vhe,$he,Whe,FT,zhe,Yhe,Khe,Jhe,Xhe,Zhe,eme,tme,UQr,QQr=Z(()=>{th=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},jhe=class extends th{};jhe.errorCode="invalid_request";BU=class extends th{};BU.errorCode="invalid_client";NU=class extends th{};NU.errorCode="invalid_grant";OU=class extends th{};OU.errorCode="unauthorized_client";Vhe=class extends th{};Vhe.errorCode="unsupported_grant_type";$he=class extends th{};$he.errorCode="invalid_scope";Whe=class extends th{};Whe.errorCode="access_denied";FT=class extends th{};FT.errorCode="server_error";zhe=class extends th{};zhe.errorCode="temporarily_unavailable";Yhe=class extends th{};Yhe.errorCode="unsupported_response_type";Khe=class extends th{};Khe.errorCode="unsupported_token_type";Jhe=class extends th{};Jhe.errorCode="invalid_token";Xhe=class extends th{};Xhe.errorCode="method_not_allowed";Zhe=class extends th{};Zhe.errorCode="too_many_requests";eme=class extends th{};eme.errorCode="invalid_client_metadata";tme=class extends th{};tme.errorCode="insufficient_scope";UQr={[jhe.errorCode]:jhe,[BU.errorCode]:BU,[NU.errorCode]:NU,[OU.errorCode]:OU,[Vhe.errorCode]:Vhe,[$he.errorCode]:$he,[Whe.errorCode]:Whe,[FT.errorCode]:FT,[zhe.errorCode]:zhe,[Yhe.errorCode]:Yhe,[Khe.errorCode]:Khe,[Jhe.errorCode]:Jhe,[Xhe.errorCode]:Xhe,[Zhe.errorCode]:Zhe,[eme.errorCode]:eme,[tme.errorCode]:tme}});function PEo(t){return["client_secret_basic","client_secret_post","none"].includes(t)}function HQr(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":"token_endpoint_auth_method"in t&&t.token_endpoint_auth_method&&PEo(t.token_endpoint_auth_method)&&e.includes(t.token_endpoint_auth_method)?t.token_endpoint_auth_method:r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function GQr(t,e,r,n){let{client_id:i,client_secret:o}=e;switch(t){case"client_secret_basic":MEo(i,o,r);return;case"client_secret_post":LEo(i,o,n);return;case"none":FEo(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function MEo(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function LEo(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function FEo(t,e){e.set("client_id",t)}async function s6t(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=kQr.parse(JSON.parse(r)),{error:i,error_description:o,error_uri:s}=n,a=UQr[i]||FT;return new a(o||"",s)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new FT(i)}}async function aN(t,e){var r,n;try{return await o6t(t,e)}catch(i){if(i instanceof BU||i instanceof OU)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await o6t(t,e);if(i instanceof NU)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await o6t(t,e);throw i}}async function o6t(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:o}){let s,a;try{s=await QEo(e,{resourceMetadataUrl:i},o),s.authorization_servers&&s.authorization_servers.length>0&&(a=s.authorization_servers[0])}catch{}a||(a=e);let c=await UEo(e,t,s),u=await VEo(a,{fetchFn:o}),d=await Promise.resolve(t.clientInformation());if(!d){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let g=await WEo(a,{metadata:u,clientMetadata:t.clientMetadata,fetchFn:o});await t.saveClientInformation(g),d=g}if(r!==void 0){let g=await t.codeVerifier(),A=await c6t(a,{metadata:u,clientInformation:d,authorizationCode:r,codeVerifier:g,redirectUri:t.redirectUrl,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(A),"AUTHORIZED"}let f=await t.tokens();if(f?.refresh_token)try{let g=await l6t(a,{metadata:u,clientInformation:d,refreshToken:f.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(g),"AUTHORIZED"}catch(g){if(!(!(g instanceof th)||g instanceof FT))throw g}let p=t.state?await t.state():void 0,{authorizationUrl:h,codeVerifier:m}=await $Eo(a,{metadata:u,clientInformation:d,state:p,redirectUrl:t.redirectUrl,scope:n||t.clientMetadata.scope,resource:c});return await t.saveCodeVerifier(m),await t.redirectToAuthorization(h),"REDIRECT"}async function UEo(t,e,r){let n=MQr(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!LQr({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function rme(t){let e=t.headers.get("WWW-Authenticate");if(!e)return{};let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let o=/resource_metadata="([^"]*)"/.exec(e),a=/scope="([^"]*)"/.exec(e),c;if(o)try{c=new URL(o[1])}catch{}let u=a?.[1]||void 0;return{resourceMetadataUrl:c,scope:u}}async function QEo(t,e,r=fetch){let n=await GEo(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return NQr.parse(await n.json())}async function a6t(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?a6t(t,void 0,r):void 0;throw n}}function qEo(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function qQr(t,e,r=fetch){return await a6t(t,{"MCP-Protocol-Version":e},r)}function HEo(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function GEo(t,e,r,n){var i,o;let s=new URL(t),a=(i=n?.protocolVersion)!==null&&i!==void 0?i:$J,c;if(n?.metadataUrl)c=new URL(n.metadataUrl);else{let d=qEo(e,s.pathname);c=new URL(d,(o=n?.metadataServerUrl)!==null&&o!==void 0?o:s),c.search=s.search}let u=await qQr(c,a,r);if(!n?.metadataUrl&&HEo(u,s.pathname)){let d=new URL(`/.well-known/${e}`,s);u=await qQr(d,a,r)}return u}function jEo(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let i=e.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${i}`,e.origin),type:"oidc"}),n.push({url:new URL(`${i}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function VEo(t,{fetchFn:e=fetch,protocolVersion:r=$J}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},i=jEo(t);for(let{url:o,type:s}of i){let a=await a6t(o,n,e);if(a){if(!a.ok){if(a.status>=400&&a.status<500)continue;throw new Error(`HTTP ${a.status} trying to load ${s==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`)}return s==="oauth"?e6t.parse(await a.json()):OQr.parse(await a.json())}}}async function $Eo(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:i,state:o,resource:s}){let a;if(e){if(a=new URL(e.authorization_endpoint),!e.response_types_supported.includes(n6t))throw new Error(`Incompatible auth server: does not support response type ${n6t}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(i6t))throw new Error(`Incompatible auth server: does not support code challenge method ${i6t}`)}else a=new URL("/authorize",t);let c=await Zbt(),u=c.code_verifier,d=c.code_challenge;return a.searchParams.set("response_type",n6t),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",d),a.searchParams.set("code_challenge_method",i6t),a.searchParams.set("redirect_uri",String(n)),o&&a.searchParams.set("state",o),i&&a.searchParams.set("scope",i),i?.includes("offline_access")&&a.searchParams.append("prompt","consent"),s&&a.searchParams.set("resource",s.href),{authorizationUrl:a,codeVerifier:u}}async function c6t(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:i,redirectUri:o,resource:s,addClientAuthentication:a,fetchFn:c}){var u;let d="authorization_code",f=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t);if(e?.grant_types_supported&&!e.grant_types_supported.includes(d))throw new Error(`Incompatible auth server: does not support grant type ${d}`);let p=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),h=new URLSearchParams({grant_type:d,code:n,code_verifier:i,redirect_uri:String(o)});if(a)a(p,h,t,e);else{let g=(u=e?.token_endpoint_auth_methods_supported)!==null&&u!==void 0?u:[],A=HQr(r,g);GQr(A,r,p,h)}s&&h.set("resource",s.href);let m=await(c??fetch)(f,{method:"POST",headers:p,body:h});if(!m.ok)throw await s6t(m);return t6t.parse(await m.json())}async function l6t(t,{metadata:e,clientInformation:r,refreshToken:n,resource:i,addClientAuthentication:o,fetchFn:s}){var a;let c="refresh_token",u;if(e){if(u=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(c))throw new Error(`Incompatible auth server: does not support grant type ${c}`)}else u=new URL("/token",t);let d=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),f=new URLSearchParams({grant_type:c,refresh_token:n});if(o)o(d,f,t,e);else{let h=(a=e?.token_endpoint_auth_methods_supported)!==null&&a!==void 0?a:[],m=HQr(r,h);GQr(m,r,d,f)}i&&f.set("resource",i.href);let p=await(s??fetch)(u,{method:"POST",headers:d,body:f});if(!p.ok)throw await s6t(p);return t6t.parse({refresh_token:n,...await p.json()})}async function WEo(t,{metadata:e,clientMetadata:r,fetchFn:n}){let i;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(e.registration_endpoint)}else i=new URL("/register",t);let o=await(n??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw await s6t(o);return PQr.parse(await o.json())}var F3,n6t,i6t,xOe=Z(()=>{RQr();JB();r6t();r6t();FQr();QQr();F3=class extends Error{constructor(e){super(e??"Unauthorized")}};n6t="code",i6t="S256"});var u6t,yX,jQr=Z(()=>{DQr();JB();xOe();u6t=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},yX=class{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch}async _authThenStart(){var e;if(!this._authProvider)throw new F3("No auth provider");let r;try{r=await aN(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new F3;return await this._startOrAuth()}async _commonHeaders(){var e;let r={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(r.Authorization=`Bearer ${n.access_token}`)}return this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion),new Headers({...r,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_startOrAuth(){var e,r,n;let i=(n=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&n!==void 0?n:fetch;return new Promise((o,s)=>{this._eventSource=new RU(this._url.href,{...this._eventSourceInit,fetch:async(a,c)=>{let u=await this._commonHeaders();u.set("Accept","text/event-stream");let d=await i(a,{...c,headers:u});if(d.status===401&&d.headers.has("www-authenticate")){let{resourceMetadataUrl:f,scope:p}=rme(d);this._resourceMetadataUrl=f,this._scope=p}return d}}),this._abortController=new AbortController,this._eventSource.onerror=a=>{var c;if(a.code===401&&this._authProvider){this._authThenStart().then(o,s);return}let u=new u6t(a.code,a.message,a);s(u),(c=this.onerror)===null||c===void 0||c.call(this,u)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",a=>{var c;let u=a;try{if(this._endpoint=new URL(u.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(d){s(d),(c=this.onerror)===null||c===void 0||c.call(this,d),this.close();return}o()}),this._eventSource.onmessage=a=>{var c,u;let d=a,f;try{f=KB.parse(JSON.parse(d.data))}catch(p){(c=this.onerror)===null||c===void 0||c.call(this,p);return}(u=this.onmessage)===null||u===void 0||u.call(this,f)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new F3("No auth provider");if(await aN(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new F3("Failed to authorize")}async close(){var e,r,n;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(e){var r,n,i;if(!this._endpoint)throw new Error("Not connected");try{let o=await this._commonHeaders();o.set("content-type","application/json");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},a=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,s);if(!a.ok){if(a.status===401&&this._authProvider){let{resourceMetadataUrl:u,scope:d}=rme(a);if(this._resourceMetadataUrl=u,this._scope=d,await aN(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new F3;return this.send(e)}let c=await a.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${a.status}): ${c}`)}}catch(o){throw(i=this.onerror)===null||i===void 0||i.call(this,o),o}}setProtocolVersion(e){this._protocolVersion=e}}});var SOe,VQr=Z(()=>{Hbt();SOe=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(o){i=vOe({onEvent:s=>{o.enqueue(s)},onError(s){e==="terminate"?o.error(s):typeof e=="function"&&e(s)},onRetry:r,onComment:n})},transform(o){i.feed(o)}})}}});var zEo,EX,cN,d6t=Z(()=>{JB();xOe();VQr();zEo={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},EX=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},cN=class{constructor(e,r){var n;this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._sessionId=r?.sessionId,this._reconnectionOptions=(n=r?.reconnectionOptions)!==null&&n!==void 0?n:zEo}async _authThenStart(){var e;if(!this._authProvider)throw new F3("No auth provider");let r;try{r=await aN(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new F3;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let r={};if(this._authProvider){let i=await this._authProvider.tokens();i&&(r.Authorization=`Bearer ${i.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,i;let{resumptionToken:o}=e;try{let s=await this._commonHeaders();s.set("Accept","text/event-stream"),o&&s.set("last-event-id",o);let a=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:s,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal});if(!a.ok){if(a.status===401&&this._authProvider)return await this._authThenStart();if(a.status===405)return;throw new EX(a.status,`Failed to open SSE stream: ${a.statusText}`)}this._handleSseStream(a.body,e,!0)}catch(s){throw(i=this.onerror)===null||i===void 0||i.call(this,s),s}}_getNextReconnectionDelay(e){let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,i=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),i)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,r=0){var n;let i=this._reconnectionOptions.maxRetries;if(i>0&&r>=i){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${i}) exceeded.`));return}let o=this._getNextReconnectionDelay(r);setTimeout(()=>{this._startOrAuthSse(e).catch(s=>{var a;(a=this.onerror)===null||a===void 0||a.call(this,new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(e,r+1)})},o)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:i,replayMessageId:o}=r,s;(async()=>{var c,u,d,f;try{let p=e.pipeThrough(new TextDecoderStream).pipeThrough(new SOe).getReader();for(;;){let{value:h,done:m}=await p.read();if(m)break;if(h.id&&(s=h.id,i?.(h.id)),!h.event||h.event==="message")try{let g=KB.parse(JSON.parse(h.data));o!==void 0&&she(g)&&(g.id=o),(c=this.onmessage)===null||c===void 0||c.call(this,g)}catch(g){(u=this.onerror)===null||u===void 0||u.call(this,g)}}}catch(p){if((d=this.onerror)===null||d===void 0||d.call(this,new Error(`SSE stream disconnected: ${p}`)),n&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:o},0)}catch(h){(f=this.onerror)===null||f===void 0||f.call(this,new Error(`Failed to reconnect: ${h instanceof Error?h.message:String(h)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new F3("No auth provider");if(await aN(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new F3("Failed to authorize")}async close(){var e,r;(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var n,i,o,s;try{let{resumptionToken:a,onresumptiontoken:c}=r||{};if(a){this._startOrAuthSse({resumptionToken:a,replayMessageId:_Ne(e)?e.id:void 0}).catch(A=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,A)});return}let u=await this._commonHeaders();u.set("content-type","application/json"),u.set("accept","application/json, text/event-stream");let d={...this._requestInit,method:"POST",headers:u,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},f=await((i=this._fetch)!==null&&i!==void 0?i:fetch)(this._url,d),p=f.headers.get("mcp-session-id");if(p&&(this._sessionId=p),!f.ok){if(f.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new EX(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:y,scope:E}=rme(f);if(this._resourceMetadataUrl=y,this._scope=E,await aN(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new F3;return this._hasCompletedAuthFlow=!0,this.send(e)}let A=await f.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${f.status}): ${A}`)}if(this._hasCompletedAuthFlow=!1,f.status===202){FMr(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(A=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,A)});return}let m=(Array.isArray(e)?e:[e]).filter(A=>"method"in A&&"id"in A&&A.id!==void 0).length>0,g=f.headers.get("content-type");if(m)if(g?.includes("text/event-stream"))this._handleSseStream(f.body,{onresumptiontoken:c},!1);else if(g?.includes("application/json")){let A=await f.json(),y=Array.isArray(A)?A.map(E=>KB.parse(E)):[KB.parse(A)];for(let E of y)(o=this.onmessage)===null||o===void 0||o.call(this,E)}else throw new EX(-1,`Unexpected content type: ${g}`)}catch(a){throw(s=this.onerror)===null||s===void 0||s.call(this,a),a}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n;if(this._sessionId)try{let i=await this._commonHeaders(),o={...this._requestInit,method:"DELETE",headers:i,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},s=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,o);if(!s.ok&&s.status!==405)throw new EX(s.status,`Failed to terminate session: ${s.statusText}`);this._sessionId=void 0}catch(i){throw(n=this.onerror)===null||n===void 0||n.call(this,i),i}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}}});import{readFile as YEo}from"node:fs/promises";var nme,ime,kU,f6t=Z(()=>{"use strict";Qle();xOe();ui();(function(t){t.CLI_CONNECT="cli_connect",t.PING="ping",t.GET_ACTIVE_FILE="get_active_file",t.GET_FILE_CONTENT="get_file_content",t.GET_SELECTED_TEXT="get_selected_text",t.SHOW_DIFF="show_diff"})(nme||(nme={}));ime=class extends Error{code;constructor(e,r){super(r),this.code=e}},kU=class{_websocket;_url;_authProvider;_websocketOptions;_WebSocket;_protocolVersion;_isClosed=!1;_specialIds=new Set;onclose;onerror;onmessage;sessionId;constructor(e,r){this._url=e,this._authProvider=r?.authProvider,this._websocketOptions=r?.websocketOptions,this._WebSocket=r?.WebSocket||ZM.default}async start(){if(this._isClosed)throw new Error(B.t("websocketClient.errors.transportClosed"));let e=null;if(this._authProvider)try{let i=await this._authProvider.tokens();i?.access_token&&(e=i.access_token)}catch(i){try{let o=await this._authProvider.clientInformation();if(o){let s=await this._authProvider.tokens();if(s?.refresh_token){let a=await l6t(this._url,{clientInformation:o,refreshToken:s.refresh_token,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(a),a?.access_token&&(e=a.access_token)}}}catch{if(this._authProvider.redirectToAuthorization){let s=this._authProvider.redirectUrl;throw await this._authProvider.redirectToAuthorization(typeof s=="string"?new URL(s):s),new Error(B.t("websocketClient.errors.unauthorizedOAuth"))}throw i}}let r={...this._websocketOptions?.headers};e&&(r.Authorization=`Bearer ${e}`),this._protocolVersion&&(r["MCP-Protocol-Version"]=this._protocolVersion);let n=new URL(this._url.toString());return n.protocol==="http:"?n.protocol="ws:":n.protocol==="https:"&&(n.protocol="wss:"),new Promise((i,o)=>{try{let s={headers:r};this._websocket=new this._WebSocket(n.toString(),s),this._websocket.on("open",()=>{i()}),this._websocket.on("error",a=>{let c=a.code!==void 0?a.code:void 0;o(new ime(c,`WebSocket error: ${a.message}`))}),this._websocket.on("message",async a=>{try{let c=a.toString(),u=JSON.parse(c);if(this._specialIds.has(Number(u.id))||u.type==="welcome")return;this.onmessage?.(await this._transformResponse(u))}catch(c){this.onerror?.(new Error(`Failed to parse WebSocket message: ${c instanceof Error?c.message:String(c)}`))}}),this._websocket.on("close",()=>{this._isClosed||(this._isClosed=!0,this.onclose?.())})}catch(s){o(new ime(void 0,`Failed to create WebSocket: ${s}`))}})}async finishAuth(e){if(!this._authProvider)throw new Error(B.t("websocketClient.errors.noAuthProvider"));try{let r=await this._authProvider.clientInformation();if(r){let n=this._authProvider.redirectUrl.toString(),i=await c6t(this._url,{clientInformation:r,authorizationCode:e,codeVerifier:await this._authProvider.codeVerifier(),redirectUri:n,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(i)}else throw new Error(B.t("websocketClient.errors.clientInfoNotAvailable"))}catch(r){throw new Error(`Failed to exchange authorization code for access token: ${r}`)}}async close(){this._isClosed=!0,this._websocket&&this._websocket.readyState===ZM.default.OPEN?this._websocket.close():this.onclose?.()}async send(e){if(this._isClosed)throw new Error(B.t("websocketClient.errors.transportClosed"));if(!this._websocket)throw new Error(B.t("websocketClient.errors.transportNotStarted"));if(this._websocket.readyState!==ZM.default.OPEN)throw new Error(B.t("websocketClient.errors.websocketNotOpen"));try{if(e.method==="notifications/initialized")return;let r=await this._transformRequest(e),n=JSON.stringify(r);this._websocket.send(n)}catch(r){throw new ime(void 0,`Failed to send message: ${r instanceof Error?r.message:String(r)}`)}}async _transformRequest(e){if(e.method==="initialize")return{type:nme.CLI_CONNECT,id:e.id,timestamp:Date.now(),payload:{clientInfo:{version:"0.3.21",platform:process.platform,workingDirectory:process.cwd()}}};if(e.method==="tools/call"&&e.params?.name==="openDiff"){let{arguments:r}=e.params||{},{filePath:n,newContent:i}=r||{};return{type:nme.SHOW_DIFF,id:e.id,timestamp:Date.now(),payload:{originalText:await YEo(n,"utf8"),modifiedText:i}}}return e}async _transformResponse(e){if(e.type==="connection_ack")return{jsonrpc:"2.0",id:e.id,result:{protocolVersion:"2024-11-05",capabilities:{logging:{},prompts:{},resources:{},tools:{}},serverInfo:{name:"JetBrains Plugin Server",title:"JetBrains Plugin Server",version:"1.0.0"}}};if(e.type==="selection_changed"){let r=await this._getSelectedText();return{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0,selectedText:r}]}}}}return e.type==="active_file_changed"?{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0}]}}}:e}async _getSelectedText(){if(!this._websocket)return"";let e=performance.now();return this._specialIds.add(e),this._websocket.send(JSON.stringify({type:nme.GET_SELECTED_TEXT,id:e,timestamp:Date.now()})),new Promise((r,n)=>{this._websocket.once("message",i=>{try{let o=JSON.parse(i.toString());Number(o.id)===e&&(this._specialIds.delete(e),o.payload.success?r(o.payload.data.text):n(o.payload.error))}catch{r("")}})})}setProtocolVersion(e){this._protocolVersion=e}}});var $Qr,wOe,WQr=Z(()=>{"use strict";$Qr=Te(y_e(),1);ui();wOe=class{config;auth;redirectUrl="";clientMetadata={client_name:"iFlow CLI (Google ADC)",redirect_uris:[],grant_types:[],response_types:[],token_endpoint_auth_method:"none"};_clientInformation;constructor(e){this.config=e;let r=this.config?.oauth?.scopes;if(!r||r.length===0)throw new Error(B.t("mcp.auth.scopesRequired"));this.auth=new $Qr.GoogleAuth({scopes:r})}clientInformation(){return this._clientInformation}saveClientInformation(e){this._clientInformation=e}async tokens(){let r=await(await this.auth.getClient()).getAccessToken();if(!r.token){console.error(B.t("mcp.auth.failedToGetAccessToken"));return}return{access_token:r.token,token_type:"Bearer"}}saveTokens(e){}redirectToAuthorization(e){}saveCodeVerifier(e){}codeVerifier(){return""}}});import{execFile as KEo}from"node:child_process";import{promisify as JEo}from"node:util";import{platform as XEo}from"node:os";import{URL as ZEo}from"node:url";function e4o(t){let e;try{e=new ZEo(t)}catch{throw new Error(`Invalid URL: ${t}`)}if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error(`Unsafe protocol: ${e.protocol}. Only HTTP and HTTPS are allowed.`);if(/[\r\n\x00-\x1f]/.test(t))throw new Error("URL contains invalid characters")}async function YQr(t){e4o(t);let e=XEo(),r,n;switch(e){case"darwin":r="open",n=[t];break;case"win32":r="powershell.exe",n=["-NoProfile","-NonInteractive","-WindowStyle","Hidden","-Command",`Start-Process '${t.replace(/'/g,"''")}'`];break;case"linux":case"freebsd":case"openbsd":r="xdg-open",n=[t];break;default:throw new Error(`Unsupported platform: ${e}`)}let i={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};try{await zQr(r,n,i)}catch(o){if((e==="linux"||e==="freebsd"||e==="openbsd")&&r==="xdg-open"){let s=["gnome-open","kde-open","firefox","chromium","google-chrome"];for(let a of s)try{await zQr(a,[t],i);return}catch{continue}}throw new Error(`Failed to open browser: ${o instanceof Error?o.message:"Unknown error"}`)}}var zQr,KQr=Z(()=>{"use strict";zQr=JEo(KEo)});function Oo(t){return t instanceof Error&&"code"in t}function gr(t){if(t instanceof Error)return t.message;try{return String(t)}catch{return"Failed to get error details"}}function p6t(t){if(t&&typeof t=="object"&&"response"in t){let r=t4o(t);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new IOe(r.error.message);case 401:return new lN(r.error.message);case 403:return new TOe(r.error.message);default:}}return t}function t4o(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}var TOe,lN,IOe,Vu=Z(()=>{"use strict";TOe=class extends Error{},lN=class extends Error{},IOe=class extends Error{}});import{promises as vX}from"node:fs";import*as DOe from"node:path";import*as JQr from"node:os";var Hm,ROe=Z(()=>{"use strict";Vu();ui();Hm=class{static TOKEN_FILE="mcp-oauth-tokens.json";static CONFIG_DIR=".iflow";static getTokenFilePath(){let e=JQr.homedir();return DOe.join(e,this.CONFIG_DIR,this.TOKEN_FILE)}static async ensureConfigDir(){let e=DOe.dirname(this.getTokenFilePath());await vX.mkdir(e,{recursive:!0})}static async loadTokens(){let e=new Map;try{let r=this.getTokenFilePath(),n=await vX.readFile(r,"utf-8"),i=JSON.parse(n);for(let o of i)e.set(o.serverName,o)}catch(r){r.code!=="ENOENT"&&console.error(B.t("mcp.tokenStorage.errors.failedToLoadTokens",{error:gr(r)}))}return e}static async saveToken(e,r,n,i,o){await this.ensureConfigDir();let s=await this.loadTokens(),a={serverName:e,token:r,clientId:n,tokenUrl:i,mcpServerUrl:o,updatedAt:Date.now()};s.set(e,a);let c=Array.from(s.values()),u=this.getTokenFilePath();try{await vX.writeFile(u,JSON.stringify(c,null,2),{mode:384})}catch(d){throw console.error(B.t("mcp.tokenStorage.errors.failedToSaveToken",{error:gr(d)})),d}}static async getToken(e){return(await this.loadTokens()).get(e)||null}static async removeToken(e){let r=await this.loadTokens();if(r.delete(e)){let n=Array.from(r.values()),i=this.getTokenFilePath();try{n.length===0?await vX.unlink(i):await vX.writeFile(i,JSON.stringify(n,null,2),{mode:384})}catch(o){console.error(B.t("mcp.tokenStorage.errors.failedToRemoveToken",{error:gr(o)}))}}}static isTokenExpired(e){if(!e.expiresAt)return!1;let r=300*1e3;return Date.now()+r>=e.expiresAt}static async clearAllTokens(){try{let e=this.getTokenFilePath();await vX.unlink(e)}catch(e){e.code!=="ENOENT"&&console.error(B.t("mcp.tokenStorage.errors.failedToClearTokens",{error:gr(e)}))}}}});var Gm,BOe=Z(()=>{"use strict";Vu();ui();Gm=class{static buildWellKnownUrls(e){let r=new URL(e),n=`${r.protocol}//${r.host}`;return{protectedResource:new URL("/.well-known/oauth-protected-resource",n).toString(),authorizationServer:new URL("/.well-known/oauth-authorization-server",n).toString()}}static async fetchProtectedResourceMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch protected resource metadata from ${e}: ${gr(r)}`),null}}static async fetchAuthorizationServerMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch authorization server metadata from ${e}: ${gr(r)}`),null}}static metadataToOAuthConfig(e){return{authorizationUrl:e.authorization_endpoint,tokenUrl:e.token_endpoint,scopes:e.scopes_supported||[]}}static async discoverOAuthConfig(e){try{let r=this.buildWellKnownUrls(e),n=await this.fetchProtectedResourceMetadata(r.protectedResource);if(n?.authorization_servers?.length){let o=n.authorization_servers[0],s=new URL("/.well-known/oauth-authorization-server",o).toString(),a=await this.fetchAuthorizationServerMetadata(s);if(a){let c=this.metadataToOAuthConfig(a);return a.registration_endpoint&&console.log(B.t("mcp.oauth.discovery.dynamicRegistrationSupported"),a.registration_endpoint),c}}console.debug(`Trying OAuth discovery fallback at ${r.authorizationServer}`);let i=await this.fetchAuthorizationServerMetadata(r.authorizationServer);if(i){let o=this.metadataToOAuthConfig(i);return i.registration_endpoint&&console.log(B.t("mcp.oauth.discovery.dynamicRegistrationSupported"),i.registration_endpoint),o}return null}catch(r){return console.debug(`Failed to discover OAuth configuration: ${gr(r)}`),null}}static parseWWWAuthenticateHeader(e){let r=e.match(/resource_metadata="([^"]+)"/);return r?r[1]:null}static async discoverOAuthFromWWWAuthenticate(e){let r=this.parseWWWAuthenticateHeader(e);if(!r)return null;console.log(B.t("mcp.oauth.discovery.foundResourceMetadataUri",{uri:r}));let n=await this.fetchProtectedResourceMetadata(r);if(!n?.authorization_servers?.length)return null;let i=n.authorization_servers[0],o=new URL("/.well-known/oauth-authorization-server",i).toString(),s=await this.fetchAuthorizationServerMetadata(o);return s?(console.log(B.t("mcp.oauth.discovery.configDiscoveredFromWwwAuth")),this.metadataToOAuthConfig(s)):null}static extractBaseUrl(e){let r=new URL(e);return`${r.protocol}//${r.host}`}static isSSEEndpoint(e){return e.includes("/sse")||!e.includes("/mcp")}static buildResourceParameter(e){let r=new URL(e);return`${r.protocol}//${r.host}`}}});import*as XQr from"node:http";import*as ome from"node:crypto";import{URL as h6t}from"node:url";var bE,m6t=Z(()=>{"use strict";KQr();ROe();Vu();BOe();ui();bE=class{static REDIRECT_PORT=7777;static REDIRECT_PATH="/oauth/callback";static HTTP_OK=200;static HTTP_REDIRECT=302;static async registerClient(e,r){let i={client_name:"iFlow CLI MCP Client",redirect_uris:[r.redirectUri||`http://localhost:${this.REDIRECT_PORT}${this.REDIRECT_PATH}`],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"none",code_challenge_method:["S256"],scope:r.scopes?.join(" ")||""},o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok){let s=await o.text();throw new Error(B.t("mcp.auth.clientRegistrationFailed",{status:o.status,statusText:o.statusText,error:s}))}return await o.json()}static async discoverOAuthFromMCPServer(e){let r=Gm.extractBaseUrl(e);return Gm.discoverOAuthConfig(r)}static generatePKCEParams(){let e=ome.randomBytes(32).toString("base64url"),r=ome.createHash("sha256").update(e).digest("base64url"),n=ome.randomBytes(16).toString("base64url");return{codeVerifier:e,codeChallenge:r,state:n}}static async startCallbackServer(e){return new Promise((r,n)=>{let i=XQr.createServer(async(o,s)=>{try{let a=new h6t(o.url,`http://localhost:${this.REDIRECT_PORT}`);if(a.pathname!==this.REDIRECT_PATH){s.writeHead(404),s.end(B.t("mcp.ui.notFound"));return}let c=a.searchParams.get("code"),u=a.searchParams.get("state"),d=a.searchParams.get("error");if(d){s.writeHead(this.HTTP_OK,{"Content-Type":"text/html"}),s.end(`
|
|
927
927
|
<html>
|
|
928
928
|
<body>
|
|
929
929
|
<h1>${B.t("mcp.ui.authenticationFailed")}</h1>
|
|
@@ -4525,7 +4525,7 @@ ${Le.description}`:Le.subject||Le.description||"Thinking...",[]),ye=(0,sa.useCal
|
|
|
4525
4525
|
`,e-1),[i,o]=Jra(r);return{line:n===-1?i:t.slice(0,n+1).match(/\n/g).length+i,column:e-n-1+o}}function ZJt(t,e,r){if(typeof t!="string")throw new TypeError("Text parameter should be a string");if(!Number.isInteger(e))throw new TypeError("Index parameter should be an integer");if(e<0||e>t.length)throw new RangeError("Index out of bounds");return Xra(t,e,r)}var Zra=t=>`\\u{${t.codePointAt(0).toString(16)}}`,eXt=class t extends Error{name="JSONError";fileName;#e;#t;#r;#n;#i;constructor(e){if(typeof e=="string")super(),this.#r=e;else{let{jsonParseError:r,fileName:n,input:i}=e;super(void 0,{cause:r}),this.#e=i,this.#t=r,this.fileName=n}Error.captureStackTrace?.(this,t)}get message(){this.#r??=`${tna(this.#t.message)}${this.#e===""?" while parsing empty string":""}`;let{codeFrame:e}=this;return`${this.#r}${this.fileName?` in ${this.fileName}`:""}${e?`
|
|
4526
4526
|
|
|
4527
4527
|
${e}
|
|
4528
|
-
`:""}`}set message(e){this.#r=e}#o(e){if(!this.#t)return;let r=this.#e,n=ena(r,this.#t.message);if(n)return(0,vei.codeFrameColumns)(r,{start:n},{highlightCode:e})}get codeFrame(){return this.#n??=this.#o(!0),this.#n}get rawCodeFrame(){return this.#i??=this.#o(!1),this.#i}},ena=(t,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:n,line:i,column:o}=r.groups;return i&&o?{line:Number(i),column:Number(o)}:ZJt(t,Number(n),{oneBased:!0})},tna=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${Zra(n)})`);function tXt(t,e,r){typeof e=="string"&&(r=e,e=void 0);try{return JSON.parse(t,e)}catch(n){throw new eXt({jsonParseError:n,fileName:r,input:t})}}var Rti=Te(Iti(),1);import{fileURLToPath as xia}from"node:url";function Dti(t){return t instanceof URL?xia(t):t}var Tia=t=>wia.resolve(Dti(t)??".","package.json"),Iia=(t,e)=>{let r=typeof t=="string"?tXt(t):t;return e&&(0,Rti.default)(r),r};async function Bti({cwd:t,normalize:e=!0}={}){let r=await Sia.readFile(Tia(t),"utf8");return Iia(r,e)}async function Nti(t){let e=await YZn("package.json",t);if(e)return{packageJson:await Bti({...t,cwd:Dia.dirname(e)}),path:e}}import{fileURLToPath as Ria}from"url";import Bia from"path";var Nia=Ria(import.meta.url),Oia=Bia.dirname(Nia),ott;async function OP(){if(ott)return ott;let t=await Nti({cwd:Oia});if(t)return ott=t.packageJson,ott}async function kP(){let t=await OP();return"0.3.21
|
|
4528
|
+
`:""}`}set message(e){this.#r=e}#o(e){if(!this.#t)return;let r=this.#e,n=ena(r,this.#t.message);if(n)return(0,vei.codeFrameColumns)(r,{start:n},{highlightCode:e})}get codeFrame(){return this.#n??=this.#o(!0),this.#n}get rawCodeFrame(){return this.#i??=this.#o(!1),this.#i}},ena=(t,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:n,line:i,column:o}=r.groups;return i&&o?{line:Number(i),column:Number(o)}:ZJt(t,Number(n),{oneBased:!0})},tna=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${Zra(n)})`);function tXt(t,e,r){typeof e=="string"&&(r=e,e=void 0);try{return JSON.parse(t,e)}catch(n){throw new eXt({jsonParseError:n,fileName:r,input:t})}}var Rti=Te(Iti(),1);import{fileURLToPath as xia}from"node:url";function Dti(t){return t instanceof URL?xia(t):t}var Tia=t=>wia.resolve(Dti(t)??".","package.json"),Iia=(t,e)=>{let r=typeof t=="string"?tXt(t):t;return e&&(0,Rti.default)(r),r};async function Bti({cwd:t,normalize:e=!0}={}){let r=await Sia.readFile(Tia(t),"utf8");return Iia(r,e)}async function Nti(t){let e=await YZn("package.json",t);if(e)return{packageJson:await Bti({...t,cwd:Dia.dirname(e)}),path:e}}import{fileURLToPath as Ria}from"url";import Bia from"path";var Nia=Ria(import.meta.url),Oia=Bia.dirname(Nia),ott;async function OP(){if(ott)return ott;let t=await Nti({cwd:Oia});if(t)return ott=t.packageJson,ott}async function kP(){let t=await OP();return"0.3.21"}Ps();qt();import Yj from"node:process";var Oti={name:"about",description:B.t("command.about"),kind:"built-in",action:async t=>{let e=Yj.platform,r=B.t("aboutCommand.noSandbox");Yj.env.SANDBOX&&Yj.env.SANDBOX!=="sandbox-exec"?r=Yj.env.SANDBOX:Yj.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${Yj.env.SEATBELT_PROFILE||B.t("aboutCommand.unknown")})`);let n=t.services.config?.getModel()||B.t("aboutCommand.unknown"),i=await kP(),o=t.services.settings.merged.selectedAuthType||"",s=Yj.env.GOOGLE_CLOUD_PROJECT||"",a={type:"about",cliVersion:i,osVersion:e,sandboxEnv:r,modelVersion:n,selectedAuthType:o,gcpProject:s};t.ui.addItem(a,Date.now())}};qt();qt();Ps();var att="\x1B[32m";var Pti="\x1B[31m",PP="\x1B[36m",Ug="\x1B[90m";var Dc="\x1B[0m";function stt(t,e,r,n=!1){let i="";if(t.length===0)return i="\u{1F534} ",`${i}${e}
|
|
4529
4529
|
${Pti}${B.t("agentsCommand.list.noAgentsFound")}${Dc}
|
|
4530
4530
|
`;i="\u{1F7E2} ";let o=`${i}${e}
|
|
4531
4531
|
`;for(let s of t)n?o+=kia(s):o+=`${att}- ${s.agentType}${Dc}
|
|
@@ -5624,7 +5624,7 @@ ${B.t("gemini.errors.criticalUnhandledRejection")}
|
|
|
5624
5624
|
=========================================
|
|
5625
5625
|
${B.t("gemini.errors.reason",{reason:e})}${e instanceof Error&&e.stack?`
|
|
5626
5626
|
${B.t("gemini.errors.stackTrace")}
|
|
5627
|
-
${e.stack}`:""}`;Us.emit("log-error",n),t||(t=!0,Us.emit("open-debug-console"))})}function xAa(){console.log(B.t("gemini.crashDiagnosticsEnabled")),process.setUncaughtExceptionCaptureCallback(t=>{let e={timestamp:new Date().toISOString(),error:{name:t.name,message:t.message,stack:t.stack},memory:process.memoryUsage(),pid:process.pid,cwd:process.cwd(),nodeVersion:process.version,platform:process.platform,arch:process.arch,uptime:process.uptime(),env:{NODE_ENV:"production",SANDBOX:process.env.SANDBOX,CLI_VERSION:"0.3.21
|
|
5627
|
+
${e.stack}`:""}`;Us.emit("log-error",n),t||(t=!0,Us.emit("open-debug-console"))})}function xAa(){console.log(B.t("gemini.crashDiagnosticsEnabled")),process.setUncaughtExceptionCaptureCallback(t=>{let e={timestamp:new Date().toISOString(),error:{name:t.name,message:t.message,stack:t.stack},memory:process.memoryUsage(),pid:process.pid,cwd:process.cwd(),nodeVersion:process.version,platform:process.platform,arch:process.arch,uptime:process.uptime(),env:{NODE_ENV:"production",SANDBOX:process.env.SANDBOX,CLI_VERSION:"0.3.21"}},r=`crash-${Date.now()}-${process.pid}.json`,n=hAa.join(process.cwd(),r);try{EAa.writeFileSync(n,JSON.stringify(e,null,2)),console.error(B.t("gemini.crashDetected",{crashFilePath:n})),console.error(B.t("gemini.coreDumpWillBeGenerated"))}catch(i){console.error(B.t("gemini.failedToWriteCrashFile"),i)}process.abort()}),process.on("warning",t=>{console.warn(B.t("gemini.debug.nodejsWarning"),{name:t.name,message:t.message,stack:t.stack})}),process.on("unhandledRejection",(t,e)=>{console.error(B.t("gemini.debug.unhandledPromiseRejectionDetected"),{reason:t,promise:e.toString()})})}async function T2i(){_Aa();let t=process.cwd(),e=pl(t);if(!e.user.settings.cna){let m=await HBe();m&&e.setValue("User","cna",m)}if(await Cmi(),e.errors.length>0){for(let m of e.errors){let g=B.t("gemini.errorInFile",{path:m.path,message:m.message});process.env.NO_COLOR||(g=`\x1B[31m${g}\x1B[0m`),console.error(g),console.error(B.t("gemini.pleaseFixFileAndTryAgain",{path:m.path}))}process.exit(1)}let r=await Mnt(),n=typeof r.resume=="string";(!!r.prompt&&!r.promptInteractive&&!r.continue&&(!r.resume||n)||r.experimentalAcp)&&(process.env.IFLOW_NON_INTERACTIVE="true");let o=JP(t),s=n&&typeof r.resume=="string"?r.resume:E0.generateSessionId(),a=await QV(e.merged,o,s,r);if(B.changeLanguage(a.getLanguage()),a.getDebugMode()&&xAa(),AAa.setDefaultResultOrder(vAa(e.merged.dnsResolutionOrder)),r.promptInteractive&&!process.stdin.isTTY&&(console.error(B.t("gemini.errors.promptInteractiveFlagNotSupported")),process.exit(1)),a.getListExtensions()){console.debug(B.t("gemini.installedExtensions"));for(let m of o)console.debug(`- ${m.config.name}`);process.exit(0)}if(r._&&r._[0]==="agent"){let{agentCommand:m}=await Promise.resolve().then(()=>(_rr(),mmi)),g=(await Promise.resolve().then(()=>(Hnr(),qnr))).default;await g().scriptName("iflow").command(m).help().version(!1).parse(),process.exit(0)}if(r._&&r._[0]==="commands"){let{commandsCommand:m}=await Promise.resolve().then(()=>(brr(),tmi)),g=(await Promise.resolve().then(()=>(Hnr(),qnr))).default;await g().scriptName("iflow").command(m).help().version(!1).parse(),process.exit(0)}if(e.merged.selectedAuthType||process.env.CLOUD_SHELL==="true"&&e.setValue("User","selectedAuthType",zt.CLOUD_SHELL),hdi(a.getDebugMode()),await a.initialize(),Vs.loadCustomThemes(e.merged.customThemes),e.merged.theme&&(Vs.setActiveTheme(e.merged.theme)||console.warn(B.t("gemini.themeNotFound",{theme:e.merged.theme}))),!process.env.SANDBOX){let m=e.merged.autoConfigureMaxOldSpaceSize?bAa(a):[],g=a.getSandbox();if(g){if(e.merged.selectedAuthType&&!e.merged.useExternalAuth)try{let A=wV(e.merged.selectedAuthType);if(A)throw new Error(A);await a.refreshAuth(e.merged.selectedAuthType,{apiKey:e.merged.apiKey,baseUrl:e.merged.baseUrl,modelName:e.merged.modelName})}catch(A){console.error(B.t("gemini.errorAuthenticating"),A),process.exit(1)}await mgi(g,m,a),process.exit(0)}else m.length>0&&(await CAa(m),process.exit(0))}if(e.merged.selectedAuthType===zt.LOGIN_WITH_IFLOW&&a.isBrowserLaunchSuppressed()&&await EL(e.merged.selectedAuthType,a),a.getExperimentalAcp())return a.getAcpPort()?await Fgi(a,e,o,r,a.getAcpPort()):Bgi(a,e,o,r);let c=a.getQuestion(),u=[...await ggi(),...await ygi(t)];if(!!r.promptInteractive||!!r.continue||!!r.resume&&!n||process.stdin.isTTY&&c?.length===0){console.clear();let m=await kP();w2i(S2i(t),e);try{await wli()}catch(C){a.getDebugMode()&&console.warn("Failed to detect/enable Kitty protocol:",C)}try{await a.setIdeModeAndSyncConnection(!0)}catch(C){console.error(B.t("gemini.failedToConnectToIdeServer"),C)}let g,A=async()=>{try{if(console.clear(),w2i(S2i(t),e),g)try{g.unmount(),await new Promise(R=>process.nextTick(R))}catch(R){console.error(B.t("gemini.errorDuringUnmount"),R)}let{executeSessionStartHooks:C}=await Promise.resolve().then(()=>(Xj(),Jj)),S=await C(a,"resume");g=WCe((0,Ebe.jsx)(Gnr.default.StrictMode,{children:(0,Ebe.jsx)(Xrr,{instance:()=>g,config:a,settings:e,startupWarnings:u,version:m,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,fgMode:!0,sessionStartContext:S})}),{exitOnCtrlC:!1,isScreenReaderEnabled:!1,stdout:BXt(),maxFps:20})}catch(C){console.error(B.t("gemini.errorDuringResume"),C)}};process.on("SIGCONT",A),sbe(()=>{process.off("SIGCONT",A)});let y="startup";(r.continue||r.resume)&&(y="resume");let{executeSessionStartHooks:E}=await Promise.resolve().then(()=>(Xj(),Jj)),v=await E(a,y);g=WCe((0,Ebe.jsx)(Gnr.default.StrictMode,{children:(0,Ebe.jsx)(Xrr,{instance:()=>g,config:a,settings:e,startupWarnings:u,version:m,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,sessionStartContext:v})}),{exitOnCtrlC:!1,isScreenReaderEnabled:!1,stdout:BXt()}),e.merged.disableAutoUpdate||Jtt().then(C=>{D0i(C,e,a.getProjectRoot())}).catch(C=>{a.getDebugMode()&&console.error(B.t("gemini.updateCheckFailed"),C)}),sbe(()=>g.unmount());return}!process.stdin.isTTY&&!c&&(c+=await dgi()),c||(console.error(B.t("gemini.noInputProvidedViaStdin")),process.exit(1));let f=Math.random().toString(16).slice(2);BJ(a,{"event.name":"user_prompt","event.timestamp":new Date().toISOString(),prompt:c,prompt_id:f,auth_type:a.getContentGeneratorConfig()?.authType,prompt_length:c.length});let p=await SAa(a,o,e,r),h=r.outputFile||r.output_file;await bgi(p,c,f,h),process.exit(0)}function w2i(t,e){if(!e.merged.hideWindowTitle){let r=(process.env.CLI_TITLE||`iFlow - ${t}`).replace(/[\x00-\x1F\x7F]/g,"");process.stdout.write(`\x1B]2;${r}\x07`),process.on("exit",()=>{process.stdout.write("\x1B]2;\x07")})}}async function SAa(t,e,r,n){let i=t;if(t.getApprovalMode()!==Yn.YOLO){let o=r.merged.excludeTools||[],s=[Md.Name,uh.Name,Uf.Name],a=[...new Set([...o,...s])],c={...r.merged,excludeTools:a},u={...n};i=await QV(c,e,t.getSessionId(),u),await i.initialize()}return await wAa(r.merged.selectedAuthType,i,r)}async function wAa(t,e,r){!t&&!process.env.GEMINI_API_KEY&&!dNe()&&(console.error(B.t("gemini.pleaseSetAuthMethod",{userSettingsPath:Gj})),process.exit(1)),t||(dNe()?t=zt.IFLOW:t=zt.IFLOW);let n=wV(t);return n!=null&&(console.error(n),process.exit(1)),await e.refreshAuth(t,{apiKey:r.merged.apiKey,baseUrl:r.merged.baseUrl,modelName:r.merged.modelName}),e}T2i().catch(t=>{console.error("An unexpected critical error occurred:"),t instanceof Error?console.error(t.stack):console.error(String(t)),process.exit(1)});
|
|
5628
5628
|
/**
|
|
5629
5629
|
* @license
|
|
5630
5630
|
* Copyright 2025 Google LLC
|