@iflow-ai/iflow-cli 0.5.1-beta-20260113143539 → 0.5.1

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 CHANGED
@@ -491,9 +491,9 @@ ${o}
491
491
  ${s}
492
492
  `}};uUe.PrometheusSerializer=T9t});var Qen=T(dUe=>{"use strict";Object.defineProperty(dUe,"__esModule",{value:!0});dUe.PrometheusExporter=void 0;var V2e=(Xt(),gt(ar)),bGo=Ii(),I9t=a8(),CGo=me("http"),SGo=D9t(),wGo=me("url"),R9t=class t extends I9t.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:o=>({type:I9t.AggregationType.DEFAULT}),aggregationTemporalitySelector:o=>I9t.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,CGo.createServer)(this._requestHandler).unref(),this._serializer=new SGo.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,o=>{V2e.diag.error(o),r(o)}):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,bGo.globalErrorHandler)(r):V2e.diag.debug("Prometheus exporter was stopped"),e()})}):(V2e.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},()=>{V2e.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 wGo.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:o}=r;o.length&&V2e.diag.error("PrometheusExporter: metrics collection errors",...o),e.end(this._serializer.serialize(n))},r=>{e.end(`# failed to export metrics: ${r}`)})};_notFound=e=>{e.statusCode=404,e.end()}};dUe.PrometheusExporter=R9t});var Gen=T(_re=>{"use strict";Object.defineProperty(_re,"__esModule",{value:!0});_re.PrometheusSerializer=_re.PrometheusExporter=void 0;var xGo=Qen();Object.defineProperty(_re,"PrometheusExporter",{enumerable:!0,get:function(){return xGo.PrometheusExporter}});var TGo=D9t();Object.defineProperty(_re,"PrometheusSerializer",{enumerable:!0,get:function(){return TGo.PrometheusSerializer}})});var qen=T(fUe=>{"use strict";Object.defineProperty(fUe,"__esModule",{value:!0});fUe.VERSION=void 0;fUe.VERSION="0.206.0"});var Ven=T(pUe=>{"use strict";Object.defineProperty(pUe,"__esModule",{value:!0});pUe.OTLPTraceExporter=void 0;var DGo=(XT(),gt(JT)),IGo=qen(),RGo=u8(),Hen=(sR(),gt(fP)),k9t=class extends DGo.OTLPExporterBase{constructor(e={}){super((0,Hen.createOtlpHttpExportDelegate)((0,Hen.convertLegacyHttpOptions)(e,"TRACES","v1/traces",{"User-Agent":`OTel-OTLP-Exporter-JavaScript/${IGo.VERSION}`,"Content-Type":"application/json"}),RGo.JsonTraceSerializer))}};pUe.OTLPTraceExporter=k9t});var Wen=T(hUe=>{"use strict";Object.defineProperty(hUe,"__esModule",{value:!0});hUe.OTLPTraceExporter=void 0;var kGo=Ven();Object.defineProperty(hUe,"OTLPTraceExporter",{enumerable:!0,get:function(){return kGo.OTLPTraceExporter}})});var zen=T(mUe=>{"use strict";Object.defineProperty(mUe,"__esModule",{value:!0});mUe.OTLPTraceExporter=void 0;var OGo=Wen();Object.defineProperty(mUe,"OTLPTraceExporter",{enumerable:!0,get:function(){return OGo.OTLPTraceExporter}})});var Yen=T(gUe=>{"use strict";Object.defineProperty(gUe,"__esModule",{value:!0});gUe.OTLPTraceExporter=void 0;var NGo=zen();Object.defineProperty(gUe,"OTLPTraceExporter",{enumerable:!0,get:function(){return NGo.OTLPTraceExporter}})});var Jen=T(AUe=>{"use strict";Object.defineProperty(AUe,"__esModule",{value:!0});AUe.OTLPTraceExporter=void 0;var Ken=XLe(),BGo=u8(),PGo=(XT(),gt(JT)),O9t=class extends PGo.OTLPExporterBase{constructor(e={}){super((0,Ken.createOtlpGrpcExportDelegate)((0,Ken.convertLegacyOtlpGrpcOptions)(e,"TRACES"),BGo.ProtobufTraceSerializer,"TraceExportService","/opentelemetry.proto.collector.trace.v1.TraceService/Export"))}};AUe.OTLPTraceExporter=O9t});var Xen=T(yUe=>{"use strict";Object.defineProperty(yUe,"__esModule",{value:!0});yUe.OTLPTraceExporter=void 0;var MGo=Jen();Object.defineProperty(yUe,"OTLPTraceExporter",{enumerable:!0,get:function(){return MGo.OTLPTraceExporter}})});var Zen=T(EUe=>{"use strict";Object.defineProperty(EUe,"__esModule",{value:!0});EUe.prepareSend=void 0;var N9t=(Xt(),gt(ar)),_Ue=Ii(),FGo=me("http"),LGo=me("https");function UGo(t,e){let r=new URL(t),n=Object.assign({method:"POST",headers:{"Content-Type":"application/json",...e}});return function(s,a){if(s.length===0)return N9t.diag.debug("Zipkin send with empty spans"),a({code:_Ue.ExportResultCode.SUCCESS});let{request:c}=r.protocol==="http:"?FGo:LGo,u=c(r,n,f=>{let p="";f.on("data",h=>{p+=h}),f.on("end",()=>{let h=f.statusCode||0;return N9t.diag.debug(`Zipkin response status code: ${h}, body: ${p}`),h<400?a({code:_Ue.ExportResultCode.SUCCESS}):a({code:_Ue.ExportResultCode.FAILED,error:new Error(`Got unexpected status code from zipkin: ${h}`)})})});u.on("error",f=>a({code:_Ue.ExportResultCode.FAILED,error:f}));let d=JSON.stringify(s);N9t.diag.debug(`Zipkin request payload: ${d}`),u.write(d,"utf8"),u.end()}}EUe.prepareSend=UGo});var etn=T(vUe=>{"use strict";Object.defineProperty(vUe,"__esModule",{value:!0});vUe.prepareSend=void 0;var $Go=Zen();Object.defineProperty(vUe,"prepareSend",{enumerable:!0,get:function(){return $Go.prepareSend}})});var B9t=T(bUe=>{"use strict";Object.defineProperty(bUe,"__esModule",{value:!0});bUe.prepareSend=void 0;var jGo=etn();Object.defineProperty(bUe,"prepareSend",{enumerable:!0,get:function(){return jGo.prepareSend}})});var ttn=T(W2e=>{"use strict";Object.defineProperty(W2e,"__esModule",{value:!0});W2e.SpanKind=void 0;var QGo;(function(t){t.CLIENT="CLIENT",t.SERVER="SERVER",t.CONSUMER="CONSUMER",t.PRODUCER="PRODUCER"})(QGo=W2e.SpanKind||(W2e.SpanKind={}))});var itn=T(IC=>{"use strict";Object.defineProperty(IC,"__esModule",{value:!0});IC._toZipkinAnnotations=IC._toZipkinTags=IC.toZipkinSpan=IC.defaultStatusErrorTagName=IC.defaultStatusCodeTagName=void 0;var BP=(Xt(),gt(ar)),P9t=Ii(),CUe=ttn(),GGo={[BP.SpanKind.CLIENT]:CUe.SpanKind.CLIENT,[BP.SpanKind.SERVER]:CUe.SpanKind.SERVER,[BP.SpanKind.CONSUMER]:CUe.SpanKind.CONSUMER,[BP.SpanKind.PRODUCER]:CUe.SpanKind.PRODUCER,[BP.SpanKind.INTERNAL]:void 0};IC.defaultStatusCodeTagName="otel.status_code";IC.defaultStatusErrorTagName="error";function qGo(t,e,r,n){return{traceId:t.spanContext().traceId,parentId:t.parentSpanContext?.spanId,name:t.name,id:t.spanContext().spanId,kind:GGo[t.kind],timestamp:(0,P9t.hrTimeToMicroseconds)(t.startTime),duration:Math.round((0,P9t.hrTimeToMicroseconds)(t.duration)),localEndpoint:{serviceName:e},tags:rtn(t,r,n),annotations:t.events.length?ntn(t.events):void 0}}IC.toZipkinSpan=qGo;function rtn({attributes:t,resource:e,status:r,droppedAttributesCount:n,droppedEventsCount:o,droppedLinksCount:s},a,c){let u={};for(let d of Object.keys(t))u[d]=String(t[d]);return r.code!==BP.SpanStatusCode.UNSET&&(u[a]=String(BP.SpanStatusCode[r.code])),r.code===BP.SpanStatusCode.ERROR&&r.message&&(u[c]=r.message),n&&(u["otel.dropped_attributes_count"]=String(n)),o&&(u["otel.dropped_events_count"]=String(o)),s&&(u["otel.dropped_links_count"]=String(s)),Object.keys(e.attributes).forEach(d=>u[d]=String(e.attributes[d])),u}IC._toZipkinTags=rtn;function ntn(t){return t.map(e=>({timestamp:Math.round((0,P9t.hrTimeToMicroseconds)(e.time)),value:e.name}))}IC._toZipkinAnnotations=ntn});var otn=T(SUe=>{"use strict";Object.defineProperty(SUe,"__esModule",{value:!0});SUe.prepareGetHeaders=void 0;function HGo(t){return function(){return t()}}SUe.prepareGetHeaders=HGo});var ltn=T(wUe=>{"use strict";Object.defineProperty(wUe,"__esModule",{value:!0});wUe.ZipkinExporter=void 0;var stn=(Xt(),gt(ar)),atn=Ii(),ctn=B9t(),M9t=itn(),F9t=(Bh(),gt(f0)),VGo=otn(),L9t=class{DEFAULT_SERVICE_NAME="OpenTelemetry Service";_statusCodeTagName;_statusDescriptionTagName;_urlStr;_send;_getHeaders;_serviceName;_isShutdown;_sendingPromises=[];constructor(e={}){this._urlStr=e.url||((0,atn.getStringFromEnv)("OTEL_EXPORTER_ZIPKIN_ENDPOINT")??"http://localhost:9411/api/v2/spans"),this._send=(0,ctn.prepareSend)(this._urlStr,e.headers),this._serviceName=e.serviceName,this._statusCodeTagName=e.statusCodeTagName||M9t.defaultStatusCodeTagName,this._statusDescriptionTagName=e.statusDescriptionTagName||M9t.defaultStatusErrorTagName,this._isShutdown=!1,typeof e.getExportRequestHeaders=="function"?this._getHeaders=(0,VGo.prepareGetHeaders)(e.getExportRequestHeaders):this._beforeSend=function(){}}export(e,r){let n=String(this._serviceName||e[0].resource.attributes[F9t.ATTR_SERVICE_NAME]||this.DEFAULT_SERVICE_NAME);if(stn.diag.debug("Zipkin exporter export"),this._isShutdown){setTimeout(()=>r({code:atn.ExportResultCode.FAILED,error:new Error("Exporter has been shutdown")}));return}let o=new Promise(a=>{this._sendSpans(e,n,c=>{a(),r(c)})});this._sendingPromises.push(o);let s=()=>{let a=this._sendingPromises.indexOf(o);this._sendingPromises.splice(a,1)};o.then(s,s)}shutdown(){return stn.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,ctn.prepareSend)(this._urlStr,this._getHeaders()))}_sendSpans(e,r,n){let o=e.map(s=>(0,M9t.toZipkinSpan)(s,String(s.attributes[F9t.ATTR_SERVICE_NAME]||s.resource.attributes[F9t.ATTR_SERVICE_NAME]||r),this._statusCodeTagName,this._statusDescriptionTagName));return this._beforeSend(),this._send(o,s=>{if(n)return n(s)})}};wUe.ZipkinExporter=L9t});var utn=T(Ere=>{"use strict";Object.defineProperty(Ere,"__esModule",{value:!0});Ere.ZipkinExporter=Ere.prepareSend=void 0;var WGo=B9t();Object.defineProperty(Ere,"prepareSend",{enumerable:!0,get:function(){return WGo.prepareSend}});var zGo=ltn();Object.defineProperty(Ere,"ZipkinExporter",{enumerable:!0,get:function(){return zGo.ZipkinExporter}})});var U9t=T(xUe=>{"use strict";Object.defineProperty(xUe,"__esModule",{value:!0});xUe.B3_DEBUG_FLAG_KEY=void 0;var YGo=(Xt(),gt(ar));xUe.B3_DEBUG_FLAG_KEY=(0,YGo.createContextKey)("OpenTelemetry Context Key B3 Debug Flag")});var z2e=T(K_=>{"use strict";Object.defineProperty(K_,"__esModule",{value:!0});K_.X_B3_FLAGS=K_.X_B3_PARENT_SPAN_ID=K_.X_B3_SAMPLED=K_.X_B3_SPAN_ID=K_.X_B3_TRACE_ID=K_.B3_CONTEXT_HEADER=void 0;K_.B3_CONTEXT_HEADER="b3";K_.X_B3_TRACE_ID="x-b3-traceid";K_.X_B3_SPAN_ID="x-b3-spanid";K_.X_B3_SAMPLED="x-b3-sampled";K_.X_B3_PARENT_SPAN_ID="x-b3-parentspanid";K_.X_B3_FLAGS="x-b3-flags"});var ptn=T(DUe=>{"use strict";Object.defineProperty(DUe,"__esModule",{value:!0});DUe.B3MultiPropagator=void 0;var zw=(Xt(),gt(ar)),KGo=Ii(),dtn=U9t(),r6=z2e(),JGo=new Set([!0,"true","True","1",1]),XGo=new Set([!1,"false","False","0",0]);function ZGo(t){return t===zw.TraceFlags.SAMPLED||t===zw.TraceFlags.NONE}function eqo(t){return Array.isArray(t)?t[0]:t}function TUe(t,e,r){let n=e.get(t,r);return eqo(n)}function tqo(t,e){let r=TUe(t,e,r6.X_B3_TRACE_ID);return typeof r=="string"?r.padStart(32,"0"):""}function rqo(t,e){let r=TUe(t,e,r6.X_B3_SPAN_ID);return typeof r=="string"?r:""}function ftn(t,e){return TUe(t,e,r6.X_B3_FLAGS)==="1"?"1":void 0}function nqo(t,e){let r=TUe(t,e,r6.X_B3_SAMPLED);if(ftn(t,e)==="1"||JGo.has(r))return zw.TraceFlags.SAMPLED;if(r===void 0||XGo.has(r))return zw.TraceFlags.NONE}var $9t=class{inject(e,r,n){let o=zw.trace.getSpanContext(e);if(!o||!(0,zw.isSpanContextValid)(o)||(0,KGo.isTracingSuppressed)(e))return;let s=e.getValue(dtn.B3_DEBUG_FLAG_KEY);n.set(r,r6.X_B3_TRACE_ID,o.traceId),n.set(r,r6.X_B3_SPAN_ID,o.spanId),s==="1"?n.set(r,r6.X_B3_FLAGS,s):o.traceFlags!==void 0&&n.set(r,r6.X_B3_SAMPLED,(zw.TraceFlags.SAMPLED&o.traceFlags)===zw.TraceFlags.SAMPLED?"1":"0")}extract(e,r,n){let o=tqo(r,n),s=rqo(r,n),a=nqo(r,n),c=ftn(r,n);return(0,zw.isValidTraceId)(o)&&(0,zw.isValidSpanId)(s)&&ZGo(a)?(e=e.setValue(dtn.B3_DEBUG_FLAG_KEY,c),zw.trace.setSpanContext(e,{traceId:o,spanId:s,isRemote:!0,traceFlags:a})):e}fields(){return[r6.X_B3_TRACE_ID,r6.X_B3_SPAN_ID,r6.X_B3_FLAGS,r6.X_B3_SAMPLED,r6.X_B3_PARENT_SPAN_ID]}};DUe.B3MultiPropagator=$9t});var mtn=T(IUe=>{"use strict";Object.defineProperty(IUe,"__esModule",{value:!0});IUe.B3SinglePropagator=void 0;var iq=(Xt(),gt(ar)),iqo=Ii(),htn=U9t(),j9t=z2e(),oqo=/((?:[0-9a-f]{16}){1,2})-([0-9a-f]{16})(?:-([01d](?![0-9a-f])))?(?:-([0-9a-f]{16}))?/,sqo="0".repeat(16),aqo=new Set(["d","1"]),cqo="d";function lqo(t){return t.length===32?t:`${sqo}${t}`}function uqo(t){return t&&aqo.has(t)?iq.TraceFlags.SAMPLED:iq.TraceFlags.NONE}var Q9t=class{inject(e,r,n){let o=iq.trace.getSpanContext(e);if(!o||!(0,iq.isSpanContextValid)(o)||(0,iqo.isTracingSuppressed)(e))return;let s=e.getValue(htn.B3_DEBUG_FLAG_KEY)||o.traceFlags&1,a=`${o.traceId}-${o.spanId}-${s}`;n.set(r,j9t.B3_CONTEXT_HEADER,a)}extract(e,r,n){let o=n.get(r,j9t.B3_CONTEXT_HEADER),s=Array.isArray(o)?o[0]:o;if(typeof s!="string")return e;let a=s.match(oqo);if(!a)return e;let[,c,u,d]=a,f=lqo(c);if(!(0,iq.isValidTraceId)(f)||!(0,iq.isValidSpanId)(u))return e;let p=uqo(d);return d===cqo&&(e=e.setValue(htn.B3_DEBUG_FLAG_KEY,d)),iq.trace.setSpanContext(e,{traceId:f,spanId:u,isRemote:!0,traceFlags:p})}fields(){return[j9t.B3_CONTEXT_HEADER]}};IUe.B3SinglePropagator=Q9t});var G9t=T(Y2e=>{"use strict";Object.defineProperty(Y2e,"__esModule",{value:!0});Y2e.B3InjectEncoding=void 0;var dqo;(function(t){t[t.SINGLE_HEADER=0]="SINGLE_HEADER",t[t.MULTI_HEADER=1]="MULTI_HEADER"})(dqo=Y2e.B3InjectEncoding||(Y2e.B3InjectEncoding={}))});var gtn=T(RUe=>{"use strict";Object.defineProperty(RUe,"__esModule",{value:!0});RUe.B3Propagator=void 0;var fqo=Ii(),pqo=ptn(),hqo=mtn(),mqo=z2e(),gqo=G9t(),q9t=class{_b3MultiPropagator=new pqo.B3MultiPropagator;_b3SinglePropagator=new hqo.B3SinglePropagator;_inject;_fields;constructor(e={}){e.injectEncoding===gqo.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,fqo.isTracingSuppressed)(e)||this._inject(e,r,n)}extract(e,r,n){let o=n.get(r,mqo.B3_CONTEXT_HEADER);return(Array.isArray(o)?o[0]:o)?this._b3SinglePropagator.extract(e,r,n):this._b3MultiPropagator.extract(e,r,n)}fields(){return this._fields}};RUe.B3Propagator=q9t});var Atn=T(b0=>{"use strict";Object.defineProperty(b0,"__esModule",{value:!0});b0.B3InjectEncoding=b0.X_B3_TRACE_ID=b0.X_B3_SPAN_ID=b0.X_B3_SAMPLED=b0.X_B3_PARENT_SPAN_ID=b0.X_B3_FLAGS=b0.B3_CONTEXT_HEADER=b0.B3Propagator=void 0;var Aqo=gtn();Object.defineProperty(b0,"B3Propagator",{enumerable:!0,get:function(){return Aqo.B3Propagator}});var vre=z2e();Object.defineProperty(b0,"B3_CONTEXT_HEADER",{enumerable:!0,get:function(){return vre.B3_CONTEXT_HEADER}});Object.defineProperty(b0,"X_B3_FLAGS",{enumerable:!0,get:function(){return vre.X_B3_FLAGS}});Object.defineProperty(b0,"X_B3_PARENT_SPAN_ID",{enumerable:!0,get:function(){return vre.X_B3_PARENT_SPAN_ID}});Object.defineProperty(b0,"X_B3_SAMPLED",{enumerable:!0,get:function(){return vre.X_B3_SAMPLED}});Object.defineProperty(b0,"X_B3_SPAN_ID",{enumerable:!0,get:function(){return vre.X_B3_SPAN_ID}});Object.defineProperty(b0,"X_B3_TRACE_ID",{enumerable:!0,get:function(){return vre.X_B3_TRACE_ID}});var yqo=G9t();Object.defineProperty(b0,"B3InjectEncoding",{enumerable:!0,get:function(){return yqo.B3InjectEncoding}})});var ytn=T(Yw=>{"use strict";Object.defineProperty(Yw,"__esModule",{value:!0});Yw.JaegerPropagator=Yw.UBER_BAGGAGE_HEADER_PREFIX=Yw.UBER_TRACE_ID_HEADER=void 0;var oq=(Xt(),gt(ar)),_qo=Ii();Yw.UBER_TRACE_ID_HEADER="uber-trace-id";Yw.UBER_BAGGAGE_HEADER_PREFIX="uberctx";var H9t=class{_jaegerTraceHeader;_jaegerBaggageHeaderPrefix;constructor(e){typeof e=="string"?(this._jaegerTraceHeader=e,this._jaegerBaggageHeaderPrefix=Yw.UBER_BAGGAGE_HEADER_PREFIX):(this._jaegerTraceHeader=e?.customTraceHeader||Yw.UBER_TRACE_ID_HEADER,this._jaegerBaggageHeaderPrefix=e?.customBaggageHeaderPrefix||Yw.UBER_BAGGAGE_HEADER_PREFIX)}inject(e,r,n){let o=oq.trace.getSpanContext(e),s=oq.propagation.getBaggage(e);if(o&&(0,_qo.isTracingSuppressed)(e)===!1){let a=`0${(o.traceFlags||oq.TraceFlags.NONE).toString(16)}`;n.set(r,this._jaegerTraceHeader,`${o.traceId}:${o.spanId}:0:${a}`)}if(s)for(let[a,c]of s.getAllEntries())n.set(r,`${this._jaegerBaggageHeaderPrefix}-${a}`,encodeURIComponent(c.value))}extract(e,r,n){let o=n.get(r,this._jaegerTraceHeader),s=Array.isArray(o)?o[0]:o,a=n.keys(r).filter(d=>d.startsWith(`${this._jaegerBaggageHeaderPrefix}-`)).map(d=>{let f=n.get(r,d);return{key:d.substring(this._jaegerBaggageHeaderPrefix.length+1),value:Array.isArray(f)?f[0]:f}}),c=e;if(typeof s=="string"){let d=vqo(s);d&&(c=oq.trace.setSpanContext(c,d))}if(a.length===0)return c;let u=oq.propagation.getBaggage(e)??oq.propagation.createBaggage();for(let d of a)d.value!==void 0&&(u=u.setEntry(d.key,{value:decodeURIComponent(d.value)}));return c=oq.propagation.setBaggage(c,u),c}fields(){return[this._jaegerTraceHeader]}};Yw.JaegerPropagator=H9t;var Eqo=/^[0-9a-f]{1,2}$/i;function vqo(t){let e=decodeURIComponent(t).split(":");if(e.length!==4)return null;let[r,n,,o]=e,s=r.padStart(32,"0"),a=n.padStart(16,"0"),c=Eqo.test(o)?parseInt(o,16)&1:1;return{traceId:s,spanId:a,isRemote:!0,traceFlags:c}}});var _tn=T(PP=>{"use strict";Object.defineProperty(PP,"__esModule",{value:!0});PP.UBER_TRACE_ID_HEADER=PP.UBER_BAGGAGE_HEADER_PREFIX=PP.JaegerPropagator=void 0;var V9t=ytn();Object.defineProperty(PP,"JaegerPropagator",{enumerable:!0,get:function(){return V9t.JaegerPropagator}});Object.defineProperty(PP,"UBER_BAGGAGE_HEADER_PREFIX",{enumerable:!0,get:function(){return V9t.UBER_BAGGAGE_HEADER_PREFIX}});Object.defineProperty(PP,"UBER_TRACE_ID_HEADER",{enumerable:!0,get:function(){return V9t.UBER_TRACE_ID_HEADER}})});var Ctn=T(RC=>{"use strict";Object.defineProperty(RC,"__esModule",{value:!0});RC.getPropagatorFromEnv=RC.getSpanProcessorsFromEnv=RC.getOtlpProtocolFromEnv=RC.filterBlanksAndNulls=RC.getResourceDetectorsFromEnv=void 0;var MP=(Xt(),gt(ar)),FP=Ii(),Etn=JSt(),bqo=Yen(),Cqo=Xen(),Sqo=utn(),K2e=hte(),kUe=NMe(),W9t=Atn(),wqo=_tn(),xqo="env",Tqo="host",Dqo="os",Iqo="process",Rqo="serviceinstance";function kqo(){let t=new Map([[xqo,K2e.envDetector],[Tqo,K2e.hostDetector],[Dqo,K2e.osDetector],[Rqo,K2e.serviceInstanceIdDetector],[Iqo,K2e.processDetector]]),e=(0,FP.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||MP.diag.warn(`Invalid resource detector "${r}" specified in the environment variable OTEL_NODE_RESOURCE_DETECTORS`),n||[]})}RC.getResourceDetectorsFromEnv=kqo;function vtn(t){return t.map(e=>e.trim()).filter(e=>e!=="null"&&e!=="")}RC.filterBlanksAndNulls=vtn;function btn(){return(0,FP.getStringFromEnv)("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL")??(0,FP.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL")??"http/protobuf"}RC.getOtlpProtocolFromEnv=btn;function Oqo(){let t=btn();switch(t){case"grpc":return new Cqo.OTLPTraceExporter;case"http/json":return new bqo.OTLPTraceExporter;case"http/protobuf":return new Etn.OTLPTraceExporter;default:return MP.diag.warn(`Unsupported OTLP traces protocol: ${t}. Using http/protobuf.`),new Etn.OTLPTraceExporter}}function Nqo(){try{let{JaegerExporter:t}=me("@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 Bqo(){let t=new Map([["otlp",()=>Oqo()],["zipkin",()=>new Sqo.ZipkinExporter],["console",()=>new kUe.ConsoleSpanExporter],["jaeger",()=>Nqo()]]),e=[],r=[],n=vtn(Array.from(new Set((0,FP.getStringListFromEnv)("OTEL_TRACES_EXPORTER"))));if(n[0]==="none")return MP.diag.warn('OTEL_TRACES_EXPORTER contains "none". SDK will not be initialized.'),[];n.length===0?(MP.diag.debug("OTEL_TRACES_EXPORTER is empty. Using default otlp exporter."),n=["otlp"]):n.length>1&&n.includes("none")&&(MP.diag.warn('OTEL_TRACES_EXPORTER contains "none" along with other exporters. Using default otlp exporter.'),n=["otlp"]);for(let o of n){let s=t.get(o)?.();s?e.push(s):MP.diag.warn(`Unrecognized OTEL_TRACES_EXPORTER value: ${o}.`)}for(let o of e)o instanceof kUe.ConsoleSpanExporter?r.push(new kUe.SimpleSpanProcessor(o)):r.push(new kUe.BatchSpanProcessor(o));return e.length===0&&MP.diag.warn("Unable to set up trace exporter(s) due to invalid exporter and/or protocol values."),r}RC.getSpanProcessorsFromEnv=Bqo;function Pqo(){let t=(0,FP.getStringListFromEnv)("OTEL_PROPAGATORS");if(t==null)return;let e=new Map([["tracecontext",()=>new FP.W3CTraceContextPropagator],["baggage",()=>new FP.W3CBaggagePropagator],["b3",()=>new W9t.B3Propagator],["b3multi",()=>new W9t.B3Propagator({injectEncoding:W9t.B3InjectEncoding.MULTI_HEADER})],["jaeger",()=>new wqo.JaegerPropagator]]),r=Array.from(new Set(t)),o=r.map(s=>{let a=e.get(s)?.();if(!a){MP.diag.warn(`Propagator "${s}" requested through environment variable is unavailable.`);return}return a}).reduce((s,a)=>(a&&s.push(a),s),[]);return o.length===0?null:r.length===1?o[0]:new FP.CompositePropagator({propagators:o})}RC.getPropagatorFromEnv=Pqo});var xtn=T(OUe=>{"use strict";Object.defineProperty(OUe,"__esModule",{value:!0});OUe.NodeSDK=void 0;var ty=(Xt(),gt(ar)),Mqo=ute(),Fqo=lKr(),bre=hte(),J2e=Mwt(),Lqo=owt(),Uqo=Ren(),z9t=Men(),$qo=Uen(),Stn=nwt(),jqo=dBe(),Qqo=Gen(),sq=a8(),Gqo=NMe(),qqo=cMe(),Hqo=(Bh(),gt(f0)),LP=Ii(),Y9t=Ctn();function wtn(t,e){return parseInt(process.env[t]||"")||e}function Vqo(){let t=[],e=(0,LP.getStringListFromEnv)("OTEL_METRICS_EXPORTER");return e?(e.length===0&&ty.diag.debug("OTEL_METRICS_EXPORTER is empty. Using default otlp exporter."),e.includes("none")?(ty.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(),o=wtn("OTEL_METRIC_EXPORT_INTERVAL",6e4),s=wtn("OTEL_METRIC_EXPORT_TIMEOUT",3e4);switch(n){case"grpc":t.push(new sq.PeriodicExportingMetricReader({exporter:new $qo.OTLPMetricExporter,exportIntervalMillis:o,exportTimeoutMillis:s}));break;case"http/json":t.push(new sq.PeriodicExportingMetricReader({exporter:new jqo.OTLPMetricExporter,exportIntervalMillis:o,exportTimeoutMillis:s}));break;case"http/protobuf":t.push(new sq.PeriodicExportingMetricReader({exporter:new Stn.OTLPMetricExporter,exportIntervalMillis:o,exportTimeoutMillis:s}));break;default:ty.diag.warn(`Unsupported OTLP metrics protocol: "${n}". Using http/protobuf.`),t.push(new sq.PeriodicExportingMetricReader({exporter:new Stn.OTLPMetricExporter,exportIntervalMillis:o,exportTimeoutMillis:s}))}}else r==="console"?t.push(new sq.PeriodicExportingMetricReader({exporter:new sq.ConsoleMetricExporter})):r==="prometheus"?t.push(new Qqo.PrometheusExporter):ty.diag.warn(`Unsupported OTEL_METRICS_EXPORTER value: "${r}". Supported values are: otlp, console, prometheus, none.`)}),t)):t}var K9t=class{_tracerProviderConfig;_loggerProviderConfig;_meterProviderConfig;_instrumentations;_resource;_resourceDetectors;_autoDetectResources;_tracerProvider;_loggerProvider;_meterProvider;_serviceName;_configuration;_disabled;constructor(e={}){(0,LP.getBooleanFromEnv)("OTEL_SDK_DISABLED")&&(this._disabled=!0);let r=(0,LP.getStringFromEnv)("OTEL_LOG_LEVEL");if(r!=null&&ty.diag.setLogger(new ty.DiagConsoleLogger,{logLevel:(0,LP.diagLogLevelFromString)(r)}),this._configuration=e,this._resource=e.resource??(0,bre.defaultResource)(),this._autoDetectResources=e.autoDetectResources??!0,this._autoDetectResources?e.resourceDetectors!=null?this._resourceDetectors=e.resourceDetectors:(0,LP.getStringFromEnv)("OTEL_NODE_RESOURCE_DETECTORS")?this._resourceDetectors=(0,Y9t.getResourceDetectorsFromEnv)():this._resourceDetectors=[bre.envDetector,bre.processDetector,bre.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&&ty.diag.warn("The 'spanProcessor' option is deprecated. Please use 'spanProcessors' instead.");let o=e.spanProcessor??new Gqo.BatchSpanProcessor(e.traceExporter),s=e.spanProcessors??[o];this._tracerProviderConfig={tracerConfig:n,spanProcessors:s,contextManager:e.contextManager,textMapPropagator:e.textMapPropagator}}if(e.logRecordProcessors?this._loggerProviderConfig={logRecordProcessors:e.logRecordProcessors}:e.logRecordProcessor?(this._loggerProviderConfig={logRecordProcessors:[e.logRecordProcessor]},ty.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],ty.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,Fqo.registerInstrumentations)({instrumentations:this._instrumentations}),this._autoDetectResources){let n={detectors:this._resourceDetectors};this._resource=this._resource.merge((0,bre.detectResources)(n))}this._resource=this._serviceName===void 0?this._resource:this._resource.merge((0,bre.resourceFromAttributes)({[Hqo.ATTR_SERVICE_NAME]:this._serviceName}));let e=this._tracerProviderConfig?this._tracerProviderConfig.spanProcessors:(0,Y9t.getSpanProcessorsFromEnv)();if(this._tracerProvider=new qqo.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,Y9t.getPropagatorFromEnv)()}),this._loggerProviderConfig){let n=new J2e.LoggerProvider({resource:this._resource,processors:this._loggerProviderConfig.logRecordProcessors});this._loggerProvider=n,Mqo.logs.setGlobalLoggerProvider(n)}let r=Vqo();if(this._meterProviderConfig||r.length>0){let n=[];this._meterProviderConfig?.readers&&n.push(...this._meterProviderConfig.readers),n.length===0&&r.forEach(s=>n.push(s));let o=new sq.MeterProvider({resource:this._resource,views:this._meterProviderConfig?.views??[],readers:n});this._meterProvider=o,ty.metrics.setGlobalMeterProvider(o);for(let s of this._instrumentations)s.setMeterProvider(ty.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,LP.getStringListFromEnv)("OTEL_LOGS_EXPORTER")??[];if(e.length===0&&(ty.diag.debug("OTEL_LOGS_EXPORTER is empty. Using default otlp exporter."),e.push("otlp")),e.includes("none")){ty.diag.info('OTEL_LOGS_EXPORTER contains "none". Logger provider will not be initialized.');return}let r=[];e.forEach(n=>{if(n==="otlp"){let o=((0,LP.getStringFromEnv)("OTEL_EXPORTER_OTLP_LOGS_PROTOCOL")??(0,LP.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL"))?.trim();switch(o){case"grpc":r.push(new Uqo.OTLPLogExporter);break;case"http/json":r.push(new Lqo.OTLPLogExporter);break;case"http/protobuf":r.push(new z9t.OTLPLogExporter);break;case void 0:case"":r.push(new z9t.OTLPLogExporter);break;default:ty.diag.warn(`Unsupported OTLP logs protocol: "${o}". Using http/protobuf.`),r.push(new z9t.OTLPLogExporter)}}else n==="console"?r.push(new J2e.ConsoleLogRecordExporter):ty.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 J2e.ConsoleLogRecordExporter?new J2e.SimpleLogRecordProcessor(n):new J2e.BatchLogRecordProcessor(n))})}};OUe.NodeSDK=K9t});var Ttn=T(Om=>{"use strict";Object.defineProperty(Om,"__esModule",{value:!0});Om.NodeSDK=Om.tracing=Om.resources=Om.node=Om.metrics=Om.logs=Om.core=Om.contextBase=Om.api=void 0;Om.api=(Xt(),gt(ar));Om.contextBase=(Xt(),gt(ar));Om.core=Ii();Om.logs=Mwt();Om.metrics=a8();Om.node=cMe();Om.resources=hte();Om.tracing=NMe();var Wqo=xtn();Object.defineProperty(Om,"NodeSDK",{enumerable:!0,get:function(){return Wqo.NodeSDK}})});function zqo(t,e){return new Promise((r,n)=>{let o=setTimeout(()=>{n(new Error(`Operation timed out after ${e} ms`))},e);t.then(r).catch(n).finally(()=>clearTimeout(o))})}var Dtn,NUe,Itn=G(()=>{"use strict";Dtn=Se(a8(),1);NUe=class extends Dtn.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(),o=this._alignSeconds.find(c=>c>=r),s;o!==void 0?s=(o-r)*1e3-n:(s=(60-r)*1e3-n,o=0),s=Math.max(0,s);let a=setTimeout(()=>{this._alignedExport(),this._interval=setInterval(()=>{this._alignedExport()},this._intervalSeconds*1e3);let c=this._interval;typeof c!="number"&&c?.unref&&c.unref()},s);typeof a!="number"&&a?.unref&&a.unref()}async _alignedExport(){let e=this._exportTimeout;try{await zqo(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 X2e=T(UP=>{"use strict";Object.defineProperty(UP,"__esModule",{value:!0});UP.isTracingSuppressed=UP.unsuppressTracing=UP.suppressTracing=void 0;var Yqo=(Xt(),gt(ar)),J9t=(0,Yqo.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function Kqo(t){return t.setValue(J9t,!0)}UP.suppressTracing=Kqo;function Jqo(t){return t.deleteValue(J9t)}UP.unsuppressTracing=Jqo;function Xqo(t){return t.getValue(J9t)===!0}UP.isTracingSuppressed=Xqo});var X9t=T(f1=>{"use strict";Object.defineProperty(f1,"__esModule",{value:!0});f1.BAGGAGE_MAX_TOTAL_LENGTH=f1.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=f1.BAGGAGE_MAX_NAME_VALUE_PAIRS=f1.BAGGAGE_HEADER=f1.BAGGAGE_ITEMS_SEPARATOR=f1.BAGGAGE_PROPERTIES_SEPARATOR=f1.BAGGAGE_KEY_PAIR_SEPARATOR=void 0;f1.BAGGAGE_KEY_PAIR_SEPARATOR="=";f1.BAGGAGE_PROPERTIES_SEPARATOR=";";f1.BAGGAGE_ITEMS_SEPARATOR=",";f1.BAGGAGE_HEADER="baggage";f1.BAGGAGE_MAX_NAME_VALUE_PAIRS=180;f1.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096;f1.BAGGAGE_MAX_TOTAL_LENGTH=8192});var Z9t=T(U8=>{"use strict";Object.defineProperty(U8,"__esModule",{value:!0});U8.parseKeyPairsIntoRecord=U8.parsePairKeyValue=U8.getKeyPairs=U8.serializeKeyPairs=void 0;var Zqo=(Xt(),gt(ar)),Cre=X9t();function eHo(t){return t.reduce((e,r)=>{let n=`${e}${e!==""?Cre.BAGGAGE_ITEMS_SEPARATOR:""}${r}`;return n.length>Cre.BAGGAGE_MAX_TOTAL_LENGTH?e:n},"")}U8.serializeKeyPairs=eHo;function tHo(t){return t.getAllEntries().map(([e,r])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=Cre.BAGGAGE_PROPERTIES_SEPARATOR+r.metadata.toString()),n})}U8.getKeyPairs=tHo;function Rtn(t){if(!t)return;let e=t.indexOf(Cre.BAGGAGE_PROPERTIES_SEPARATOR),r=e===-1?t:t.substring(0,e),n=r.indexOf(Cre.BAGGAGE_KEY_PAIR_SEPARATOR);if(n<=0)return;let o=r.substring(0,n).trim(),s=r.substring(n+1).trim();if(!o||!s)return;let a,c;try{a=decodeURIComponent(o),c=decodeURIComponent(s)}catch{return}let u;if(e!==-1&&e<t.length-1){let d=t.substring(e+1);u=(0,Zqo.baggageEntryMetadataFromString)(d)}return{key:a,value:c,metadata:u}}U8.parsePairKeyValue=Rtn;function rHo(t){let e={};return typeof t=="string"&&t.length>0&&t.split(Cre.BAGGAGE_ITEMS_SEPARATOR).forEach(r=>{let n=Rtn(r);n!==void 0&&n.value.length>0&&(e[n.key]=n.value)}),e}U8.parseKeyPairsIntoRecord=rHo});var ktn=T(BUe=>{"use strict";Object.defineProperty(BUe,"__esModule",{value:!0});BUe.W3CBaggagePropagator=void 0;var eIt=(Xt(),gt(ar)),nHo=X2e(),aq=X9t(),tIt=Z9t(),rIt=class{inject(e,r,n){let o=eIt.propagation.getBaggage(e);if(!o||(0,nHo.isTracingSuppressed)(e))return;let s=(0,tIt.getKeyPairs)(o).filter(c=>c.length<=aq.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,aq.BAGGAGE_MAX_NAME_VALUE_PAIRS),a=(0,tIt.serializeKeyPairs)(s);a.length>0&&n.set(r,aq.BAGGAGE_HEADER,a)}extract(e,r,n){let o=n.get(r,aq.BAGGAGE_HEADER),s=Array.isArray(o)?o.join(aq.BAGGAGE_ITEMS_SEPARATOR):o;if(!s)return e;let a={};return s.length===0||(s.split(aq.BAGGAGE_ITEMS_SEPARATOR).forEach(u=>{let d=(0,tIt.parsePairKeyValue)(u);if(d){let f={value:d.value};d.metadata&&(f.metadata=d.metadata),a[d.key]=f}}),Object.entries(a).length===0)?e:eIt.propagation.setBaggage(e,eIt.propagation.createBaggage(a))}fields(){return[aq.BAGGAGE_HEADER]}};BUe.W3CBaggagePropagator=rIt});var Otn=T(PUe=>{"use strict";Object.defineProperty(PUe,"__esModule",{value:!0});PUe.AnchoredClock=void 0;var nIt=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}};PUe.AnchoredClock=nIt});var Ftn=T($P=>{"use strict";Object.defineProperty($P,"__esModule",{value:!0});$P.isAttributeValue=$P.isAttributeKey=$P.sanitizeAttributes=void 0;var Ntn=(Xt(),gt(ar));function iHo(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(!Btn(r)){Ntn.diag.warn(`Invalid attribute key: ${r}`);continue}let n=t[r];if(!Ptn(n)){Ntn.diag.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?e[r]=n.slice():e[r]=n}return e}$P.sanitizeAttributes=iHo;function Btn(t){return typeof t=="string"&&t!==""}$P.isAttributeKey=Btn;function Ptn(t){return t==null?!0:Array.isArray(t)?oHo(t):Mtn(typeof t)}$P.isAttributeValue=Ptn;function oHo(t){let e;for(let r of t){if(r==null)continue;let n=typeof r;if(n!==e){if(!e){if(Mtn(n)){e=n;continue}return!1}return!1}}return!0}function Mtn(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}});var iIt=T(MUe=>{"use strict";Object.defineProperty(MUe,"__esModule",{value:!0});MUe.loggingErrorHandler=void 0;var sHo=(Xt(),gt(ar));function aHo(){return t=>{sHo.diag.error(cHo(t))}}MUe.loggingErrorHandler=aHo;function cHo(t){return typeof t=="string"?t:JSON.stringify(lHo(t))}function lHo(t){let e={},r=t;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(e[n])return;let o=r[n];o&&(e[n]=String(o))}),r=Object.getPrototypeOf(r);return e}});var Utn=T(Sre=>{"use strict";Object.defineProperty(Sre,"__esModule",{value:!0});Sre.globalErrorHandler=Sre.setGlobalErrorHandler=void 0;var uHo=iIt(),Ltn=(0,uHo.loggingErrorHandler)();function dHo(t){Ltn=t}Sre.setGlobalErrorHandler=dHo;function fHo(t){try{Ltn(t)}catch{}}Sre.globalErrorHandler=fHo});var Gtn=T($8=>{"use strict";Object.defineProperty($8,"__esModule",{value:!0});$8.getStringListFromEnv=$8.getBooleanFromEnv=$8.getStringFromEnv=$8.getNumberFromEnv=void 0;var $tn=(Xt(),gt(ar)),jtn=me("util");function pHo(t){let e=process.env[t];if(e==null||e.trim()==="")return;let r=Number(e);if(isNaN(r)){$tn.diag.warn(`Unknown value ${(0,jtn.inspect)(e)} for ${t}, expected a number, using defaults`);return}return r}$8.getNumberFromEnv=pHo;function Qtn(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}$8.getStringFromEnv=Qtn;function hHo(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||$tn.diag.warn(`Unknown value ${(0,jtn.inspect)(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}$8.getBooleanFromEnv=hHo;function mHo(t){return Qtn(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}$8.getStringListFromEnv=mHo});var qtn=T(FUe=>{"use strict";Object.defineProperty(FUe,"__esModule",{value:!0});FUe._globalThis=void 0;FUe._globalThis=globalThis});var Htn=T(LUe=>{"use strict";Object.defineProperty(LUe,"__esModule",{value:!0});LUe.VERSION=void 0;LUe.VERSION="2.3.0"});var Vtn=T(UUe=>{"use strict";Object.defineProperty(UUe,"__esModule",{value:!0});UUe.ATTR_PROCESS_RUNTIME_NAME=void 0;UUe.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name"});var Wtn=T(jUe=>{"use strict";Object.defineProperty(jUe,"__esModule",{value:!0});jUe.SDK_INFO=void 0;var gHo=Htn(),$Ue=(Bh(),gt(f0)),AHo=Vtn();jUe.SDK_INFO={[$Ue.ATTR_TELEMETRY_SDK_NAME]:"opentelemetry",[AHo.ATTR_PROCESS_RUNTIME_NAME]:"node",[$Ue.ATTR_TELEMETRY_SDK_LANGUAGE]:$Ue.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[$Ue.ATTR_TELEMETRY_SDK_VERSION]:gHo.VERSION}});var ztn=T(p1=>{"use strict";Object.defineProperty(p1,"__esModule",{value:!0});p1.otperformance=p1.SDK_INFO=p1._globalThis=p1.getStringListFromEnv=p1.getNumberFromEnv=p1.getBooleanFromEnv=p1.getStringFromEnv=void 0;var QUe=Gtn();Object.defineProperty(p1,"getStringFromEnv",{enumerable:!0,get:function(){return QUe.getStringFromEnv}});Object.defineProperty(p1,"getBooleanFromEnv",{enumerable:!0,get:function(){return QUe.getBooleanFromEnv}});Object.defineProperty(p1,"getNumberFromEnv",{enumerable:!0,get:function(){return QUe.getNumberFromEnv}});Object.defineProperty(p1,"getStringListFromEnv",{enumerable:!0,get:function(){return QUe.getStringListFromEnv}});var yHo=qtn();Object.defineProperty(p1,"_globalThis",{enumerable:!0,get:function(){return yHo._globalThis}});var _Ho=Wtn();Object.defineProperty(p1,"SDK_INFO",{enumerable:!0,get:function(){return _Ho.SDK_INFO}});p1.otperformance=performance});var oIt=T(h1=>{"use strict";Object.defineProperty(h1,"__esModule",{value:!0});h1.getStringListFromEnv=h1.getNumberFromEnv=h1.getStringFromEnv=h1.getBooleanFromEnv=h1.otperformance=h1._globalThis=h1.SDK_INFO=void 0;var cq=ztn();Object.defineProperty(h1,"SDK_INFO",{enumerable:!0,get:function(){return cq.SDK_INFO}});Object.defineProperty(h1,"_globalThis",{enumerable:!0,get:function(){return cq._globalThis}});Object.defineProperty(h1,"otperformance",{enumerable:!0,get:function(){return cq.otperformance}});Object.defineProperty(h1,"getBooleanFromEnv",{enumerable:!0,get:function(){return cq.getBooleanFromEnv}});Object.defineProperty(h1,"getStringFromEnv",{enumerable:!0,get:function(){return cq.getStringFromEnv}});Object.defineProperty(h1,"getNumberFromEnv",{enumerable:!0,get:function(){return cq.getNumberFromEnv}});Object.defineProperty(h1,"getStringListFromEnv",{enumerable:!0,get:function(){return cq.getStringListFromEnv}})});var Xtn=T(Pd=>{"use strict";Object.defineProperty(Pd,"__esModule",{value:!0});Pd.addHrTimes=Pd.isTimeInput=Pd.isTimeInputHrTime=Pd.hrTimeToMicroseconds=Pd.hrTimeToMilliseconds=Pd.hrTimeToNanoseconds=Pd.hrTimeToTimeStamp=Pd.hrTimeDuration=Pd.timeInputToHrTime=Pd.hrTime=Pd.getTimeOrigin=Pd.millisToHrTime=void 0;var GUe=oIt(),Ytn=9,EHo=6,vHo=Math.pow(10,EHo),qUe=Math.pow(10,Ytn);function Z2e(t){let e=t/1e3,r=Math.trunc(e),n=Math.round(t%1e3*vHo);return[r,n]}Pd.millisToHrTime=Z2e;function bHo(){return GUe.otperformance.timeOrigin}Pd.getTimeOrigin=bHo;function Ktn(t){let e=Z2e(GUe.otperformance.timeOrigin),r=Z2e(typeof t=="number"?t:GUe.otperformance.now());return Jtn(e,r)}Pd.hrTime=Ktn;function CHo(t){if(sIt(t))return t;if(typeof t=="number")return t<GUe.otperformance.timeOrigin?Ktn(t):Z2e(t);if(t instanceof Date)return Z2e(t.getTime());throw TypeError("Invalid input type")}Pd.timeInputToHrTime=CHo;function SHo(t,e){let r=e[0]-t[0],n=e[1]-t[1];return n<0&&(r-=1,n+=qUe),[r,n]}Pd.hrTimeDuration=SHo;function wHo(t){let e=Ytn,r=`${"0".repeat(e)}${t[1]}Z`,n=r.substring(r.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",n)}Pd.hrTimeToTimeStamp=wHo;function xHo(t){return t[0]*qUe+t[1]}Pd.hrTimeToNanoseconds=xHo;function THo(t){return t[0]*1e3+t[1]/1e6}Pd.hrTimeToMilliseconds=THo;function DHo(t){return t[0]*1e6+t[1]/1e3}Pd.hrTimeToMicroseconds=DHo;function sIt(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}Pd.isTimeInputHrTime=sIt;function IHo(t){return sIt(t)||typeof t=="number"||t instanceof Date}Pd.isTimeInput=IHo;function Jtn(t,e){let r=[t[0]+e[0],t[1]+e[1]];return r[1]>=qUe&&(r[1]-=qUe,r[0]+=1),r}Pd.addHrTimes=Jtn});var Ztn=T(HUe=>{"use strict";Object.defineProperty(HUe,"__esModule",{value:!0});HUe.unrefTimer=void 0;function RHo(t){typeof t!="number"&&t.unref()}HUe.unrefTimer=RHo});var ern=T(e1e=>{"use strict";Object.defineProperty(e1e,"__esModule",{value:!0});e1e.ExportResultCode=void 0;var kHo;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(kHo=e1e.ExportResultCode||(e1e.ExportResultCode={}))});var rrn=T(VUe=>{"use strict";Object.defineProperty(VUe,"__esModule",{value:!0});VUe.CompositePropagator=void 0;var trn=(Xt(),gt(ar)),aIt=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 o of this._propagators)try{o.inject(e,r,n)}catch(s){trn.diag.warn(`Failed to inject with ${o.constructor.name}. Err: ${s.message}`)}}extract(e,r,n){return this._propagators.reduce((o,s)=>{try{return s.extract(o,r,n)}catch(a){trn.diag.warn(`Failed to extract with ${s.constructor.name}. Err: ${a.message}`)}return o},e)}fields(){return this._fields.slice()}};VUe.CompositePropagator=aIt});var nrn=T(wre=>{"use strict";Object.defineProperty(wre,"__esModule",{value:!0});wre.validateValue=wre.validateKey=void 0;var cIt="[_0-9a-z-*/]",OHo=`[a-z]${cIt}{0,255}`,NHo=`[a-z0-9]${cIt}{0,240}@[a-z]${cIt}{0,13}`,BHo=new RegExp(`^(?:${OHo}|${NHo})$`),PHo=/^[ -~]{0,255}[!-~]$/,MHo=/,|=/;function FHo(t){return BHo.test(t)}wre.validateKey=FHo;function LHo(t){return PHo.test(t)&&!MHo.test(t)}wre.validateValue=LHo});var uIt=T(WUe=>{"use strict";Object.defineProperty(WUe,"__esModule",{value:!0});WUe.TraceState=void 0;var irn=nrn(),orn=32,UHo=512,srn=",",arn="=",lIt=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+arn+this.get(r)),e),[]).join(srn)}_parse(e){e.length>UHo||(this._internalState=e.split(srn).reverse().reduce((r,n)=>{let o=n.trim(),s=o.indexOf(arn);if(s!==-1){let a=o.slice(0,s),c=o.slice(s+1,n.length);(0,irn.validateKey)(a)&&(0,irn.validateValue)(c)&&r.set(a,c)}return r},new Map),this._internalState.size>orn&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,orn))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}};WUe.TraceState=lIt});var lrn=T(m1=>{"use strict";Object.defineProperty(m1,"__esModule",{value:!0});m1.W3CTraceContextPropagator=m1.parseTraceParent=m1.TRACE_STATE_HEADER=m1.TRACE_PARENT_HEADER=void 0;var zUe=(Xt(),gt(ar)),$Ho=X2e(),jHo=uIt();m1.TRACE_PARENT_HEADER="traceparent";m1.TRACE_STATE_HEADER="tracestate";var QHo="00",GHo="(?!ff)[\\da-f]{2}",qHo="(?![0]{32})[\\da-f]{32}",HHo="(?![0]{16})[\\da-f]{16}",VHo="[\\da-f]{2}",WHo=new RegExp(`^\\s?(${GHo})-(${qHo})-(${HHo})-(${VHo})(-.*)?\\s?$`);function crn(t){let e=WHo.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}m1.parseTraceParent=crn;var dIt=class{inject(e,r,n){let o=zUe.trace.getSpanContext(e);if(!o||(0,$Ho.isTracingSuppressed)(e)||!(0,zUe.isSpanContextValid)(o))return;let s=`${QHo}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||zUe.TraceFlags.NONE).toString(16)}`;n.set(r,m1.TRACE_PARENT_HEADER,s),o.traceState&&n.set(r,m1.TRACE_STATE_HEADER,o.traceState.serialize())}extract(e,r,n){let o=n.get(r,m1.TRACE_PARENT_HEADER);if(!o)return e;let s=Array.isArray(o)?o[0]:o;if(typeof s!="string")return e;let a=crn(s);if(!a)return e;a.isRemote=!0;let c=n.get(r,m1.TRACE_STATE_HEADER);if(c){let u=Array.isArray(c)?c.join(","):c;a.traceState=new jHo.TraceState(typeof u=="string"?u:void 0)}return zUe.trace.setSpanContext(e,a)}fields(){return[m1.TRACE_PARENT_HEADER,m1.TRACE_STATE_HEADER]}};m1.W3CTraceContextPropagator=dIt});var urn=T(Kw=>{"use strict";Object.defineProperty(Kw,"__esModule",{value:!0});Kw.getRPCMetadata=Kw.deleteRPCMetadata=Kw.setRPCMetadata=Kw.RPCType=void 0;var zHo=(Xt(),gt(ar)),fIt=(0,zHo.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"),YHo;(function(t){t.HTTP="http"})(YHo=Kw.RPCType||(Kw.RPCType={}));function KHo(t,e){return t.setValue(fIt,e)}Kw.setRPCMetadata=KHo;function JHo(t){return t.deleteValue(fIt)}Kw.deleteRPCMetadata=JHo;function XHo(t){return t.getValue(fIt)}Kw.getRPCMetadata=XHo});var mrn=T(YUe=>{"use strict";Object.defineProperty(YUe,"__esModule",{value:!0});YUe.isPlainObject=void 0;var ZHo="[object Object]",eVo="[object Null]",tVo="[object Undefined]",rVo=Function.prototype,drn=rVo.toString,nVo=drn.call(Object),iVo=Object.getPrototypeOf,frn=Object.prototype,prn=frn.hasOwnProperty,lq=Symbol?Symbol.toStringTag:void 0,hrn=frn.toString;function oVo(t){if(!sVo(t)||aVo(t)!==ZHo)return!1;let e=iVo(t);if(e===null)return!0;let r=prn.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&drn.call(r)===nVo}YUe.isPlainObject=oVo;function sVo(t){return t!=null&&typeof t=="object"}function aVo(t){return t==null?t===void 0?tVo:eVo:lq&&lq in Object(t)?cVo(t):lVo(t)}function cVo(t){let e=prn.call(t,lq),r=t[lq],n=!1;try{t[lq]=void 0,n=!0}catch{}let o=hrn.call(t);return n&&(e?t[lq]=r:delete t[lq]),o}function lVo(t){return hrn.call(t)}});var Ern=T(XUe=>{"use strict";Object.defineProperty(XUe,"__esModule",{value:!0});XUe.merge=void 0;var grn=mrn(),uVo=20;function dVo(...t){let e=t.shift(),r=new WeakMap;for(;t.length>0;)e=yrn(e,t.shift(),0,r);return e}XUe.merge=dVo;function pIt(t){return JUe(t)?t.slice():t}function yrn(t,e,r=0,n){let o;if(!(r>uVo)){if(r++,KUe(t)||KUe(e)||_rn(e))o=pIt(e);else if(JUe(t)){if(o=t.slice(),JUe(e))for(let s=0,a=e.length;s<a;s++)o.push(pIt(e[s]));else if(t1e(e)){let s=Object.keys(e);for(let a=0,c=s.length;a<c;a++){let u=s[a];o[u]=pIt(e[u])}}}else if(t1e(t))if(t1e(e)){if(!fVo(t,e))return e;o=Object.assign({},t);let s=Object.keys(e);for(let a=0,c=s.length;a<c;a++){let u=s[a],d=e[u];if(KUe(d))typeof d>"u"?delete o[u]:o[u]=d;else{let f=o[u],p=d;if(Arn(t,u,n)||Arn(e,u,n))delete o[u];else{if(t1e(f)&&t1e(p)){let h=n.get(f)||[],m=n.get(p)||[];h.push({obj:t,key:u}),m.push({obj:e,key:u}),n.set(f,h),n.set(p,m)}o[u]=yrn(o[u],d,r,n)}}}}else o=e;return o}}function Arn(t,e,r){let n=r.get(t[e])||[];for(let o=0,s=n.length;o<s;o++){let a=n[o];if(a.key===e&&a.obj===t)return!0}return!1}function JUe(t){return Array.isArray(t)}function _rn(t){return typeof t=="function"}function t1e(t){return!KUe(t)&&!JUe(t)&&!_rn(t)&&typeof t=="object"}function KUe(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function fVo(t,e){return!(!(0,grn.isPlainObject)(t)||!(0,grn.isPlainObject)(e))}});var vrn=T(xre=>{"use strict";Object.defineProperty(xre,"__esModule",{value:!0});xre.callWithTimeout=xre.TimeoutError=void 0;var ZUe=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};xre.TimeoutError=ZUe;function pVo(t,e){let r,n=new Promise(function(s,a){r=setTimeout(function(){a(new ZUe("Operation timed out."))},e)});return Promise.race([t,n]).then(o=>(clearTimeout(r),o),o=>{throw clearTimeout(r),o})}xre.callWithTimeout=pVo});var Crn=T(Tre=>{"use strict";Object.defineProperty(Tre,"__esModule",{value:!0});Tre.isUrlIgnored=Tre.urlMatches=void 0;function brn(t,e){return typeof e=="string"?t===e:!!t.match(e)}Tre.urlMatches=brn;function hVo(t,e){if(!e)return!1;for(let r of e)if(brn(t,r))return!0;return!1}Tre.isUrlIgnored=hVo});var Srn=T(e$e=>{"use strict";Object.defineProperty(e$e,"__esModule",{value:!0});e$e.Deferred=void 0;var hIt=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)}};e$e.Deferred=hIt});var wrn=T(t$e=>{"use strict";Object.defineProperty(t$e,"__esModule",{value:!0});t$e.BindOnceFuture=void 0;var mVo=Srn(),mIt=class{_isCalled=!1;_deferred=new mVo.Deferred;_callback;_that;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}};t$e.BindOnceFuture=mIt});var Trn=T(r$e=>{"use strict";Object.defineProperty(r$e,"__esModule",{value:!0});r$e.diagLogLevelFromString=void 0;var vR=(Xt(),gt(ar)),xrn={ALL:vR.DiagLogLevel.ALL,VERBOSE:vR.DiagLogLevel.VERBOSE,DEBUG:vR.DiagLogLevel.DEBUG,INFO:vR.DiagLogLevel.INFO,WARN:vR.DiagLogLevel.WARN,ERROR:vR.DiagLogLevel.ERROR,NONE:vR.DiagLogLevel.NONE};function gVo(t){if(t==null)return;let e=xrn[t.toUpperCase()];return e??(vR.diag.warn(`Unknown log level "${t}", expected one of ${Object.keys(xrn)}, using default`),vR.DiagLogLevel.INFO)}r$e.diagLogLevelFromString=gVo});var Irn=T(n$e=>{"use strict";Object.defineProperty(n$e,"__esModule",{value:!0});n$e._export=void 0;var Drn=(Xt(),gt(ar)),AVo=X2e();function yVo(t,e){return new Promise(r=>{Drn.context.with((0,AVo.suppressTracing)(Drn.context.active()),()=>{t.export(e,n=>{r(n)})})})}n$e._export=yVo});var AIt=T(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.internal=Hr.diagLogLevelFromString=Hr.BindOnceFuture=Hr.urlMatches=Hr.isUrlIgnored=Hr.callWithTimeout=Hr.TimeoutError=Hr.merge=Hr.TraceState=Hr.unsuppressTracing=Hr.suppressTracing=Hr.isTracingSuppressed=Hr.setRPCMetadata=Hr.getRPCMetadata=Hr.deleteRPCMetadata=Hr.RPCType=Hr.parseTraceParent=Hr.W3CTraceContextPropagator=Hr.TRACE_STATE_HEADER=Hr.TRACE_PARENT_HEADER=Hr.CompositePropagator=Hr.otperformance=Hr.getStringListFromEnv=Hr.getNumberFromEnv=Hr.getBooleanFromEnv=Hr.getStringFromEnv=Hr._globalThis=Hr.SDK_INFO=Hr.parseKeyPairsIntoRecord=Hr.ExportResultCode=Hr.unrefTimer=Hr.timeInputToHrTime=Hr.millisToHrTime=Hr.isTimeInputHrTime=Hr.isTimeInput=Hr.hrTimeToTimeStamp=Hr.hrTimeToNanoseconds=Hr.hrTimeToMilliseconds=Hr.hrTimeToMicroseconds=Hr.hrTimeDuration=Hr.hrTime=Hr.getTimeOrigin=Hr.addHrTimes=Hr.loggingErrorHandler=Hr.setGlobalErrorHandler=Hr.globalErrorHandler=Hr.sanitizeAttributes=Hr.isAttributeValue=Hr.AnchoredClock=Hr.W3CBaggagePropagator=void 0;var _Vo=ktn();Object.defineProperty(Hr,"W3CBaggagePropagator",{enumerable:!0,get:function(){return _Vo.W3CBaggagePropagator}});var EVo=Otn();Object.defineProperty(Hr,"AnchoredClock",{enumerable:!0,get:function(){return EVo.AnchoredClock}});var Rrn=Ftn();Object.defineProperty(Hr,"isAttributeValue",{enumerable:!0,get:function(){return Rrn.isAttributeValue}});Object.defineProperty(Hr,"sanitizeAttributes",{enumerable:!0,get:function(){return Rrn.sanitizeAttributes}});var krn=Utn();Object.defineProperty(Hr,"globalErrorHandler",{enumerable:!0,get:function(){return krn.globalErrorHandler}});Object.defineProperty(Hr,"setGlobalErrorHandler",{enumerable:!0,get:function(){return krn.setGlobalErrorHandler}});var vVo=iIt();Object.defineProperty(Hr,"loggingErrorHandler",{enumerable:!0,get:function(){return vVo.loggingErrorHandler}});var kC=Xtn();Object.defineProperty(Hr,"addHrTimes",{enumerable:!0,get:function(){return kC.addHrTimes}});Object.defineProperty(Hr,"getTimeOrigin",{enumerable:!0,get:function(){return kC.getTimeOrigin}});Object.defineProperty(Hr,"hrTime",{enumerable:!0,get:function(){return kC.hrTime}});Object.defineProperty(Hr,"hrTimeDuration",{enumerable:!0,get:function(){return kC.hrTimeDuration}});Object.defineProperty(Hr,"hrTimeToMicroseconds",{enumerable:!0,get:function(){return kC.hrTimeToMicroseconds}});Object.defineProperty(Hr,"hrTimeToMilliseconds",{enumerable:!0,get:function(){return kC.hrTimeToMilliseconds}});Object.defineProperty(Hr,"hrTimeToNanoseconds",{enumerable:!0,get:function(){return kC.hrTimeToNanoseconds}});Object.defineProperty(Hr,"hrTimeToTimeStamp",{enumerable:!0,get:function(){return kC.hrTimeToTimeStamp}});Object.defineProperty(Hr,"isTimeInput",{enumerable:!0,get:function(){return kC.isTimeInput}});Object.defineProperty(Hr,"isTimeInputHrTime",{enumerable:!0,get:function(){return kC.isTimeInputHrTime}});Object.defineProperty(Hr,"millisToHrTime",{enumerable:!0,get:function(){return kC.millisToHrTime}});Object.defineProperty(Hr,"timeInputToHrTime",{enumerable:!0,get:function(){return kC.timeInputToHrTime}});var bVo=Ztn();Object.defineProperty(Hr,"unrefTimer",{enumerable:!0,get:function(){return bVo.unrefTimer}});var CVo=ern();Object.defineProperty(Hr,"ExportResultCode",{enumerable:!0,get:function(){return CVo.ExportResultCode}});var SVo=Z9t();Object.defineProperty(Hr,"parseKeyPairsIntoRecord",{enumerable:!0,get:function(){return SVo.parseKeyPairsIntoRecord}});var uq=oIt();Object.defineProperty(Hr,"SDK_INFO",{enumerable:!0,get:function(){return uq.SDK_INFO}});Object.defineProperty(Hr,"_globalThis",{enumerable:!0,get:function(){return uq._globalThis}});Object.defineProperty(Hr,"getStringFromEnv",{enumerable:!0,get:function(){return uq.getStringFromEnv}});Object.defineProperty(Hr,"getBooleanFromEnv",{enumerable:!0,get:function(){return uq.getBooleanFromEnv}});Object.defineProperty(Hr,"getNumberFromEnv",{enumerable:!0,get:function(){return uq.getNumberFromEnv}});Object.defineProperty(Hr,"getStringListFromEnv",{enumerable:!0,get:function(){return uq.getStringListFromEnv}});Object.defineProperty(Hr,"otperformance",{enumerable:!0,get:function(){return uq.otperformance}});var wVo=rrn();Object.defineProperty(Hr,"CompositePropagator",{enumerable:!0,get:function(){return wVo.CompositePropagator}});var i$e=lrn();Object.defineProperty(Hr,"TRACE_PARENT_HEADER",{enumerable:!0,get:function(){return i$e.TRACE_PARENT_HEADER}});Object.defineProperty(Hr,"TRACE_STATE_HEADER",{enumerable:!0,get:function(){return i$e.TRACE_STATE_HEADER}});Object.defineProperty(Hr,"W3CTraceContextPropagator",{enumerable:!0,get:function(){return i$e.W3CTraceContextPropagator}});Object.defineProperty(Hr,"parseTraceParent",{enumerable:!0,get:function(){return i$e.parseTraceParent}});var o$e=urn();Object.defineProperty(Hr,"RPCType",{enumerable:!0,get:function(){return o$e.RPCType}});Object.defineProperty(Hr,"deleteRPCMetadata",{enumerable:!0,get:function(){return o$e.deleteRPCMetadata}});Object.defineProperty(Hr,"getRPCMetadata",{enumerable:!0,get:function(){return o$e.getRPCMetadata}});Object.defineProperty(Hr,"setRPCMetadata",{enumerable:!0,get:function(){return o$e.setRPCMetadata}});var gIt=X2e();Object.defineProperty(Hr,"isTracingSuppressed",{enumerable:!0,get:function(){return gIt.isTracingSuppressed}});Object.defineProperty(Hr,"suppressTracing",{enumerable:!0,get:function(){return gIt.suppressTracing}});Object.defineProperty(Hr,"unsuppressTracing",{enumerable:!0,get:function(){return gIt.unsuppressTracing}});var xVo=uIt();Object.defineProperty(Hr,"TraceState",{enumerable:!0,get:function(){return xVo.TraceState}});var TVo=Ern();Object.defineProperty(Hr,"merge",{enumerable:!0,get:function(){return TVo.merge}});var Orn=vrn();Object.defineProperty(Hr,"TimeoutError",{enumerable:!0,get:function(){return Orn.TimeoutError}});Object.defineProperty(Hr,"callWithTimeout",{enumerable:!0,get:function(){return Orn.callWithTimeout}});var Nrn=Crn();Object.defineProperty(Hr,"isUrlIgnored",{enumerable:!0,get:function(){return Nrn.isUrlIgnored}});Object.defineProperty(Hr,"urlMatches",{enumerable:!0,get:function(){return Nrn.urlMatches}});var DVo=wrn();Object.defineProperty(Hr,"BindOnceFuture",{enumerable:!0,get:function(){return DVo.BindOnceFuture}});var IVo=Trn();Object.defineProperty(Hr,"diagLogLevelFromString",{enumerable:!0,get:function(){return IVo.diagLogLevelFromString}});var RVo=Irn();Hr.internal={_export:RVo._export}});var yIt=T(s$e=>{"use strict";Object.defineProperty(s$e,"__esModule",{value:!0});s$e.defaultServiceName=void 0;var kVo=typeof process=="object"&&typeof process.argv0=="string"&&process.argv0.length>0?`unknown_service:${process.argv0}`:"unknown_service";function OVo(){return kVo}s$e.defaultServiceName=OVo});var Brn=T(a$e=>{"use strict";Object.defineProperty(a$e,"__esModule",{value:!0});a$e.isPromiseLike=void 0;var NVo=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";a$e.isPromiseLike=NVo});var vIt=T(j8=>{"use strict";Object.defineProperty(j8,"__esModule",{value:!0});j8.defaultResource=j8.emptyResource=j8.resourceFromDetectedResource=j8.resourceFromAttributes=void 0;var n1e=(Xt(),gt(ar)),_It=AIt(),dq=(Bh(),gt(f0)),BVo=yIt(),r1e=Brn(),c$e=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,r){let n=new t({},r);return n._rawAttributes=Prn(e),n._asyncAttributesPending=e.filter(([o,s])=>(0,r1e.isPromiseLike)(s)).length>0,n}constructor(e,r){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([o,s])=>((0,r1e.isPromiseLike)(s)&&(this._asyncAttributesPending=!0),[o,s])),this._rawAttributes=Prn(this._rawAttributes),this._schemaUrl=LVo(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,r1e.isPromiseLike)(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&n1e.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,r1e.isPromiseLike)(n)){n1e.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=UVo(this,e),n=r?{schemaUrl:r}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],n)}};function EIt(t,e){return c$e.FromAttributeList(Object.entries(t),e)}j8.resourceFromAttributes=EIt;function PVo(t,e){return new c$e(t,e)}j8.resourceFromDetectedResource=PVo;function MVo(){return EIt({})}j8.emptyResource=MVo;function FVo(){return EIt({[dq.ATTR_SERVICE_NAME]:(0,BVo.defaultServiceName)(),[dq.ATTR_TELEMETRY_SDK_LANGUAGE]:_It.SDK_INFO[dq.ATTR_TELEMETRY_SDK_LANGUAGE],[dq.ATTR_TELEMETRY_SDK_NAME]:_It.SDK_INFO[dq.ATTR_TELEMETRY_SDK_NAME],[dq.ATTR_TELEMETRY_SDK_VERSION]:_It.SDK_INFO[dq.ATTR_TELEMETRY_SDK_VERSION]})}j8.defaultResource=FVo;function Prn(t){return t.map(([e,r])=>(0,r1e.isPromiseLike)(r)?[e,r.catch(n=>{n1e.diag.debug("promise rejection for resource attribute: %s - %s",e,n)})]:[e,r])}function LVo(t){if(typeof t=="string"||t===void 0)return t;n1e.diag.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function UVo(t,e){let r=t?.schemaUrl,n=e?.schemaUrl,o=r===void 0||r==="",s=n===void 0||n==="";if(o)return n;if(s||r===n)return r;n1e.diag.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}});var Frn=T(l$e=>{"use strict";Object.defineProperty(l$e,"__esModule",{value:!0});l$e.detectResources=void 0;var Mrn=(Xt(),gt(ar)),bIt=vIt(),$Vo=(t={})=>(t.detectors||[]).map(r=>{try{let n=(0,bIt.resourceFromDetectedResource)(r.detect(t));return Mrn.diag.debug(`${r.constructor.name} found resource.`,n),n}catch(n){return Mrn.diag.debug(`${r.constructor.name} failed: ${n.message}`),(0,bIt.emptyResource)()}}).reduce((r,n)=>r.merge(n),(0,bIt.emptyResource)());l$e.detectResources=$Vo});var Urn=T(u$e=>{"use strict";Object.defineProperty(u$e,"__esModule",{value:!0});u$e.envDetector=void 0;var jVo=(Xt(),gt(ar)),QVo=(Bh(),gt(f0)),Lrn=AIt(),CIt=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,Lrn.getStringFromEnv)("OTEL_RESOURCE_ATTRIBUTES"),o=(0,Lrn.getStringFromEnv)("OTEL_SERVICE_NAME");if(n)try{let s=this._parseResourceAttributes(n);Object.assign(r,s)}catch(s){jVo.diag.debug(`EnvDetector failed: ${s.message}`)}return o&&(r[QVo.ATTR_SERVICE_NAME]=o),{attributes:r}}_parseResourceAttributes(e){if(!e)return{};let r={},n=e.split(this._COMMA_SEPARATOR,-1);for(let o of n){let s=o.split(this._LABEL_KEY_VALUE_SPLITTER,-1);if(s.length!==2)continue;let[a,c]=s;if(a=a.trim(),c=c.trim().split(/^"|"$/).join(""),!this._isValidAndNotEmpty(a))throw new Error(`Attribute key ${this._ERROR_MESSAGE_INVALID_CHARS}`);if(!this._isValid(c))throw new Error(`Attribute value ${this._ERROR_MESSAGE_INVALID_VALUE}`);r[a]=decodeURIComponent(c)}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)}};u$e.envDetector=new CIt});var i1e=T(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.ATTR_WEBENGINE_VERSION=Kn.ATTR_WEBENGINE_NAME=Kn.ATTR_WEBENGINE_DESCRIPTION=Kn.ATTR_SERVICE_NAMESPACE=Kn.ATTR_SERVICE_INSTANCE_ID=Kn.ATTR_PROCESS_RUNTIME_VERSION=Kn.ATTR_PROCESS_RUNTIME_NAME=Kn.ATTR_PROCESS_RUNTIME_DESCRIPTION=Kn.ATTR_PROCESS_PID=Kn.ATTR_PROCESS_OWNER=Kn.ATTR_PROCESS_EXECUTABLE_PATH=Kn.ATTR_PROCESS_EXECUTABLE_NAME=Kn.ATTR_PROCESS_COMMAND_ARGS=Kn.ATTR_PROCESS_COMMAND=Kn.ATTR_OS_VERSION=Kn.ATTR_OS_TYPE=Kn.ATTR_K8S_POD_NAME=Kn.ATTR_K8S_NAMESPACE_NAME=Kn.ATTR_K8S_DEPLOYMENT_NAME=Kn.ATTR_K8S_CLUSTER_NAME=Kn.ATTR_HOST_TYPE=Kn.ATTR_HOST_NAME=Kn.ATTR_HOST_IMAGE_VERSION=Kn.ATTR_HOST_IMAGE_NAME=Kn.ATTR_HOST_IMAGE_ID=Kn.ATTR_HOST_ID=Kn.ATTR_HOST_ARCH=Kn.ATTR_CONTAINER_NAME=Kn.ATTR_CONTAINER_IMAGE_TAGS=Kn.ATTR_CONTAINER_IMAGE_NAME=Kn.ATTR_CONTAINER_ID=Kn.ATTR_CLOUD_REGION=Kn.ATTR_CLOUD_PROVIDER=Kn.ATTR_CLOUD_AVAILABILITY_ZONE=Kn.ATTR_CLOUD_ACCOUNT_ID=void 0;Kn.ATTR_CLOUD_ACCOUNT_ID="cloud.account.id";Kn.ATTR_CLOUD_AVAILABILITY_ZONE="cloud.availability_zone";Kn.ATTR_CLOUD_PROVIDER="cloud.provider";Kn.ATTR_CLOUD_REGION="cloud.region";Kn.ATTR_CONTAINER_ID="container.id";Kn.ATTR_CONTAINER_IMAGE_NAME="container.image.name";Kn.ATTR_CONTAINER_IMAGE_TAGS="container.image.tags";Kn.ATTR_CONTAINER_NAME="container.name";Kn.ATTR_HOST_ARCH="host.arch";Kn.ATTR_HOST_ID="host.id";Kn.ATTR_HOST_IMAGE_ID="host.image.id";Kn.ATTR_HOST_IMAGE_NAME="host.image.name";Kn.ATTR_HOST_IMAGE_VERSION="host.image.version";Kn.ATTR_HOST_NAME="host.name";Kn.ATTR_HOST_TYPE="host.type";Kn.ATTR_K8S_CLUSTER_NAME="k8s.cluster.name";Kn.ATTR_K8S_DEPLOYMENT_NAME="k8s.deployment.name";Kn.ATTR_K8S_NAMESPACE_NAME="k8s.namespace.name";Kn.ATTR_K8S_POD_NAME="k8s.pod.name";Kn.ATTR_OS_TYPE="os.type";Kn.ATTR_OS_VERSION="os.version";Kn.ATTR_PROCESS_COMMAND="process.command";Kn.ATTR_PROCESS_COMMAND_ARGS="process.command_args";Kn.ATTR_PROCESS_EXECUTABLE_NAME="process.executable.name";Kn.ATTR_PROCESS_EXECUTABLE_PATH="process.executable.path";Kn.ATTR_PROCESS_OWNER="process.owner";Kn.ATTR_PROCESS_PID="process.pid";Kn.ATTR_PROCESS_RUNTIME_DESCRIPTION="process.runtime.description";Kn.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name";Kn.ATTR_PROCESS_RUNTIME_VERSION="process.runtime.version";Kn.ATTR_SERVICE_INSTANCE_ID="service.instance.id";Kn.ATTR_SERVICE_NAMESPACE="service.namespace";Kn.ATTR_WEBENGINE_DESCRIPTION="webengine.description";Kn.ATTR_WEBENGINE_NAME="webengine.name";Kn.ATTR_WEBENGINE_VERSION="webengine.version"});var f$e=T(d$e=>{"use strict";Object.defineProperty(d$e,"__esModule",{value:!0});d$e.execAsync=void 0;var GVo=me("child_process"),qVo=me("util");d$e.execAsync=qVo.promisify(GVo.exec)});var $rn=T(p$e=>{"use strict";Object.defineProperty(p$e,"__esModule",{value:!0});p$e.getMachineId=void 0;var HVo=f$e(),VVo=(Xt(),gt(ar));async function WVo(){try{let e=(await(0,HVo.execAsync)('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split(`
493
493
  `).find(n=>n.includes("IOPlatformUUID"));if(!e)return;let r=e.split('" = "');if(r.length===2)return r[1].slice(0,-1)}catch(t){VVo.diag.debug(`error reading machine id: ${t}`)}}p$e.getMachineId=WVo});var jrn=T(h$e=>{"use strict";Object.defineProperty(h$e,"__esModule",{value:!0});h$e.getMachineId=void 0;var zVo=me("fs"),YVo=(Xt(),gt(ar));async function KVo(){let t=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let e of t)try{return(await zVo.promises.readFile(e,{encoding:"utf8"})).trim()}catch(r){YVo.diag.debug(`error reading machine id: ${r}`)}}h$e.getMachineId=KVo});var Grn=T(m$e=>{"use strict";Object.defineProperty(m$e,"__esModule",{value:!0});m$e.getMachineId=void 0;var JVo=me("fs"),XVo=f$e(),Qrn=(Xt(),gt(ar));async function ZVo(){try{return(await JVo.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(t){Qrn.diag.debug(`error reading machine id: ${t}`)}try{return(await(0,XVo.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(t){Qrn.diag.debug(`error reading machine id: ${t}`)}}m$e.getMachineId=ZVo});var Hrn=T(g$e=>{"use strict";Object.defineProperty(g$e,"__esModule",{value:!0});g$e.getMachineId=void 0;var qrn=me("process"),eWo=f$e(),tWo=(Xt(),gt(ar));async function rWo(){let t="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",e="%windir%\\System32\\REG.exe";qrn.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in qrn.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{let n=(await(0,eWo.execAsync)(`${e} ${t}`)).stdout.split("REG_SZ");if(n.length===2)return n[1].trim()}catch(r){tWo.diag.debug(`error reading machine id: ${r}`)}}g$e.getMachineId=rWo});var Vrn=T(A$e=>{"use strict";Object.defineProperty(A$e,"__esModule",{value:!0});A$e.getMachineId=void 0;var nWo=(Xt(),gt(ar));async function iWo(){nWo.diag.debug("could not read machine-id: unsupported platform")}A$e.getMachineId=iWo});var Wrn=T(y$e=>{"use strict";Object.defineProperty(y$e,"__esModule",{value:!0});y$e.getMachineId=void 0;var oWo=me("process"),fq;async function sWo(){if(!fq)switch(oWo.platform){case"darwin":fq=(await Promise.resolve().then(()=>Se($rn()))).getMachineId;break;case"linux":fq=(await Promise.resolve().then(()=>Se(jrn()))).getMachineId;break;case"freebsd":fq=(await Promise.resolve().then(()=>Se(Grn()))).getMachineId;break;case"win32":fq=(await Promise.resolve().then(()=>Se(Hrn()))).getMachineId;break;default:fq=(await Promise.resolve().then(()=>Se(Vrn()))).getMachineId;break}return fq()}y$e.getMachineId=sWo});var SIt=T(Dre=>{"use strict";Object.defineProperty(Dre,"__esModule",{value:!0});Dre.normalizeType=Dre.normalizeArch=void 0;var aWo=t=>{switch(t){case"arm":return"arm32";case"ppc":return"ppc32";case"x64":return"amd64";default:return t}};Dre.normalizeArch=aWo;var cWo=t=>{switch(t){case"sunos":return"solaris";case"win32":return"windows";default:return t}};Dre.normalizeType=cWo});var Yrn=T(_$e=>{"use strict";Object.defineProperty(_$e,"__esModule",{value:!0});_$e.hostDetector=void 0;var wIt=i1e(),zrn=me("os"),lWo=Wrn(),uWo=SIt(),xIt=class{detect(e){return{attributes:{[wIt.ATTR_HOST_NAME]:(0,zrn.hostname)(),[wIt.ATTR_HOST_ARCH]:(0,uWo.normalizeArch)((0,zrn.arch)()),[wIt.ATTR_HOST_ID]:(0,lWo.getMachineId)()}}}};_$e.hostDetector=new xIt});var Xrn=T(E$e=>{"use strict";Object.defineProperty(E$e,"__esModule",{value:!0});E$e.osDetector=void 0;var Krn=i1e(),Jrn=me("os"),dWo=SIt(),TIt=class{detect(e){return{attributes:{[Krn.ATTR_OS_TYPE]:(0,dWo.normalizeType)((0,Jrn.platform)()),[Krn.ATTR_OS_VERSION]:(0,Jrn.release)()}}}};E$e.osDetector=new TIt});var Zrn=T(v$e=>{"use strict";Object.defineProperty(v$e,"__esModule",{value:!0});v$e.processDetector=void 0;var fWo=(Xt(),gt(ar)),bR=i1e(),pWo=me("os"),DIt=class{detect(e){let r={[bR.ATTR_PROCESS_PID]:process.pid,[bR.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[bR.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[bR.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[bR.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[bR.ATTR_PROCESS_RUNTIME_NAME]:"nodejs",[bR.ATTR_PROCESS_RUNTIME_DESCRIPTION]:"Node.js"};process.argv.length>1&&(r[bR.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let n=pWo.userInfo();r[bR.ATTR_PROCESS_OWNER]=n.username}catch(n){fWo.diag.debug(`error obtaining process owner: ${n}`)}return{attributes:r}}};v$e.processDetector=new DIt});var enn=T(b$e=>{"use strict";Object.defineProperty(b$e,"__esModule",{value:!0});b$e.serviceInstanceIdDetector=void 0;var hWo=i1e(),mWo=me("crypto"),IIt=class{detect(e){return{attributes:{[hWo.ATTR_SERVICE_INSTANCE_ID]:(0,mWo.randomUUID)()}}}};b$e.serviceInstanceIdDetector=new IIt});var tnn=T(Q8=>{"use strict";Object.defineProperty(Q8,"__esModule",{value:!0});Q8.serviceInstanceIdDetector=Q8.processDetector=Q8.osDetector=Q8.hostDetector=void 0;var gWo=Yrn();Object.defineProperty(Q8,"hostDetector",{enumerable:!0,get:function(){return gWo.hostDetector}});var AWo=Xrn();Object.defineProperty(Q8,"osDetector",{enumerable:!0,get:function(){return AWo.osDetector}});var yWo=Zrn();Object.defineProperty(Q8,"processDetector",{enumerable:!0,get:function(){return yWo.processDetector}});var _Wo=enn();Object.defineProperty(Q8,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return _Wo.serviceInstanceIdDetector}})});var rnn=T(G8=>{"use strict";Object.defineProperty(G8,"__esModule",{value:!0});G8.serviceInstanceIdDetector=G8.processDetector=G8.osDetector=G8.hostDetector=void 0;var C$e=tnn();Object.defineProperty(G8,"hostDetector",{enumerable:!0,get:function(){return C$e.hostDetector}});Object.defineProperty(G8,"osDetector",{enumerable:!0,get:function(){return C$e.osDetector}});Object.defineProperty(G8,"processDetector",{enumerable:!0,get:function(){return C$e.processDetector}});Object.defineProperty(G8,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return C$e.serviceInstanceIdDetector}})});var nnn=T(Ire=>{"use strict";Object.defineProperty(Ire,"__esModule",{value:!0});Ire.noopDetector=Ire.NoopDetector=void 0;var S$e=class{detect(){return{attributes:{}}}};Ire.NoopDetector=S$e;Ire.noopDetector=new S$e});var inn=T(J_=>{"use strict";Object.defineProperty(J_,"__esModule",{value:!0});J_.noopDetector=J_.serviceInstanceIdDetector=J_.processDetector=J_.osDetector=J_.hostDetector=J_.envDetector=void 0;var EWo=Urn();Object.defineProperty(J_,"envDetector",{enumerable:!0,get:function(){return EWo.envDetector}});var w$e=rnn();Object.defineProperty(J_,"hostDetector",{enumerable:!0,get:function(){return w$e.hostDetector}});Object.defineProperty(J_,"osDetector",{enumerable:!0,get:function(){return w$e.osDetector}});Object.defineProperty(J_,"processDetector",{enumerable:!0,get:function(){return w$e.processDetector}});Object.defineProperty(J_,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return w$e.serviceInstanceIdDetector}});var vWo=nnn();Object.defineProperty(J_,"noopDetector",{enumerable:!0,get:function(){return vWo.noopDetector}})});var onn=T(rh=>{"use strict";Object.defineProperty(rh,"__esModule",{value:!0});rh.defaultServiceName=rh.emptyResource=rh.defaultResource=rh.resourceFromAttributes=rh.serviceInstanceIdDetector=rh.processDetector=rh.osDetector=rh.hostDetector=rh.envDetector=rh.detectResources=void 0;var bWo=Frn();Object.defineProperty(rh,"detectResources",{enumerable:!0,get:function(){return bWo.detectResources}});var o1e=inn();Object.defineProperty(rh,"envDetector",{enumerable:!0,get:function(){return o1e.envDetector}});Object.defineProperty(rh,"hostDetector",{enumerable:!0,get:function(){return o1e.hostDetector}});Object.defineProperty(rh,"osDetector",{enumerable:!0,get:function(){return o1e.osDetector}});Object.defineProperty(rh,"processDetector",{enumerable:!0,get:function(){return o1e.processDetector}});Object.defineProperty(rh,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return o1e.serviceInstanceIdDetector}});var RIt=vIt();Object.defineProperty(rh,"resourceFromAttributes",{enumerable:!0,get:function(){return RIt.resourceFromAttributes}});Object.defineProperty(rh,"defaultResource",{enumerable:!0,get:function(){return RIt.defaultResource}});Object.defineProperty(rh,"emptyResource",{enumerable:!0,get:function(){return RIt.emptyResource}});var CWo=yIt();Object.defineProperty(rh,"defaultServiceName",{enumerable:!0,get:function(){return CWo.defaultServiceName}})});var snn=T(s1e=>{"use strict";Object.defineProperty(s1e,"__esModule",{value:!0});s1e.SeverityNumber=void 0;var SWo;(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"})(SWo=s1e.SeverityNumber||(s1e.SeverityNumber={}))});var T$e=T(Rre=>{"use strict";Object.defineProperty(Rre,"__esModule",{value:!0});Rre.NOOP_LOGGER=Rre.NoopLogger=void 0;var x$e=class{emit(e){}};Rre.NoopLogger=x$e;Rre.NOOP_LOGGER=new x$e});var I$e=T(kre=>{"use strict";Object.defineProperty(kre,"__esModule",{value:!0});kre.NOOP_LOGGER_PROVIDER=kre.NoopLoggerProvider=void 0;var wWo=T$e(),D$e=class{getLogger(e,r,n){return new wWo.NoopLogger}};kre.NoopLoggerProvider=D$e;kre.NOOP_LOGGER_PROVIDER=new D$e});var OIt=T(R$e=>{"use strict";Object.defineProperty(R$e,"__esModule",{value:!0});R$e.ProxyLogger=void 0;var xWo=T$e(),kIt=class{constructor(e,r,n,o){this._provider=e,this.name=r,this.version=n,this.options=o}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):xWo.NOOP_LOGGER}};R$e.ProxyLogger=kIt});var BIt=T(k$e=>{"use strict";Object.defineProperty(k$e,"__esModule",{value:!0});k$e.ProxyLoggerProvider=void 0;var TWo=I$e(),DWo=OIt(),NIt=class{getLogger(e,r,n){var o;return(o=this._getDelegateLogger(e,r,n))!==null&&o!==void 0?o:new DWo.ProxyLogger(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:TWo.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,r,n)}};k$e.ProxyLoggerProvider=NIt});var ann=T(O$e=>{"use strict";Object.defineProperty(O$e,"__esModule",{value:!0});O$e._globalThis=void 0;O$e._globalThis=typeof globalThis=="object"?globalThis:global});var cnn=T(N$e=>{"use strict";Object.defineProperty(N$e,"__esModule",{value:!0});N$e._globalThis=void 0;var IWo=ann();Object.defineProperty(N$e,"_globalThis",{enumerable:!0,get:function(){return IWo._globalThis}})});var lnn=T(B$e=>{"use strict";Object.defineProperty(B$e,"__esModule",{value:!0});B$e._globalThis=void 0;var RWo=cnn();Object.defineProperty(B$e,"_globalThis",{enumerable:!0,get:function(){return RWo._globalThis}})});var unn=T(q8=>{"use strict";Object.defineProperty(q8,"__esModule",{value:!0});q8.API_BACKWARDS_COMPATIBILITY_VERSION=q8.makeGetter=q8._global=q8.GLOBAL_LOGS_API_KEY=void 0;var kWo=lnn();q8.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");q8._global=kWo._globalThis;function OWo(t,e,r){return n=>n===t?e:r}q8.makeGetter=OWo;q8.API_BACKWARDS_COMPATIBILITY_VERSION=1});var fnn=T(P$e=>{"use strict";Object.defineProperty(P$e,"__esModule",{value:!0});P$e.LogsAPI=void 0;var OC=unn(),NWo=I$e(),dnn=BIt(),PIt=class t{constructor(){this._proxyLoggerProvider=new dnn.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return OC._global[OC.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(OC._global[OC.GLOBAL_LOGS_API_KEY]=(0,OC.makeGetter)(OC.API_BACKWARDS_COMPATIBILITY_VERSION,e,NWo.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=OC._global[OC.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(OC._global,OC.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete OC._global[OC.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new dnn.ProxyLoggerProvider}};P$e.LogsAPI=PIt});var mnn=T(C0=>{"use strict";Object.defineProperty(C0,"__esModule",{value:!0});C0.logs=C0.ProxyLoggerProvider=C0.ProxyLogger=C0.NoopLoggerProvider=C0.NOOP_LOGGER_PROVIDER=C0.NoopLogger=C0.NOOP_LOGGER=C0.SeverityNumber=void 0;var BWo=snn();Object.defineProperty(C0,"SeverityNumber",{enumerable:!0,get:function(){return BWo.SeverityNumber}});var pnn=T$e();Object.defineProperty(C0,"NOOP_LOGGER",{enumerable:!0,get:function(){return pnn.NOOP_LOGGER}});Object.defineProperty(C0,"NoopLogger",{enumerable:!0,get:function(){return pnn.NoopLogger}});var hnn=I$e();Object.defineProperty(C0,"NOOP_LOGGER_PROVIDER",{enumerable:!0,get:function(){return hnn.NOOP_LOGGER_PROVIDER}});Object.defineProperty(C0,"NoopLoggerProvider",{enumerable:!0,get:function(){return hnn.NoopLoggerProvider}});var PWo=OIt();Object.defineProperty(C0,"ProxyLogger",{enumerable:!0,get:function(){return PWo.ProxyLogger}});var MWo=BIt();Object.defineProperty(C0,"ProxyLoggerProvider",{enumerable:!0,get:function(){return MWo.ProxyLoggerProvider}});var FWo=fnn();C0.logs=FWo.LogsAPI.getInstance()});var a1e=T(jP=>{"use strict";Object.defineProperty(jP,"__esModule",{value:!0});jP.isTracingSuppressed=jP.unsuppressTracing=jP.suppressTracing=void 0;var LWo=(Xt(),gt(ar)),MIt=(0,LWo.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function UWo(t){return t.setValue(MIt,!0)}jP.suppressTracing=UWo;function $Wo(t){return t.deleteValue(MIt)}jP.unsuppressTracing=$Wo;function jWo(t){return t.getValue(MIt)===!0}jP.isTracingSuppressed=jWo});var FIt=T(g1=>{"use strict";Object.defineProperty(g1,"__esModule",{value:!0});g1.BAGGAGE_MAX_TOTAL_LENGTH=g1.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=g1.BAGGAGE_MAX_NAME_VALUE_PAIRS=g1.BAGGAGE_HEADER=g1.BAGGAGE_ITEMS_SEPARATOR=g1.BAGGAGE_PROPERTIES_SEPARATOR=g1.BAGGAGE_KEY_PAIR_SEPARATOR=void 0;g1.BAGGAGE_KEY_PAIR_SEPARATOR="=";g1.BAGGAGE_PROPERTIES_SEPARATOR=";";g1.BAGGAGE_ITEMS_SEPARATOR=",";g1.BAGGAGE_HEADER="baggage";g1.BAGGAGE_MAX_NAME_VALUE_PAIRS=180;g1.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096;g1.BAGGAGE_MAX_TOTAL_LENGTH=8192});var LIt=T(H8=>{"use strict";Object.defineProperty(H8,"__esModule",{value:!0});H8.parseKeyPairsIntoRecord=H8.parsePairKeyValue=H8.getKeyPairs=H8.serializeKeyPairs=void 0;var QWo=(Xt(),gt(ar)),pq=FIt();function GWo(t){return t.reduce((e,r)=>{let n=`${e}${e!==""?pq.BAGGAGE_ITEMS_SEPARATOR:""}${r}`;return n.length>pq.BAGGAGE_MAX_TOTAL_LENGTH?e:n},"")}H8.serializeKeyPairs=GWo;function qWo(t){return t.getAllEntries().map(([e,r])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=pq.BAGGAGE_PROPERTIES_SEPARATOR+r.metadata.toString()),n})}H8.getKeyPairs=qWo;function gnn(t){let e=t.split(pq.BAGGAGE_PROPERTIES_SEPARATOR);if(e.length<=0)return;let r=e.shift();if(!r)return;let n=r.indexOf(pq.BAGGAGE_KEY_PAIR_SEPARATOR);if(n<=0)return;let o=decodeURIComponent(r.substring(0,n).trim()),s=decodeURIComponent(r.substring(n+1).trim()),a;return e.length>0&&(a=(0,QWo.baggageEntryMetadataFromString)(e.join(pq.BAGGAGE_PROPERTIES_SEPARATOR))),{key:o,value:s,metadata:a}}H8.parsePairKeyValue=gnn;function HWo(t){let e={};return typeof t=="string"&&t.length>0&&t.split(pq.BAGGAGE_ITEMS_SEPARATOR).forEach(r=>{let n=gnn(r);n!==void 0&&n.value.length>0&&(e[n.key]=n.value)}),e}H8.parseKeyPairsIntoRecord=HWo});var Ann=T(M$e=>{"use strict";Object.defineProperty(M$e,"__esModule",{value:!0});M$e.W3CBaggagePropagator=void 0;var UIt=(Xt(),gt(ar)),VWo=a1e(),hq=FIt(),$It=LIt(),jIt=class{inject(e,r,n){let o=UIt.propagation.getBaggage(e);if(!o||(0,VWo.isTracingSuppressed)(e))return;let s=(0,$It.getKeyPairs)(o).filter(c=>c.length<=hq.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,hq.BAGGAGE_MAX_NAME_VALUE_PAIRS),a=(0,$It.serializeKeyPairs)(s);a.length>0&&n.set(r,hq.BAGGAGE_HEADER,a)}extract(e,r,n){let o=n.get(r,hq.BAGGAGE_HEADER),s=Array.isArray(o)?o.join(hq.BAGGAGE_ITEMS_SEPARATOR):o;if(!s)return e;let a={};return s.length===0||(s.split(hq.BAGGAGE_ITEMS_SEPARATOR).forEach(u=>{let d=(0,$It.parsePairKeyValue)(u);if(d){let f={value:d.value};d.metadata&&(f.metadata=d.metadata),a[d.key]=f}}),Object.entries(a).length===0)?e:UIt.propagation.setBaggage(e,UIt.propagation.createBaggage(a))}fields(){return[hq.BAGGAGE_HEADER]}};M$e.W3CBaggagePropagator=jIt});var ynn=T(F$e=>{"use strict";Object.defineProperty(F$e,"__esModule",{value:!0});F$e.AnchoredClock=void 0;var QIt=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}};F$e.AnchoredClock=QIt});var Cnn=T(QP=>{"use strict";Object.defineProperty(QP,"__esModule",{value:!0});QP.isAttributeValue=QP.isAttributeKey=QP.sanitizeAttributes=void 0;var _nn=(Xt(),gt(ar));function WWo(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(!Enn(r)){_nn.diag.warn(`Invalid attribute key: ${r}`);continue}let n=t[r];if(!vnn(n)){_nn.diag.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?e[r]=n.slice():e[r]=n}return e}QP.sanitizeAttributes=WWo;function Enn(t){return typeof t=="string"&&t!==""}QP.isAttributeKey=Enn;function vnn(t){return t==null?!0:Array.isArray(t)?zWo(t):bnn(typeof t)}QP.isAttributeValue=vnn;function zWo(t){let e;for(let r of t){if(r==null)continue;let n=typeof r;if(n!==e){if(!e){if(bnn(n)){e=n;continue}return!1}return!1}}return!0}function bnn(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}});var GIt=T(L$e=>{"use strict";Object.defineProperty(L$e,"__esModule",{value:!0});L$e.loggingErrorHandler=void 0;var YWo=(Xt(),gt(ar));function KWo(){return t=>{YWo.diag.error(JWo(t))}}L$e.loggingErrorHandler=KWo;function JWo(t){return typeof t=="string"?t:JSON.stringify(XWo(t))}function XWo(t){let e={},r=t;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(e[n])return;let o=r[n];o&&(e[n]=String(o))}),r=Object.getPrototypeOf(r);return e}});var wnn=T(Ore=>{"use strict";Object.defineProperty(Ore,"__esModule",{value:!0});Ore.globalErrorHandler=Ore.setGlobalErrorHandler=void 0;var ZWo=GIt(),Snn=(0,ZWo.loggingErrorHandler)();function ezo(t){Snn=t}Ore.setGlobalErrorHandler=ezo;function tzo(t){try{Snn(t)}catch{}}Ore.globalErrorHandler=tzo});var Inn=T(V8=>{"use strict";Object.defineProperty(V8,"__esModule",{value:!0});V8.getStringListFromEnv=V8.getBooleanFromEnv=V8.getStringFromEnv=V8.getNumberFromEnv=void 0;var xnn=(Xt(),gt(ar)),Tnn=me("util");function rzo(t){let e=process.env[t];if(e==null||e.trim()==="")return;let r=Number(e);if(isNaN(r)){xnn.diag.warn(`Unknown value ${(0,Tnn.inspect)(e)} for ${t}, expected a number, using defaults`);return}return r}V8.getNumberFromEnv=rzo;function Dnn(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}V8.getStringFromEnv=Dnn;function nzo(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||xnn.diag.warn(`Unknown value ${(0,Tnn.inspect)(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}V8.getBooleanFromEnv=nzo;function izo(t){return Dnn(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}V8.getStringListFromEnv=izo});var Rnn=T(U$e=>{"use strict";Object.defineProperty(U$e,"__esModule",{value:!0});U$e._globalThis=void 0;U$e._globalThis=typeof globalThis=="object"?globalThis:global});var knn=T($$e=>{"use strict";Object.defineProperty($$e,"__esModule",{value:!0});$$e.otperformance=void 0;var ozo=me("perf_hooks");$$e.otperformance=ozo.performance});var Onn=T(j$e=>{"use strict";Object.defineProperty(j$e,"__esModule",{value:!0});j$e.VERSION=void 0;j$e.VERSION="2.2.0"});var Nnn=T(Q$e=>{"use strict";Object.defineProperty(Q$e,"__esModule",{value:!0});Q$e.ATTR_PROCESS_RUNTIME_NAME=void 0;Q$e.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name"});var Bnn=T(q$e=>{"use strict";Object.defineProperty(q$e,"__esModule",{value:!0});q$e.SDK_INFO=void 0;var szo=Onn(),G$e=(Bh(),gt(f0)),azo=Nnn();q$e.SDK_INFO={[G$e.ATTR_TELEMETRY_SDK_NAME]:"opentelemetry",[azo.ATTR_PROCESS_RUNTIME_NAME]:"node",[G$e.ATTR_TELEMETRY_SDK_LANGUAGE]:G$e.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[G$e.ATTR_TELEMETRY_SDK_VERSION]:szo.VERSION}});var Pnn=T(A1=>{"use strict";Object.defineProperty(A1,"__esModule",{value:!0});A1.SDK_INFO=A1.otperformance=A1._globalThis=A1.getStringListFromEnv=A1.getNumberFromEnv=A1.getBooleanFromEnv=A1.getStringFromEnv=void 0;var H$e=Inn();Object.defineProperty(A1,"getStringFromEnv",{enumerable:!0,get:function(){return H$e.getStringFromEnv}});Object.defineProperty(A1,"getBooleanFromEnv",{enumerable:!0,get:function(){return H$e.getBooleanFromEnv}});Object.defineProperty(A1,"getNumberFromEnv",{enumerable:!0,get:function(){return H$e.getNumberFromEnv}});Object.defineProperty(A1,"getStringListFromEnv",{enumerable:!0,get:function(){return H$e.getStringListFromEnv}});var czo=Rnn();Object.defineProperty(A1,"_globalThis",{enumerable:!0,get:function(){return czo._globalThis}});var lzo=knn();Object.defineProperty(A1,"otperformance",{enumerable:!0,get:function(){return lzo.otperformance}});var uzo=Bnn();Object.defineProperty(A1,"SDK_INFO",{enumerable:!0,get:function(){return uzo.SDK_INFO}})});var qIt=T(y1=>{"use strict";Object.defineProperty(y1,"__esModule",{value:!0});y1.getStringListFromEnv=y1.getNumberFromEnv=y1.getStringFromEnv=y1.getBooleanFromEnv=y1.otperformance=y1._globalThis=y1.SDK_INFO=void 0;var mq=Pnn();Object.defineProperty(y1,"SDK_INFO",{enumerable:!0,get:function(){return mq.SDK_INFO}});Object.defineProperty(y1,"_globalThis",{enumerable:!0,get:function(){return mq._globalThis}});Object.defineProperty(y1,"otperformance",{enumerable:!0,get:function(){return mq.otperformance}});Object.defineProperty(y1,"getBooleanFromEnv",{enumerable:!0,get:function(){return mq.getBooleanFromEnv}});Object.defineProperty(y1,"getStringFromEnv",{enumerable:!0,get:function(){return mq.getStringFromEnv}});Object.defineProperty(y1,"getNumberFromEnv",{enumerable:!0,get:function(){return mq.getNumberFromEnv}});Object.defineProperty(y1,"getStringListFromEnv",{enumerable:!0,get:function(){return mq.getStringListFromEnv}})});var Unn=T(Md=>{"use strict";Object.defineProperty(Md,"__esModule",{value:!0});Md.addHrTimes=Md.isTimeInput=Md.isTimeInputHrTime=Md.hrTimeToMicroseconds=Md.hrTimeToMilliseconds=Md.hrTimeToNanoseconds=Md.hrTimeToTimeStamp=Md.hrTimeDuration=Md.timeInputToHrTime=Md.hrTime=Md.getTimeOrigin=Md.millisToHrTime=void 0;var HIt=qIt(),Mnn=9,dzo=6,fzo=Math.pow(10,dzo),V$e=Math.pow(10,Mnn);function c1e(t){let e=t/1e3,r=Math.trunc(e),n=Math.round(t%1e3*fzo);return[r,n]}Md.millisToHrTime=c1e;function VIt(){let t=HIt.otperformance.timeOrigin;if(typeof t!="number"){let e=HIt.otperformance;t=e.timing&&e.timing.fetchStart}return t}Md.getTimeOrigin=VIt;function Fnn(t){let e=c1e(VIt()),r=c1e(typeof t=="number"?t:HIt.otperformance.now());return Lnn(e,r)}Md.hrTime=Fnn;function pzo(t){if(WIt(t))return t;if(typeof t=="number")return t<VIt()?Fnn(t):c1e(t);if(t instanceof Date)return c1e(t.getTime());throw TypeError("Invalid input type")}Md.timeInputToHrTime=pzo;function hzo(t,e){let r=e[0]-t[0],n=e[1]-t[1];return n<0&&(r-=1,n+=V$e),[r,n]}Md.hrTimeDuration=hzo;function mzo(t){let e=Mnn,r=`${"0".repeat(e)}${t[1]}Z`,n=r.substring(r.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",n)}Md.hrTimeToTimeStamp=mzo;function gzo(t){return t[0]*V$e+t[1]}Md.hrTimeToNanoseconds=gzo;function Azo(t){return t[0]*1e3+t[1]/1e6}Md.hrTimeToMilliseconds=Azo;function yzo(t){return t[0]*1e6+t[1]/1e3}Md.hrTimeToMicroseconds=yzo;function WIt(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}Md.isTimeInputHrTime=WIt;function _zo(t){return WIt(t)||typeof t=="number"||t instanceof Date}Md.isTimeInput=_zo;function Lnn(t,e){let r=[t[0]+e[0],t[1]+e[1]];return r[1]>=V$e&&(r[1]-=V$e,r[0]+=1),r}Md.addHrTimes=Lnn});var $nn=T(W$e=>{"use strict";Object.defineProperty(W$e,"__esModule",{value:!0});W$e.unrefTimer=void 0;function Ezo(t){typeof t!="number"&&t.unref()}W$e.unrefTimer=Ezo});var jnn=T(l1e=>{"use strict";Object.defineProperty(l1e,"__esModule",{value:!0});l1e.ExportResultCode=void 0;var vzo;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(vzo=l1e.ExportResultCode||(l1e.ExportResultCode={}))});var Gnn=T(z$e=>{"use strict";Object.defineProperty(z$e,"__esModule",{value:!0});z$e.CompositePropagator=void 0;var Qnn=(Xt(),gt(ar)),zIt=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 o of this._propagators)try{o.inject(e,r,n)}catch(s){Qnn.diag.warn(`Failed to inject with ${o.constructor.name}. Err: ${s.message}`)}}extract(e,r,n){return this._propagators.reduce((o,s)=>{try{return s.extract(o,r,n)}catch(a){Qnn.diag.warn(`Failed to extract with ${s.constructor.name}. Err: ${a.message}`)}return o},e)}fields(){return this._fields.slice()}};z$e.CompositePropagator=zIt});var qnn=T(Nre=>{"use strict";Object.defineProperty(Nre,"__esModule",{value:!0});Nre.validateValue=Nre.validateKey=void 0;var YIt="[_0-9a-z-*/]",bzo=`[a-z]${YIt}{0,255}`,Czo=`[a-z0-9]${YIt}{0,240}@[a-z]${YIt}{0,13}`,Szo=new RegExp(`^(?:${bzo}|${Czo})$`),wzo=/^[ -~]{0,255}[!-~]$/,xzo=/,|=/;function Tzo(t){return Szo.test(t)}Nre.validateKey=Tzo;function Dzo(t){return wzo.test(t)&&!xzo.test(t)}Nre.validateValue=Dzo});var JIt=T(Y$e=>{"use strict";Object.defineProperty(Y$e,"__esModule",{value:!0});Y$e.TraceState=void 0;var Hnn=qnn(),Vnn=32,Izo=512,Wnn=",",znn="=",KIt=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+znn+this.get(r)),e),[]).join(Wnn)}_parse(e){e.length>Izo||(this._internalState=e.split(Wnn).reverse().reduce((r,n)=>{let o=n.trim(),s=o.indexOf(znn);if(s!==-1){let a=o.slice(0,s),c=o.slice(s+1,n.length);(0,Hnn.validateKey)(a)&&(0,Hnn.validateValue)(c)&&r.set(a,c)}return r},new Map),this._internalState.size>Vnn&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,Vnn))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}};Y$e.TraceState=KIt});var Knn=T(_1=>{"use strict";Object.defineProperty(_1,"__esModule",{value:!0});_1.W3CTraceContextPropagator=_1.parseTraceParent=_1.TRACE_STATE_HEADER=_1.TRACE_PARENT_HEADER=void 0;var K$e=(Xt(),gt(ar)),Rzo=a1e(),kzo=JIt();_1.TRACE_PARENT_HEADER="traceparent";_1.TRACE_STATE_HEADER="tracestate";var Ozo="00",Nzo="(?!ff)[\\da-f]{2}",Bzo="(?![0]{32})[\\da-f]{32}",Pzo="(?![0]{16})[\\da-f]{16}",Mzo="[\\da-f]{2}",Fzo=new RegExp(`^\\s?(${Nzo})-(${Bzo})-(${Pzo})-(${Mzo})(-.*)?\\s?$`);function Ynn(t){let e=Fzo.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}_1.parseTraceParent=Ynn;var XIt=class{inject(e,r,n){let o=K$e.trace.getSpanContext(e);if(!o||(0,Rzo.isTracingSuppressed)(e)||!(0,K$e.isSpanContextValid)(o))return;let s=`${Ozo}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||K$e.TraceFlags.NONE).toString(16)}`;n.set(r,_1.TRACE_PARENT_HEADER,s),o.traceState&&n.set(r,_1.TRACE_STATE_HEADER,o.traceState.serialize())}extract(e,r,n){let o=n.get(r,_1.TRACE_PARENT_HEADER);if(!o)return e;let s=Array.isArray(o)?o[0]:o;if(typeof s!="string")return e;let a=Ynn(s);if(!a)return e;a.isRemote=!0;let c=n.get(r,_1.TRACE_STATE_HEADER);if(c){let u=Array.isArray(c)?c.join(","):c;a.traceState=new kzo.TraceState(typeof u=="string"?u:void 0)}return K$e.trace.setSpanContext(e,a)}fields(){return[_1.TRACE_PARENT_HEADER,_1.TRACE_STATE_HEADER]}};_1.W3CTraceContextPropagator=XIt});var Jnn=T(Jw=>{"use strict";Object.defineProperty(Jw,"__esModule",{value:!0});Jw.getRPCMetadata=Jw.deleteRPCMetadata=Jw.setRPCMetadata=Jw.RPCType=void 0;var Lzo=(Xt(),gt(ar)),ZIt=(0,Lzo.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"),Uzo;(function(t){t.HTTP="http"})(Uzo=Jw.RPCType||(Jw.RPCType={}));function $zo(t,e){return t.setValue(ZIt,e)}Jw.setRPCMetadata=$zo;function jzo(t){return t.deleteValue(ZIt)}Jw.deleteRPCMetadata=jzo;function Qzo(t){return t.getValue(ZIt)}Jw.getRPCMetadata=Qzo});var rin=T(J$e=>{"use strict";Object.defineProperty(J$e,"__esModule",{value:!0});J$e.isPlainObject=void 0;var Gzo="[object Object]",qzo="[object Null]",Hzo="[object Undefined]",Vzo=Function.prototype,Xnn=Vzo.toString,Wzo=Xnn.call(Object),zzo=Object.getPrototypeOf,Znn=Object.prototype,ein=Znn.hasOwnProperty,gq=Symbol?Symbol.toStringTag:void 0,tin=Znn.toString;function Yzo(t){if(!Kzo(t)||Jzo(t)!==Gzo)return!1;let e=zzo(t);if(e===null)return!0;let r=ein.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&Xnn.call(r)===Wzo}J$e.isPlainObject=Yzo;function Kzo(t){return t!=null&&typeof t=="object"}function Jzo(t){return t==null?t===void 0?Hzo:qzo:gq&&gq in Object(t)?Xzo(t):Zzo(t)}function Xzo(t){let e=ein.call(t,gq),r=t[gq],n=!1;try{t[gq]=void 0,n=!0}catch{}let o=tin.call(t);return n&&(e?t[gq]=r:delete t[gq]),o}function Zzo(t){return tin.call(t)}});var ain=T(eje=>{"use strict";Object.defineProperty(eje,"__esModule",{value:!0});eje.merge=void 0;var nin=rin(),eYo=20;function tYo(...t){let e=t.shift(),r=new WeakMap;for(;t.length>0;)e=oin(e,t.shift(),0,r);return e}eje.merge=tYo;function e7t(t){return Z$e(t)?t.slice():t}function oin(t,e,r=0,n){let o;if(!(r>eYo)){if(r++,X$e(t)||X$e(e)||sin(e))o=e7t(e);else if(Z$e(t)){if(o=t.slice(),Z$e(e))for(let s=0,a=e.length;s<a;s++)o.push(e7t(e[s]));else if(u1e(e)){let s=Object.keys(e);for(let a=0,c=s.length;a<c;a++){let u=s[a];o[u]=e7t(e[u])}}}else if(u1e(t))if(u1e(e)){if(!rYo(t,e))return e;o=Object.assign({},t);let s=Object.keys(e);for(let a=0,c=s.length;a<c;a++){let u=s[a],d=e[u];if(X$e(d))typeof d>"u"?delete o[u]:o[u]=d;else{let f=o[u],p=d;if(iin(t,u,n)||iin(e,u,n))delete o[u];else{if(u1e(f)&&u1e(p)){let h=n.get(f)||[],m=n.get(p)||[];h.push({obj:t,key:u}),m.push({obj:e,key:u}),n.set(f,h),n.set(p,m)}o[u]=oin(o[u],d,r,n)}}}}else o=e;return o}}function iin(t,e,r){let n=r.get(t[e])||[];for(let o=0,s=n.length;o<s;o++){let a=n[o];if(a.key===e&&a.obj===t)return!0}return!1}function Z$e(t){return Array.isArray(t)}function sin(t){return typeof t=="function"}function u1e(t){return!X$e(t)&&!Z$e(t)&&!sin(t)&&typeof t=="object"}function X$e(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function rYo(t,e){return!(!(0,nin.isPlainObject)(t)||!(0,nin.isPlainObject)(e))}});var cin=T(Bre=>{"use strict";Object.defineProperty(Bre,"__esModule",{value:!0});Bre.callWithTimeout=Bre.TimeoutError=void 0;var tje=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};Bre.TimeoutError=tje;function nYo(t,e){let r,n=new Promise(function(s,a){r=setTimeout(function(){a(new tje("Operation timed out."))},e)});return Promise.race([t,n]).then(o=>(clearTimeout(r),o),o=>{throw clearTimeout(r),o})}Bre.callWithTimeout=nYo});var uin=T(Pre=>{"use strict";Object.defineProperty(Pre,"__esModule",{value:!0});Pre.isUrlIgnored=Pre.urlMatches=void 0;function lin(t,e){return typeof e=="string"?t===e:!!t.match(e)}Pre.urlMatches=lin;function iYo(t,e){if(!e)return!1;for(let r of e)if(lin(t,r))return!0;return!1}Pre.isUrlIgnored=iYo});var din=T(rje=>{"use strict";Object.defineProperty(rje,"__esModule",{value:!0});rje.Deferred=void 0;var t7t=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)}};rje.Deferred=t7t});var fin=T(nje=>{"use strict";Object.defineProperty(nje,"__esModule",{value:!0});nje.BindOnceFuture=void 0;var oYo=din(),r7t=class{_callback;_that;_isCalled=!1;_deferred=new oYo.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}};nje.BindOnceFuture=r7t});var hin=T(ije=>{"use strict";Object.defineProperty(ije,"__esModule",{value:!0});ije.diagLogLevelFromString=void 0;var CR=(Xt(),gt(ar)),pin={ALL:CR.DiagLogLevel.ALL,VERBOSE:CR.DiagLogLevel.VERBOSE,DEBUG:CR.DiagLogLevel.DEBUG,INFO:CR.DiagLogLevel.INFO,WARN:CR.DiagLogLevel.WARN,ERROR:CR.DiagLogLevel.ERROR,NONE:CR.DiagLogLevel.NONE};function sYo(t){if(t==null)return;let e=pin[t.toUpperCase()];return e??(CR.diag.warn(`Unknown log level "${t}", expected one of ${Object.keys(pin)}, using default`),CR.DiagLogLevel.INFO)}ije.diagLogLevelFromString=sYo});var gin=T(oje=>{"use strict";Object.defineProperty(oje,"__esModule",{value:!0});oje._export=void 0;var min=(Xt(),gt(ar)),aYo=a1e();function cYo(t,e){return new Promise(r=>{min.context.with((0,aYo.suppressTracing)(min.context.active()),()=>{t.export(e,n=>{r(n)})})})}oje._export=cYo});var Xw=T(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.internal=Vr.diagLogLevelFromString=Vr.BindOnceFuture=Vr.urlMatches=Vr.isUrlIgnored=Vr.callWithTimeout=Vr.TimeoutError=Vr.merge=Vr.TraceState=Vr.unsuppressTracing=Vr.suppressTracing=Vr.isTracingSuppressed=Vr.setRPCMetadata=Vr.getRPCMetadata=Vr.deleteRPCMetadata=Vr.RPCType=Vr.parseTraceParent=Vr.W3CTraceContextPropagator=Vr.TRACE_STATE_HEADER=Vr.TRACE_PARENT_HEADER=Vr.CompositePropagator=Vr.otperformance=Vr.getStringListFromEnv=Vr.getNumberFromEnv=Vr.getBooleanFromEnv=Vr.getStringFromEnv=Vr._globalThis=Vr.SDK_INFO=Vr.parseKeyPairsIntoRecord=Vr.ExportResultCode=Vr.unrefTimer=Vr.timeInputToHrTime=Vr.millisToHrTime=Vr.isTimeInputHrTime=Vr.isTimeInput=Vr.hrTimeToTimeStamp=Vr.hrTimeToNanoseconds=Vr.hrTimeToMilliseconds=Vr.hrTimeToMicroseconds=Vr.hrTimeDuration=Vr.hrTime=Vr.getTimeOrigin=Vr.addHrTimes=Vr.loggingErrorHandler=Vr.setGlobalErrorHandler=Vr.globalErrorHandler=Vr.sanitizeAttributes=Vr.isAttributeValue=Vr.AnchoredClock=Vr.W3CBaggagePropagator=void 0;var lYo=Ann();Object.defineProperty(Vr,"W3CBaggagePropagator",{enumerable:!0,get:function(){return lYo.W3CBaggagePropagator}});var uYo=ynn();Object.defineProperty(Vr,"AnchoredClock",{enumerable:!0,get:function(){return uYo.AnchoredClock}});var Ain=Cnn();Object.defineProperty(Vr,"isAttributeValue",{enumerable:!0,get:function(){return Ain.isAttributeValue}});Object.defineProperty(Vr,"sanitizeAttributes",{enumerable:!0,get:function(){return Ain.sanitizeAttributes}});var yin=wnn();Object.defineProperty(Vr,"globalErrorHandler",{enumerable:!0,get:function(){return yin.globalErrorHandler}});Object.defineProperty(Vr,"setGlobalErrorHandler",{enumerable:!0,get:function(){return yin.setGlobalErrorHandler}});var dYo=GIt();Object.defineProperty(Vr,"loggingErrorHandler",{enumerable:!0,get:function(){return dYo.loggingErrorHandler}});var NC=Unn();Object.defineProperty(Vr,"addHrTimes",{enumerable:!0,get:function(){return NC.addHrTimes}});Object.defineProperty(Vr,"getTimeOrigin",{enumerable:!0,get:function(){return NC.getTimeOrigin}});Object.defineProperty(Vr,"hrTime",{enumerable:!0,get:function(){return NC.hrTime}});Object.defineProperty(Vr,"hrTimeDuration",{enumerable:!0,get:function(){return NC.hrTimeDuration}});Object.defineProperty(Vr,"hrTimeToMicroseconds",{enumerable:!0,get:function(){return NC.hrTimeToMicroseconds}});Object.defineProperty(Vr,"hrTimeToMilliseconds",{enumerable:!0,get:function(){return NC.hrTimeToMilliseconds}});Object.defineProperty(Vr,"hrTimeToNanoseconds",{enumerable:!0,get:function(){return NC.hrTimeToNanoseconds}});Object.defineProperty(Vr,"hrTimeToTimeStamp",{enumerable:!0,get:function(){return NC.hrTimeToTimeStamp}});Object.defineProperty(Vr,"isTimeInput",{enumerable:!0,get:function(){return NC.isTimeInput}});Object.defineProperty(Vr,"isTimeInputHrTime",{enumerable:!0,get:function(){return NC.isTimeInputHrTime}});Object.defineProperty(Vr,"millisToHrTime",{enumerable:!0,get:function(){return NC.millisToHrTime}});Object.defineProperty(Vr,"timeInputToHrTime",{enumerable:!0,get:function(){return NC.timeInputToHrTime}});var fYo=$nn();Object.defineProperty(Vr,"unrefTimer",{enumerable:!0,get:function(){return fYo.unrefTimer}});var pYo=jnn();Object.defineProperty(Vr,"ExportResultCode",{enumerable:!0,get:function(){return pYo.ExportResultCode}});var hYo=LIt();Object.defineProperty(Vr,"parseKeyPairsIntoRecord",{enumerable:!0,get:function(){return hYo.parseKeyPairsIntoRecord}});var Aq=qIt();Object.defineProperty(Vr,"SDK_INFO",{enumerable:!0,get:function(){return Aq.SDK_INFO}});Object.defineProperty(Vr,"_globalThis",{enumerable:!0,get:function(){return Aq._globalThis}});Object.defineProperty(Vr,"getStringFromEnv",{enumerable:!0,get:function(){return Aq.getStringFromEnv}});Object.defineProperty(Vr,"getBooleanFromEnv",{enumerable:!0,get:function(){return Aq.getBooleanFromEnv}});Object.defineProperty(Vr,"getNumberFromEnv",{enumerable:!0,get:function(){return Aq.getNumberFromEnv}});Object.defineProperty(Vr,"getStringListFromEnv",{enumerable:!0,get:function(){return Aq.getStringListFromEnv}});Object.defineProperty(Vr,"otperformance",{enumerable:!0,get:function(){return Aq.otperformance}});var mYo=Gnn();Object.defineProperty(Vr,"CompositePropagator",{enumerable:!0,get:function(){return mYo.CompositePropagator}});var sje=Knn();Object.defineProperty(Vr,"TRACE_PARENT_HEADER",{enumerable:!0,get:function(){return sje.TRACE_PARENT_HEADER}});Object.defineProperty(Vr,"TRACE_STATE_HEADER",{enumerable:!0,get:function(){return sje.TRACE_STATE_HEADER}});Object.defineProperty(Vr,"W3CTraceContextPropagator",{enumerable:!0,get:function(){return sje.W3CTraceContextPropagator}});Object.defineProperty(Vr,"parseTraceParent",{enumerable:!0,get:function(){return sje.parseTraceParent}});var aje=Jnn();Object.defineProperty(Vr,"RPCType",{enumerable:!0,get:function(){return aje.RPCType}});Object.defineProperty(Vr,"deleteRPCMetadata",{enumerable:!0,get:function(){return aje.deleteRPCMetadata}});Object.defineProperty(Vr,"getRPCMetadata",{enumerable:!0,get:function(){return aje.getRPCMetadata}});Object.defineProperty(Vr,"setRPCMetadata",{enumerable:!0,get:function(){return aje.setRPCMetadata}});var n7t=a1e();Object.defineProperty(Vr,"isTracingSuppressed",{enumerable:!0,get:function(){return n7t.isTracingSuppressed}});Object.defineProperty(Vr,"suppressTracing",{enumerable:!0,get:function(){return n7t.suppressTracing}});Object.defineProperty(Vr,"unsuppressTracing",{enumerable:!0,get:function(){return n7t.unsuppressTracing}});var gYo=JIt();Object.defineProperty(Vr,"TraceState",{enumerable:!0,get:function(){return gYo.TraceState}});var AYo=ain();Object.defineProperty(Vr,"merge",{enumerable:!0,get:function(){return AYo.merge}});var _in=cin();Object.defineProperty(Vr,"TimeoutError",{enumerable:!0,get:function(){return _in.TimeoutError}});Object.defineProperty(Vr,"callWithTimeout",{enumerable:!0,get:function(){return _in.callWithTimeout}});var Ein=uin();Object.defineProperty(Vr,"isUrlIgnored",{enumerable:!0,get:function(){return Ein.isUrlIgnored}});Object.defineProperty(Vr,"urlMatches",{enumerable:!0,get:function(){return Ein.urlMatches}});var yYo=fin();Object.defineProperty(Vr,"BindOnceFuture",{enumerable:!0,get:function(){return yYo.BindOnceFuture}});var _Yo=hin();Object.defineProperty(Vr,"diagLogLevelFromString",{enumerable:!0,get:function(){return _Yo.diagLogLevelFromString}});var EYo=gin();Vr.internal={_export:EYo._export}});var vin=T(cje=>{"use strict";Object.defineProperty(cje,"__esModule",{value:!0});cje.defaultServiceName=void 0;function vYo(){return`unknown_service:${process.argv0}`}cje.defaultServiceName=vYo});var bin=T(lje=>{"use strict";Object.defineProperty(lje,"__esModule",{value:!0});lje.defaultServiceName=void 0;var bYo=vin();Object.defineProperty(lje,"defaultServiceName",{enumerable:!0,get:function(){return bYo.defaultServiceName}})});var i7t=T(uje=>{"use strict";Object.defineProperty(uje,"__esModule",{value:!0});uje.defaultServiceName=void 0;var CYo=bin();Object.defineProperty(uje,"defaultServiceName",{enumerable:!0,get:function(){return CYo.defaultServiceName}})});var Cin=T(Mre=>{"use strict";Object.defineProperty(Mre,"__esModule",{value:!0});Mre.identity=Mre.isPromiseLike=void 0;var SYo=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";Mre.isPromiseLike=SYo;function wYo(t){return t}Mre.identity=wYo});var a7t=T(W8=>{"use strict";Object.defineProperty(W8,"__esModule",{value:!0});W8.defaultResource=W8.emptyResource=W8.resourceFromDetectedResource=W8.resourceFromAttributes=void 0;var f1e=(Xt(),gt(ar)),o7t=Xw(),yq=(Bh(),gt(f0)),xYo=i7t(),d1e=Cin(),dje=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,r){let n=new t({},r);return n._rawAttributes=Sin(e),n._asyncAttributesPending=e.filter(([o,s])=>(0,d1e.isPromiseLike)(s)).length>0,n}constructor(e,r){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([o,s])=>((0,d1e.isPromiseLike)(s)&&(this._asyncAttributesPending=!0),[o,s])),this._rawAttributes=Sin(this._rawAttributes),this._schemaUrl=RYo(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,d1e.isPromiseLike)(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&f1e.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,d1e.isPromiseLike)(n)){f1e.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=kYo(this,e),n=r?{schemaUrl:r}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],n)}};function s7t(t,e){return dje.FromAttributeList(Object.entries(t),e)}W8.resourceFromAttributes=s7t;function TYo(t,e){return new dje(t,e)}W8.resourceFromDetectedResource=TYo;function DYo(){return s7t({})}W8.emptyResource=DYo;function IYo(){return s7t({[yq.ATTR_SERVICE_NAME]:(0,xYo.defaultServiceName)(),[yq.ATTR_TELEMETRY_SDK_LANGUAGE]:o7t.SDK_INFO[yq.ATTR_TELEMETRY_SDK_LANGUAGE],[yq.ATTR_TELEMETRY_SDK_NAME]:o7t.SDK_INFO[yq.ATTR_TELEMETRY_SDK_NAME],[yq.ATTR_TELEMETRY_SDK_VERSION]:o7t.SDK_INFO[yq.ATTR_TELEMETRY_SDK_VERSION]})}W8.defaultResource=IYo;function Sin(t){return t.map(([e,r])=>(0,d1e.isPromiseLike)(r)?[e,r.catch(n=>{f1e.diag.debug("promise rejection for resource attribute: %s - %s",e,n)})]:[e,r])}function RYo(t){if(typeof t=="string"||t===void 0)return t;f1e.diag.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function kYo(t,e){let r=t?.schemaUrl,n=e?.schemaUrl,o=r===void 0||r==="",s=n===void 0||n==="";if(o)return n;if(s||r===n)return r;f1e.diag.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}});var xin=T(fje=>{"use strict";Object.defineProperty(fje,"__esModule",{value:!0});fje.detectResources=void 0;var win=(Xt(),gt(ar)),c7t=a7t(),OYo=(t={})=>(t.detectors||[]).map(r=>{try{let n=(0,c7t.resourceFromDetectedResource)(r.detect(t));return win.diag.debug(`${r.constructor.name} found resource.`,n),n}catch(n){return win.diag.debug(`${r.constructor.name} failed: ${n.message}`),(0,c7t.emptyResource)()}}).reduce((r,n)=>r.merge(n),(0,c7t.emptyResource)());fje.detectResources=OYo});var Din=T(pje=>{"use strict";Object.defineProperty(pje,"__esModule",{value:!0});pje.envDetector=void 0;var NYo=(Xt(),gt(ar)),BYo=(Bh(),gt(f0)),Tin=Xw(),l7t=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,Tin.getStringFromEnv)("OTEL_RESOURCE_ATTRIBUTES"),o=(0,Tin.getStringFromEnv)("OTEL_SERVICE_NAME");if(n)try{let s=this._parseResourceAttributes(n);Object.assign(r,s)}catch(s){NYo.diag.debug(`EnvDetector failed: ${s.message}`)}return o&&(r[BYo.ATTR_SERVICE_NAME]=o),{attributes:r}}_parseResourceAttributes(e){if(!e)return{};let r={},n=e.split(this._COMMA_SEPARATOR,-1);for(let o of n){let s=o.split(this._LABEL_KEY_VALUE_SPLITTER,-1);if(s.length!==2)continue;let[a,c]=s;if(a=a.trim(),c=c.trim().split(/^"|"$/).join(""),!this._isValidAndNotEmpty(a))throw new Error(`Attribute key ${this._ERROR_MESSAGE_INVALID_CHARS}`);if(!this._isValid(c))throw new Error(`Attribute value ${this._ERROR_MESSAGE_INVALID_VALUE}`);r[a]=decodeURIComponent(c)}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)}};pje.envDetector=new l7t});var p1e=T(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.ATTR_WEBENGINE_VERSION=Jn.ATTR_WEBENGINE_NAME=Jn.ATTR_WEBENGINE_DESCRIPTION=Jn.ATTR_SERVICE_NAMESPACE=Jn.ATTR_SERVICE_INSTANCE_ID=Jn.ATTR_PROCESS_RUNTIME_VERSION=Jn.ATTR_PROCESS_RUNTIME_NAME=Jn.ATTR_PROCESS_RUNTIME_DESCRIPTION=Jn.ATTR_PROCESS_PID=Jn.ATTR_PROCESS_OWNER=Jn.ATTR_PROCESS_EXECUTABLE_PATH=Jn.ATTR_PROCESS_EXECUTABLE_NAME=Jn.ATTR_PROCESS_COMMAND_ARGS=Jn.ATTR_PROCESS_COMMAND=Jn.ATTR_OS_VERSION=Jn.ATTR_OS_TYPE=Jn.ATTR_K8S_POD_NAME=Jn.ATTR_K8S_NAMESPACE_NAME=Jn.ATTR_K8S_DEPLOYMENT_NAME=Jn.ATTR_K8S_CLUSTER_NAME=Jn.ATTR_HOST_TYPE=Jn.ATTR_HOST_NAME=Jn.ATTR_HOST_IMAGE_VERSION=Jn.ATTR_HOST_IMAGE_NAME=Jn.ATTR_HOST_IMAGE_ID=Jn.ATTR_HOST_ID=Jn.ATTR_HOST_ARCH=Jn.ATTR_CONTAINER_NAME=Jn.ATTR_CONTAINER_IMAGE_TAGS=Jn.ATTR_CONTAINER_IMAGE_NAME=Jn.ATTR_CONTAINER_ID=Jn.ATTR_CLOUD_REGION=Jn.ATTR_CLOUD_PROVIDER=Jn.ATTR_CLOUD_AVAILABILITY_ZONE=Jn.ATTR_CLOUD_ACCOUNT_ID=void 0;Jn.ATTR_CLOUD_ACCOUNT_ID="cloud.account.id";Jn.ATTR_CLOUD_AVAILABILITY_ZONE="cloud.availability_zone";Jn.ATTR_CLOUD_PROVIDER="cloud.provider";Jn.ATTR_CLOUD_REGION="cloud.region";Jn.ATTR_CONTAINER_ID="container.id";Jn.ATTR_CONTAINER_IMAGE_NAME="container.image.name";Jn.ATTR_CONTAINER_IMAGE_TAGS="container.image.tags";Jn.ATTR_CONTAINER_NAME="container.name";Jn.ATTR_HOST_ARCH="host.arch";Jn.ATTR_HOST_ID="host.id";Jn.ATTR_HOST_IMAGE_ID="host.image.id";Jn.ATTR_HOST_IMAGE_NAME="host.image.name";Jn.ATTR_HOST_IMAGE_VERSION="host.image.version";Jn.ATTR_HOST_NAME="host.name";Jn.ATTR_HOST_TYPE="host.type";Jn.ATTR_K8S_CLUSTER_NAME="k8s.cluster.name";Jn.ATTR_K8S_DEPLOYMENT_NAME="k8s.deployment.name";Jn.ATTR_K8S_NAMESPACE_NAME="k8s.namespace.name";Jn.ATTR_K8S_POD_NAME="k8s.pod.name";Jn.ATTR_OS_TYPE="os.type";Jn.ATTR_OS_VERSION="os.version";Jn.ATTR_PROCESS_COMMAND="process.command";Jn.ATTR_PROCESS_COMMAND_ARGS="process.command_args";Jn.ATTR_PROCESS_EXECUTABLE_NAME="process.executable.name";Jn.ATTR_PROCESS_EXECUTABLE_PATH="process.executable.path";Jn.ATTR_PROCESS_OWNER="process.owner";Jn.ATTR_PROCESS_PID="process.pid";Jn.ATTR_PROCESS_RUNTIME_DESCRIPTION="process.runtime.description";Jn.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name";Jn.ATTR_PROCESS_RUNTIME_VERSION="process.runtime.version";Jn.ATTR_SERVICE_INSTANCE_ID="service.instance.id";Jn.ATTR_SERVICE_NAMESPACE="service.namespace";Jn.ATTR_WEBENGINE_DESCRIPTION="webengine.description";Jn.ATTR_WEBENGINE_NAME="webengine.name";Jn.ATTR_WEBENGINE_VERSION="webengine.version"});var mje=T(hje=>{"use strict";Object.defineProperty(hje,"__esModule",{value:!0});hje.execAsync=void 0;var PYo=me("child_process"),MYo=me("util");hje.execAsync=MYo.promisify(PYo.exec)});var Iin=T(gje=>{"use strict";Object.defineProperty(gje,"__esModule",{value:!0});gje.getMachineId=void 0;var FYo=mje(),LYo=(Xt(),gt(ar));async function UYo(){try{let e=(await(0,FYo.execAsync)('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split(`
494
- `).find(n=>n.includes("IOPlatformUUID"));if(!e)return;let r=e.split('" = "');if(r.length===2)return r[1].slice(0,-1)}catch(t){LYo.diag.debug(`error reading machine id: ${t}`)}}gje.getMachineId=UYo});var Rin=T(Aje=>{"use strict";Object.defineProperty(Aje,"__esModule",{value:!0});Aje.getMachineId=void 0;var $Yo=me("fs"),jYo=(Xt(),gt(ar));async function QYo(){let t=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let e of t)try{return(await $Yo.promises.readFile(e,{encoding:"utf8"})).trim()}catch(r){jYo.diag.debug(`error reading machine id: ${r}`)}}Aje.getMachineId=QYo});var Oin=T(yje=>{"use strict";Object.defineProperty(yje,"__esModule",{value:!0});yje.getMachineId=void 0;var GYo=me("fs"),qYo=mje(),kin=(Xt(),gt(ar));async function HYo(){try{return(await GYo.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(t){kin.diag.debug(`error reading machine id: ${t}`)}try{return(await(0,qYo.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(t){kin.diag.debug(`error reading machine id: ${t}`)}}yje.getMachineId=HYo});var Bin=T(_je=>{"use strict";Object.defineProperty(_je,"__esModule",{value:!0});_je.getMachineId=void 0;var Nin=me("process"),VYo=mje(),WYo=(Xt(),gt(ar));async function zYo(){let t="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",e="%windir%\\System32\\REG.exe";Nin.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in Nin.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{let n=(await(0,VYo.execAsync)(`${e} ${t}`)).stdout.split("REG_SZ");if(n.length===2)return n[1].trim()}catch(r){WYo.diag.debug(`error reading machine id: ${r}`)}}_je.getMachineId=zYo});var Pin=T(Eje=>{"use strict";Object.defineProperty(Eje,"__esModule",{value:!0});Eje.getMachineId=void 0;var YYo=(Xt(),gt(ar));async function KYo(){YYo.diag.debug("could not read machine-id: unsupported platform")}Eje.getMachineId=KYo});var Min=T(vje=>{"use strict";Object.defineProperty(vje,"__esModule",{value:!0});vje.getMachineId=void 0;var JYo=me("process"),_q;async function XYo(){if(!_q)switch(JYo.platform){case"darwin":_q=(await Promise.resolve().then(()=>Se(Iin()))).getMachineId;break;case"linux":_q=(await Promise.resolve().then(()=>Se(Rin()))).getMachineId;break;case"freebsd":_q=(await Promise.resolve().then(()=>Se(Oin()))).getMachineId;break;case"win32":_q=(await Promise.resolve().then(()=>Se(Bin()))).getMachineId;break;default:_q=(await Promise.resolve().then(()=>Se(Pin()))).getMachineId;break}return _q()}vje.getMachineId=XYo});var u7t=T(Fre=>{"use strict";Object.defineProperty(Fre,"__esModule",{value:!0});Fre.normalizeType=Fre.normalizeArch=void 0;var ZYo=t=>{switch(t){case"arm":return"arm32";case"ppc":return"ppc32";case"x64":return"amd64";default:return t}};Fre.normalizeArch=ZYo;var eKo=t=>{switch(t){case"sunos":return"solaris";case"win32":return"windows";default:return t}};Fre.normalizeType=eKo});var Lin=T(bje=>{"use strict";Object.defineProperty(bje,"__esModule",{value:!0});bje.hostDetector=void 0;var d7t=p1e(),Fin=me("os"),tKo=Min(),rKo=u7t(),f7t=class{detect(e){return{attributes:{[d7t.ATTR_HOST_NAME]:(0,Fin.hostname)(),[d7t.ATTR_HOST_ARCH]:(0,rKo.normalizeArch)((0,Fin.arch)()),[d7t.ATTR_HOST_ID]:(0,tKo.getMachineId)()}}}};bje.hostDetector=new f7t});var jin=T(Cje=>{"use strict";Object.defineProperty(Cje,"__esModule",{value:!0});Cje.osDetector=void 0;var Uin=p1e(),$in=me("os"),nKo=u7t(),p7t=class{detect(e){return{attributes:{[Uin.ATTR_OS_TYPE]:(0,nKo.normalizeType)((0,$in.platform)()),[Uin.ATTR_OS_VERSION]:(0,$in.release)()}}}};Cje.osDetector=new p7t});var Qin=T(Sje=>{"use strict";Object.defineProperty(Sje,"__esModule",{value:!0});Sje.processDetector=void 0;var iKo=(Xt(),gt(ar)),SR=p1e(),oKo=me("os"),h7t=class{detect(e){let r={[SR.ATTR_PROCESS_PID]:process.pid,[SR.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[SR.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[SR.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[SR.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[SR.ATTR_PROCESS_RUNTIME_NAME]:"nodejs",[SR.ATTR_PROCESS_RUNTIME_DESCRIPTION]:"Node.js"};process.argv.length>1&&(r[SR.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let n=oKo.userInfo();r[SR.ATTR_PROCESS_OWNER]=n.username}catch(n){iKo.diag.debug(`error obtaining process owner: ${n}`)}return{attributes:r}}};Sje.processDetector=new h7t});var Gin=T(wje=>{"use strict";Object.defineProperty(wje,"__esModule",{value:!0});wje.serviceInstanceIdDetector=void 0;var sKo=p1e(),aKo=me("crypto"),m7t=class{detect(e){return{attributes:{[sKo.ATTR_SERVICE_INSTANCE_ID]:(0,aKo.randomUUID)()}}}};wje.serviceInstanceIdDetector=new m7t});var qin=T(z8=>{"use strict";Object.defineProperty(z8,"__esModule",{value:!0});z8.serviceInstanceIdDetector=z8.processDetector=z8.osDetector=z8.hostDetector=void 0;var cKo=Lin();Object.defineProperty(z8,"hostDetector",{enumerable:!0,get:function(){return cKo.hostDetector}});var lKo=jin();Object.defineProperty(z8,"osDetector",{enumerable:!0,get:function(){return lKo.osDetector}});var uKo=Qin();Object.defineProperty(z8,"processDetector",{enumerable:!0,get:function(){return uKo.processDetector}});var dKo=Gin();Object.defineProperty(z8,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return dKo.serviceInstanceIdDetector}})});var Hin=T(Y8=>{"use strict";Object.defineProperty(Y8,"__esModule",{value:!0});Y8.serviceInstanceIdDetector=Y8.processDetector=Y8.osDetector=Y8.hostDetector=void 0;var xje=qin();Object.defineProperty(Y8,"hostDetector",{enumerable:!0,get:function(){return xje.hostDetector}});Object.defineProperty(Y8,"osDetector",{enumerable:!0,get:function(){return xje.osDetector}});Object.defineProperty(Y8,"processDetector",{enumerable:!0,get:function(){return xje.processDetector}});Object.defineProperty(Y8,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return xje.serviceInstanceIdDetector}})});var Vin=T(Lre=>{"use strict";Object.defineProperty(Lre,"__esModule",{value:!0});Lre.noopDetector=Lre.NoopDetector=void 0;var Tje=class{detect(){return{attributes:{}}}};Lre.NoopDetector=Tje;Lre.noopDetector=new Tje});var Win=T(X_=>{"use strict";Object.defineProperty(X_,"__esModule",{value:!0});X_.noopDetector=X_.serviceInstanceIdDetector=X_.processDetector=X_.osDetector=X_.hostDetector=X_.envDetector=void 0;var fKo=Din();Object.defineProperty(X_,"envDetector",{enumerable:!0,get:function(){return fKo.envDetector}});var Dje=Hin();Object.defineProperty(X_,"hostDetector",{enumerable:!0,get:function(){return Dje.hostDetector}});Object.defineProperty(X_,"osDetector",{enumerable:!0,get:function(){return Dje.osDetector}});Object.defineProperty(X_,"processDetector",{enumerable:!0,get:function(){return Dje.processDetector}});Object.defineProperty(X_,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Dje.serviceInstanceIdDetector}});var pKo=Vin();Object.defineProperty(X_,"noopDetector",{enumerable:!0,get:function(){return pKo.noopDetector}})});var zin=T(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.defaultServiceName=nh.emptyResource=nh.defaultResource=nh.resourceFromAttributes=nh.serviceInstanceIdDetector=nh.processDetector=nh.osDetector=nh.hostDetector=nh.envDetector=nh.detectResources=void 0;var hKo=xin();Object.defineProperty(nh,"detectResources",{enumerable:!0,get:function(){return hKo.detectResources}});var h1e=Win();Object.defineProperty(nh,"envDetector",{enumerable:!0,get:function(){return h1e.envDetector}});Object.defineProperty(nh,"hostDetector",{enumerable:!0,get:function(){return h1e.hostDetector}});Object.defineProperty(nh,"osDetector",{enumerable:!0,get:function(){return h1e.osDetector}});Object.defineProperty(nh,"processDetector",{enumerable:!0,get:function(){return h1e.processDetector}});Object.defineProperty(nh,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return h1e.serviceInstanceIdDetector}});var g7t=a7t();Object.defineProperty(nh,"resourceFromAttributes",{enumerable:!0,get:function(){return g7t.resourceFromAttributes}});Object.defineProperty(nh,"defaultResource",{enumerable:!0,get:function(){return g7t.defaultResource}});Object.defineProperty(nh,"emptyResource",{enumerable:!0,get:function(){return g7t.emptyResource}});var mKo=i7t();Object.defineProperty(nh,"defaultServiceName",{enumerable:!0,get:function(){return mKo.defaultServiceName}})});var Yin=T(Rje=>{"use strict";Object.defineProperty(Rje,"__esModule",{value:!0});Rje.LogRecordImpl=void 0;var Eq=(Xt(),gt(ar)),Ije=Xw(),A7t=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:o,observedTimestamp:s,eventName:a,severityNumber:c,severityText:u,body:d,attributes:f={},context:p}=n,h=Date.now();if(this.hrTime=(0,Ije.timeInputToHrTime)(o??h),this.hrTimeObserved=(0,Ije.timeInputToHrTime)(s??h),p){let m=Eq.trace.getSpanContext(p);m&&Eq.isSpanContextValid(m)&&(this.spanContext=m)}this.severityNumber=c,this.severityText=u,this.body=d,this.resource=e.resource,this.instrumentationScope=r,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(f)}setAttribute(e,r){return this._isLogRecordReadonly()?this:r===null?this:e.length===0?(Eq.diag.warn(`Invalid attribute key: ${e}`),this):!(0,Ije.isAttributeValue)(r)&&!(typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length>0)?(Eq.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&&Eq.diag.warn("Dropping extra attributes."),this):((0,Ije.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?(Eq.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&&Eq.diag.warn("Can not execute the operation on emitted log record"),this._isReadonly}};Rje.LogRecordImpl=A7t});var Kin=T(kje=>{"use strict";Object.defineProperty(kje,"__esModule",{value:!0});kje.Logger=void 0;var gKo=(Xt(),gt(ar)),AKo=Yin(),y7t=class{instrumentationScope;_sharedState;constructor(e,r){this.instrumentationScope=e,this._sharedState=r}emit(e){let r=e.context||gKo.context.active(),n=new AKo.LogRecordImpl(this._sharedState,this.instrumentationScope,{context:r,...e});this._sharedState.activeProcessor.onEmit(n,r),n._makeReadonly()}};kje.Logger=y7t});var Jin=T($re=>{"use strict";Object.defineProperty($re,"__esModule",{value:!0});$re.reconfigureLimits=$re.loadDefaultConfig=void 0;var Ure=Xw();function yKo(){return{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:(0,Ure.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,Ure.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT")??128},includeTraceContext:!0}}$re.loadDefaultConfig=yKo;function _Ko(t){return{attributeCountLimit:t.attributeCountLimit??(0,Ure.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT")??(0,Ure.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??128,attributeValueLengthLimit:t.attributeValueLengthLimit??(0,Ure.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT")??(0,Ure.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0}}$re.reconfigureLimits=_Ko});var E7t=T(Oje=>{"use strict";Object.defineProperty(Oje,"__esModule",{value:!0});Oje.NoopLogRecordProcessor=void 0;var _7t=class{forceFlush(){return Promise.resolve()}onEmit(e,r){}shutdown(){return Promise.resolve()}};Oje.NoopLogRecordProcessor=_7t});var Xin=T(Nje=>{"use strict";Object.defineProperty(Nje,"__esModule",{value:!0});Nje.MultiLogRecordProcessor=void 0;var EKo=Xw(),v7t=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,EKo.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()))}};Nje.MultiLogRecordProcessor=v7t});var Zin=T(Bje=>{"use strict";Object.defineProperty(Bje,"__esModule",{value:!0});Bje.LoggerProviderSharedState=void 0;var vKo=E7t(),bKo=Xin(),b7t=class{resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];constructor(e,r,n,o){this.resource=e,this.forceFlushTimeoutMillis=r,this.logRecordLimits=n,this.processors=o,o.length>0?(this.registeredLogRecordProcessors=o,this.activeProcessor=new bKo.MultiLogRecordProcessor(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new vKo.NoopLogRecordProcessor}};Bje.LoggerProviderSharedState=b7t});var ron=T(vq=>{"use strict";Object.defineProperty(vq,"__esModule",{value:!0});vq.LoggerProvider=vq.DEFAULT_LOGGER_NAME=void 0;var Pje=(Xt(),gt(ar)),CKo=mnn(),SKo=zin(),eon=Xw(),wKo=Kin(),ton=Jin(),xKo=Zin();vq.DEFAULT_LOGGER_NAME="unknown";var C7t=class{_shutdownOnce;_sharedState;constructor(e={}){let r=(0,eon.merge)({},(0,ton.loadDefaultConfig)(),e),n=e.resource??(0,SKo.defaultResource)();this._sharedState=new xKo.LoggerProviderSharedState(n,r.forceFlushTimeoutMillis,(0,ton.reconfigureLimits)(r.logRecordLimits),e?.processors??[]),this._shutdownOnce=new eon.BindOnceFuture(this._shutdown,this)}getLogger(e,r,n){if(this._shutdownOnce.isCalled)return Pje.diag.warn("A shutdown LoggerProvider cannot provide a Logger"),CKo.NOOP_LOGGER;e||Pje.diag.warn("Logger requested without instrumentation scope name.");let o=e||vq.DEFAULT_LOGGER_NAME,s=`${o}@${r||""}:${n?.schemaUrl||""}`;return this._sharedState.loggers.has(s)||this._sharedState.loggers.set(s,new wKo.Logger({name:o,version:r,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(s)}forceFlush(){return this._shutdownOnce.isCalled?(Pje.diag.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(Pje.diag.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};vq.LoggerProvider=C7t});var ion=T(Mje=>{"use strict";Object.defineProperty(Mje,"__esModule",{value:!0});Mje.ConsoleLogRecordExporter=void 0;var non=Xw(),S7t=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,non.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:non.ExportResultCode.SUCCESS})}};Mje.ConsoleLogRecordExporter=S7t});var oon=T(Fje=>{"use strict";Object.defineProperty(Fje,"__esModule",{value:!0});Fje.SimpleLogRecordProcessor=void 0;var jre=Xw(),w7t=class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new jre.BindOnceFuture(this._shutdown,this),this._unresolvedExports=new Set}onEmit(e){if(this._shutdownOnce.isCalled)return;let r=()=>jre.internal._export(this._exporter,[e]).then(n=>{n.code!==jre.ExportResultCode.SUCCESS&&(0,jre.globalErrorHandler)(n.error??new Error(`SimpleLogRecordProcessor: log record export failed (status ${n})`))}).catch(jre.globalErrorHandler);if(e.resource.asyncAttributesPending){let n=e.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(n),r()),jre.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()}};Fje.SimpleLogRecordProcessor=w7t});var aon=T(Lje=>{"use strict";Object.defineProperty(Lje,"__esModule",{value:!0});Lje.InMemoryLogRecordExporter=void 0;var son=Xw(),x7t=class{_finishedLogRecords=[];_stopped=!1;export(e,r){if(this._stopped)return r({code:son.ExportResultCode.FAILED,error:new Error("Exporter has been stopped")});this._finishedLogRecords.push(...e),r({code:son.ExportResultCode.SUCCESS})}shutdown(){return this._stopped=!0,this.reset(),Promise.resolve()}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}};Lje.InMemoryLogRecordExporter=x7t});var con=T(Uje=>{"use strict";Object.defineProperty(Uje,"__esModule",{value:!0});Uje.BatchLogRecordProcessorBase=void 0;var TKo=(Xt(),gt(ar)),BC=Xw(),T7t=class{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_isExporting=!1;_finishedLogRecords=[];_timer;_shutdownOnce;constructor(e,r){this._exporter=e,this._maxExportBatchSize=r?.maxExportBatchSize??(0,BC.getNumberFromEnv)("OTEL_BLRP_MAX_EXPORT_BATCH_SIZE")??512,this._maxQueueSize=r?.maxQueueSize??(0,BC.getNumberFromEnv)("OTEL_BLRP_MAX_QUEUE_SIZE")??2048,this._scheduledDelayMillis=r?.scheduledDelayMillis??(0,BC.getNumberFromEnv)("OTEL_BLRP_SCHEDULE_DELAY")??5e3,this._exportTimeoutMillis=r?.exportTimeoutMillis??(0,BC.getNumberFromEnv)("OTEL_BLRP_EXPORT_TIMEOUT")??3e4,this._shutdownOnce=new BC.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(TKo.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=[],o=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let s=0;s<o;s++)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,BC.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,BC.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=()=>BC.internal._export(this._exporter,e).then(o=>{o.code!==BC.ExportResultCode.SUCCESS&&(0,BC.globalErrorHandler)(o.error??new Error(`BatchLogRecordProcessor: log record export failed (status ${o})`))}).catch(BC.globalErrorHandler),n=e.map(o=>o.resource).filter(o=>o.asyncAttributesPending);return n.length===0?r():Promise.all(n.map(o=>o.waitForAsyncAttributes?.())).then(r,BC.globalErrorHandler)}};Uje.BatchLogRecordProcessorBase=T7t});var lon=T($je=>{"use strict";Object.defineProperty($je,"__esModule",{value:!0});$je.BatchLogRecordProcessor=void 0;var DKo=con(),D7t=class extends DKo.BatchLogRecordProcessorBase{onShutdown(){}};$je.BatchLogRecordProcessor=D7t});var uon=T(jje=>{"use strict";Object.defineProperty(jje,"__esModule",{value:!0});jje.BatchLogRecordProcessor=void 0;var IKo=lon();Object.defineProperty(jje,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return IKo.BatchLogRecordProcessor}})});var don=T(Qje=>{"use strict";Object.defineProperty(Qje,"__esModule",{value:!0});Qje.BatchLogRecordProcessor=void 0;var RKo=uon();Object.defineProperty(Qje,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return RKo.BatchLogRecordProcessor}})});var fon=T(Z_=>{"use strict";Object.defineProperty(Z_,"__esModule",{value:!0});Z_.BatchLogRecordProcessor=Z_.InMemoryLogRecordExporter=Z_.SimpleLogRecordProcessor=Z_.ConsoleLogRecordExporter=Z_.NoopLogRecordProcessor=Z_.LoggerProvider=void 0;var kKo=ron();Object.defineProperty(Z_,"LoggerProvider",{enumerable:!0,get:function(){return kKo.LoggerProvider}});var OKo=E7t();Object.defineProperty(Z_,"NoopLogRecordProcessor",{enumerable:!0,get:function(){return OKo.NoopLogRecordProcessor}});var NKo=ion();Object.defineProperty(Z_,"ConsoleLogRecordExporter",{enumerable:!0,get:function(){return NKo.ConsoleLogRecordExporter}});var BKo=oon();Object.defineProperty(Z_,"SimpleLogRecordProcessor",{enumerable:!0,get:function(){return BKo.SimpleLogRecordProcessor}});var PKo=aon();Object.defineProperty(Z_,"InMemoryLogRecordExporter",{enumerable:!0,get:function(){return PKo.InMemoryLogRecordExporter}});var MKo=don();Object.defineProperty(Z_,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return MKo.BatchLogRecordProcessor}})});var Nm,pon,m1e,hon,g1e,A1e,mon,gon,Aon,yon,_on,Eon,von,bon,Con,Son,won,xon,Ton,Don,Ion,Ron,kon,Oon,Non,Bon,Pon,Mon,Fon,Lon,Uon,$on,jon,Qon,Gon,qon,Hon,Von,Won,zon,Yon,Kon,Jon,Xon,Zon,Qre=G(()=>{"use strict";Nm="iflow-cli",pon="iflow_cli.user_prompt",m1e="iflow_cli.tool_call",hon="iflow_cli.api_request",g1e="iflow_cli.api_error",A1e="iflow_cli.api_response",mon="iflow_cli.config",gon="iflow_cli.flash_fallback",Aon="iflow_cli.next_speaker_check",yon="iflow_cli.slash_command",_on="iflow_cli.cli_response",Eon="iflow_cli.tool.call.count",von="iflow_cli.tool.call.latency",bon="iflow_cli.mcp.tool.call.count",Con="iflow_cli.mcp.tool.call.latency",Son="iflow_cli.builtin.tool.call.count",won="iflow_cli.builtin.tool.call.latency",xon="gen_ai.client.operation",Ton="gen_ai.client.operation.duration",Don="gen_ai.client.token.usage",Ion="iflow_cli.session.count",Ron="iflow_cli.file.operation.count",kon="iflow_cli.user_request.count",Oon="iflow_cli.user_request.latency",Non="iflow_cli.user_experience.success",Bon="iflow_cli.user.identity",Pon="iflow_cli.scheduler.lock.error",Mon="iflow_cli.mcp.connect.count",Fon="iflow_cli.loop.detection.count",Lon="iflow_cli.paste.operation.count",Uon="iflow_cli.paste.operation.latency",$on="iflow_cli.xinliu.web.search.count",jon="iflow_cli.xinliu.web.search.latency",Qon="iflow_cli.web.fetch.count",Gon="iflow_cli.web.fetch.latency",qon="iflow_cli.approval.mode.count",Hon="iflow_cli.compression.lightweight.count",Von="iflow_cli.compression.lightweight.ratio",Won="iflow_cli.compression.full.count",zon="iflow_cli.compression.full.ratio",Yon="iflow_cli.low_token_no_compression.count",Kon="iflow_cli.smart_approval.blacklist.block.count",Jon="iflow_cli.smart_approval.blacklist.user_action.count",Xon="iflow_cli.smart_approval.ai_review.count",Zon="iflow_cli.smart_approval.ai_risky.user_action.count"});var Gre,qre,Hre,Vre,Wre,zre,Yre,Kre,Jre,Xre,Zw,ex,esn=G(()=>{"use strict";Gre="iflow_cli.cpu.usage_percentage",qre="iflow_cli.cpu.user_percentage",Hre="iflow_cli.cpu.system_percentage",Vre="iflow_cli.cpu.cores",Wre="iflow_cli.memory.heap_used",zre="iflow_cli.memory.heap_total",Yre="iflow_cli.memory.rss",Kre="iflow_cli.memory.external",Jre="iflow_cli.memory.system_usage_percentage",Xre="iflow_cli.memory.process_usage_percentage",Zw={[Gre]:"CPU usage percentage",[qre]:"CPU user time percentage",[Hre]:"CPU system time percentage",[Vre]:"Number of CPU cores",[Wre]:"Heap memory used in bytes",[zre]:"Heap memory total in bytes",[Yre]:"Resident Set Size in bytes",[Kre]:"External memory in bytes",[Jre]:"System memory usage percentage",[Xre]:"Process memory usage percentage relative to Node.js limits"},ex={[Gre]:"percent",[qre]:"percent",[Hre]:"percent",[Vre]:"cores",[Wre]:"bytes",[zre]:"bytes",[Yre]:"bytes",[Kre]:"bytes",[Jre]:"percent",[Xre]:"percent"}});import*as tx from"os";var Gje,tsn=G(()=>{"use strict";esn();Gje=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=tx.cpus().length,this.totalSystemMemory=tx.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 o=Math.max(0,e.user+e.system),s=Math.max(0,e.user),a=Math.max(0,e.system),c=o/(n*1e3)*100,u=s/(n*1e3)*100,d=a/(n*1e3)*100,f=Number.isFinite(c)?Math.min(100,Math.max(0,c)):0,p=Number.isFinite(u)?Math.min(100,Math.max(0,u)):0,h=Number.isFinite(d)?Math.min(100,Math.max(0,d)):0;return{usage:f,user:p,system:h,cores:this.cpuCores}}catch{return{usage:0,user:0,system:0,cores:this.cpuCores}}}getCurrentMemoryMetrics(){try{let e=process.memoryUsage(),r=tx.freemem(),o=(this.totalSystemMemory-r)/this.totalSystemMemory*100,s=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,o)),processUsage:Math.min(100,Math.max(0,s))}}catch{return{heapUsed:0,heapTotal:0,rss:0,external:0,systemUsage:0,processUsage:0}}}initializeMetrics(){let e=tx.platform(),r=tx.arch(),n=process.version;this.options.enableCpuMetrics&&(this.cpuUsageGauge=this.meter.createObservableGauge(Gre,{description:Zw[Gre],unit:ex[Gre]}),this.cpuUserGauge=this.meter.createObservableGauge(qre,{description:Zw[qre],unit:ex[qre]}),this.cpuSystemGauge=this.meter.createObservableGauge(Hre,{description:Zw[Hre],unit:ex[Hre]}),this.cpuCoresGauge=this.meter.createObservableGauge(Vre,{description:Zw[Vre],unit:ex[Vre]}),this.cpuUsageGauge.addCallback(o=>{let s=this.getCurrentCpuMetrics();o.observe(s.usage,{platform:e,arch:r,node_version:n})}),this.cpuUserGauge.addCallback(o=>{let s=this.getCurrentCpuMetrics();o.observe(s.user,{platform:e,arch:r,node_version:n})}),this.cpuSystemGauge.addCallback(o=>{let s=this.getCurrentCpuMetrics();o.observe(s.system,{platform:e,arch:r,node_version:n})}),this.cpuCoresGauge?.addCallback(o=>{o.observe(this.cpuCores,{platform:e,arch:r})})),this.options.enableMemoryMetrics&&(this.memoryHeapUsedGauge=this.meter.createObservableGauge(Wre,{description:Zw[Wre],unit:ex[Wre]}),this.memoryHeapTotalGauge=this.meter.createObservableGauge(zre,{description:Zw[zre],unit:ex[zre]}),this.memoryRssGauge=this.meter.createObservableGauge(Yre,{description:Zw[Yre],unit:ex[Yre]}),this.memoryExternalGauge=this.meter.createObservableGauge(Kre,{description:Zw[Kre],unit:ex[Kre]}),this.memorySystemUsageGauge=this.meter.createObservableGauge(Jre,{description:Zw[Jre],unit:ex[Jre]}),this.memoryProcessUsageGauge=this.meter.createObservableGauge(Xre,{description:Zw[Xre],unit:ex[Xre]}),this.memoryHeapUsedGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.heapUsed,{platform:e,arch:r,node_version:n})}),this.memoryHeapTotalGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.heapTotal,{platform:e,arch:r,node_version:n})}),this.memoryRssGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.rss,{platform:e,arch:r,node_version:n})}),this.memoryExternalGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.external,{platform:e,arch:r,node_version:n})}),this.memorySystemUsageGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.systemUsage,{platform:e,arch:r,node_version:n})}),this.memoryProcessUsageGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.processUsage,{platform:e,arch:r,node_version:n,memory_limit_mb:Math.round(this.nodeJSMemoryLimit/(1024*1024)).toString()})}))}getNodeJSMemoryLimit(){let e=process.execArgv.find(o=>o.startsWith("--max-old-space-size="))?.split("=")[1];if(e){let o=parseInt(e,10);if(!isNaN(o)&&o>0)return o*1024*1024}let r=process.execArgv.find(o=>o.startsWith("--max_old_space_size="))?.split("=")[1];if(r){let o=parseInt(r,10);if(!isNaN(o)&&o>0)return o*1024*1024}let n=tx.arch();return n==="x64"||n==="arm64"?1400*1024*1024:700*1024*1024}}});function rsn(t,e={}){if(qje)return qje;let r={enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0,...e};return qje=new Gje(t,r),qje}var qje,nsn=G(()=>{"use strict";tsn();qje=null});import FKo from"os";function isn(){try{let t=FKo.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 osn=G(()=>{"use strict"});import*as Zre from"os";import*as Hje from"fs";function Ta(t){let e="0.5.1-beta-20260113143539",r=process.env.IFLOW_ENV||"normal",n={darwin:"macOS",win32:"Windows",linux:"Linux",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX"},o=Zre.platform(),s=n[o]||o,a="unknown";try{if(o==="darwin")a=Zre.release();else if(o==="linux")try{if(Hje.existsSync("/etc/os-release")){let m=Hje.readFileSync("/etc/os-release","utf8").match(/^PRETTY_NAME="(.+)"/m);m&&(a=m[1])}}catch{a=Zre.release()}else o==="win32"&&(a=Zre.release())}catch{a="unknown"}let c={name:"Node.js",version:process.version,architecture:process.arch},u=t.getModel()||"unknown",d=t.getUsageMode(),f=!1,p=t.getContentGeneratorConfig?.();if(p){let h=p.authType,m=p.baseUrl||"";(h===er.LOGIN_WITH_IFLOW||h===er.IFLOW||h===er.OPENAI_COMPATIBLE&&m.includes("apis.iflow.cn"))&&(f=!0)}return{app_name:Nm,tenant__:"gen_ai",version:e,platform:s,os_model:a,runtime_name:c.name,runtime_version:c.version,runtime_architecture:c.architecture,model_name:u,is_iflow_open_user:String(f),ip:isn(),iflow_env:r,usage_mode:d}}var I7t=G(()=>{"use strict";Hv();osn();Qre()});function ssn(){return R7t||(R7t=Y0e.getMeter(Nm)),R7t}function asn(){if(Au)return;let t=ssn();if(t){try{rsn(t,{enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0})}catch{}k7t=t.createHistogram(Eon,{description:"Counts tool calls, tagged by function name and success.",unit:"count",valueType:Xs.INT}),O7t=t.createHistogram(von,{description:"Latency of tool calls in milliseconds.",unit:"ms",valueType:Xs.INT}),N7t=t.createHistogram(bon,{description:"Counts MCP tool calls, tagged by function name and success.",unit:"count",valueType:Xs.INT}),B7t=t.createHistogram(Con,{description:"Latency of MCP tool calls in milliseconds.",unit:"ms",valueType:Xs.INT}),P7t=t.createHistogram(Son,{description:"Counts built-in tool calls, tagged by function name and success.",unit:"count",valueType:Xs.INT}),M7t=t.createHistogram(won,{description:"Latency of built-in tool calls in milliseconds.",unit:"ms",valueType:Xs.INT}),y1e=t.createHistogram(xon,{description:"Counts API requests, tagged by model and status.",unit:"count",valueType:Xs.INT}),_1e=t.createHistogram(Ton,{description:"Latency of API requests in milliseconds.",unit:"ms",valueType:Xs.INT}),F7t=t.createHistogram(Don,{description:"Counts the total number of tokens used.",unit:"tokens",valueType:Xs.INT}),L7t=t.createHistogram(Ron,{description:"Counts file operations (create, read, update).",unit:"count",valueType:Xs.INT}),U7t=t.createHistogram(kon,{description:"Counts user requests from prompt to completion.",unit:"count",valueType:Xs.INT}),$7t=t.createHistogram(Oon,{description:"End-to-end latency of user requests in milliseconds.",unit:"ms",valueType:Xs.INT}),j7t=t.createHistogram(Non,{description:"User experience success rate - counts successful user experiences including retries and fixes.",unit:"count",valueType:Xs.INT}),Q7t=t.createHistogram(Bon,{description:"User identity for tracking unique installations.",unit:"count",valueType:Xs.INT}),G7t=t.createHistogram(Pon,{description:"Counts tool scheduler lock errors when new calls are blocked by running calls.",unit:"count",valueType:Xs.INT}),q7t=t.createHistogram(Mon,{description:"Counts MCP connection attempts and their success/failure status.",unit:"count",valueType:Xs.INT}),H7t=t.createHistogram(Fon,{description:"Counts loop detection events by loop type.",unit:"count",valueType:Xs.INT}),V7t=t.createHistogram(Lon,{description:"Counts paste operations, tagged by type and success.",unit:"count",valueType:Xs.INT}),W7t=t.createHistogram(Uon,{description:"Latency of paste operations in milliseconds.",unit:"ms",valueType:Xs.INT}),z7t=t.createHistogram($on,{description:"Counts xinliu web search operations, tagged by success and error type.",unit:"count",valueType:Xs.INT}),Y7t=t.createHistogram(jon,{description:"Latency of xinliu web search operations in milliseconds.",unit:"ms",valueType:Xs.INT}),K7t=t.createHistogram(Qon,{description:"Counts web fetch operations, tagged by success and error type.",unit:"count",valueType:Xs.INT}),J7t=t.createHistogram(Gon,{description:"Latency of web fetch operations in milliseconds.",unit:"ms",valueType:Xs.INT}),X7t=t.createHistogram(qon,{description:"Counts usage of different approval modes.",unit:"count",valueType:Xs.INT}),Z7t=t.createHistogram(Hon,{description:"Counts lightweight compression triggers, tagged by executed status and skip reason.",unit:"count",valueType:Xs.INT}),eRt=t.createHistogram(Von,{description:"Histogram of lightweight compression token reduction ratios (reduced_tokens / original_tokens).",unit:"ratio",valueType:Xs.DOUBLE}),tRt=t.createHistogram(Won,{description:"Counts full compression triggers, tagged by triggered_by and had_lightweight_before.",unit:"count",valueType:Xs.INT}),rRt=t.createHistogram(zon,{description:"Histogram of full compression token reduction ratios (reduced_tokens / original_tokens).",unit:"ratio",valueType:Xs.DOUBLE}),nRt=t.createHistogram(Yon,{description:"Counts API calls when token remaining < 20% without compression triggered.",unit:"count",valueType:Xs.INT}),iRt=t.createHistogram(Kon,{description:"Counts blacklist blocks in smart approval, tagged by function name and risk level.",unit:"count",valueType:Xs.INT}),oRt=t.createHistogram(Jon,{description:"Counts user actions after blacklist block, tagged by function name and action (execute/cancel).",unit:"count",valueType:Xs.INT}),sRt=t.createHistogram(Xon,{description:"Counts AI review operations in smart approval, tagged by function name and decision (safe/risky).",unit:"count",valueType:Xs.INT}),aRt=t.createHistogram(Zon,{description:"Counts user actions after AI judges risky, tagged by function name and action (execute/cancel).",unit:"count",valueType:Xs.INT}),Au=!0}}function Vje(t){let e=ssn();if(!e||!Au)return;e.createHistogram(Ion,{description:"Count of CLI sessions started.",unit:"count",valueType:Xs.INT}).record(1,Ta(t))}function csn(t,e,r,n,o,s){if(!k7t||!O7t||!Au)return;let a={...Ta(t),function_name:e??"unknown",success:String(n),decision:o??"unknown"};k7t.record(1,a),O7t.record(r,{...Ta(t),function_name:e??"unknown",tool_type:s??"unknown"})}function lsn(t,e,r,n,o,s){if(!N7t||!B7t||!Au)return;let a={...Ta(t),function_name:e??"unknown",success:String(n),decision:o??"unknown"};s&&(a.execution_context=s),N7t.record(1,a),B7t.record(r,{...Ta(t),function_name:e??"unknown",execution_context:s??"unknown"})}function usn(t,e,r,n,o,s){if(!P7t||!M7t||!Au)return;let a={...Ta(t),function_name:e??"unknown",success:String(n),decision:o??"unknown"};s&&(a.execution_context=s),P7t.record(1,a),M7t.record(r,{...Ta(t),function_name:e??"unknown",execution_context:s??"unknown"})}function ene(t,e,r,n){!F7t||!Au||F7t.record(r,{...Ta(t),model:e??"unknown",type:n??"unknown"})}function dsn(t,e,r,n,o,s,a,c){if(!y1e||!_1e||!Au)return;let u={...Ta(t),model:e??"unknown",status_code:String(n??(o?"error":"ok"))};a!==void 0&&(u.http_status_code=String(a)),c!==void 0&&(u.business_code=String(c)),s&&(u.finish_reason=s),y1e.record(1,u);let d={...Ta(t),model:e??"unknown",http_status_code:String(a??200),finish_reason:s??"unknown"};c!=null&&(d.business_code=String(c)),_1e.record(r,d)}function fsn(t,e,r,n,o,s,a){if(!y1e||!_1e||!Au)return;let c={...Ta(t),model:e??"unknown",status_code:String(n??"error"),error:o??"unknown"};s!==void 0&&(c.http_status_code=String(s)),a!==void 0&&(c.business_code=String(a)),y1e.record(1,c);let u={...Ta(t),model:e??"unknown",http_status_code:String(s??0),error:o??"unknown"};a!=null&&(u.business_code=String(a)),_1e.record(r,u)}function wR(t,e,r,n,o){if(!L7t||!Au)return;let s={...Ta(t),operation:e};r!==void 0&&(s.lines=String(r)),n!==void 0&&(s.mimetype=n),o!==void 0&&(s.extension=o),L7t.record(1,s)}function psn(t,e,r,n,o){if(!U7t||!$7t||!Au)return;let s={...Ta(t),prompt_id:e,success:String(n)};o&&(s.error=o),U7t.record(1,s),$7t.record(r,s)}function cRt(t,e,r=!1,n=!1,o){if(!j7t||!Au)return;let s={...Ta(t),success:String(e),had_retries:String(r),had_fixes:String(n)};o&&(s.final_error=o),j7t.record(1,s)}function hsn(t,e){if(!Q7t||!Au)return;let r={...Ta(t),user_id:e};Q7t.record(1,r)}function msn(t,e,r){if(!G7t||!Au)return;let n={...Ta(t),running_calls_count:String(e)};r.forEach((o,s)=>{n[`call_${s}_name`]=o.name,n[`call_${s}_status`]=o.status}),G7t.record(1,n)}function lRt(t,e,r,n,o){if(!q7t||!Au)return;let s={...Ta(t),server_name:e,success:String(r)};n&&(s.error_type=n),o&&(s.transport_type=o),q7t.record(1,s)}function gsn(t,e,r){if(!H7t||!Au)return;let n={...Ta(t),loop_type:e,prompt_id:r};H7t.record(1,n)}function Wje(t,e,r,n,o="text",s,a){if(!V7t||!W7t||!Au)return;let c={};try{c=Ta(t)}catch{c={app_name:Nm,tenant__:"gen_ai",version:"unknown",platform:a||"unknown",os_model:"unknown",runtime_name:"Node.js",runtime_version:process.version,runtime_architecture:process.arch,model_name:"unknown",is_iflow_open_user:"false",ip:"unknown",iflow_env:"test",usage_mode:"unknown"}}let u={...c,success:String(n),paste_type:o};s&&(u.error_type=s),a&&(u.platform_specific=a),V7t.record(1,u);let d={...c,paste_type:o,text_length_range:String(r),performance_ratio:LKo(e,r)};W7t.record(e,d)}function LKo(t,e){if(e===0)return"no-text";let r=t/e;return r<=.1?"excellent":r<=.5?"good":r<=1?"normal":r<=2?"slow":"very-slow"}function zje(t,e,r,n,o,s){if(!z7t||!Y7t||!Au)return;let a={...Ta(t),success:String(r)};n&&(a.error_type=n),o!==void 0&&(a.results_count=String(o)),s&&(a.query_length=String(s.length)),z7t.record(1,a),Y7t.record(e,{...Ta(t),error_type:n??"none"})}function bq(t,e,r,n,o,s){if(!K7t||!J7t||!Au)return;let a={...Ta(t),success:String(r)};n&&(a.error_type=n),o!==void 0&&(a.url_count=String(o)),s!==void 0&&(a.prompt_length=String(s)),K7t.record(1,a),J7t.record(e,{...Ta(t),error_type:n??"none"})}function Yje(t,e){if(!X7t||!Au)return;let r={...Ta(t),approval_mode:e};X7t.record(1,r)}function tne(t,e,r,n){if(!Z7t||!Au)return;let o={...Ta(t),executed:String(e),triggered_by:r};n&&(o.skipped_reason=n),Z7t.record(1,o)}function Kje(t,e,r,n){if(!eRt||!Au)return;let o=e-r,s=e>0?o/e:0,a={...Ta(t),original_tokens:String(e),compressed_tokens:String(r),reduced_tokens:String(o),removed_tool_calls:String(n)};eRt.record(s,a)}function rne(t,e,r,n){if(!tRt||!Au)return;let o={...Ta(t),executed:String(e),triggered_by:r,had_lightweight_before:String(n)};tRt.record(1,o)}function Jje(t,e,r,n,o){if(!rRt||!Au)return;let s=e-r,a=e>0?s/e:0,c={...Ta(t),original_tokens:String(e),compressed_tokens:String(r),reduced_tokens:String(s),had_lightweight_before:String(n),recovered_files_count:String(o)};rRt.record(a,c)}function Xje(t,e,r,n){if(!nRt||!Au)return;let o=(1-n)*100,s={...Ta(t),token_count:String(e),token_limit:String(r),token_ratio:n.toFixed(2),token_remaining_percent:o.toFixed(1)};nRt.record(1,s)}function Zje(t,e,r,n,o){if(!iRt||!Au)return;let s={...Ta(t),function_name:e,risk_level:r};if(n&&(s.rule_name=n),o&&typeof o=="object"){let a=o;if((a.command||a.cmd)&&(s.command=String(a.command||a.cmd).substring(0,200)),(a.file_path||a.absolute_path||a.path)&&(s.file_path=String(a.file_path||a.absolute_path||a.path).substring(0,200)),a.url||a.prompt){let c=String(a.url||a.prompt).substring(0,200);s.url_or_prompt=c}}iRt.record(1,s)}function eQe(t,e,r,n,o){if(!oRt||!Au)return;let s={...Ta(t),function_name:e,action:r,risk_level:n};if(o&&typeof o=="object"){let a=o;if((a.command||a.cmd)&&(s.command=String(a.command||a.cmd).substring(0,200)),(a.file_path||a.absolute_path||a.path)&&(s.file_path=String(a.file_path||a.absolute_path||a.path).substring(0,200)),a.url||a.prompt){let c=String(a.url||a.prompt).substring(0,200);s.url_or_prompt=c}}oRt.record(1,s)}function tQe(t,e,r,n,o,s){if(!sRt||!Au)return;let a={...Ta(t),function_name:e,decision:r,review_layer:o,latency_ms:String(n)};if(s&&typeof s=="object"){let c=s;if((c.command||c.cmd)&&(a.command=String(c.command||c.cmd).substring(0,200)),(c.file_path||c.absolute_path||c.path)&&(a.file_path=String(c.file_path||c.absolute_path||c.path).substring(0,200)),c.url||c.prompt){let u=String(c.url||c.prompt).substring(0,200);a.url_or_prompt=u}}sRt.record(1,a)}function rQe(t,e,r,n,o){if(!aRt||!Au)return;let s={...Ta(t),function_name:e,action:r,review_layer:n};if(o&&typeof o=="object"){let a=o;if((a.command||a.cmd)&&(s.command=String(a.command||a.cmd).substring(0,200)),(a.file_path||a.absolute_path||a.path)&&(s.file_path=String(a.file_path||a.absolute_path||a.path).substring(0,200)),a.url||a.prompt){let c=String(a.url||a.prompt).substring(0,200);s.url_or_prompt=c}}aRt.record(1,s)}var rx,R7t,k7t,O7t,N7t,B7t,P7t,M7t,y1e,_1e,F7t,L7t,U7t,$7t,j7t,Q7t,G7t,q7t,H7t,V7t,W7t,z7t,Y7t,K7t,J7t,X7t,Z7t,eRt,tRt,rRt,nRt,iRt,oRt,sRt,aRt,Au,S0=G(()=>{"use strict";Xt();Qre();nsn();I7t();(function(t){t.CREATE="create",t.READ="read",t.UPDATE="update"})(rx||(rx={}));Au=!1});var ao,un,co,lo,yu=G(()=>{"use strict";ao=class{name;displayName;description;icon;kind;parameterSchema;isOutputMarkdown;canUpdateOutput;aliases;constructor(e,r,n,o,s,a,c=!0,u=!1,d=[]){this.name=e,this.displayName=r,this.description=n,this.icon=o,this.kind=s,this.parameterSchema=a,this.isOutputMarkdown=c,this.canUpdateOutput=u,this.aliases=d}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"})(un||(un={}));(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"})(co||(co={}));(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"})(lo||(lo={}))});function UKo(t){switch(t){case un.ProceedOnce:case un.ProceedAlways:case un.ProceedAlwaysServer:case un.ProceedAlwaysTool:return E1e.ACCEPT;case un.ModifyWithEditor:return E1e.MODIFY;case un.Cancel:default:return E1e.REJECT}}var E1e,nne,ine,one,sne,ane,E1,cne,lne,PC,une,nQe,GP,iQe,Cq=G(()=>{"use strict";yu();Hv();(function(t){t.ACCEPT="accept",t.REJECT="reject",t.MODIFY="modify"})(E1e||(E1e={}));nne=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(),o=!1,s=!1;r&&r.authType&&(o=r.authType===er.IFLOW,s=r.authType===er.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=o||s,this.vertex_ai_enabled=s,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()}},ine=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()}},one=class{"event.name";"event.timestamp";prompt_length;prompt_id;auth_type;prompt;constructor(e,r,n,o){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=o}},sne=class{"event.name";"event.timestamp";function_name;function_args;duration_ms;success;decision;error;error_type;prompt_id;server_name;response_text;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?UKo(e.outcome):void 0,this.error=e.response.error?.message,this.error_type=e.response.errorType,this.prompt_id=e.request.prompt_id,this.response_text=JSON.stringify(e.response,null,2),"tool"in e&&e.tool&&"serverName"in e.tool&&(this.server_name=e.tool.serverName)}},ane=class{"event.name";"event.timestamp";model;prompt_id;request_text;base_url;openai_request;constructor(e,r,n,o,s){this["event.name"]="api_request",this["event.timestamp"]=new Date().toISOString(),this.model=r,this.prompt_id=o,this.request_text=s,this.base_url=e,this.openai_request=n}},E1=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,o,s,a,c,u,d){this["event.name"]="api_error",this["event.timestamp"]=new Date().toISOString(),this.model=e,this.error=r,this.error_type=a,this.status_code=c,this.http_status_code=u,this.business_code=d,this.duration_ms=n,this.prompt_id=o,this.auth_type=s}},cne=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,o,s,a,c,u,d,f){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=d||200,this.business_code=f,this.input_token_count=s?.promptTokenCount??0,this.output_token_count=s?.candidatesTokenCount??0,this.cached_content_token_count=s?.cachedContentTokenCount??0,this.thoughts_token_count=s?.thoughtsTokenCount??0,this.tool_token_count=s?.toolUsePromptTokenCount??0,this.total_token_count=s?.totalTokenCount??0,this.response_text=a,this.error=c,this.prompt_id=n,this.auth_type=o,this.finish_reason=u}},lne=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"})(PC||(PC={}));une=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}},nQe=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}},GP=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}},iQe=class{"event.name";"event.timestamp";model;constructor(e){this["event.name"]="malformed_json_response",this["event.timestamp"]=new Date().toISOString(),this.model=e}}});var yi,Asn=G(()=>{"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",t[t.IFLOW_CLI_RESPONSE_TYPE=46]="IFLOW_CLI_RESPONSE_TYPE",t[t.IFLOW_CLI_RESPONSE_LENGTH=47]="IFLOW_CLI_RESPONSE_LENGTH",t[t.IFLOW_CLI_RESPONSE_SUCCESS=48]="IFLOW_CLI_RESPONSE_SUCCESS",t[t.IFLOW_CLI_ERROR_MESSAGE=49]="IFLOW_CLI_ERROR_MESSAGE"})(yi||(yi={}))});function Sq(t,e){let r=new WeakSet;return JSON.stringify(t,(n,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[Circular]";r.add(o)}return o},e)}var oQe=G(()=>{"use strict";});import K8,{dirname as $Ko,join as uRt}from"node:path";import sQe from"os";import*as ysn from"crypto";import{fileURLToPath as jKo}from"node:url";import QKo from"node:fs";import{execSync as GKo}from"node:child_process";function J8(t){let e=sQe.homedir();return t.startsWith(e)?t.replace(e,"~"):t}function Da(t,e=35){if(t.length<=e)return t;let n=K8.parse(t).root,o=K8.sep,a=t.substring(n.length).split(o).filter(m=>m!=="");if(a.length<=1){let m=Math.floor((e-3)/2);if(m<=0)return t.substring(0,e-3)+"...";let g=t.substring(0,m),A=t.substring(t.length-m);return`${g}...${A}`}let c=a[0],u=a[a.length-1],d=n+c,f=[],p=o.length+u.length;for(let m=a.length-2;m>=0;m--){let g=a[m],A=p+o.length+g.length;if(A<=e)f.unshift(g),p=A;else break}let h=f.join(o)+o+u;return p>e?h:(h=d+o+h,h.length>e?"..."+h.substring(h.length-e-3):h)}function Vl(t,e){let r=K8.resolve(t),n=K8.resolve(e);return K8.relative(n,r)||"."}function dne(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 xR(t){return process.platform==="win32"?t.replace(/\\([ ,;!?()[\]{}])/g,"$1"):t.replace(/\\(.)/g,"$1")}function aQe(t){return ysn.createHash("sha256").update(t).digest("hex")}function eE(t){let e=aQe(t);return K8.join(sQe.homedir(),ih,qKo,e)}function cQe(){return K8.join(sQe.homedir(),ih,_sn)}function lQe(t){return K8.join(t,ih,_sn)}function uQe(){if(process.env.USE_BUILTIN_RIPGREP==="0")return"rg";let t=$Ko(jKo(import.meta.url)),e=[uRt(t,"..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`),uRt(t,"..","..","..","..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`),uRt(t,"..","..","..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`)];for(let r of e)try{if(QKo.existsSync(r))return process.platform==="darwin"&&Esn(r),r}catch{}return e[0]}function Esn(t){if(process.platform==="darwin")try{let e=["com.apple.quarantine","CachedFileMimeType","CachedFileType","FileXRayCachedResultInEA"];for(let r of e)try{GKo(`xattr -d "${r}" "${t}" 2>/dev/null`,{stdio:"ignore"})}catch{}}catch{}}function wq(t,e){let n=sQe.platform()==="win32"?K8.win32:K8,o=n.relative(t,e);return!o.startsWith(`..${n.sep}`)&&o!==".."&&!n.isAbsolute(o)}var ih,dRt,qKo,_sn,$u=G(()=>{"use strict";ih=".iflow",dRt="google_accounts.json",qKo="tmp",_sn="commands"});import HKo from"node:path";import{promises as bUc,existsSync as vsn,readFileSync as bsn}from"node:fs";import*as Csn from"os";function Ssn(){return HKo.join(Csn.homedir(),ih,dRt)}function wsn(){try{let t=Ssn();if(vsn(t)){let e=bsn(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 xsn(){try{let t=Ssn();if(!vsn(t))return 0;let e=bsn(t,"utf-8").trim();if(!e)return 0;let r=JSON.parse(e);if(!r||typeof r!="object")return 0;let n=r,o=n.old&&Array.isArray(n.old)?n.old.length:0;return n.active&&o++,o}catch(t){return console.debug("Error reading lifetime Google Accounts:",t),0}}var Tsn=G(()=>{"use strict";$u();});import*as Dsn from"os";import*as TR from"fs";import*as hRt from"path";import{randomUUID as VKo}from"crypto";function zKo(){TR.existsSync(fRt)||TR.mkdirSync(fRt,{recursive:!0})}function YKo(){return TR.existsSync(pRt)&&TR.readFileSync(pRt,"utf-8").trim()||null}function KKo(t){TR.writeFileSync(pRt,t,"utf-8")}function dQe(){try{zKo();let t=YKo();return t||(t=VKo(),KKo(t)),t}catch(t){return console.error("Error accessing installation ID file, generating ephemeral ID:",t),"123456789"}}var WKo,fRt,pRt,mRt=G(()=>{"use strict";$u();WKo=Dsn.homedir()??"",fRt=hRt.join(WKo,ih),pRt=hRt.join(fRt,"installation_id")});var Isn,JKo,XKo,ZKo,eJo,tJo,rJo,nJo,iJo,oJo,sJo,aJo,cJo,lJo,_g,v1e=G(()=>{"use strict";Isn=Se(Cvt(),1);Cq();Asn();oQe();Tsn();mRt();JKo="start_session",XKo="new_prompt",ZKo="tool_call",eJo="api_request",tJo="api_response",rJo="api_error",nJo="end_session",iJo="flash_fallback",oJo="loop_detected",sJo="next_speaker_check",aJo="slash_command",cJo="malformed_json_response",lJo="cli_response",_g=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:Sq(e)}])}createLogEvent(e,r){let n=wsn(),o=xsn();r.push({iflow_cli_key:yi.IFLOW_CLI_GOOGLE_ACCOUNTS_COUNT,value:o.toString()});let s={console_type:"IFLOW_CLI",application:102,event_name:e,event_metadata:[r]};return n?s.client_email=n:s.client_install_id=dQe(),s}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 s=1;n&&s<e.length;s++){let a=e.readUInt8(s);r|=BigInt(a&127)<<BigInt(7*(s-1)),n=(a&128)!==0}return n?void 0:{nextRequestWaitMs:Number(r)}}handleLogEvent(e,r,n=!1){this.enqueueLogEvent(this.createLogEvent(e,r)),n?this.flushToClearcut().catch(o=>{console.debug("Error flushing to Clearcut:",o)}):this.flushIfNeeded()}logStartSessionEvent(e){let r=process.env.SURFACE||"SURFACE_NOT_SET",n=[{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_MODEL,value:e.model},{iflow_cli_key:yi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_EMBEDDING_MODEL,value:e.embedding_model},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_SANDBOX,value:e.sandbox_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_CORE_TOOLS,value:e.core_tools_enabled},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_APPROVAL_MODE,value:e.approval_mode},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_API_KEY_ENABLED,value:e.api_key_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_DEBUG_MODE_ENABLED,value:e.debug_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_MCP_SERVERS,value:e.mcp_servers},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_TELEMETRY_ENABLED,value:e.telemetry_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED,value:e.telemetry_log_user_prompts_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_SURFACE,value:r}];this.handleLogEvent(JKo,n,!0)}logNewPromptEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_USER_PROMPT_LENGTH,value:JSON.stringify(e.prompt_length)},{iflow_cli_key:yi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.handleLogEvent(XKo,r)}logToolCallEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_TOOL_CALL_NAME,value:JSON.stringify(e.function_name)},{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_TOOL_CALL_DECISION,value:JSON.stringify(e.decision)},{iflow_cli_key:yi.IFLOW_CLI_TOOL_CALL_SUCCESS,value:JSON.stringify(e.success)},{iflow_cli_key:yi.IFLOW_CLI_TOOL_CALL_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:yi.IFLOW_CLI_TOOL_ERROR_MESSAGE,value:JSON.stringify(e.error)},{iflow_cli_key:yi.IFLOW_CLI_TOOL_CALL_ERROR_TYPE,value:JSON.stringify(e.error_type)}];this.handleLogEvent(ZKo,r)}logApiRequestEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_API_REQUEST_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)}];this.handleLogEvent(eJo,r)}logApiResponseEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_STATUS_CODE,value:JSON.stringify(e.status_code)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:yi.IFLOW_CLI_API_ERROR_MESSAGE,value:JSON.stringify(e.error)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_INPUT_TOKEN_COUNT,value:JSON.stringify(e.input_token_count)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT,value:JSON.stringify(e.output_token_count)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_CACHED_TOKEN_COUNT,value:JSON.stringify(e.cached_content_token_count)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_THINKING_TOKEN_COUNT,value:JSON.stringify(e.thoughts_token_count)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_TOOL_TOKEN_COUNT,value:JSON.stringify(e.tool_token_count)},{iflow_cli_key:yi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.handleLogEvent(tJo,r)}logApiErrorEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_API_ERROR_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_API_ERROR_TYPE,value:JSON.stringify(e.error_type)},{iflow_cli_key:yi.IFLOW_CLI_API_ERROR_STATUS_CODE,value:JSON.stringify(e.status_code)},{iflow_cli_key:yi.IFLOW_CLI_API_ERROR_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:yi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.handleLogEvent(rJo,r)}logFlashFallbackEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)},{iflow_cli_key:yi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.handleLogEvent(iJo,r,!0)}logLoopDetectedEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_LOOP_DETECTED_TYPE,value:JSON.stringify(e.loop_type)}];this.handleLogEvent(oJo,r)}logNextSpeakerCheck(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_RESPONSE_FINISH_REASON,value:JSON.stringify(e.finish_reason)},{iflow_cli_key:yi.IFLOW_CLI_NEXT_SPEAKER_CHECK_RESULT,value:JSON.stringify(e.result)},{iflow_cli_key:yi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.handleLogEvent(sJo,r)}logSlashCommandEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_SLASH_COMMAND_NAME,value:JSON.stringify(e.command)}];e.subcommand&&r.push({iflow_cli_key:yi.IFLOW_CLI_SLASH_COMMAND_SUBCOMMAND,value:JSON.stringify(e.subcommand)}),this.handleLogEvent(aJo,r)}logMalformedJsonResponseEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_MALFORMED_JSON_RESPONSE_MODEL,value:JSON.stringify(e.model)}];this.handleLogEvent(cJo,r)}logCliResponseEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_RESPONSE_TYPE,value:JSON.stringify(e.response_type)},{iflow_cli_key:yi.IFLOW_CLI_RESPONSE_LENGTH,value:JSON.stringify(e.response_length)},{iflow_cli_key:yi.IFLOW_CLI_RESPONSE_SUCCESS,value:JSON.stringify(e.success)},{iflow_cli_key:yi.IFLOW_CLI_ERROR_MESSAGE,value:JSON.stringify(e.error)}];this.handleLogEvent(lJo,r)}logEndSessionEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_SESSION_ID,value:e?.session_id?.toString()??""}];this.handleLogEvent(nJo,r,!0)}getProxyAgent(){let e=this.config?.getProxy();if(e){if(e.startsWith("http"))return new Isn.HttpsProxyAgent(e);throw new Error("Unsupported proxy type")}}shutdown(){let e=new ine(this.config);this.logEndSessionEvent(e)}}});import*as Rsn from"node:fs";var xq,ksn,b1e,fQe,pQe,hQe,Osn=G(()=>{"use strict";xq=Se(Ii(),1),ksn=Se(a8(),1);b1e=class{writeStream;constructor(e){this.writeStream=Rsn.createWriteStream(e,{flags:"a"})}serialize(e){let r=new WeakSet;return JSON.stringify(e,(o,s)=>{if(typeof s=="object"&&s!==null){if(r.has(s))return"[Circular]";r.add(s)}return s},2)+`
494
+ `).find(n=>n.includes("IOPlatformUUID"));if(!e)return;let r=e.split('" = "');if(r.length===2)return r[1].slice(0,-1)}catch(t){LYo.diag.debug(`error reading machine id: ${t}`)}}gje.getMachineId=UYo});var Rin=T(Aje=>{"use strict";Object.defineProperty(Aje,"__esModule",{value:!0});Aje.getMachineId=void 0;var $Yo=me("fs"),jYo=(Xt(),gt(ar));async function QYo(){let t=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let e of t)try{return(await $Yo.promises.readFile(e,{encoding:"utf8"})).trim()}catch(r){jYo.diag.debug(`error reading machine id: ${r}`)}}Aje.getMachineId=QYo});var Oin=T(yje=>{"use strict";Object.defineProperty(yje,"__esModule",{value:!0});yje.getMachineId=void 0;var GYo=me("fs"),qYo=mje(),kin=(Xt(),gt(ar));async function HYo(){try{return(await GYo.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(t){kin.diag.debug(`error reading machine id: ${t}`)}try{return(await(0,qYo.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(t){kin.diag.debug(`error reading machine id: ${t}`)}}yje.getMachineId=HYo});var Bin=T(_je=>{"use strict";Object.defineProperty(_je,"__esModule",{value:!0});_je.getMachineId=void 0;var Nin=me("process"),VYo=mje(),WYo=(Xt(),gt(ar));async function zYo(){let t="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",e="%windir%\\System32\\REG.exe";Nin.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in Nin.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{let n=(await(0,VYo.execAsync)(`${e} ${t}`)).stdout.split("REG_SZ");if(n.length===2)return n[1].trim()}catch(r){WYo.diag.debug(`error reading machine id: ${r}`)}}_je.getMachineId=zYo});var Pin=T(Eje=>{"use strict";Object.defineProperty(Eje,"__esModule",{value:!0});Eje.getMachineId=void 0;var YYo=(Xt(),gt(ar));async function KYo(){YYo.diag.debug("could not read machine-id: unsupported platform")}Eje.getMachineId=KYo});var Min=T(vje=>{"use strict";Object.defineProperty(vje,"__esModule",{value:!0});vje.getMachineId=void 0;var JYo=me("process"),_q;async function XYo(){if(!_q)switch(JYo.platform){case"darwin":_q=(await Promise.resolve().then(()=>Se(Iin()))).getMachineId;break;case"linux":_q=(await Promise.resolve().then(()=>Se(Rin()))).getMachineId;break;case"freebsd":_q=(await Promise.resolve().then(()=>Se(Oin()))).getMachineId;break;case"win32":_q=(await Promise.resolve().then(()=>Se(Bin()))).getMachineId;break;default:_q=(await Promise.resolve().then(()=>Se(Pin()))).getMachineId;break}return _q()}vje.getMachineId=XYo});var u7t=T(Fre=>{"use strict";Object.defineProperty(Fre,"__esModule",{value:!0});Fre.normalizeType=Fre.normalizeArch=void 0;var ZYo=t=>{switch(t){case"arm":return"arm32";case"ppc":return"ppc32";case"x64":return"amd64";default:return t}};Fre.normalizeArch=ZYo;var eKo=t=>{switch(t){case"sunos":return"solaris";case"win32":return"windows";default:return t}};Fre.normalizeType=eKo});var Lin=T(bje=>{"use strict";Object.defineProperty(bje,"__esModule",{value:!0});bje.hostDetector=void 0;var d7t=p1e(),Fin=me("os"),tKo=Min(),rKo=u7t(),f7t=class{detect(e){return{attributes:{[d7t.ATTR_HOST_NAME]:(0,Fin.hostname)(),[d7t.ATTR_HOST_ARCH]:(0,rKo.normalizeArch)((0,Fin.arch)()),[d7t.ATTR_HOST_ID]:(0,tKo.getMachineId)()}}}};bje.hostDetector=new f7t});var jin=T(Cje=>{"use strict";Object.defineProperty(Cje,"__esModule",{value:!0});Cje.osDetector=void 0;var Uin=p1e(),$in=me("os"),nKo=u7t(),p7t=class{detect(e){return{attributes:{[Uin.ATTR_OS_TYPE]:(0,nKo.normalizeType)((0,$in.platform)()),[Uin.ATTR_OS_VERSION]:(0,$in.release)()}}}};Cje.osDetector=new p7t});var Qin=T(Sje=>{"use strict";Object.defineProperty(Sje,"__esModule",{value:!0});Sje.processDetector=void 0;var iKo=(Xt(),gt(ar)),SR=p1e(),oKo=me("os"),h7t=class{detect(e){let r={[SR.ATTR_PROCESS_PID]:process.pid,[SR.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[SR.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[SR.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[SR.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[SR.ATTR_PROCESS_RUNTIME_NAME]:"nodejs",[SR.ATTR_PROCESS_RUNTIME_DESCRIPTION]:"Node.js"};process.argv.length>1&&(r[SR.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let n=oKo.userInfo();r[SR.ATTR_PROCESS_OWNER]=n.username}catch(n){iKo.diag.debug(`error obtaining process owner: ${n}`)}return{attributes:r}}};Sje.processDetector=new h7t});var Gin=T(wje=>{"use strict";Object.defineProperty(wje,"__esModule",{value:!0});wje.serviceInstanceIdDetector=void 0;var sKo=p1e(),aKo=me("crypto"),m7t=class{detect(e){return{attributes:{[sKo.ATTR_SERVICE_INSTANCE_ID]:(0,aKo.randomUUID)()}}}};wje.serviceInstanceIdDetector=new m7t});var qin=T(z8=>{"use strict";Object.defineProperty(z8,"__esModule",{value:!0});z8.serviceInstanceIdDetector=z8.processDetector=z8.osDetector=z8.hostDetector=void 0;var cKo=Lin();Object.defineProperty(z8,"hostDetector",{enumerable:!0,get:function(){return cKo.hostDetector}});var lKo=jin();Object.defineProperty(z8,"osDetector",{enumerable:!0,get:function(){return lKo.osDetector}});var uKo=Qin();Object.defineProperty(z8,"processDetector",{enumerable:!0,get:function(){return uKo.processDetector}});var dKo=Gin();Object.defineProperty(z8,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return dKo.serviceInstanceIdDetector}})});var Hin=T(Y8=>{"use strict";Object.defineProperty(Y8,"__esModule",{value:!0});Y8.serviceInstanceIdDetector=Y8.processDetector=Y8.osDetector=Y8.hostDetector=void 0;var xje=qin();Object.defineProperty(Y8,"hostDetector",{enumerable:!0,get:function(){return xje.hostDetector}});Object.defineProperty(Y8,"osDetector",{enumerable:!0,get:function(){return xje.osDetector}});Object.defineProperty(Y8,"processDetector",{enumerable:!0,get:function(){return xje.processDetector}});Object.defineProperty(Y8,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return xje.serviceInstanceIdDetector}})});var Vin=T(Lre=>{"use strict";Object.defineProperty(Lre,"__esModule",{value:!0});Lre.noopDetector=Lre.NoopDetector=void 0;var Tje=class{detect(){return{attributes:{}}}};Lre.NoopDetector=Tje;Lre.noopDetector=new Tje});var Win=T(X_=>{"use strict";Object.defineProperty(X_,"__esModule",{value:!0});X_.noopDetector=X_.serviceInstanceIdDetector=X_.processDetector=X_.osDetector=X_.hostDetector=X_.envDetector=void 0;var fKo=Din();Object.defineProperty(X_,"envDetector",{enumerable:!0,get:function(){return fKo.envDetector}});var Dje=Hin();Object.defineProperty(X_,"hostDetector",{enumerable:!0,get:function(){return Dje.hostDetector}});Object.defineProperty(X_,"osDetector",{enumerable:!0,get:function(){return Dje.osDetector}});Object.defineProperty(X_,"processDetector",{enumerable:!0,get:function(){return Dje.processDetector}});Object.defineProperty(X_,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Dje.serviceInstanceIdDetector}});var pKo=Vin();Object.defineProperty(X_,"noopDetector",{enumerable:!0,get:function(){return pKo.noopDetector}})});var zin=T(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.defaultServiceName=nh.emptyResource=nh.defaultResource=nh.resourceFromAttributes=nh.serviceInstanceIdDetector=nh.processDetector=nh.osDetector=nh.hostDetector=nh.envDetector=nh.detectResources=void 0;var hKo=xin();Object.defineProperty(nh,"detectResources",{enumerable:!0,get:function(){return hKo.detectResources}});var h1e=Win();Object.defineProperty(nh,"envDetector",{enumerable:!0,get:function(){return h1e.envDetector}});Object.defineProperty(nh,"hostDetector",{enumerable:!0,get:function(){return h1e.hostDetector}});Object.defineProperty(nh,"osDetector",{enumerable:!0,get:function(){return h1e.osDetector}});Object.defineProperty(nh,"processDetector",{enumerable:!0,get:function(){return h1e.processDetector}});Object.defineProperty(nh,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return h1e.serviceInstanceIdDetector}});var g7t=a7t();Object.defineProperty(nh,"resourceFromAttributes",{enumerable:!0,get:function(){return g7t.resourceFromAttributes}});Object.defineProperty(nh,"defaultResource",{enumerable:!0,get:function(){return g7t.defaultResource}});Object.defineProperty(nh,"emptyResource",{enumerable:!0,get:function(){return g7t.emptyResource}});var mKo=i7t();Object.defineProperty(nh,"defaultServiceName",{enumerable:!0,get:function(){return mKo.defaultServiceName}})});var Yin=T(Rje=>{"use strict";Object.defineProperty(Rje,"__esModule",{value:!0});Rje.LogRecordImpl=void 0;var Eq=(Xt(),gt(ar)),Ije=Xw(),A7t=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:o,observedTimestamp:s,eventName:a,severityNumber:c,severityText:u,body:d,attributes:f={},context:p}=n,h=Date.now();if(this.hrTime=(0,Ije.timeInputToHrTime)(o??h),this.hrTimeObserved=(0,Ije.timeInputToHrTime)(s??h),p){let m=Eq.trace.getSpanContext(p);m&&Eq.isSpanContextValid(m)&&(this.spanContext=m)}this.severityNumber=c,this.severityText=u,this.body=d,this.resource=e.resource,this.instrumentationScope=r,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(f)}setAttribute(e,r){return this._isLogRecordReadonly()?this:r===null?this:e.length===0?(Eq.diag.warn(`Invalid attribute key: ${e}`),this):!(0,Ije.isAttributeValue)(r)&&!(typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length>0)?(Eq.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&&Eq.diag.warn("Dropping extra attributes."),this):((0,Ije.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?(Eq.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&&Eq.diag.warn("Can not execute the operation on emitted log record"),this._isReadonly}};Rje.LogRecordImpl=A7t});var Kin=T(kje=>{"use strict";Object.defineProperty(kje,"__esModule",{value:!0});kje.Logger=void 0;var gKo=(Xt(),gt(ar)),AKo=Yin(),y7t=class{instrumentationScope;_sharedState;constructor(e,r){this.instrumentationScope=e,this._sharedState=r}emit(e){let r=e.context||gKo.context.active(),n=new AKo.LogRecordImpl(this._sharedState,this.instrumentationScope,{context:r,...e});this._sharedState.activeProcessor.onEmit(n,r),n._makeReadonly()}};kje.Logger=y7t});var Jin=T($re=>{"use strict";Object.defineProperty($re,"__esModule",{value:!0});$re.reconfigureLimits=$re.loadDefaultConfig=void 0;var Ure=Xw();function yKo(){return{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:(0,Ure.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,Ure.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT")??128},includeTraceContext:!0}}$re.loadDefaultConfig=yKo;function _Ko(t){return{attributeCountLimit:t.attributeCountLimit??(0,Ure.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT")??(0,Ure.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??128,attributeValueLengthLimit:t.attributeValueLengthLimit??(0,Ure.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT")??(0,Ure.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0}}$re.reconfigureLimits=_Ko});var E7t=T(Oje=>{"use strict";Object.defineProperty(Oje,"__esModule",{value:!0});Oje.NoopLogRecordProcessor=void 0;var _7t=class{forceFlush(){return Promise.resolve()}onEmit(e,r){}shutdown(){return Promise.resolve()}};Oje.NoopLogRecordProcessor=_7t});var Xin=T(Nje=>{"use strict";Object.defineProperty(Nje,"__esModule",{value:!0});Nje.MultiLogRecordProcessor=void 0;var EKo=Xw(),v7t=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,EKo.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()))}};Nje.MultiLogRecordProcessor=v7t});var Zin=T(Bje=>{"use strict";Object.defineProperty(Bje,"__esModule",{value:!0});Bje.LoggerProviderSharedState=void 0;var vKo=E7t(),bKo=Xin(),b7t=class{resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];constructor(e,r,n,o){this.resource=e,this.forceFlushTimeoutMillis=r,this.logRecordLimits=n,this.processors=o,o.length>0?(this.registeredLogRecordProcessors=o,this.activeProcessor=new bKo.MultiLogRecordProcessor(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new vKo.NoopLogRecordProcessor}};Bje.LoggerProviderSharedState=b7t});var ron=T(vq=>{"use strict";Object.defineProperty(vq,"__esModule",{value:!0});vq.LoggerProvider=vq.DEFAULT_LOGGER_NAME=void 0;var Pje=(Xt(),gt(ar)),CKo=mnn(),SKo=zin(),eon=Xw(),wKo=Kin(),ton=Jin(),xKo=Zin();vq.DEFAULT_LOGGER_NAME="unknown";var C7t=class{_shutdownOnce;_sharedState;constructor(e={}){let r=(0,eon.merge)({},(0,ton.loadDefaultConfig)(),e),n=e.resource??(0,SKo.defaultResource)();this._sharedState=new xKo.LoggerProviderSharedState(n,r.forceFlushTimeoutMillis,(0,ton.reconfigureLimits)(r.logRecordLimits),e?.processors??[]),this._shutdownOnce=new eon.BindOnceFuture(this._shutdown,this)}getLogger(e,r,n){if(this._shutdownOnce.isCalled)return Pje.diag.warn("A shutdown LoggerProvider cannot provide a Logger"),CKo.NOOP_LOGGER;e||Pje.diag.warn("Logger requested without instrumentation scope name.");let o=e||vq.DEFAULT_LOGGER_NAME,s=`${o}@${r||""}:${n?.schemaUrl||""}`;return this._sharedState.loggers.has(s)||this._sharedState.loggers.set(s,new wKo.Logger({name:o,version:r,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(s)}forceFlush(){return this._shutdownOnce.isCalled?(Pje.diag.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(Pje.diag.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};vq.LoggerProvider=C7t});var ion=T(Mje=>{"use strict";Object.defineProperty(Mje,"__esModule",{value:!0});Mje.ConsoleLogRecordExporter=void 0;var non=Xw(),S7t=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,non.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:non.ExportResultCode.SUCCESS})}};Mje.ConsoleLogRecordExporter=S7t});var oon=T(Fje=>{"use strict";Object.defineProperty(Fje,"__esModule",{value:!0});Fje.SimpleLogRecordProcessor=void 0;var jre=Xw(),w7t=class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new jre.BindOnceFuture(this._shutdown,this),this._unresolvedExports=new Set}onEmit(e){if(this._shutdownOnce.isCalled)return;let r=()=>jre.internal._export(this._exporter,[e]).then(n=>{n.code!==jre.ExportResultCode.SUCCESS&&(0,jre.globalErrorHandler)(n.error??new Error(`SimpleLogRecordProcessor: log record export failed (status ${n})`))}).catch(jre.globalErrorHandler);if(e.resource.asyncAttributesPending){let n=e.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(n),r()),jre.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()}};Fje.SimpleLogRecordProcessor=w7t});var aon=T(Lje=>{"use strict";Object.defineProperty(Lje,"__esModule",{value:!0});Lje.InMemoryLogRecordExporter=void 0;var son=Xw(),x7t=class{_finishedLogRecords=[];_stopped=!1;export(e,r){if(this._stopped)return r({code:son.ExportResultCode.FAILED,error:new Error("Exporter has been stopped")});this._finishedLogRecords.push(...e),r({code:son.ExportResultCode.SUCCESS})}shutdown(){return this._stopped=!0,this.reset(),Promise.resolve()}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}};Lje.InMemoryLogRecordExporter=x7t});var con=T(Uje=>{"use strict";Object.defineProperty(Uje,"__esModule",{value:!0});Uje.BatchLogRecordProcessorBase=void 0;var TKo=(Xt(),gt(ar)),BC=Xw(),T7t=class{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_isExporting=!1;_finishedLogRecords=[];_timer;_shutdownOnce;constructor(e,r){this._exporter=e,this._maxExportBatchSize=r?.maxExportBatchSize??(0,BC.getNumberFromEnv)("OTEL_BLRP_MAX_EXPORT_BATCH_SIZE")??512,this._maxQueueSize=r?.maxQueueSize??(0,BC.getNumberFromEnv)("OTEL_BLRP_MAX_QUEUE_SIZE")??2048,this._scheduledDelayMillis=r?.scheduledDelayMillis??(0,BC.getNumberFromEnv)("OTEL_BLRP_SCHEDULE_DELAY")??5e3,this._exportTimeoutMillis=r?.exportTimeoutMillis??(0,BC.getNumberFromEnv)("OTEL_BLRP_EXPORT_TIMEOUT")??3e4,this._shutdownOnce=new BC.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(TKo.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=[],o=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let s=0;s<o;s++)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,BC.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,BC.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=()=>BC.internal._export(this._exporter,e).then(o=>{o.code!==BC.ExportResultCode.SUCCESS&&(0,BC.globalErrorHandler)(o.error??new Error(`BatchLogRecordProcessor: log record export failed (status ${o})`))}).catch(BC.globalErrorHandler),n=e.map(o=>o.resource).filter(o=>o.asyncAttributesPending);return n.length===0?r():Promise.all(n.map(o=>o.waitForAsyncAttributes?.())).then(r,BC.globalErrorHandler)}};Uje.BatchLogRecordProcessorBase=T7t});var lon=T($je=>{"use strict";Object.defineProperty($je,"__esModule",{value:!0});$je.BatchLogRecordProcessor=void 0;var DKo=con(),D7t=class extends DKo.BatchLogRecordProcessorBase{onShutdown(){}};$je.BatchLogRecordProcessor=D7t});var uon=T(jje=>{"use strict";Object.defineProperty(jje,"__esModule",{value:!0});jje.BatchLogRecordProcessor=void 0;var IKo=lon();Object.defineProperty(jje,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return IKo.BatchLogRecordProcessor}})});var don=T(Qje=>{"use strict";Object.defineProperty(Qje,"__esModule",{value:!0});Qje.BatchLogRecordProcessor=void 0;var RKo=uon();Object.defineProperty(Qje,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return RKo.BatchLogRecordProcessor}})});var fon=T(Z_=>{"use strict";Object.defineProperty(Z_,"__esModule",{value:!0});Z_.BatchLogRecordProcessor=Z_.InMemoryLogRecordExporter=Z_.SimpleLogRecordProcessor=Z_.ConsoleLogRecordExporter=Z_.NoopLogRecordProcessor=Z_.LoggerProvider=void 0;var kKo=ron();Object.defineProperty(Z_,"LoggerProvider",{enumerable:!0,get:function(){return kKo.LoggerProvider}});var OKo=E7t();Object.defineProperty(Z_,"NoopLogRecordProcessor",{enumerable:!0,get:function(){return OKo.NoopLogRecordProcessor}});var NKo=ion();Object.defineProperty(Z_,"ConsoleLogRecordExporter",{enumerable:!0,get:function(){return NKo.ConsoleLogRecordExporter}});var BKo=oon();Object.defineProperty(Z_,"SimpleLogRecordProcessor",{enumerable:!0,get:function(){return BKo.SimpleLogRecordProcessor}});var PKo=aon();Object.defineProperty(Z_,"InMemoryLogRecordExporter",{enumerable:!0,get:function(){return PKo.InMemoryLogRecordExporter}});var MKo=don();Object.defineProperty(Z_,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return MKo.BatchLogRecordProcessor}})});var Nm,pon,m1e,hon,g1e,A1e,mon,gon,Aon,yon,_on,Eon,von,bon,Con,Son,won,xon,Ton,Don,Ion,Ron,kon,Oon,Non,Bon,Pon,Mon,Fon,Lon,Uon,$on,jon,Qon,Gon,qon,Hon,Von,Won,zon,Yon,Kon,Jon,Xon,Zon,Qre=G(()=>{"use strict";Nm="iflow-cli",pon="iflow_cli.user_prompt",m1e="iflow_cli.tool_call",hon="iflow_cli.api_request",g1e="iflow_cli.api_error",A1e="iflow_cli.api_response",mon="iflow_cli.config",gon="iflow_cli.flash_fallback",Aon="iflow_cli.next_speaker_check",yon="iflow_cli.slash_command",_on="iflow_cli.cli_response",Eon="iflow_cli.tool.call.count",von="iflow_cli.tool.call.latency",bon="iflow_cli.mcp.tool.call.count",Con="iflow_cli.mcp.tool.call.latency",Son="iflow_cli.builtin.tool.call.count",won="iflow_cli.builtin.tool.call.latency",xon="gen_ai.client.operation",Ton="gen_ai.client.operation.duration",Don="gen_ai.client.token.usage",Ion="iflow_cli.session.count",Ron="iflow_cli.file.operation.count",kon="iflow_cli.user_request.count",Oon="iflow_cli.user_request.latency",Non="iflow_cli.user_experience.success",Bon="iflow_cli.user.identity",Pon="iflow_cli.scheduler.lock.error",Mon="iflow_cli.mcp.connect.count",Fon="iflow_cli.loop.detection.count",Lon="iflow_cli.paste.operation.count",Uon="iflow_cli.paste.operation.latency",$on="iflow_cli.xinliu.web.search.count",jon="iflow_cli.xinliu.web.search.latency",Qon="iflow_cli.web.fetch.count",Gon="iflow_cli.web.fetch.latency",qon="iflow_cli.approval.mode.count",Hon="iflow_cli.compression.lightweight.count",Von="iflow_cli.compression.lightweight.ratio",Won="iflow_cli.compression.full.count",zon="iflow_cli.compression.full.ratio",Yon="iflow_cli.low_token_no_compression.count",Kon="iflow_cli.smart_approval.blacklist.block.count",Jon="iflow_cli.smart_approval.blacklist.user_action.count",Xon="iflow_cli.smart_approval.ai_review.count",Zon="iflow_cli.smart_approval.ai_risky.user_action.count"});var Gre,qre,Hre,Vre,Wre,zre,Yre,Kre,Jre,Xre,Zw,ex,esn=G(()=>{"use strict";Gre="iflow_cli.cpu.usage_percentage",qre="iflow_cli.cpu.user_percentage",Hre="iflow_cli.cpu.system_percentage",Vre="iflow_cli.cpu.cores",Wre="iflow_cli.memory.heap_used",zre="iflow_cli.memory.heap_total",Yre="iflow_cli.memory.rss",Kre="iflow_cli.memory.external",Jre="iflow_cli.memory.system_usage_percentage",Xre="iflow_cli.memory.process_usage_percentage",Zw={[Gre]:"CPU usage percentage",[qre]:"CPU user time percentage",[Hre]:"CPU system time percentage",[Vre]:"Number of CPU cores",[Wre]:"Heap memory used in bytes",[zre]:"Heap memory total in bytes",[Yre]:"Resident Set Size in bytes",[Kre]:"External memory in bytes",[Jre]:"System memory usage percentage",[Xre]:"Process memory usage percentage relative to Node.js limits"},ex={[Gre]:"percent",[qre]:"percent",[Hre]:"percent",[Vre]:"cores",[Wre]:"bytes",[zre]:"bytes",[Yre]:"bytes",[Kre]:"bytes",[Jre]:"percent",[Xre]:"percent"}});import*as tx from"os";var Gje,tsn=G(()=>{"use strict";esn();Gje=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=tx.cpus().length,this.totalSystemMemory=tx.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 o=Math.max(0,e.user+e.system),s=Math.max(0,e.user),a=Math.max(0,e.system),c=o/(n*1e3)*100,u=s/(n*1e3)*100,d=a/(n*1e3)*100,f=Number.isFinite(c)?Math.min(100,Math.max(0,c)):0,p=Number.isFinite(u)?Math.min(100,Math.max(0,u)):0,h=Number.isFinite(d)?Math.min(100,Math.max(0,d)):0;return{usage:f,user:p,system:h,cores:this.cpuCores}}catch{return{usage:0,user:0,system:0,cores:this.cpuCores}}}getCurrentMemoryMetrics(){try{let e=process.memoryUsage(),r=tx.freemem(),o=(this.totalSystemMemory-r)/this.totalSystemMemory*100,s=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,o)),processUsage:Math.min(100,Math.max(0,s))}}catch{return{heapUsed:0,heapTotal:0,rss:0,external:0,systemUsage:0,processUsage:0}}}initializeMetrics(){let e=tx.platform(),r=tx.arch(),n=process.version;this.options.enableCpuMetrics&&(this.cpuUsageGauge=this.meter.createObservableGauge(Gre,{description:Zw[Gre],unit:ex[Gre]}),this.cpuUserGauge=this.meter.createObservableGauge(qre,{description:Zw[qre],unit:ex[qre]}),this.cpuSystemGauge=this.meter.createObservableGauge(Hre,{description:Zw[Hre],unit:ex[Hre]}),this.cpuCoresGauge=this.meter.createObservableGauge(Vre,{description:Zw[Vre],unit:ex[Vre]}),this.cpuUsageGauge.addCallback(o=>{let s=this.getCurrentCpuMetrics();o.observe(s.usage,{platform:e,arch:r,node_version:n})}),this.cpuUserGauge.addCallback(o=>{let s=this.getCurrentCpuMetrics();o.observe(s.user,{platform:e,arch:r,node_version:n})}),this.cpuSystemGauge.addCallback(o=>{let s=this.getCurrentCpuMetrics();o.observe(s.system,{platform:e,arch:r,node_version:n})}),this.cpuCoresGauge?.addCallback(o=>{o.observe(this.cpuCores,{platform:e,arch:r})})),this.options.enableMemoryMetrics&&(this.memoryHeapUsedGauge=this.meter.createObservableGauge(Wre,{description:Zw[Wre],unit:ex[Wre]}),this.memoryHeapTotalGauge=this.meter.createObservableGauge(zre,{description:Zw[zre],unit:ex[zre]}),this.memoryRssGauge=this.meter.createObservableGauge(Yre,{description:Zw[Yre],unit:ex[Yre]}),this.memoryExternalGauge=this.meter.createObservableGauge(Kre,{description:Zw[Kre],unit:ex[Kre]}),this.memorySystemUsageGauge=this.meter.createObservableGauge(Jre,{description:Zw[Jre],unit:ex[Jre]}),this.memoryProcessUsageGauge=this.meter.createObservableGauge(Xre,{description:Zw[Xre],unit:ex[Xre]}),this.memoryHeapUsedGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.heapUsed,{platform:e,arch:r,node_version:n})}),this.memoryHeapTotalGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.heapTotal,{platform:e,arch:r,node_version:n})}),this.memoryRssGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.rss,{platform:e,arch:r,node_version:n})}),this.memoryExternalGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.external,{platform:e,arch:r,node_version:n})}),this.memorySystemUsageGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.systemUsage,{platform:e,arch:r,node_version:n})}),this.memoryProcessUsageGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.processUsage,{platform:e,arch:r,node_version:n,memory_limit_mb:Math.round(this.nodeJSMemoryLimit/(1024*1024)).toString()})}))}getNodeJSMemoryLimit(){let e=process.execArgv.find(o=>o.startsWith("--max-old-space-size="))?.split("=")[1];if(e){let o=parseInt(e,10);if(!isNaN(o)&&o>0)return o*1024*1024}let r=process.execArgv.find(o=>o.startsWith("--max_old_space_size="))?.split("=")[1];if(r){let o=parseInt(r,10);if(!isNaN(o)&&o>0)return o*1024*1024}let n=tx.arch();return n==="x64"||n==="arm64"?1400*1024*1024:700*1024*1024}}});function rsn(t,e={}){if(qje)return qje;let r={enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0,...e};return qje=new Gje(t,r),qje}var qje,nsn=G(()=>{"use strict";tsn();qje=null});import FKo from"os";function isn(){try{let t=FKo.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 osn=G(()=>{"use strict"});import*as Zre from"os";import*as Hje from"fs";function Ta(t){let e="0.5.1",r=process.env.IFLOW_ENV||"normal",n={darwin:"macOS",win32:"Windows",linux:"Linux",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX"},o=Zre.platform(),s=n[o]||o,a="unknown";try{if(o==="darwin")a=Zre.release();else if(o==="linux")try{if(Hje.existsSync("/etc/os-release")){let m=Hje.readFileSync("/etc/os-release","utf8").match(/^PRETTY_NAME="(.+)"/m);m&&(a=m[1])}}catch{a=Zre.release()}else o==="win32"&&(a=Zre.release())}catch{a="unknown"}let c={name:"Node.js",version:process.version,architecture:process.arch},u=t.getModel()||"unknown",d=t.getUsageMode(),f=!1,p=t.getContentGeneratorConfig?.();if(p){let h=p.authType,m=p.baseUrl||"";(h===er.LOGIN_WITH_IFLOW||h===er.IFLOW||h===er.OPENAI_COMPATIBLE&&m.includes("apis.iflow.cn"))&&(f=!0)}return{app_name:Nm,tenant__:"gen_ai",version:e,platform:s,os_model:a,runtime_name:c.name,runtime_version:c.version,runtime_architecture:c.architecture,model_name:u,is_iflow_open_user:String(f),ip:isn(),iflow_env:r,usage_mode:d}}var I7t=G(()=>{"use strict";Hv();osn();Qre()});function ssn(){return R7t||(R7t=Y0e.getMeter(Nm)),R7t}function asn(){if(Au)return;let t=ssn();if(t){try{rsn(t,{enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0})}catch{}k7t=t.createHistogram(Eon,{description:"Counts tool calls, tagged by function name and success.",unit:"count",valueType:Xs.INT}),O7t=t.createHistogram(von,{description:"Latency of tool calls in milliseconds.",unit:"ms",valueType:Xs.INT}),N7t=t.createHistogram(bon,{description:"Counts MCP tool calls, tagged by function name and success.",unit:"count",valueType:Xs.INT}),B7t=t.createHistogram(Con,{description:"Latency of MCP tool calls in milliseconds.",unit:"ms",valueType:Xs.INT}),P7t=t.createHistogram(Son,{description:"Counts built-in tool calls, tagged by function name and success.",unit:"count",valueType:Xs.INT}),M7t=t.createHistogram(won,{description:"Latency of built-in tool calls in milliseconds.",unit:"ms",valueType:Xs.INT}),y1e=t.createHistogram(xon,{description:"Counts API requests, tagged by model and status.",unit:"count",valueType:Xs.INT}),_1e=t.createHistogram(Ton,{description:"Latency of API requests in milliseconds.",unit:"ms",valueType:Xs.INT}),F7t=t.createHistogram(Don,{description:"Counts the total number of tokens used.",unit:"tokens",valueType:Xs.INT}),L7t=t.createHistogram(Ron,{description:"Counts file operations (create, read, update).",unit:"count",valueType:Xs.INT}),U7t=t.createHistogram(kon,{description:"Counts user requests from prompt to completion.",unit:"count",valueType:Xs.INT}),$7t=t.createHistogram(Oon,{description:"End-to-end latency of user requests in milliseconds.",unit:"ms",valueType:Xs.INT}),j7t=t.createHistogram(Non,{description:"User experience success rate - counts successful user experiences including retries and fixes.",unit:"count",valueType:Xs.INT}),Q7t=t.createHistogram(Bon,{description:"User identity for tracking unique installations.",unit:"count",valueType:Xs.INT}),G7t=t.createHistogram(Pon,{description:"Counts tool scheduler lock errors when new calls are blocked by running calls.",unit:"count",valueType:Xs.INT}),q7t=t.createHistogram(Mon,{description:"Counts MCP connection attempts and their success/failure status.",unit:"count",valueType:Xs.INT}),H7t=t.createHistogram(Fon,{description:"Counts loop detection events by loop type.",unit:"count",valueType:Xs.INT}),V7t=t.createHistogram(Lon,{description:"Counts paste operations, tagged by type and success.",unit:"count",valueType:Xs.INT}),W7t=t.createHistogram(Uon,{description:"Latency of paste operations in milliseconds.",unit:"ms",valueType:Xs.INT}),z7t=t.createHistogram($on,{description:"Counts xinliu web search operations, tagged by success and error type.",unit:"count",valueType:Xs.INT}),Y7t=t.createHistogram(jon,{description:"Latency of xinliu web search operations in milliseconds.",unit:"ms",valueType:Xs.INT}),K7t=t.createHistogram(Qon,{description:"Counts web fetch operations, tagged by success and error type.",unit:"count",valueType:Xs.INT}),J7t=t.createHistogram(Gon,{description:"Latency of web fetch operations in milliseconds.",unit:"ms",valueType:Xs.INT}),X7t=t.createHistogram(qon,{description:"Counts usage of different approval modes.",unit:"count",valueType:Xs.INT}),Z7t=t.createHistogram(Hon,{description:"Counts lightweight compression triggers, tagged by executed status and skip reason.",unit:"count",valueType:Xs.INT}),eRt=t.createHistogram(Von,{description:"Histogram of lightweight compression token reduction ratios (reduced_tokens / original_tokens).",unit:"ratio",valueType:Xs.DOUBLE}),tRt=t.createHistogram(Won,{description:"Counts full compression triggers, tagged by triggered_by and had_lightweight_before.",unit:"count",valueType:Xs.INT}),rRt=t.createHistogram(zon,{description:"Histogram of full compression token reduction ratios (reduced_tokens / original_tokens).",unit:"ratio",valueType:Xs.DOUBLE}),nRt=t.createHistogram(Yon,{description:"Counts API calls when token remaining < 20% without compression triggered.",unit:"count",valueType:Xs.INT}),iRt=t.createHistogram(Kon,{description:"Counts blacklist blocks in smart approval, tagged by function name and risk level.",unit:"count",valueType:Xs.INT}),oRt=t.createHistogram(Jon,{description:"Counts user actions after blacklist block, tagged by function name and action (execute/cancel).",unit:"count",valueType:Xs.INT}),sRt=t.createHistogram(Xon,{description:"Counts AI review operations in smart approval, tagged by function name and decision (safe/risky).",unit:"count",valueType:Xs.INT}),aRt=t.createHistogram(Zon,{description:"Counts user actions after AI judges risky, tagged by function name and action (execute/cancel).",unit:"count",valueType:Xs.INT}),Au=!0}}function Vje(t){let e=ssn();if(!e||!Au)return;e.createHistogram(Ion,{description:"Count of CLI sessions started.",unit:"count",valueType:Xs.INT}).record(1,Ta(t))}function csn(t,e,r,n,o,s){if(!k7t||!O7t||!Au)return;let a={...Ta(t),function_name:e??"unknown",success:String(n),decision:o??"unknown"};k7t.record(1,a),O7t.record(r,{...Ta(t),function_name:e??"unknown",tool_type:s??"unknown"})}function lsn(t,e,r,n,o,s){if(!N7t||!B7t||!Au)return;let a={...Ta(t),function_name:e??"unknown",success:String(n),decision:o??"unknown"};s&&(a.execution_context=s),N7t.record(1,a),B7t.record(r,{...Ta(t),function_name:e??"unknown",execution_context:s??"unknown"})}function usn(t,e,r,n,o,s){if(!P7t||!M7t||!Au)return;let a={...Ta(t),function_name:e??"unknown",success:String(n),decision:o??"unknown"};s&&(a.execution_context=s),P7t.record(1,a),M7t.record(r,{...Ta(t),function_name:e??"unknown",execution_context:s??"unknown"})}function ene(t,e,r,n){!F7t||!Au||F7t.record(r,{...Ta(t),model:e??"unknown",type:n??"unknown"})}function dsn(t,e,r,n,o,s,a,c){if(!y1e||!_1e||!Au)return;let u={...Ta(t),model:e??"unknown",status_code:String(n??(o?"error":"ok"))};a!==void 0&&(u.http_status_code=String(a)),c!==void 0&&(u.business_code=String(c)),s&&(u.finish_reason=s),y1e.record(1,u);let d={...Ta(t),model:e??"unknown",http_status_code:String(a??200),finish_reason:s??"unknown"};c!=null&&(d.business_code=String(c)),_1e.record(r,d)}function fsn(t,e,r,n,o,s,a){if(!y1e||!_1e||!Au)return;let c={...Ta(t),model:e??"unknown",status_code:String(n??"error"),error:o??"unknown"};s!==void 0&&(c.http_status_code=String(s)),a!==void 0&&(c.business_code=String(a)),y1e.record(1,c);let u={...Ta(t),model:e??"unknown",http_status_code:String(s??0),error:o??"unknown"};a!=null&&(u.business_code=String(a)),_1e.record(r,u)}function wR(t,e,r,n,o){if(!L7t||!Au)return;let s={...Ta(t),operation:e};r!==void 0&&(s.lines=String(r)),n!==void 0&&(s.mimetype=n),o!==void 0&&(s.extension=o),L7t.record(1,s)}function psn(t,e,r,n,o){if(!U7t||!$7t||!Au)return;let s={...Ta(t),prompt_id:e,success:String(n)};o&&(s.error=o),U7t.record(1,s),$7t.record(r,s)}function cRt(t,e,r=!1,n=!1,o){if(!j7t||!Au)return;let s={...Ta(t),success:String(e),had_retries:String(r),had_fixes:String(n)};o&&(s.final_error=o),j7t.record(1,s)}function hsn(t,e){if(!Q7t||!Au)return;let r={...Ta(t),user_id:e};Q7t.record(1,r)}function msn(t,e,r){if(!G7t||!Au)return;let n={...Ta(t),running_calls_count:String(e)};r.forEach((o,s)=>{n[`call_${s}_name`]=o.name,n[`call_${s}_status`]=o.status}),G7t.record(1,n)}function lRt(t,e,r,n,o){if(!q7t||!Au)return;let s={...Ta(t),server_name:e,success:String(r)};n&&(s.error_type=n),o&&(s.transport_type=o),q7t.record(1,s)}function gsn(t,e,r){if(!H7t||!Au)return;let n={...Ta(t),loop_type:e,prompt_id:r};H7t.record(1,n)}function Wje(t,e,r,n,o="text",s,a){if(!V7t||!W7t||!Au)return;let c={};try{c=Ta(t)}catch{c={app_name:Nm,tenant__:"gen_ai",version:"unknown",platform:a||"unknown",os_model:"unknown",runtime_name:"Node.js",runtime_version:process.version,runtime_architecture:process.arch,model_name:"unknown",is_iflow_open_user:"false",ip:"unknown",iflow_env:"test",usage_mode:"unknown"}}let u={...c,success:String(n),paste_type:o};s&&(u.error_type=s),a&&(u.platform_specific=a),V7t.record(1,u);let d={...c,paste_type:o,text_length_range:String(r),performance_ratio:LKo(e,r)};W7t.record(e,d)}function LKo(t,e){if(e===0)return"no-text";let r=t/e;return r<=.1?"excellent":r<=.5?"good":r<=1?"normal":r<=2?"slow":"very-slow"}function zje(t,e,r,n,o,s){if(!z7t||!Y7t||!Au)return;let a={...Ta(t),success:String(r)};n&&(a.error_type=n),o!==void 0&&(a.results_count=String(o)),s&&(a.query_length=String(s.length)),z7t.record(1,a),Y7t.record(e,{...Ta(t),error_type:n??"none"})}function bq(t,e,r,n,o,s){if(!K7t||!J7t||!Au)return;let a={...Ta(t),success:String(r)};n&&(a.error_type=n),o!==void 0&&(a.url_count=String(o)),s!==void 0&&(a.prompt_length=String(s)),K7t.record(1,a),J7t.record(e,{...Ta(t),error_type:n??"none"})}function Yje(t,e){if(!X7t||!Au)return;let r={...Ta(t),approval_mode:e};X7t.record(1,r)}function tne(t,e,r,n){if(!Z7t||!Au)return;let o={...Ta(t),executed:String(e),triggered_by:r};n&&(o.skipped_reason=n),Z7t.record(1,o)}function Kje(t,e,r,n){if(!eRt||!Au)return;let o=e-r,s=e>0?o/e:0,a={...Ta(t),original_tokens:String(e),compressed_tokens:String(r),reduced_tokens:String(o),removed_tool_calls:String(n)};eRt.record(s,a)}function rne(t,e,r,n){if(!tRt||!Au)return;let o={...Ta(t),executed:String(e),triggered_by:r,had_lightweight_before:String(n)};tRt.record(1,o)}function Jje(t,e,r,n,o){if(!rRt||!Au)return;let s=e-r,a=e>0?s/e:0,c={...Ta(t),original_tokens:String(e),compressed_tokens:String(r),reduced_tokens:String(s),had_lightweight_before:String(n),recovered_files_count:String(o)};rRt.record(a,c)}function Xje(t,e,r,n){if(!nRt||!Au)return;let o=(1-n)*100,s={...Ta(t),token_count:String(e),token_limit:String(r),token_ratio:n.toFixed(2),token_remaining_percent:o.toFixed(1)};nRt.record(1,s)}function Zje(t,e,r,n,o){if(!iRt||!Au)return;let s={...Ta(t),function_name:e,risk_level:r};if(n&&(s.rule_name=n),o&&typeof o=="object"){let a=o;if((a.command||a.cmd)&&(s.command=String(a.command||a.cmd).substring(0,200)),(a.file_path||a.absolute_path||a.path)&&(s.file_path=String(a.file_path||a.absolute_path||a.path).substring(0,200)),a.url||a.prompt){let c=String(a.url||a.prompt).substring(0,200);s.url_or_prompt=c}}iRt.record(1,s)}function eQe(t,e,r,n,o){if(!oRt||!Au)return;let s={...Ta(t),function_name:e,action:r,risk_level:n};if(o&&typeof o=="object"){let a=o;if((a.command||a.cmd)&&(s.command=String(a.command||a.cmd).substring(0,200)),(a.file_path||a.absolute_path||a.path)&&(s.file_path=String(a.file_path||a.absolute_path||a.path).substring(0,200)),a.url||a.prompt){let c=String(a.url||a.prompt).substring(0,200);s.url_or_prompt=c}}oRt.record(1,s)}function tQe(t,e,r,n,o,s){if(!sRt||!Au)return;let a={...Ta(t),function_name:e,decision:r,review_layer:o,latency_ms:String(n)};if(s&&typeof s=="object"){let c=s;if((c.command||c.cmd)&&(a.command=String(c.command||c.cmd).substring(0,200)),(c.file_path||c.absolute_path||c.path)&&(a.file_path=String(c.file_path||c.absolute_path||c.path).substring(0,200)),c.url||c.prompt){let u=String(c.url||c.prompt).substring(0,200);a.url_or_prompt=u}}sRt.record(1,a)}function rQe(t,e,r,n,o){if(!aRt||!Au)return;let s={...Ta(t),function_name:e,action:r,review_layer:n};if(o&&typeof o=="object"){let a=o;if((a.command||a.cmd)&&(s.command=String(a.command||a.cmd).substring(0,200)),(a.file_path||a.absolute_path||a.path)&&(s.file_path=String(a.file_path||a.absolute_path||a.path).substring(0,200)),a.url||a.prompt){let c=String(a.url||a.prompt).substring(0,200);s.url_or_prompt=c}}aRt.record(1,s)}var rx,R7t,k7t,O7t,N7t,B7t,P7t,M7t,y1e,_1e,F7t,L7t,U7t,$7t,j7t,Q7t,G7t,q7t,H7t,V7t,W7t,z7t,Y7t,K7t,J7t,X7t,Z7t,eRt,tRt,rRt,nRt,iRt,oRt,sRt,aRt,Au,S0=G(()=>{"use strict";Xt();Qre();nsn();I7t();(function(t){t.CREATE="create",t.READ="read",t.UPDATE="update"})(rx||(rx={}));Au=!1});var ao,un,co,lo,yu=G(()=>{"use strict";ao=class{name;displayName;description;icon;kind;parameterSchema;isOutputMarkdown;canUpdateOutput;aliases;constructor(e,r,n,o,s,a,c=!0,u=!1,d=[]){this.name=e,this.displayName=r,this.description=n,this.icon=o,this.kind=s,this.parameterSchema=a,this.isOutputMarkdown=c,this.canUpdateOutput=u,this.aliases=d}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"})(un||(un={}));(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"})(co||(co={}));(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"})(lo||(lo={}))});function UKo(t){switch(t){case un.ProceedOnce:case un.ProceedAlways:case un.ProceedAlwaysServer:case un.ProceedAlwaysTool:return E1e.ACCEPT;case un.ModifyWithEditor:return E1e.MODIFY;case un.Cancel:default:return E1e.REJECT}}var E1e,nne,ine,one,sne,ane,E1,cne,lne,PC,une,nQe,GP,iQe,Cq=G(()=>{"use strict";yu();Hv();(function(t){t.ACCEPT="accept",t.REJECT="reject",t.MODIFY="modify"})(E1e||(E1e={}));nne=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(),o=!1,s=!1;r&&r.authType&&(o=r.authType===er.IFLOW,s=r.authType===er.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=o||s,this.vertex_ai_enabled=s,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()}},ine=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()}},one=class{"event.name";"event.timestamp";prompt_length;prompt_id;auth_type;prompt;constructor(e,r,n,o){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=o}},sne=class{"event.name";"event.timestamp";function_name;function_args;duration_ms;success;decision;error;error_type;prompt_id;server_name;response_text;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?UKo(e.outcome):void 0,this.error=e.response.error?.message,this.error_type=e.response.errorType,this.prompt_id=e.request.prompt_id,this.response_text=JSON.stringify(e.response,null,2),"tool"in e&&e.tool&&"serverName"in e.tool&&(this.server_name=e.tool.serverName)}},ane=class{"event.name";"event.timestamp";model;prompt_id;request_text;base_url;openai_request;constructor(e,r,n,o,s){this["event.name"]="api_request",this["event.timestamp"]=new Date().toISOString(),this.model=r,this.prompt_id=o,this.request_text=s,this.base_url=e,this.openai_request=n}},E1=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,o,s,a,c,u,d){this["event.name"]="api_error",this["event.timestamp"]=new Date().toISOString(),this.model=e,this.error=r,this.error_type=a,this.status_code=c,this.http_status_code=u,this.business_code=d,this.duration_ms=n,this.prompt_id=o,this.auth_type=s}},cne=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,o,s,a,c,u,d,f){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=d||200,this.business_code=f,this.input_token_count=s?.promptTokenCount??0,this.output_token_count=s?.candidatesTokenCount??0,this.cached_content_token_count=s?.cachedContentTokenCount??0,this.thoughts_token_count=s?.thoughtsTokenCount??0,this.tool_token_count=s?.toolUsePromptTokenCount??0,this.total_token_count=s?.totalTokenCount??0,this.response_text=a,this.error=c,this.prompt_id=n,this.auth_type=o,this.finish_reason=u}},lne=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"})(PC||(PC={}));une=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}},nQe=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}},GP=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}},iQe=class{"event.name";"event.timestamp";model;constructor(e){this["event.name"]="malformed_json_response",this["event.timestamp"]=new Date().toISOString(),this.model=e}}});var yi,Asn=G(()=>{"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",t[t.IFLOW_CLI_RESPONSE_TYPE=46]="IFLOW_CLI_RESPONSE_TYPE",t[t.IFLOW_CLI_RESPONSE_LENGTH=47]="IFLOW_CLI_RESPONSE_LENGTH",t[t.IFLOW_CLI_RESPONSE_SUCCESS=48]="IFLOW_CLI_RESPONSE_SUCCESS",t[t.IFLOW_CLI_ERROR_MESSAGE=49]="IFLOW_CLI_ERROR_MESSAGE"})(yi||(yi={}))});function Sq(t,e){let r=new WeakSet;return JSON.stringify(t,(n,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[Circular]";r.add(o)}return o},e)}var oQe=G(()=>{"use strict";});import K8,{dirname as $Ko,join as uRt}from"node:path";import sQe from"os";import*as ysn from"crypto";import{fileURLToPath as jKo}from"node:url";import QKo from"node:fs";import{execSync as GKo}from"node:child_process";function J8(t){let e=sQe.homedir();return t.startsWith(e)?t.replace(e,"~"):t}function Da(t,e=35){if(t.length<=e)return t;let n=K8.parse(t).root,o=K8.sep,a=t.substring(n.length).split(o).filter(m=>m!=="");if(a.length<=1){let m=Math.floor((e-3)/2);if(m<=0)return t.substring(0,e-3)+"...";let g=t.substring(0,m),A=t.substring(t.length-m);return`${g}...${A}`}let c=a[0],u=a[a.length-1],d=n+c,f=[],p=o.length+u.length;for(let m=a.length-2;m>=0;m--){let g=a[m],A=p+o.length+g.length;if(A<=e)f.unshift(g),p=A;else break}let h=f.join(o)+o+u;return p>e?h:(h=d+o+h,h.length>e?"..."+h.substring(h.length-e-3):h)}function Vl(t,e){let r=K8.resolve(t),n=K8.resolve(e);return K8.relative(n,r)||"."}function dne(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 xR(t){return process.platform==="win32"?t.replace(/\\([ ,;!?()[\]{}])/g,"$1"):t.replace(/\\(.)/g,"$1")}function aQe(t){return ysn.createHash("sha256").update(t).digest("hex")}function eE(t){let e=aQe(t);return K8.join(sQe.homedir(),ih,qKo,e)}function cQe(){return K8.join(sQe.homedir(),ih,_sn)}function lQe(t){return K8.join(t,ih,_sn)}function uQe(){if(process.env.USE_BUILTIN_RIPGREP==="0")return"rg";let t=$Ko(jKo(import.meta.url)),e=[uRt(t,"..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`),uRt(t,"..","..","..","..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`),uRt(t,"..","..","..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`)];for(let r of e)try{if(QKo.existsSync(r))return process.platform==="darwin"&&Esn(r),r}catch{}return e[0]}function Esn(t){if(process.platform==="darwin")try{let e=["com.apple.quarantine","CachedFileMimeType","CachedFileType","FileXRayCachedResultInEA"];for(let r of e)try{GKo(`xattr -d "${r}" "${t}" 2>/dev/null`,{stdio:"ignore"})}catch{}}catch{}}function wq(t,e){let n=sQe.platform()==="win32"?K8.win32:K8,o=n.relative(t,e);return!o.startsWith(`..${n.sep}`)&&o!==".."&&!n.isAbsolute(o)}var ih,dRt,qKo,_sn,$u=G(()=>{"use strict";ih=".iflow",dRt="google_accounts.json",qKo="tmp",_sn="commands"});import HKo from"node:path";import{promises as bUc,existsSync as vsn,readFileSync as bsn}from"node:fs";import*as Csn from"os";function Ssn(){return HKo.join(Csn.homedir(),ih,dRt)}function wsn(){try{let t=Ssn();if(vsn(t)){let e=bsn(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 xsn(){try{let t=Ssn();if(!vsn(t))return 0;let e=bsn(t,"utf-8").trim();if(!e)return 0;let r=JSON.parse(e);if(!r||typeof r!="object")return 0;let n=r,o=n.old&&Array.isArray(n.old)?n.old.length:0;return n.active&&o++,o}catch(t){return console.debug("Error reading lifetime Google Accounts:",t),0}}var Tsn=G(()=>{"use strict";$u();});import*as Dsn from"os";import*as TR from"fs";import*as hRt from"path";import{randomUUID as VKo}from"crypto";function zKo(){TR.existsSync(fRt)||TR.mkdirSync(fRt,{recursive:!0})}function YKo(){return TR.existsSync(pRt)&&TR.readFileSync(pRt,"utf-8").trim()||null}function KKo(t){TR.writeFileSync(pRt,t,"utf-8")}function dQe(){try{zKo();let t=YKo();return t||(t=VKo(),KKo(t)),t}catch(t){return console.error("Error accessing installation ID file, generating ephemeral ID:",t),"123456789"}}var WKo,fRt,pRt,mRt=G(()=>{"use strict";$u();WKo=Dsn.homedir()??"",fRt=hRt.join(WKo,ih),pRt=hRt.join(fRt,"installation_id")});var Isn,JKo,XKo,ZKo,eJo,tJo,rJo,nJo,iJo,oJo,sJo,aJo,cJo,lJo,_g,v1e=G(()=>{"use strict";Isn=Se(Cvt(),1);Cq();Asn();oQe();Tsn();mRt();JKo="start_session",XKo="new_prompt",ZKo="tool_call",eJo="api_request",tJo="api_response",rJo="api_error",nJo="end_session",iJo="flash_fallback",oJo="loop_detected",sJo="next_speaker_check",aJo="slash_command",cJo="malformed_json_response",lJo="cli_response",_g=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:Sq(e)}])}createLogEvent(e,r){let n=wsn(),o=xsn();r.push({iflow_cli_key:yi.IFLOW_CLI_GOOGLE_ACCOUNTS_COUNT,value:o.toString()});let s={console_type:"IFLOW_CLI",application:102,event_name:e,event_metadata:[r]};return n?s.client_email=n:s.client_install_id=dQe(),s}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 s=1;n&&s<e.length;s++){let a=e.readUInt8(s);r|=BigInt(a&127)<<BigInt(7*(s-1)),n=(a&128)!==0}return n?void 0:{nextRequestWaitMs:Number(r)}}handleLogEvent(e,r,n=!1){this.enqueueLogEvent(this.createLogEvent(e,r)),n?this.flushToClearcut().catch(o=>{console.debug("Error flushing to Clearcut:",o)}):this.flushIfNeeded()}logStartSessionEvent(e){let r=process.env.SURFACE||"SURFACE_NOT_SET",n=[{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_MODEL,value:e.model},{iflow_cli_key:yi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_EMBEDDING_MODEL,value:e.embedding_model},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_SANDBOX,value:e.sandbox_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_CORE_TOOLS,value:e.core_tools_enabled},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_APPROVAL_MODE,value:e.approval_mode},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_API_KEY_ENABLED,value:e.api_key_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_DEBUG_MODE_ENABLED,value:e.debug_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_MCP_SERVERS,value:e.mcp_servers},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_TELEMETRY_ENABLED,value:e.telemetry_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED,value:e.telemetry_log_user_prompts_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_SURFACE,value:r}];this.handleLogEvent(JKo,n,!0)}logNewPromptEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_USER_PROMPT_LENGTH,value:JSON.stringify(e.prompt_length)},{iflow_cli_key:yi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.handleLogEvent(XKo,r)}logToolCallEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_TOOL_CALL_NAME,value:JSON.stringify(e.function_name)},{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_TOOL_CALL_DECISION,value:JSON.stringify(e.decision)},{iflow_cli_key:yi.IFLOW_CLI_TOOL_CALL_SUCCESS,value:JSON.stringify(e.success)},{iflow_cli_key:yi.IFLOW_CLI_TOOL_CALL_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:yi.IFLOW_CLI_TOOL_ERROR_MESSAGE,value:JSON.stringify(e.error)},{iflow_cli_key:yi.IFLOW_CLI_TOOL_CALL_ERROR_TYPE,value:JSON.stringify(e.error_type)}];this.handleLogEvent(ZKo,r)}logApiRequestEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_API_REQUEST_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)}];this.handleLogEvent(eJo,r)}logApiResponseEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_STATUS_CODE,value:JSON.stringify(e.status_code)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:yi.IFLOW_CLI_API_ERROR_MESSAGE,value:JSON.stringify(e.error)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_INPUT_TOKEN_COUNT,value:JSON.stringify(e.input_token_count)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT,value:JSON.stringify(e.output_token_count)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_CACHED_TOKEN_COUNT,value:JSON.stringify(e.cached_content_token_count)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_THINKING_TOKEN_COUNT,value:JSON.stringify(e.thoughts_token_count)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_TOOL_TOKEN_COUNT,value:JSON.stringify(e.tool_token_count)},{iflow_cli_key:yi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.handleLogEvent(tJo,r)}logApiErrorEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_API_ERROR_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_API_ERROR_TYPE,value:JSON.stringify(e.error_type)},{iflow_cli_key:yi.IFLOW_CLI_API_ERROR_STATUS_CODE,value:JSON.stringify(e.status_code)},{iflow_cli_key:yi.IFLOW_CLI_API_ERROR_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:yi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.handleLogEvent(rJo,r)}logFlashFallbackEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)},{iflow_cli_key:yi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.handleLogEvent(iJo,r,!0)}logLoopDetectedEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_LOOP_DETECTED_TYPE,value:JSON.stringify(e.loop_type)}];this.handleLogEvent(oJo,r)}logNextSpeakerCheck(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_RESPONSE_FINISH_REASON,value:JSON.stringify(e.finish_reason)},{iflow_cli_key:yi.IFLOW_CLI_NEXT_SPEAKER_CHECK_RESULT,value:JSON.stringify(e.result)},{iflow_cli_key:yi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.handleLogEvent(sJo,r)}logSlashCommandEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_SLASH_COMMAND_NAME,value:JSON.stringify(e.command)}];e.subcommand&&r.push({iflow_cli_key:yi.IFLOW_CLI_SLASH_COMMAND_SUBCOMMAND,value:JSON.stringify(e.subcommand)}),this.handleLogEvent(aJo,r)}logMalformedJsonResponseEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_MALFORMED_JSON_RESPONSE_MODEL,value:JSON.stringify(e.model)}];this.handleLogEvent(cJo,r)}logCliResponseEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_RESPONSE_TYPE,value:JSON.stringify(e.response_type)},{iflow_cli_key:yi.IFLOW_CLI_RESPONSE_LENGTH,value:JSON.stringify(e.response_length)},{iflow_cli_key:yi.IFLOW_CLI_RESPONSE_SUCCESS,value:JSON.stringify(e.success)},{iflow_cli_key:yi.IFLOW_CLI_ERROR_MESSAGE,value:JSON.stringify(e.error)}];this.handleLogEvent(lJo,r)}logEndSessionEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_SESSION_ID,value:e?.session_id?.toString()??""}];this.handleLogEvent(nJo,r,!0)}getProxyAgent(){let e=this.config?.getProxy();if(e){if(e.startsWith("http"))return new Isn.HttpsProxyAgent(e);throw new Error("Unsupported proxy type")}}shutdown(){let e=new ine(this.config);this.logEndSessionEvent(e)}}});import*as Rsn from"node:fs";var xq,ksn,b1e,fQe,pQe,hQe,Osn=G(()=>{"use strict";xq=Se(Ii(),1),ksn=Se(a8(),1);b1e=class{writeStream;constructor(e){this.writeStream=Rsn.createWriteStream(e,{flags:"a"})}serialize(e){let r=new WeakSet;return JSON.stringify(e,(o,s)=>{if(typeof s=="object"&&s!==null){if(r.has(s))return"[Circular]";r.add(s)}return s},2)+`
495
495
  `}shutdown(){return new Promise(e=>{this.writeStream.end(e)})}},fQe=class extends b1e{export(e,r){let n=e.map(o=>this.serialize(o)).join("");this.writeStream.write(n,o=>{r({code:o?xq.ExportResultCode.FAILED:xq.ExportResultCode.SUCCESS,error:o||void 0})})}},pQe=class extends b1e{export(e,r){let n=e.map(o=>this.serialize(o)).join("");this.writeStream.write(n,o=>{r({code:o?xq.ExportResultCode.FAILED:xq.ExportResultCode.SUCCESS,error:o||void 0})})}},hQe=class extends b1e{export(e,r){let n=this.serialize(e);this.writeStream.write(n,o=>{r({code:o?xq.ExportResultCode.FAILED:xq.ExportResultCode.SUCCESS,error:o||void 0})})}getPreferredAggregationTemporality(){return ksn.AggregationTemporality.CUMULATIVE}async forceFlush(){return Promise.resolve()}}});var Usn={};Eo(Usn,{flushTelemetry:()=>gRt,initializeTelemetry:()=>C1e,isTelemetrySdkInitialized:()=>GA,shutdownTelemetry:()=>Tq});function GA(){return fne}function uJo(t){if(!t)return;let e=t.replace(/^["']|["']$/g,"");try{let r=new URL(e),o=r.port==="4318"||r.protocol==="http:"||r.protocol==="https:"?"http":"grpc";return{url:o==="grpc"?r.origin:e,protocol:o}}catch(r){Jp.error("Invalid OTLP endpoint URL provided:",e,r);return}}function C1e(t){if(fne)return;let e=(0,gQe.defaultResource)().merge((0,gQe.resourceFromAttributes)({[jCt]:Nm,[QCt]:process.version,"session.id":t.getSessionId()})),r=t.getTelemetryOtlpEndpoint(),n=uJo(r),o=!!n,s=t.getTelemetryOutfile(),a=[];o&&a.push(new Nsn.OTLPTraceExporter({url:`${n.url}/v1/traces`})),s&&a.push(new fQe(s));let c=[];o&&n&&c.push(new Psn.OTLPLogExporter({url:`${n.url}/v1/logs`})),s&&c.push(new pQe(s));let u=[];o&&u.push(new NUe({exporter:new Bsn.OTLPMetricExporter({url:`${n.url}/v1/metrics`,temporalityPreference:AQe.AggregationTemporality.DELTA}),exportIntervalMillis:2e4})),s&&u.push(new AQe.PeriodicExportingMetricReader({exporter:new hQe(s),exportIntervalMillis:1e4}));let d={resource:e,serviceName:Nm,logRecordProcessors:[],spanProcessors:[],metricReaders:[]};a.forEach(f=>{d.spanProcessors.push(new Fsn.BatchSpanProcessor(f,{exportTimeoutMillis:1e4}))}),c.forEach(f=>{d.logRecordProcessors.push(new Lsn.BatchLogRecordProcessor(f,{exportTimeoutMillis:1e4}))}),u.forEach(f=>{d.metricReaders.push(f)}),mQe=new Msn.NodeSDK({...d});try{mQe.start(),fne=!0,asn()}catch(f){console.error("Error starting OpenTelemetry SDK:",f)}process.on("SIGTERM",Tq),process.on("SIGINT",Tq)}async function gRt(){if(fne)try{let{trace:t}=await Promise.resolve().then(()=>(Xt(),ar)),e=t.getTracerProvider();"forceFlush"in e&&await e.forceFlush();let{metrics:r}=await Promise.resolve().then(()=>(Xt(),ar)),n=r.getMeterProvider();"forceFlush"in n&&await n.forceFlush()}catch(t){process.env.DEBUG&&console.error("Error flushing telemetry:",t)}}async function Tq(){if(!(!fne||!mQe))try{_g.getInstance()?.shutdown(),await mQe.shutdown()}catch(t){console.error("Error shutting down SDK:",t)}finally{fne=!1}}var Nsn,Bsn,Psn,Msn,gQe,Fsn,Lsn,AQe,mQe,fne,S1e=G(()=>{"use strict";Xt();Nsn=Se(JSt(),1),Bsn=Se(nwt(),1),Psn=Se(owt(),1),Msn=Se(Ttn(),1);Itn();Bh();gQe=Se(onn(),1),Fsn=Se(cMe(),1),Lsn=Se(fon(),1),AQe=Se(a8(),1);Qre();S0();v1e();Osn();process.env.DEBUG?Jp.setLogger(new G0e,Tm.DEBUG):Jp.setLogger(new G0e,Tm.NONE);fne=!1});var $sn={};Eo($sn,{TraceContext:()=>nx});var nx,yQe=G(()=>{"use strict";Xt();S1e();nx=class{static rootSpan=null;static tracer=Zs.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?MA.with(Zs.setSpan(MA.active(),n),async()=>{try{return await e()}catch(o){throw n.recordException(o),n.setStatus({code:fC.ERROR,message:o.message}),o}}):e()}static startChildSpan(e){return this.tracer.startSpan(e,void 0,MA.active())}static async withChildSpan(e,r,n){let o=this.startChildSpan(e);return n&&o.setAttributes(n),MA.with(Zs.setSpan(MA.active(),o),async()=>{try{let s=await r();return o.setStatus({code:fC.OK}),s}catch(s){throw o.recordException(s),o.setStatus({code:fC.ERROR,message:s.message}),s}finally{o.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 gRt()}catch{}}})(),await this.spanLock,this.spanLock=null}static getActiveSpan(){return Zs.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 w1e(){let t=Zs.getActiveSpan();if(t){let r=t.spanContext();if(r&&r.traceId&&r.spanId){let o=r.traceId,s=r.spanId,a=(r.traceFlags||0).toString(16).padStart(2,"0");return`00-${o}-${s}-${a}`}}return qP.getCurrentSession()?.traceparent}function x1e(t){let e=w1e();return e?{...t,traceparent:e}:t}function ARt(){return w1e()}async function ry(t,e,r){let n=Zs.getTracer("iflow-cli"),{TraceContext:o}=await Promise.resolve().then(()=>(yQe(),$sn)),s=o.getRootSpan(),a;if(s){let c=Zs.setSpan(MA.active(),s);a=MA.with(c,()=>n.startSpan(t,{attributes:e}))}else a=n.startSpan(t,{attributes:e});try{return await MA.with(Zs.setSpan(MA.active(),a),r)}catch(c){throw a.recordException(c),a.setStatus({code:fC.ERROR,message:c instanceof Error?c.message:"Unknown error"}),c}finally{a.end()}}var MC=G(()=>{"use strict";Xt();_Qe();});import{release as dJo,version as fJo}from"os";var EQe,qP,_Qe=G(()=>{"use strict";iCt();oCt();MC();EQe=class{currentSession=null;async startSession(e,r,n,o){let{model:s,tool:a}=o||{},c="iflow",u="cli",d=w1e()||"",f="";d&&(f=d.split("-")[1]??"");let p=Ree(),h=f?`${c}.${u}.${n}.${f}`:"",m=Date.now();return this.currentSession={traceId:f,parent_observation_id:p,conversationId:n,sessionId:e,userId:r,pid:c,sceneId:u,sam:h,traceparent:d,startTime:m,model:s,tool:a},await L0e("/aitrack.lifecycle.run_started",{gmkey:"AI",gokey:{pid:c,sam:h,trace_id:f,session_id:e,conversation_id:n,observation_id:p,model:s,tool:a,user_id:r}}),this.currentSession}async endSession(){if(!this.currentSession)return;let{pid:e,sam:r,traceId:n,parent_observation_id:o,model:s,tool:a,sessionId:c,conversationId:u,userId:d,startTime:f}=this.currentSession,p=Date.now()-f,h=Ree();await L0e("/aitrack.lifecycle.run_finished",{gmkey:"AI",gokey:{pid:e,sam:r,trace_id:n,session_id:c,conversation_id:u,observation_id:h,parent_observation_id:o,duration:p,model:s,tool:a,sessionId:c,user_id:d}})}async recordError(e,r){if(!this.currentSession)throw new Error("No active session to record error");let{pid:n,sam:o,traceId:s,parent_observation_id:a,model:c,tool:u,sessionId:d,conversationId:f,userId:p}=this.currentSession,h=Ree(),m="",g="";e instanceof Error?(m=e.cause?`${e.message}:${e.cause.message}`:e.message,g=e.cause?e.cause.stack||"":e.stack||""):m=String(e);let A={gmkey:"AI",gokey:{pid:n,sam:o,trace_id:s,observation_id:h,parent_observation_id:a,session_id:d,conversation_id:f,user_id:p,error_msg:`${m}
496
- ${g.slice(0,2e4)}`,model:c,tool:u,toolName:r?.toolName,toolArgs:r?.toolArgs?JSON.stringify(r.toolArgs):void 0,cliVer:"0.5.1-beta-20260113143539",platform:process.platform,arch:process.arch,nodeVersion:process.version,osVersion:process.platform==="darwin"?dJo():fJo()}};await L0e("/aitrack.lifecycle.run_error",A)}getCurrentSession(){return this.currentSession}},qP=new EQe});var jsn=T((XUc,pJo)=>{pJo.exports={name:"systeminformation",version:"5.30.3",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 Bm=T(uo=>{"use strict";var VP=me("os"),X8=me("fs"),hJo=me("path"),SRt=me("child_process").spawn,mJo=me("child_process").exec,D1e=me("child_process").execSync,gJo=me("util"),Dq=process.platform,wRt=Dq==="linux"||Dq==="android",Hsn=Dq==="darwin",SQe=Dq==="win32",Vsn=Dq==="freebsd",Wsn=Dq==="openbsd",zsn=Dq==="netbsd",yRt=0,ix="",HP=null,ox=null,Ysn=process.env.WINDIR||"C:\\Windows",Eg,pne="",T1e=[],xRt=!1,bQe="",Qsn="$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 ; ",ERt="--###START###--",Gsn="--ERROR--",CQe="--###ENDCMD###--",vRt="--##ID##--",wQe={windowsHide:!0,maxBuffer:1024*102400,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})},xQe={maxBuffer:1024*102400,encoding:"UTF-8",stdio:["pipe","pipe","ignore"]};function AJo(t){let e=parseInt(t,10);return isNaN(e)&&(e=0),e}function yJo(t){let e=!1,r="",n="";for(let o of t)o>="0"&&o<="9"||e?(e=!0,r+=o):n+=o;return[n,r]}var vQe=new String,bRt=new String().replace,CRt=new String().toLowerCase,Ksn=new String().toString,Jsn=new String().substr,Xsn=new String().substring,Zsn=new String().trim,ean=new String().startsWith,tan=Math.min;function _Jo(t){return t&&{}.toString.call(t)==="[object Function]"}function EJo(t){let e=[],r={};for(let n=0;n<t.length;n++){let o=Object.keys(t[n]);o.sort((a,c)=>a-c);let s="";for(let a=0;a<o.length;a++)s+=JSON.stringify(o[a]),s+=JSON.stringify(t[n][o[a]]);({}).hasOwnProperty.call(r,s)||(e.push(t[n]),r[s]=!0)}return e}function vJo(t,e){return t.sort((r,n)=>{let o="",s="";return e.forEach(a=>{o=o+r[a],s=s+n[a]}),o<s?-1:o>s?1:0})}function bJo(){return yRt===0&&(yRt=VP.cpus().length),yRt}function WP(t,e,r,n,o){r=r||":",e=e.toLowerCase(),n=n||!1,o=o||!1;let s="";return t.some(a=>{let c=a.toLowerCase().replace(/\t/g,"");if(n&&(c=c.trim()),c.startsWith(e)&&(!o||c.match(e+r)||c.match(e+" "+r))){let u=n?a.trim().split(r):a.split(r);if(u.length>=2)return u.shift(),s=u.join(r).trim(),!0}return!1}),s}function CJo(t,e){return e=e||16,t.replace(/\\x([0-9A-Fa-f]{2})/g,function(){return String.fromCharCode(parseInt(arguments[1],e))})}function SJo(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 wJo(t,e){e=e||"",t=t.toUpperCase();let r=0,n=0,o=SJo(t),s=t.split(o);if(s.length>=2){s[2]&&(s[1]+=s[2]);let a=s[1]&&s[1].toLowerCase().indexOf("pm")>-1||s[1].toLowerCase().indexOf("p.m.")>-1||s[1].toLowerCase().indexOf("p. m.")>-1||s[1].toLowerCase().indexOf("n")>-1||s[1].toLowerCase().indexOf("ch")>-1||s[1].toLowerCase().indexOf("\xF6s")>-1||e&&s[1].toLowerCase().indexOf(e)>-1;return r=parseInt(s[0],10),n=parseInt(s[1],10),r=a&&r<12?r+12:r,("0"+r).substr(-2)+":"+("0"+n).substr(-2)}}function xJo(t,e){let r={date:"",time:""};e=e||{};let n=(e.dateFormat||"").toLowerCase(),o=e.pmDesignator||"",s=t.split(" ");if(s[0]){if(s[0].indexOf("/")>=0){let a=s[0].split("/");a.length===3&&(a[0].length===4?r.date=a[0]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[2]).substr(-2):a[2].length===2?(n.indexOf("/d/")>-1||n.indexOf("/dd/")>-1,r.date="20"+a[2]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[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=a[2]+"-"+("0"+a[0]).substr(-2)+"-"+("0"+a[1]).substr(-2):r.date=a[2]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[0]).substr(-2))}if(s[0].indexOf(".")>=0){let a=s[0].split(".");a.length===3&&(n.indexOf(".d.")>-1||n.indexOf(".dd.")>-1?r.date=a[2]+"-"+("0"+a[0]).substr(-2)+"-"+("0"+a[1]).substr(-2):r.date=a[2]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[0]).substr(-2))}if(s[0].indexOf("-")>=0){let a=s[0].split("-");a.length===3&&(r.date=a[0]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[2]).substr(-2))}}if(s[1]){s.shift();let a=s.join(" ");r.time=wJo(a,o)}return r}function TJo(t,e){let r=e>0,n=1,o=0,s=0,a=[];for(let u=0;u<t.length;u++)n<=e?(/\s/.test(t[u])&&!r&&(s=u-1,a.push({from:o,to:s+1,cap:t.substring(o,s+1)}),o=s+2,n++),r=t[u]===" "):(!/\s/.test(t[u])&&r&&(s=u-1,o<s&&a.push({from:o,to:s,cap:t.substring(o,s)}),o=s+1,n++),r=t[u]===" ");s=5e3,a.push({from:o,to:s,cap:t.substring(o,s)});let c=a.length;for(let u=0;u<c;u++)a[u].cap.replace(/\s/g,"").length===0&&u+1<c&&(a[u].to=a[u+1].to,a[u].cap=a[u].cap+a[u+1].cap,a.splice(u+1,1),c=c-1);return a}function DJo(t,e,r){for(let n=0;n<t.length;n++)if(t[n][e]===r)return n;return-1}function IJo(){if(bQe="powershell.exe",SQe){let t=`${Ysn}\\system32\\WindowsPowerShell\\v1.0\\powershell.exe`;X8.existsSync(t)&&(bQe=t)}}function RJo(){return SQe?`"${process.env.VBOX_INSTALL_PATH||process.env.VBOX_MSI_INSTALL_PATH}\\VBoxManage.exe"`:"vboxmanage"}function _Rt(t){let e="",r,n="";if(t.indexOf(ERt)>=0){r=t.split(ERt);let s=r[1].split(vRt);e=s[0],s.length>1&&(t=s.slice(1).join(vRt))}t.indexOf(CQe)>=0&&(r=t.split(CQe),n=r[0]);let o=-1;for(let s=0;s<T1e.length;s++)T1e[s].id===e&&(o=s,T1e[s].callback(n));o>=0&&T1e.splice(o,1)}function kJo(){Eg||(Eg=SRt(bQe,["-NoProfile","-NoLogo","-InputFormat","Text","-NoExit","-Command","-"],{stdio:"pipe",windowsHide:!0,maxBuffer:1024*102400,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})}),Eg&&Eg.pid&&(xRt=!0,Eg.stdout.on("data",t=>{pne=pne+t.toString("utf8"),t.indexOf(CQe)>=0&&(_Rt(pne),pne="")}),Eg.stderr.on("data",()=>{_Rt(pne+Gsn)}),Eg.on("error",()=>{_Rt(pne+Gsn)}),Eg.on("close",()=>{Eg&&Eg.kill()})))}function OJo(){try{Eg&&(Eg.stdin.write("exit"+VP.EOL),Eg.stdin.end())}catch{Eg&&Eg.kill()}xRt=!1,Eg=null}function NJo(t){if(xRt){let e=Math.random().toString(36).substring(2,12);return new Promise(r=>{process.nextTick(()=>{function n(o){r(o)}T1e.push({id:e,cmd:t,callback:n,start:new Date});try{Eg&&Eg.pid&&Eg.stdin.write(Qsn+"echo "+ERt+e+vRt+"; "+VP.EOL+t+VP.EOL+"echo "+CQe+VP.EOL)}catch{r("")}})})}else{let e="";return new Promise(r=>{process.nextTick(()=>{try{let n=VP.release().split(".").map(Number),o=n[0]<10?["-NoProfile","-NoLogo","-InputFormat","Text","-NoExit","-ExecutionPolicy","Unrestricted","-Command","-"]:["-NoProfile","-NoLogo","-InputFormat","Text","-ExecutionPolicy","Unrestricted","-Command",t],s=SRt(bQe,o,{stdio:"pipe",windowsHide:!0,maxBuffer:1024*102400,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})});if(s&&!s.pid&&s.on("error",()=>{r(e)}),s&&s.pid){if(s.stdout.on("data",a=>{e=e+a.toString("utf8")}),s.stderr.on("data",()=>{s.kill(),r(e)}),s.on("close",()=>{s.kill(),r(e)}),s.on("error",()=>{s.kill(),r(e)}),n[0]<10)try{s.stdin.write(Qsn+t+VP.EOL),s.stdin.write("exit"+VP.EOL),s.stdin.end()}catch{s.kill(),r(e)}}else r(e)}catch{r(e)}})})}}function BJo(t,e,r){let n="";return r=r||{},new Promise(o=>{process.nextTick(()=>{try{let s=SRt(t,e,r);s&&!s.pid&&s.on("error",()=>{o(n)}),s&&s.pid?(s.stdout.on("data",a=>{n+=a.toString()}),s.on("close",()=>{s.kill(),o(n)}),s.on("error",()=>{s.kill(),o(n)})):o(n)}catch{o(n)}})})}function PJo(){if(SQe){if(!ix)try{let r=D1e("chcp",wQe).toString().split(`\r
496
+ ${g.slice(0,2e4)}`,model:c,tool:u,toolName:r?.toolName,toolArgs:r?.toolArgs?JSON.stringify(r.toolArgs):void 0,cliVer:"0.5.1",platform:process.platform,arch:process.arch,nodeVersion:process.version,osVersion:process.platform==="darwin"?dJo():fJo()}};await L0e("/aitrack.lifecycle.run_error",A)}getCurrentSession(){return this.currentSession}},qP=new EQe});var jsn=T((XUc,pJo)=>{pJo.exports={name:"systeminformation",version:"5.30.3",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 Bm=T(uo=>{"use strict";var VP=me("os"),X8=me("fs"),hJo=me("path"),SRt=me("child_process").spawn,mJo=me("child_process").exec,D1e=me("child_process").execSync,gJo=me("util"),Dq=process.platform,wRt=Dq==="linux"||Dq==="android",Hsn=Dq==="darwin",SQe=Dq==="win32",Vsn=Dq==="freebsd",Wsn=Dq==="openbsd",zsn=Dq==="netbsd",yRt=0,ix="",HP=null,ox=null,Ysn=process.env.WINDIR||"C:\\Windows",Eg,pne="",T1e=[],xRt=!1,bQe="",Qsn="$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 ; ",ERt="--###START###--",Gsn="--ERROR--",CQe="--###ENDCMD###--",vRt="--##ID##--",wQe={windowsHide:!0,maxBuffer:1024*102400,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})},xQe={maxBuffer:1024*102400,encoding:"UTF-8",stdio:["pipe","pipe","ignore"]};function AJo(t){let e=parseInt(t,10);return isNaN(e)&&(e=0),e}function yJo(t){let e=!1,r="",n="";for(let o of t)o>="0"&&o<="9"||e?(e=!0,r+=o):n+=o;return[n,r]}var vQe=new String,bRt=new String().replace,CRt=new String().toLowerCase,Ksn=new String().toString,Jsn=new String().substr,Xsn=new String().substring,Zsn=new String().trim,ean=new String().startsWith,tan=Math.min;function _Jo(t){return t&&{}.toString.call(t)==="[object Function]"}function EJo(t){let e=[],r={};for(let n=0;n<t.length;n++){let o=Object.keys(t[n]);o.sort((a,c)=>a-c);let s="";for(let a=0;a<o.length;a++)s+=JSON.stringify(o[a]),s+=JSON.stringify(t[n][o[a]]);({}).hasOwnProperty.call(r,s)||(e.push(t[n]),r[s]=!0)}return e}function vJo(t,e){return t.sort((r,n)=>{let o="",s="";return e.forEach(a=>{o=o+r[a],s=s+n[a]}),o<s?-1:o>s?1:0})}function bJo(){return yRt===0&&(yRt=VP.cpus().length),yRt}function WP(t,e,r,n,o){r=r||":",e=e.toLowerCase(),n=n||!1,o=o||!1;let s="";return t.some(a=>{let c=a.toLowerCase().replace(/\t/g,"");if(n&&(c=c.trim()),c.startsWith(e)&&(!o||c.match(e+r)||c.match(e+" "+r))){let u=n?a.trim().split(r):a.split(r);if(u.length>=2)return u.shift(),s=u.join(r).trim(),!0}return!1}),s}function CJo(t,e){return e=e||16,t.replace(/\\x([0-9A-Fa-f]{2})/g,function(){return String.fromCharCode(parseInt(arguments[1],e))})}function SJo(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 wJo(t,e){e=e||"",t=t.toUpperCase();let r=0,n=0,o=SJo(t),s=t.split(o);if(s.length>=2){s[2]&&(s[1]+=s[2]);let a=s[1]&&s[1].toLowerCase().indexOf("pm")>-1||s[1].toLowerCase().indexOf("p.m.")>-1||s[1].toLowerCase().indexOf("p. m.")>-1||s[1].toLowerCase().indexOf("n")>-1||s[1].toLowerCase().indexOf("ch")>-1||s[1].toLowerCase().indexOf("\xF6s")>-1||e&&s[1].toLowerCase().indexOf(e)>-1;return r=parseInt(s[0],10),n=parseInt(s[1],10),r=a&&r<12?r+12:r,("0"+r).substr(-2)+":"+("0"+n).substr(-2)}}function xJo(t,e){let r={date:"",time:""};e=e||{};let n=(e.dateFormat||"").toLowerCase(),o=e.pmDesignator||"",s=t.split(" ");if(s[0]){if(s[0].indexOf("/")>=0){let a=s[0].split("/");a.length===3&&(a[0].length===4?r.date=a[0]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[2]).substr(-2):a[2].length===2?(n.indexOf("/d/")>-1||n.indexOf("/dd/")>-1,r.date="20"+a[2]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[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=a[2]+"-"+("0"+a[0]).substr(-2)+"-"+("0"+a[1]).substr(-2):r.date=a[2]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[0]).substr(-2))}if(s[0].indexOf(".")>=0){let a=s[0].split(".");a.length===3&&(n.indexOf(".d.")>-1||n.indexOf(".dd.")>-1?r.date=a[2]+"-"+("0"+a[0]).substr(-2)+"-"+("0"+a[1]).substr(-2):r.date=a[2]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[0]).substr(-2))}if(s[0].indexOf("-")>=0){let a=s[0].split("-");a.length===3&&(r.date=a[0]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[2]).substr(-2))}}if(s[1]){s.shift();let a=s.join(" ");r.time=wJo(a,o)}return r}function TJo(t,e){let r=e>0,n=1,o=0,s=0,a=[];for(let u=0;u<t.length;u++)n<=e?(/\s/.test(t[u])&&!r&&(s=u-1,a.push({from:o,to:s+1,cap:t.substring(o,s+1)}),o=s+2,n++),r=t[u]===" "):(!/\s/.test(t[u])&&r&&(s=u-1,o<s&&a.push({from:o,to:s,cap:t.substring(o,s)}),o=s+1,n++),r=t[u]===" ");s=5e3,a.push({from:o,to:s,cap:t.substring(o,s)});let c=a.length;for(let u=0;u<c;u++)a[u].cap.replace(/\s/g,"").length===0&&u+1<c&&(a[u].to=a[u+1].to,a[u].cap=a[u].cap+a[u+1].cap,a.splice(u+1,1),c=c-1);return a}function DJo(t,e,r){for(let n=0;n<t.length;n++)if(t[n][e]===r)return n;return-1}function IJo(){if(bQe="powershell.exe",SQe){let t=`${Ysn}\\system32\\WindowsPowerShell\\v1.0\\powershell.exe`;X8.existsSync(t)&&(bQe=t)}}function RJo(){return SQe?`"${process.env.VBOX_INSTALL_PATH||process.env.VBOX_MSI_INSTALL_PATH}\\VBoxManage.exe"`:"vboxmanage"}function _Rt(t){let e="",r,n="";if(t.indexOf(ERt)>=0){r=t.split(ERt);let s=r[1].split(vRt);e=s[0],s.length>1&&(t=s.slice(1).join(vRt))}t.indexOf(CQe)>=0&&(r=t.split(CQe),n=r[0]);let o=-1;for(let s=0;s<T1e.length;s++)T1e[s].id===e&&(o=s,T1e[s].callback(n));o>=0&&T1e.splice(o,1)}function kJo(){Eg||(Eg=SRt(bQe,["-NoProfile","-NoLogo","-InputFormat","Text","-NoExit","-Command","-"],{stdio:"pipe",windowsHide:!0,maxBuffer:1024*102400,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})}),Eg&&Eg.pid&&(xRt=!0,Eg.stdout.on("data",t=>{pne=pne+t.toString("utf8"),t.indexOf(CQe)>=0&&(_Rt(pne),pne="")}),Eg.stderr.on("data",()=>{_Rt(pne+Gsn)}),Eg.on("error",()=>{_Rt(pne+Gsn)}),Eg.on("close",()=>{Eg&&Eg.kill()})))}function OJo(){try{Eg&&(Eg.stdin.write("exit"+VP.EOL),Eg.stdin.end())}catch{Eg&&Eg.kill()}xRt=!1,Eg=null}function NJo(t){if(xRt){let e=Math.random().toString(36).substring(2,12);return new Promise(r=>{process.nextTick(()=>{function n(o){r(o)}T1e.push({id:e,cmd:t,callback:n,start:new Date});try{Eg&&Eg.pid&&Eg.stdin.write(Qsn+"echo "+ERt+e+vRt+"; "+VP.EOL+t+VP.EOL+"echo "+CQe+VP.EOL)}catch{r("")}})})}else{let e="";return new Promise(r=>{process.nextTick(()=>{try{let n=VP.release().split(".").map(Number),o=n[0]<10?["-NoProfile","-NoLogo","-InputFormat","Text","-NoExit","-ExecutionPolicy","Unrestricted","-Command","-"]:["-NoProfile","-NoLogo","-InputFormat","Text","-ExecutionPolicy","Unrestricted","-Command",t],s=SRt(bQe,o,{stdio:"pipe",windowsHide:!0,maxBuffer:1024*102400,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})});if(s&&!s.pid&&s.on("error",()=>{r(e)}),s&&s.pid){if(s.stdout.on("data",a=>{e=e+a.toString("utf8")}),s.stderr.on("data",()=>{s.kill(),r(e)}),s.on("close",()=>{s.kill(),r(e)}),s.on("error",()=>{s.kill(),r(e)}),n[0]<10)try{s.stdin.write(Qsn+t+VP.EOL),s.stdin.write("exit"+VP.EOL),s.stdin.end()}catch{s.kill(),r(e)}}else r(e)}catch{r(e)}})})}}function BJo(t,e,r){let n="";return r=r||{},new Promise(o=>{process.nextTick(()=>{try{let s=SRt(t,e,r);s&&!s.pid&&s.on("error",()=>{o(n)}),s&&s.pid?(s.stdout.on("data",a=>{n+=a.toString()}),s.on("close",()=>{s.kill(),o(n)}),s.on("error",()=>{s.kill(),o(n)})):o(n)}catch{o(n)}})})}function PJo(){if(SQe){if(!ix)try{let r=D1e("chcp",wQe).toString().split(`\r
497
497
  `)[0].split(":");ix=r.length>1?r[1].replace(".","").trim():""}catch{ix="437"}return ix}if(wRt||Hsn||Vsn||Wsn||zsn){if(!ix)try{let r=D1e("echo $LANG",xQe).toString().split(`\r
498
498
  `)[0].split(".");ix=r.length>1?r[1].trim():"",ix||(ix="UTF-8")}catch{ix="UTF-8"}return ix}}function MJo(){if(HP!==null)return HP;if(HP=!1,SQe)try{let t=D1e("WHERE smartctl 2>nul",wQe).toString().split(`\r
499
499
  `);t&&t.length?HP=t[0].indexOf(":\\")>=0:HP=!1}catch{HP=!1}if(wRt||Hsn||Vsn||Wsn||zsn)try{HP=D1e("which smartctl 2>/dev/null",xQe).toString().split(`\r
@@ -952,7 +952,7 @@ ${JSON.stringify(e,null,2)}`;try{let o=Jcn.dirname(this.logFilePath);await Kcn.m
952
952
  [${new Date().toISOString()}]
953
953
  ${n}
954
954
  ${"=".repeat(80)}
955
- `;await Kcn.appendFile(this.logFilePath,a,"utf-8")}catch(o){console.debug(R.t("openaiContentGenerator.errors.failedWriteDebugLog"),o)}}logTelemetryFailure(e,r){let n=r instanceof Error&&r.message?r.message:String(r);rE(new Error(`${e}: ${n}`))}isClaudeModel(){return/claude/i.test(this.modelName)}isGpt5Model(){return/gpt-5/i.test(this.modelName)}async generateContent(e,r){let n={"model.name":this.modelName,"model.provider":"openai","api.endpoint":`${this.baseUrl}/chat/completions`,"session.id":this.config?.getSessionId()||"","conversation.id":this.config?.getConversationId()||""};return ry("model_call",n,async()=>{let o=Date.now(),s={},a;try{let c=await this.generateContentInternal(e,r,d=>{s=d},(d,f,p,h)=>{a=h;let m=Zs.getActiveSpan();if(m){let g=Date.now()-o,A={"request.model":h?.model||s.model||this.modelName,"request.temperature":s.temperature,"request.max_tokens":s.max_tokens||s.max_new_tokens,"request.tools_count":s.tools?.length||0,"request.messages_count":s.messages?.length||0,"response.http_status":d||200,"response.business_error_code":f,"response.finish_reason":p||"unknown","response.duration_ms":g,"response.success":!0};try{A["request.full_body"]=this.safeStringify(s),a&&(A["response.full_body"]=this.safeStringify(a))}catch(y){console.error("Failed to serialize request/response data for telemetry:",y),A["request.body_serialization_error"]=!0,A.serialization_error_message=y instanceof Error?y.message:String(y)}try{m.setAttributes(A)}catch(y){console.error("Failed to set span attributes:",y)}}}),u=Zs.getActiveSpan();if(u&&c.usageMetadata){let d={"response.prompt_tokens":c.usageMetadata.promptTokenCount,"response.completion_tokens":c.usageMetadata.candidatesTokenCount,"response.total_tokens":c.usageMetadata.totalTokenCount};try{d["request.full_body"]=this.safeStringify(s),a&&(d["response.full_body"]=this.safeStringify(a))}catch(f){console.error("Failed to serialize request/response data for telemetry:",f),d["request.body_serialization_error"]=!0,d.serialization_error_message=f instanceof Error?f.message:String(f)}try{u.setAttributes(d)}catch(f){console.error("Failed to set span attributes:",f)}}return c}catch(c){let u=Date.now()-o,d=c instanceof Error?c.message:String(c),f=Zs.getActiveSpan();if(f){let p={"request.model":a?.model||s.model||this.modelName,"request.temperature":s.temperature,"request.max_tokens":s.max_tokens||s.max_new_tokens,"request.tools_count":s.tools?.length||0,"request.messages_count":s.messages?.length||0,"response.duration_ms":u,"response.success":!1,"response.error_message":d};try{p["request.full_body"]=this.safeStringify(s),a&&(p["response.full_body"]=this.safeStringify(a))}catch(h){console.error("Failed to serialize request/response data for telemetry:",h),p["request.body_serialization_error"]=!0,p.serialization_error_message=h instanceof Error?h.message:String(h)}try{f.setAttributes(p)}catch(h){console.error("Failed to set span attributes:",h)}}throw c}})}safeStringify(e){let r=new WeakSet;return JSON.stringify(e,(n,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[Circular Reference]";r.add(o)}return o})}async generateContentInternal(e,r,n,o){let s=BR.api;s.start("OpenAI-GenerateContent-Total");let a=!1;try{if((this.authType===er.LOGIN_WITH_IFLOW||this.authType===er.IFLOW)&&await Tee()){this.authType===er.LOGIN_WITH_IFLOW&&await hke();let{getCachedApiKey:B}=await Promise.resolve().then(()=>(ZB(),Ybt)),L=await B();L&&(this.apiKey=L)}let c=await this.convertToOpenAIMessages(e),u=qcn(c);if(this.config){let O=this.config.getConversationId();if(O)try{await pkt(this.config,O,{model:this.modelName,tool:u})}catch(B){this.logTelemetryFailure("Telemetry initialization failed",B)}}let d=this.convertToOpenAITools(e.config?.tools),f={model:this.modelName,messages:c};(this.authType===er.LOGIN_WITH_IFLOW||this.authType===er.IFLOW)&&this.modelName==="glm-4.6"&&(f.model="glm-4.6-exp");let p=!1;this.config?.getTemperature()!==void 0&&this.config.getTemperature()!==-1?(f.temperature=this.config.getTemperature(),p=!0):e.config?.temperature!==void 0&&(this.config?.getTemperature()===void 0||this.config.getTemperature()!==-1)&&(f.temperature=e.config.temperature,p=!0),p||(this.config?.getTopP()!==void 0&&this.config.getTopP()!==-1?f.top_p=this.config.getTopP():e.config?.topP!==void 0&&(this.config?.getTopP()===void 0||this.config.getTopP()!==-1)&&(f.top_p=e.config.topP));let h=this.config?.getContentGeneratorConfig?.();h?.thinking&&h.thinking.maxTokens>0?dx.configureThinkingRequest(f.model,f,h.thinking)||console.debug(`Model ${this.modelName} does not support thinking mode`):dx.configureNonThinkingRequest(f.model,f);let m=await this.calculateInputTokens(e),g=_kt(f.model,m,this.config?.getOutputTokensLimit()),A="global";A==="aone"&&(f.max_tokens=g),this.modelName.includes("deepseek")&&f.model!=="deepseek-v3.2-reasoner"&&(f.max_tokens=g),f.max_new_tokens=g,e.config?.stopSequences&&e.config.stopSequences.length>0&&(f.stop=e.config.stopSequences),d&&d.length>0&&(f.tools=d),await this.logToPromptFile(f,"INPUT REQUEST"),n&&n(f);let y=this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl;["offline-whale-wave.alibaba-inc.com","whale.wave.vipserver.offline","whale-wave.alibaba-inc.com","pre-whale-wave.alibaba-inc.com","internal-offline-whale-wave.alibaba-inc.com","internal-whale-wave.alibaba-inc.com"].some(O=>y.includes(O))&&(f.extend_fields={sessionId:this.config?.getSessionId()||""}),f.model==="iFlow-ROME-30BA3B"&&(f.temperature=.7,f.top_p=.8,f.top_k=20);let v=Date.now(),b=ARt(),S={"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,"user-agent":"iFlow-Cli","session-id":this.config?.getSessionId()||"","conversation-id":this.config?.getConversationId()||""};b&&(S={...S,traceparent:b}),A==="aone"&&(S={...S,"X-Client-Type":"iflow-cli","X-Client-Version":"0.5.1-beta-20260113143539"}),lGe(this.config,new ane(this.baseUrl,this.modelName,JSON.stringify(f),r,JSON.stringify(e.contents)));let x=await fetch(`${y}/chat/completions`,{signal:e.config?.abortSignal,method:"POST",headers:S,body:JSON.stringify(f)}),k=Date.now()-v;if(!x.ok){o&&o(x.status);let O=await x.text();if(this.config)try{await iGe(this.config,new Error(O)),nE(this.config,new E1(this.modelName,O,k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"http_error",x.status,x.status,void 0))}catch(B){this.logTelemetryFailure("Telemetry error recording failed",B)}throw x.status===511?(this.config&&nE(this.config,new E1(this.modelName,"Content length exceeded",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"content_length_exceed",511,200,511)),new Error(R.t("openaiContentGenerator.errors.contentLengthExceed",{traceId:b||x.headers.get("eagleeye-traceid")}))):x.status===514?(this.config&&nE(this.config,new E1(this.modelName,"model_error",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"model_error",514,200,514)),new Error(R.t("openaiContentGenerator.errors.modelError",{traceId:b||x.headers.get("eagleeye-traceid")}))):x.status===429?(this.config&&nE(this.config,new E1(this.modelName,"Rate limit reached",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"rate_limit",429,200,429)),new Error(R.t("openaiContentGenerator.errors.modelRateLimitReached"))):new Error(R.t("openaiContentGenerator.errors.httpError",{status:x.status,body:O,traceId:b||x.headers.get("eagleeye-traceid")}))}let I;try{I=await x.json()}catch(O){throw rE(O),new Error(R.t("openaiContentGenerator.errors.responseFormatError",{traceId:b||x.headers.get("eagleeye-traceid")}))}if(I.error_code&&(I.error_code===511||I.error_code===413))throw this.config&&nE(this.config,new E1(this.modelName,"Content length exceeded",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"content_length_exceed",I.error_code,200,I.error_code)),new Error(R.t("openaiContentGenerator.errors.contentLengthExceed",{traceId:b||x.headers.get("eagleeye-traceid")}));if(I.error_code&&I.error_code===514)throw this.config&&nE(this.config,new E1(this.modelName,"model_error",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"model_error",514,200,514)),new Error(R.t("openaiContentGenerator.errors.modelError",{traceId:b||x.headers.get("eagleeye-traceid")}));if(I.status&&I.status==="439"||I.error_code&&I.error_code===439)throw this.config&&nE(this.config,new E1(this.modelName,"API token expired",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"token_expired",439,200,439)),new Error(R.t("openaiContentGenerator.errors.apiTokenExpired"));if(I.msg&&(I.msg.includes("invalid apiKey")||I.msg.includes("Invalid apiKey")))throw new Error(R.t("openaiContentGenerator.errors.invalidApiKey"));if(I.status&&(I.status==="434"||I.status===434))throw this.config&&nE(this.config,new E1(this.modelName,"Invalid API key",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"invalid_api_key",434,200,434)),new Error(R.t("openaiContentGenerator.errors.invalidApiKey"));if(I.status&&(I.status==="435"||I.status===435))throw this.config&&nE(this.config,new E1(this.modelName,"Model Not Support",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"Model Not Support",435,200,435)),new Error(R.t("openaiContentGenerator.errors.modelNotSupport"));if(I.status&&I.status==="429"||I.error_code&&(I.error_code===429||I.error_code===8211))throw this.config&&nE(this.config,new E1(this.modelName,"Rate limit reached",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"rate_limit",I.error_code||I.status||429,200,I.error_code||I.status||429)),new Error(R.t("openaiContentGenerator.errors.modelRateLimitReached"));if(I.status&&I.status==="449"||I.error_code&&I.error_code===449)throw this.config&&nE(this.config,new E1(this.modelName,"Rate limit reached",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"rate_limit",449,200,449)),new Error(R.t("openaiContentGenerator.errors.rateLimitReached"));if(e.config?.abortSignal?.aborted)throw new Error(R.t("openaiContentGenerator.errors.userCancel"));if(!I||!I.choices||!Array.isArray(I.choices)||I.choices.length===0){let O=b||x.headers.get("eagleeye-traceid");throw new Error(R.t("openaiContentGenerator.errors.invalidResponseFormat",{traceId:O}))}await this.logToPromptFile(I,"API RESPONSE"),I.usage&&(I.usage.cache_creation_input_tokens&&(I.usage.total_tokens=I.usage.total_tokens+I.usage.cache_creation_input_tokens,I.usage.prompt_tokens=I.usage.prompt_tokens+I.usage.cache_creation_input_tokens),I.usage.cache_read_input_tokens&&(I.usage.total_tokens=I.usage.total_tokens+I.usage.cache_read_input_tokens,I.usage.prompt_tokens=I.usage.prompt_tokens+I.usage.cache_read_input_tokens),this.lastUsageMetadata={total_tokens:I.usage.total_tokens,prompt_tokens:I.usage.prompt_tokens,completion_tokens:I.usage.completion_tokens});let{response:P,hadJsonFixes:D}=await this.convertFromOpenAIResponse(I);if(a=D,o){let O=I.choices[0]?.finish_reason,B=I.error_code;o(200,B,O,I)}if(this.config)try{let O=I.choices[0]?.finish_reason;dGe(this.config,new cne(this.modelName,k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,I.usage?{promptTokenCount:I.usage.prompt_tokens||0,candidatesTokenCount:I.usage.completion_tokens||0,totalTokenCount:I.usage.total_tokens||0,cachedContentTokenCount:0,thoughtsTokenCount:0,toolUsePromptTokenCount:0}:void 0,JSON.stringify(I,null,2),void 0,O,200,void 0)),await J1e(this.config),cRt(this.config,!0,!1,a)}catch(O){this.logTelemetryFailure("Telemetry cleanup failed",O)}return P}catch(c){if(rE(c),this.config&&!(c instanceof Error&&c.message==="user cancel")&&c?.name!=="AbortError"&&(await iGe(this.config,c instanceof Error?c:new Error(String(c))),cRt(this.config,!1,!1,a,c instanceof Error?c.message:String(c))),c instanceof Error&&c.cause?.name?.includes("InvalidArgumentError"))throw new Error(R.t("openaiContentGenerator.errors.apiKeyError"));if(c instanceof Error&&c.message&&["iFlow Login expired","Your iFlow Login expired","Your API Token has expired","platform rate limit","platform concurrency limit","Your input has exceeded","the network is unavailable","\u60A8\u7684 iFlow \u767B\u5F55\u5DF2\u8FC7\u671F","\u767B\u5F55\u5DF2\u8FC7\u671F","API Token \u5DF2\u8FC7\u671F","API Token\u5DF2\u8FC7\u671F","\u5E73\u53F0\u901F\u7387\u9650\u5236","\u5E73\u53F0\u5E76\u53D1\u9650\u5236","\u60A8\u7684\u8F93\u5165\u8D85\u8FC7\u4E86\u6A21\u578B\u7684\u4E0A\u4E0B\u6587\u957F\u5EA6","\u60A8\u7684\u8F93\u5165\u5DF2\u8D85\u51FA","\u7F51\u7EDC\u5F02\u5E38\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"].some(f=>c.message.includes(f)))throw new Error(c.message);let u="";throw c instanceof Error?u=c.cause?`${c.message}:${c.cause.message}`:c.message:u=String(c),new Error(R.t("openaiContentGenerator.errors.generateDataError",{error:u}),{cause:c})}finally{s.end("OpenAI-GenerateContent-Total")}}async generateContentStream(e,r){let n=await this.generateContent(e,r);async function*o(){yield n}return o()}async countTokens(e,r=!1){let n=e.useCache??!0;if(!r&&this.lastUsageMetadata?.total_tokens)return{totalTokens:this.lastUsageMetadata.total_tokens};let o=this.extractTextFromRequest(e);return{totalTokens:Math.ceil(o.length/4)}}async calculateInputTokens(e){try{let r={model:this.modelName,contents:e.contents,config:{systemInstruction:e.config?.systemInstruction}};return(await this.countTokens(r)).totalTokens||0}catch{let n=this.extractTextFromRequest({model:this.modelName,contents:e.contents});return Math.ceil(n.length/4)}}async embedContent(e){try{let r=this.extractTextFromEmbedRequest(e),n=this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl,o=await fetch(`${n}/v1/embeddings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({model:this.modelName,input:r})});if(!o.ok){let a=await o.text();throw new Error(`HTTP error! status: ${o.status}, body: ${a}`)}return{embeddings:[{values:(await o.json()).data[0].embedding}]}}catch(r){throw rE(r),new Error(R.t("openaiContentGenerator.errors.embedContentFailed",{error:r instanceof Error?r.message:String(r)}))}}async convertToOpenAIMessages(e){let r=[],n=new Set,o=new Map;if(e.contents){let a=Array.isArray(e.contents)?e.contents:[e.contents];for(let c of a)if(typeof c=="object"&&c!==null&&"parts"in c&&c.parts){let u=Array.isArray(c.parts)?c.parts:[c.parts];for(let d of u){if(d.functionCall){let f=d.functionCall.id||`call_${Date.now()}_${Math.random().toString(36).substring(2,11)}`;n.add(f)}if(d.functionResponse){let f=d.functionResponse.id||d.functionResponse.name||"";f.startsWith(YC)&&n.add(f);let p=d.functionResponse.response?.output??(d.functionResponse.response?JSON.stringify(d.functionResponse.response):"");o.set(f,{role:"tool",tool_call_id:f,content:p})}}}for(let[c]of o)n.has(c)||o.delete(c)}if(e.config?.systemInstruction){let a=this.extractSystemInstruction(e.config.systemInstruction);a&&r.push({role:"system",content:a})}if(e.contents){let a=Array.isArray(e.contents)?e.contents:[e.contents];for(let c of a){if(typeof c=="string"){r.push({role:"user",content:c});continue}if(typeof c=="object"&&c!==null&&"text"in c&&c.text){r.push({role:"user",content:c.text});continue}if(typeof c=="object"&&c!==null&&"parts"in c&&c.parts){let u=Array.isArray(c.parts)?c.parts:[c.parts];if(c.role==="model"){let d={role:"assistant",content:"",tool_calls:[]};for(let f of u)if(f.thought&&"text"in f?(d.reasoning_content=f.text,f.thoughtSignature&&(d.signature=f.thoughtSignature)):"text"in f&&f.text&&(d.content=f.text),f.functionCall){let p=f.functionCall.id||`call_${Date.now()}_${Math.random().toString(36).substring(2,11)}`;d.tool_calls.push({id:p,function:{name:f.functionCall.name||"",arguments:JSON.stringify(f.functionCall.args||{})},type:"function"})}if((d.content||d.tool_calls.length>0)&&(d.tool_calls.length===0&&delete d.tool_calls,r.push(d),d.tool_calls&&d.tool_calls.length>0))for(let f of d.tool_calls){let p=o.get(f.id);p?r.push(p):r.push({role:"tool",tool_call_id:f.id,content:R.t("openaiContentGenerator.messages.toolNotExecuted")})}}else{let d=[];for(let f of u)if("text"in f&&f.text)d.push({type:"text",text:f.text});else if(f.inlineData){let p=f.inlineData;if(p.mimeType&&p.mimeType.startsWith("image/")){let h=this.authType===er.IFLOW||this.authType===er.LOGIN_WITH_IFLOW||this.baseUrl&&this.baseUrl.toLowerCase().includes("apis.iflow.cn"),m=this.authType===er.AONE||this.authType===er.LOGIN_WITH_AONE;if(!h&&!m)r.push({role:"user",content:[{type:"image_url",image_url:{url:"data:"+p.mimeType+";base64,"+p.data}}]});else try{if(!p.data)throw new Error(R.t("openaiContentGenerator.errors.imageDataMissing"));let g=await this.multimodalHelper.generateImageDescription(p.data,p.mimeType);d.push({type:"text",text:`[Image Description]: ${g}`})}catch(g){rE(g),d.push({type:"text",text:R.t("openaiContentGenerator.errors.imageContentCannotParse",{error:g instanceof Error?g.message:String(g)})})}}}d.length>0&&r.push({role:"user",content:d})}}}}if("global"==="aone"&&this.isClaudeModel()&&r.length>0){let a=r[r.length-1];if(a.role==="user"||a.role==="assistant"){if(typeof a.content=="string")a.content=[{type:"text",text:a.content,cache_control:{type:"ephemeral"}}];else if(Array.isArray(a.content)){let c=a.content[a.content.length-1];c&&typeof c=="object"&&(c.cache_control={type:"ephemeral"})}}else a.role==="tool"&&(a.cache_control={type:"ephemeral"})}return r}createGeminiResponse(){let e=new Dee;return e.candidates=[{content:{parts:[],role:"model"}}],e}async convertFromOpenAIResponse(e){let r=e.choices[0],n=this.createGeminiResponse(),o=n.candidates?.[0],s=!1;if(!r||!r.message)return{response:n,hadJsonFixes:s};if(r.message.reasoning_content!==null&&r.message.reasoning_content!==void 0&&o?.content?.parts&&o.content.parts.push({thought:!0,text:r.message.reasoning_content,thoughtSignature:r.message.signature??null}),r.message.reasoning&&o?.content?.parts&&o.content.parts.push({thought:!0,text:r.message.reasoning}),r.message.content&&r.message.content.trim()&&o?.content?.parts&&o.content.parts.push({text:r.message.content}),r.message.tool_calls&&Array.isArray(r.message.tool_calls))for(let a of r.message.tool_calls){let c;try{c=JSON.parse(a.function.arguments)}catch(u){if(rE(u),this.baseUrl==="https://apis.iflow.cn/v1"||this.baseUrl==="https://ducky.code.alibaba-inc.com/v1/openai")try{c=await this.fixInvalidJsonWithQwen(a.function.arguments),s=!0}catch(d){rE(d),console.error("Failed to fix JSON",d),c={}}else c={}}o?.content?.parts?.push({functionCall:{id:a.id,name:a.function.name,args:c}})}return o&&r.finish_reason!=="tool_calls"&&r.finish_reason&&(o.finishReason=this.mapFinishReason(r.finish_reason)),n.usageMetadata={promptTokenCount:e.usage?.prompt_tokens||0,candidatesTokenCount:e.usage?.completion_tokens||0,totalTokenCount:e.usage?.total_tokens||0},{response:n,hadJsonFixes:s}}async fixInvalidJsonWithQwen(e){let r=`
955
+ `;await Kcn.appendFile(this.logFilePath,a,"utf-8")}catch(o){console.debug(R.t("openaiContentGenerator.errors.failedWriteDebugLog"),o)}}logTelemetryFailure(e,r){let n=r instanceof Error&&r.message?r.message:String(r);rE(new Error(`${e}: ${n}`))}isClaudeModel(){return/claude/i.test(this.modelName)}isGpt5Model(){return/gpt-5/i.test(this.modelName)}async generateContent(e,r){let n={"model.name":this.modelName,"model.provider":"openai","api.endpoint":`${this.baseUrl}/chat/completions`,"session.id":this.config?.getSessionId()||"","conversation.id":this.config?.getConversationId()||""};return ry("model_call",n,async()=>{let o=Date.now(),s={},a;try{let c=await this.generateContentInternal(e,r,d=>{s=d},(d,f,p,h)=>{a=h;let m=Zs.getActiveSpan();if(m){let g=Date.now()-o,A={"request.model":h?.model||s.model||this.modelName,"request.temperature":s.temperature,"request.max_tokens":s.max_tokens||s.max_new_tokens,"request.tools_count":s.tools?.length||0,"request.messages_count":s.messages?.length||0,"response.http_status":d||200,"response.business_error_code":f,"response.finish_reason":p||"unknown","response.duration_ms":g,"response.success":!0};try{A["request.full_body"]=this.safeStringify(s),a&&(A["response.full_body"]=this.safeStringify(a))}catch(y){console.error("Failed to serialize request/response data for telemetry:",y),A["request.body_serialization_error"]=!0,A.serialization_error_message=y instanceof Error?y.message:String(y)}try{m.setAttributes(A)}catch(y){console.error("Failed to set span attributes:",y)}}}),u=Zs.getActiveSpan();if(u&&c.usageMetadata){let d={"response.prompt_tokens":c.usageMetadata.promptTokenCount,"response.completion_tokens":c.usageMetadata.candidatesTokenCount,"response.total_tokens":c.usageMetadata.totalTokenCount};try{d["request.full_body"]=this.safeStringify(s),a&&(d["response.full_body"]=this.safeStringify(a))}catch(f){console.error("Failed to serialize request/response data for telemetry:",f),d["request.body_serialization_error"]=!0,d.serialization_error_message=f instanceof Error?f.message:String(f)}try{u.setAttributes(d)}catch(f){console.error("Failed to set span attributes:",f)}}return c}catch(c){let u=Date.now()-o,d=c instanceof Error?c.message:String(c),f=Zs.getActiveSpan();if(f){let p={"request.model":a?.model||s.model||this.modelName,"request.temperature":s.temperature,"request.max_tokens":s.max_tokens||s.max_new_tokens,"request.tools_count":s.tools?.length||0,"request.messages_count":s.messages?.length||0,"response.duration_ms":u,"response.success":!1,"response.error_message":d};try{p["request.full_body"]=this.safeStringify(s),a&&(p["response.full_body"]=this.safeStringify(a))}catch(h){console.error("Failed to serialize request/response data for telemetry:",h),p["request.body_serialization_error"]=!0,p.serialization_error_message=h instanceof Error?h.message:String(h)}try{f.setAttributes(p)}catch(h){console.error("Failed to set span attributes:",h)}}throw c}})}safeStringify(e){let r=new WeakSet;return JSON.stringify(e,(n,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[Circular Reference]";r.add(o)}return o})}async generateContentInternal(e,r,n,o){let s=BR.api;s.start("OpenAI-GenerateContent-Total");let a=!1;try{if((this.authType===er.LOGIN_WITH_IFLOW||this.authType===er.IFLOW)&&await Tee()){this.authType===er.LOGIN_WITH_IFLOW&&await hke();let{getCachedApiKey:B}=await Promise.resolve().then(()=>(ZB(),Ybt)),L=await B();L&&(this.apiKey=L)}let c=await this.convertToOpenAIMessages(e),u=qcn(c);if(this.config){let O=this.config.getConversationId();if(O)try{await pkt(this.config,O,{model:this.modelName,tool:u})}catch(B){this.logTelemetryFailure("Telemetry initialization failed",B)}}let d=this.convertToOpenAITools(e.config?.tools),f={model:this.modelName,messages:c};(this.authType===er.LOGIN_WITH_IFLOW||this.authType===er.IFLOW)&&this.modelName==="glm-4.6"&&(f.model="glm-4.6-exp");let p=!1;this.config?.getTemperature()!==void 0&&this.config.getTemperature()!==-1?(f.temperature=this.config.getTemperature(),p=!0):e.config?.temperature!==void 0&&(this.config?.getTemperature()===void 0||this.config.getTemperature()!==-1)&&(f.temperature=e.config.temperature,p=!0),p||(this.config?.getTopP()!==void 0&&this.config.getTopP()!==-1?f.top_p=this.config.getTopP():e.config?.topP!==void 0&&(this.config?.getTopP()===void 0||this.config.getTopP()!==-1)&&(f.top_p=e.config.topP));let h=this.config?.getContentGeneratorConfig?.();h?.thinking&&h.thinking.maxTokens>0?dx.configureThinkingRequest(f.model,f,h.thinking)||console.debug(`Model ${this.modelName} does not support thinking mode`):dx.configureNonThinkingRequest(f.model,f);let m=await this.calculateInputTokens(e),g=_kt(f.model,m,this.config?.getOutputTokensLimit()),A="global";A==="aone"&&(f.max_tokens=g),this.modelName.includes("deepseek")&&f.model!=="deepseek-v3.2-reasoner"&&(f.max_tokens=g),f.max_new_tokens=g,e.config?.stopSequences&&e.config.stopSequences.length>0&&(f.stop=e.config.stopSequences),d&&d.length>0&&(f.tools=d),await this.logToPromptFile(f,"INPUT REQUEST"),n&&n(f);let y=this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl;["offline-whale-wave.alibaba-inc.com","whale.wave.vipserver.offline","whale-wave.alibaba-inc.com","pre-whale-wave.alibaba-inc.com","internal-offline-whale-wave.alibaba-inc.com","internal-whale-wave.alibaba-inc.com"].some(O=>y.includes(O))&&(f.extend_fields={sessionId:this.config?.getSessionId()||""}),f.model==="iFlow-ROME-30BA3B"&&(f.temperature=.7,f.top_p=.8,f.top_k=20);let v=Date.now(),b=ARt(),S={"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,"user-agent":"iFlow-Cli","session-id":this.config?.getSessionId()||"","conversation-id":this.config?.getConversationId()||""};b&&(S={...S,traceparent:b}),A==="aone"&&(S={...S,"X-Client-Type":"iflow-cli","X-Client-Version":"0.5.1"}),lGe(this.config,new ane(this.baseUrl,this.modelName,JSON.stringify(f),r,JSON.stringify(e.contents)));let x=await fetch(`${y}/chat/completions`,{signal:e.config?.abortSignal,method:"POST",headers:S,body:JSON.stringify(f)}),k=Date.now()-v;if(!x.ok){o&&o(x.status);let O=await x.text();if(this.config)try{await iGe(this.config,new Error(O)),nE(this.config,new E1(this.modelName,O,k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"http_error",x.status,x.status,void 0))}catch(B){this.logTelemetryFailure("Telemetry error recording failed",B)}throw x.status===511?(this.config&&nE(this.config,new E1(this.modelName,"Content length exceeded",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"content_length_exceed",511,200,511)),new Error(R.t("openaiContentGenerator.errors.contentLengthExceed",{traceId:b||x.headers.get("eagleeye-traceid")}))):x.status===514?(this.config&&nE(this.config,new E1(this.modelName,"model_error",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"model_error",514,200,514)),new Error(R.t("openaiContentGenerator.errors.modelError",{traceId:b||x.headers.get("eagleeye-traceid")}))):x.status===429?(this.config&&nE(this.config,new E1(this.modelName,"Rate limit reached",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"rate_limit",429,200,429)),new Error(R.t("openaiContentGenerator.errors.modelRateLimitReached"))):new Error(R.t("openaiContentGenerator.errors.httpError",{status:x.status,body:O,traceId:b||x.headers.get("eagleeye-traceid")}))}let I;try{I=await x.json()}catch(O){throw rE(O),new Error(R.t("openaiContentGenerator.errors.responseFormatError",{traceId:b||x.headers.get("eagleeye-traceid")}))}if(I.error_code&&(I.error_code===511||I.error_code===413))throw this.config&&nE(this.config,new E1(this.modelName,"Content length exceeded",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"content_length_exceed",I.error_code,200,I.error_code)),new Error(R.t("openaiContentGenerator.errors.contentLengthExceed",{traceId:b||x.headers.get("eagleeye-traceid")}));if(I.error_code&&I.error_code===514)throw this.config&&nE(this.config,new E1(this.modelName,"model_error",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"model_error",514,200,514)),new Error(R.t("openaiContentGenerator.errors.modelError",{traceId:b||x.headers.get("eagleeye-traceid")}));if(I.status&&I.status==="439"||I.error_code&&I.error_code===439)throw this.config&&nE(this.config,new E1(this.modelName,"API token expired",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"token_expired",439,200,439)),new Error(R.t("openaiContentGenerator.errors.apiTokenExpired"));if(I.msg&&(I.msg.includes("invalid apiKey")||I.msg.includes("Invalid apiKey")))throw new Error(R.t("openaiContentGenerator.errors.invalidApiKey"));if(I.status&&(I.status==="434"||I.status===434))throw this.config&&nE(this.config,new E1(this.modelName,"Invalid API key",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"invalid_api_key",434,200,434)),new Error(R.t("openaiContentGenerator.errors.invalidApiKey"));if(I.status&&(I.status==="435"||I.status===435))throw this.config&&nE(this.config,new E1(this.modelName,"Model Not Support",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"Model Not Support",435,200,435)),new Error(R.t("openaiContentGenerator.errors.modelNotSupport"));if(I.status&&I.status==="429"||I.error_code&&(I.error_code===429||I.error_code===8211))throw this.config&&nE(this.config,new E1(this.modelName,"Rate limit reached",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"rate_limit",I.error_code||I.status||429,200,I.error_code||I.status||429)),new Error(R.t("openaiContentGenerator.errors.modelRateLimitReached"));if(I.status&&I.status==="449"||I.error_code&&I.error_code===449)throw this.config&&nE(this.config,new E1(this.modelName,"Rate limit reached",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"rate_limit",449,200,449)),new Error(R.t("openaiContentGenerator.errors.rateLimitReached"));if(e.config?.abortSignal?.aborted)throw new Error(R.t("openaiContentGenerator.errors.userCancel"));if(!I||!I.choices||!Array.isArray(I.choices)||I.choices.length===0){let O=b||x.headers.get("eagleeye-traceid");throw new Error(R.t("openaiContentGenerator.errors.invalidResponseFormat",{traceId:O}))}await this.logToPromptFile(I,"API RESPONSE"),I.usage&&(I.usage.cache_creation_input_tokens&&(I.usage.total_tokens=I.usage.total_tokens+I.usage.cache_creation_input_tokens,I.usage.prompt_tokens=I.usage.prompt_tokens+I.usage.cache_creation_input_tokens),I.usage.cache_read_input_tokens&&(I.usage.total_tokens=I.usage.total_tokens+I.usage.cache_read_input_tokens,I.usage.prompt_tokens=I.usage.prompt_tokens+I.usage.cache_read_input_tokens),this.lastUsageMetadata={total_tokens:I.usage.total_tokens,prompt_tokens:I.usage.prompt_tokens,completion_tokens:I.usage.completion_tokens});let{response:P,hadJsonFixes:D}=await this.convertFromOpenAIResponse(I);if(a=D,o){let O=I.choices[0]?.finish_reason,B=I.error_code;o(200,B,O,I)}if(this.config)try{let O=I.choices[0]?.finish_reason;dGe(this.config,new cne(this.modelName,k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,I.usage?{promptTokenCount:I.usage.prompt_tokens||0,candidatesTokenCount:I.usage.completion_tokens||0,totalTokenCount:I.usage.total_tokens||0,cachedContentTokenCount:0,thoughtsTokenCount:0,toolUsePromptTokenCount:0}:void 0,JSON.stringify(I,null,2),void 0,O,200,void 0)),await J1e(this.config),cRt(this.config,!0,!1,a)}catch(O){this.logTelemetryFailure("Telemetry cleanup failed",O)}return P}catch(c){if(rE(c),this.config&&!(c instanceof Error&&c.message==="user cancel")&&c?.name!=="AbortError"&&(await iGe(this.config,c instanceof Error?c:new Error(String(c))),cRt(this.config,!1,!1,a,c instanceof Error?c.message:String(c))),c instanceof Error&&c.cause?.name?.includes("InvalidArgumentError"))throw new Error(R.t("openaiContentGenerator.errors.apiKeyError"));if(c instanceof Error&&c.message&&["iFlow Login expired","Your iFlow Login expired","Your API Token has expired","platform rate limit","platform concurrency limit","Your input has exceeded","the network is unavailable","\u60A8\u7684 iFlow \u767B\u5F55\u5DF2\u8FC7\u671F","\u767B\u5F55\u5DF2\u8FC7\u671F","API Token \u5DF2\u8FC7\u671F","API Token\u5DF2\u8FC7\u671F","\u5E73\u53F0\u901F\u7387\u9650\u5236","\u5E73\u53F0\u5E76\u53D1\u9650\u5236","\u60A8\u7684\u8F93\u5165\u8D85\u8FC7\u4E86\u6A21\u578B\u7684\u4E0A\u4E0B\u6587\u957F\u5EA6","\u60A8\u7684\u8F93\u5165\u5DF2\u8D85\u51FA","\u7F51\u7EDC\u5F02\u5E38\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"].some(f=>c.message.includes(f)))throw new Error(c.message);let u="";throw c instanceof Error?u=c.cause?`${c.message}:${c.cause.message}`:c.message:u=String(c),new Error(R.t("openaiContentGenerator.errors.generateDataError",{error:u}),{cause:c})}finally{s.end("OpenAI-GenerateContent-Total")}}async generateContentStream(e,r){let n=await this.generateContent(e,r);async function*o(){yield n}return o()}async countTokens(e,r=!1){let n=e.useCache??!0;if(!r&&this.lastUsageMetadata?.total_tokens)return{totalTokens:this.lastUsageMetadata.total_tokens};let o=this.extractTextFromRequest(e);return{totalTokens:Math.ceil(o.length/4)}}async calculateInputTokens(e){try{let r={model:this.modelName,contents:e.contents,config:{systemInstruction:e.config?.systemInstruction}};return(await this.countTokens(r)).totalTokens||0}catch{let n=this.extractTextFromRequest({model:this.modelName,contents:e.contents});return Math.ceil(n.length/4)}}async embedContent(e){try{let r=this.extractTextFromEmbedRequest(e),n=this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl,o=await fetch(`${n}/v1/embeddings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({model:this.modelName,input:r})});if(!o.ok){let a=await o.text();throw new Error(`HTTP error! status: ${o.status}, body: ${a}`)}return{embeddings:[{values:(await o.json()).data[0].embedding}]}}catch(r){throw rE(r),new Error(R.t("openaiContentGenerator.errors.embedContentFailed",{error:r instanceof Error?r.message:String(r)}))}}async convertToOpenAIMessages(e){let r=[],n=new Set,o=new Map;if(e.contents){let a=Array.isArray(e.contents)?e.contents:[e.contents];for(let c of a)if(typeof c=="object"&&c!==null&&"parts"in c&&c.parts){let u=Array.isArray(c.parts)?c.parts:[c.parts];for(let d of u){if(d.functionCall){let f=d.functionCall.id||`call_${Date.now()}_${Math.random().toString(36).substring(2,11)}`;n.add(f)}if(d.functionResponse){let f=d.functionResponse.id||d.functionResponse.name||"";f.startsWith(YC)&&n.add(f);let p=d.functionResponse.response?.output??(d.functionResponse.response?JSON.stringify(d.functionResponse.response):"");o.set(f,{role:"tool",tool_call_id:f,content:p})}}}for(let[c]of o)n.has(c)||o.delete(c)}if(e.config?.systemInstruction){let a=this.extractSystemInstruction(e.config.systemInstruction);a&&r.push({role:"system",content:a})}if(e.contents){let a=Array.isArray(e.contents)?e.contents:[e.contents];for(let c of a){if(typeof c=="string"){r.push({role:"user",content:c});continue}if(typeof c=="object"&&c!==null&&"text"in c&&c.text){r.push({role:"user",content:c.text});continue}if(typeof c=="object"&&c!==null&&"parts"in c&&c.parts){let u=Array.isArray(c.parts)?c.parts:[c.parts];if(c.role==="model"){let d={role:"assistant",content:"",tool_calls:[]};for(let f of u)if(f.thought&&"text"in f?(d.reasoning_content=f.text,f.thoughtSignature&&(d.signature=f.thoughtSignature)):"text"in f&&f.text&&(d.content=f.text),f.functionCall){let p=f.functionCall.id||`call_${Date.now()}_${Math.random().toString(36).substring(2,11)}`;d.tool_calls.push({id:p,function:{name:f.functionCall.name||"",arguments:JSON.stringify(f.functionCall.args||{})},type:"function"})}if((d.content||d.tool_calls.length>0)&&(d.tool_calls.length===0&&delete d.tool_calls,r.push(d),d.tool_calls&&d.tool_calls.length>0))for(let f of d.tool_calls){let p=o.get(f.id);p?r.push(p):r.push({role:"tool",tool_call_id:f.id,content:R.t("openaiContentGenerator.messages.toolNotExecuted")})}}else{let d=[];for(let f of u)if("text"in f&&f.text)d.push({type:"text",text:f.text});else if(f.inlineData){let p=f.inlineData;if(p.mimeType&&p.mimeType.startsWith("image/")){let h=this.authType===er.IFLOW||this.authType===er.LOGIN_WITH_IFLOW||this.baseUrl&&this.baseUrl.toLowerCase().includes("apis.iflow.cn"),m=this.authType===er.AONE||this.authType===er.LOGIN_WITH_AONE;if(!h&&!m)r.push({role:"user",content:[{type:"image_url",image_url:{url:"data:"+p.mimeType+";base64,"+p.data}}]});else try{if(!p.data)throw new Error(R.t("openaiContentGenerator.errors.imageDataMissing"));let g=await this.multimodalHelper.generateImageDescription(p.data,p.mimeType);d.push({type:"text",text:`[Image Description]: ${g}`})}catch(g){rE(g),d.push({type:"text",text:R.t("openaiContentGenerator.errors.imageContentCannotParse",{error:g instanceof Error?g.message:String(g)})})}}}d.length>0&&r.push({role:"user",content:d})}}}}if("global"==="aone"&&this.isClaudeModel()&&r.length>0){let a=r[r.length-1];if(a.role==="user"||a.role==="assistant"){if(typeof a.content=="string")a.content=[{type:"text",text:a.content,cache_control:{type:"ephemeral"}}];else if(Array.isArray(a.content)){let c=a.content[a.content.length-1];c&&typeof c=="object"&&(c.cache_control={type:"ephemeral"})}}else a.role==="tool"&&(a.cache_control={type:"ephemeral"})}return r}createGeminiResponse(){let e=new Dee;return e.candidates=[{content:{parts:[],role:"model"}}],e}async convertFromOpenAIResponse(e){let r=e.choices[0],n=this.createGeminiResponse(),o=n.candidates?.[0],s=!1;if(!r||!r.message)return{response:n,hadJsonFixes:s};if(r.message.reasoning_content!==null&&r.message.reasoning_content!==void 0&&o?.content?.parts&&o.content.parts.push({thought:!0,text:r.message.reasoning_content,thoughtSignature:r.message.signature??null}),r.message.reasoning&&o?.content?.parts&&o.content.parts.push({thought:!0,text:r.message.reasoning}),r.message.content&&r.message.content.trim()&&o?.content?.parts&&o.content.parts.push({text:r.message.content}),r.message.tool_calls&&Array.isArray(r.message.tool_calls))for(let a of r.message.tool_calls){let c;try{c=JSON.parse(a.function.arguments)}catch(u){if(rE(u),this.baseUrl==="https://apis.iflow.cn/v1"||this.baseUrl==="https://ducky.code.alibaba-inc.com/v1/openai")try{c=await this.fixInvalidJsonWithQwen(a.function.arguments),s=!0}catch(d){rE(d),console.error("Failed to fix JSON",d),c={}}else c={}}o?.content?.parts?.push({functionCall:{id:a.id,name:a.function.name,args:c}})}return o&&r.finish_reason!=="tool_calls"&&r.finish_reason&&(o.finishReason=this.mapFinishReason(r.finish_reason)),n.usageMetadata={promptTokenCount:e.usage?.prompt_tokens||0,candidatesTokenCount:e.usage?.completion_tokens||0,totalTokenCount:e.usage?.total_tokens||0},{response:n,hadJsonFixes:s}}async fixInvalidJsonWithQwen(e){let r=`
956
956
  \u4F60\u662F\u4E00\u4E2Ajson\u683C\u5F0F\u4F18\u5316\u4E13\u5BB6\uFF0C\u4F60\u7684\u5DE5\u4F5C\u662F\u5C06\u4E00\u4E32\u6587\u672C\uFF0C\u6839\u636Ejson schema\u7684\u5B9A\u4E49\u8F93\u51FA\u6210\u4E00\u4E2Avalid\u7684json
957
957
  \u8FD9\u4E2A\u662F\u9519\u8BEF\u7684json\u683C\u5F0F\uFF1A
958
958
  ${e}
@@ -965,7 +965,7 @@ Otherwise navigate to:
965
965
 
966
966
  ${e}
967
967
 
968
- `);try{(await d0(e)).on("error",s=>{throw new Error(`BROWSER_LAUNCH_FAILED: Failed to open browser automatically: ${s.message}. Please navigate to the URL manually.`)})}catch(o){throw new Error(`BROWSER_LAUNCH_FAILED: An unexpected error occurred while trying to open the browser: ${o}. Please navigate to the URL manually.`)}console.log("Waiting for authentication...");let n=0;for(;n<r.maxRetries;){await vln(r.pollInterval);let o=await bln(t,r);if(o.isSuccess()){let s=o.getPrivateToken();return await PR.savePrivateToken(s),console.log("Aone authentication successful!"),!0}o.getError()&&console.log(`Waiting for authentication... (${n+1}/${r.maxRetries})`),n++}throw new Error("Authentication timeout. Please try again.")}async function CGe(t=new Une){return await PR.hasValidToken()?(console.log("Using cached Aone authentication."),!0):await Cln(t)}async function JC(){return await PR.loadPrivateToken()}async function SGe(){await PR.clearPrivateToken(),console.log("Aone authentication cleared.")}async function Ers(){return await PR.hasValidToken()}async function vrs(t=new Une){return await SGe(),await CGe(t)}var a3e=G(()=>{"use strict";Tkt();qT();yln();_ln();Eln();});async function Dkt(t,e,r,n,o){if(e===er.LOGIN_WITH_IFLOW){await nG(e,r,o);let s=await Rw();if(!s)throw new Error("No API key found. Please re-authenticate.");let a=r.getContentGeneratorConfig();return new Lq({model:r.getModel(),apiKey:s,baseUrl:a?.baseUrl||n3e,authType:e,debugMode:r.getDebugMode(),multimodalModelName:"qwen3-vl-plus",config:r})}if(e===er.LOGIN_WITH_AONE){if(!await CGe())throw new Error("Aone authentication failed. Please try again.");let a=await JC();if(!a)throw new Error("No Aone private token found. Please re-authenticate.");let c=r.getContentGeneratorConfig(),u=Buffer.from(a,"utf8").toString("base64");return new Lq({model:r.getModel(),apiKey:u,baseUrl:c?.baseUrl||"https://ducky.code.alibaba-inc.com/v1/openai",authType:e,debugMode:r.getDebugMode(),multimodalModelName:c?.multimodalModelName,config:r})}if(e===er.CLOUD_SHELL){let s=await nG(e,r),a=await cNr(s);return new tR(s,a.projectId,t,n,a.userTier)}throw new Error(`Unsupported authType: ${e}`)}var Ikt=G(()=>{"use strict";Hv();ZB();lNr();_ke();Ekt();KC();a3e();});function brs(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function iD(t){let e=brs(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 o=`iflow_${t}`;if(process.env[o])return process.env[o];let s=`iflow_${e}`;if(process.env[s])return process.env[s]}function c3e(){return iD("apiKey")}function l3e(){return iD("baseUrl")||iD("url")}function u3e(){return iD("modelName")||iD("model")}function Sln(t){let e=iD(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 wln(t){let e=iD(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function xln(t){let e=iD(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function wGe(){return!!(c3e()||l3e()||u3e())}function Rkt(){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","lightWeightPlan"],n=["maxSessionTurns","memoryDiscoveryMaxDirs","tokensLimit","outputTokensLimit","compressionTokenThreshold","shellTimeout","temperature","topP"],o=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(s=>{let a=iD(s);a!==void 0&&(t[s]=a)}),r.forEach(s=>{let a=Sln(s);a!==void 0&&(t[s]=a)}),n.forEach(s=>{let a=wln(s);a!==void 0&&(t[s]=a)}),o.forEach(s=>{let a=xln(s);a!==void 0&&(t[s]=a)}),t}function Crs(){return{apiKey:c3e(),baseUrl:l3e(),model:u3e()}}var kkt=G(()=>{"use strict";});async function Okt(t,e,r){if(await Tee())try{await mke()||console.log("OAuth2 credentials cleared due to expiration. Please authenticate when prompted.")}catch(p){throw p instanceof Error&&p.message.includes("SERVER_OAUTH2_REQUIRED"),p}let o=c3e(),s=l3e(),a=u3e(),c=r?.apiKey||o,u=r?.baseUrl||s||Srs[e],d=r?.modelName||t.getModel()||a||i6,f={model:d,authType:e,proxy:t?.getProxy(),debugMode:t?.getDebugMode(),config:t};return e===er.CLOUD_SHELL?f:e===er.LOGIN_WITH_IFLOW?(f.baseUrl=u||n3e,f.multimodalModelName="qwen3-vl-plus",c&&(f.apiKey=c),f):([...o6,er.OPENAI_COMPATIBLE].includes(e)&&c&&(f.apiKey=c,f.baseUrl=u,f.model=d),f)}async function Nkt(t,e,r,n){let s={headers:{"User-Agent":`iFlowCLI/0.5.1-beta-20260113143539 (${process.platform}; ${process.arch})`}};if(t.authType&&[...o6,er.IDEA_LAB].includes(t.authType)||t.authType===er.OPENAI_COMPATIBLE)return new Lq({...t,config:e});if(t.authType===er.LOGIN_WITH_IFLOW||t.authType===er.LOGIN_WITH_AONE||t.authType===er.CLOUD_SHELL)return Dkt(s,t.authType,e,r,n);throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var er,o6,Srs,Hv=G(()=>{"use strict";Ikt();KC();Ekt();kkt();ZB();(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"})(er||(er={}));o6=[er.IFLOW,er.AONE],Srs={[er.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[er.IFLOW]:n3e,[er.AONE]:Xcn}});var xGe,Tln=G(()=>{"use strict";xGe=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,o)=>n.name.localeCompare(o.name))}clear(){this.prompts.clear()}removePromptsByServer(e){for(let[r,n]of this.prompts.entries())n.serverName===e&&this.prompts.delete(r)}}});var Fr,C1=G(()=>{"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.EDIT_NO_CHANGE_LLM_JUDGEMENT="edit_no_change_llm_judgement",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",t.BASH_OUTPUT_EXECUTION_ERROR="bash_output_execution_error",t.TASK_NOT_FOUND="task_not_found"})(Fr||(Fr={}))});var oc,Dln,ii,MR,d3e=G(()=>{(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let s={};for(let a of o)s[a]=a;return s},t.getValidEnumValues=o=>{let s=t.objectKeys(o).filter(c=>typeof o[o[c]]!="number"),a={};for(let c of s)a[c]=o[c];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(s){return o[s]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&s.push(a);return s},t.find=(o,s)=>{for(let a of o)if(s(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(oc||(oc={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Dln||(Dln={}));ii=oc.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),MR=t=>{switch(typeof t){case"undefined":return ii.undefined;case"string":return ii.string;case"number":return Number.isNaN(t)?ii.nan:ii.number;case"boolean":return ii.boolean;case"function":return ii.function;case"bigint":return ii.bigint;case"symbol":return ii.symbol;case"object":return Array.isArray(t)?ii.array:t===null?ii.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ii.promise:typeof Map<"u"&&t instanceof Map?ii.map:typeof Set<"u"&&t instanceof Set?ii.set:typeof Date<"u"&&t instanceof Date?ii.date:ii.object;default:return ii.unknown}}});var rn,s6,TGe=G(()=>{d3e();rn=oc.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"]),s6=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(s){return s.message},n={_errors:[]},o=s=>{for(let a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let c=n,u=0;for(;u<a.path.length;){let d=a.path[u];u===a.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(r(a))):c[d]=c[d]||{_errors:[]},c=c[d],u++}}};return o(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,oc.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];r[s]=r[s]||[],r[s].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};s6.create=t=>new s6(t)});var wrs,SM,Bkt=G(()=>{TGe();d3e();wrs=(t,e)=>{let r;switch(t.code){case rn.invalid_type:t.received===ii.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case rn.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,oc.jsonStringifyReplacer)}`;break;case rn.unrecognized_keys:r=`Unrecognized key(s) in object: ${oc.joinValues(t.keys,", ")}`;break;case rn.invalid_union:r="Invalid input";break;case rn.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${oc.joinValues(t.options)}`;break;case rn.invalid_enum_value:r=`Invalid enum value. Expected ${oc.joinValues(t.options)}, received '${t.received}'`;break;case rn.invalid_arguments:r="Invalid function arguments";break;case rn.invalid_return_type:r="Invalid function return type";break;case rn.invalid_date:r="Invalid date";break;case rn.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}"`:oc.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case rn.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 rn.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 rn.custom:r="Invalid input";break;case rn.invalid_intersection_types:r="Intersection results could not be merged";break;case rn.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case rn.not_finite:r="Number must be finite";break;default:r=e.defaultError,oc.assertNever(t)}return{message:r}},SM=wrs});function f3e(){return xrs}var xrs,DGe=G(()=>{Bkt();xrs=SM});function $n(t,e){let r=f3e(),n=IGe({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===SM?void 0:SM].filter(o=>!!o)});t.common.issues.push(n)}var IGe,S1,Oo,$ne,oy,Pkt,Mkt,Uq,p3e,Fkt=G(()=>{DGe();Bkt();IGe=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,s=[...r,...o.path||[]],a={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let c="",u=n.filter(d=>!!d).slice().reverse();for(let d of u)c=d(a,{data:e,defaultError:c}).message;return{...o,path:s,message:c}};S1=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 o of r){if(o.status==="aborted")return Oo;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let s=await o.key,a=await o.value;n.push({key:s,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:s,value:a}=o;if(s.status==="aborted"||a.status==="aborted")return Oo;s.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[s.value]=a.value)}return{status:e.value,value:n}}},Oo=Object.freeze({status:"aborted"}),$ne=t=>({status:"dirty",value:t}),oy=t=>({status:"valid",value:t}),Pkt=t=>t.status==="aborted",Mkt=t=>t.status==="dirty",Uq=t=>t.status==="valid",p3e=t=>typeof Promise<"u"&&t instanceof Promise});var Iln=G(()=>{});var Pi,Rln=G(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Pi||(Pi={}))});function Gs(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=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:o}:{errorMap:(a,c)=>{let{message:u}=t;return a.code==="invalid_enum_value"?{message:u??c.defaultError}:typeof c.data>"u"?{message:u??n??c.defaultError}:a.code!=="invalid_type"?{message:c.defaultError}:{message:u??r??c.defaultError}},description:o}}function Nln(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 Grs(t){return new RegExp(`^${Nln(t)}$`)}function qrs(t){let e=`${Oln}T${Nln(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 Hrs(t,e){return!!((e==="v4"||!e)&&Mrs.test(t)||(e==="v6"||!e)&&Lrs.test(t))}function Vrs(t,e){if(!Ors.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,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function Wrs(t,e){return!!((e==="v4"||!e)&&Frs.test(t)||(e==="v6"||!e)&&Urs.test(t))}function zrs(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return s%a/10**o}function jne(t){if(t instanceof a6){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=fx.create(jne(n))}return new a6({...t._def,shape:()=>e})}else return t instanceof xM?new xM({...t._def,type:jne(t.element)}):t instanceof fx?fx.create(jne(t.unwrap())):t instanceof UR?UR.create(jne(t.unwrap())):t instanceof LR?LR.create(t.items.map(e=>jne(e))):t}function $kt(t,e){let r=MR(t),n=MR(e);if(t===e)return{valid:!0,data:t};if(r===ii.object&&n===ii.object){let o=oc.objectKeys(e),s=oc.objectKeys(t).filter(c=>o.indexOf(c)!==-1),a={...t,...e};for(let c of s){let u=$kt(t[c],e[c]);if(!u.valid)return{valid:!1};a[c]=u.data}return{valid:!0,data:a}}else if(r===ii.array&&n===ii.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let a=t[s],c=e[s],u=$kt(a,c);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===ii.date&&n===ii.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function Bln(t,e){return new Yne({values:t,typeName:wo.ZodEnum,...Gs(e)})}var XC,kln,Ia,Trs,Drs,Irs,Rrs,krs,Ors,Nrs,Brs,Prs,Lkt,Mrs,Frs,Lrs,Urs,$rs,jrs,Oln,Qrs,Qne,h3e,m3e,g3e,A3e,y3e,Gne,qne,_3e,wM,oD,E3e,xM,a6,Hne,FR,Ukt,Vne,LR,jkt,v3e,b3e,Qkt,Wne,zne,Yne,Kne,$q,px,fx,UR,Jne,Xne,C3e,eGc,RGe,kGe,Zne,tGc,wo,rGc,nGc,iGc,oGc,sGc,aGc,cGc,lGc,uGc,dGc,fGc,pGc,hGc,mGc,Yrs,gGc,AGc,yGc,_Gc,EGc,vGc,bGc,CGc,SGc,wGc,xGc,TGc,DGc,IGc,RGc,kGc,OGc,NGc,BGc,Pln=G(()=>{TGe();DGe();Rln();Fkt();d3e();XC=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}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}},kln=(t,e)=>{if(Uq(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 s6(t.common.issues);return this._error=r,this._error}}};Ia=class{get description(){return this._def.description}_getType(e){return MR(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:MR(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new S1,ctx:{common:e.parent.common,data:e.data,parsedType:MR(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(p3e(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:MR(e)},o=this._parseSync({data:e,path:n.path,parent:n});return kln(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:MR(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Uq(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=>Uq(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:MR(e)},o=this._parse({data:e,path:n.path,parent:n}),s=await(p3e(o)?o:Promise.resolve(o));return kln(n,s)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,s)=>{let a=e(o),c=()=>s.addIssue({code:rn.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(c(),!1)):a?!0:(c(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new px({schema:this,typeName:wo.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 fx.create(this,this._def)}nullable(){return UR.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return xM.create(this)}promise(){return $q.create(this,this._def)}or(e){return Hne.create([this,e],this._def)}and(e){return Vne.create(this,e,this._def)}transform(e){return new px({...Gs(this._def),schema:this,typeName:wo.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Jne({...Gs(this._def),innerType:this,defaultValue:r,typeName:wo.ZodDefault})}brand(){return new RGe({typeName:wo.ZodBranded,type:this,...Gs(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Xne({...Gs(this._def),innerType:this,catchValue:r,typeName:wo.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return kGe.create(this,e)}readonly(){return Zne.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Trs=/^c[^\s-]{8,}$/i,Drs=/^[0-9a-z]+$/,Irs=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Rrs=/^[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,krs=/^[a-z0-9_-]{21}$/i,Ors=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Nrs=/^[-+]?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)?)??$/,Brs=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Prs="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Mrs=/^(?:(?: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])$/,Frs=/^(?:(?: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])$/,Lrs=/^(([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]))$/,Urs=/^(([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])$/,$rs=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,jrs=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Oln="((\\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])))",Qrs=new RegExp(`^${Oln}$`);Qne=class t extends Ia{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ii.string){let s=this._getOrReturnCtx(e);return $n(s,{code:rn.invalid_type,expected:ii.string,received:s.parsedType}),Oo}let n=new S1,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),$n(o,{code:rn.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),$n(o,{code:rn.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let a=e.data.length>s.value,c=e.data.length<s.value;(a||c)&&(o=this._getOrReturnCtx(e,o),a?$n(o,{code:rn.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&$n(o,{code:rn.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")Brs.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"email",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Lkt||(Lkt=new RegExp(Prs,"u")),Lkt.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"emoji",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Rrs.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"uuid",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")krs.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"nanoid",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Trs.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"cuid",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Drs.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"cuid2",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Irs.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"ulid",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),$n(o,{validation:"url",code:rn.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"regex",code:rn.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),$n(o,{code:rn.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),$n(o,{code:rn.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),$n(o,{code:rn.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?qrs(s).test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{code:rn.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Qrs.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{code:rn.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?Grs(s).test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{code:rn.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?Nrs.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"duration",code:rn.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?Hrs(e.data,s.version)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"ip",code:rn.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?Vrs(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"jwt",code:rn.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?Wrs(e.data,s.version)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"cidr",code:rn.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?$rs.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"base64",code:rn.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?jrs.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"base64url",code:rn.invalid_string,message:s.message}),n.dirty()):oc.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:rn.invalid_string,...Pi.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Pi.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Pi.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Pi.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Pi.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Pi.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Pi.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Pi.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Pi.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Pi.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Pi.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Pi.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Pi.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Pi.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,...Pi.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,...Pi.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Pi.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Pi.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Pi.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Pi.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Pi.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Pi.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Pi.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Pi.errToObj(r)})}nonempty(e){return this.min(1,Pi.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}};Qne.create=t=>new Qne({checks:[],typeName:wo.ZodString,coerce:t?.coerce??!1,...Gs(t)});h3e=class t extends Ia{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)!==ii.number){let s=this._getOrReturnCtx(e);return $n(s,{code:rn.invalid_type,expected:ii.number,received:s.parsedType}),Oo}let n,o=new S1;for(let s of this._def.checks)s.kind==="int"?oc.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),$n(n,{code:rn.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),$n(n,{code:rn.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),$n(n,{code:rn.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?zrs(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),$n(n,{code:rn.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),$n(n,{code:rn.not_finite,message:s.message}),o.dirty()):oc.assertNever(s);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Pi.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Pi.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Pi.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Pi.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Pi.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Pi.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Pi.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Pi.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Pi.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Pi.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Pi.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Pi.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Pi.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Pi.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"&&oc.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)}};h3e.create=t=>new h3e({checks:[],typeName:wo.ZodNumber,coerce:t?.coerce||!1,...Gs(t)});m3e=class t extends Ia{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)!==ii.bigint)return this._getInvalidInput(e);let n,o=new S1;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),$n(n,{code:rn.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),$n(n,{code:rn.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),$n(n,{code:rn.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):oc.assertNever(s);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return $n(r,{code:rn.invalid_type,expected:ii.bigint,received:r.parsedType}),Oo}gte(e,r){return this.setLimit("min",e,!0,Pi.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Pi.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Pi.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Pi.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Pi.toString(o)}]})}_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:Pi.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Pi.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Pi.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Pi.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Pi.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}};m3e.create=t=>new m3e({checks:[],typeName:wo.ZodBigInt,coerce:t?.coerce??!1,...Gs(t)});g3e=class extends Ia{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ii.boolean){let n=this._getOrReturnCtx(e);return $n(n,{code:rn.invalid_type,expected:ii.boolean,received:n.parsedType}),Oo}return oy(e.data)}};g3e.create=t=>new g3e({typeName:wo.ZodBoolean,coerce:t?.coerce||!1,...Gs(t)});A3e=class t extends Ia{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ii.date){let s=this._getOrReturnCtx(e);return $n(s,{code:rn.invalid_type,expected:ii.date,received:s.parsedType}),Oo}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return $n(s,{code:rn.invalid_date}),Oo}let n=new S1,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),$n(o,{code:rn.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),$n(o,{code:rn.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):oc.assertNever(s);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:Pi.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Pi.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}};A3e.create=t=>new A3e({checks:[],coerce:t?.coerce||!1,typeName:wo.ZodDate,...Gs(t)});y3e=class extends Ia{_parse(e){if(this._getType(e)!==ii.symbol){let n=this._getOrReturnCtx(e);return $n(n,{code:rn.invalid_type,expected:ii.symbol,received:n.parsedType}),Oo}return oy(e.data)}};y3e.create=t=>new y3e({typeName:wo.ZodSymbol,...Gs(t)});Gne=class extends Ia{_parse(e){if(this._getType(e)!==ii.undefined){let n=this._getOrReturnCtx(e);return $n(n,{code:rn.invalid_type,expected:ii.undefined,received:n.parsedType}),Oo}return oy(e.data)}};Gne.create=t=>new Gne({typeName:wo.ZodUndefined,...Gs(t)});qne=class extends Ia{_parse(e){if(this._getType(e)!==ii.null){let n=this._getOrReturnCtx(e);return $n(n,{code:rn.invalid_type,expected:ii.null,received:n.parsedType}),Oo}return oy(e.data)}};qne.create=t=>new qne({typeName:wo.ZodNull,...Gs(t)});_3e=class extends Ia{constructor(){super(...arguments),this._any=!0}_parse(e){return oy(e.data)}};_3e.create=t=>new _3e({typeName:wo.ZodAny,...Gs(t)});wM=class extends Ia{constructor(){super(...arguments),this._unknown=!0}_parse(e){return oy(e.data)}};wM.create=t=>new wM({typeName:wo.ZodUnknown,...Gs(t)});oD=class extends Ia{_parse(e){let r=this._getOrReturnCtx(e);return $n(r,{code:rn.invalid_type,expected:ii.never,received:r.parsedType}),Oo}};oD.create=t=>new oD({typeName:wo.ZodNever,...Gs(t)});E3e=class extends Ia{_parse(e){if(this._getType(e)!==ii.undefined){let n=this._getOrReturnCtx(e);return $n(n,{code:rn.invalid_type,expected:ii.void,received:n.parsedType}),Oo}return oy(e.data)}};E3e.create=t=>new E3e({typeName:wo.ZodVoid,...Gs(t)});xM=class t extends Ia{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==ii.array)return $n(r,{code:rn.invalid_type,expected:ii.array,received:r.parsedType}),Oo;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,c=r.data.length<o.exactLength.value;(a||c)&&($n(r,{code:a?rn.too_big:rn.too_small,minimum:c?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&($n(r,{code:rn.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&($n(r,{code:rn.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,c)=>o.type._parseAsync(new XC(r,a,r.path,c)))).then(a=>S1.mergeArray(n,a));let s=[...r.data].map((a,c)=>o.type._parseSync(new XC(r,a,r.path,c)));return S1.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Pi.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Pi.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Pi.toString(r)}})}nonempty(e){return this.min(1,e)}};xM.create=(t,e)=>new xM({type:t,minLength:null,maxLength:null,exactLength:null,typeName:wo.ZodArray,...Gs(e)});a6=class t extends Ia{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=oc.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==ii.object){let d=this._getOrReturnCtx(e);return $n(d,{code:rn.invalid_type,expected:ii.object,received:d.parsedType}),Oo}let{status:n,ctx:o}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),c=[];if(!(this._def.catchall instanceof oD&&this._def.unknownKeys==="strip"))for(let d in o.data)a.includes(d)||c.push(d);let u=[];for(let d of a){let f=s[d],p=o.data[d];u.push({key:{status:"valid",value:d},value:f._parse(new XC(o,p,o.path,d)),alwaysSet:d in o.data})}if(this._def.catchall instanceof oD){let d=this._def.unknownKeys;if(d==="passthrough")for(let f of c)u.push({key:{status:"valid",value:f},value:{status:"valid",value:o.data[f]}});else if(d==="strict")c.length>0&&($n(o,{code:rn.unrecognized_keys,keys:c}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let f of c){let p=o.data[f];u.push({key:{status:"valid",value:f},value:d._parse(new XC(o,p,o.path,f)),alwaysSet:f in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let d=[];for(let f of u){let p=await f.key,h=await f.value;d.push({key:p,value:h,alwaysSet:f.alwaysSet})}return d}).then(d=>S1.mergeObjectSync(n,d)):S1.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Pi.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Pi.errToObj(e).message??o}:{message:o}}}:{}})}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:wo.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 oc.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 oc.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return jne(this)}partial(e){let r={};for(let n of oc.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of oc.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof fx;)s=s._def.innerType;r[n]=s}return new t({...this._def,shape:()=>r})}keyof(){return Bln(oc.objectKeys(this.shape))}};a6.create=(t,e)=>new a6({shape:()=>t,unknownKeys:"strip",catchall:oD.create(),typeName:wo.ZodObject,...Gs(e)});a6.strictCreate=(t,e)=>new a6({shape:()=>t,unknownKeys:"strict",catchall:oD.create(),typeName:wo.ZodObject,...Gs(e)});a6.lazycreate=(t,e)=>new a6({shape:t,unknownKeys:"strip",catchall:oD.create(),typeName:wo.ZodObject,...Gs(e)});Hne=class extends Ia{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(s){for(let c of s)if(c.result.status==="valid")return c.result;for(let c of s)if(c.result.status==="dirty")return r.common.issues.push(...c.ctx.common.issues),c.result;let a=s.map(c=>new s6(c.ctx.common.issues));return $n(r,{code:rn.invalid_union,unionErrors:a}),Oo}if(r.common.async)return Promise.all(n.map(async s=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let s,a=[];for(let u of n){let d={...r,common:{...r.common,issues:[]},parent:null},f=u._parseSync({data:r.data,path:r.path,parent:d});if(f.status==="valid")return f;f.status==="dirty"&&!s&&(s={result:f,ctx:d}),d.common.issues.length&&a.push(d.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let c=a.map(u=>new s6(u));return $n(r,{code:rn.invalid_union,unionErrors:c}),Oo}}get options(){return this._def.options}};Hne.create=(t,e)=>new Hne({options:t,typeName:wo.ZodUnion,...Gs(e)});FR=t=>t instanceof Wne?FR(t.schema):t instanceof px?FR(t.innerType()):t instanceof zne?[t.value]:t instanceof Yne?t.options:t instanceof Kne?oc.objectValues(t.enum):t instanceof Jne?FR(t._def.innerType):t instanceof Gne?[void 0]:t instanceof qne?[null]:t instanceof fx?[void 0,...FR(t.unwrap())]:t instanceof UR?[null,...FR(t.unwrap())]:t instanceof RGe||t instanceof Zne?FR(t.unwrap()):t instanceof Xne?FR(t._def.innerType):[],Ukt=class t extends Ia{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ii.object)return $n(r,{code:rn.invalid_type,expected:ii.object,received:r.parsedType}),Oo;let n=this.discriminator,o=r.data[n],s=this.optionsMap.get(o);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):($n(r,{code:rn.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Oo)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let s of r){let a=FR(s.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let c of a){if(o.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);o.set(c,s)}}return new t({typeName:wo.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Gs(n)})}};Vne=class extends Ia{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(s,a)=>{if(Pkt(s)||Pkt(a))return Oo;let c=$kt(s.value,a.value);return c.valid?((Mkt(s)||Mkt(a))&&r.dirty(),{status:r.value,value:c.data}):($n(n,{code:rn.invalid_intersection_types}),Oo)};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(([s,a])=>o(s,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Vne.create=(t,e,r)=>new Vne({left:t,right:e,typeName:wo.ZodIntersection,...Gs(r)});LR=class t extends Ia{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ii.array)return $n(n,{code:rn.invalid_type,expected:ii.array,received:n.parsedType}),Oo;if(n.data.length<this._def.items.length)return $n(n,{code:rn.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Oo;!this._def.rest&&n.data.length>this._def.items.length&&($n(n,{code:rn.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((a,c)=>{let u=this._def.items[c]||this._def.rest;return u?u._parse(new XC(n,a,n.path,c)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>S1.mergeArray(r,a)):S1.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};LR.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new LR({items:t,typeName:wo.ZodTuple,rest:null,...Gs(e)})};jkt=class t extends Ia{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!==ii.object)return $n(n,{code:rn.invalid_type,expected:ii.object,received:n.parsedType}),Oo;let o=[],s=this._def.keyType,a=this._def.valueType;for(let c in n.data)o.push({key:s._parse(new XC(n,c,n.path,c)),value:a._parse(new XC(n,n.data[c],n.path,c)),alwaysSet:c in n.data});return n.common.async?S1.mergeObjectAsync(r,o):S1.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Ia?new t({keyType:e,valueType:r,typeName:wo.ZodRecord,...Gs(n)}):new t({keyType:Qne.create(),valueType:e,typeName:wo.ZodRecord,...Gs(r)})}},v3e=class extends Ia{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!==ii.map)return $n(n,{code:rn.invalid_type,expected:ii.map,received:n.parsedType}),Oo;let o=this._def.keyType,s=this._def.valueType,a=[...n.data.entries()].map(([c,u],d)=>({key:o._parse(new XC(n,c,n.path,[d,"key"])),value:s._parse(new XC(n,u,n.path,[d,"value"]))}));if(n.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let u of a){let d=await u.key,f=await u.value;if(d.status==="aborted"||f.status==="aborted")return Oo;(d.status==="dirty"||f.status==="dirty")&&r.dirty(),c.set(d.value,f.value)}return{status:r.value,value:c}})}else{let c=new Map;for(let u of a){let d=u.key,f=u.value;if(d.status==="aborted"||f.status==="aborted")return Oo;(d.status==="dirty"||f.status==="dirty")&&r.dirty(),c.set(d.value,f.value)}return{status:r.value,value:c}}}};v3e.create=(t,e,r)=>new v3e({valueType:e,keyType:t,typeName:wo.ZodMap,...Gs(r)});b3e=class t extends Ia{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ii.set)return $n(n,{code:rn.invalid_type,expected:ii.set,received:n.parsedType}),Oo;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&($n(n,{code:rn.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&($n(n,{code:rn.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let s=this._def.valueType;function a(u){let d=new Set;for(let f of u){if(f.status==="aborted")return Oo;f.status==="dirty"&&r.dirty(),d.add(f.value)}return{status:r.value,value:d}}let c=[...n.data.values()].map((u,d)=>s._parse(new XC(n,u,n.path,d)));return n.common.async?Promise.all(c).then(u=>a(u)):a(c)}min(e,r){return new t({...this._def,minSize:{value:e,message:Pi.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Pi.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};b3e.create=(t,e)=>new b3e({valueType:t,minSize:null,maxSize:null,typeName:wo.ZodSet,...Gs(e)});Qkt=class t extends Ia{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ii.function)return $n(r,{code:rn.invalid_type,expected:ii.function,received:r.parsedType}),Oo;function n(c,u){return IGe({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,f3e(),SM].filter(d=>!!d),issueData:{code:rn.invalid_arguments,argumentsError:u}})}function o(c,u){return IGe({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,f3e(),SM].filter(d=>!!d),issueData:{code:rn.invalid_return_type,returnTypeError:u}})}let s={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof $q){let c=this;return oy(async function(...u){let d=new s6([]),f=await c._def.args.parseAsync(u,s).catch(m=>{throw d.addIssue(n(u,m)),d}),p=await Reflect.apply(a,this,f);return await c._def.returns._def.type.parseAsync(p,s).catch(m=>{throw d.addIssue(o(p,m)),d})})}else{let c=this;return oy(function(...u){let d=c._def.args.safeParse(u,s);if(!d.success)throw new s6([n(u,d.error)]);let f=Reflect.apply(a,this,d.data),p=c._def.returns.safeParse(f,s);if(!p.success)throw new s6([o(f,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:LR.create(e).rest(wM.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||LR.create([]).rest(wM.create()),returns:r||wM.create(),typeName:wo.ZodFunction,...Gs(n)})}},Wne=class extends Ia{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})}};Wne.create=(t,e)=>new Wne({getter:t,typeName:wo.ZodLazy,...Gs(e)});zne=class extends Ia{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return $n(r,{received:r.data,code:rn.invalid_literal,expected:this._def.value}),Oo}return{status:"valid",value:e.data}}get value(){return this._def.value}};zne.create=(t,e)=>new zne({value:t,typeName:wo.ZodLiteral,...Gs(e)});Yne=class t extends Ia{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return $n(r,{expected:oc.joinValues(n),received:r.parsedType,code:rn.invalid_type}),Oo}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 $n(r,{received:r.data,code:rn.invalid_enum_value,options:n}),Oo}return oy(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})}};Yne.create=Bln;Kne=class extends Ia{_parse(e){let r=oc.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==ii.string&&n.parsedType!==ii.number){let o=oc.objectValues(r);return $n(n,{expected:oc.joinValues(o),received:n.parsedType,code:rn.invalid_type}),Oo}if(this._cache||(this._cache=new Set(oc.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=oc.objectValues(r);return $n(n,{received:n.data,code:rn.invalid_enum_value,options:o}),Oo}return oy(e.data)}get enum(){return this._def.values}};Kne.create=(t,e)=>new Kne({values:t,typeName:wo.ZodNativeEnum,...Gs(e)});$q=class extends Ia{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ii.promise&&r.common.async===!1)return $n(r,{code:rn.invalid_type,expected:ii.promise,received:r.parsedType}),Oo;let n=r.parsedType===ii.promise?r.data:Promise.resolve(r.data);return oy(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};$q.create=(t,e)=>new $q({type:t,typeName:wo.ZodPromise,...Gs(e)});px=class extends Ia{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===wo.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:a=>{$n(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let a=o.transform(n.data,s);if(n.common.async)return Promise.resolve(a).then(async c=>{if(r.value==="aborted")return Oo;let u=await this._def.schema._parseAsync({data:c,path:n.path,parent:n});return u.status==="aborted"?Oo:u.status==="dirty"?$ne(u.value):r.value==="dirty"?$ne(u.value):u});{if(r.value==="aborted")return Oo;let c=this._def.schema._parseSync({data:a,path:n.path,parent:n});return c.status==="aborted"?Oo:c.status==="dirty"?$ne(c.value):r.value==="dirty"?$ne(c.value):c}}if(o.type==="refinement"){let a=c=>{let u=o.refinement(c,s);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(n.common.async===!1){let c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return c.status==="aborted"?Oo:(c.status==="dirty"&&r.dirty(),a(c.value),{status:r.value,value:c.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>c.status==="aborted"?Oo:(c.status==="dirty"&&r.dirty(),a(c.value).then(()=>({status:r.value,value:c.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Uq(a))return Oo;let c=o.transform(a.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:c}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Uq(a)?Promise.resolve(o.transform(a.value,s)).then(c=>({status:r.value,value:c})):Oo);oc.assertNever(o)}};px.create=(t,e,r)=>new px({schema:t,typeName:wo.ZodEffects,effect:e,...Gs(r)});px.createWithPreprocess=(t,e,r)=>new px({schema:e,effect:{type:"preprocess",transform:t},typeName:wo.ZodEffects,...Gs(r)});fx=class extends Ia{_parse(e){return this._getType(e)===ii.undefined?oy(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};fx.create=(t,e)=>new fx({innerType:t,typeName:wo.ZodOptional,...Gs(e)});UR=class extends Ia{_parse(e){return this._getType(e)===ii.null?oy(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};UR.create=(t,e)=>new UR({innerType:t,typeName:wo.ZodNullable,...Gs(e)});Jne=class extends Ia{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===ii.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Jne.create=(t,e)=>new Jne({innerType:t,typeName:wo.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Gs(e)});Xne=class extends Ia{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return p3e(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new s6(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new s6(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Xne.create=(t,e)=>new Xne({innerType:t,typeName:wo.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Gs(e)});C3e=class extends Ia{_parse(e){if(this._getType(e)!==ii.nan){let n=this._getOrReturnCtx(e);return $n(n,{code:rn.invalid_type,expected:ii.nan,received:n.parsedType}),Oo}return{status:"valid",value:e.data}}};C3e.create=t=>new C3e({typeName:wo.ZodNaN,...Gs(t)});eGc=Symbol("zod_brand"),RGe=class extends Ia{_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}},kGe=class t extends Ia{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Oo:s.status==="dirty"?(r.dirty(),$ne(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Oo:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:wo.ZodPipeline})}},Zne=class extends Ia{_parse(e){let r=this._def.innerType._parse(e),n=o=>(Uq(o)&&(o.value=Object.freeze(o.value)),o);return p3e(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Zne.create=(t,e)=>new Zne({innerType:t,typeName:wo.ZodReadonly,...Gs(e)});tGc={object:a6.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"})(wo||(wo={}));rGc=Qne.create,nGc=h3e.create,iGc=C3e.create,oGc=m3e.create,sGc=g3e.create,aGc=A3e.create,cGc=y3e.create,lGc=Gne.create,uGc=qne.create,dGc=_3e.create,fGc=wM.create,pGc=oD.create,hGc=E3e.create,mGc=xM.create,Yrs=a6.create,gGc=a6.strictCreate,AGc=Hne.create,yGc=Ukt.create,_Gc=Vne.create,EGc=LR.create,vGc=jkt.create,bGc=v3e.create,CGc=b3e.create,SGc=Qkt.create,wGc=Wne.create,xGc=zne.create,TGc=Yne.create,DGc=Kne.create,IGc=$q.create,RGc=px.create,kGc=fx.create,OGc=UR.create,NGc=px.createWithPreprocess,BGc=kGe.create});var Gkt=G(()=>{DGe();Fkt();Iln();d3e();Pln();TGe()});var S3e=G(()=>{Gkt();Gkt()});function Mt(t,e,r){function n(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:a,traits:new Set},enumerable:!1}),c._zod.traits.has(t))return;c._zod.traits.add(t),e(c,u);let d=a.prototype,f=Object.keys(d);for(let p=0;p<f.length;p++){let h=f[p];h in c||(c[h]=d[h].bind(c))}}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:t});function a(c){var u;let d=r?.Parent?new s:this;n(d,c),(u=d._zod).deferred??(u.deferred=[]);for(let f of d._zod.deferred)f();return d}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}function wp(t){return t&&Object.assign(w3e,t),w3e}var eie,x3e,hx,TM,w3e,tie=G(()=>{eie=Object.freeze({status:"aborted"});x3e=Symbol("zod_brand"),hx=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},TM=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},w3e={}});var nn={};Eo(nn,{BIGINT_FORMAT_RANGES:()=>Xkt,Class:()=>Hkt,NUMBER_FORMAT_RANGES:()=>Jkt,aborted:()=>kM,allowsEval:()=>zkt,assert:()=>rns,assertEqual:()=>Xrs,assertIs:()=>ens,assertNever:()=>tns,assertNotEqual:()=>Zrs,assignProp:()=>IM,base64ToUint8Array:()=>Gln,base64urlToUint8Array:()=>pns,cached:()=>nie,captureStackTrace:()=>NGe,cleanEnum:()=>fns,cleanRegex:()=>I3e,clone:()=>HA,cloneDef:()=>ins,createTransparentProxy:()=>uns,defineLazy:()=>ta,esc:()=>OGe,escapeRegex:()=>ZC,extend:()=>Uln,finalizeIssue:()=>iE,floatSafeRemainder:()=>Vkt,getElementAtPath:()=>ons,getEnumValues:()=>D3e,getLengthableOrigin:()=>O3e,getParsedType:()=>lns,getSizableOrigin:()=>k3e,hexToUint8Array:()=>mns,isObject:()=>jq,isPlainObject:()=>RM,issue:()=>iie,joinValues:()=>ir,jsonStringifyReplacer:()=>rie,merge:()=>dns,mergeDefs:()=>$R,normalizeParams:()=>cn,nullish:()=>DM,numKeys:()=>cns,objectClone:()=>nns,omit:()=>Lln,optionalKeys:()=>Kkt,parsedType:()=>on,partial:()=>jln,pick:()=>Fln,prefixIssues:()=>c6,primitiveTypes:()=>Ykt,promiseAllObject:()=>sns,propertyKeyTypes:()=>R3e,randomString:()=>ans,required:()=>Qln,safeExtend:()=>$ln,shallowClone:()=>BGe,slugify:()=>Wkt,stringifyPrimitive:()=>Zr,uint8ArrayToBase64:()=>qln,uint8ArrayToBase64url:()=>hns,uint8ArrayToHex:()=>gns,unwrapMessage:()=>T3e});function Xrs(t){return t}function Zrs(t){return t}function ens(t){}function tns(t){throw new Error("Unexpected value in exhaustive check")}function rns(t){}function D3e(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function ir(t,e="|"){return t.map(r=>Zr(r)).join(e)}function rie(t,e){return typeof e=="bigint"?e.toString():e}function nie(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function DM(t){return t==null}function I3e(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Vkt(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let u=n.match(/\d?e-(\d?)/);u?.[1]&&(o=Number.parseInt(u[1]))}let s=r>o?r:o,a=Number.parseInt(t.toFixed(s).replace(".","")),c=Number.parseInt(e.toFixed(s).replace(".",""));return a%c/10**s}function ta(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==Mln)return n===void 0&&(n=Mln,n=r()),n},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function nns(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function IM(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function $R(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function ins(t){return $R(t._zod.def)}function ons(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function sns(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<e.length;s++)o[e[s]]=n[s];return o})}function ans(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function OGe(t){return JSON.stringify(t)}function Wkt(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function jq(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function RM(t){if(jq(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(jq(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function BGe(t){return RM(t)?{...t}:Array.isArray(t)?[...t]:t}function cns(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}function ZC(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function HA(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function cn(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function uns(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,s){return e??(e=t()),Reflect.set(e,n,o,s)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function Zr(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Kkt(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function Fln(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=$R(t._zod.def,{get shape(){let a={};for(let c in e){if(!(c in r.shape))throw new Error(`Unrecognized key: "${c}"`);e[c]&&(a[c]=r.shape[c])}return IM(this,"shape",a),a},checks:[]});return HA(t,s)}function Lln(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=$R(t._zod.def,{get shape(){let a={...t._zod.def.shape};for(let c in e){if(!(c in r.shape))throw new Error(`Unrecognized key: "${c}"`);e[c]&&delete a[c]}return IM(this,"shape",a),a},checks:[]});return HA(t,s)}function Uln(t,e){if(!RM(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let s=t._zod.def.shape;for(let a in e)if(Object.getOwnPropertyDescriptor(s,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=$R(t._zod.def,{get shape(){let s={...t._zod.def.shape,...e};return IM(this,"shape",s),s}});return HA(t,o)}function $ln(t,e){if(!RM(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=$R(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e};return IM(this,"shape",n),n}});return HA(t,r)}function dns(t,e){let r=$R(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return IM(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return HA(t,r)}function jln(t,e,r){let o=e._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=$R(e._zod.def,{get shape(){let c=e._zod.def.shape,u={...c};if(r)for(let d in r){if(!(d in c))throw new Error(`Unrecognized key: "${d}"`);r[d]&&(u[d]=t?new t({type:"optional",innerType:c[d]}):c[d])}else for(let d in c)u[d]=t?new t({type:"optional",innerType:c[d]}):c[d];return IM(this,"shape",u),u},checks:[]});return HA(e,a)}function Qln(t,e,r){let n=$R(e._zod.def,{get shape(){let o=e._zod.def.shape,s={...o};if(r)for(let a in r){if(!(a in s))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(s[a]=new t({type:"nonoptional",innerType:o[a]}))}else for(let a in o)s[a]=new t({type:"nonoptional",innerType:o[a]});return IM(this,"shape",s),s}});return HA(e,n)}function kM(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function c6(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function T3e(t){return typeof t=="string"?t:t?.message}function iE(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=T3e(t.inst?._zod.def?.error?.(t))??T3e(e?.error?.(t))??T3e(r.customError?.(t))??T3e(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function k3e(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function O3e(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function on(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function iie(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function fns(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function Gln(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function qln(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function pns(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return Gln(e+r)}function hns(t){return qln(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function mns(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function gns(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var Mln,NGe,zkt,lns,R3e,Ykt,Jkt,Xkt,Hkt,Hi=G(()=>{Mln=Symbol("evaluating");NGe="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};zkt=nie(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});lns=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},R3e=new Set(["string","number","symbol"]),Ykt=new Set(["string","number","bigint","boolean","symbol","undefined"]);Jkt={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Xkt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};Hkt=class{constructor(...e){}}});function oie(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function sie(t,e=r=>r.message){let r={_errors:[]},n=o=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>n({issues:a}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)r._errors.push(e(s));else{let a=r,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(e(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return n(t),r}function PGe(t,e=r=>r.message){let r={errors:[]},n=(o,s=[])=>{var a,c;for(let u of o.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>n({issues:d},u.path));else if(u.code==="invalid_key")n({issues:u.issues},u.path);else if(u.code==="invalid_element")n({issues:u.issues},u.path);else{let d=[...s,...u.path];if(d.length===0){r.errors.push(e(u));continue}let f=r,p=0;for(;p<d.length;){let h=d[p],m=p===d.length-1;typeof h=="string"?(f.properties??(f.properties={}),(a=f.properties)[h]??(a[h]={errors:[]}),f=f.properties[h]):(f.items??(f.items=[]),(c=f.items)[h]??(c[h]={errors:[]}),f=f.items[h]),m&&f.errors.push(e(u)),p++}}};return n(t),r}function Vln(t){let e=[],r=t.map(n=>typeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?e.push(`[${n}]`):typeof n=="symbol"?e.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?e.push(`[${JSON.stringify(n)}]`):(e.length&&e.push("."),e.push(n));return e.join("")}function MGe(t){let e=[],r=[...t.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)e.push(`\u2716 ${n.message}`),n.path?.length&&e.push(` \u2192 at ${Vln(n.path)}`);return e.join(`
968
+ `);try{(await d0(e)).on("error",s=>{throw new Error(`BROWSER_LAUNCH_FAILED: Failed to open browser automatically: ${s.message}. Please navigate to the URL manually.`)})}catch(o){throw new Error(`BROWSER_LAUNCH_FAILED: An unexpected error occurred while trying to open the browser: ${o}. Please navigate to the URL manually.`)}console.log("Waiting for authentication...");let n=0;for(;n<r.maxRetries;){await vln(r.pollInterval);let o=await bln(t,r);if(o.isSuccess()){let s=o.getPrivateToken();return await PR.savePrivateToken(s),console.log("Aone authentication successful!"),!0}o.getError()&&console.log(`Waiting for authentication... (${n+1}/${r.maxRetries})`),n++}throw new Error("Authentication timeout. Please try again.")}async function CGe(t=new Une){return await PR.hasValidToken()?(console.log("Using cached Aone authentication."),!0):await Cln(t)}async function JC(){return await PR.loadPrivateToken()}async function SGe(){await PR.clearPrivateToken(),console.log("Aone authentication cleared.")}async function Ers(){return await PR.hasValidToken()}async function vrs(t=new Une){return await SGe(),await CGe(t)}var a3e=G(()=>{"use strict";Tkt();qT();yln();_ln();Eln();});async function Dkt(t,e,r,n,o){if(e===er.LOGIN_WITH_IFLOW){await nG(e,r,o);let s=await Rw();if(!s)throw new Error("No API key found. Please re-authenticate.");let a=r.getContentGeneratorConfig();return new Lq({model:r.getModel(),apiKey:s,baseUrl:a?.baseUrl||n3e,authType:e,debugMode:r.getDebugMode(),multimodalModelName:"qwen3-vl-plus",config:r})}if(e===er.LOGIN_WITH_AONE){if(!await CGe())throw new Error("Aone authentication failed. Please try again.");let a=await JC();if(!a)throw new Error("No Aone private token found. Please re-authenticate.");let c=r.getContentGeneratorConfig(),u=Buffer.from(a,"utf8").toString("base64");return new Lq({model:r.getModel(),apiKey:u,baseUrl:c?.baseUrl||"https://ducky.code.alibaba-inc.com/v1/openai",authType:e,debugMode:r.getDebugMode(),multimodalModelName:c?.multimodalModelName,config:r})}if(e===er.CLOUD_SHELL){let s=await nG(e,r),a=await cNr(s);return new tR(s,a.projectId,t,n,a.userTier)}throw new Error(`Unsupported authType: ${e}`)}var Ikt=G(()=>{"use strict";Hv();ZB();lNr();_ke();Ekt();KC();a3e();});function brs(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function iD(t){let e=brs(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 o=`iflow_${t}`;if(process.env[o])return process.env[o];let s=`iflow_${e}`;if(process.env[s])return process.env[s]}function c3e(){return iD("apiKey")}function l3e(){return iD("baseUrl")||iD("url")}function u3e(){return iD("modelName")||iD("model")}function Sln(t){let e=iD(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 wln(t){let e=iD(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function xln(t){let e=iD(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function wGe(){return!!(c3e()||l3e()||u3e())}function Rkt(){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","lightWeightPlan"],n=["maxSessionTurns","memoryDiscoveryMaxDirs","tokensLimit","outputTokensLimit","compressionTokenThreshold","shellTimeout","temperature","topP"],o=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(s=>{let a=iD(s);a!==void 0&&(t[s]=a)}),r.forEach(s=>{let a=Sln(s);a!==void 0&&(t[s]=a)}),n.forEach(s=>{let a=wln(s);a!==void 0&&(t[s]=a)}),o.forEach(s=>{let a=xln(s);a!==void 0&&(t[s]=a)}),t}function Crs(){return{apiKey:c3e(),baseUrl:l3e(),model:u3e()}}var kkt=G(()=>{"use strict";});async function Okt(t,e,r){if(await Tee())try{await mke()||console.log("OAuth2 credentials cleared due to expiration. Please authenticate when prompted.")}catch(p){throw p instanceof Error&&p.message.includes("SERVER_OAUTH2_REQUIRED"),p}let o=c3e(),s=l3e(),a=u3e(),c=r?.apiKey||o,u=r?.baseUrl||s||Srs[e],d=r?.modelName||t.getModel()||a||i6,f={model:d,authType:e,proxy:t?.getProxy(),debugMode:t?.getDebugMode(),config:t};return e===er.CLOUD_SHELL?f:e===er.LOGIN_WITH_IFLOW?(f.baseUrl=u||n3e,f.multimodalModelName="qwen3-vl-plus",c&&(f.apiKey=c),f):([...o6,er.OPENAI_COMPATIBLE].includes(e)&&c&&(f.apiKey=c,f.baseUrl=u,f.model=d),f)}async function Nkt(t,e,r,n){let s={headers:{"User-Agent":`iFlowCLI/0.5.1 (${process.platform}; ${process.arch})`}};if(t.authType&&[...o6,er.IDEA_LAB].includes(t.authType)||t.authType===er.OPENAI_COMPATIBLE)return new Lq({...t,config:e});if(t.authType===er.LOGIN_WITH_IFLOW||t.authType===er.LOGIN_WITH_AONE||t.authType===er.CLOUD_SHELL)return Dkt(s,t.authType,e,r,n);throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var er,o6,Srs,Hv=G(()=>{"use strict";Ikt();KC();Ekt();kkt();ZB();(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"})(er||(er={}));o6=[er.IFLOW,er.AONE],Srs={[er.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[er.IFLOW]:n3e,[er.AONE]:Xcn}});var xGe,Tln=G(()=>{"use strict";xGe=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,o)=>n.name.localeCompare(o.name))}clear(){this.prompts.clear()}removePromptsByServer(e){for(let[r,n]of this.prompts.entries())n.serverName===e&&this.prompts.delete(r)}}});var Fr,C1=G(()=>{"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.EDIT_NO_CHANGE_LLM_JUDGEMENT="edit_no_change_llm_judgement",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",t.BASH_OUTPUT_EXECUTION_ERROR="bash_output_execution_error",t.TASK_NOT_FOUND="task_not_found"})(Fr||(Fr={}))});var oc,Dln,ii,MR,d3e=G(()=>{(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let s={};for(let a of o)s[a]=a;return s},t.getValidEnumValues=o=>{let s=t.objectKeys(o).filter(c=>typeof o[o[c]]!="number"),a={};for(let c of s)a[c]=o[c];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(s){return o[s]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&s.push(a);return s},t.find=(o,s)=>{for(let a of o)if(s(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(oc||(oc={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Dln||(Dln={}));ii=oc.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),MR=t=>{switch(typeof t){case"undefined":return ii.undefined;case"string":return ii.string;case"number":return Number.isNaN(t)?ii.nan:ii.number;case"boolean":return ii.boolean;case"function":return ii.function;case"bigint":return ii.bigint;case"symbol":return ii.symbol;case"object":return Array.isArray(t)?ii.array:t===null?ii.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ii.promise:typeof Map<"u"&&t instanceof Map?ii.map:typeof Set<"u"&&t instanceof Set?ii.set:typeof Date<"u"&&t instanceof Date?ii.date:ii.object;default:return ii.unknown}}});var rn,s6,TGe=G(()=>{d3e();rn=oc.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"]),s6=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(s){return s.message},n={_errors:[]},o=s=>{for(let a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let c=n,u=0;for(;u<a.path.length;){let d=a.path[u];u===a.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(r(a))):c[d]=c[d]||{_errors:[]},c=c[d],u++}}};return o(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,oc.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];r[s]=r[s]||[],r[s].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};s6.create=t=>new s6(t)});var wrs,SM,Bkt=G(()=>{TGe();d3e();wrs=(t,e)=>{let r;switch(t.code){case rn.invalid_type:t.received===ii.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case rn.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,oc.jsonStringifyReplacer)}`;break;case rn.unrecognized_keys:r=`Unrecognized key(s) in object: ${oc.joinValues(t.keys,", ")}`;break;case rn.invalid_union:r="Invalid input";break;case rn.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${oc.joinValues(t.options)}`;break;case rn.invalid_enum_value:r=`Invalid enum value. Expected ${oc.joinValues(t.options)}, received '${t.received}'`;break;case rn.invalid_arguments:r="Invalid function arguments";break;case rn.invalid_return_type:r="Invalid function return type";break;case rn.invalid_date:r="Invalid date";break;case rn.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}"`:oc.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case rn.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 rn.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 rn.custom:r="Invalid input";break;case rn.invalid_intersection_types:r="Intersection results could not be merged";break;case rn.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case rn.not_finite:r="Number must be finite";break;default:r=e.defaultError,oc.assertNever(t)}return{message:r}},SM=wrs});function f3e(){return xrs}var xrs,DGe=G(()=>{Bkt();xrs=SM});function $n(t,e){let r=f3e(),n=IGe({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===SM?void 0:SM].filter(o=>!!o)});t.common.issues.push(n)}var IGe,S1,Oo,$ne,oy,Pkt,Mkt,Uq,p3e,Fkt=G(()=>{DGe();Bkt();IGe=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,s=[...r,...o.path||[]],a={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let c="",u=n.filter(d=>!!d).slice().reverse();for(let d of u)c=d(a,{data:e,defaultError:c}).message;return{...o,path:s,message:c}};S1=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 o of r){if(o.status==="aborted")return Oo;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let s=await o.key,a=await o.value;n.push({key:s,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:s,value:a}=o;if(s.status==="aborted"||a.status==="aborted")return Oo;s.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[s.value]=a.value)}return{status:e.value,value:n}}},Oo=Object.freeze({status:"aborted"}),$ne=t=>({status:"dirty",value:t}),oy=t=>({status:"valid",value:t}),Pkt=t=>t.status==="aborted",Mkt=t=>t.status==="dirty",Uq=t=>t.status==="valid",p3e=t=>typeof Promise<"u"&&t instanceof Promise});var Iln=G(()=>{});var Pi,Rln=G(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Pi||(Pi={}))});function Gs(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=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:o}:{errorMap:(a,c)=>{let{message:u}=t;return a.code==="invalid_enum_value"?{message:u??c.defaultError}:typeof c.data>"u"?{message:u??n??c.defaultError}:a.code!=="invalid_type"?{message:c.defaultError}:{message:u??r??c.defaultError}},description:o}}function Nln(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 Grs(t){return new RegExp(`^${Nln(t)}$`)}function qrs(t){let e=`${Oln}T${Nln(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 Hrs(t,e){return!!((e==="v4"||!e)&&Mrs.test(t)||(e==="v6"||!e)&&Lrs.test(t))}function Vrs(t,e){if(!Ors.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,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function Wrs(t,e){return!!((e==="v4"||!e)&&Frs.test(t)||(e==="v6"||!e)&&Urs.test(t))}function zrs(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return s%a/10**o}function jne(t){if(t instanceof a6){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=fx.create(jne(n))}return new a6({...t._def,shape:()=>e})}else return t instanceof xM?new xM({...t._def,type:jne(t.element)}):t instanceof fx?fx.create(jne(t.unwrap())):t instanceof UR?UR.create(jne(t.unwrap())):t instanceof LR?LR.create(t.items.map(e=>jne(e))):t}function $kt(t,e){let r=MR(t),n=MR(e);if(t===e)return{valid:!0,data:t};if(r===ii.object&&n===ii.object){let o=oc.objectKeys(e),s=oc.objectKeys(t).filter(c=>o.indexOf(c)!==-1),a={...t,...e};for(let c of s){let u=$kt(t[c],e[c]);if(!u.valid)return{valid:!1};a[c]=u.data}return{valid:!0,data:a}}else if(r===ii.array&&n===ii.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let a=t[s],c=e[s],u=$kt(a,c);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===ii.date&&n===ii.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function Bln(t,e){return new Yne({values:t,typeName:wo.ZodEnum,...Gs(e)})}var XC,kln,Ia,Trs,Drs,Irs,Rrs,krs,Ors,Nrs,Brs,Prs,Lkt,Mrs,Frs,Lrs,Urs,$rs,jrs,Oln,Qrs,Qne,h3e,m3e,g3e,A3e,y3e,Gne,qne,_3e,wM,oD,E3e,xM,a6,Hne,FR,Ukt,Vne,LR,jkt,v3e,b3e,Qkt,Wne,zne,Yne,Kne,$q,px,fx,UR,Jne,Xne,C3e,eGc,RGe,kGe,Zne,tGc,wo,rGc,nGc,iGc,oGc,sGc,aGc,cGc,lGc,uGc,dGc,fGc,pGc,hGc,mGc,Yrs,gGc,AGc,yGc,_Gc,EGc,vGc,bGc,CGc,SGc,wGc,xGc,TGc,DGc,IGc,RGc,kGc,OGc,NGc,BGc,Pln=G(()=>{TGe();DGe();Rln();Fkt();d3e();XC=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}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}},kln=(t,e)=>{if(Uq(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 s6(t.common.issues);return this._error=r,this._error}}};Ia=class{get description(){return this._def.description}_getType(e){return MR(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:MR(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new S1,ctx:{common:e.parent.common,data:e.data,parsedType:MR(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(p3e(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:MR(e)},o=this._parseSync({data:e,path:n.path,parent:n});return kln(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:MR(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Uq(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=>Uq(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:MR(e)},o=this._parse({data:e,path:n.path,parent:n}),s=await(p3e(o)?o:Promise.resolve(o));return kln(n,s)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,s)=>{let a=e(o),c=()=>s.addIssue({code:rn.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(c(),!1)):a?!0:(c(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new px({schema:this,typeName:wo.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 fx.create(this,this._def)}nullable(){return UR.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return xM.create(this)}promise(){return $q.create(this,this._def)}or(e){return Hne.create([this,e],this._def)}and(e){return Vne.create(this,e,this._def)}transform(e){return new px({...Gs(this._def),schema:this,typeName:wo.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Jne({...Gs(this._def),innerType:this,defaultValue:r,typeName:wo.ZodDefault})}brand(){return new RGe({typeName:wo.ZodBranded,type:this,...Gs(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Xne({...Gs(this._def),innerType:this,catchValue:r,typeName:wo.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return kGe.create(this,e)}readonly(){return Zne.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Trs=/^c[^\s-]{8,}$/i,Drs=/^[0-9a-z]+$/,Irs=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Rrs=/^[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,krs=/^[a-z0-9_-]{21}$/i,Ors=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Nrs=/^[-+]?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)?)??$/,Brs=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Prs="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Mrs=/^(?:(?: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])$/,Frs=/^(?:(?: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])$/,Lrs=/^(([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]))$/,Urs=/^(([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])$/,$rs=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,jrs=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Oln="((\\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])))",Qrs=new RegExp(`^${Oln}$`);Qne=class t extends Ia{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ii.string){let s=this._getOrReturnCtx(e);return $n(s,{code:rn.invalid_type,expected:ii.string,received:s.parsedType}),Oo}let n=new S1,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),$n(o,{code:rn.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),$n(o,{code:rn.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let a=e.data.length>s.value,c=e.data.length<s.value;(a||c)&&(o=this._getOrReturnCtx(e,o),a?$n(o,{code:rn.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&$n(o,{code:rn.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")Brs.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"email",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Lkt||(Lkt=new RegExp(Prs,"u")),Lkt.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"emoji",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Rrs.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"uuid",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")krs.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"nanoid",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Trs.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"cuid",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Drs.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"cuid2",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Irs.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"ulid",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),$n(o,{validation:"url",code:rn.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"regex",code:rn.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),$n(o,{code:rn.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),$n(o,{code:rn.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),$n(o,{code:rn.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?qrs(s).test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{code:rn.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Qrs.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{code:rn.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?Grs(s).test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{code:rn.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?Nrs.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"duration",code:rn.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?Hrs(e.data,s.version)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"ip",code:rn.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?Vrs(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"jwt",code:rn.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?Wrs(e.data,s.version)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"cidr",code:rn.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?$rs.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"base64",code:rn.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?jrs.test(e.data)||(o=this._getOrReturnCtx(e,o),$n(o,{validation:"base64url",code:rn.invalid_string,message:s.message}),n.dirty()):oc.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:rn.invalid_string,...Pi.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Pi.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Pi.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Pi.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Pi.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Pi.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Pi.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Pi.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Pi.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Pi.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Pi.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Pi.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Pi.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Pi.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,...Pi.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,...Pi.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Pi.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Pi.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Pi.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Pi.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Pi.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Pi.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Pi.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Pi.errToObj(r)})}nonempty(e){return this.min(1,Pi.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}};Qne.create=t=>new Qne({checks:[],typeName:wo.ZodString,coerce:t?.coerce??!1,...Gs(t)});h3e=class t extends Ia{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)!==ii.number){let s=this._getOrReturnCtx(e);return $n(s,{code:rn.invalid_type,expected:ii.number,received:s.parsedType}),Oo}let n,o=new S1;for(let s of this._def.checks)s.kind==="int"?oc.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),$n(n,{code:rn.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),$n(n,{code:rn.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),$n(n,{code:rn.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?zrs(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),$n(n,{code:rn.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),$n(n,{code:rn.not_finite,message:s.message}),o.dirty()):oc.assertNever(s);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Pi.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Pi.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Pi.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Pi.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Pi.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Pi.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Pi.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Pi.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Pi.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Pi.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Pi.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Pi.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Pi.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Pi.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"&&oc.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)}};h3e.create=t=>new h3e({checks:[],typeName:wo.ZodNumber,coerce:t?.coerce||!1,...Gs(t)});m3e=class t extends Ia{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)!==ii.bigint)return this._getInvalidInput(e);let n,o=new S1;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),$n(n,{code:rn.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),$n(n,{code:rn.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),$n(n,{code:rn.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):oc.assertNever(s);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return $n(r,{code:rn.invalid_type,expected:ii.bigint,received:r.parsedType}),Oo}gte(e,r){return this.setLimit("min",e,!0,Pi.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Pi.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Pi.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Pi.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Pi.toString(o)}]})}_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:Pi.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Pi.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Pi.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Pi.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Pi.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}};m3e.create=t=>new m3e({checks:[],typeName:wo.ZodBigInt,coerce:t?.coerce??!1,...Gs(t)});g3e=class extends Ia{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ii.boolean){let n=this._getOrReturnCtx(e);return $n(n,{code:rn.invalid_type,expected:ii.boolean,received:n.parsedType}),Oo}return oy(e.data)}};g3e.create=t=>new g3e({typeName:wo.ZodBoolean,coerce:t?.coerce||!1,...Gs(t)});A3e=class t extends Ia{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ii.date){let s=this._getOrReturnCtx(e);return $n(s,{code:rn.invalid_type,expected:ii.date,received:s.parsedType}),Oo}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return $n(s,{code:rn.invalid_date}),Oo}let n=new S1,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),$n(o,{code:rn.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),$n(o,{code:rn.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):oc.assertNever(s);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:Pi.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Pi.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}};A3e.create=t=>new A3e({checks:[],coerce:t?.coerce||!1,typeName:wo.ZodDate,...Gs(t)});y3e=class extends Ia{_parse(e){if(this._getType(e)!==ii.symbol){let n=this._getOrReturnCtx(e);return $n(n,{code:rn.invalid_type,expected:ii.symbol,received:n.parsedType}),Oo}return oy(e.data)}};y3e.create=t=>new y3e({typeName:wo.ZodSymbol,...Gs(t)});Gne=class extends Ia{_parse(e){if(this._getType(e)!==ii.undefined){let n=this._getOrReturnCtx(e);return $n(n,{code:rn.invalid_type,expected:ii.undefined,received:n.parsedType}),Oo}return oy(e.data)}};Gne.create=t=>new Gne({typeName:wo.ZodUndefined,...Gs(t)});qne=class extends Ia{_parse(e){if(this._getType(e)!==ii.null){let n=this._getOrReturnCtx(e);return $n(n,{code:rn.invalid_type,expected:ii.null,received:n.parsedType}),Oo}return oy(e.data)}};qne.create=t=>new qne({typeName:wo.ZodNull,...Gs(t)});_3e=class extends Ia{constructor(){super(...arguments),this._any=!0}_parse(e){return oy(e.data)}};_3e.create=t=>new _3e({typeName:wo.ZodAny,...Gs(t)});wM=class extends Ia{constructor(){super(...arguments),this._unknown=!0}_parse(e){return oy(e.data)}};wM.create=t=>new wM({typeName:wo.ZodUnknown,...Gs(t)});oD=class extends Ia{_parse(e){let r=this._getOrReturnCtx(e);return $n(r,{code:rn.invalid_type,expected:ii.never,received:r.parsedType}),Oo}};oD.create=t=>new oD({typeName:wo.ZodNever,...Gs(t)});E3e=class extends Ia{_parse(e){if(this._getType(e)!==ii.undefined){let n=this._getOrReturnCtx(e);return $n(n,{code:rn.invalid_type,expected:ii.void,received:n.parsedType}),Oo}return oy(e.data)}};E3e.create=t=>new E3e({typeName:wo.ZodVoid,...Gs(t)});xM=class t extends Ia{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==ii.array)return $n(r,{code:rn.invalid_type,expected:ii.array,received:r.parsedType}),Oo;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,c=r.data.length<o.exactLength.value;(a||c)&&($n(r,{code:a?rn.too_big:rn.too_small,minimum:c?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&($n(r,{code:rn.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&($n(r,{code:rn.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,c)=>o.type._parseAsync(new XC(r,a,r.path,c)))).then(a=>S1.mergeArray(n,a));let s=[...r.data].map((a,c)=>o.type._parseSync(new XC(r,a,r.path,c)));return S1.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Pi.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Pi.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Pi.toString(r)}})}nonempty(e){return this.min(1,e)}};xM.create=(t,e)=>new xM({type:t,minLength:null,maxLength:null,exactLength:null,typeName:wo.ZodArray,...Gs(e)});a6=class t extends Ia{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=oc.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==ii.object){let d=this._getOrReturnCtx(e);return $n(d,{code:rn.invalid_type,expected:ii.object,received:d.parsedType}),Oo}let{status:n,ctx:o}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),c=[];if(!(this._def.catchall instanceof oD&&this._def.unknownKeys==="strip"))for(let d in o.data)a.includes(d)||c.push(d);let u=[];for(let d of a){let f=s[d],p=o.data[d];u.push({key:{status:"valid",value:d},value:f._parse(new XC(o,p,o.path,d)),alwaysSet:d in o.data})}if(this._def.catchall instanceof oD){let d=this._def.unknownKeys;if(d==="passthrough")for(let f of c)u.push({key:{status:"valid",value:f},value:{status:"valid",value:o.data[f]}});else if(d==="strict")c.length>0&&($n(o,{code:rn.unrecognized_keys,keys:c}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let f of c){let p=o.data[f];u.push({key:{status:"valid",value:f},value:d._parse(new XC(o,p,o.path,f)),alwaysSet:f in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let d=[];for(let f of u){let p=await f.key,h=await f.value;d.push({key:p,value:h,alwaysSet:f.alwaysSet})}return d}).then(d=>S1.mergeObjectSync(n,d)):S1.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Pi.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Pi.errToObj(e).message??o}:{message:o}}}:{}})}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:wo.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 oc.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 oc.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return jne(this)}partial(e){let r={};for(let n of oc.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of oc.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof fx;)s=s._def.innerType;r[n]=s}return new t({...this._def,shape:()=>r})}keyof(){return Bln(oc.objectKeys(this.shape))}};a6.create=(t,e)=>new a6({shape:()=>t,unknownKeys:"strip",catchall:oD.create(),typeName:wo.ZodObject,...Gs(e)});a6.strictCreate=(t,e)=>new a6({shape:()=>t,unknownKeys:"strict",catchall:oD.create(),typeName:wo.ZodObject,...Gs(e)});a6.lazycreate=(t,e)=>new a6({shape:t,unknownKeys:"strip",catchall:oD.create(),typeName:wo.ZodObject,...Gs(e)});Hne=class extends Ia{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(s){for(let c of s)if(c.result.status==="valid")return c.result;for(let c of s)if(c.result.status==="dirty")return r.common.issues.push(...c.ctx.common.issues),c.result;let a=s.map(c=>new s6(c.ctx.common.issues));return $n(r,{code:rn.invalid_union,unionErrors:a}),Oo}if(r.common.async)return Promise.all(n.map(async s=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let s,a=[];for(let u of n){let d={...r,common:{...r.common,issues:[]},parent:null},f=u._parseSync({data:r.data,path:r.path,parent:d});if(f.status==="valid")return f;f.status==="dirty"&&!s&&(s={result:f,ctx:d}),d.common.issues.length&&a.push(d.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let c=a.map(u=>new s6(u));return $n(r,{code:rn.invalid_union,unionErrors:c}),Oo}}get options(){return this._def.options}};Hne.create=(t,e)=>new Hne({options:t,typeName:wo.ZodUnion,...Gs(e)});FR=t=>t instanceof Wne?FR(t.schema):t instanceof px?FR(t.innerType()):t instanceof zne?[t.value]:t instanceof Yne?t.options:t instanceof Kne?oc.objectValues(t.enum):t instanceof Jne?FR(t._def.innerType):t instanceof Gne?[void 0]:t instanceof qne?[null]:t instanceof fx?[void 0,...FR(t.unwrap())]:t instanceof UR?[null,...FR(t.unwrap())]:t instanceof RGe||t instanceof Zne?FR(t.unwrap()):t instanceof Xne?FR(t._def.innerType):[],Ukt=class t extends Ia{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ii.object)return $n(r,{code:rn.invalid_type,expected:ii.object,received:r.parsedType}),Oo;let n=this.discriminator,o=r.data[n],s=this.optionsMap.get(o);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):($n(r,{code:rn.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Oo)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let s of r){let a=FR(s.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let c of a){if(o.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);o.set(c,s)}}return new t({typeName:wo.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Gs(n)})}};Vne=class extends Ia{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(s,a)=>{if(Pkt(s)||Pkt(a))return Oo;let c=$kt(s.value,a.value);return c.valid?((Mkt(s)||Mkt(a))&&r.dirty(),{status:r.value,value:c.data}):($n(n,{code:rn.invalid_intersection_types}),Oo)};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(([s,a])=>o(s,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Vne.create=(t,e,r)=>new Vne({left:t,right:e,typeName:wo.ZodIntersection,...Gs(r)});LR=class t extends Ia{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ii.array)return $n(n,{code:rn.invalid_type,expected:ii.array,received:n.parsedType}),Oo;if(n.data.length<this._def.items.length)return $n(n,{code:rn.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Oo;!this._def.rest&&n.data.length>this._def.items.length&&($n(n,{code:rn.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((a,c)=>{let u=this._def.items[c]||this._def.rest;return u?u._parse(new XC(n,a,n.path,c)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>S1.mergeArray(r,a)):S1.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};LR.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new LR({items:t,typeName:wo.ZodTuple,rest:null,...Gs(e)})};jkt=class t extends Ia{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!==ii.object)return $n(n,{code:rn.invalid_type,expected:ii.object,received:n.parsedType}),Oo;let o=[],s=this._def.keyType,a=this._def.valueType;for(let c in n.data)o.push({key:s._parse(new XC(n,c,n.path,c)),value:a._parse(new XC(n,n.data[c],n.path,c)),alwaysSet:c in n.data});return n.common.async?S1.mergeObjectAsync(r,o):S1.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Ia?new t({keyType:e,valueType:r,typeName:wo.ZodRecord,...Gs(n)}):new t({keyType:Qne.create(),valueType:e,typeName:wo.ZodRecord,...Gs(r)})}},v3e=class extends Ia{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!==ii.map)return $n(n,{code:rn.invalid_type,expected:ii.map,received:n.parsedType}),Oo;let o=this._def.keyType,s=this._def.valueType,a=[...n.data.entries()].map(([c,u],d)=>({key:o._parse(new XC(n,c,n.path,[d,"key"])),value:s._parse(new XC(n,u,n.path,[d,"value"]))}));if(n.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let u of a){let d=await u.key,f=await u.value;if(d.status==="aborted"||f.status==="aborted")return Oo;(d.status==="dirty"||f.status==="dirty")&&r.dirty(),c.set(d.value,f.value)}return{status:r.value,value:c}})}else{let c=new Map;for(let u of a){let d=u.key,f=u.value;if(d.status==="aborted"||f.status==="aborted")return Oo;(d.status==="dirty"||f.status==="dirty")&&r.dirty(),c.set(d.value,f.value)}return{status:r.value,value:c}}}};v3e.create=(t,e,r)=>new v3e({valueType:e,keyType:t,typeName:wo.ZodMap,...Gs(r)});b3e=class t extends Ia{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ii.set)return $n(n,{code:rn.invalid_type,expected:ii.set,received:n.parsedType}),Oo;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&($n(n,{code:rn.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&($n(n,{code:rn.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let s=this._def.valueType;function a(u){let d=new Set;for(let f of u){if(f.status==="aborted")return Oo;f.status==="dirty"&&r.dirty(),d.add(f.value)}return{status:r.value,value:d}}let c=[...n.data.values()].map((u,d)=>s._parse(new XC(n,u,n.path,d)));return n.common.async?Promise.all(c).then(u=>a(u)):a(c)}min(e,r){return new t({...this._def,minSize:{value:e,message:Pi.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Pi.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};b3e.create=(t,e)=>new b3e({valueType:t,minSize:null,maxSize:null,typeName:wo.ZodSet,...Gs(e)});Qkt=class t extends Ia{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ii.function)return $n(r,{code:rn.invalid_type,expected:ii.function,received:r.parsedType}),Oo;function n(c,u){return IGe({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,f3e(),SM].filter(d=>!!d),issueData:{code:rn.invalid_arguments,argumentsError:u}})}function o(c,u){return IGe({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,f3e(),SM].filter(d=>!!d),issueData:{code:rn.invalid_return_type,returnTypeError:u}})}let s={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof $q){let c=this;return oy(async function(...u){let d=new s6([]),f=await c._def.args.parseAsync(u,s).catch(m=>{throw d.addIssue(n(u,m)),d}),p=await Reflect.apply(a,this,f);return await c._def.returns._def.type.parseAsync(p,s).catch(m=>{throw d.addIssue(o(p,m)),d})})}else{let c=this;return oy(function(...u){let d=c._def.args.safeParse(u,s);if(!d.success)throw new s6([n(u,d.error)]);let f=Reflect.apply(a,this,d.data),p=c._def.returns.safeParse(f,s);if(!p.success)throw new s6([o(f,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:LR.create(e).rest(wM.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||LR.create([]).rest(wM.create()),returns:r||wM.create(),typeName:wo.ZodFunction,...Gs(n)})}},Wne=class extends Ia{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})}};Wne.create=(t,e)=>new Wne({getter:t,typeName:wo.ZodLazy,...Gs(e)});zne=class extends Ia{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return $n(r,{received:r.data,code:rn.invalid_literal,expected:this._def.value}),Oo}return{status:"valid",value:e.data}}get value(){return this._def.value}};zne.create=(t,e)=>new zne({value:t,typeName:wo.ZodLiteral,...Gs(e)});Yne=class t extends Ia{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return $n(r,{expected:oc.joinValues(n),received:r.parsedType,code:rn.invalid_type}),Oo}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 $n(r,{received:r.data,code:rn.invalid_enum_value,options:n}),Oo}return oy(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})}};Yne.create=Bln;Kne=class extends Ia{_parse(e){let r=oc.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==ii.string&&n.parsedType!==ii.number){let o=oc.objectValues(r);return $n(n,{expected:oc.joinValues(o),received:n.parsedType,code:rn.invalid_type}),Oo}if(this._cache||(this._cache=new Set(oc.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=oc.objectValues(r);return $n(n,{received:n.data,code:rn.invalid_enum_value,options:o}),Oo}return oy(e.data)}get enum(){return this._def.values}};Kne.create=(t,e)=>new Kne({values:t,typeName:wo.ZodNativeEnum,...Gs(e)});$q=class extends Ia{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ii.promise&&r.common.async===!1)return $n(r,{code:rn.invalid_type,expected:ii.promise,received:r.parsedType}),Oo;let n=r.parsedType===ii.promise?r.data:Promise.resolve(r.data);return oy(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};$q.create=(t,e)=>new $q({type:t,typeName:wo.ZodPromise,...Gs(e)});px=class extends Ia{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===wo.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:a=>{$n(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let a=o.transform(n.data,s);if(n.common.async)return Promise.resolve(a).then(async c=>{if(r.value==="aborted")return Oo;let u=await this._def.schema._parseAsync({data:c,path:n.path,parent:n});return u.status==="aborted"?Oo:u.status==="dirty"?$ne(u.value):r.value==="dirty"?$ne(u.value):u});{if(r.value==="aborted")return Oo;let c=this._def.schema._parseSync({data:a,path:n.path,parent:n});return c.status==="aborted"?Oo:c.status==="dirty"?$ne(c.value):r.value==="dirty"?$ne(c.value):c}}if(o.type==="refinement"){let a=c=>{let u=o.refinement(c,s);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(n.common.async===!1){let c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return c.status==="aborted"?Oo:(c.status==="dirty"&&r.dirty(),a(c.value),{status:r.value,value:c.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>c.status==="aborted"?Oo:(c.status==="dirty"&&r.dirty(),a(c.value).then(()=>({status:r.value,value:c.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Uq(a))return Oo;let c=o.transform(a.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:c}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Uq(a)?Promise.resolve(o.transform(a.value,s)).then(c=>({status:r.value,value:c})):Oo);oc.assertNever(o)}};px.create=(t,e,r)=>new px({schema:t,typeName:wo.ZodEffects,effect:e,...Gs(r)});px.createWithPreprocess=(t,e,r)=>new px({schema:e,effect:{type:"preprocess",transform:t},typeName:wo.ZodEffects,...Gs(r)});fx=class extends Ia{_parse(e){return this._getType(e)===ii.undefined?oy(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};fx.create=(t,e)=>new fx({innerType:t,typeName:wo.ZodOptional,...Gs(e)});UR=class extends Ia{_parse(e){return this._getType(e)===ii.null?oy(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};UR.create=(t,e)=>new UR({innerType:t,typeName:wo.ZodNullable,...Gs(e)});Jne=class extends Ia{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===ii.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Jne.create=(t,e)=>new Jne({innerType:t,typeName:wo.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Gs(e)});Xne=class extends Ia{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return p3e(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new s6(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new s6(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Xne.create=(t,e)=>new Xne({innerType:t,typeName:wo.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Gs(e)});C3e=class extends Ia{_parse(e){if(this._getType(e)!==ii.nan){let n=this._getOrReturnCtx(e);return $n(n,{code:rn.invalid_type,expected:ii.nan,received:n.parsedType}),Oo}return{status:"valid",value:e.data}}};C3e.create=t=>new C3e({typeName:wo.ZodNaN,...Gs(t)});eGc=Symbol("zod_brand"),RGe=class extends Ia{_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}},kGe=class t extends Ia{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Oo:s.status==="dirty"?(r.dirty(),$ne(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Oo:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:wo.ZodPipeline})}},Zne=class extends Ia{_parse(e){let r=this._def.innerType._parse(e),n=o=>(Uq(o)&&(o.value=Object.freeze(o.value)),o);return p3e(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Zne.create=(t,e)=>new Zne({innerType:t,typeName:wo.ZodReadonly,...Gs(e)});tGc={object:a6.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"})(wo||(wo={}));rGc=Qne.create,nGc=h3e.create,iGc=C3e.create,oGc=m3e.create,sGc=g3e.create,aGc=A3e.create,cGc=y3e.create,lGc=Gne.create,uGc=qne.create,dGc=_3e.create,fGc=wM.create,pGc=oD.create,hGc=E3e.create,mGc=xM.create,Yrs=a6.create,gGc=a6.strictCreate,AGc=Hne.create,yGc=Ukt.create,_Gc=Vne.create,EGc=LR.create,vGc=jkt.create,bGc=v3e.create,CGc=b3e.create,SGc=Qkt.create,wGc=Wne.create,xGc=zne.create,TGc=Yne.create,DGc=Kne.create,IGc=$q.create,RGc=px.create,kGc=fx.create,OGc=UR.create,NGc=px.createWithPreprocess,BGc=kGe.create});var Gkt=G(()=>{DGe();Fkt();Iln();d3e();Pln();TGe()});var S3e=G(()=>{Gkt();Gkt()});function Mt(t,e,r){function n(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:a,traits:new Set},enumerable:!1}),c._zod.traits.has(t))return;c._zod.traits.add(t),e(c,u);let d=a.prototype,f=Object.keys(d);for(let p=0;p<f.length;p++){let h=f[p];h in c||(c[h]=d[h].bind(c))}}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:t});function a(c){var u;let d=r?.Parent?new s:this;n(d,c),(u=d._zod).deferred??(u.deferred=[]);for(let f of d._zod.deferred)f();return d}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}function wp(t){return t&&Object.assign(w3e,t),w3e}var eie,x3e,hx,TM,w3e,tie=G(()=>{eie=Object.freeze({status:"aborted"});x3e=Symbol("zod_brand"),hx=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},TM=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},w3e={}});var nn={};Eo(nn,{BIGINT_FORMAT_RANGES:()=>Xkt,Class:()=>Hkt,NUMBER_FORMAT_RANGES:()=>Jkt,aborted:()=>kM,allowsEval:()=>zkt,assert:()=>rns,assertEqual:()=>Xrs,assertIs:()=>ens,assertNever:()=>tns,assertNotEqual:()=>Zrs,assignProp:()=>IM,base64ToUint8Array:()=>Gln,base64urlToUint8Array:()=>pns,cached:()=>nie,captureStackTrace:()=>NGe,cleanEnum:()=>fns,cleanRegex:()=>I3e,clone:()=>HA,cloneDef:()=>ins,createTransparentProxy:()=>uns,defineLazy:()=>ta,esc:()=>OGe,escapeRegex:()=>ZC,extend:()=>Uln,finalizeIssue:()=>iE,floatSafeRemainder:()=>Vkt,getElementAtPath:()=>ons,getEnumValues:()=>D3e,getLengthableOrigin:()=>O3e,getParsedType:()=>lns,getSizableOrigin:()=>k3e,hexToUint8Array:()=>mns,isObject:()=>jq,isPlainObject:()=>RM,issue:()=>iie,joinValues:()=>ir,jsonStringifyReplacer:()=>rie,merge:()=>dns,mergeDefs:()=>$R,normalizeParams:()=>cn,nullish:()=>DM,numKeys:()=>cns,objectClone:()=>nns,omit:()=>Lln,optionalKeys:()=>Kkt,parsedType:()=>on,partial:()=>jln,pick:()=>Fln,prefixIssues:()=>c6,primitiveTypes:()=>Ykt,promiseAllObject:()=>sns,propertyKeyTypes:()=>R3e,randomString:()=>ans,required:()=>Qln,safeExtend:()=>$ln,shallowClone:()=>BGe,slugify:()=>Wkt,stringifyPrimitive:()=>Zr,uint8ArrayToBase64:()=>qln,uint8ArrayToBase64url:()=>hns,uint8ArrayToHex:()=>gns,unwrapMessage:()=>T3e});function Xrs(t){return t}function Zrs(t){return t}function ens(t){}function tns(t){throw new Error("Unexpected value in exhaustive check")}function rns(t){}function D3e(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function ir(t,e="|"){return t.map(r=>Zr(r)).join(e)}function rie(t,e){return typeof e=="bigint"?e.toString():e}function nie(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function DM(t){return t==null}function I3e(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Vkt(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let u=n.match(/\d?e-(\d?)/);u?.[1]&&(o=Number.parseInt(u[1]))}let s=r>o?r:o,a=Number.parseInt(t.toFixed(s).replace(".","")),c=Number.parseInt(e.toFixed(s).replace(".",""));return a%c/10**s}function ta(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==Mln)return n===void 0&&(n=Mln,n=r()),n},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function nns(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function IM(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function $R(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function ins(t){return $R(t._zod.def)}function ons(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function sns(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<e.length;s++)o[e[s]]=n[s];return o})}function ans(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function OGe(t){return JSON.stringify(t)}function Wkt(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function jq(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function RM(t){if(jq(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(jq(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function BGe(t){return RM(t)?{...t}:Array.isArray(t)?[...t]:t}function cns(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}function ZC(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function HA(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function cn(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function uns(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,s){return e??(e=t()),Reflect.set(e,n,o,s)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function Zr(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Kkt(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function Fln(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=$R(t._zod.def,{get shape(){let a={};for(let c in e){if(!(c in r.shape))throw new Error(`Unrecognized key: "${c}"`);e[c]&&(a[c]=r.shape[c])}return IM(this,"shape",a),a},checks:[]});return HA(t,s)}function Lln(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=$R(t._zod.def,{get shape(){let a={...t._zod.def.shape};for(let c in e){if(!(c in r.shape))throw new Error(`Unrecognized key: "${c}"`);e[c]&&delete a[c]}return IM(this,"shape",a),a},checks:[]});return HA(t,s)}function Uln(t,e){if(!RM(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let s=t._zod.def.shape;for(let a in e)if(Object.getOwnPropertyDescriptor(s,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=$R(t._zod.def,{get shape(){let s={...t._zod.def.shape,...e};return IM(this,"shape",s),s}});return HA(t,o)}function $ln(t,e){if(!RM(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=$R(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e};return IM(this,"shape",n),n}});return HA(t,r)}function dns(t,e){let r=$R(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return IM(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return HA(t,r)}function jln(t,e,r){let o=e._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=$R(e._zod.def,{get shape(){let c=e._zod.def.shape,u={...c};if(r)for(let d in r){if(!(d in c))throw new Error(`Unrecognized key: "${d}"`);r[d]&&(u[d]=t?new t({type:"optional",innerType:c[d]}):c[d])}else for(let d in c)u[d]=t?new t({type:"optional",innerType:c[d]}):c[d];return IM(this,"shape",u),u},checks:[]});return HA(e,a)}function Qln(t,e,r){let n=$R(e._zod.def,{get shape(){let o=e._zod.def.shape,s={...o};if(r)for(let a in r){if(!(a in s))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(s[a]=new t({type:"nonoptional",innerType:o[a]}))}else for(let a in o)s[a]=new t({type:"nonoptional",innerType:o[a]});return IM(this,"shape",s),s}});return HA(e,n)}function kM(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function c6(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function T3e(t){return typeof t=="string"?t:t?.message}function iE(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=T3e(t.inst?._zod.def?.error?.(t))??T3e(e?.error?.(t))??T3e(r.customError?.(t))??T3e(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function k3e(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function O3e(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function on(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function iie(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function fns(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function Gln(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function qln(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function pns(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return Gln(e+r)}function hns(t){return qln(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function mns(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function gns(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var Mln,NGe,zkt,lns,R3e,Ykt,Jkt,Xkt,Hkt,Hi=G(()=>{Mln=Symbol("evaluating");NGe="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};zkt=nie(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});lns=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},R3e=new Set(["string","number","symbol"]),Ykt=new Set(["string","number","bigint","boolean","symbol","undefined"]);Jkt={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Xkt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};Hkt=class{constructor(...e){}}});function oie(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function sie(t,e=r=>r.message){let r={_errors:[]},n=o=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>n({issues:a}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)r._errors.push(e(s));else{let a=r,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(e(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return n(t),r}function PGe(t,e=r=>r.message){let r={errors:[]},n=(o,s=[])=>{var a,c;for(let u of o.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>n({issues:d},u.path));else if(u.code==="invalid_key")n({issues:u.issues},u.path);else if(u.code==="invalid_element")n({issues:u.issues},u.path);else{let d=[...s,...u.path];if(d.length===0){r.errors.push(e(u));continue}let f=r,p=0;for(;p<d.length;){let h=d[p],m=p===d.length-1;typeof h=="string"?(f.properties??(f.properties={}),(a=f.properties)[h]??(a[h]={errors:[]}),f=f.properties[h]):(f.items??(f.items=[]),(c=f.items)[h]??(c[h]={errors:[]}),f=f.items[h]),m&&f.errors.push(e(u)),p++}}};return n(t),r}function Vln(t){let e=[],r=t.map(n=>typeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?e.push(`[${n}]`):typeof n=="symbol"?e.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?e.push(`[${JSON.stringify(n)}]`):(e.length&&e.push("."),e.push(n));return e.join("")}function MGe(t){let e=[],r=[...t.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)e.push(`\u2716 ${n.message}`),n.path?.length&&e.push(` \u2192 at ${Vln(n.path)}`);return e.join(`
969
969
  `)}var Hln,N3e,oE,Zkt=G(()=>{tie();Hi();Hln=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,rie,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},N3e=Mt("$ZodError",Hln),oE=Mt("$ZodError",Hln,{Parent:Error})});var aie,cie,lie,uie,die,Qq,fie,pie,FGe,Wln,LGe,zln,UGe,Yln,$Ge,Kln,jGe,Jln,QGe,Xln,GGe,Zln,qGe,eun,eOt=G(()=>{tie();Zkt();Hi();aie=t=>(e,r,n,o)=>{let s=n?Object.assign(n,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new hx;if(a.issues.length){let c=new(o?.Err??t)(a.issues.map(u=>iE(u,s,wp())));throw NGe(c,o?.callee),c}return a.value},cie=aie(oE),lie=t=>async(e,r,n,o)=>{let s=n?Object.assign(n,{async:!0}):{async:!0},a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(o?.Err??t)(a.issues.map(u=>iE(u,s,wp())));throw NGe(c,o?.callee),c}return a.value},uie=lie(oE),die=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new hx;return s.issues.length?{success:!1,error:new(t??N3e)(s.issues.map(a=>iE(a,o,wp())))}:{success:!0,data:s.value}},Qq=die(oE),fie=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(a=>iE(a,o,wp())))}:{success:!0,data:s.value}},pie=fie(oE),FGe=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return aie(t)(e,r,o)},Wln=FGe(oE),LGe=t=>(e,r,n)=>aie(t)(e,r,n),zln=LGe(oE),UGe=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return lie(t)(e,r,o)},Yln=UGe(oE),$Ge=t=>async(e,r,n)=>lie(t)(e,r,n),Kln=$Ge(oE),jGe=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return die(t)(e,r,o)},Jln=jGe(oE),QGe=t=>(e,r,n)=>die(t)(e,r,n),Xln=QGe(oE),GGe=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return fie(t)(e,r,o)},Zln=GGe(oE),qGe=t=>async(e,r,n)=>fie(t)(e,r,n),eun=qGe(oE)});var sE={};Eo(sE,{base64:()=>gOt,base64url:()=>HGe,bigint:()=>bOt,boolean:()=>SOt,browserEmail:()=>wns,cidrv4:()=>hOt,cidrv6:()=>mOt,cuid:()=>tOt,cuid2:()=>rOt,date:()=>yOt,datetime:()=>EOt,domain:()=>Dns,duration:()=>aOt,e164:()=>AOt,email:()=>lOt,emoji:()=>uOt,extendedDuration:()=>yns,guid:()=>cOt,hex:()=>Ins,hostname:()=>Tns,html5Email:()=>bns,idnEmail:()=>Sns,integer:()=>COt,ipv4:()=>dOt,ipv6:()=>fOt,ksuid:()=>oOt,lowercase:()=>TOt,mac:()=>pOt,md5_base64:()=>kns,md5_base64url:()=>Ons,md5_hex:()=>Rns,nanoid:()=>sOt,null:()=>wOt,number:()=>VGe,rfc5322Email:()=>Cns,sha1_base64:()=>Bns,sha1_base64url:()=>Pns,sha1_hex:()=>Nns,sha256_base64:()=>Fns,sha256_base64url:()=>Lns,sha256_hex:()=>Mns,sha384_base64:()=>$ns,sha384_base64url:()=>jns,sha384_hex:()=>Uns,sha512_base64:()=>Gns,sha512_base64url:()=>qns,sha512_hex:()=>Qns,string:()=>vOt,time:()=>_Ot,ulid:()=>nOt,undefined:()=>xOt,unicodeEmail:()=>tun,uppercase:()=>DOt,uuid:()=>Gq,uuid4:()=>_ns,uuid6:()=>Ens,uuid7:()=>vns,xid:()=>iOt});function uOt(){return new RegExp(xns,"u")}function iun(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function _Ot(t){return new RegExp(`^${iun(t)}$`)}function EOt(t){let e=iun({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${nun}T(?:${n})$`)}function B3e(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function P3e(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var tOt,rOt,nOt,iOt,oOt,sOt,aOt,yns,cOt,Gq,_ns,Ens,vns,lOt,bns,Cns,tun,Sns,wns,xns,dOt,fOt,pOt,hOt,mOt,gOt,HGe,Tns,Dns,AOt,nun,yOt,vOt,bOt,COt,VGe,SOt,wOt,xOt,TOt,DOt,Ins,Rns,kns,Ons,Nns,Bns,Pns,Mns,Fns,Lns,Uns,$ns,jns,Qns,Gns,qns,WGe=G(()=>{Hi();tOt=/^[cC][^\s-]{8,}$/,rOt=/^[0-9a-z]+$/,nOt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,iOt=/^[0-9a-vA-V]{20}$/,oOt=/^[A-Za-z0-9]{27}$/,sOt=/^[a-zA-Z0-9_-]{21}$/,aOt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,yns=/^[-+]?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)?)??$/,cOt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Gq=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,_ns=Gq(4),Ens=Gq(6),vns=Gq(7),lOt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,bns=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Cns=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,tun=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Sns=tun,wns=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,xns="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";dOt=/^(?:(?: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])$/,fOt=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,pOt=t=>{let e=ZC(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},hOt=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,mOt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,gOt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,HGe=/^[A-Za-z0-9_-]*$/,Tns=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Dns=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,AOt=/^\+[1-9]\d{6,14}$/,nun="(?:(?:\\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])))",yOt=new RegExp(`^${nun}$`);vOt=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},bOt=/^-?\d+n?$/,COt=/^-?\d+$/,VGe=/^-?\d+(?:\.\d+)?$/,SOt=/^(?:true|false)$/i,wOt=/^null$/i,xOt=/^undefined$/i,TOt=/^[^A-Z]*$/,DOt=/^[^a-z]*$/,Ins=/^[0-9a-fA-F]*$/;Rns=/^[0-9a-fA-F]{32}$/,kns=B3e(22,"=="),Ons=P3e(22),Nns=/^[0-9a-fA-F]{40}$/,Bns=B3e(27,"="),Pns=P3e(27),Mns=/^[0-9a-fA-F]{64}$/,Fns=B3e(43,"="),Lns=P3e(43),Uns=/^[0-9a-fA-F]{96}$/,$ns=B3e(64,""),jns=P3e(64),Qns=/^[0-9a-fA-F]{128}$/,Gns=B3e(86,"=="),qns=P3e(86)});function oun(t,e,r){t.issues.length&&e.issues.push(...c6(r,t.issues))}var ju,sun,zGe,YGe,IOt,ROt,kOt,OOt,NOt,BOt,POt,MOt,FOt,hie,LOt,UOt,$Ot,jOt,QOt,GOt,qOt,HOt,VOt,KGe=G(()=>{tie();WGe();Hi();ju=Mt("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),sun={number:"number",bigint:"bigint",object:"date"},zGe=Mt("$ZodCheckLessThan",(t,e)=>{ju.init(t,e);let r=sun[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,s=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?o.maximum=e.value:o.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),YGe=Mt("$ZodCheckGreaterThan",(t,e)=>{ju.init(t,e);let r=sun[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,s=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),IOt=Mt("$ZodCheckMultipleOf",(t,e)=>{ju.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):Vkt(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),ROt=Mt("$ZodCheckNumberFormat",(t,e)=>{ju.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,s]=Jkt[e.format];t._zod.onattach.push(a=>{let c=a._zod.bag;c.format=e.format,c.minimum=o,c.maximum=s,r&&(c.pattern=COt)}),t._zod.check=a=>{let c=a.value;if(r){if(!Number.isInteger(c)){a.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:c,inst:t});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort}):a.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort});return}}c<o&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),c>s&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:t,continue:!e.abort})}}),kOt=Mt("$ZodCheckBigIntFormat",(t,e)=>{ju.init(t,e);let[r,n]=Xkt[e.format];t._zod.onattach.push(o=>{let s=o._zod.bag;s.format=e.format,s.minimum=r,s.maximum=n}),t._zod.check=o=>{let s=o.value;s<r&&o.issues.push({origin:"bigint",input:s,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),s>n&&o.issues.push({origin:"bigint",input:s,code:"too_big",maximum:n,inclusive:!0,inst:t,continue:!e.abort})}}),OOt=Mt("$ZodCheckMaxSize",(t,e)=>{var r;ju.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!DM(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;o.size<=e.maximum||n.issues.push({origin:k3e(o),code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),NOt=Mt("$ZodCheckMinSize",(t,e)=>{var r;ju.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!DM(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;o.size>=e.minimum||n.issues.push({origin:k3e(o),code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),BOt=Mt("$ZodCheckSizeEquals",(t,e)=>{var r;ju.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!DM(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.size,o.maximum=e.size,o.size=e.size}),t._zod.check=n=>{let o=n.value,s=o.size;if(s===e.size)return;let a=s>e.size;n.issues.push({origin:k3e(o),...a?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),POt=Mt("$ZodCheckMaxLength",(t,e)=>{var r;ju.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!DM(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;if(o.length<=e.maximum)return;let a=O3e(o);n.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),MOt=Mt("$ZodCheckMinLength",(t,e)=>{var r;ju.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!DM(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let a=O3e(o);n.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),FOt=Mt("$ZodCheckLengthEquals",(t,e)=>{var r;ju.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!DM(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,s=o.length;if(s===e.length)return;let a=O3e(o),c=s>e.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),hie=Mt("$ZodCheckStringFormat",(t,e)=>{var r,n;ju.init(t,e),t._zod.onattach.push(o=>{let s=o._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),LOt=Mt("$ZodCheckRegex",(t,e)=>{hie.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),UOt=Mt("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=TOt),hie.init(t,e)}),$Ot=Mt("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=DOt),hie.init(t,e)}),jOt=Mt("$ZodCheckIncludes",(t,e)=>{ju.init(t,e);let r=ZC(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),QOt=Mt("$ZodCheckStartsWith",(t,e)=>{ju.init(t,e);let r=new RegExp(`^${ZC(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),GOt=Mt("$ZodCheckEndsWith",(t,e)=>{ju.init(t,e);let r=new RegExp(`.*${ZC(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});qOt=Mt("$ZodCheckProperty",(t,e)=>{ju.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>oun(o,r,e.property));oun(n,r,e.property)}}),HOt=Mt("$ZodCheckMimeType",(t,e)=>{ju.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t,continue:!e.abort})}}),VOt=Mt("$ZodCheckOverwrite",(t,e)=>{ju.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}})});var M3e,WOt=G(()=>{M3e=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
970
970
  `).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),s=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(let a of s)this.content.push(a)}compile(){let e=Function,r=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new e(...r,o.join(`
971
971
  `))}}});var zOt,YOt=G(()=>{zOt={major:4,minor:3,patch:5}});function JOt(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}function _un(t){if(!HGe.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return JOt(r)}function Eun(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}function cun(t,e,r){t.issues.length&&e.issues.push(...c6(r,t.issues)),e.value[r]=t.value}function tqe(t,e,r,n,o){if(t.issues.length){if(o&&!(r in n))return;e.issues.push(...c6(r,t.issues))}t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function vun(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Kkt(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function bun(t,e,r,n,o,s){let a=[],c=o.keySet,u=o.catchall._zod,d=u.def.type,f=u.optout==="optional";for(let p in e){if(c.has(p))continue;if(d==="never"){a.push(p);continue}let h=u.run({value:e[p],issues:[]},n);h instanceof Promise?t.push(h.then(m=>tqe(m,r,p,e,f))):tqe(h,r,p,e,f)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:s}),t.length?Promise.all(t).then(()=>r):r}function lun(t,e,r,n){for(let s of t)if(s.issues.length===0)return e.value=s.value,e;let o=t.filter(s=>!kM(s));return o.length===1?(e.value=o[0].value,o[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(s=>s.issues.map(a=>iE(a,n,wp())))}),e)}function uun(t,e,r,n){let o=t.filter(s=>s.issues.length===0);return o.length===1?(e.value=o[0].value,e):(o.length===0?e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(s=>s.issues.map(a=>iE(a,n,wp())))}):e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:[],inclusive:!1}),e)}function KOt(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(RM(t)&&RM(e)){let r=Object.keys(e),n=Object.keys(t).filter(s=>r.indexOf(s)!==-1),o={...t,...e};for(let s of n){let a=KOt(t[s],e[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};o[s]=a.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let o=t[n],s=e[n],a=KOt(o,s);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function dun(t,e,r){let n=new Map,o;for(let c of e.issues)if(c.code==="unrecognized_keys"){o??(o=c);for(let u of c.keys)n.has(u)||n.set(u,{}),n.get(u).l=!0}else t.issues.push(c);for(let c of r.issues)if(c.code==="unrecognized_keys")for(let u of c.keys)n.has(u)||n.set(u,{}),n.get(u).r=!0;else t.issues.push(c);let s=[...n].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(s.length&&o&&t.issues.push({...o,keys:s}),kM(t))return t;let a=KOt(e.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return t.value=a.data,t}function JGe(t,e,r){t.issues.length&&e.issues.push(...c6(r,t.issues)),e.value[r]=t.value}function fun(t,e,r,n,o,s,a){t.issues.length&&(R3e.has(typeof n)?r.issues.push(...c6(n,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:s,issues:t.issues.map(c=>iE(c,a,wp()))})),e.issues.length&&(R3e.has(typeof n)?r.issues.push(...c6(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:s,key:n,issues:e.issues.map(c=>iE(c,a,wp()))})),r.value.set(t.value,e.value)}function pun(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}function hun(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}function mun(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}function gun(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}function XGe(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}function ZGe(t,e,r){if(t.issues.length)return t.aborted=!0,t;if((r.direction||"forward")==="forward"){let o=e.transform(t.value,t);return o instanceof Promise?o.then(s=>eqe(t,s,e.out,r)):eqe(t,o,e.out,r)}else{let o=e.reverseTransform(t.value,t);return o instanceof Promise?o.then(s=>eqe(t,s,e.in,r)):eqe(t,o,e.in,r)}}function eqe(t,e,r,n){return t.issues.length?(t.aborted=!0,t):r._zod.run({value:e,issues:t.issues},n)}function Aun(t){return t.value=Object.freeze(t.value),t}function yun(t,e,r,n){if(!t){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),e.issues.push(iie(o))}}var Jo,OM,_u,rqe,nqe,iqe,oqe,sqe,aqe,cqe,lqe,uqe,dqe,fqe,pqe,hqe,mqe,gqe,Aqe,yqe,_qe,Eqe,vqe,bqe,Cqe,Sqe,wqe,xqe,F3e,Tqe,mie,L3e,Dqe,Iqe,Rqe,kqe,Oqe,Nqe,Bqe,Pqe,Mqe,Fqe,XOt,ZOt,gie,Lqe,Uqe,$qe,U3e,jqe,Qqe,Gqe,qqe,Hqe,Vqe,Wqe,$3e,zqe,Yqe,Kqe,Jqe,Xqe,Zqe,eHe,tHe,rHe,Aie,nHe,iHe,oHe,sHe,aHe,cHe,eNt=G(()=>{KGe();tie();WOt();eOt();WGe();Hi();YOt();Hi();Jo=Mt("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=zOt;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let s of o._zod.onattach)s(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(a,c,u)=>{let d=kM(a),f;for(let p of c){if(p._zod.def.when){if(!p._zod.def.when(a))continue}else if(d)continue;let h=a.issues.length,m=p._zod.check(a);if(m instanceof Promise&&u?.async===!1)throw new hx;if(f||m instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await m,a.issues.length!==h&&(d||(d=kM(a,h)))});else{if(a.issues.length===h)continue;d||(d=kM(a,h))}}return f?f.then(()=>a):a},s=(a,c,u)=>{if(kM(a))return a.aborted=!0,a;let d=o(c,n,u);if(d instanceof Promise){if(u.async===!1)throw new hx;return d.then(f=>t._zod.parse(f,u))}return t._zod.parse(d,u)};t._zod.run=(a,c)=>{if(c.skipChecks)return t._zod.parse(a,c);if(c.direction==="backward"){let d=t._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return d instanceof Promise?d.then(f=>s(f,a,c)):s(d,a,c)}let u=t._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new hx;return u.then(d=>o(d,n,c))}return o(u,n,c)}}ta(t,"~standard",()=>({validate:o=>{try{let s=Qq(t,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return pie(t,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),OM=Mt("$ZodString",(t,e)=>{Jo.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??vOt(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),_u=Mt("$ZodStringFormat",(t,e)=>{hie.init(t,e),OM.init(t,e)}),rqe=Mt("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=cOt),_u.init(t,e)}),nqe=Mt("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Gq(n))}else e.pattern??(e.pattern=Gq());_u.init(t,e)}),iqe=Mt("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=lOt),_u.init(t,e)}),oqe=Mt("$ZodURL",(t,e)=>{_u.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),sqe=Mt("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=uOt()),_u.init(t,e)}),aqe=Mt("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=sOt),_u.init(t,e)}),cqe=Mt("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=tOt),_u.init(t,e)}),lqe=Mt("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=rOt),_u.init(t,e)}),uqe=Mt("$ZodULID",(t,e)=>{e.pattern??(e.pattern=nOt),_u.init(t,e)}),dqe=Mt("$ZodXID",(t,e)=>{e.pattern??(e.pattern=iOt),_u.init(t,e)}),fqe=Mt("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=oOt),_u.init(t,e)}),pqe=Mt("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=EOt(e)),_u.init(t,e)}),hqe=Mt("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=yOt),_u.init(t,e)}),mqe=Mt("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=_Ot(e)),_u.init(t,e)}),gqe=Mt("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=aOt),_u.init(t,e)}),Aqe=Mt("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=dOt),_u.init(t,e),t._zod.bag.format="ipv4"}),yqe=Mt("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=fOt),_u.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),_qe=Mt("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=pOt(e.delimiter)),_u.init(t,e),t._zod.bag.format="mac"}),Eqe=Mt("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=hOt),_u.init(t,e)}),vqe=Mt("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=mOt),_u.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,s]=n;if(!s)throw new Error;let a=Number(s);if(`${a}`!==s)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});bqe=Mt("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=gOt),_u.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{JOt(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});Cqe=Mt("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=HGe),_u.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{_un(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Sqe=Mt("$ZodE164",(t,e)=>{e.pattern??(e.pattern=AOt),_u.init(t,e)});wqe=Mt("$ZodJWT",(t,e)=>{_u.init(t,e),t._zod.check=r=>{Eun(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),xqe=Mt("$ZodCustomStringFormat",(t,e)=>{_u.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),F3e=Mt("$ZodNumber",(t,e)=>{Jo.init(t,e),t._zod.pattern=t._zod.bag.pattern??VGe,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...s?{received:s}:{}}),r}}),Tqe=Mt("$ZodNumberFormat",(t,e)=>{ROt.init(t,e),F3e.init(t,e)}),mie=Mt("$ZodBoolean",(t,e)=>{Jo.init(t,e),t._zod.pattern=SOt,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),r}}),L3e=Mt("$ZodBigInt",(t,e)=>{Jo.init(t,e),t._zod.pattern=bOt,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),Dqe=Mt("$ZodBigIntFormat",(t,e)=>{kOt.init(t,e),L3e.init(t,e)}),Iqe=Mt("$ZodSymbol",(t,e)=>{Jo.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:t}),r}}),Rqe=Mt("$ZodUndefined",(t,e)=>{Jo.init(t,e),t._zod.pattern=xOt,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:t}),r}}),kqe=Mt("$ZodNull",(t,e)=>{Jo.init(t,e),t._zod.pattern=wOt,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r}}),Oqe=Mt("$ZodAny",(t,e)=>{Jo.init(t,e),t._zod.parse=r=>r}),Nqe=Mt("$ZodUnknown",(t,e)=>{Jo.init(t,e),t._zod.parse=r=>r}),Bqe=Mt("$ZodNever",(t,e)=>{Jo.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),Pqe=Mt("$ZodVoid",(t,e)=>{Jo.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:t}),r}}),Mqe=Mt("$ZodDate",(t,e)=>{Jo.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,s=o instanceof Date;return s&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...s?{received:"Invalid Date"}:{},inst:t}),r}});Fqe=Mt("$ZodArray",(t,e)=>{Jo.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let s=[];for(let a=0;a<o.length;a++){let c=o[a],u=e.element._zod.run({value:c,issues:[]},n);u instanceof Promise?s.push(u.then(d=>cun(d,r,a))):cun(u,r,a)}return s.length?Promise.all(s).then(()=>r):r}});XOt=Mt("$ZodObject",(t,e)=>{if(Jo.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let c=e.shape;Object.defineProperty(e,"shape",{get:()=>{let u={...c};return Object.defineProperty(e,"shape",{value:u}),u}})}let n=nie(()=>vun(e));ta(t._zod,"propValues",()=>{let c=e.shape,u={};for(let d in c){let f=c[d]._zod;if(f.values){u[d]??(u[d]=new Set);for(let p of f.values)u[d].add(p)}}return u});let o=jq,s=e.catchall,a;t._zod.parse=(c,u)=>{a??(a=n.value);let d=c.value;if(!o(d))return c.issues.push({expected:"object",code:"invalid_type",input:d,inst:t}),c;c.value={};let f=[],p=a.shape;for(let h of a.keys){let m=p[h],g=m._zod.optout==="optional",A=m._zod.run({value:d[h],issues:[]},u);A instanceof Promise?f.push(A.then(y=>tqe(y,c,h,d,g))):tqe(A,c,h,d,g)}return s?bun(f,d,c,u,n.value,t):f.length?Promise.all(f).then(()=>c):c}}),ZOt=Mt("$ZodObjectJIT",(t,e)=>{XOt.init(t,e);let r=t._zod.parse,n=nie(()=>vun(e)),o=h=>{let m=new M3e(["shape","payload","ctx"]),g=n.value,A=b=>{let S=OGe(b);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};m.write("const input = payload.value;");let y=Object.create(null),E=0;for(let b of g.keys)y[b]=`key_${E++}`;m.write("const newResult = {};");for(let b of g.keys){let S=y[b],x=OGe(b),I=h[b]?._zod?.optout==="optional";m.write(`const ${S} = ${A(b)};`),I?m.write(`
@@ -1024,7 +1024,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
1024
1024
  `;break;case"id":c=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?n(parseInt(y,10)):r(new Tze(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:E}));break;default:r(new Tze(`Unknown field "${A.length>20?`${A.slice(0,20)}\u2026`:A}"`,{type:"unknown-field",field:A,value:y,line:E}));break}}function m(){u.length>0&&e({id:c,event:d||void 0,data:u.endsWith(`
1025
1025
  `)?u.slice(0,-1):u}),c=void 0,u="",d=""}function g(A={}){s&&A.consume&&p(s),a=!0,c=void 0,u="",d="",s=""}return{feed:f,reset:g}}function EAs(t){let e=[],r="",n=0;for(;n<t.length;){let o=t.indexOf("\r",n),s=t.indexOf(`
1026
1026
  `,n),a=-1;if(o!==-1&&s!==-1?a=Math.min(o,s):o!==-1?o===t.length-1?a=-1:a=o:s!==-1&&(a=s),a===-1){r=t.slice(n);break}else{let c=t.slice(n,a);e.push(c),n=a+1,t[n-1]==="\r"&&t[n]===`
1027
- `&&n++}}return[e,r]}var Tze,NUt=G(()=>{Tze=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 vAs(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function BUt(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(BUt).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${BUt(t.cause)}`:t.message:`${t}`}function o1n(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}function bAs(){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 Rze,a1n,QUt,Ka,Cg,Zf,ek,gE,TH,_oe,Ize,kze,W_e,boe,z_e,oF,Eoe,Coe,voe,H_e,Dx,PUt,MUt,FUt,s1n,LUt,UUt,V_e,$Ut,jUt,DH,c1n=G(()=>{NUt();Rze=class extends Event{constructor(e,r){var n,o;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(o=r?.message)!=null?o:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(o1n(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(o1n(this),r)}};a1n=t=>{throw TypeError(t)},QUt=(t,e,r)=>e.has(t)||a1n("Cannot "+r),Ka=(t,e,r)=>(QUt(t,e,"read from private field"),r?r.call(t):e.get(t)),Cg=(t,e,r)=>e.has(t)?a1n("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Zf=(t,e,r,n)=>(QUt(t,e,"write to private field"),e.set(t,r),r),ek=(t,e,r)=>(QUt(t,e,"access private method"),r),DH=class extends EventTarget{constructor(e,r){var n,o;super(),Cg(this,Dx),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Cg(this,gE),Cg(this,TH),Cg(this,_oe),Cg(this,Ize),Cg(this,kze),Cg(this,W_e),Cg(this,boe),Cg(this,z_e,null),Cg(this,oF),Cg(this,Eoe),Cg(this,Coe,null),Cg(this,voe,null),Cg(this,H_e,null),Cg(this,MUt,async s=>{var a;Ka(this,Eoe).reset();let{body:c,redirected:u,status:d,headers:f}=s;if(d===204){ek(this,Dx,V_e).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(u?Zf(this,_oe,new URL(s.url)):Zf(this,_oe,void 0),d!==200){ek(this,Dx,V_e).call(this,`Non-200 status code (${d})`,d);return}if(!(f.get("content-type")||"").startsWith("text/event-stream")){ek(this,Dx,V_e).call(this,'Invalid content type, expected "text/event-stream"',d);return}if(Ka(this,gE)===this.CLOSED)return;Zf(this,gE,this.OPEN);let p=new Event("open");if((a=Ka(this,H_e))==null||a.call(this,p),this.dispatchEvent(p),typeof c!="object"||!c||!("getReader"in c)){ek(this,Dx,V_e).call(this,"Invalid response body, expected a web ReadableStream",d),this.close();return}let h=new TextDecoder,m=c.getReader(),g=!0;do{let{done:A,value:y}=await m.read();y&&Ka(this,Eoe).feed(h.decode(y,{stream:!A})),A&&(g=!1,Ka(this,Eoe).reset(),ek(this,Dx,$Ut).call(this))}while(g)}),Cg(this,FUt,s=>{Zf(this,oF,void 0),!(s.name==="AbortError"||s.type==="aborted")&&ek(this,Dx,$Ut).call(this,BUt(s))}),Cg(this,LUt,s=>{typeof s.id=="string"&&Zf(this,z_e,s.id);let a=new MessageEvent(s.event||"message",{data:s.data,origin:Ka(this,_oe)?Ka(this,_oe).origin:Ka(this,TH).origin,lastEventId:s.id||""});Ka(this,voe)&&(!s.event||s.event==="message")&&Ka(this,voe).call(this,a),this.dispatchEvent(a)}),Cg(this,UUt,s=>{Zf(this,W_e,s)}),Cg(this,jUt,()=>{Zf(this,boe,void 0),Ka(this,gE)===this.CONNECTING&&ek(this,Dx,PUt).call(this)});try{if(e instanceof URL)Zf(this,TH,e);else if(typeof e=="string")Zf(this,TH,new URL(e,bAs()));else throw new Error("Invalid URL")}catch{throw vAs("An invalid or illegal string was specified")}Zf(this,Eoe,Dze({onEvent:Ka(this,LUt),onRetry:Ka(this,UUt)})),Zf(this,gE,this.CONNECTING),Zf(this,W_e,3e3),Zf(this,kze,(n=r?.fetch)!=null?n:globalThis.fetch),Zf(this,Ize,(o=r?.withCredentials)!=null?o:!1),ek(this,Dx,PUt).call(this)}get readyState(){return Ka(this,gE)}get url(){return Ka(this,TH).href}get withCredentials(){return Ka(this,Ize)}get onerror(){return Ka(this,Coe)}set onerror(e){Zf(this,Coe,e)}get onmessage(){return Ka(this,voe)}set onmessage(e){Zf(this,voe,e)}get onopen(){return Ka(this,H_e)}set onopen(e){Zf(this,H_e,e)}addEventListener(e,r,n){let o=r;super.addEventListener(e,o,n)}removeEventListener(e,r,n){let o=r;super.removeEventListener(e,o,n)}close(){Ka(this,boe)&&clearTimeout(Ka(this,boe)),Ka(this,gE)!==this.CLOSED&&(Ka(this,oF)&&Ka(this,oF).abort(),Zf(this,gE,this.CLOSED),Zf(this,oF,void 0))}};gE=new WeakMap,TH=new WeakMap,_oe=new WeakMap,Ize=new WeakMap,kze=new WeakMap,W_e=new WeakMap,boe=new WeakMap,z_e=new WeakMap,oF=new WeakMap,Eoe=new WeakMap,Coe=new WeakMap,voe=new WeakMap,H_e=new WeakMap,Dx=new WeakSet,PUt=function(){Zf(this,gE,this.CONNECTING),Zf(this,oF,new AbortController),Ka(this,kze)(Ka(this,TH),ek(this,Dx,s1n).call(this)).then(Ka(this,MUt)).catch(Ka(this,FUt))},MUt=new WeakMap,FUt=new WeakMap,s1n=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ka(this,z_e)?{"Last-Event-ID":Ka(this,z_e)}:void 0},cache:"no-store",signal:(t=Ka(this,oF))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},LUt=new WeakMap,UUt=new WeakMap,V_e=function(t,e){var r;Ka(this,gE)!==this.CLOSED&&Zf(this,gE,this.CLOSED);let n=new Rze("error",{code:e,message:t});(r=Ka(this,Coe))==null||r.call(this,n),this.dispatchEvent(n)},$Ut=function(t,e){var r;if(Ka(this,gE)===this.CLOSED)return;Zf(this,gE,this.CONNECTING);let n=new Rze("error",{code:e,message:t});(r=Ka(this,Coe))==null||r.call(this,n),this.dispatchEvent(n),Zf(this,boe,setTimeout(Ka(this,jUt),Ka(this,W_e)))},jUt=new WeakMap,DH.CONNECTING=0,DH.OPEN=1,DH.CLOSED=2});function Soe(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function Oze(t=fetch,e){return e?async(r,n)=>{let o={...e,...n,headers:n?.headers?{...Soe(e.headers),...Soe(n.headers)}:e.headers};return t(r,o)}:t}var GUt=G(()=>{});async function CAs(t){return(await qUt).getRandomValues(new Uint8Array(t))}async function SAs(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=Math.pow(2,8)-Math.pow(2,8)%e.length,n="";for(;n.length<t;){let o=await CAs(t-n.length);for(let s of o)s<r&&(n+=e[s%e.length])}return n}async function wAs(t){return await SAs(t)}async function xAs(t){let e=await(await qUt).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function HUt(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await wAs(t),r=await xAs(e);return{code_verifier:e,code_challenge:r}}var qUt,l1n=G(()=>{qUt=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto)});var r2,d1n,VUt,TAs,f1n,p1n,h1n,u1n,DAs,IAs,m1n,eel,tel,WUt=G(()=>{ePt();r2=gVe().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:XBt.custom,message:"URL must be parseable",fatal:!0}),eie}).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"}),d1n=jh({resource:wt().url(),authorization_servers:yn(r2).optional(),jwks_uri:wt().url().optional(),scopes_supported:yn(wt()).optional(),bearer_methods_supported:yn(wt()).optional(),resource_signing_alg_values_supported:yn(wt()).optional(),resource_name:wt().optional(),resource_documentation:wt().optional(),resource_policy_uri:wt().url().optional(),resource_tos_uri:wt().url().optional(),tls_client_certificate_bound_access_tokens:zl().optional(),authorization_details_types_supported:yn(wt()).optional(),dpop_signing_alg_values_supported:yn(wt()).optional(),dpop_bound_access_tokens_required:zl().optional()}),VUt=jh({issuer:wt(),authorization_endpoint:r2,token_endpoint:r2,registration_endpoint:r2.optional(),scopes_supported:yn(wt()).optional(),response_types_supported:yn(wt()),response_modes_supported:yn(wt()).optional(),grant_types_supported:yn(wt()).optional(),token_endpoint_auth_methods_supported:yn(wt()).optional(),token_endpoint_auth_signing_alg_values_supported:yn(wt()).optional(),service_documentation:r2.optional(),revocation_endpoint:r2.optional(),revocation_endpoint_auth_methods_supported:yn(wt()).optional(),revocation_endpoint_auth_signing_alg_values_supported:yn(wt()).optional(),introspection_endpoint:wt().optional(),introspection_endpoint_auth_methods_supported:yn(wt()).optional(),introspection_endpoint_auth_signing_alg_values_supported:yn(wt()).optional(),code_challenge_methods_supported:yn(wt()).optional(),client_id_metadata_document_supported:zl().optional()}),TAs=jh({issuer:wt(),authorization_endpoint:r2,token_endpoint:r2,userinfo_endpoint:r2.optional(),jwks_uri:r2,registration_endpoint:r2.optional(),scopes_supported:yn(wt()).optional(),response_types_supported:yn(wt()),response_modes_supported:yn(wt()).optional(),grant_types_supported:yn(wt()).optional(),acr_values_supported:yn(wt()).optional(),subject_types_supported:yn(wt()),id_token_signing_alg_values_supported:yn(wt()),id_token_encryption_alg_values_supported:yn(wt()).optional(),id_token_encryption_enc_values_supported:yn(wt()).optional(),userinfo_signing_alg_values_supported:yn(wt()).optional(),userinfo_encryption_alg_values_supported:yn(wt()).optional(),userinfo_encryption_enc_values_supported:yn(wt()).optional(),request_object_signing_alg_values_supported:yn(wt()).optional(),request_object_encryption_alg_values_supported:yn(wt()).optional(),request_object_encryption_enc_values_supported:yn(wt()).optional(),token_endpoint_auth_methods_supported:yn(wt()).optional(),token_endpoint_auth_signing_alg_values_supported:yn(wt()).optional(),display_values_supported:yn(wt()).optional(),claim_types_supported:yn(wt()).optional(),claims_supported:yn(wt()).optional(),service_documentation:wt().optional(),claims_locales_supported:yn(wt()).optional(),ui_locales_supported:yn(wt()).optional(),claims_parameter_supported:zl().optional(),request_parameter_supported:zl().optional(),request_uri_parameter_supported:zl().optional(),require_request_uri_registration:zl().optional(),op_policy_uri:r2.optional(),op_tos_uri:r2.optional(),client_id_metadata_document_supported:zl().optional()}),f1n=wn({...TAs.shape,...VUt.pick({code_challenge_methods_supported:!0}).shape}),p1n=wn({access_token:wt(),id_token:wt().optional(),token_type:wt(),expires_in:Rye.number().optional(),scope:wt().optional(),refresh_token:wt().optional()}).strip(),h1n=wn({error:wt(),error_description:wt().optional(),error_uri:wt().optional()}),u1n=r2.optional().or(Bi("").transform(()=>{})),DAs=wn({redirect_uris:yn(r2),token_endpoint_auth_method:wt().optional(),grant_types:yn(wt()).optional(),response_types:yn(wt()).optional(),client_name:wt().optional(),client_uri:r2.optional(),logo_uri:u1n,scope:wt().optional(),contacts:yn(wt()).optional(),tos_uri:u1n,policy_uri:wt().optional(),jwks_uri:r2.optional(),jwks:NVe().optional(),software_id:wt().optional(),software_version:wt().optional(),software_statement:wt().optional()}).strip(),IAs=wn({client_id:wt(),client_secret:wt().optional(),client_id_issued_at:hc().optional(),client_secret_expires_at:hc().optional()}).strip(),m1n=DAs.merge(IAs),eel=wn({error:wt(),error_description:wt().optional()}).strip(),tel=wn({token:wt(),token_type_hint:wt().optional()}).strip()});function g1n(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function A1n({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 o=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return o.startsWith(s)}var y1n=G(()=>{});var qh,Y_e,IH,RH,kH,K_e,J_e,X_e,tk,Z_e,eEe,tEe,rEe,nEe,iEe,OH,oEe,sEe,_1n,E1n=G(()=>{qh=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}},Y_e=class extends qh{};Y_e.errorCode="invalid_request";IH=class extends qh{};IH.errorCode="invalid_client";RH=class extends qh{};RH.errorCode="invalid_grant";kH=class extends qh{};kH.errorCode="unauthorized_client";K_e=class extends qh{};K_e.errorCode="unsupported_grant_type";J_e=class extends qh{};J_e.errorCode="invalid_scope";X_e=class extends qh{};X_e.errorCode="access_denied";tk=class extends qh{};tk.errorCode="server_error";Z_e=class extends qh{};Z_e.errorCode="temporarily_unavailable";eEe=class extends qh{};eEe.errorCode="unsupported_response_type";tEe=class extends qh{};tEe.errorCode="unsupported_token_type";rEe=class extends qh{};rEe.errorCode="invalid_token";nEe=class extends qh{};nEe.errorCode="method_not_allowed";iEe=class extends qh{};iEe.errorCode="too_many_requests";OH=class extends qh{};OH.errorCode="invalid_client_metadata";oEe=class extends qh{};oEe.errorCode="insufficient_scope";sEe=class extends qh{};sEe.errorCode="invalid_target";_1n={[Y_e.errorCode]:Y_e,[IH.errorCode]:IH,[RH.errorCode]:RH,[kH.errorCode]:kH,[K_e.errorCode]:K_e,[J_e.errorCode]:J_e,[X_e.errorCode]:X_e,[tk.errorCode]:tk,[Z_e.errorCode]:Z_e,[eEe.errorCode]:eEe,[tEe.errorCode]:tEe,[rEe.errorCode]:rEe,[nEe.errorCode]:nEe,[iEe.errorCode]:iEe,[OH.errorCode]:OH,[oEe.errorCode]:oEe,[sEe.errorCode]:sEe}});function RAs(t){return["client_secret_basic","client_secret_post","none"].includes(t)}function kAs(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&&RAs(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 OAs(t,e,r,n){let{client_id:o,client_secret:s}=e;switch(t){case"client_secret_basic":NAs(o,s,r);return;case"client_secret_post":BAs(o,s,n);return;case"none":PAs(o,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function NAs(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 BAs(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function PAs(t,e){e.set("client_id",t)}async function b1n(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=h1n.parse(JSON.parse(r)),{error:o,error_description:s,error_uri:a}=n,c=_1n[o]||tk;return new c(s||"",a)}catch(n){let o=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new tk(o)}}async function rk(t,e){try{return await KUt(t,e)}catch(r){if(r instanceof IH||r instanceof kH)return await t.invalidateCredentials?.("all"),await KUt(t,e);if(r instanceof RH)return await t.invalidateCredentials?.("tokens"),await KUt(t,e);throw r}}async function KUt(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:o,fetchFn:s}){let a,c;try{a=await LAs(e,{resourceMetadataUrl:o},s),a.authorization_servers&&a.authorization_servers.length>0&&(c=a.authorization_servers[0])}catch{}c||(c=new URL("/",e));let u=await FAs(e,t,a),d=await GAs(c,{fetchFn:s}),f=await Promise.resolve(t.clientInformation());if(!f){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let y=d?.client_id_metadata_document_supported===!0,E=t.clientMetadataUrl;if(E&&!MAs(E))throw new OH(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${E}`);if(y&&E)f={client_id:E},await t.saveClientInformation?.(f);else{if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let b=await VAs(c,{metadata:d,clientMetadata:t.clientMetadata,fetchFn:s});await t.saveClientInformation(b),f=b}}let p=!t.redirectUrl;if(r!==void 0||p){let y=await HAs(t,c,{metadata:d,resource:u,authorizationCode:r,fetchFn:s});return await t.saveTokens(y),"AUTHORIZED"}let h=await t.tokens();if(h?.refresh_token)try{let y=await e$t(c,{metadata:d,clientInformation:f,refreshToken:h.refresh_token,resource:u,addClientAuthentication:t.addClientAuthentication,fetchFn:s});return await t.saveTokens(y),"AUTHORIZED"}catch(y){if(!(!(y instanceof qh)||y instanceof tk))throw y}let m=t.state?await t.state():void 0,{authorizationUrl:g,codeVerifier:A}=await qAs(c,{metadata:d,clientInformation:f,state:m,redirectUrl:t.redirectUrl,scope:n||a?.scopes_supported?.join(" ")||t.clientMetadata.scope,resource:u});return await t.saveCodeVerifier(A),await t.redirectToAuthorization(g),"REDIRECT"}function MAs(t){if(!t)return!1;try{let e=new URL(t);return e.protocol==="https:"&&e.pathname!=="/"}catch{return!1}}async function FAs(t,e,r){let n=g1n(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!A1n({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 woe(t){let e=t.headers.get("WWW-Authenticate");if(!e)return{};let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let o=JUt(t,"resource_metadata")||void 0,s;if(o)try{s=new URL(o)}catch{}let a=JUt(t,"scope")||void 0,c=JUt(t,"error")||void 0;return{resourceMetadataUrl:s,scope:a,error:c}}function JUt(t,e){let r=t.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${e}=(?:"([^"]+)"|([^\\s,]+))`),o=r.match(n);return o?o[1]||o[2]:null}async function LAs(t,e,r=fetch){let n=await jAs(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw await n?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw await n.body?.cancel(),new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return d1n.parse(await n.json())}async function XUt(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?XUt(t,void 0,r):void 0;throw n}}function UAs(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function v1n(t,e,r=fetch){return await XUt(t,{"MCP-Protocol-Version":e},r)}function $As(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function jAs(t,e,r,n){let o=new URL(t),s=n?.protocolVersion??Mie,a;if(n?.metadataUrl)a=new URL(n.metadataUrl);else{let u=UAs(e,o.pathname);a=new URL(u,n?.metadataServerUrl??o),a.search=o.search}let c=await v1n(a,s,r);if(!n?.metadataUrl&&$As(c,o.pathname)){let u=new URL(`/.well-known/${e}`,o);c=await v1n(u,s,r)}return c}function QAs(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 o=e.pathname;return o.endsWith("/")&&(o=o.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${o}`,e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${o}`,e.origin),type:"oidc"}),n.push({url:new URL(`${o}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function GAs(t,{fetchFn:e=fetch,protocolVersion:r=Mie}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},o=QAs(t);for(let{url:s,type:a}of o){let c=await XUt(s,n,e);if(c){if(!c.ok){if(await c.body?.cancel(),c.status>=400&&c.status<500)continue;throw new Error(`HTTP ${c.status} trying to load ${a==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}return a==="oauth"?VUt.parse(await c.json()):f1n.parse(await c.json())}}}async function qAs(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:o,state:s,resource:a}){let c;if(e){if(c=new URL(e.authorization_endpoint),!e.response_types_supported.includes(zUt))throw new Error(`Incompatible auth server: does not support response type ${zUt}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(YUt))throw new Error(`Incompatible auth server: does not support code challenge method ${YUt}`)}else c=new URL("/authorize",t);let u=await HUt(),d=u.code_verifier,f=u.code_challenge;return c.searchParams.set("response_type",zUt),c.searchParams.set("client_id",r.client_id),c.searchParams.set("code_challenge",f),c.searchParams.set("code_challenge_method",YUt),c.searchParams.set("redirect_uri",String(n)),s&&c.searchParams.set("state",s),o&&c.searchParams.set("scope",o),o?.includes("offline_access")&&c.searchParams.append("prompt","consent"),a&&c.searchParams.set("resource",a.href),{authorizationUrl:c,codeVerifier:d}}function C1n(t,e,r){return new URLSearchParams({grant_type:"authorization_code",code:t,code_verifier:e,redirect_uri:String(r)})}async function ZUt(t,{metadata:e,tokenRequestParams:r,clientInformation:n,addClientAuthentication:o,resource:s,fetchFn:a}){let c=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t),u=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s&&r.set("resource",s.href),o)await o(u,r,c,e);else if(n){let f=e?.token_endpoint_auth_methods_supported??[],p=kAs(n,f);OAs(p,n,u,r)}let d=await(a??fetch)(c,{method:"POST",headers:u,body:r});if(!d.ok)throw await b1n(d);return p1n.parse(await d.json())}async function S1n(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:o,redirectUri:s,resource:a,addClientAuthentication:c,fetchFn:u}){let d=C1n(n,o,s);return ZUt(t,{metadata:e,tokenRequestParams:d,clientInformation:r,addClientAuthentication:c,resource:a,fetchFn:u})}async function e$t(t,{metadata:e,clientInformation:r,refreshToken:n,resource:o,addClientAuthentication:s,fetchFn:a}){let c=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),u=await ZUt(t,{metadata:e,tokenRequestParams:c,clientInformation:r,addClientAuthentication:s,resource:o,fetchFn:a});return{refresh_token:n,...u}}async function HAs(t,e,{metadata:r,resource:n,authorizationCode:o,fetchFn:s}={}){let a=t.clientMetadata.scope,c;if(t.prepareTokenRequest&&(c=await t.prepareTokenRequest(a)),!c){if(!o)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let d=await t.codeVerifier();c=C1n(o,d,t.redirectUrl)}let u=await t.clientInformation();return ZUt(e,{metadata:r,tokenRequestParams:c,clientInformation:u??void 0,addClientAuthentication:t.addClientAuthentication,resource:n,fetchFn:s})}async function VAs(t,{metadata:e,clientMetadata:r,fetchFn:n}){let o;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");o=new URL(e.registration_endpoint)}else o=new URL("/register",t);let s=await(n??fetch)(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!s.ok)throw await b1n(s);return m1n.parse(await s.json())}var fy,zUt,YUt,Nze=G(()=>{l1n();GR();WUt();WUt();y1n();E1n();fy=class extends Error{constructor(e){super(e??"Unauthorized")}};zUt="code",YUt="S256"});var t$t,xoe,w1n=G(()=>{c1n();GUt();GR();Nze();t$t=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},xoe=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,this._fetchWithInit=Oze(r?.fetch,r?.requestInit)}async _authThenStart(){if(!this._authProvider)throw new fy("No auth provider");let e;try{e=await rk(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(e!=="AUTHORIZED")throw new fy;return await this._startOrAuth()}async _commonHeaders(){let e={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(e.Authorization=`Bearer ${n.access_token}`)}this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);let r=Soe(this._requestInit?.headers);return new Headers({...e,...r})}_startOrAuth(){let e=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((r,n)=>{this._eventSource=new DH(this._url.href,{...this._eventSourceInit,fetch:async(o,s)=>{let a=await this._commonHeaders();a.set("Accept","text/event-stream");let c=await e(o,{...s,headers:a});if(c.status===401&&c.headers.has("www-authenticate")){let{resourceMetadataUrl:u,scope:d}=woe(c);this._resourceMetadataUrl=u,this._scope=d}return c}}),this._abortController=new AbortController,this._eventSource.onerror=o=>{if(o.code===401&&this._authProvider){this._authThenStart().then(r,n);return}let s=new t$t(o.code,o.message,o);n(s),this.onerror?.(s)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",o=>{let s=o;try{if(this._endpoint=new URL(s.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(a){n(a),this.onerror?.(a),this.close();return}r()}),this._eventSource.onmessage=o=>{let s=o,a;try{a=jM.parse(JSON.parse(s.data))}catch(c){this.onerror?.(c);return}this.onmessage?.(a)}})}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 fy("No auth provider");if(await rk(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new fy("Failed to authorize")}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(e){if(!this._endpoint)throw new Error("Not connected");try{let r=await this._commonHeaders();r.set("content-type","application/json");let n={...this._requestInit,method:"POST",headers:r,body:JSON.stringify(e),signal:this._abortController?.signal},o=await(this._fetch??fetch)(this._endpoint,n);if(!o.ok){let s=await o.text().catch(()=>null);if(o.status===401&&this._authProvider){let{resourceMetadataUrl:a,scope:c}=woe(o);if(this._resourceMetadataUrl=a,this._scope=c,await rk(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new fy;return this.send(e)}throw new Error(`Error POSTing to endpoint (HTTP ${o.status}): ${s}`)}await o.body?.cancel()}catch(r){throw this.onerror?.(r),r}}setProtocolVersion(e){this._protocolVersion=e}}});var Bze,x1n=G(()=>{NUt();Bze=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let o;super({start(s){o=Dze({onEvent:a=>{s.enqueue(a)},onError(a){e==="terminate"?s.error(a):typeof e=="function"&&e(a)},onRetry:r,onComment:n})},transform(s){o.feed(s)}})}}});var WAs,sF,aF,r$t=G(()=>{GUt();GR();Nze();x1n();WAs={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},sF=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},aF=class{constructor(e,r){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._fetchWithInit=Oze(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??WAs}async _authThenStart(){if(!this._authProvider)throw new fy("No auth provider");let e;try{e=await rk(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(e!=="AUTHORIZED")throw new fy;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(e.Authorization=`Bearer ${n.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);let r=Soe(this._requestInit?.headers);return new Headers({...e,...r})}async _startOrAuthSse(e){let{resumptionToken:r}=e;try{let n=await this._commonHeaders();n.set("Accept","text/event-stream"),r&&n.set("last-event-id",r);let o=await(this._fetch??fetch)(this._url,{method:"GET",headers:n,signal:this._abortController?.signal});if(!o.ok){if(await o.body?.cancel(),o.status===401&&this._authProvider)return await this._authThenStart();if(o.status===405)return;throw new sF(o.status,`Failed to open SSE stream: ${o.statusText}`)}this._handleSseStream(o.body,e,!0)}catch(n){throw this.onerror?.(n),n}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),o)}_scheduleReconnection(e,r=0){let n=this._reconnectionOptions.maxRetries;if(r>=n){this.onerror?.(new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let o=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(s=>{this.onerror?.(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:o,replayMessageId:s}=r,a,c=!1,u=!1;(async()=>{try{let f=e.pipeThrough(new TextDecoderStream).pipeThrough(new Bze({onRetry:m=>{this._serverRetryMs=m}})).getReader();for(;;){let{value:m,done:g}=await f.read();if(g)break;if(m.id&&(a=m.id,c=!0,o?.(m.id)),!!m.data&&(!m.event||m.event==="message"))try{let A=jM.parse(JSON.parse(m.data));nH(A)&&(u=!0,s!==void 0&&(A.id=s)),this.onmessage?.(A)}catch(A){this.onerror?.(A)}}(n||c)&&!u&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:a,onresumptiontoken:o,replayMessageId:s},0)}catch(f){if(this.onerror?.(new Error(`SSE stream disconnected: ${f}`)),(n||c)&&!u&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:a,onresumptiontoken:o,replayMessageId:s},0)}catch(m){this.onerror?.(new Error(`Failed to reconnect: ${m instanceof Error?m.message:String(m)}`))}}})()}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 fy("No auth provider");if(await rk(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new fy("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,r){try{let{resumptionToken:n,onresumptiontoken:o}=r||{};if(n){this._startOrAuthSse({resumptionToken:n,replayMessageId:Nye(e)?e.id:void 0}).catch(h=>this.onerror?.(h));return}let s=await this._commonHeaders();s.set("content-type","application/json"),s.set("accept","application/json, text/event-stream");let a={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(e),signal:this._abortController?.signal},c=await(this._fetch??fetch)(this._url,a),u=c.headers.get("mcp-session-id");if(u&&(this._sessionId=u),!c.ok){let h=await c.text().catch(()=>null);if(c.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new sF(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:m,scope:g}=woe(c);if(this._resourceMetadataUrl=m,this._scope=g,await rk(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new fy;return this._hasCompletedAuthFlow=!0,this.send(e)}if(c.status===403&&this._authProvider){let{resourceMetadataUrl:m,scope:g,error:A}=woe(c);if(A==="insufficient_scope"){let y=c.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===y)throw new sF(403,"Server returned 403 after trying upscoping");if(g&&(this._scope=g),m&&(this._resourceMetadataUrl=m),this._lastUpscopingHeader=y??void 0,await rk(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new fy;return this.send(e)}}throw new sF(c.status,`Error POSTing to endpoint: ${h}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,c.status===202){await c.body?.cancel(),Vpn(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(h=>this.onerror?.(h));return}let f=(Array.isArray(e)?e:[e]).filter(h=>"method"in h&&"id"in h&&h.id!==void 0).length>0,p=c.headers.get("content-type");if(f)if(p?.includes("text/event-stream"))this._handleSseStream(c.body,{onresumptiontoken:o},!1);else if(p?.includes("application/json")){let h=await c.json(),m=Array.isArray(h)?h.map(g=>jM.parse(g)):[jM.parse(h)];for(let g of m)this.onmessage?.(g)}else throw await c.body?.cancel(),new sF(-1,`Unexpected content type: ${p}`);else await c.body?.cancel()}catch(n){throw this.onerror?.(n),n}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),r={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},n=await(this._fetch??fetch)(this._url,r);if(await n.body?.cancel(),!n.ok&&n.status!==405)throw new sF(n.status,`Failed to terminate session: ${n.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r?.onresumptiontoken})}}});import{readFile as zAs}from"node:fs/promises";var aEe,cEe,NH,n$t=G(()=>{"use strict";Gge();Nze();ai();(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"})(aEe||(aEe={}));cEe=class extends Error{code;constructor(e,r){super(r),this.code=e}},NH=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||BQ.default}async start(){if(this._isClosed)throw new Error(R.t("websocketClient.errors.transportClosed"));let e=null;if(this._authProvider)try{let o=await this._authProvider.tokens();o?.access_token&&(e=o.access_token)}catch(o){try{let s=await this._authProvider.clientInformation();if(s){let a=await this._authProvider.tokens();if(a?.refresh_token){let c=await e$t(this._url,{clientInformation:s,refreshToken:a.refresh_token,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(c),c?.access_token&&(e=c.access_token)}}}catch{if(this._authProvider.redirectToAuthorization){let s=this._authProvider.redirectUrl;throw s?(await this._authProvider.redirectToAuthorization(typeof s=="string"?new URL(s):s),new Error(R.t("websocketClient.errors.unauthorizedOAuth"))):new Error("Redirect URL is required for authorization")}throw o}}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((o,s)=>{try{let a={headers:r};this._websocket=new this._WebSocket(n.toString(),a),this._websocket.on("open",()=>{o()}),this._websocket.on("error",c=>{let u=c.code!==void 0?c.code:void 0;s(new cEe(u,`WebSocket error: ${c.message}`))}),this._websocket.on("message",async c=>{try{let u=c.toString(),d=JSON.parse(u);if(this._specialIds.has(Number(d.id))||d.type==="welcome")return;this.onmessage?.(await this._transformResponse(d))}catch(u){this.onerror?.(new Error(`Failed to parse WebSocket message: ${u instanceof Error?u.message:String(u)}`))}}),this._websocket.on("close",()=>{this._isClosed||(this._isClosed=!0,this.onclose?.())})}catch(a){s(new cEe(void 0,`Failed to create WebSocket: ${a}`))}})}async finishAuth(e){if(!this._authProvider)throw new Error(R.t("websocketClient.errors.noAuthProvider"));try{let r=await this._authProvider.clientInformation();if(r){let n=this._authProvider.redirectUrl;if(!n)throw new Error("Redirect URL is required for authorization");let o=typeof n=="string"?n:n.toString(),s=await S1n(this._url,{clientInformation:r,authorizationCode:e,codeVerifier:await this._authProvider.codeVerifier(),redirectUri:o,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(s)}else throw new Error(R.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===BQ.default.OPEN?this._websocket.close():this.onclose?.()}async send(e){if(this._isClosed)throw new Error(R.t("websocketClient.errors.transportClosed"));if(!this._websocket)throw new Error(R.t("websocketClient.errors.transportNotStarted"));if(this._websocket.readyState!==BQ.default.OPEN)throw new Error(R.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 cEe(void 0,`Failed to send message: ${r instanceof Error?r.message:String(r)}`)}}async _transformRequest(e){if(e.method==="initialize")return{type:aEe.CLI_CONNECT,id:e.id,timestamp:Date.now(),payload:{clientInfo:{version:"0.5.1-beta-20260113143539",platform:process.platform,workingDirectory:process.cwd()}}};if(e.method==="tools/call"&&e.params?.name==="openDiff"){let{arguments:r}=e.params||{},{filePath:n,newContent:o}=r||{};return{type:aEe.SHOW_DIFF,id:e.id,timestamp:Date.now(),payload:{filePath:n,originalText:await zAs(n,"utf8"),modifiedText:o}}}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:aEe.GET_SELECTED_TEXT,id:e,timestamp:Date.now()})),new Promise((r,n)=>{this._websocket.once("message",o=>{try{let s=JSON.parse(o.toString());Number(s.id)===e&&(this._specialIds.delete(e),s.payload.success?r(s.payload.data.text):n(s.payload.error))}catch{r("")}})})}setProtocolVersion(e){this._protocolVersion=e}}});var D1n=T((Iel,T1n)=>{"use strict";T1n.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 P1n=T((Rel,B1n)=>{"use strict";var N1n="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",I1n=new RegExp("^"+N1n+"$"),R1n="|&;()<> \\t",YAs='"((\\\\"|[^"])*?)"',KAs="'((\\\\'|[^'])*?)'",JAs=/^#$/,k1n="'",O1n='"',i$t="$",BH="",XAs=4294967296;for(o$t=0;o$t<4;o$t++)BH+=(XAs*Math.random()).toString(16);var o$t,ZAs=new RegExp("^"+BH);function e2s(t,e){for(var r=e.lastIndex,n=[],o;o=e.exec(t);)n.push(o),e.lastIndex===o.index&&(e.lastIndex+=1);return e.lastIndex=r,n}function t2s(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+BH+JSON.stringify(n)+BH:e+n}function r2s(t,e,r){r||(r={});var n=r.escape||"\\",o="(\\"+n+`['"`+R1n+`]|[^\\s'"`+R1n+"])+",s=new RegExp(["("+N1n+")","("+o+"|"+YAs+"|"+KAs+")+"].join("|"),"g"),a=e2s(t,s);if(a.length===0)return[];e||(e={});var c=!1;return a.map(function(u){var d=u[0];if(!d||c)return;if(I1n.test(d))return{op:d};var f=!1,p=!1,h="",m=!1,g;function A(){g+=1;var v,b,S=d.charAt(g);if(S==="{"){if(g+=1,d.charAt(g)==="}")throw new Error("Bad substitution: "+d.slice(g-2,g+1));if(v=d.indexOf("}",g),v<0)throw new Error("Bad substitution: "+d.slice(g));b=d.slice(g,v),g=v}else if(/[*@#?$!_-]/.test(S))b=S,g+=1;else{var x=d.slice(g);v=x.match(/[^\w\d_]/),v?(b=x.slice(0,v.index),g+=v.index-1):(b=x,g=d.length)}return t2s(e,"",b)}for(g=0;g<d.length;g++){var y=d.charAt(g);if(m=m||!f&&(y==="*"||y==="?"),p)h+=y,p=!1;else if(f)y===f?f=!1:f==k1n?h+=y:y===n?(g+=1,y=d.charAt(g),y===O1n||y===n||y===i$t?h+=y:h+=n+y):y===i$t?h+=A():h+=y;else if(y===O1n||y===k1n)f=y;else{if(I1n.test(y))return{op:d};if(JAs.test(y)){c=!0;var E={comment:t.slice(u.index+g+1)};return h.length?[h,E]:[E]}else y===n?p=!0:y===i$t?h+=A():h+=y}}return m?{op:"glob",pattern:h}:h}).reduce(function(u,d){return typeof d>"u"?u:u.concat(d)},[])}B1n.exports=function(e,r,n){var o=r2s(e,r,n);return typeof r!="function"?o:o.reduce(function(s,a){if(typeof a=="object")return s.concat(a);var c=a.split(RegExp("("+BH+".*?"+BH+")","g"));return c.length===1?s.concat(c[0]):s.concat(c.filter(Boolean).map(function(u){return ZAs.test(u)?JSON.parse(u.split(BH)[1]):u}))},[])}});var lEe=T(s$t=>{"use strict";s$t.quote=D1n();s$t.parse=P1n()});var M1n,Pze,F1n=G(()=>{"use strict";M1n=Se(zRe(),1);ai();Pze=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(R.t("mcp.auth.scopesRequired"));this.auth=new M1n.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(R.t("mcp.auth.failedToGetAccessToken"));return}return{access_token:r.token,token_type:"Bearer"}}saveTokens(e){}redirectToAuthorization(e){}saveCodeVerifier(e){}codeVerifier(){return""}}});import{execFile as n2s}from"node:child_process";import{promisify as i2s}from"node:util";import{platform as o2s}from"node:os";import{URL as s2s}from"node:url";function a2s(t){let e;try{e=new s2s(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 U1n(t){a2s(t);let e=o2s(),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 o={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};try{await L1n(r,n,o)}catch(s){if((e==="linux"||e==="freebsd"||e==="openbsd")&&r==="xdg-open"){let a=["gnome-open","kde-open","firefox","chromium","google-chrome"];for(let c of a)try{await L1n(c,[t],o);return}catch{continue}}throw new Error(`Failed to open browser: ${s instanceof Error?s.message:"Unknown error"}`)}}var L1n,$1n=G(()=>{"use strict";L1n=i2s(n2s)});function $o(t){return t instanceof Error&&"code"in t}function Cr(t){if(t instanceof Error)return t.message;try{return String(t)}catch{return"Failed to get error details"}}function a$t(t){if(t&&typeof t=="object"&&"response"in t){let r=c2s(t);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new Fze(r.error.message);case 401:return new cF(r.error.message);case 403:return new Mze(r.error.message);default:}}return t}function c2s(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}var Mze,cF,Fze,Ld=G(()=>{"use strict";Mze=class extends Error{},cF=class extends Error{},Fze=class extends Error{}});import{promises as Toe}from"node:fs";import*as Lze from"node:path";import*as j1n from"node:os";var T0,Uze=G(()=>{"use strict";Ld();ai();T0=class{static TOKEN_FILE="mcp-oauth-tokens.json";static CONFIG_DIR=".iflow";static getTokenFilePath(){let e=j1n.homedir();return Lze.join(e,this.CONFIG_DIR,this.TOKEN_FILE)}static async ensureConfigDir(){let e=Lze.dirname(this.getTokenFilePath());await Toe.mkdir(e,{recursive:!0})}static async loadTokens(){let e=new Map;try{let r=this.getTokenFilePath(),n=await Toe.readFile(r,"utf-8"),o=JSON.parse(n);for(let s of o)e.set(s.serverName,s)}catch(r){r.code!=="ENOENT"&&console.error(R.t("mcp.tokenStorage.errors.failedToLoadTokens",{error:Cr(r)}))}return e}static async saveToken(e,r,n,o,s){await this.ensureConfigDir();let a=await this.loadTokens(),c={serverName:e,token:r,clientId:n,tokenUrl:o,mcpServerUrl:s,updatedAt:Date.now()};a.set(e,c);let u=Array.from(a.values()),d=this.getTokenFilePath();try{await Toe.writeFile(d,JSON.stringify(u,null,2),{mode:384})}catch(f){throw console.error(R.t("mcp.tokenStorage.errors.failedToSaveToken",{error:Cr(f)})),f}}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()),o=this.getTokenFilePath();try{n.length===0?await Toe.unlink(o):await Toe.writeFile(o,JSON.stringify(n,null,2),{mode:384})}catch(s){console.error(R.t("mcp.tokenStorage.errors.failedToRemoveToken",{error:Cr(s)}))}}}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 Toe.unlink(e)}catch(e){e.code!=="ENOENT"&&console.error(R.t("mcp.tokenStorage.errors.failedToClearTokens",{error:Cr(e)}))}}}});var D0,$ze=G(()=>{"use strict";Ld();ai();D0=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}: ${Cr(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}: ${Cr(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 s=n.authorization_servers[0],a=new URL("/.well-known/oauth-authorization-server",s).toString(),c=await this.fetchAuthorizationServerMetadata(a);if(c){let u=this.metadataToOAuthConfig(c);return c.registration_endpoint&&console.log(R.t("mcp.oauth.discovery.dynamicRegistrationSupported"),c.registration_endpoint),u}}console.debug(`Trying OAuth discovery fallback at ${r.authorizationServer}`);let o=await this.fetchAuthorizationServerMetadata(r.authorizationServer);if(o){let s=this.metadataToOAuthConfig(o);return o.registration_endpoint&&console.log(R.t("mcp.oauth.discovery.dynamicRegistrationSupported"),o.registration_endpoint),s}return null}catch(r){return console.debug(`Failed to discover OAuth configuration: ${Cr(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(R.t("mcp.oauth.discovery.foundResourceMetadataUri",{uri:r}));let n=await this.fetchProtectedResourceMetadata(r);if(!n?.authorization_servers?.length)return null;let o=n.authorization_servers[0],s=new URL("/.well-known/oauth-authorization-server",o).toString(),a=await this.fetchAuthorizationServerMetadata(s);return a?(console.log(R.t("mcp.oauth.discovery.configDiscoveredFromWwwAuth")),this.metadataToOAuthConfig(a)):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 Q1n from"node:http";import*as uEe from"node:crypto";import{URL as c$t}from"node:url";var f6,l$t=G(()=>{"use strict";$1n();Uze();Ld();$ze();ai();f6=class{static REDIRECT_PORT=7777;static REDIRECT_PATH="/oauth/callback";static HTTP_OK=200;static HTTP_REDIRECT=302;static async registerClient(e,r){let o={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(" ")||""},s=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!s.ok){let a=await s.text();throw new Error(R.t("mcp.auth.clientRegistrationFailed",{status:s.status,statusText:s.statusText,error:a}))}return await s.json()}static async discoverOAuthFromMCPServer(e){let r=D0.extractBaseUrl(e);return D0.discoverOAuthConfig(r)}static generatePKCEParams(){let e=uEe.randomBytes(32).toString("base64url"),r=uEe.createHash("sha256").update(e).digest("base64url"),n=uEe.randomBytes(16).toString("base64url");return{codeVerifier:e,codeChallenge:r,state:n}}static async startCallbackServer(e){return new Promise((r,n)=>{let o=Q1n.createServer(async(s,a)=>{try{let c=new c$t(s.url,`http://localhost:${this.REDIRECT_PORT}`);if(c.pathname!==this.REDIRECT_PATH){a.writeHead(404),a.end(R.t("mcp.ui.notFound"));return}let u=c.searchParams.get("code"),d=c.searchParams.get("state"),f=c.searchParams.get("error");if(f){a.writeHead(this.HTTP_OK,{"Content-Type":"text/html"}),a.end(`
1027
+ `&&n++}}return[e,r]}var Tze,NUt=G(()=>{Tze=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 vAs(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function BUt(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(BUt).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${BUt(t.cause)}`:t.message:`${t}`}function o1n(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}function bAs(){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 Rze,a1n,QUt,Ka,Cg,Zf,ek,gE,TH,_oe,Ize,kze,W_e,boe,z_e,oF,Eoe,Coe,voe,H_e,Dx,PUt,MUt,FUt,s1n,LUt,UUt,V_e,$Ut,jUt,DH,c1n=G(()=>{NUt();Rze=class extends Event{constructor(e,r){var n,o;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(o=r?.message)!=null?o:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(o1n(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(o1n(this),r)}};a1n=t=>{throw TypeError(t)},QUt=(t,e,r)=>e.has(t)||a1n("Cannot "+r),Ka=(t,e,r)=>(QUt(t,e,"read from private field"),r?r.call(t):e.get(t)),Cg=(t,e,r)=>e.has(t)?a1n("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Zf=(t,e,r,n)=>(QUt(t,e,"write to private field"),e.set(t,r),r),ek=(t,e,r)=>(QUt(t,e,"access private method"),r),DH=class extends EventTarget{constructor(e,r){var n,o;super(),Cg(this,Dx),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Cg(this,gE),Cg(this,TH),Cg(this,_oe),Cg(this,Ize),Cg(this,kze),Cg(this,W_e),Cg(this,boe),Cg(this,z_e,null),Cg(this,oF),Cg(this,Eoe),Cg(this,Coe,null),Cg(this,voe,null),Cg(this,H_e,null),Cg(this,MUt,async s=>{var a;Ka(this,Eoe).reset();let{body:c,redirected:u,status:d,headers:f}=s;if(d===204){ek(this,Dx,V_e).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(u?Zf(this,_oe,new URL(s.url)):Zf(this,_oe,void 0),d!==200){ek(this,Dx,V_e).call(this,`Non-200 status code (${d})`,d);return}if(!(f.get("content-type")||"").startsWith("text/event-stream")){ek(this,Dx,V_e).call(this,'Invalid content type, expected "text/event-stream"',d);return}if(Ka(this,gE)===this.CLOSED)return;Zf(this,gE,this.OPEN);let p=new Event("open");if((a=Ka(this,H_e))==null||a.call(this,p),this.dispatchEvent(p),typeof c!="object"||!c||!("getReader"in c)){ek(this,Dx,V_e).call(this,"Invalid response body, expected a web ReadableStream",d),this.close();return}let h=new TextDecoder,m=c.getReader(),g=!0;do{let{done:A,value:y}=await m.read();y&&Ka(this,Eoe).feed(h.decode(y,{stream:!A})),A&&(g=!1,Ka(this,Eoe).reset(),ek(this,Dx,$Ut).call(this))}while(g)}),Cg(this,FUt,s=>{Zf(this,oF,void 0),!(s.name==="AbortError"||s.type==="aborted")&&ek(this,Dx,$Ut).call(this,BUt(s))}),Cg(this,LUt,s=>{typeof s.id=="string"&&Zf(this,z_e,s.id);let a=new MessageEvent(s.event||"message",{data:s.data,origin:Ka(this,_oe)?Ka(this,_oe).origin:Ka(this,TH).origin,lastEventId:s.id||""});Ka(this,voe)&&(!s.event||s.event==="message")&&Ka(this,voe).call(this,a),this.dispatchEvent(a)}),Cg(this,UUt,s=>{Zf(this,W_e,s)}),Cg(this,jUt,()=>{Zf(this,boe,void 0),Ka(this,gE)===this.CONNECTING&&ek(this,Dx,PUt).call(this)});try{if(e instanceof URL)Zf(this,TH,e);else if(typeof e=="string")Zf(this,TH,new URL(e,bAs()));else throw new Error("Invalid URL")}catch{throw vAs("An invalid or illegal string was specified")}Zf(this,Eoe,Dze({onEvent:Ka(this,LUt),onRetry:Ka(this,UUt)})),Zf(this,gE,this.CONNECTING),Zf(this,W_e,3e3),Zf(this,kze,(n=r?.fetch)!=null?n:globalThis.fetch),Zf(this,Ize,(o=r?.withCredentials)!=null?o:!1),ek(this,Dx,PUt).call(this)}get readyState(){return Ka(this,gE)}get url(){return Ka(this,TH).href}get withCredentials(){return Ka(this,Ize)}get onerror(){return Ka(this,Coe)}set onerror(e){Zf(this,Coe,e)}get onmessage(){return Ka(this,voe)}set onmessage(e){Zf(this,voe,e)}get onopen(){return Ka(this,H_e)}set onopen(e){Zf(this,H_e,e)}addEventListener(e,r,n){let o=r;super.addEventListener(e,o,n)}removeEventListener(e,r,n){let o=r;super.removeEventListener(e,o,n)}close(){Ka(this,boe)&&clearTimeout(Ka(this,boe)),Ka(this,gE)!==this.CLOSED&&(Ka(this,oF)&&Ka(this,oF).abort(),Zf(this,gE,this.CLOSED),Zf(this,oF,void 0))}};gE=new WeakMap,TH=new WeakMap,_oe=new WeakMap,Ize=new WeakMap,kze=new WeakMap,W_e=new WeakMap,boe=new WeakMap,z_e=new WeakMap,oF=new WeakMap,Eoe=new WeakMap,Coe=new WeakMap,voe=new WeakMap,H_e=new WeakMap,Dx=new WeakSet,PUt=function(){Zf(this,gE,this.CONNECTING),Zf(this,oF,new AbortController),Ka(this,kze)(Ka(this,TH),ek(this,Dx,s1n).call(this)).then(Ka(this,MUt)).catch(Ka(this,FUt))},MUt=new WeakMap,FUt=new WeakMap,s1n=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ka(this,z_e)?{"Last-Event-ID":Ka(this,z_e)}:void 0},cache:"no-store",signal:(t=Ka(this,oF))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},LUt=new WeakMap,UUt=new WeakMap,V_e=function(t,e){var r;Ka(this,gE)!==this.CLOSED&&Zf(this,gE,this.CLOSED);let n=new Rze("error",{code:e,message:t});(r=Ka(this,Coe))==null||r.call(this,n),this.dispatchEvent(n)},$Ut=function(t,e){var r;if(Ka(this,gE)===this.CLOSED)return;Zf(this,gE,this.CONNECTING);let n=new Rze("error",{code:e,message:t});(r=Ka(this,Coe))==null||r.call(this,n),this.dispatchEvent(n),Zf(this,boe,setTimeout(Ka(this,jUt),Ka(this,W_e)))},jUt=new WeakMap,DH.CONNECTING=0,DH.OPEN=1,DH.CLOSED=2});function Soe(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function Oze(t=fetch,e){return e?async(r,n)=>{let o={...e,...n,headers:n?.headers?{...Soe(e.headers),...Soe(n.headers)}:e.headers};return t(r,o)}:t}var GUt=G(()=>{});async function CAs(t){return(await qUt).getRandomValues(new Uint8Array(t))}async function SAs(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=Math.pow(2,8)-Math.pow(2,8)%e.length,n="";for(;n.length<t;){let o=await CAs(t-n.length);for(let s of o)s<r&&(n+=e[s%e.length])}return n}async function wAs(t){return await SAs(t)}async function xAs(t){let e=await(await qUt).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function HUt(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await wAs(t),r=await xAs(e);return{code_verifier:e,code_challenge:r}}var qUt,l1n=G(()=>{qUt=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto)});var r2,d1n,VUt,TAs,f1n,p1n,h1n,u1n,DAs,IAs,m1n,eel,tel,WUt=G(()=>{ePt();r2=gVe().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:XBt.custom,message:"URL must be parseable",fatal:!0}),eie}).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"}),d1n=jh({resource:wt().url(),authorization_servers:yn(r2).optional(),jwks_uri:wt().url().optional(),scopes_supported:yn(wt()).optional(),bearer_methods_supported:yn(wt()).optional(),resource_signing_alg_values_supported:yn(wt()).optional(),resource_name:wt().optional(),resource_documentation:wt().optional(),resource_policy_uri:wt().url().optional(),resource_tos_uri:wt().url().optional(),tls_client_certificate_bound_access_tokens:zl().optional(),authorization_details_types_supported:yn(wt()).optional(),dpop_signing_alg_values_supported:yn(wt()).optional(),dpop_bound_access_tokens_required:zl().optional()}),VUt=jh({issuer:wt(),authorization_endpoint:r2,token_endpoint:r2,registration_endpoint:r2.optional(),scopes_supported:yn(wt()).optional(),response_types_supported:yn(wt()),response_modes_supported:yn(wt()).optional(),grant_types_supported:yn(wt()).optional(),token_endpoint_auth_methods_supported:yn(wt()).optional(),token_endpoint_auth_signing_alg_values_supported:yn(wt()).optional(),service_documentation:r2.optional(),revocation_endpoint:r2.optional(),revocation_endpoint_auth_methods_supported:yn(wt()).optional(),revocation_endpoint_auth_signing_alg_values_supported:yn(wt()).optional(),introspection_endpoint:wt().optional(),introspection_endpoint_auth_methods_supported:yn(wt()).optional(),introspection_endpoint_auth_signing_alg_values_supported:yn(wt()).optional(),code_challenge_methods_supported:yn(wt()).optional(),client_id_metadata_document_supported:zl().optional()}),TAs=jh({issuer:wt(),authorization_endpoint:r2,token_endpoint:r2,userinfo_endpoint:r2.optional(),jwks_uri:r2,registration_endpoint:r2.optional(),scopes_supported:yn(wt()).optional(),response_types_supported:yn(wt()),response_modes_supported:yn(wt()).optional(),grant_types_supported:yn(wt()).optional(),acr_values_supported:yn(wt()).optional(),subject_types_supported:yn(wt()),id_token_signing_alg_values_supported:yn(wt()),id_token_encryption_alg_values_supported:yn(wt()).optional(),id_token_encryption_enc_values_supported:yn(wt()).optional(),userinfo_signing_alg_values_supported:yn(wt()).optional(),userinfo_encryption_alg_values_supported:yn(wt()).optional(),userinfo_encryption_enc_values_supported:yn(wt()).optional(),request_object_signing_alg_values_supported:yn(wt()).optional(),request_object_encryption_alg_values_supported:yn(wt()).optional(),request_object_encryption_enc_values_supported:yn(wt()).optional(),token_endpoint_auth_methods_supported:yn(wt()).optional(),token_endpoint_auth_signing_alg_values_supported:yn(wt()).optional(),display_values_supported:yn(wt()).optional(),claim_types_supported:yn(wt()).optional(),claims_supported:yn(wt()).optional(),service_documentation:wt().optional(),claims_locales_supported:yn(wt()).optional(),ui_locales_supported:yn(wt()).optional(),claims_parameter_supported:zl().optional(),request_parameter_supported:zl().optional(),request_uri_parameter_supported:zl().optional(),require_request_uri_registration:zl().optional(),op_policy_uri:r2.optional(),op_tos_uri:r2.optional(),client_id_metadata_document_supported:zl().optional()}),f1n=wn({...TAs.shape,...VUt.pick({code_challenge_methods_supported:!0}).shape}),p1n=wn({access_token:wt(),id_token:wt().optional(),token_type:wt(),expires_in:Rye.number().optional(),scope:wt().optional(),refresh_token:wt().optional()}).strip(),h1n=wn({error:wt(),error_description:wt().optional(),error_uri:wt().optional()}),u1n=r2.optional().or(Bi("").transform(()=>{})),DAs=wn({redirect_uris:yn(r2),token_endpoint_auth_method:wt().optional(),grant_types:yn(wt()).optional(),response_types:yn(wt()).optional(),client_name:wt().optional(),client_uri:r2.optional(),logo_uri:u1n,scope:wt().optional(),contacts:yn(wt()).optional(),tos_uri:u1n,policy_uri:wt().optional(),jwks_uri:r2.optional(),jwks:NVe().optional(),software_id:wt().optional(),software_version:wt().optional(),software_statement:wt().optional()}).strip(),IAs=wn({client_id:wt(),client_secret:wt().optional(),client_id_issued_at:hc().optional(),client_secret_expires_at:hc().optional()}).strip(),m1n=DAs.merge(IAs),eel=wn({error:wt(),error_description:wt().optional()}).strip(),tel=wn({token:wt(),token_type_hint:wt().optional()}).strip()});function g1n(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function A1n({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 o=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return o.startsWith(s)}var y1n=G(()=>{});var qh,Y_e,IH,RH,kH,K_e,J_e,X_e,tk,Z_e,eEe,tEe,rEe,nEe,iEe,OH,oEe,sEe,_1n,E1n=G(()=>{qh=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}},Y_e=class extends qh{};Y_e.errorCode="invalid_request";IH=class extends qh{};IH.errorCode="invalid_client";RH=class extends qh{};RH.errorCode="invalid_grant";kH=class extends qh{};kH.errorCode="unauthorized_client";K_e=class extends qh{};K_e.errorCode="unsupported_grant_type";J_e=class extends qh{};J_e.errorCode="invalid_scope";X_e=class extends qh{};X_e.errorCode="access_denied";tk=class extends qh{};tk.errorCode="server_error";Z_e=class extends qh{};Z_e.errorCode="temporarily_unavailable";eEe=class extends qh{};eEe.errorCode="unsupported_response_type";tEe=class extends qh{};tEe.errorCode="unsupported_token_type";rEe=class extends qh{};rEe.errorCode="invalid_token";nEe=class extends qh{};nEe.errorCode="method_not_allowed";iEe=class extends qh{};iEe.errorCode="too_many_requests";OH=class extends qh{};OH.errorCode="invalid_client_metadata";oEe=class extends qh{};oEe.errorCode="insufficient_scope";sEe=class extends qh{};sEe.errorCode="invalid_target";_1n={[Y_e.errorCode]:Y_e,[IH.errorCode]:IH,[RH.errorCode]:RH,[kH.errorCode]:kH,[K_e.errorCode]:K_e,[J_e.errorCode]:J_e,[X_e.errorCode]:X_e,[tk.errorCode]:tk,[Z_e.errorCode]:Z_e,[eEe.errorCode]:eEe,[tEe.errorCode]:tEe,[rEe.errorCode]:rEe,[nEe.errorCode]:nEe,[iEe.errorCode]:iEe,[OH.errorCode]:OH,[oEe.errorCode]:oEe,[sEe.errorCode]:sEe}});function RAs(t){return["client_secret_basic","client_secret_post","none"].includes(t)}function kAs(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&&RAs(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 OAs(t,e,r,n){let{client_id:o,client_secret:s}=e;switch(t){case"client_secret_basic":NAs(o,s,r);return;case"client_secret_post":BAs(o,s,n);return;case"none":PAs(o,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function NAs(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 BAs(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function PAs(t,e){e.set("client_id",t)}async function b1n(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=h1n.parse(JSON.parse(r)),{error:o,error_description:s,error_uri:a}=n,c=_1n[o]||tk;return new c(s||"",a)}catch(n){let o=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new tk(o)}}async function rk(t,e){try{return await KUt(t,e)}catch(r){if(r instanceof IH||r instanceof kH)return await t.invalidateCredentials?.("all"),await KUt(t,e);if(r instanceof RH)return await t.invalidateCredentials?.("tokens"),await KUt(t,e);throw r}}async function KUt(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:o,fetchFn:s}){let a,c;try{a=await LAs(e,{resourceMetadataUrl:o},s),a.authorization_servers&&a.authorization_servers.length>0&&(c=a.authorization_servers[0])}catch{}c||(c=new URL("/",e));let u=await FAs(e,t,a),d=await GAs(c,{fetchFn:s}),f=await Promise.resolve(t.clientInformation());if(!f){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let y=d?.client_id_metadata_document_supported===!0,E=t.clientMetadataUrl;if(E&&!MAs(E))throw new OH(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${E}`);if(y&&E)f={client_id:E},await t.saveClientInformation?.(f);else{if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let b=await VAs(c,{metadata:d,clientMetadata:t.clientMetadata,fetchFn:s});await t.saveClientInformation(b),f=b}}let p=!t.redirectUrl;if(r!==void 0||p){let y=await HAs(t,c,{metadata:d,resource:u,authorizationCode:r,fetchFn:s});return await t.saveTokens(y),"AUTHORIZED"}let h=await t.tokens();if(h?.refresh_token)try{let y=await e$t(c,{metadata:d,clientInformation:f,refreshToken:h.refresh_token,resource:u,addClientAuthentication:t.addClientAuthentication,fetchFn:s});return await t.saveTokens(y),"AUTHORIZED"}catch(y){if(!(!(y instanceof qh)||y instanceof tk))throw y}let m=t.state?await t.state():void 0,{authorizationUrl:g,codeVerifier:A}=await qAs(c,{metadata:d,clientInformation:f,state:m,redirectUrl:t.redirectUrl,scope:n||a?.scopes_supported?.join(" ")||t.clientMetadata.scope,resource:u});return await t.saveCodeVerifier(A),await t.redirectToAuthorization(g),"REDIRECT"}function MAs(t){if(!t)return!1;try{let e=new URL(t);return e.protocol==="https:"&&e.pathname!=="/"}catch{return!1}}async function FAs(t,e,r){let n=g1n(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!A1n({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 woe(t){let e=t.headers.get("WWW-Authenticate");if(!e)return{};let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let o=JUt(t,"resource_metadata")||void 0,s;if(o)try{s=new URL(o)}catch{}let a=JUt(t,"scope")||void 0,c=JUt(t,"error")||void 0;return{resourceMetadataUrl:s,scope:a,error:c}}function JUt(t,e){let r=t.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${e}=(?:"([^"]+)"|([^\\s,]+))`),o=r.match(n);return o?o[1]||o[2]:null}async function LAs(t,e,r=fetch){let n=await jAs(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw await n?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw await n.body?.cancel(),new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return d1n.parse(await n.json())}async function XUt(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?XUt(t,void 0,r):void 0;throw n}}function UAs(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function v1n(t,e,r=fetch){return await XUt(t,{"MCP-Protocol-Version":e},r)}function $As(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function jAs(t,e,r,n){let o=new URL(t),s=n?.protocolVersion??Mie,a;if(n?.metadataUrl)a=new URL(n.metadataUrl);else{let u=UAs(e,o.pathname);a=new URL(u,n?.metadataServerUrl??o),a.search=o.search}let c=await v1n(a,s,r);if(!n?.metadataUrl&&$As(c,o.pathname)){let u=new URL(`/.well-known/${e}`,o);c=await v1n(u,s,r)}return c}function QAs(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 o=e.pathname;return o.endsWith("/")&&(o=o.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${o}`,e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${o}`,e.origin),type:"oidc"}),n.push({url:new URL(`${o}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function GAs(t,{fetchFn:e=fetch,protocolVersion:r=Mie}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},o=QAs(t);for(let{url:s,type:a}of o){let c=await XUt(s,n,e);if(c){if(!c.ok){if(await c.body?.cancel(),c.status>=400&&c.status<500)continue;throw new Error(`HTTP ${c.status} trying to load ${a==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}return a==="oauth"?VUt.parse(await c.json()):f1n.parse(await c.json())}}}async function qAs(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:o,state:s,resource:a}){let c;if(e){if(c=new URL(e.authorization_endpoint),!e.response_types_supported.includes(zUt))throw new Error(`Incompatible auth server: does not support response type ${zUt}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(YUt))throw new Error(`Incompatible auth server: does not support code challenge method ${YUt}`)}else c=new URL("/authorize",t);let u=await HUt(),d=u.code_verifier,f=u.code_challenge;return c.searchParams.set("response_type",zUt),c.searchParams.set("client_id",r.client_id),c.searchParams.set("code_challenge",f),c.searchParams.set("code_challenge_method",YUt),c.searchParams.set("redirect_uri",String(n)),s&&c.searchParams.set("state",s),o&&c.searchParams.set("scope",o),o?.includes("offline_access")&&c.searchParams.append("prompt","consent"),a&&c.searchParams.set("resource",a.href),{authorizationUrl:c,codeVerifier:d}}function C1n(t,e,r){return new URLSearchParams({grant_type:"authorization_code",code:t,code_verifier:e,redirect_uri:String(r)})}async function ZUt(t,{metadata:e,tokenRequestParams:r,clientInformation:n,addClientAuthentication:o,resource:s,fetchFn:a}){let c=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t),u=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s&&r.set("resource",s.href),o)await o(u,r,c,e);else if(n){let f=e?.token_endpoint_auth_methods_supported??[],p=kAs(n,f);OAs(p,n,u,r)}let d=await(a??fetch)(c,{method:"POST",headers:u,body:r});if(!d.ok)throw await b1n(d);return p1n.parse(await d.json())}async function S1n(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:o,redirectUri:s,resource:a,addClientAuthentication:c,fetchFn:u}){let d=C1n(n,o,s);return ZUt(t,{metadata:e,tokenRequestParams:d,clientInformation:r,addClientAuthentication:c,resource:a,fetchFn:u})}async function e$t(t,{metadata:e,clientInformation:r,refreshToken:n,resource:o,addClientAuthentication:s,fetchFn:a}){let c=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),u=await ZUt(t,{metadata:e,tokenRequestParams:c,clientInformation:r,addClientAuthentication:s,resource:o,fetchFn:a});return{refresh_token:n,...u}}async function HAs(t,e,{metadata:r,resource:n,authorizationCode:o,fetchFn:s}={}){let a=t.clientMetadata.scope,c;if(t.prepareTokenRequest&&(c=await t.prepareTokenRequest(a)),!c){if(!o)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let d=await t.codeVerifier();c=C1n(o,d,t.redirectUrl)}let u=await t.clientInformation();return ZUt(e,{metadata:r,tokenRequestParams:c,clientInformation:u??void 0,addClientAuthentication:t.addClientAuthentication,resource:n,fetchFn:s})}async function VAs(t,{metadata:e,clientMetadata:r,fetchFn:n}){let o;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");o=new URL(e.registration_endpoint)}else o=new URL("/register",t);let s=await(n??fetch)(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!s.ok)throw await b1n(s);return m1n.parse(await s.json())}var fy,zUt,YUt,Nze=G(()=>{l1n();GR();WUt();WUt();y1n();E1n();fy=class extends Error{constructor(e){super(e??"Unauthorized")}};zUt="code",YUt="S256"});var t$t,xoe,w1n=G(()=>{c1n();GUt();GR();Nze();t$t=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},xoe=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,this._fetchWithInit=Oze(r?.fetch,r?.requestInit)}async _authThenStart(){if(!this._authProvider)throw new fy("No auth provider");let e;try{e=await rk(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(e!=="AUTHORIZED")throw new fy;return await this._startOrAuth()}async _commonHeaders(){let e={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(e.Authorization=`Bearer ${n.access_token}`)}this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);let r=Soe(this._requestInit?.headers);return new Headers({...e,...r})}_startOrAuth(){let e=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((r,n)=>{this._eventSource=new DH(this._url.href,{...this._eventSourceInit,fetch:async(o,s)=>{let a=await this._commonHeaders();a.set("Accept","text/event-stream");let c=await e(o,{...s,headers:a});if(c.status===401&&c.headers.has("www-authenticate")){let{resourceMetadataUrl:u,scope:d}=woe(c);this._resourceMetadataUrl=u,this._scope=d}return c}}),this._abortController=new AbortController,this._eventSource.onerror=o=>{if(o.code===401&&this._authProvider){this._authThenStart().then(r,n);return}let s=new t$t(o.code,o.message,o);n(s),this.onerror?.(s)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",o=>{let s=o;try{if(this._endpoint=new URL(s.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(a){n(a),this.onerror?.(a),this.close();return}r()}),this._eventSource.onmessage=o=>{let s=o,a;try{a=jM.parse(JSON.parse(s.data))}catch(c){this.onerror?.(c);return}this.onmessage?.(a)}})}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 fy("No auth provider");if(await rk(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new fy("Failed to authorize")}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(e){if(!this._endpoint)throw new Error("Not connected");try{let r=await this._commonHeaders();r.set("content-type","application/json");let n={...this._requestInit,method:"POST",headers:r,body:JSON.stringify(e),signal:this._abortController?.signal},o=await(this._fetch??fetch)(this._endpoint,n);if(!o.ok){let s=await o.text().catch(()=>null);if(o.status===401&&this._authProvider){let{resourceMetadataUrl:a,scope:c}=woe(o);if(this._resourceMetadataUrl=a,this._scope=c,await rk(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new fy;return this.send(e)}throw new Error(`Error POSTing to endpoint (HTTP ${o.status}): ${s}`)}await o.body?.cancel()}catch(r){throw this.onerror?.(r),r}}setProtocolVersion(e){this._protocolVersion=e}}});var Bze,x1n=G(()=>{NUt();Bze=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let o;super({start(s){o=Dze({onEvent:a=>{s.enqueue(a)},onError(a){e==="terminate"?s.error(a):typeof e=="function"&&e(a)},onRetry:r,onComment:n})},transform(s){o.feed(s)}})}}});var WAs,sF,aF,r$t=G(()=>{GUt();GR();Nze();x1n();WAs={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},sF=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},aF=class{constructor(e,r){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._fetchWithInit=Oze(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??WAs}async _authThenStart(){if(!this._authProvider)throw new fy("No auth provider");let e;try{e=await rk(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(e!=="AUTHORIZED")throw new fy;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(e.Authorization=`Bearer ${n.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);let r=Soe(this._requestInit?.headers);return new Headers({...e,...r})}async _startOrAuthSse(e){let{resumptionToken:r}=e;try{let n=await this._commonHeaders();n.set("Accept","text/event-stream"),r&&n.set("last-event-id",r);let o=await(this._fetch??fetch)(this._url,{method:"GET",headers:n,signal:this._abortController?.signal});if(!o.ok){if(await o.body?.cancel(),o.status===401&&this._authProvider)return await this._authThenStart();if(o.status===405)return;throw new sF(o.status,`Failed to open SSE stream: ${o.statusText}`)}this._handleSseStream(o.body,e,!0)}catch(n){throw this.onerror?.(n),n}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),o)}_scheduleReconnection(e,r=0){let n=this._reconnectionOptions.maxRetries;if(r>=n){this.onerror?.(new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let o=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(s=>{this.onerror?.(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:o,replayMessageId:s}=r,a,c=!1,u=!1;(async()=>{try{let f=e.pipeThrough(new TextDecoderStream).pipeThrough(new Bze({onRetry:m=>{this._serverRetryMs=m}})).getReader();for(;;){let{value:m,done:g}=await f.read();if(g)break;if(m.id&&(a=m.id,c=!0,o?.(m.id)),!!m.data&&(!m.event||m.event==="message"))try{let A=jM.parse(JSON.parse(m.data));nH(A)&&(u=!0,s!==void 0&&(A.id=s)),this.onmessage?.(A)}catch(A){this.onerror?.(A)}}(n||c)&&!u&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:a,onresumptiontoken:o,replayMessageId:s},0)}catch(f){if(this.onerror?.(new Error(`SSE stream disconnected: ${f}`)),(n||c)&&!u&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:a,onresumptiontoken:o,replayMessageId:s},0)}catch(m){this.onerror?.(new Error(`Failed to reconnect: ${m instanceof Error?m.message:String(m)}`))}}})()}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 fy("No auth provider");if(await rk(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new fy("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,r){try{let{resumptionToken:n,onresumptiontoken:o}=r||{};if(n){this._startOrAuthSse({resumptionToken:n,replayMessageId:Nye(e)?e.id:void 0}).catch(h=>this.onerror?.(h));return}let s=await this._commonHeaders();s.set("content-type","application/json"),s.set("accept","application/json, text/event-stream");let a={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(e),signal:this._abortController?.signal},c=await(this._fetch??fetch)(this._url,a),u=c.headers.get("mcp-session-id");if(u&&(this._sessionId=u),!c.ok){let h=await c.text().catch(()=>null);if(c.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new sF(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:m,scope:g}=woe(c);if(this._resourceMetadataUrl=m,this._scope=g,await rk(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new fy;return this._hasCompletedAuthFlow=!0,this.send(e)}if(c.status===403&&this._authProvider){let{resourceMetadataUrl:m,scope:g,error:A}=woe(c);if(A==="insufficient_scope"){let y=c.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===y)throw new sF(403,"Server returned 403 after trying upscoping");if(g&&(this._scope=g),m&&(this._resourceMetadataUrl=m),this._lastUpscopingHeader=y??void 0,await rk(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new fy;return this.send(e)}}throw new sF(c.status,`Error POSTing to endpoint: ${h}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,c.status===202){await c.body?.cancel(),Vpn(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(h=>this.onerror?.(h));return}let f=(Array.isArray(e)?e:[e]).filter(h=>"method"in h&&"id"in h&&h.id!==void 0).length>0,p=c.headers.get("content-type");if(f)if(p?.includes("text/event-stream"))this._handleSseStream(c.body,{onresumptiontoken:o},!1);else if(p?.includes("application/json")){let h=await c.json(),m=Array.isArray(h)?h.map(g=>jM.parse(g)):[jM.parse(h)];for(let g of m)this.onmessage?.(g)}else throw await c.body?.cancel(),new sF(-1,`Unexpected content type: ${p}`);else await c.body?.cancel()}catch(n){throw this.onerror?.(n),n}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),r={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},n=await(this._fetch??fetch)(this._url,r);if(await n.body?.cancel(),!n.ok&&n.status!==405)throw new sF(n.status,`Failed to terminate session: ${n.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r?.onresumptiontoken})}}});import{readFile as zAs}from"node:fs/promises";var aEe,cEe,NH,n$t=G(()=>{"use strict";Gge();Nze();ai();(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"})(aEe||(aEe={}));cEe=class extends Error{code;constructor(e,r){super(r),this.code=e}},NH=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||BQ.default}async start(){if(this._isClosed)throw new Error(R.t("websocketClient.errors.transportClosed"));let e=null;if(this._authProvider)try{let o=await this._authProvider.tokens();o?.access_token&&(e=o.access_token)}catch(o){try{let s=await this._authProvider.clientInformation();if(s){let a=await this._authProvider.tokens();if(a?.refresh_token){let c=await e$t(this._url,{clientInformation:s,refreshToken:a.refresh_token,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(c),c?.access_token&&(e=c.access_token)}}}catch{if(this._authProvider.redirectToAuthorization){let s=this._authProvider.redirectUrl;throw s?(await this._authProvider.redirectToAuthorization(typeof s=="string"?new URL(s):s),new Error(R.t("websocketClient.errors.unauthorizedOAuth"))):new Error("Redirect URL is required for authorization")}throw o}}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((o,s)=>{try{let a={headers:r};this._websocket=new this._WebSocket(n.toString(),a),this._websocket.on("open",()=>{o()}),this._websocket.on("error",c=>{let u=c.code!==void 0?c.code:void 0;s(new cEe(u,`WebSocket error: ${c.message}`))}),this._websocket.on("message",async c=>{try{let u=c.toString(),d=JSON.parse(u);if(this._specialIds.has(Number(d.id))||d.type==="welcome")return;this.onmessage?.(await this._transformResponse(d))}catch(u){this.onerror?.(new Error(`Failed to parse WebSocket message: ${u instanceof Error?u.message:String(u)}`))}}),this._websocket.on("close",()=>{this._isClosed||(this._isClosed=!0,this.onclose?.())})}catch(a){s(new cEe(void 0,`Failed to create WebSocket: ${a}`))}})}async finishAuth(e){if(!this._authProvider)throw new Error(R.t("websocketClient.errors.noAuthProvider"));try{let r=await this._authProvider.clientInformation();if(r){let n=this._authProvider.redirectUrl;if(!n)throw new Error("Redirect URL is required for authorization");let o=typeof n=="string"?n:n.toString(),s=await S1n(this._url,{clientInformation:r,authorizationCode:e,codeVerifier:await this._authProvider.codeVerifier(),redirectUri:o,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(s)}else throw new Error(R.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===BQ.default.OPEN?this._websocket.close():this.onclose?.()}async send(e){if(this._isClosed)throw new Error(R.t("websocketClient.errors.transportClosed"));if(!this._websocket)throw new Error(R.t("websocketClient.errors.transportNotStarted"));if(this._websocket.readyState!==BQ.default.OPEN)throw new Error(R.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 cEe(void 0,`Failed to send message: ${r instanceof Error?r.message:String(r)}`)}}async _transformRequest(e){if(e.method==="initialize")return{type:aEe.CLI_CONNECT,id:e.id,timestamp:Date.now(),payload:{clientInfo:{version:"0.5.1",platform:process.platform,workingDirectory:process.cwd()}}};if(e.method==="tools/call"&&e.params?.name==="openDiff"){let{arguments:r}=e.params||{},{filePath:n,newContent:o}=r||{};return{type:aEe.SHOW_DIFF,id:e.id,timestamp:Date.now(),payload:{filePath:n,originalText:await zAs(n,"utf8"),modifiedText:o}}}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:aEe.GET_SELECTED_TEXT,id:e,timestamp:Date.now()})),new Promise((r,n)=>{this._websocket.once("message",o=>{try{let s=JSON.parse(o.toString());Number(s.id)===e&&(this._specialIds.delete(e),s.payload.success?r(s.payload.data.text):n(s.payload.error))}catch{r("")}})})}setProtocolVersion(e){this._protocolVersion=e}}});var D1n=T((Iel,T1n)=>{"use strict";T1n.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 P1n=T((Rel,B1n)=>{"use strict";var N1n="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",I1n=new RegExp("^"+N1n+"$"),R1n="|&;()<> \\t",YAs='"((\\\\"|[^"])*?)"',KAs="'((\\\\'|[^'])*?)'",JAs=/^#$/,k1n="'",O1n='"',i$t="$",BH="",XAs=4294967296;for(o$t=0;o$t<4;o$t++)BH+=(XAs*Math.random()).toString(16);var o$t,ZAs=new RegExp("^"+BH);function e2s(t,e){for(var r=e.lastIndex,n=[],o;o=e.exec(t);)n.push(o),e.lastIndex===o.index&&(e.lastIndex+=1);return e.lastIndex=r,n}function t2s(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+BH+JSON.stringify(n)+BH:e+n}function r2s(t,e,r){r||(r={});var n=r.escape||"\\",o="(\\"+n+`['"`+R1n+`]|[^\\s'"`+R1n+"])+",s=new RegExp(["("+N1n+")","("+o+"|"+YAs+"|"+KAs+")+"].join("|"),"g"),a=e2s(t,s);if(a.length===0)return[];e||(e={});var c=!1;return a.map(function(u){var d=u[0];if(!d||c)return;if(I1n.test(d))return{op:d};var f=!1,p=!1,h="",m=!1,g;function A(){g+=1;var v,b,S=d.charAt(g);if(S==="{"){if(g+=1,d.charAt(g)==="}")throw new Error("Bad substitution: "+d.slice(g-2,g+1));if(v=d.indexOf("}",g),v<0)throw new Error("Bad substitution: "+d.slice(g));b=d.slice(g,v),g=v}else if(/[*@#?$!_-]/.test(S))b=S,g+=1;else{var x=d.slice(g);v=x.match(/[^\w\d_]/),v?(b=x.slice(0,v.index),g+=v.index-1):(b=x,g=d.length)}return t2s(e,"",b)}for(g=0;g<d.length;g++){var y=d.charAt(g);if(m=m||!f&&(y==="*"||y==="?"),p)h+=y,p=!1;else if(f)y===f?f=!1:f==k1n?h+=y:y===n?(g+=1,y=d.charAt(g),y===O1n||y===n||y===i$t?h+=y:h+=n+y):y===i$t?h+=A():h+=y;else if(y===O1n||y===k1n)f=y;else{if(I1n.test(y))return{op:d};if(JAs.test(y)){c=!0;var E={comment:t.slice(u.index+g+1)};return h.length?[h,E]:[E]}else y===n?p=!0:y===i$t?h+=A():h+=y}}return m?{op:"glob",pattern:h}:h}).reduce(function(u,d){return typeof d>"u"?u:u.concat(d)},[])}B1n.exports=function(e,r,n){var o=r2s(e,r,n);return typeof r!="function"?o:o.reduce(function(s,a){if(typeof a=="object")return s.concat(a);var c=a.split(RegExp("("+BH+".*?"+BH+")","g"));return c.length===1?s.concat(c[0]):s.concat(c.filter(Boolean).map(function(u){return ZAs.test(u)?JSON.parse(u.split(BH)[1]):u}))},[])}});var lEe=T(s$t=>{"use strict";s$t.quote=D1n();s$t.parse=P1n()});var M1n,Pze,F1n=G(()=>{"use strict";M1n=Se(zRe(),1);ai();Pze=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(R.t("mcp.auth.scopesRequired"));this.auth=new M1n.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(R.t("mcp.auth.failedToGetAccessToken"));return}return{access_token:r.token,token_type:"Bearer"}}saveTokens(e){}redirectToAuthorization(e){}saveCodeVerifier(e){}codeVerifier(){return""}}});import{execFile as n2s}from"node:child_process";import{promisify as i2s}from"node:util";import{platform as o2s}from"node:os";import{URL as s2s}from"node:url";function a2s(t){let e;try{e=new s2s(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 U1n(t){a2s(t);let e=o2s(),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 o={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};try{await L1n(r,n,o)}catch(s){if((e==="linux"||e==="freebsd"||e==="openbsd")&&r==="xdg-open"){let a=["gnome-open","kde-open","firefox","chromium","google-chrome"];for(let c of a)try{await L1n(c,[t],o);return}catch{continue}}throw new Error(`Failed to open browser: ${s instanceof Error?s.message:"Unknown error"}`)}}var L1n,$1n=G(()=>{"use strict";L1n=i2s(n2s)});function $o(t){return t instanceof Error&&"code"in t}function Cr(t){if(t instanceof Error)return t.message;try{return String(t)}catch{return"Failed to get error details"}}function a$t(t){if(t&&typeof t=="object"&&"response"in t){let r=c2s(t);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new Fze(r.error.message);case 401:return new cF(r.error.message);case 403:return new Mze(r.error.message);default:}}return t}function c2s(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}var Mze,cF,Fze,Ld=G(()=>{"use strict";Mze=class extends Error{},cF=class extends Error{},Fze=class extends Error{}});import{promises as Toe}from"node:fs";import*as Lze from"node:path";import*as j1n from"node:os";var T0,Uze=G(()=>{"use strict";Ld();ai();T0=class{static TOKEN_FILE="mcp-oauth-tokens.json";static CONFIG_DIR=".iflow";static getTokenFilePath(){let e=j1n.homedir();return Lze.join(e,this.CONFIG_DIR,this.TOKEN_FILE)}static async ensureConfigDir(){let e=Lze.dirname(this.getTokenFilePath());await Toe.mkdir(e,{recursive:!0})}static async loadTokens(){let e=new Map;try{let r=this.getTokenFilePath(),n=await Toe.readFile(r,"utf-8"),o=JSON.parse(n);for(let s of o)e.set(s.serverName,s)}catch(r){r.code!=="ENOENT"&&console.error(R.t("mcp.tokenStorage.errors.failedToLoadTokens",{error:Cr(r)}))}return e}static async saveToken(e,r,n,o,s){await this.ensureConfigDir();let a=await this.loadTokens(),c={serverName:e,token:r,clientId:n,tokenUrl:o,mcpServerUrl:s,updatedAt:Date.now()};a.set(e,c);let u=Array.from(a.values()),d=this.getTokenFilePath();try{await Toe.writeFile(d,JSON.stringify(u,null,2),{mode:384})}catch(f){throw console.error(R.t("mcp.tokenStorage.errors.failedToSaveToken",{error:Cr(f)})),f}}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()),o=this.getTokenFilePath();try{n.length===0?await Toe.unlink(o):await Toe.writeFile(o,JSON.stringify(n,null,2),{mode:384})}catch(s){console.error(R.t("mcp.tokenStorage.errors.failedToRemoveToken",{error:Cr(s)}))}}}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 Toe.unlink(e)}catch(e){e.code!=="ENOENT"&&console.error(R.t("mcp.tokenStorage.errors.failedToClearTokens",{error:Cr(e)}))}}}});var D0,$ze=G(()=>{"use strict";Ld();ai();D0=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}: ${Cr(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}: ${Cr(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 s=n.authorization_servers[0],a=new URL("/.well-known/oauth-authorization-server",s).toString(),c=await this.fetchAuthorizationServerMetadata(a);if(c){let u=this.metadataToOAuthConfig(c);return c.registration_endpoint&&console.log(R.t("mcp.oauth.discovery.dynamicRegistrationSupported"),c.registration_endpoint),u}}console.debug(`Trying OAuth discovery fallback at ${r.authorizationServer}`);let o=await this.fetchAuthorizationServerMetadata(r.authorizationServer);if(o){let s=this.metadataToOAuthConfig(o);return o.registration_endpoint&&console.log(R.t("mcp.oauth.discovery.dynamicRegistrationSupported"),o.registration_endpoint),s}return null}catch(r){return console.debug(`Failed to discover OAuth configuration: ${Cr(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(R.t("mcp.oauth.discovery.foundResourceMetadataUri",{uri:r}));let n=await this.fetchProtectedResourceMetadata(r);if(!n?.authorization_servers?.length)return null;let o=n.authorization_servers[0],s=new URL("/.well-known/oauth-authorization-server",o).toString(),a=await this.fetchAuthorizationServerMetadata(s);return a?(console.log(R.t("mcp.oauth.discovery.configDiscoveredFromWwwAuth")),this.metadataToOAuthConfig(a)):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 Q1n from"node:http";import*as uEe from"node:crypto";import{URL as c$t}from"node:url";var f6,l$t=G(()=>{"use strict";$1n();Uze();Ld();$ze();ai();f6=class{static REDIRECT_PORT=7777;static REDIRECT_PATH="/oauth/callback";static HTTP_OK=200;static HTTP_REDIRECT=302;static async registerClient(e,r){let o={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(" ")||""},s=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!s.ok){let a=await s.text();throw new Error(R.t("mcp.auth.clientRegistrationFailed",{status:s.status,statusText:s.statusText,error:a}))}return await s.json()}static async discoverOAuthFromMCPServer(e){let r=D0.extractBaseUrl(e);return D0.discoverOAuthConfig(r)}static generatePKCEParams(){let e=uEe.randomBytes(32).toString("base64url"),r=uEe.createHash("sha256").update(e).digest("base64url"),n=uEe.randomBytes(16).toString("base64url");return{codeVerifier:e,codeChallenge:r,state:n}}static async startCallbackServer(e){return new Promise((r,n)=>{let o=Q1n.createServer(async(s,a)=>{try{let c=new c$t(s.url,`http://localhost:${this.REDIRECT_PORT}`);if(c.pathname!==this.REDIRECT_PATH){a.writeHead(404),a.end(R.t("mcp.ui.notFound"));return}let u=c.searchParams.get("code"),d=c.searchParams.get("state"),f=c.searchParams.get("error");if(f){a.writeHead(this.HTTP_OK,{"Content-Type":"text/html"}),a.end(`
1028
1028
  <html>
1029
1029
  <body>
1030
1030
  <h1>${R.t("mcp.ui.authenticationFailed")}</h1>
@@ -5888,7 +5888,7 @@ ${h}`),n?o.reset(h):h}function Tnc(t,e,r,n={}){if(!vLi){vLi=!0;let s="Passing li
5888
5888
 
5889
5889
  ${e}
5890
5890
  `:""}`}set message(e){this.#r=e}#o(e){if(!this.#t)return;let r=this.#e,n=knc(r,this.#t.message);if(n)return(0,RLi.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}},knc=(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:o,column:s}=r.groups;return o&&s?{line:Number(o),column:Number(s)}:IEr(t,Number(n),{oneBased:!0})},Onc=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${Rnc(n)})`)});var d8e=T((hiu,OLi)=>{"use strict";var Nnc=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};OLi.exports=Nnc});var f8e=T((miu,NLi)=>{"use strict";var Bnc="2.0.0",Pnc=Number.MAX_SAFE_INTEGER||9007199254740991,Mnc=16,Fnc=250,Lnc=["major","premajor","minor","preminor","patch","prepatch","prerelease"];NLi.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Mnc,MAX_SAFE_BUILD_LENGTH:Fnc,MAX_SAFE_INTEGER:Pnc,RELEASE_TYPES:Lnc,SEMVER_SPEC_VERSION:Bnc,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Bpe=T((mI,BLi)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:OEr,MAX_SAFE_BUILD_LENGTH:Unc,MAX_LENGTH:$nc}=f8e(),jnc=d8e();mI=BLi.exports={};var Qnc=mI.re=[],Gnc=mI.safeRe=[],ui=mI.src=[],qnc=mI.safeSrc=[],di=mI.t={},Hnc=0,NEr="[a-zA-Z0-9-]",Vnc=[["\\s",1],["\\d",$nc],[NEr,Unc]],Wnc=t=>{for(let[e,r]of Vnc)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},Ms=(t,e,r)=>{let n=Wnc(e),o=Hnc++;jnc(t,o,e),di[t]=o,ui[o]=e,qnc[o]=n,Qnc[o]=new RegExp(e,r?"g":void 0),Gnc[o]=new RegExp(n,r?"g":void 0)};Ms("NUMERICIDENTIFIER","0|[1-9]\\d*");Ms("NUMERICIDENTIFIERLOOSE","\\d+");Ms("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${NEr}*`);Ms("MAINVERSION",`(${ui[di.NUMERICIDENTIFIER]})\\.(${ui[di.NUMERICIDENTIFIER]})\\.(${ui[di.NUMERICIDENTIFIER]})`);Ms("MAINVERSIONLOOSE",`(${ui[di.NUMERICIDENTIFIERLOOSE]})\\.(${ui[di.NUMERICIDENTIFIERLOOSE]})\\.(${ui[di.NUMERICIDENTIFIERLOOSE]})`);Ms("PRERELEASEIDENTIFIER",`(?:${ui[di.NONNUMERICIDENTIFIER]}|${ui[di.NUMERICIDENTIFIER]})`);Ms("PRERELEASEIDENTIFIERLOOSE",`(?:${ui[di.NONNUMERICIDENTIFIER]}|${ui[di.NUMERICIDENTIFIERLOOSE]})`);Ms("PRERELEASE",`(?:-(${ui[di.PRERELEASEIDENTIFIER]}(?:\\.${ui[di.PRERELEASEIDENTIFIER]})*))`);Ms("PRERELEASELOOSE",`(?:-?(${ui[di.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${ui[di.PRERELEASEIDENTIFIERLOOSE]})*))`);Ms("BUILDIDENTIFIER",`${NEr}+`);Ms("BUILD",`(?:\\+(${ui[di.BUILDIDENTIFIER]}(?:\\.${ui[di.BUILDIDENTIFIER]})*))`);Ms("FULLPLAIN",`v?${ui[di.MAINVERSION]}${ui[di.PRERELEASE]}?${ui[di.BUILD]}?`);Ms("FULL",`^${ui[di.FULLPLAIN]}$`);Ms("LOOSEPLAIN",`[v=\\s]*${ui[di.MAINVERSIONLOOSE]}${ui[di.PRERELEASELOOSE]}?${ui[di.BUILD]}?`);Ms("LOOSE",`^${ui[di.LOOSEPLAIN]}$`);Ms("GTLT","((?:<|>)?=?)");Ms("XRANGEIDENTIFIERLOOSE",`${ui[di.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Ms("XRANGEIDENTIFIER",`${ui[di.NUMERICIDENTIFIER]}|x|X|\\*`);Ms("XRANGEPLAIN",`[v=\\s]*(${ui[di.XRANGEIDENTIFIER]})(?:\\.(${ui[di.XRANGEIDENTIFIER]})(?:\\.(${ui[di.XRANGEIDENTIFIER]})(?:${ui[di.PRERELEASE]})?${ui[di.BUILD]}?)?)?`);Ms("XRANGEPLAINLOOSE",`[v=\\s]*(${ui[di.XRANGEIDENTIFIERLOOSE]})(?:\\.(${ui[di.XRANGEIDENTIFIERLOOSE]})(?:\\.(${ui[di.XRANGEIDENTIFIERLOOSE]})(?:${ui[di.PRERELEASELOOSE]})?${ui[di.BUILD]}?)?)?`);Ms("XRANGE",`^${ui[di.GTLT]}\\s*${ui[di.XRANGEPLAIN]}$`);Ms("XRANGELOOSE",`^${ui[di.GTLT]}\\s*${ui[di.XRANGEPLAINLOOSE]}$`);Ms("COERCEPLAIN",`(^|[^\\d])(\\d{1,${OEr}})(?:\\.(\\d{1,${OEr}}))?(?:\\.(\\d{1,${OEr}}))?`);Ms("COERCE",`${ui[di.COERCEPLAIN]}(?:$|[^\\d])`);Ms("COERCEFULL",ui[di.COERCEPLAIN]+`(?:${ui[di.PRERELEASE]})?(?:${ui[di.BUILD]})?(?:$|[^\\d])`);Ms("COERCERTL",ui[di.COERCE],!0);Ms("COERCERTLFULL",ui[di.COERCEFULL],!0);Ms("LONETILDE","(?:~>?)");Ms("TILDETRIM",`(\\s*)${ui[di.LONETILDE]}\\s+`,!0);mI.tildeTrimReplace="$1~";Ms("TILDE",`^${ui[di.LONETILDE]}${ui[di.XRANGEPLAIN]}$`);Ms("TILDELOOSE",`^${ui[di.LONETILDE]}${ui[di.XRANGEPLAINLOOSE]}$`);Ms("LONECARET","(?:\\^)");Ms("CARETTRIM",`(\\s*)${ui[di.LONECARET]}\\s+`,!0);mI.caretTrimReplace="$1^";Ms("CARET",`^${ui[di.LONECARET]}${ui[di.XRANGEPLAIN]}$`);Ms("CARETLOOSE",`^${ui[di.LONECARET]}${ui[di.XRANGEPLAINLOOSE]}$`);Ms("COMPARATORLOOSE",`^${ui[di.GTLT]}\\s*(${ui[di.LOOSEPLAIN]})$|^$`);Ms("COMPARATOR",`^${ui[di.GTLT]}\\s*(${ui[di.FULLPLAIN]})$|^$`);Ms("COMPARATORTRIM",`(\\s*)${ui[di.GTLT]}\\s*(${ui[di.LOOSEPLAIN]}|${ui[di.XRANGEPLAIN]})`,!0);mI.comparatorTrimReplace="$1$2$3";Ms("HYPHENRANGE",`^\\s*(${ui[di.XRANGEPLAIN]})\\s+-\\s+(${ui[di.XRANGEPLAIN]})\\s*$`);Ms("HYPHENRANGELOOSE",`^\\s*(${ui[di.XRANGEPLAINLOOSE]})\\s+-\\s+(${ui[di.XRANGEPLAINLOOSE]})\\s*$`);Ms("STAR","(<|>)?=?\\s*\\*");Ms("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Ms("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var r0t=T((giu,PLi)=>{"use strict";var znc=Object.freeze({loose:!0}),Ync=Object.freeze({}),Knc=t=>t?typeof t!="object"?znc:t:Ync;PLi.exports=Knc});var BEr=T((Aiu,LLi)=>{"use strict";var MLi=/^[0-9]+$/,FLi=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=MLi.test(t),n=MLi.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},Jnc=(t,e)=>FLi(e,t);LLi.exports={compareIdentifiers:FLi,rcompareIdentifiers:Jnc}});var v3=T((yiu,$Li)=>{"use strict";var n0t=d8e(),{MAX_LENGTH:ULi,MAX_SAFE_INTEGER:i0t}=f8e(),{safeRe:o0t,t:s0t}=Bpe(),Xnc=r0t(),{compareIdentifiers:PEr}=BEr(),MEr=class t{constructor(e,r){if(r=Xnc(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>ULi)throw new TypeError(`version is longer than ${ULi} characters`);n0t("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?o0t[s0t.LOOSE]:o0t[s0t.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>i0t||this.major<0)throw new TypeError("Invalid major version");if(this.minor>i0t||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>i0t||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let s=+o;if(s>=0&&s<i0t)return s}return o}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(n0t("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],o=e.prerelease[r];if(n0t("prerelease compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return PEr(n,o)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],o=e.build[r];if(n0t("build compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return PEr(n,o)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let o=`-${r}`.match(this.options.loose?o0t[s0t.PRERELEASELOOSE]:o0t[s0t.PRERELEASE]);if(!o||o[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[o];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(r){let s=[r,o];n===!1&&(s=[r]),PEr(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};$Li.exports=MEr});var BK=T((_iu,QLi)=>{"use strict";var jLi=v3(),Znc=(t,e,r=!1)=>{if(t instanceof jLi)return t;try{return new jLi(t,e)}catch(n){if(!r)return null;throw n}};QLi.exports=Znc});var FEr=T((Eiu,GLi)=>{"use strict";var eic=BK(),tic=(t,e)=>{let r=eic(t,e);return r?r.version:null};GLi.exports=tic});var LEr=T((viu,qLi)=>{"use strict";var ric=BK(),nic=(t,e)=>{let r=ric(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};qLi.exports=nic});var UEr=T((biu,iic)=>{iic.exports=["0BSD","3D-Slicer-1.0","AAL","ADSL","AFL-1.1","AFL-1.2","AFL-2.0","AFL-2.1","AFL-3.0","AGPL-1.0-only","AGPL-1.0-or-later","AGPL-3.0-only","AGPL-3.0-or-later","AMD-newlib","AMDPLPA","AML","AML-glslang","AMPAS","ANTLR-PD","ANTLR-PD-fallback","APAFML","APL-1.0","APSL-1.0","APSL-1.1","APSL-1.2","APSL-2.0","ASWF-Digital-Assets-1.0","ASWF-Digital-Assets-1.1","Abstyles","AdaCore-doc","Adobe-2006","Adobe-Display-PostScript","Adobe-Glyph","Adobe-Utopia","Afmparse","Aladdin","Apache-1.0","Apache-1.1","Apache-2.0","App-s2p","Arphic-1999","Artistic-1.0","Artistic-1.0-Perl","Artistic-1.0-cl8","Artistic-2.0","Artistic-dist","Aspell-RU","BSD-1-Clause","BSD-2-Clause","BSD-2-Clause-Darwin","BSD-2-Clause-Patent","BSD-2-Clause-Views","BSD-2-Clause-first-lines","BSD-2-Clause-pkgconf-disclaimer","BSD-3-Clause","BSD-3-Clause-Attribution","BSD-3-Clause-Clear","BSD-3-Clause-HP","BSD-3-Clause-LBNL","BSD-3-Clause-Modification","BSD-3-Clause-No-Military-License","BSD-3-Clause-No-Nuclear-License","BSD-3-Clause-No-Nuclear-License-2014","BSD-3-Clause-No-Nuclear-Warranty","BSD-3-Clause-Open-MPI","BSD-3-Clause-Sun","BSD-3-Clause-acpica","BSD-3-Clause-flex","BSD-4-Clause","BSD-4-Clause-Shortened","BSD-4-Clause-UC","BSD-4.3RENO","BSD-4.3TAHOE","BSD-Advertising-Acknowledgement","BSD-Attribution-HPND-disclaimer","BSD-Inferno-Nettverk","BSD-Protection","BSD-Source-Code","BSD-Source-beginning-file","BSD-Systemics","BSD-Systemics-W3Works","BSL-1.0","BUSL-1.1","Baekmuk","Bahyph","Barr","Beerware","BitTorrent-1.0","BitTorrent-1.1","Bitstream-Charter","Bitstream-Vera","BlueOak-1.0.0","Boehm-GC","Boehm-GC-without-fee","Borceux","Brian-Gladman-2-Clause","Brian-Gladman-3-Clause","C-UDA-1.0","CAL-1.0","CAL-1.0-Combined-Work-Exception","CATOSL-1.1","CC-BY-1.0","CC-BY-2.0","CC-BY-2.5","CC-BY-2.5-AU","CC-BY-3.0","CC-BY-3.0-AT","CC-BY-3.0-AU","CC-BY-3.0-DE","CC-BY-3.0-IGO","CC-BY-3.0-NL","CC-BY-3.0-US","CC-BY-4.0","CC-BY-NC-1.0","CC-BY-NC-2.0","CC-BY-NC-2.5","CC-BY-NC-3.0","CC-BY-NC-3.0-DE","CC-BY-NC-4.0","CC-BY-NC-ND-1.0","CC-BY-NC-ND-2.0","CC-BY-NC-ND-2.5","CC-BY-NC-ND-3.0","CC-BY-NC-ND-3.0-DE","CC-BY-NC-ND-3.0-IGO","CC-BY-NC-ND-4.0","CC-BY-NC-SA-1.0","CC-BY-NC-SA-2.0","CC-BY-NC-SA-2.0-DE","CC-BY-NC-SA-2.0-FR","CC-BY-NC-SA-2.0-UK","CC-BY-NC-SA-2.5","CC-BY-NC-SA-3.0","CC-BY-NC-SA-3.0-DE","CC-BY-NC-SA-3.0-IGO","CC-BY-NC-SA-4.0","CC-BY-ND-1.0","CC-BY-ND-2.0","CC-BY-ND-2.5","CC-BY-ND-3.0","CC-BY-ND-3.0-DE","CC-BY-ND-4.0","CC-BY-SA-1.0","CC-BY-SA-2.0","CC-BY-SA-2.0-UK","CC-BY-SA-2.1-JP","CC-BY-SA-2.5","CC-BY-SA-3.0","CC-BY-SA-3.0-AT","CC-BY-SA-3.0-DE","CC-BY-SA-3.0-IGO","CC-BY-SA-4.0","CC-PDDC","CC-PDM-1.0","CC-SA-1.0","CC0-1.0","CDDL-1.0","CDDL-1.1","CDL-1.0","CDLA-Permissive-1.0","CDLA-Permissive-2.0","CDLA-Sharing-1.0","CECILL-1.0","CECILL-1.1","CECILL-2.0","CECILL-2.1","CECILL-B","CECILL-C","CERN-OHL-1.1","CERN-OHL-1.2","CERN-OHL-P-2.0","CERN-OHL-S-2.0","CERN-OHL-W-2.0","CFITSIO","CMU-Mach","CMU-Mach-nodoc","CNRI-Jython","CNRI-Python","CNRI-Python-GPL-Compatible","COIL-1.0","CPAL-1.0","CPL-1.0","CPOL-1.02","CUA-OPL-1.0","Caldera","Caldera-no-preamble","Catharon","ClArtistic","Clips","Community-Spec-1.0","Condor-1.1","Cornell-Lossless-JPEG","Cronyx","Crossword","CryptoSwift","CrystalStacker","Cube","D-FSL-1.0","DEC-3-Clause","DL-DE-BY-2.0","DL-DE-ZERO-2.0","DOC","DRL-1.0","DRL-1.1","DSDP","DocBook-DTD","DocBook-Schema","DocBook-Stylesheet","DocBook-XML","Dotseqn","ECL-1.0","ECL-2.0","EFL-1.0","EFL-2.0","EPICS","EPL-1.0","EPL-2.0","EUDatagrid","EUPL-1.0","EUPL-1.1","EUPL-1.2","Elastic-2.0","Entessa","ErlPL-1.1","Eurosym","FBM","FDK-AAC","FSFAP","FSFAP-no-warranty-disclaimer","FSFUL","FSFULLR","FSFULLRSD","FSFULLRWD","FSL-1.1-ALv2","FSL-1.1-MIT","FTL","Fair","Ferguson-Twofish","Frameworx-1.0","FreeBSD-DOC","FreeImage","Furuseth","GCR-docs","GD","GFDL-1.1-invariants-only","GFDL-1.1-invariants-or-later","GFDL-1.1-no-invariants-only","GFDL-1.1-no-invariants-or-later","GFDL-1.1-only","GFDL-1.1-or-later","GFDL-1.2-invariants-only","GFDL-1.2-invariants-or-later","GFDL-1.2-no-invariants-only","GFDL-1.2-no-invariants-or-later","GFDL-1.2-only","GFDL-1.2-or-later","GFDL-1.3-invariants-only","GFDL-1.3-invariants-or-later","GFDL-1.3-no-invariants-only","GFDL-1.3-no-invariants-or-later","GFDL-1.3-only","GFDL-1.3-or-later","GL2PS","GLWTPL","GPL-1.0-only","GPL-1.0-or-later","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0-only","GPL-3.0-or-later","Game-Programming-Gems","Giftware","Glide","Glulxe","Graphics-Gems","Gutmann","HDF5","HIDAPI","HP-1986","HP-1989","HPND","HPND-DEC","HPND-Fenneberg-Livingston","HPND-INRIA-IMAG","HPND-Intel","HPND-Kevlin-Henney","HPND-MIT-disclaimer","HPND-Markus-Kuhn","HPND-Netrek","HPND-Pbmplus","HPND-UC","HPND-UC-export-US","HPND-doc","HPND-doc-sell","HPND-export-US","HPND-export-US-acknowledgement","HPND-export-US-modify","HPND-export2-US","HPND-merchantability-variant","HPND-sell-MIT-disclaimer-xserver","HPND-sell-regexpr","HPND-sell-variant","HPND-sell-variant-MIT-disclaimer","HPND-sell-variant-MIT-disclaimer-rev","HTMLTIDY","HaskellReport","Hippocratic-2.1","IBM-pibs","ICU","IEC-Code-Components-EULA","IJG","IJG-short","IPA","IPL-1.0","ISC","ISC-Veillard","ImageMagick","Imlib2","Info-ZIP","Inner-Net-2.0","InnoSetup","Intel","Intel-ACPI","Interbase-1.0","JPL-image","JPNIC","JSON","Jam","JasPer-2.0","Kastrup","Kazlib","Knuth-CTAN","LAL-1.2","LAL-1.3","LGPL-2.0-only","LGPL-2.0-or-later","LGPL-2.1-only","LGPL-2.1-or-later","LGPL-3.0-only","LGPL-3.0-or-later","LGPLLR","LOOP","LPD-document","LPL-1.0","LPL-1.02","LPPL-1.0","LPPL-1.1","LPPL-1.2","LPPL-1.3a","LPPL-1.3c","LZMA-SDK-9.11-to-9.20","LZMA-SDK-9.22","Latex2e","Latex2e-translated-notice","Leptonica","LiLiQ-P-1.1","LiLiQ-R-1.1","LiLiQ-Rplus-1.1","Libpng","Linux-OpenIB","Linux-man-pages-1-para","Linux-man-pages-copyleft","Linux-man-pages-copyleft-2-para","Linux-man-pages-copyleft-var","Lucida-Bitmap-Fonts","MIPS","MIT","MIT-0","MIT-CMU","MIT-Click","MIT-Festival","MIT-Khronos-old","MIT-Modern-Variant","MIT-Wu","MIT-advertising","MIT-enna","MIT-feh","MIT-open-group","MIT-testregex","MITNFA","MMIXware","MPEG-SSG","MPL-1.0","MPL-1.1","MPL-2.0","MPL-2.0-no-copyleft-exception","MS-LPL","MS-PL","MS-RL","MTLL","Mackerras-3-Clause","Mackerras-3-Clause-acknowledgment","MakeIndex","Martin-Birgmeier","McPhee-slideshow","Minpack","MirOS","Motosoto","MulanPSL-1.0","MulanPSL-2.0","Multics","Mup","NAIST-2003","NASA-1.3","NBPL-1.0","NCBI-PD","NCGL-UK-2.0","NCL","NCSA","NGPL","NICTA-1.0","NIST-PD","NIST-PD-fallback","NIST-Software","NLOD-1.0","NLOD-2.0","NLPL","NOSL","NPL-1.0","NPL-1.1","NPOSL-3.0","NRL","NTIA-PD","NTP","NTP-0","Naumen","NetCDF","Newsletr","Nokia","Noweb","O-UDA-1.0","OAR","OCCT-PL","OCLC-2.0","ODC-By-1.0","ODbL-1.0","OFFIS","OFL-1.0","OFL-1.0-RFN","OFL-1.0-no-RFN","OFL-1.1","OFL-1.1-RFN","OFL-1.1-no-RFN","OGC-1.0","OGDL-Taiwan-1.0","OGL-Canada-2.0","OGL-UK-1.0","OGL-UK-2.0","OGL-UK-3.0","OGTSL","OLDAP-1.1","OLDAP-1.2","OLDAP-1.3","OLDAP-1.4","OLDAP-2.0","OLDAP-2.0.1","OLDAP-2.1","OLDAP-2.2","OLDAP-2.2.1","OLDAP-2.2.2","OLDAP-2.3","OLDAP-2.4","OLDAP-2.5","OLDAP-2.6","OLDAP-2.7","OLDAP-2.8","OLFL-1.3","OML","OPL-1.0","OPL-UK-3.0","OPUBL-1.0","OSET-PL-2.1","OSL-1.0","OSL-1.1","OSL-2.0","OSL-2.1","OSL-3.0","OpenPBS-2.3","OpenSSL","OpenSSL-standalone","OpenVision","PADL","PDDL-1.0","PHP-3.0","PHP-3.01","PPL","PSF-2.0","Parity-6.0.0","Parity-7.0.0","Pixar","Plexus","PolyForm-Noncommercial-1.0.0","PolyForm-Small-Business-1.0.0","PostgreSQL","Python-2.0","Python-2.0.1","QPL-1.0","QPL-1.0-INRIA-2004","Qhull","RHeCos-1.1","RPL-1.1","RPL-1.5","RPSL-1.0","RSA-MD","RSCPL","Rdisc","Ruby","Ruby-pty","SAX-PD","SAX-PD-2.0","SCEA","SGI-B-1.0","SGI-B-1.1","SGI-B-2.0","SGI-OpenGL","SGP4","SHL-0.5","SHL-0.51","SISSL","SISSL-1.2","SL","SMAIL-GPL","SMLNJ","SMPPL","SNIA","SOFA","SPL-1.0","SSH-OpenSSH","SSH-short","SSLeay-standalone","SSPL-1.0","SUL-1.0","SWL","Saxpath","SchemeReport","Sendmail","Sendmail-8.23","Sendmail-Open-Source-1.1","SimPL-2.0","Sleepycat","Soundex","Spencer-86","Spencer-94","Spencer-99","SugarCRM-1.1.3","Sun-PPP","Sun-PPP-2000","SunPro","Symlinks","TAPR-OHL-1.0","TCL","TCP-wrappers","TGPPL-1.0","TMate","TORQUE-1.1","TOSL","TPDL","TPL-1.0","TTWL","TTYP0","TU-Berlin-1.0","TU-Berlin-2.0","TermReadKey","ThirdEye","TrustedQSL","UCAR","UCL-1.0","UMich-Merit","UPL-1.0","URT-RLE","Ubuntu-font-1.0","Unicode-3.0","Unicode-DFS-2015","Unicode-DFS-2016","Unicode-TOU","UnixCrypt","Unlicense","Unlicense-libtelnet","Unlicense-libwhirlpool","VOSTROM","VSL-1.0","Vim","W3C","W3C-19980720","W3C-20150513","WTFPL","Watcom-1.0","Widget-Workshop","Wsuipa","X11","X11-distribute-modifications-variant","X11-swapped","XFree86-1.1","XSkat","Xdebug-1.03","Xerox","Xfig","Xnet","YPL-1.0","YPL-1.1","ZPL-1.1","ZPL-2.0","ZPL-2.1","Zed","Zeeff","Zend-2.0","Zimbra-1.3","Zimbra-1.4","Zlib","any-OSI","any-OSI-perl-modules","bcrypt-Solar-Designer","blessing","bzip2-1.0.6","check-cvs","checkmk","copyleft-next-0.3.0","copyleft-next-0.3.1","curl","cve-tou","diffmark","dtoa","dvipdfm","eGenix","etalab-2.0","fwlw","gSOAP-1.3b","generic-xts","gnuplot","gtkbook","hdparm","iMatix","jove","libpng-1.6.35","libpng-2.0","libselinux-1.0","libtiff","libutil-David-Nugent","lsof","magaz","mailprio","man2html","metamail","mpi-permissive","mpich2","mplus","ngrep","pkgconf","pnmstitch","psfrag","psutils","python-ldap","radvd","snprintf","softSurfer","ssh-keyscan","swrule","threeparttable","ulem","w3m","wwl","xinetd","xkeyboard-config-Zinoviev","xlock","xpp","xzoom","zlib-acknowledgement"]});var HLi=T((Ciu,oic)=>{oic.exports=["AGPL-1.0","AGPL-3.0","BSD-2-Clause-FreeBSD","BSD-2-Clause-NetBSD","GFDL-1.1","GFDL-1.2","GFDL-1.3","GPL-1.0","GPL-2.0","GPL-2.0-with-GCC-exception","GPL-2.0-with-autoconf-exception","GPL-2.0-with-bison-exception","GPL-2.0-with-classpath-exception","GPL-2.0-with-font-exception","GPL-3.0","GPL-3.0-with-GCC-exception","GPL-3.0-with-autoconf-exception","LGPL-2.0","LGPL-2.1","LGPL-3.0","Net-SNMP","Nunit","StandardML-NJ","bzip2-1.0.5","eCos-2.0","wxWindows"]});var VLi=T((Siu,sic)=>{sic.exports=["389-exception","Asterisk-exception","Autoconf-exception-2.0","Autoconf-exception-3.0","Autoconf-exception-generic","Autoconf-exception-generic-3.0","Autoconf-exception-macro","Bison-exception-1.24","Bison-exception-2.2","Bootloader-exception","Classpath-exception-2.0","CLISP-exception-2.0","cryptsetup-OpenSSL-exception","DigiRule-FOSS-exception","eCos-exception-2.0","Fawkes-Runtime-exception","FLTK-exception","fmt-exception","Font-exception-2.0","freertos-exception-2.0","GCC-exception-2.0","GCC-exception-2.0-note","GCC-exception-3.1","Gmsh-exception","GNAT-exception","GNOME-examples-exception","GNU-compiler-exception","gnu-javamail-exception","GPL-3.0-interface-exception","GPL-3.0-linking-exception","GPL-3.0-linking-source-exception","GPL-CC-1.0","GStreamer-exception-2005","GStreamer-exception-2008","i2p-gpl-java-exception","KiCad-libraries-exception","LGPL-3.0-linking-exception","libpri-OpenH323-exception","Libtool-exception","Linux-syscall-note","LLGPL","LLVM-exception","LZMA-exception","mif-exception","OCaml-LGPL-linking-exception","OCCT-exception-1.0","OpenJDK-assembly-exception-1.0","openvpn-openssl-exception","PS-or-PDF-font-exception-20170817","QPL-1.0-INRIA-2004-exception","Qt-GPL-exception-1.0","Qt-LGPL-exception-1.1","Qwt-exception-1.0","SANE-exception","SHL-2.0","SHL-2.1","stunnel-exception","SWI-exception","Swift-exception","Texinfo-exception","u-boot-exception-2.0","UBDL-exception","Universal-FOSS-exception-1.0","vsftpd-openssl-exception","WxWindows-exception-3.1","x11vnc-openssl-exception"]});var zLi=T((wiu,WLi)=>{"use strict";var aic=[].concat(UEr()).concat(HLi()),cic=VLi();WLi.exports=function(t){var e=0;function r(){return e<t.length}function n(g){if(g instanceof RegExp){var A=t.slice(e),y=A.match(g);if(y)return e+=y[0].length,y[0]}else if(t.indexOf(g,e)===e)return e+=g.length,g}function o(){n(/[ ]*/)}function s(){for(var g,A=["WITH","AND","OR","(",")",":","+"],y=0;y<A.length&&(g=n(A[y]),!g);y++);if(g==="+"&&e>1&&t[e-2]===" ")throw new Error("Space before `+`");return g&&{type:"OPERATOR",string:g}}function a(){return n(/[A-Za-z0-9-.]+/)}function c(){var g=a();if(!g)throw new Error("Expected idstring at offset "+e);return g}function u(){if(n("DocumentRef-")){var g=c();return{type:"DOCUMENTREF",string:g}}}function d(){if(n("LicenseRef-")){var g=c();return{type:"LICENSEREF",string:g}}}function f(){var g=e,A=a();if(aic.indexOf(A)!==-1)return{type:"LICENSE",string:A};if(cic.indexOf(A)!==-1)return{type:"EXCEPTION",string:A};e=g}function p(){return s()||u()||d()||f()}for(var h=[];r()&&(o(),!!r());){var m=p();if(!m)throw new Error("Unexpected `"+t[e]+"` at offset "+e);h.push(m)}return h}});var KLi=T((xiu,YLi)=>{"use strict";YLi.exports=function(t){var e=0;function r(){return e<t.length}function n(){return r()?t[e]:null}function o(){if(!r())throw new Error;e++}function s(A){var y=n();if(y&&y.type==="OPERATOR"&&A===y.string)return o(),y.string}function a(){if(s("WITH")){var A=n();if(A&&A.type==="EXCEPTION")return o(),A.string;throw new Error("Expected exception after `WITH`")}}function c(){var A=e,y="",E=n();if(E.type==="DOCUMENTREF"&&(o(),y+="DocumentRef-"+E.string+":",!s(":")))throw new Error("Expected `:` after `DocumentRef-...`");if(E=n(),E.type==="LICENSEREF")return o(),y+="LicenseRef-"+E.string,{license:y};e=A}function u(){var A=n();if(A&&A.type==="LICENSE"){o();var y={license:A.string};s("+")&&(y.plus=!0);var E=a();return E&&(y.exception=E),y}}function d(){var A=s("(");if(A){var y=m();if(!s(")"))throw new Error("Expected `)`");return y}}function f(){return d()||c()||u()}function p(A,y){return function E(){var v=y();if(v){if(!s(A))return v;var b=E();if(!b)throw new Error("Expected expression");return{left:v,conjunction:A.toLowerCase(),right:b}}}}var h=p("AND",f),m=p("OR",h),g=m();if(!g||r())throw new Error("Syntax error");return g}});var $Er=T((Tiu,JLi)=>{"use strict";var lic=zLi(),uic=KLi();JLi.exports=function(t){return uic(lic(t))}});var sUi=T((Diu,oUi)=>{var dic=$Er(),fic=UEr();function a0t(t){try{return dic(t),!0}catch{return!1}}function iUi(t,e){var r=e[0].length-t[0].length;return r!==0?r:t[0].toUpperCase().localeCompare(e[0].toUpperCase())}var XLi=[["APGL","AGPL"],["Gpl","GPL"],["GLP","GPL"],["APL","Apache"],["ISD","ISC"],["GLP","GPL"],["IST","ISC"],["Claude","Clause"],[" or later","+"],[" International",""],["GNU","GPL"],["GUN","GPL"],["+",""],["GNU GPL","GPL"],["GNU LGPL","LGPL"],["GNU/GPL","GPL"],["GNU GLP","GPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL"],["GNU Lesser General Public License","LGPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["GNU Lesser General Public License","LGPL-2.1"],["LESSER GENERAL PUBLIC LICENSE","LGPL"],["Lesser General Public License","LGPL"],["LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["Lesser General Public License","LGPL-2.1"],["GNU General Public License","GPL"],["Gnu public license","GPL"],["GNU Public License","GPL"],["GNU GENERAL PUBLIC LICENSE","GPL"],["MTI","MIT"],["Mozilla Public License","MPL"],["Universal Permissive License","UPL"],["WTH","WTF"],["WTFGPL","WTFPL"],["-License",""]].sort(iUi),pic=0,hic=1,ZLi=[function(t){return t.toUpperCase()},function(t){return t.trim()},function(t){return t.replace(/\./g,"")},function(t){return t.replace(/\s+/g,"")},function(t){return t.replace(/\s+/g,"-")},function(t){return t.replace("v","-")},function(t){return t.replace(/,?\s*(\d)/,"-$1")},function(t){return t.replace(/,?\s*(\d)/,"-$1.0")},function(t){return t.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2")},function(t){return t.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2.0")},function(t){return t[0].toUpperCase()+t.slice(1)},function(t){return t.replace("/","-")},function(t){return t.replace(/\s*V\s*(\d)/,"-$1").replace(/(\d)$/,"$1.0")},function(t){return t.indexOf("3.0")!==-1?t+"-or-later":t+"-only"},function(t){return t+"only"},function(t){return t.replace(/(\d)$/,"-$1.0")},function(t){return t.replace(/(-| )?(\d)$/,"-$2-Clause")},function(t){return t.replace(/(-| )clause(-| )(\d)/,"-$3-Clause")},function(t){return t.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,"BSD-3-Clause")},function(t){return t.replace(/\bSimplified(-| )?BSD((-| )License)?/i,"BSD-2-Clause")},function(t){return t.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,"BSD-2-Clause-$1BSD")},function(t){return t.replace(/\bClear(-| )?BSD((-| )License)?/i,"BSD-3-Clause-Clear")},function(t){return t.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,"BSD-4-Clause")},function(t){return"CC-"+t},function(t){return"CC-"+t+"-4.0"},function(t){return t.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")},function(t){return"CC-"+t.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")+"-4.0"}],jEr=fic.map(function(t){var e=/^(.*)-\d+\.\d+$/.exec(t);return e?[e[0],e[1]]:[t,null]}).reduce(function(t,e){var r=e[1];return t[r]=t[r]||[],t[r].push(e[0]),t},{}),mic=Object.keys(jEr).map(function(e){return[e,jEr[e]]}).filter(function(e){return e[1].length===1&&e[0]!==null&&e[0]!=="APL"}).map(function(e){return[e[0],e[1][0]]});jEr=void 0;var eUi=[["UNLI","Unlicense"],["WTF","WTFPL"],["2 CLAUSE","BSD-2-Clause"],["2-CLAUSE","BSD-2-Clause"],["3 CLAUSE","BSD-3-Clause"],["3-CLAUSE","BSD-3-Clause"],["AFFERO","AGPL-3.0-or-later"],["AGPL","AGPL-3.0-or-later"],["APACHE","Apache-2.0"],["ARTISTIC","Artistic-2.0"],["Affero","AGPL-3.0-or-later"],["BEER","Beerware"],["BOOST","BSL-1.0"],["BSD","BSD-2-Clause"],["CDDL","CDDL-1.1"],["ECLIPSE","EPL-1.0"],["FUCK","WTFPL"],["GNU","GPL-3.0-or-later"],["LGPL","LGPL-3.0-or-later"],["GPLV1","GPL-1.0-only"],["GPL-1","GPL-1.0-only"],["GPLV2","GPL-2.0-only"],["GPL-2","GPL-2.0-only"],["GPL","GPL-3.0-or-later"],["MIT +NO-FALSE-ATTRIBS","MITNFA"],["MIT","MIT"],["MPL","MPL-2.0"],["X11","X11"],["ZLIB","Zlib"]].concat(mic).sort(iUi),gic=0,Aic=1,tUi=function(t){for(var e=0;e<ZLi.length;e++){var r=ZLi[e](t).trim();if(r!==t&&a0t(r))return r}return null},rUi=function(t){for(var e=t.toUpperCase(),r=0;r<eUi.length;r++){var n=eUi[r];if(e.indexOf(n[gic])>-1)return n[Aic]}return null},nUi=function(t,e){for(var r=0;r<XLi.length;r++){var n=XLi[r],o=n[pic];if(t.indexOf(o)>-1){var s=t.replace(o,n[hic]),a=e(s);if(a!==null)return a}}return null};oUi.exports=function(t,e){e=e||{};var r=e.upgrade===void 0?!0:!!e.upgrade;function n(c){return r?yic(c):c}var o=typeof t=="string"&&t.trim().length!==0;if(!o)throw Error("Invalid argument. Expected non-empty string.");if(t=t.trim(),a0t(t))return n(t);var s=t.replace(/\+$/,"").trim();if(a0t(s))return n(s);var a=tUi(t);return a!==null||(a=nUi(t,function(c){return a0t(c)?c:tUi(c)}),a!==null)||(a=rUi(t),a!==null)||(a=nUi(t,rUi),a!==null)?n(a):null};function yic(t){return["GPL-1.0","LGPL-1.0","AGPL-1.0","GPL-2.0","LGPL-2.0","AGPL-2.0","LGPL-2.1"].indexOf(t)!==-1?t+"-only":["GPL-1.0+","GPL-2.0+","GPL-3.0+","LGPL-2.0+","LGPL-2.1+","LGPL-3.0+","AGPL-1.0+","AGPL-3.0+"].indexOf(t)!==-1?t.replace(/\+$/,"-or-later"):["GPL-3.0","LGPL-3.0","AGPL-3.0"].indexOf(t)!==-1?t+"-or-later":t}});var uUi=T((Iiu,lUi)=>{var _ic=$Er(),Eic=sUi(),aUi='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',vic=/^SEE LICEN[CS]E IN (.+)$/;function cUi(t,e){return e.slice(0,t.length)===t}function QEr(t){if(t.hasOwnProperty("license")){var e=t.license;return cUi("LicenseRef",e)||cUi("DocumentRef",e)}else return QEr(t.left)||QEr(t.right)}lUi.exports=function(t){var e;try{e=_ic(t)}catch{var r;if(t==="UNLICENSED"||t==="UNLICENCED")return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(r=vic.exec(t))return{validForOldPackages:!0,validForNewPackages:!0,inFile:r[1]};var n={validForOldPackages:!1,validForNewPackages:!1,warnings:[aUi]};if(t.trim().length!==0){var o=Eic(t);o&&n.warnings.push('license is similar to the valid expression "'+o+'"')}return n}return QEr(e)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[aUi]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}});var mUi=T(l0t=>{"use strict";Object.defineProperty(l0t,"__esModule",{value:!0});l0t.LRUCache=void 0;var Ppe=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,fUi=new Set,GEr=typeof process=="object"&&process?process:{},pUi=(t,e,r,n)=>{typeof GEr.emitWarning=="function"?GEr.emitWarning(t,e,r,n):console.error(`[${r}] ${e}: ${t}`)},c0t=globalThis.AbortController,dUi=globalThis.AbortSignal;if(typeof c0t>"u"){dUi=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,o){this._onabort.push(o)}},c0t=class{constructor(){e()}signal=new dUi;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let o of this.signal._onabort)o(n);this.signal.onabort?.(n)}}};let t=GEr.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,pUi("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var bic=t=>!fUi.has(t),Oiu=Symbol("type"),W$=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),hUi=t=>W$(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?Mpe:null:null,Mpe=class extends Array{constructor(e){super(e),this.fill(0)}},qEr=class t{heap;length;static#e=!1;static create(e){let r=hUi(e);if(!r)return[];t.#e=!0;let n=new t(e,r);return t.#e=!1,n}constructor(e,r){if(!t.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},HEr=class t{#e;#t;#r;#n;#i;#o;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#a;#s;#u;#l;#h;#p;#m;#g;#v;#A;#b;#S;#E;#C;#w;#y;static unsafeExposeInternals(e){return{starts:e.#S,ttls:e.#E,sizes:e.#b,keyMap:e.#s,keyList:e.#u,valList:e.#l,next:e.#h,prev:e.#p,get head(){return e.#m},get tail(){return e.#g},free:e.#v,isBackgroundFetch:r=>e.#f(r),backgroundFetch:(r,n,o,s)=>e.#U(r,n,o,s),moveToTail:r=>e.#P(r),indexes:r=>e.#x(r),rindexes:r=>e.#T(r),isStale:r=>e.#_(r)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#a}get size(){return this.#c}get fetchMethod(){return this.#i}get memoMethod(){return this.#o}get dispose(){return this.#r}get disposeAfter(){return this.#n}constructor(e){let{max:r=0,ttl:n,ttlResolution:o=1,ttlAutopurge:s,updateAgeOnGet:a,updateAgeOnHas:c,allowStale:u,dispose:d,disposeAfter:f,noDisposeOnSet:p,noUpdateTTL:h,maxSize:m=0,maxEntrySize:g=0,sizeCalculation:A,fetchMethod:y,memoMethod:E,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:x,ignoreFetchAbort:k}=e;if(r!==0&&!W$(r))throw new TypeError("max option must be a nonnegative integer");let I=r?hUi(r):Array;if(!I)throw new Error("invalid max value: "+r);if(this.#e=r,this.#t=m,this.maxEntrySize=g||this.#t,this.sizeCalculation=A,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(E!==void 0&&typeof E!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#o=E,y!==void 0&&typeof y!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#i=y,this.#w=!!y,this.#s=new Map,this.#u=new Array(r).fill(void 0),this.#l=new Array(r).fill(void 0),this.#h=new I(r),this.#p=new I(r),this.#m=0,this.#g=0,this.#v=qEr.create(r),this.#c=0,this.#a=0,typeof d=="function"&&(this.#r=d),typeof f=="function"?(this.#n=f,this.#A=[]):(this.#n=void 0,this.#A=void 0),this.#C=!!this.#r,this.#y=!!this.#n,this.noDisposeOnSet=!!p,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!x,this.ignoreFetchAbort=!!k,this.maxEntrySize!==0){if(this.#t!==0&&!W$(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!W$(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#O()}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!c,this.ttlResolution=W$(o)||o===0?o:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!W$(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#R()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let P="LRU_CACHE_UNBOUNDED";bic(P)&&(fUi.add(P),pUi("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",P,t))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#R(){let e=new Mpe(this.#e),r=new Mpe(this.#e);this.#E=e,this.#S=r,this.#M=(s,a,c=Ppe.now())=>{if(r[s]=a!==0?c:0,e[s]=a,a!==0&&this.ttlAutopurge){let u=setTimeout(()=>{this.#_(s)&&this.#D(this.#u[s],"expire")},a+1);u.unref&&u.unref()}},this.#I=s=>{r[s]=e[s]!==0?Ppe.now():0},this.#d=(s,a)=>{if(e[a]){let c=e[a],u=r[a];if(!c||!u)return;s.ttl=c,s.start=u,s.now=n||o();let d=s.now-u;s.remainingTTL=c-d}};let n=0,o=()=>{let s=Ppe.now();if(this.ttlResolution>0){n=s;let a=setTimeout(()=>n=0,this.ttlResolution);a.unref&&a.unref()}return s};this.getRemainingTTL=s=>{let a=this.#s.get(s);if(a===void 0)return 0;let c=e[a],u=r[a];if(!c||!u)return 1/0;let d=(n||o())-u;return c-d},this.#_=s=>{let a=r[s],c=e[s];return!!c&&!!a&&(n||o())-a>c}}#I=()=>{};#d=()=>{};#M=()=>{};#_=()=>!1;#O(){let e=new Mpe(this.#e);this.#a=0,this.#b=e,this.#k=r=>{this.#a-=e[r],e[r]=0},this.#F=(r,n,o,s)=>{if(this.#f(n))return 0;if(!W$(o))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(o=s(n,r),!W$(o))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return o},this.#N=(r,n,o)=>{if(e[r]=n,this.#t){let s=this.#t-e[r];for(;this.#a>s;)this.#B(!0)}this.#a+=e[r],o&&(o.entrySize=n,o.totalCalculatedSize=this.#a)}}#k=e=>{};#N=(e,r,n)=>{};#F=(e,r,n,o)=>{if(n||o)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#x({allowStale:e=this.allowStale}={}){if(this.#c)for(let r=this.#g;!(!this.#L(r)||((e||!this.#_(r))&&(yield r),r===this.#m));)r=this.#p[r]}*#T({allowStale:e=this.allowStale}={}){if(this.#c)for(let r=this.#m;!(!this.#L(r)||((e||!this.#_(r))&&(yield r),r===this.#g));)r=this.#h[r]}#L(e){return e!==void 0&&this.#s.get(this.#u[e])===e}*entries(){for(let e of this.#x())this.#l[e]!==void 0&&this.#u[e]!==void 0&&!this.#f(this.#l[e])&&(yield[this.#u[e],this.#l[e]])}*rentries(){for(let e of this.#T())this.#l[e]!==void 0&&this.#u[e]!==void 0&&!this.#f(this.#l[e])&&(yield[this.#u[e],this.#l[e]])}*keys(){for(let e of this.#x()){let r=this.#u[e];r!==void 0&&!this.#f(this.#l[e])&&(yield r)}}*rkeys(){for(let e of this.#T()){let r=this.#u[e];r!==void 0&&!this.#f(this.#l[e])&&(yield r)}}*values(){for(let e of this.#x())this.#l[e]!==void 0&&!this.#f(this.#l[e])&&(yield this.#l[e])}*rvalues(){for(let e of this.#T())this.#l[e]!==void 0&&!this.#f(this.#l[e])&&(yield this.#l[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let n of this.#x()){let o=this.#l[n],s=this.#f(o)?o.__staleWhileFetching:o;if(s!==void 0&&e(s,this.#u[n],this))return this.get(this.#u[n],r)}}forEach(e,r=this){for(let n of this.#x()){let o=this.#l[n],s=this.#f(o)?o.__staleWhileFetching:o;s!==void 0&&e.call(r,s,this.#u[n],this)}}rforEach(e,r=this){for(let n of this.#T()){let o=this.#l[n],s=this.#f(o)?o.__staleWhileFetching:o;s!==void 0&&e.call(r,s,this.#u[n],this)}}purgeStale(){let e=!1;for(let r of this.#T({allowStale:!0}))this.#_(r)&&(this.#D(this.#u[r],"expire"),e=!0);return e}info(e){let r=this.#s.get(e);if(r===void 0)return;let n=this.#l[r],o=this.#f(n)?n.__staleWhileFetching:n;if(o===void 0)return;let s={value:o};if(this.#E&&this.#S){let a=this.#E[r],c=this.#S[r];if(a&&c){let u=a-(Ppe.now()-c);s.ttl=u,s.start=Date.now()}}return this.#b&&(s.size=this.#b[r]),s}dump(){let e=[];for(let r of this.#x({allowStale:!0})){let n=this.#u[r],o=this.#l[r],s=this.#f(o)?o.__staleWhileFetching:o;if(s===void 0||n===void 0)continue;let a={value:s};if(this.#E&&this.#S){a.ttl=this.#E[r];let c=Ppe.now()-this.#S[r];a.start=Math.floor(Date.now()-c)}this.#b&&(a.size=this.#b[r]),e.unshift([n,a])}return e}load(e){this.clear();for(let[r,n]of e){if(n.start){let o=Date.now()-n.start;n.start=Ppe.now()-o}this.set(r,n.value,n)}}set(e,r,n={}){if(r===void 0)return this.delete(e),this;let{ttl:o=this.ttl,start:s,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:u}=n,{noUpdateTTL:d=this.noUpdateTTL}=n,f=this.#F(e,r,n.size||0,c);if(this.maxEntrySize&&f>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=!0),this.#D(e,"set"),this;let p=this.#c===0?void 0:this.#s.get(e);if(p===void 0)p=this.#c===0?this.#g:this.#v.length!==0?this.#v.pop():this.#c===this.#e?this.#B(!1):this.#c,this.#u[p]=e,this.#l[p]=r,this.#s.set(e,p),this.#h[this.#g]=p,this.#p[p]=this.#g,this.#g=p,this.#c++,this.#N(p,f,u),u&&(u.set="add"),d=!1;else{this.#P(p);let h=this.#l[p];if(r!==h){if(this.#w&&this.#f(h)){h.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=h;m!==void 0&&!a&&(this.#C&&this.#r?.(m,e,"set"),this.#y&&this.#A?.push([m,e,"set"]))}else a||(this.#C&&this.#r?.(h,e,"set"),this.#y&&this.#A?.push([h,e,"set"]));if(this.#k(p),this.#N(p,f,u),this.#l[p]=r,u){u.set="replace";let m=h&&this.#f(h)?h.__staleWhileFetching:h;m!==void 0&&(u.oldValue=m)}}else u&&(u.set="update")}if(o!==0&&!this.#E&&this.#R(),this.#E&&(d||this.#M(p,o,s),u&&this.#d(u,p)),!a&&this.#y&&this.#A){let h=this.#A,m;for(;m=h?.shift();)this.#n?.(...m)}return this}pop(){try{for(;this.#c;){let e=this.#l[this.#m];if(this.#B(!0),this.#f(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#y&&this.#A){let e=this.#A,r;for(;r=e?.shift();)this.#n?.(...r)}}}#B(e){let r=this.#m,n=this.#u[r],o=this.#l[r];return this.#w&&this.#f(o)?o.__abortController.abort(new Error("evicted")):(this.#C||this.#y)&&(this.#C&&this.#r?.(o,n,"evict"),this.#y&&this.#A?.push([o,n,"evict"])),this.#k(r),e&&(this.#u[r]=void 0,this.#l[r]=void 0,this.#v.push(r)),this.#c===1?(this.#m=this.#g=0,this.#v.length=0):this.#m=this.#h[r],this.#s.delete(n),this.#c--,r}has(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:o}=r,s=this.#s.get(e);if(s!==void 0){let a=this.#l[s];if(this.#f(a)&&a.__staleWhileFetching===void 0)return!1;if(this.#_(s))o&&(o.has="stale",this.#d(o,s));else return n&&this.#I(s),o&&(o.has="hit",this.#d(o,s)),!0}else o&&(o.has="miss");return!1}peek(e,r={}){let{allowStale:n=this.allowStale}=r,o=this.#s.get(e);if(o===void 0||!n&&this.#_(o))return;let s=this.#l[o];return this.#f(s)?s.__staleWhileFetching:s}#U(e,r,n,o){let s=r===void 0?void 0:this.#l[r];if(this.#f(s))return s;let a=new c0t,{signal:c}=n;c?.addEventListener("abort",()=>a.abort(c.reason),{signal:a.signal});let u={signal:a.signal,options:n,context:o},d=(A,y=!1)=>{let{aborted:E}=a.signal,v=n.ignoreFetchAbort&&A!==void 0;if(n.status&&(E&&!y?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,v&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),E&&!v&&!y)return p(a.signal.reason);let b=m;return this.#l[r]===m&&(A===void 0?b.__staleWhileFetching?this.#l[r]=b.__staleWhileFetching:this.#D(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.set(e,A,u.options))),A},f=A=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=A),p(A)),p=A=>{let{aborted:y}=a.signal,E=y&&n.allowStaleOnFetchAbort,v=E||n.allowStaleOnFetchRejection,b=v||n.noDeleteOnFetchRejection,S=m;if(this.#l[r]===m&&(!b||S.__staleWhileFetching===void 0?this.#D(e,"fetch"):E||(this.#l[r]=S.__staleWhileFetching)),v)return n.status&&S.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),S.__staleWhileFetching;if(S.__returned===S)throw A},h=(A,y)=>{let E=this.#i?.(e,s,u);E&&E instanceof Promise&&E.then(v=>A(v===void 0?void 0:v),y),a.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(A(void 0),n.allowStaleOnFetchAbort&&(A=v=>d(v,!0)))})};n.status&&(n.status.fetchDispatched=!0);let m=new Promise(h).then(d,f),g=Object.assign(m,{__abortController:a,__staleWhileFetching:s,__returned:void 0});return r===void 0?(this.set(e,g,{...u.options,status:void 0}),r=this.#s.get(e)):this.#l[r]=g,g}#f(e){if(!this.#w)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof c0t}async fetch(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:u=0,sizeCalculation:d=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:p=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:m=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:A,forceRefresh:y=!1,status:E,signal:v}=r;if(!this.#w)return E&&(E.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:o,noDeleteOnStaleGet:s,status:E});let b={allowStale:n,updateAgeOnGet:o,noDeleteOnStaleGet:s,ttl:a,noDisposeOnSet:c,size:u,sizeCalculation:d,noUpdateTTL:f,noDeleteOnFetchRejection:p,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:g,ignoreFetchAbort:m,status:E,signal:v},S=this.#s.get(e);if(S===void 0){E&&(E.fetch="miss");let x=this.#U(e,S,b,A);return x.__returned=x}else{let x=this.#l[S];if(this.#f(x)){let O=n&&x.__staleWhileFetching!==void 0;return E&&(E.fetch="inflight",O&&(E.returnedStale=!0)),O?x.__staleWhileFetching:x.__returned=x}let k=this.#_(S);if(!y&&!k)return E&&(E.fetch="hit"),this.#P(S),o&&this.#I(S),E&&this.#d(E,S),x;let I=this.#U(e,S,b,A),D=I.__staleWhileFetching!==void 0&&n;return E&&(E.fetch=k?"stale":"refresh",D&&k&&(E.returnedStale=!0)),D?I.__staleWhileFetching:I.__returned=I}}async forceFetch(e,r={}){let n=await this.fetch(e,r);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,r={}){let n=this.#o;if(!n)throw new Error("no memoMethod provided to constructor");let{context:o,forceRefresh:s,...a}=r,c=this.get(e,a);if(!s&&c!==void 0)return c;let u=n(e,c,{options:a,context:o});return this.set(e,u,a),u}get(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:a}=r,c=this.#s.get(e);if(c!==void 0){let u=this.#l[c],d=this.#f(u);return a&&this.#d(a,c),this.#_(c)?(a&&(a.get="stale"),d?(a&&n&&u.__staleWhileFetching!==void 0&&(a.returnedStale=!0),n?u.__staleWhileFetching:void 0):(s||this.#D(e,"expire"),a&&n&&(a.returnedStale=!0),n?u:void 0)):(a&&(a.get="hit"),d?u.__staleWhileFetching:(this.#P(c),o&&this.#I(c),u))}else a&&(a.get="miss")}#$(e,r){this.#p[r]=e,this.#h[e]=r}#P(e){e!==this.#g&&(e===this.#m?this.#m=this.#h[e]:this.#$(this.#p[e],this.#h[e]),this.#$(this.#g,e),this.#g=e)}delete(e){return this.#D(e,"delete")}#D(e,r){let n=!1;if(this.#c!==0){let o=this.#s.get(e);if(o!==void 0)if(n=!0,this.#c===1)this.#j(r);else{this.#k(o);let s=this.#l[o];if(this.#f(s)?s.__abortController.abort(new Error("deleted")):(this.#C||this.#y)&&(this.#C&&this.#r?.(s,e,r),this.#y&&this.#A?.push([s,e,r])),this.#s.delete(e),this.#u[o]=void 0,this.#l[o]=void 0,o===this.#g)this.#g=this.#p[o];else if(o===this.#m)this.#m=this.#h[o];else{let a=this.#p[o];this.#h[a]=this.#h[o];let c=this.#h[o];this.#p[c]=this.#p[o]}this.#c--,this.#v.push(o)}}if(this.#y&&this.#A?.length){let o=this.#A,s;for(;s=o?.shift();)this.#n?.(...s)}return n}clear(){return this.#j("delete")}#j(e){for(let r of this.#T({allowStale:!0})){let n=this.#l[r];if(this.#f(n))n.__abortController.abort(new Error("deleted"));else{let o=this.#u[r];this.#C&&this.#r?.(n,o,e),this.#y&&this.#A?.push([n,o,e])}}if(this.#s.clear(),this.#l.fill(void 0),this.#u.fill(void 0),this.#E&&this.#S&&(this.#E.fill(0),this.#S.fill(0)),this.#b&&this.#b.fill(0),this.#m=0,this.#g=0,this.#v.length=0,this.#a=0,this.#c=0,this.#y&&this.#A){let r=this.#A,n;for(;n=r?.shift();)this.#n?.(...n)}}};l0t.LRUCache=HEr});var yUi=T((Biu,AUi)=>{"use strict";var Cl=(...t)=>t.every(e=>e)?t.join(""):"",tg=t=>t?encodeURIComponent(t):"",gUi=t=>t.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-"),Cic={sshtemplate:({domain:t,user:e,project:r,committish:n})=>`git@${t}:${e}/${r}.git${Cl("#",n)}`,sshurltemplate:({domain:t,user:e,project:r,committish:n})=>`git+ssh://git@${t}/${e}/${r}.git${Cl("#",n)}`,edittemplate:({domain:t,user:e,project:r,committish:n,editpath:o,path:s})=>`https://${t}/${e}/${r}${Cl("/",o,"/",tg(n||"HEAD"),"/",s)}`,browsetemplate:({domain:t,user:e,project:r,committish:n,treepath:o})=>`https://${t}/${e}/${r}${Cl("/",o,"/",tg(n))}`,browsetreetemplate:({domain:t,user:e,project:r,committish:n,treepath:o,path:s,fragment:a,hashformat:c})=>`https://${t}/${e}/${r}/${o}/${tg(n||"HEAD")}/${s}${Cl("#",c(a||""))}`,browseblobtemplate:({domain:t,user:e,project:r,committish:n,blobpath:o,path:s,fragment:a,hashformat:c})=>`https://${t}/${e}/${r}/${o}/${tg(n||"HEAD")}/${s}${Cl("#",c(a||""))}`,docstemplate:({domain:t,user:e,project:r,treepath:n,committish:o})=>`https://${t}/${e}/${r}${Cl("/",n,"/",tg(o))}#readme`,httpstemplate:({auth:t,domain:e,user:r,project:n,committish:o})=>`git+https://${Cl(t,"@")}${e}/${r}/${n}.git${Cl("#",o)}`,filetemplate:({domain:t,user:e,project:r,committish:n,path:o})=>`https://${t}/${e}/${r}/raw/${tg(n||"HEAD")}/${o}`,shortcuttemplate:({type:t,user:e,project:r,committish:n})=>`${t}:${e}/${r}${Cl("#",n)}`,pathtemplate:({user:t,project:e,committish:r})=>`${t}/${e}${Cl("#",r)}`,bugstemplate:({domain:t,user:e,project:r})=>`https://${t}/${e}/${r}/issues`,hashformat:gUi},z$={};z$.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth:t,user:e,project:r,committish:n,path:o})=>`https://${Cl(t,"@")}raw.githubusercontent.com/${e}/${r}/${tg(n||"HEAD")}/${o}`,gittemplate:({auth:t,domain:e,user:r,project:n,committish:o})=>`git://${Cl(t,"@")}${e}/${r}/${n}.git${Cl("#",o)}`,tarballtemplate:({domain:t,user:e,project:r,committish:n})=>`https://codeload.${t}/${e}/${r}/tar.gz/${tg(n||"HEAD")}`,extract:t=>{let[,e,r,n,o]=t.pathname.split("/",5);if(!(n&&n!=="tree")&&(n||(o=t.hash.slice(1)),r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:o}}};z$.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain:t,user:e,project:r,committish:n,treepath:o,path:s,editpath:a})=>`https://${t}/${e}/${r}${Cl("/",o,"/",tg(n||"HEAD"),"/",s,a)}`,tarballtemplate:({domain:t,user:e,project:r,committish:n})=>`https://${t}/${e}/${r}/get/${tg(n||"HEAD")}.tar.gz`,extract:t=>{let[,e,r,n]=t.pathname.split("/",4);if(!["get"].includes(n)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:t.hash.slice(1)}}};z$.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",httpstemplate:({auth:t,domain:e,user:r,project:n,committish:o})=>`git+https://${Cl(t,"@")}${e}/${r}/${n}.git${Cl("#",o)}`,tarballtemplate:({domain:t,user:e,project:r,committish:n})=>`https://${t}/${e}/${r}/repository/archive.tar.gz?ref=${tg(n||"HEAD")}`,extract:t=>{let e=t.pathname.slice(1);if(e.includes("/-/")||e.includes("/archive.tar.gz"))return;let r=e.split("/"),n=r.pop();n.endsWith(".git")&&(n=n.slice(0,-4));let o=r.join("/");if(!(!o||!n))return{user:o,project:n,committish:t.hash.slice(1)}}};z$.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain:t,project:e,committish:r})=>`git@${t}:${e}.git${Cl("#",r)}`,sshurltemplate:({domain:t,project:e,committish:r})=>`git+ssh://git@${t}/${e}.git${Cl("#",r)}`,edittemplate:({domain:t,user:e,project:r,committish:n,editpath:o})=>`https://${t}/${e}/${r}${Cl("/",tg(n))}/${o}`,browsetemplate:({domain:t,project:e,committish:r})=>`https://${t}/${e}${Cl("/",tg(r))}`,browsetreetemplate:({domain:t,project:e,committish:r,path:n,hashformat:o})=>`https://${t}/${e}${Cl("/",tg(r))}${Cl("#",o(n))}`,browseblobtemplate:({domain:t,project:e,committish:r,path:n,hashformat:o})=>`https://${t}/${e}${Cl("/",tg(r))}${Cl("#",o(n))}`,docstemplate:({domain:t,project:e,committish:r})=>`https://${t}/${e}${Cl("/",tg(r))}`,httpstemplate:({domain:t,project:e,committish:r})=>`git+https://${t}/${e}.git${Cl("#",r)}`,filetemplate:({user:t,project:e,committish:r,path:n})=>`https://gist.githubusercontent.com/${t}/${e}/raw${Cl("/",tg(r))}/${n}`,shortcuttemplate:({type:t,project:e,committish:r})=>`${t}:${e}${Cl("#",r)}`,pathtemplate:({project:t,committish:e})=>`${t}${Cl("#",e)}`,bugstemplate:({domain:t,project:e})=>`https://${t}/${e}`,gittemplate:({domain:t,project:e,committish:r})=>`git://${t}/${e}.git${Cl("#",r)}`,tarballtemplate:({project:t,committish:e})=>`https://codeload.github.com/gist/${t}/tar.gz/${tg(e||"HEAD")}`,extract:t=>{let[,e,r,n]=t.pathname.split("/",4);if(n!=="raw"){if(!r){if(!e)return;r=e,e=null}return r.endsWith(".git")&&(r=r.slice(0,-4)),{user:e,project:r,committish:t.hash.slice(1)}}},hashformat:function(t){return t&&"file-"+gUi(t)}};z$.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain:t,user:e,project:r,committish:n,path:o})=>`https://${t}/${e}/${r}/blob/${tg(n)||"HEAD"}/${o}`,httpstemplate:({domain:t,user:e,project:r,committish:n})=>`https://${t}/${e}/${r}.git${Cl("#",n)}`,tarballtemplate:({domain:t,user:e,project:r,committish:n})=>`https://${t}/${e}/${r}/archive/${tg(n)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:t=>{let[,e,r,n]=t.pathname.split("/",4);if(!["archive"].includes(n)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:t.hash.slice(1)}}};for(let[t,e]of Object.entries(z$))z$[t]=Object.assign({},Cic,e);AUi.exports=z$});var WEr=T((Piu,EUi)=>{var Sic=me("url"),VEr=(t,e,r)=>{let n=t.indexOf(r);return t.lastIndexOf(e,n>-1?n:1/0)},_Ui=t=>{try{return new Sic.URL(t)}catch{}},wic=(t,e)=>{let r=t.indexOf(":"),n=t.slice(0,r+1);if(Object.prototype.hasOwnProperty.call(e,n))return t;let o=t.indexOf("@");return o>-1?o>r?`git+ssh://${t}`:t:t.indexOf("//")===r+1?t:`${t.slice(0,r+1)}//${t.slice(r+1)}`},xic=t=>{let e=VEr(t,"@","#"),r=VEr(t,":","#");return r>e&&(t=t.slice(0,r)+"/"+t.slice(r+1)),VEr(t,":","#")===-1&&t.indexOf("//")===-1&&(t=`git+ssh://${t}`),t};EUi.exports=(t,e)=>{let r=e?wic(t,e):t;return _Ui(r)||_Ui(xic(r))}});var bUi=T((Miu,vUi)=>{"use strict";var Tic=WEr(),Dic=t=>{let e=t.indexOf("#"),r=t.indexOf("/"),n=t.indexOf("/",r+1),o=t.indexOf(":"),s=/\s/.exec(t),a=t.indexOf("@"),c=!s||e>-1&&s.index>e,u=a===-1||e>-1&&a>e,d=o===-1||e>-1&&o>e,f=n===-1||e>-1&&n>e,p=r>0,h=e>-1?t[e-1]!=="/":!t.endsWith("/"),m=!t.startsWith(".");return c&&p&&h&&m&&u&&d&&f};vUi.exports=(t,e,{gitHosts:r,protocols:n})=>{if(!t)return;let o=Dic(t)?`github:${t}`:t,s=Tic(o,n);if(!s)return;let a=r.byShortcut[s.protocol],c=r.byDomain[s.hostname.startsWith("www.")?s.hostname.slice(4):s.hostname],u=a||c;if(!u)return;let d=r[a||c],f=null;n[s.protocol]?.auth&&(s.username||s.password)&&(f=`${s.username}${s.password?":"+s.password:""}`);let p=null,h=null,m=null,g=null;try{if(a){let A=s.pathname.startsWith("/")?s.pathname.slice(1):s.pathname,y=A.indexOf("@");y>-1&&(A=A.slice(y+1));let E=A.lastIndexOf("/");E>-1?(h=decodeURIComponent(A.slice(0,E)),h||(h=null),m=decodeURIComponent(A.slice(E+1))):m=decodeURIComponent(A),m.endsWith(".git")&&(m=m.slice(0,-4)),s.hash&&(p=decodeURIComponent(s.hash.slice(1))),g="shortcut"}else{if(!d.protocols.includes(s.protocol))return;let A=d.extract(s);if(!A)return;h=A.user&&decodeURIComponent(A.user),m=decodeURIComponent(A.project),p=decodeURIComponent(A.committish),g=n[s.protocol]?.name||s.protocol.slice(0,-1)}}catch(A){if(A instanceof URIError)return;throw A}return[u,h,f,m,p,g,e]}});var SUi=T((Fiu,CUi)=>{"use strict";var{LRUCache:Iic}=mUi(),Ric=yUi(),kic=bUi(),Oic=WEr(),zEr=new Iic({max:1e3}),u0t=class t{constructor(e,r,n,o,s,a,c={}){Object.assign(this,t.#e[e],{type:e,user:r,auth:n,project:o,committish:s,default:a,opts:c})}static#e={byShortcut:{},byDomain:{}};static#t={"git+ssh:":{name:"sshurl"},"ssh:":{name:"sshurl"},"git+https:":{name:"https",auth:!0},"git:":{auth:!0},"http:":{auth:!0},"https:":{auth:!0},"git+http:":{auth:!0}};static addHost(e,r){t.#e[e]=r,t.#e.byDomain[r.domain]=e,t.#e.byShortcut[`${e}:`]=e,t.#t[`${e}:`]={name:e}}static fromUrl(e,r){if(typeof e!="string")return;let n=e+JSON.stringify(r||{});if(!zEr.has(n)){let o=kic(e,r,{gitHosts:t.#e,protocols:t.#t});zEr.set(n,o?new t(...o):void 0)}return zEr.get(n)}static parseUrl(e){return Oic(e)}#r(e,r){if(typeof e!="function")return null;let n={...this,...this.opts,...r};n.path||(n.path=""),n.path.startsWith("/")&&(n.path=n.path.slice(1)),n.noCommittish&&(n.committish=null);let o=e(n);return n.noGitPlus&&o.startsWith("git+")?o.slice(4):o}hash(){return this.committish?`#${this.committish}`:""}ssh(e){return this.#r(this.sshtemplate,e)}sshurl(e){return this.#r(this.sshurltemplate,e)}browse(e,...r){return typeof e!="string"?this.#r(this.browsetemplate,e):typeof r[0]!="string"?this.#r(this.browsetreetemplate,{...r[0],path:e}):this.#r(this.browsetreetemplate,{...r[1],fragment:r[0],path:e})}browseFile(e,...r){return typeof r[0]!="string"?this.#r(this.browseblobtemplate,{...r[0],path:e}):this.#r(this.browseblobtemplate,{...r[1],fragment:r[0],path:e})}docs(e){return this.#r(this.docstemplate,e)}bugs(e){return this.#r(this.bugstemplate,e)}https(e){return this.#r(this.httpstemplate,e)}git(e){return this.#r(this.gittemplate,e)}shortcut(e){return this.#r(this.shortcuttemplate,e)}path(e){return this.#r(this.pathtemplate,e)}tarball(e){return this.#r(this.tarballtemplate,{...e,noCommittish:!1})}file(e,r){return this.#r(this.filetemplate,{...r,path:e})}edit(e,r){return this.#r(this.edittemplate,{...r,path:e})}getDefaultRepresentation(){return this.default}toString(e){return this.default&&typeof this[this.default]=="function"?this[this.default](e):this.sshurl(e)}};for(let[t,e]of Object.entries(Ric))u0t.addHost(t,e);CUi.exports=u0t});var xUi=T((Liu,wUi)=>{wUi.exports=Nic;function Nic(t){if(!t||t==="ERROR: No README data found!")return;t=t.trim().split(`
5891
- `);let e=0;for(;t[e]&&t[e].trim().match(/^(#|$)/);)e++;let r=t.length,n=e+1;for(;n<r&&t[n].trim();)n++;return t.slice(e,n).join(" ").trim()}});var TUi=T((Uiu,Bic)=>{Bic.exports={topLevel:{dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},bugs:{web:"url",name:"url"},script:{server:"start",tests:"test"}}});var kUi=T(($iu,RUi)=>{var Pic=FEr(),Mic=LEr(),Fic=uUi(),d0t=SUi(),Lic=me("node:module"),Uic=["dependencies","devDependencies","optionalDependencies"],$ic=xUi(),YEr=me("url"),Y$=TUi(),DUi=t=>t.includes("@")&&t.indexOf("@")<t.lastIndexOf(".");RUi.exports={warn:function(){},fixRepositoryField:function(t){if(t.repositories&&(this.warn("repositories"),t.repository=t.repositories[0]),!t.repository)return this.warn("missingRepository");typeof t.repository=="string"&&(t.repository={type:"git",url:t.repository});var e=t.repository.url||"";if(e){var r=d0t.fromUrl(e);r&&(e=t.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(t){Object.keys(Y$.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(t,e)&&this.warn("typo",e,Y$.topLevel[e])},this)},fixScriptsField:function(t){if(t.scripts){if(typeof t.scripts!="object"){this.warn("nonObjectScripts"),delete t.scripts;return}Object.keys(t.scripts).forEach(function(e){typeof t.scripts[e]!="string"?(this.warn("nonStringScript"),delete t.scripts[e]):Y$.script[e]&&!t.scripts[Y$.script[e]]&&this.warn("typo",e,Y$.script[e],"scripts")},this)}},fixFilesField:function(t){var e=t.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete t.files):t.files&&(t.files=t.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(t){if(t.bin&&typeof t.bin=="string"){var e={},r;(r=t.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=t.bin:e[t.name]=t.bin,t.bin=e}},fixManField:function(t){t.man&&typeof t.man=="string"&&(t.man=[t.man])},fixBundleDependenciesField:function(t){var e="bundledDependencies",r="bundleDependencies";t[e]&&!t[r]&&(t[r]=t[e],delete t[e]),t[r]&&!Array.isArray(t[r])?(this.warn("nonArrayBundleDependencies"),delete t[r]):t[r]&&(t[r]=t[r].filter(function(n){return!n||typeof n!="string"?(this.warn("nonStringBundleDependency",n),!1):(t.dependencies||(t.dependencies={}),Object.prototype.hasOwnProperty.call(t.dependencies,n)||(this.warn("nonDependencyBundleDependency",n),t.dependencies[n]="*"),!0)},this))},fixDependencies:function(t){zic(t,this.warn),Vic(t,this.warn),this.fixBundleDependenciesField(t),["dependencies","devDependencies"].forEach(function(e){if(e in t){if(!t[e]||typeof t[e]!="object"){this.warn("nonObjectDependencies",e),delete t[e];return}Object.keys(t[e]).forEach(function(r){var n=t[e][r];typeof n!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(n)),delete t[e][r]);var o=d0t.fromUrl(t[e][r]);o&&(t[e][r]=o.toString())},this)}},this)},fixModulesField:function(t){t.modules&&(this.warn("deprecatedModules"),delete t.modules)},fixKeywordsField:function(t){typeof t.keywords=="string"&&(t.keywords=t.keywords.split(/,\s+/)),t.keywords&&!Array.isArray(t.keywords)?(delete t.keywords,this.warn("nonArrayKeywords")):t.keywords&&(t.keywords=t.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(t,e){var r=!e;if(!t.version)return t.version="",!0;if(!Pic(t.version,r))throw new Error('Invalid version: "'+t.version+'"');return t.version=Mic(t.version,r),!0},fixPeople:function(t){IUi(t,qic),IUi(t,Hic)},fixNameField:function(t,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!t.name&&!r){t.name="";return}if(typeof t.name!="string")throw new Error("name field must be a string.");r||(t.name=t.name.trim()),Gic(t.name,r,e.allowLegacyCase),Lic.builtinModules.includes(t.name)&&this.warn("conflictingName",t.name)},fixDescriptionField:function(t){t.description&&typeof t.description!="string"&&(this.warn("nonStringDescription"),delete t.description),t.readme&&!t.description&&(t.description=$ic(t.readme)),t.description===void 0&&delete t.description,t.description||this.warn("missingDescription")},fixReadmeField:function(t){t.readme||(this.warn("missingReadme"),t.readme="ERROR: No README data found!")},fixBugsField:function(t){if(!t.bugs&&t.repository&&t.repository.url){var e=d0t.fromUrl(t.repository.url);e&&e.bugs()&&(t.bugs={url:e.bugs()})}else if(t.bugs){if(typeof t.bugs=="string")DUi(t.bugs)?t.bugs={email:t.bugs}:YEr.parse(t.bugs).protocol?t.bugs={url:t.bugs}:this.warn("nonEmailUrlBugsString");else{Yic(t.bugs,this.warn);var r=t.bugs;t.bugs={},r.url&&(typeof r.url=="string"&&YEr.parse(r.url).protocol?t.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&DUi(r.email)?t.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!t.bugs.email&&!t.bugs.url&&(delete t.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(t){if(!t.homepage&&t.repository&&t.repository.url){var e=d0t.fromUrl(t.repository.url);e&&e.docs()&&(t.homepage=e.docs())}if(t.homepage){if(typeof t.homepage!="string")return this.warn("nonUrlHomepage"),delete t.homepage;YEr.parse(t.homepage).protocol||(t.homepage="http://"+t.homepage)}},fixLicenseField:function(t){let e=t.license||t.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!Fic(e).validForNewPackages)return this.warn("invalidLicense")}};function jic(t){if(t.charAt(0)!=="@")return!1;var e=t.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function Qic(t){return!t.match(/[/@\s+%:]/)&&t===encodeURIComponent(t)}function Gic(t,e,r){if(t.charAt(0)==="."||!(jic(t)||Qic(t))||e&&!r&&t!==t.toLowerCase()||t.toLowerCase()==="node_modules"||t.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(t))}function IUi(t,e){return t.author&&(t.author=e(t.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(t[r])&&(t[r]=t[r].map(e))}),t}function qic(t){if(typeof t=="string")return t;var e=t.name||"",r=t.url||t.web,n=r?" ("+r+")":"",o=t.email||t.mail,s=o?" <"+o+">":"";return e+s+n}function Hic(t){if(typeof t!="string")return t;var e=t.match(/^([^(<]+)/),r=t.match(/\(([^()]+)\)/),n=t.match(/<([^<>]+)>/),o={};return e&&e[0].trim()&&(o.name=e[0].trim()),n&&(o.email=n[1]),r&&(o.url=r[1]),o}function Vic(t){var e=t.optionalDependencies;if(e){var r=t.dependencies||{};Object.keys(e).forEach(function(n){r[n]=e[n]}),t.dependencies=r}}function Wic(t,e,r){if(!t)return{};if(typeof t=="string"&&(t=t.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(t))return t;r("deprecatedArrayDependencies",e);var n={};return t.filter(function(o){return typeof o=="string"}).forEach(function(o){o=o.trim().split(/(:?[@\s><=])/);var s=o.shift(),a=o.join("");a=a.trim(),a=a.replace(/^@/,""),n[s]=a}),n}function zic(t,e){Uic.forEach(function(r){t[r]&&(t[r]=Wic(t[r],r,e))})}function Yic(t,e){t&&Object.keys(t).forEach(function(r){Y$.bugs[r]&&(e("typo",r,Y$.bugs[r],"bugs"),t[Y$.bugs[r]]=t[r],delete t[r])})}});var OUi=T((jiu,Kic)=>{Kic.exports={repositories:"'repositories' (plural) Not supported. Please pick one as the 'repository' field",missingRepository:"No repository field.",brokenGitUrl:"Probably broken git url: %s",nonObjectScripts:"scripts must be an object",nonStringScript:"script values must be string commands",nonArrayFiles:"Invalid 'files' member",invalidFilename:"Invalid filename in 'files' list: %s",nonArrayBundleDependencies:"Invalid 'bundleDependencies' list. Must be array of package names",nonStringBundleDependency:"Invalid bundleDependencies member: %s",nonDependencyBundleDependency:"Non-dependency in bundleDependencies: %s",nonObjectDependencies:"%s field must be an object",nonStringDependency:"Invalid dependency: %s %s",deprecatedArrayDependencies:"specifying %s as array is deprecated",deprecatedModules:"modules field is deprecated",nonArrayKeywords:"keywords should be an array of strings",nonStringKeyword:"keywords should be an array of strings",conflictingName:"%s is also the name of a node core module.",nonStringDescription:"'description' field should be a string",missingDescription:"No description",missingReadme:"No README data",missingLicense:"No license field.",nonEmailUrlBugsString:"Bug string field must be url, email, or {email,url}",nonUrlBugsUrlField:"bugs.url field must be a string url. Deleted.",nonEmailBugsEmailField:"bugs.email field must be a string email. Deleted.",emptyNormalizedBugs:"Normalized value of bugs field is an empty object. Deleted.",nonUrlHomepage:"homepage field must be a string url. Deleted.",invalidLicense:"license should be a valid SPDX license expression",typo:"%s should probably be %s."}});var PUi=T((Qiu,BUi)=>{var NUi=me("util"),KEr=OUi();BUi.exports=function(){var t=Array.prototype.slice.call(arguments,0),e=t.shift();if(e==="typo")return Jic.apply(null,t);var r=KEr[e]?KEr[e]:e+": '%s'";return t.unshift(r),NUi.format.apply(null,t)};function Jic(t,e,r){return r&&(t=r+"['"+t+"']",e=r+"['"+e+"']"),NUi.format(KEr.typo,t,e)}});var UUi=T((Giu,LUi)=>{LUi.exports=MUi;var JEr=kUi();MUi.fixer=JEr;var Xic=PUi(),Zic=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],eoc=["dependencies","people","typos"],XEr=Zic.map(function(t){return FUi(t)+"Field"});XEr=XEr.concat(eoc);function MUi(t,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||t.private)&&(e=function(){}),t.scripts&&t.scripts.install==="node-gyp rebuild"&&!t.scripts.preinstall&&(t.gypfile=!0),JEr.warn=function(){e(Xic.apply(null,arguments))},XEr.forEach(function(n){JEr["fix"+FUi(n)](t,r)}),t._id=t.name+"@"+t.version}function FUi(t){return t.charAt(0).toUpperCase()+t.slice(1)}});var $Ui=G(()=>{});import{fileURLToPath as toc}from"node:url";function jUi(t){return t instanceof URL?toc(t):t}var QUi=G(()=>{$Ui()});import roc from"node:fs/promises";import noc from"node:path";async function qUi({cwd:t,normalize:e=!0}={}){let r=await roc.readFile(ioc(t),"utf8");return ooc(r,e)}var GUi,ioc,ooc,HUi=G(()=>{kLi();GUi=Se(UUi(),1);QUi();ioc=t=>noc.resolve(jUi(t)??".","package.json"),ooc=(t,e)=>{let r=typeof t=="string"?kEr(t):t;return e&&(0,GUi.default)(r),r}});import soc from"node:path";async function VUi(t){let e=await nLi("package.json",t);if(e)return{packageJson:await qUi({...t,cwd:soc.dirname(e)}),path:e}}var WUi=G(()=>{iLi();HUi()});import{fileURLToPath as aoc}from"url";import coc from"path";async function K$(){if(f0t)return f0t;let t=await VUi({cwd:uoc});if(t)return f0t=t.packageJson,f0t}var loc,uoc,f0t,p8e=G(()=>{"use strict";WUi();loc=aoc(import.meta.url),uoc=coc.dirname(loc)});async function J$(){let t=await K$();return"0.5.1-beta-20260113143539"}var h8e=G(()=>{"use strict";p8e();});var ZUi=T((dou,tvr)=>{"use strict";var YUi=me("child_process").exec,KUi=me("child_process").execSync,p0t=me("fs"),zUi=me("path"),JUi=p0t.access,XUi=p0t.accessSync,Fpe=p0t.constants||p0t,ZEr=process.platform=="win32",doc=function(t,e){JUi(t,Fpe.F_OK,function(r){e(!r)})},foc=function(t){try{return XUi(t,Fpe.F_OK),!1}catch{return!0}},poc=function(t,e){JUi(t,Fpe.F_OK|Fpe.X_OK,function(r){e(null,!r)})},hoc=function(t){try{return XUi(t,Fpe.F_OK|Fpe.X_OK),!0}catch{return!1}},moc=function(t,e,r){doc(t,function(n){if(!n){var o=YUi("command -v "+e+" 2>/dev/null && { echo >&1 "+e+"; exit 0; }",function(s,a,c){r(null,!!a)});return}poc(t,r)})},goc=function(t,e,r){if(!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(t)){r(null,!1);return}var n=YUi("where "+e,function(o){o!==null?r(null,!1):r(null,!0)})},Aoc=function(t,e){if(foc(t))try{var r=KUi("command -v "+e+" 2>/dev/null && { echo >&1 "+e+"; exit 0; }");return!!r}catch{return!1}return hoc(t)},yoc=function(t,e,r){if(!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(t))return!1;try{var n=KUi("where "+e,{stdio:[]});return!!n}catch{return!1}},evr=function(t){return/[^A-Za-z0-9_\/:=-]/.test(t)&&(t="'"+t.replace(/'/g,"'\\''")+"'",t=t.replace(/^(?:'')+/g,"").replace(/\\'''/g,"\\'")),t};ZEr&&(evr=function(t){var e=/[\\]/.test(t);if(e){var r='"'+zUi.dirname(t)+'"',n='"'+zUi.basename(t)+'"';return r+":"+n}return'"'+t+'"'});tvr.exports=function t(e,r){var n=evr(e);if(!r&&typeof Promise<"u")return new Promise(function(o,s){t(e,function(a,c){c?o(e):s(a)})});ZEr?goc(e,n,r):moc(e,n,r)};tvr.exports.sync=function(t){var e=evr(t);return ZEr?yoc(t,e):Aoc(t,e)}});var t$i=T((fou,e$i)=>{e$i.exports=ZUi()});import ivr from"fs/promises";import ovr from"path";import Qoc from"os";function qoc(t,e){if(t==="global")return ovr.join(Qoc.homedir(),".iflow","commands");{let r=e||process.cwd();return ovr.join(r,".iflow","commands")}}function h$i(t){return t.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function Voc(t,e){let{scope:r}=e;if(r!=="project"&&r!=="global"){console.error(R.t("commandsAdd.invalidScope",{scope:r}));return}let o=ol(process.cwd()).merged.apiKey;if(!o){console.error(R.t("commandsAdd.apiKeyNotFound")),console.error(R.t("commandsAdd.pleaseAuthenticateFirst"));return}console.log(R.t("commandsAdd.searchingCommand",{nameOrId:t}));try{let s=null;if(/^\d+$/.test(t)){let u=parseInt(t,10);s=await Goc(o,u)}if(!s){let u=await p$i(o,1,1e3,t,"public");if(!u.success){console.error(`Error: ${u.message}`);return}s=u.commands?.find(d=>d.name.toLowerCase()===t.toLowerCase())||null}if(!s){let u=await p$i(o,1,1e3,t,"private");if(!u.success){console.error(`Error: ${u.message}`);return}s=u.commands?.find(d=>d.name.toLowerCase()===t.toLowerCase())||null}if(!s){console.error(R.t("commandsAdd.commandNotFound",{nameOrId:t}));return}console.log(R.t("commandsAdd.foundCommand",{name:s.name})),console.log(R.t("commandsAdd.commandDescription",{description:s.description})),console.log(R.t("commandsAdd.commandCategory",{category:s.category})),console.log(R.t("commandsAdd.installingToScope",{scope:r}));let a=process.cwd(),c=await Hoc(s,r,a);c.success?(console.log(c.message),console.log(""),console.log(R.t("commandsAdd.restartRequired"))):console.error(c.message)}catch(s){console.error(R.t("commandsAdd.errorAddingCommand",{error:s}))}}var p$i,Goc,Hoc,m$i,g$i=G(()=>{"use strict";bl();qt();p$i=async(t,e=1,r=20,n,o)=>{try{if(!t)return{success:!1,message:R.t("commandsAdd.pleaseAuthenticate")};let s={page:e,size:r,usePage:!0,visibility:o};n&&(s.name=n);let a={"User-Agent":"iFlow-Cli","Content-Type":"application/json"};o==="private"&&(a.Authorization=`Bearer ${t}`);let c=await fetch("https://apis.iflow.cn/v1/commands/list",{method:"POST",headers:a,body:JSON.stringify(s)});if(!c.ok){let f=R.t("commandsAdd.unableToLoadCommands");return c.status===401?f=R.t("commandsAdd.authenticationFailed"):c.status===403?f=R.t("commandsAdd.accessDenied"):c.status===404?f=R.t("commandsAdd.serviceNotFound"):c.status>=500&&(f=R.t("commandsAdd.serverError")),{success:!1,message:f}}let u=await c.json();return u.success?{success:!0,commands:Array.isArray(u.data.data)?u.data.data:[],total:u.data.total||0}:{success:!1,message:u.message||R.t("commandsAdd.failedToLoadFromServer")}}catch(s){let a=R.t("commandsAdd.connectionError");return s instanceof Error&&s.message.includes("Failed to fetch")&&(a=R.t("commandsAdd.networkError")),{success:!1,message:a}}},Goc=async(t,e)=>{try{let r=await fetch(`https://apis.iflow.cn/v1/commands/get/${e}`,{headers:{Authorization:`Bearer ${t}`}});if(!r.ok)throw new Error(`HTTP ${r.status}: ${r.statusText}`);let n=await r.json();if(!n.success)throw new Error(n.message||R.t("commandsAdd.failedToFetchDetails"));return n.data||null}catch(r){return console.error(R.t("commandsAdd.failedToFetchDetails"),r),null}};Hoc=async(t,e,r)=>{try{let n=qoc(e,r);await ivr.mkdir(n,{recursive:!0});let o=`${h$i(t.name)}.toml`,s=ovr.join(n,o);try{return await ivr.access(s),{success:!1,message:R.t("commandsAdd.alreadyInstalled",{commandName:t.name,scope:e})}}catch{}let a=`# Command: ${t.name}
5891
+ `);let e=0;for(;t[e]&&t[e].trim().match(/^(#|$)/);)e++;let r=t.length,n=e+1;for(;n<r&&t[n].trim();)n++;return t.slice(e,n).join(" ").trim()}});var TUi=T((Uiu,Bic)=>{Bic.exports={topLevel:{dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},bugs:{web:"url",name:"url"},script:{server:"start",tests:"test"}}});var kUi=T(($iu,RUi)=>{var Pic=FEr(),Mic=LEr(),Fic=uUi(),d0t=SUi(),Lic=me("node:module"),Uic=["dependencies","devDependencies","optionalDependencies"],$ic=xUi(),YEr=me("url"),Y$=TUi(),DUi=t=>t.includes("@")&&t.indexOf("@")<t.lastIndexOf(".");RUi.exports={warn:function(){},fixRepositoryField:function(t){if(t.repositories&&(this.warn("repositories"),t.repository=t.repositories[0]),!t.repository)return this.warn("missingRepository");typeof t.repository=="string"&&(t.repository={type:"git",url:t.repository});var e=t.repository.url||"";if(e){var r=d0t.fromUrl(e);r&&(e=t.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(t){Object.keys(Y$.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(t,e)&&this.warn("typo",e,Y$.topLevel[e])},this)},fixScriptsField:function(t){if(t.scripts){if(typeof t.scripts!="object"){this.warn("nonObjectScripts"),delete t.scripts;return}Object.keys(t.scripts).forEach(function(e){typeof t.scripts[e]!="string"?(this.warn("nonStringScript"),delete t.scripts[e]):Y$.script[e]&&!t.scripts[Y$.script[e]]&&this.warn("typo",e,Y$.script[e],"scripts")},this)}},fixFilesField:function(t){var e=t.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete t.files):t.files&&(t.files=t.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(t){if(t.bin&&typeof t.bin=="string"){var e={},r;(r=t.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=t.bin:e[t.name]=t.bin,t.bin=e}},fixManField:function(t){t.man&&typeof t.man=="string"&&(t.man=[t.man])},fixBundleDependenciesField:function(t){var e="bundledDependencies",r="bundleDependencies";t[e]&&!t[r]&&(t[r]=t[e],delete t[e]),t[r]&&!Array.isArray(t[r])?(this.warn("nonArrayBundleDependencies"),delete t[r]):t[r]&&(t[r]=t[r].filter(function(n){return!n||typeof n!="string"?(this.warn("nonStringBundleDependency",n),!1):(t.dependencies||(t.dependencies={}),Object.prototype.hasOwnProperty.call(t.dependencies,n)||(this.warn("nonDependencyBundleDependency",n),t.dependencies[n]="*"),!0)},this))},fixDependencies:function(t){zic(t,this.warn),Vic(t,this.warn),this.fixBundleDependenciesField(t),["dependencies","devDependencies"].forEach(function(e){if(e in t){if(!t[e]||typeof t[e]!="object"){this.warn("nonObjectDependencies",e),delete t[e];return}Object.keys(t[e]).forEach(function(r){var n=t[e][r];typeof n!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(n)),delete t[e][r]);var o=d0t.fromUrl(t[e][r]);o&&(t[e][r]=o.toString())},this)}},this)},fixModulesField:function(t){t.modules&&(this.warn("deprecatedModules"),delete t.modules)},fixKeywordsField:function(t){typeof t.keywords=="string"&&(t.keywords=t.keywords.split(/,\s+/)),t.keywords&&!Array.isArray(t.keywords)?(delete t.keywords,this.warn("nonArrayKeywords")):t.keywords&&(t.keywords=t.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(t,e){var r=!e;if(!t.version)return t.version="",!0;if(!Pic(t.version,r))throw new Error('Invalid version: "'+t.version+'"');return t.version=Mic(t.version,r),!0},fixPeople:function(t){IUi(t,qic),IUi(t,Hic)},fixNameField:function(t,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!t.name&&!r){t.name="";return}if(typeof t.name!="string")throw new Error("name field must be a string.");r||(t.name=t.name.trim()),Gic(t.name,r,e.allowLegacyCase),Lic.builtinModules.includes(t.name)&&this.warn("conflictingName",t.name)},fixDescriptionField:function(t){t.description&&typeof t.description!="string"&&(this.warn("nonStringDescription"),delete t.description),t.readme&&!t.description&&(t.description=$ic(t.readme)),t.description===void 0&&delete t.description,t.description||this.warn("missingDescription")},fixReadmeField:function(t){t.readme||(this.warn("missingReadme"),t.readme="ERROR: No README data found!")},fixBugsField:function(t){if(!t.bugs&&t.repository&&t.repository.url){var e=d0t.fromUrl(t.repository.url);e&&e.bugs()&&(t.bugs={url:e.bugs()})}else if(t.bugs){if(typeof t.bugs=="string")DUi(t.bugs)?t.bugs={email:t.bugs}:YEr.parse(t.bugs).protocol?t.bugs={url:t.bugs}:this.warn("nonEmailUrlBugsString");else{Yic(t.bugs,this.warn);var r=t.bugs;t.bugs={},r.url&&(typeof r.url=="string"&&YEr.parse(r.url).protocol?t.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&DUi(r.email)?t.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!t.bugs.email&&!t.bugs.url&&(delete t.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(t){if(!t.homepage&&t.repository&&t.repository.url){var e=d0t.fromUrl(t.repository.url);e&&e.docs()&&(t.homepage=e.docs())}if(t.homepage){if(typeof t.homepage!="string")return this.warn("nonUrlHomepage"),delete t.homepage;YEr.parse(t.homepage).protocol||(t.homepage="http://"+t.homepage)}},fixLicenseField:function(t){let e=t.license||t.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!Fic(e).validForNewPackages)return this.warn("invalidLicense")}};function jic(t){if(t.charAt(0)!=="@")return!1;var e=t.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function Qic(t){return!t.match(/[/@\s+%:]/)&&t===encodeURIComponent(t)}function Gic(t,e,r){if(t.charAt(0)==="."||!(jic(t)||Qic(t))||e&&!r&&t!==t.toLowerCase()||t.toLowerCase()==="node_modules"||t.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(t))}function IUi(t,e){return t.author&&(t.author=e(t.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(t[r])&&(t[r]=t[r].map(e))}),t}function qic(t){if(typeof t=="string")return t;var e=t.name||"",r=t.url||t.web,n=r?" ("+r+")":"",o=t.email||t.mail,s=o?" <"+o+">":"";return e+s+n}function Hic(t){if(typeof t!="string")return t;var e=t.match(/^([^(<]+)/),r=t.match(/\(([^()]+)\)/),n=t.match(/<([^<>]+)>/),o={};return e&&e[0].trim()&&(o.name=e[0].trim()),n&&(o.email=n[1]),r&&(o.url=r[1]),o}function Vic(t){var e=t.optionalDependencies;if(e){var r=t.dependencies||{};Object.keys(e).forEach(function(n){r[n]=e[n]}),t.dependencies=r}}function Wic(t,e,r){if(!t)return{};if(typeof t=="string"&&(t=t.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(t))return t;r("deprecatedArrayDependencies",e);var n={};return t.filter(function(o){return typeof o=="string"}).forEach(function(o){o=o.trim().split(/(:?[@\s><=])/);var s=o.shift(),a=o.join("");a=a.trim(),a=a.replace(/^@/,""),n[s]=a}),n}function zic(t,e){Uic.forEach(function(r){t[r]&&(t[r]=Wic(t[r],r,e))})}function Yic(t,e){t&&Object.keys(t).forEach(function(r){Y$.bugs[r]&&(e("typo",r,Y$.bugs[r],"bugs"),t[Y$.bugs[r]]=t[r],delete t[r])})}});var OUi=T((jiu,Kic)=>{Kic.exports={repositories:"'repositories' (plural) Not supported. Please pick one as the 'repository' field",missingRepository:"No repository field.",brokenGitUrl:"Probably broken git url: %s",nonObjectScripts:"scripts must be an object",nonStringScript:"script values must be string commands",nonArrayFiles:"Invalid 'files' member",invalidFilename:"Invalid filename in 'files' list: %s",nonArrayBundleDependencies:"Invalid 'bundleDependencies' list. Must be array of package names",nonStringBundleDependency:"Invalid bundleDependencies member: %s",nonDependencyBundleDependency:"Non-dependency in bundleDependencies: %s",nonObjectDependencies:"%s field must be an object",nonStringDependency:"Invalid dependency: %s %s",deprecatedArrayDependencies:"specifying %s as array is deprecated",deprecatedModules:"modules field is deprecated",nonArrayKeywords:"keywords should be an array of strings",nonStringKeyword:"keywords should be an array of strings",conflictingName:"%s is also the name of a node core module.",nonStringDescription:"'description' field should be a string",missingDescription:"No description",missingReadme:"No README data",missingLicense:"No license field.",nonEmailUrlBugsString:"Bug string field must be url, email, or {email,url}",nonUrlBugsUrlField:"bugs.url field must be a string url. Deleted.",nonEmailBugsEmailField:"bugs.email field must be a string email. Deleted.",emptyNormalizedBugs:"Normalized value of bugs field is an empty object. Deleted.",nonUrlHomepage:"homepage field must be a string url. Deleted.",invalidLicense:"license should be a valid SPDX license expression",typo:"%s should probably be %s."}});var PUi=T((Qiu,BUi)=>{var NUi=me("util"),KEr=OUi();BUi.exports=function(){var t=Array.prototype.slice.call(arguments,0),e=t.shift();if(e==="typo")return Jic.apply(null,t);var r=KEr[e]?KEr[e]:e+": '%s'";return t.unshift(r),NUi.format.apply(null,t)};function Jic(t,e,r){return r&&(t=r+"['"+t+"']",e=r+"['"+e+"']"),NUi.format(KEr.typo,t,e)}});var UUi=T((Giu,LUi)=>{LUi.exports=MUi;var JEr=kUi();MUi.fixer=JEr;var Xic=PUi(),Zic=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],eoc=["dependencies","people","typos"],XEr=Zic.map(function(t){return FUi(t)+"Field"});XEr=XEr.concat(eoc);function MUi(t,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||t.private)&&(e=function(){}),t.scripts&&t.scripts.install==="node-gyp rebuild"&&!t.scripts.preinstall&&(t.gypfile=!0),JEr.warn=function(){e(Xic.apply(null,arguments))},XEr.forEach(function(n){JEr["fix"+FUi(n)](t,r)}),t._id=t.name+"@"+t.version}function FUi(t){return t.charAt(0).toUpperCase()+t.slice(1)}});var $Ui=G(()=>{});import{fileURLToPath as toc}from"node:url";function jUi(t){return t instanceof URL?toc(t):t}var QUi=G(()=>{$Ui()});import roc from"node:fs/promises";import noc from"node:path";async function qUi({cwd:t,normalize:e=!0}={}){let r=await roc.readFile(ioc(t),"utf8");return ooc(r,e)}var GUi,ioc,ooc,HUi=G(()=>{kLi();GUi=Se(UUi(),1);QUi();ioc=t=>noc.resolve(jUi(t)??".","package.json"),ooc=(t,e)=>{let r=typeof t=="string"?kEr(t):t;return e&&(0,GUi.default)(r),r}});import soc from"node:path";async function VUi(t){let e=await nLi("package.json",t);if(e)return{packageJson:await qUi({...t,cwd:soc.dirname(e)}),path:e}}var WUi=G(()=>{iLi();HUi()});import{fileURLToPath as aoc}from"url";import coc from"path";async function K$(){if(f0t)return f0t;let t=await VUi({cwd:uoc});if(t)return f0t=t.packageJson,f0t}var loc,uoc,f0t,p8e=G(()=>{"use strict";WUi();loc=aoc(import.meta.url),uoc=coc.dirname(loc)});async function J$(){let t=await K$();return"0.5.1"}var h8e=G(()=>{"use strict";p8e();});var ZUi=T((dou,tvr)=>{"use strict";var YUi=me("child_process").exec,KUi=me("child_process").execSync,p0t=me("fs"),zUi=me("path"),JUi=p0t.access,XUi=p0t.accessSync,Fpe=p0t.constants||p0t,ZEr=process.platform=="win32",doc=function(t,e){JUi(t,Fpe.F_OK,function(r){e(!r)})},foc=function(t){try{return XUi(t,Fpe.F_OK),!1}catch{return!0}},poc=function(t,e){JUi(t,Fpe.F_OK|Fpe.X_OK,function(r){e(null,!r)})},hoc=function(t){try{return XUi(t,Fpe.F_OK|Fpe.X_OK),!0}catch{return!1}},moc=function(t,e,r){doc(t,function(n){if(!n){var o=YUi("command -v "+e+" 2>/dev/null && { echo >&1 "+e+"; exit 0; }",function(s,a,c){r(null,!!a)});return}poc(t,r)})},goc=function(t,e,r){if(!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(t)){r(null,!1);return}var n=YUi("where "+e,function(o){o!==null?r(null,!1):r(null,!0)})},Aoc=function(t,e){if(foc(t))try{var r=KUi("command -v "+e+" 2>/dev/null && { echo >&1 "+e+"; exit 0; }");return!!r}catch{return!1}return hoc(t)},yoc=function(t,e,r){if(!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(t))return!1;try{var n=KUi("where "+e,{stdio:[]});return!!n}catch{return!1}},evr=function(t){return/[^A-Za-z0-9_\/:=-]/.test(t)&&(t="'"+t.replace(/'/g,"'\\''")+"'",t=t.replace(/^(?:'')+/g,"").replace(/\\'''/g,"\\'")),t};ZEr&&(evr=function(t){var e=/[\\]/.test(t);if(e){var r='"'+zUi.dirname(t)+'"',n='"'+zUi.basename(t)+'"';return r+":"+n}return'"'+t+'"'});tvr.exports=function t(e,r){var n=evr(e);if(!r&&typeof Promise<"u")return new Promise(function(o,s){t(e,function(a,c){c?o(e):s(a)})});ZEr?goc(e,n,r):moc(e,n,r)};tvr.exports.sync=function(t){var e=evr(t);return ZEr?yoc(t,e):Aoc(t,e)}});var t$i=T((fou,e$i)=>{e$i.exports=ZUi()});import ivr from"fs/promises";import ovr from"path";import Qoc from"os";function qoc(t,e){if(t==="global")return ovr.join(Qoc.homedir(),".iflow","commands");{let r=e||process.cwd();return ovr.join(r,".iflow","commands")}}function h$i(t){return t.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function Voc(t,e){let{scope:r}=e;if(r!=="project"&&r!=="global"){console.error(R.t("commandsAdd.invalidScope",{scope:r}));return}let o=ol(process.cwd()).merged.apiKey;if(!o){console.error(R.t("commandsAdd.apiKeyNotFound")),console.error(R.t("commandsAdd.pleaseAuthenticateFirst"));return}console.log(R.t("commandsAdd.searchingCommand",{nameOrId:t}));try{let s=null;if(/^\d+$/.test(t)){let u=parseInt(t,10);s=await Goc(o,u)}if(!s){let u=await p$i(o,1,1e3,t,"public");if(!u.success){console.error(`Error: ${u.message}`);return}s=u.commands?.find(d=>d.name.toLowerCase()===t.toLowerCase())||null}if(!s){let u=await p$i(o,1,1e3,t,"private");if(!u.success){console.error(`Error: ${u.message}`);return}s=u.commands?.find(d=>d.name.toLowerCase()===t.toLowerCase())||null}if(!s){console.error(R.t("commandsAdd.commandNotFound",{nameOrId:t}));return}console.log(R.t("commandsAdd.foundCommand",{name:s.name})),console.log(R.t("commandsAdd.commandDescription",{description:s.description})),console.log(R.t("commandsAdd.commandCategory",{category:s.category})),console.log(R.t("commandsAdd.installingToScope",{scope:r}));let a=process.cwd(),c=await Hoc(s,r,a);c.success?(console.log(c.message),console.log(""),console.log(R.t("commandsAdd.restartRequired"))):console.error(c.message)}catch(s){console.error(R.t("commandsAdd.errorAddingCommand",{error:s}))}}var p$i,Goc,Hoc,m$i,g$i=G(()=>{"use strict";bl();qt();p$i=async(t,e=1,r=20,n,o)=>{try{if(!t)return{success:!1,message:R.t("commandsAdd.pleaseAuthenticate")};let s={page:e,size:r,usePage:!0,visibility:o};n&&(s.name=n);let a={"User-Agent":"iFlow-Cli","Content-Type":"application/json"};o==="private"&&(a.Authorization=`Bearer ${t}`);let c=await fetch("https://apis.iflow.cn/v1/commands/list",{method:"POST",headers:a,body:JSON.stringify(s)});if(!c.ok){let f=R.t("commandsAdd.unableToLoadCommands");return c.status===401?f=R.t("commandsAdd.authenticationFailed"):c.status===403?f=R.t("commandsAdd.accessDenied"):c.status===404?f=R.t("commandsAdd.serviceNotFound"):c.status>=500&&(f=R.t("commandsAdd.serverError")),{success:!1,message:f}}let u=await c.json();return u.success?{success:!0,commands:Array.isArray(u.data.data)?u.data.data:[],total:u.data.total||0}:{success:!1,message:u.message||R.t("commandsAdd.failedToLoadFromServer")}}catch(s){let a=R.t("commandsAdd.connectionError");return s instanceof Error&&s.message.includes("Failed to fetch")&&(a=R.t("commandsAdd.networkError")),{success:!1,message:a}}},Goc=async(t,e)=>{try{let r=await fetch(`https://apis.iflow.cn/v1/commands/get/${e}`,{headers:{Authorization:`Bearer ${t}`}});if(!r.ok)throw new Error(`HTTP ${r.status}: ${r.statusText}`);let n=await r.json();if(!n.success)throw new Error(n.message||R.t("commandsAdd.failedToFetchDetails"));return n.data||null}catch(r){return console.error(R.t("commandsAdd.failedToFetchDetails"),r),null}};Hoc=async(t,e,r)=>{try{let n=qoc(e,r);await ivr.mkdir(n,{recursive:!0});let o=`${h$i(t.name)}.toml`,s=ovr.join(n,o);try{return await ivr.access(s),{success:!1,message:R.t("commandsAdd.alreadyInstalled",{commandName:t.name,scope:e})}}catch{}let a=`# Command: ${t.name}
5892
5892
  # Description: ${t.description}
5893
5893
  # Category: ${t.category}
5894
5894
  # Version: ${t.version}
@@ -7294,7 +7294,7 @@ ${n}
7294
7294
  `}})}catch(o){console.warn("[ACP Adapter] Failed to stream agent lifecycle event:",o)}}getEnhancedToolStatus(e,r){switch(r){case"scheduled":return"running";case"executing":return"running";case"success":return"finished";case"error":return"error";default:return"running"}}formatEnhancedToolResult(e,r,n){return r==="edit"&&e?.fileDiff?{type:"diff",path:e.fileName||"unknown file",oldText:e.originalContent||null,newText:e.newContent||"",args:n}:typeof e=="string"&&this.isCodeContent(e)?{type:"markdown",markdown:"```\n"+e+"\n```",args:n}:this.formatToolResult(e,n)}isCodeContent(e){return["def ","class ","function ","import ","export ","<?php","#!/bin/","<script","<?xml"].some(n=>e.includes(n))}};var W4r=class{createAdapter(e,r){return new i3t(e,r)}};function mio(){I9.register(new W4r)}async function gio(t){let r=new TextEncoder,n=new TextDecoder,o=new WritableStream({write(f){try{let p=n.decode(f);t.send(p)}catch(p){throw console.error("WebSocket send error:",p),p}}}),s=null,a=new ReadableStream({start(f){s=f},cancel(){s=null}});function c(f){}async function u(){X1t(),mio(),console.log("[ACP Web Peer] ACP adapter factory initialized");let f=process.cwd(),p=ol(f);if(p.errors.length>0){for(let A of p.errors){let y=`Error in ${A.path}: ${A.message}`;process.env.NO_COLOR||(y=`\x1B[31m${y}\x1B[0m`),console.error(y),console.error(`Please fix ${A.path} and try again.`)}process.exit(1)}let h=await v0t(),m=V$(f),g=await PK(p.merged,m,M2.generateSessionId(),h);if(g.setUsageMode("sdk"),g.getListExtensions()){console.log("Installed extensions:");for(let A of m)console.log(`- ${A.config.name}`);process.exit(0)}await g.initialize(),console.log=(...A)=>(A.join(" "),void 0),console.info=(...A)=>(A.join(" "),void 0),console.debug=(...A)=>(A.join(" "),void 0),console.warn=(...A)=>(A.join(" "),void 0),console.error=(...A)=>(A.join(" "),void 0),new lme(A=>new VDe(g,p,m,h,A),o,a);try{t.send("//ready")}catch{}}await u();function d(f){if(!s)return;let p=f.endsWith(`
7295
7295
  `)?f:f+`
7296
7296
  `,h=r.encode(p);s.enqueue(h)}return d}var o3t=new WeakMap,WDe=new WeakMap,syc=0,dme=0,Aio=[],yio=[],_io={code:null,time:null,stdout:[],stderr:[]};function Eio(t,e,r,n,o){let s=oyc.createServer((c,u)=>{let d=new URL(c.url,`http://${c.headers.host}`);if(d.pathname==="/acp-status"){u.writeHead(200,{"Content-Type":"application/json"}),u.end(JSON.stringify({connections:dme,lastExit:_io,stdoutTail:Aio.slice(-10),stderrTail:yio.slice(-10)}));return}if(d.pathname==="/acp-logs"){u.writeHead(200,{"Content-Type":"application/json"}),u.end(JSON.stringify({stdout:Aio,stderr:yio,lastExit:_io}));return}u.writeHead(404),u.end("Not Found")}),a=new oEt.default({server:s,path:"/acp"});return a.on("connection",(c,u)=>{let d=++syc;c._id=d,dme++;let p=new URL(u.url,`http://${u.headers.host}`).searchParams.get("peer")||void 0;try{console.log(`[WS ${d}] open connection (total=${dme}) peer=${p} origin=${u.headers.origin}`)}catch{}WDe.set(c,[]),setTimeout(()=>{if(!o3t.get(c))try{console.warn(`[WS ${d}] peer not ready after 1500ms`)}catch{}},1500),(async()=>{try{console.log(`[WS ${d}] About to call startEmbeddedGeminiPeer`);let h=await gio(c);console.log(`[WS ${d}] startEmbeddedGeminiPeer completed successfully`),o3t.set(c,h);try{c.send(`//stderr [WS ${d}] Embedded iFlow ACP peer started`)}catch{}let m=WDe.get(c);if(m&&m.length){try{console.log(`[WS ${d}] flushing ${m.length} early messages`)}catch{}for(let g of m)try{h(g)}catch(A){try{console.error(`[WS ${d}] error flushing buffered message:`,A)}catch{}}WDe.delete(c)}}catch(h){console.error(`[WS ${d}] Error starting embedded iFlow peer:`,h);try{c.send(`//stderr [WS ${d}] Error starting embedded iFlow peer: ${h.message}`)}catch{}try{c.close(1011,"Peer startup error")}catch{}}})(),c.on("message",h=>{let m=c._id??"?",g=o3t.get(c),A=null;if(typeof h=="string"?A=h:Buffer.isBuffer(h)?A=h.toString():A=String(h),!g){if(A&&!A.startsWith("//")){let y=WDe.get(c);if(y){y.push(A);try{console.warn(`[WS ${m}] buffering early message len=${A.length}`)}catch{}}}return}if(A&&!A.startsWith("//")){try{process.env.GEMINI_VERBOSE==="1"&&console.log(`[WS ${m}] inbound ${A.length} bytes: ${A.slice(0,80)}`)}catch{}g(A)}}),c.on("close",(h,m)=>{let g=c._id??"?";dme=Math.max(0,dme-1);try{console.log(`[WS ${g}] close event code=${h} reason=${m?.toString()||""} (remaining=${dme})`)}catch{}o3t.delete(c),WDe.delete(c)})}),{server:s,wss:a}}async function ayc(t,e,r,n,o){let s=o||Number(process.env.PORT||3001),a=5;for(let u=0;u<a;u++){let d=s+u;try{let{server:f}=Eio(t,e,r,n,d);return await new Promise((p,h)=>{f.once("error",h),f.listen(d,()=>{f.removeAllListeners("error"),console.log(`\u{1F680} iFlow ACP Server running at http://localhost:${d}`),p()})}),f}catch(f){if(f?.code==="EADDRINUSE"){console.warn(`Port ${d} in use, retrying...`);continue}throw f}}let{server:c}=Eio(t,e,r,n,0);return await new Promise((u,d)=>{c.once("error",d),c.listen(0,()=>{c.removeAllListeners("error");let f=c.address(),p=typeof f=="object"&&f?f.port:"unknown";console.log(`\u{1F680} iFlow ACP Server running at http://localhost:${p} (ephemeral)`),u()})}),c}async function vio(t,e,r,n,o){t.setUsageMode("sdk");let s=t.getTargetDir(),a={...process.env};a.WORKSPACE_ROOT=s,t.getDebugMode()&&(a.GEMINI_VERBOSE="1"),process.env.GEMINI_DISABLE_TOOLS&&(a.GEMINI_DISABLE_TOOLS="1"),o?a.PORT=String(o):a.PORT||(a.PORT="3000"),console.log("[ACP] starting server with:",JSON.stringify({workspace:a.WORKSPACE_ROOT,port:a.PORT,verbose:!!a.GEMINI_VERBOSE,disableTools:!!a.GEMINI_DISABLE_TOOLS},null,2)),Object.assign(process.env,a);let c=await ayc(t,e,r,n,o),u=d=>{console.log(`
7297
- [ACP Server] Received ${d}, shutting down gracefully...`),c.close(()=>{console.log("[ACP Server] HTTP server closed"),process.exit(d==="SIGINT"?130:143)}),setTimeout(()=>{console.error("[ACP Server] Forced shutdown after timeout"),process.exit(1)},5e3)};return process.on("SIGINT",()=>u("SIGINT")),process.on("SIGTERM",()=>u("SIGTERM")),process.on("SIGHUP",()=>u("SIGHUP")),c}var KDe=Se(kt(),1);function wyc(t){let e="ipv4first";return t===void 0?e:t==="ipv4first"||t==="verbatim"?t:(console.warn(R.t("gemini.errors.invalidDnsResolutionOrder",{order:t,defaultValue:e})),e)}function xyc(t){let e=uoo.totalmem()/1048576,r=vyc.getHeapStatistics(),n=Math.floor(r.heap_size_limit/1024/1024),o=Math.floor(e*.5);return t.getDebugMode()&&console.debug(R.t("gemini.debug.currentHeapSize",{size:n.toFixed(2)})),process.env.IFLOW_CLI_NO_RELAUNCH?[]:o>n?(t.getDebugMode()&&console.debug(R.t("gemini.debug.needToRelaunchWithMoreMemory",{size:o.toFixed(2)})),[`--max-old-space-size=${o}`]):[]}async function Tyc(t){let e=[...t,...process.argv.slice(1)],r={...process.env,IFLOW_CLI_NO_RELAUNCH:"true"},n=Cyc(process.execPath,e,{stdio:"inherit",env:r});await new Promise(o=>n.on("close",o)),process.exit(0)}function Dyc(){console.log(R.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.5.1-beta-20260113143539"}},r=`crash-${Date.now()}-${process.pid}.json`,n=Eyc.join(process.cwd(),r);try{Syc.writeFileSync(n,JSON.stringify(e,null,2)),console.error(R.t("gemini.crashDetected",{crashFilePath:n})),console.error(R.t("gemini.coreDumpWillBeGenerated"))}catch(o){console.error(R.t("gemini.failedToWriteCrashFile"),o)}process.abort()}),process.on("warning",t=>{console.warn(R.t("gemini.debug.nodejsWarning"),{name:t.name,message:t.message,stack:t.stack})}),process.on("unhandledRejection",(t,e)=>{console.error(R.t("gemini.debug.unhandledPromiseRejectionDetected"),{reason:t,promise:e.toString()})})}async function doo(){if(X1t(),eio(),uoo.platform()==="win32")try{let{execSync:A}=await import("node:child_process");A("chcp 65001",{stdio:"ignore"})}catch{}let t=process.cwd(),e=ol(t);if(!e.user.settings.cna){let A=await nGe();A&&e.setValue("User","cna",A)}if(e.errors.length>0){for(let A of e.errors){let y=R.t("gemini.errorInFile",{path:A.path,message:A.message});process.env.NO_COLOR||(y=`\x1B[31m${y}\x1B[0m`),console.error(y),console.error(R.t("gemini.pleaseFixFileAndTryAgain",{path:A.path}))}process.exit(1)}let r=await v0t(),n=typeof r.resume=="string";(!!r.prompt&&!r.promptInteractive&&!r.continue&&(!r.resume||n)||r.experimentalAcp)&&(process.env.IFLOW_NON_INTERACTIVE="true");let s=V$(t),a=n&&typeof r.resume=="string"?r.resume:M2.generateSessionId(),c=await PK(e.merged,s,a,r),u=await jpe(c);if(u&&(global.statuslineOutput=u),R.changeLanguage(c.getLanguage()),c.getDebugMode()&&Dyc(),byc.setDefaultResultOrder(wyc(e.merged.dnsResolutionOrder)),r.promptInteractive&&!process.stdin.isTTY&&(console.error(R.t("gemini.errors.promptInteractiveFlagNotSupported")),process.exit(1)),c.getListExtensions()){console.debug(R.t("gemini.installedExtensions"));for(let A of s)console.debug(`- ${A.config.name}`);process.exit(0)}if(r._&&r._[0]==="agent"){let{agentCommand:A}=await Promise.resolve().then(()=>(uvr(),j$i)),y=(await Promise.resolve().then(()=>(gSr(),mSr))).default;await y().scriptName("iflow").command(A).help().version(!1).parse(),process.exit(0)}if(r._&&r._[0]==="commands"){let{commandsCommand:A}=await Promise.resolve().then(()=>(cvr(),T$i)),y=(await Promise.resolve().then(()=>(gSr(),mSr))).default;await y().scriptName("iflow").command(A).help().version(!1).parse(),process.exit(0)}if(e.merged.selectedAuthType||process.env.CLOUD_SHELL==="true"&&e.setValue("User","selectedAuthType",er.CLOUD_SHELL),SHi(c.getDebugMode()),await c.initialize(),c.getExperimentalAcp()?c.setUsageMode("sdk"):c.setUsageMode("interactive"),ba.loadCustomThemes(e.merged.customThemes),e.merged.theme&&(ba.setActiveTheme(e.merged.theme)||console.warn(R.t("gemini.themeNotFound",{theme:e.merged.theme}))),!process.env.SANDBOX){let A=e.merged.autoConfigureMaxOldSpaceSize?xyc(c):[],y=c.getSandbox();if(y){if(e.merged.selectedAuthType&&!e.merged.useExternalAuth)try{let E=Q$(e.merged.selectedAuthType);if(E)throw new Error(E);await c.refreshAuth(e.merged.selectedAuthType,{apiKey:e.merged.apiKey,baseUrl:e.merged.baseUrl,modelName:e.merged.modelName})}catch(E){E instanceof Error&&E.message.includes("SERVER_OAUTH2_REQUIRED")?(console.error(R.t("gemini.serverOAuth2Required")||"\u68C0\u6D4B\u5230\u670D\u52A1\u5668\u73AF\u5883\uFF0C\u9700\u8981\u624B\u52A8\u8FDB\u884COAuth2\u8BA4\u8BC1\u3002\u8BF7\u5728\u975E\u6C99\u7BB1\u6A21\u5F0F\u4E0B\u8FD0\u884CCLI\u8FDB\u884C\u8BA4\u8BC1\u3002"),console.error("\u8BF7\u5C1D\u8BD5\u4E0D\u4F7F\u7528\u6C99\u7BB1\u6A21\u5F0F\u542F\u52A8\uFF0C\u6216\u8005\u5148\u5728\u672C\u5730\u73AF\u5883\u4E0B\u5B8C\u6210\u8BA4\u8BC1\u3002")):console.error(R.t("gemini.errorAuthenticating"),E),process.exit(1)}await zno(y,A,c),process.exit(0)}else A.length>0&&(await Tyc(A),process.exit(0))}if(e.merged.selectedAuthType===er.LOGIN_WITH_IFLOW&&c.isBrowserLaunchSuppressed())try{await nG(e.merged.selectedAuthType,c)}catch(A){if(!(A instanceof Error&&A.message.includes("SERVER_OAUTH2_REQUIRED")))throw A}if(c.getExperimentalAcp())return c.getAcpPort()?await vio(c,e,s,r,c.getAcpPort()):hio(c,e,s,r);let d=c.getQuestion(),f=[...await Yno()];if(!!r.promptInteractive||!!r.continue||!!r.resume&&!n||process.stdin.isTTY&&d?.length===0){console.clear();let A=await J$();loo(coo(t),e);try{await RVi()}catch(k){c.getDebugMode()&&console.warn("Failed to detect/enable Kitty protocol:",k)}if(Xh())try{await c.setIdeModeAndSyncConnection(!0)}catch(k){console.error(R.t("gemini.failedToConnectToIdeServer"),k)}let E,v=async()=>{try{if(console.clear(),loo(coo(t),e),E)try{E.unmount(),await new Promise(P=>process.nextTick(P))}catch(P){console.error(R.t("gemini.errorDuringUnmount"),P)}let{executeSessionStartHooks:k}=await Promise.resolve().then(()=>(UN(),Aj)),I=await k(c,"resume");E=I7e((0,KDe.jsx)(ASr.default.StrictMode,{children:(0,KDe.jsx)(w4r,{instance:()=>E,config:c,settings:e,startupWarnings:f,version:A,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,fgMode:!0,sessionStartContext:I})}),{exitOnCtrlC:!1,isScreenReaderEnabled:!1,stdout:sbr(),maxFps:20})}catch(k){console.error(R.t("gemini.errorDuringResume"),k)}};process.on("SIGCONT",v),y8e(()=>{process.off("SIGCONT",v)});let b="startup";(r.continue||r.resume)&&(b="resume");let{executeSessionStartHooks:S}=await Promise.resolve().then(()=>(UN(),Aj)),x=await S(c,b);E=I7e((0,KDe.jsx)(ASr.default.StrictMode,{children:(0,KDe.jsx)(w4r,{instance:()=>E,config:c,settings:e,startupWarnings:f,version:A,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,sessionStartContext:x})}),{exitOnCtrlC:!1,isScreenReaderEnabled:!1,stdout:sbr()}),e.merged.disableAutoUpdate||l1t().then(k=>{eji(k,e,c.getProjectRoot())}).catch(k=>{c.getDebugMode()&&console.error(R.t("gemini.updateCheckFailed"),k)}),y8e(()=>E.unmount());return}!process.stdin.isTTY&&!d&&(d+=await qno()),d||(console.error(R.t("gemini.noInputProvidedViaStdin")),process.exit(1));let h=Math.random().toString(16).slice(2);Nne(c,{"event.name":"user_prompt","event.timestamp":new Date().toISOString(),prompt:d,prompt_id:h,auth_type:c.getContentGeneratorConfig()?.authType,prompt_length:d.length});let m=await Iyc(c,s,e,r),g=r.outputFile||r.output_file;await Zno(m,d,h,g),process.exit(0)}function loo(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 Iyc(t,e,r,n){let o=t;if(t.getApprovalMode()!==Sn.YOLO){let s=r.merged.excludeTools||[],a=[$c.Name,kp.Name,_d.Name],c=[...new Set([...s,...a])],u={...r.merged,excludeTools:c},d={...n};o=await PK(u,e,t.getSessionId(),d),await o.initialize()}return await Ryc(r.merged.selectedAuthType,o,r)}async function Ryc(t,e,r){!t&&!process.env.IFLOW_API_KEY&&!wGe()&&(console.error(R.t("gemini.pleaseSetAuthMethod",{userSettingsPath:_K})),process.exit(1)),t||(wGe()?t=er.IFLOW:t=er.IFLOW);let n=Q$(t);return n!=null&&(console.error(n),process.exit(1)),await e.refreshAuth(t,{apiKey:r.merged.apiKey,baseUrl:r.merged.baseUrl,modelName:e.getModel()}),e}doo().catch(t=>{console.error("An unexpected critical error occurred:"),t instanceof Error?console.error(t.stack):console.error(String(t)),process.exit(1)});
7297
+ [ACP Server] Received ${d}, shutting down gracefully...`),c.close(()=>{console.log("[ACP Server] HTTP server closed"),process.exit(d==="SIGINT"?130:143)}),setTimeout(()=>{console.error("[ACP Server] Forced shutdown after timeout"),process.exit(1)},5e3)};return process.on("SIGINT",()=>u("SIGINT")),process.on("SIGTERM",()=>u("SIGTERM")),process.on("SIGHUP",()=>u("SIGHUP")),c}var KDe=Se(kt(),1);function wyc(t){let e="ipv4first";return t===void 0?e:t==="ipv4first"||t==="verbatim"?t:(console.warn(R.t("gemini.errors.invalidDnsResolutionOrder",{order:t,defaultValue:e})),e)}function xyc(t){let e=uoo.totalmem()/1048576,r=vyc.getHeapStatistics(),n=Math.floor(r.heap_size_limit/1024/1024),o=Math.floor(e*.5);return t.getDebugMode()&&console.debug(R.t("gemini.debug.currentHeapSize",{size:n.toFixed(2)})),process.env.IFLOW_CLI_NO_RELAUNCH?[]:o>n?(t.getDebugMode()&&console.debug(R.t("gemini.debug.needToRelaunchWithMoreMemory",{size:o.toFixed(2)})),[`--max-old-space-size=${o}`]):[]}async function Tyc(t){let e=[...t,...process.argv.slice(1)],r={...process.env,IFLOW_CLI_NO_RELAUNCH:"true"},n=Cyc(process.execPath,e,{stdio:"inherit",env:r});await new Promise(o=>n.on("close",o)),process.exit(0)}function Dyc(){console.log(R.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.5.1"}},r=`crash-${Date.now()}-${process.pid}.json`,n=Eyc.join(process.cwd(),r);try{Syc.writeFileSync(n,JSON.stringify(e,null,2)),console.error(R.t("gemini.crashDetected",{crashFilePath:n})),console.error(R.t("gemini.coreDumpWillBeGenerated"))}catch(o){console.error(R.t("gemini.failedToWriteCrashFile"),o)}process.abort()}),process.on("warning",t=>{console.warn(R.t("gemini.debug.nodejsWarning"),{name:t.name,message:t.message,stack:t.stack})}),process.on("unhandledRejection",(t,e)=>{console.error(R.t("gemini.debug.unhandledPromiseRejectionDetected"),{reason:t,promise:e.toString()})})}async function doo(){if(X1t(),eio(),uoo.platform()==="win32")try{let{execSync:A}=await import("node:child_process");A("chcp 65001",{stdio:"ignore"})}catch{}let t=process.cwd(),e=ol(t);if(!e.user.settings.cna){let A=await nGe();A&&e.setValue("User","cna",A)}if(e.errors.length>0){for(let A of e.errors){let y=R.t("gemini.errorInFile",{path:A.path,message:A.message});process.env.NO_COLOR||(y=`\x1B[31m${y}\x1B[0m`),console.error(y),console.error(R.t("gemini.pleaseFixFileAndTryAgain",{path:A.path}))}process.exit(1)}let r=await v0t(),n=typeof r.resume=="string";(!!r.prompt&&!r.promptInteractive&&!r.continue&&(!r.resume||n)||r.experimentalAcp)&&(process.env.IFLOW_NON_INTERACTIVE="true");let s=V$(t),a=n&&typeof r.resume=="string"?r.resume:M2.generateSessionId(),c=await PK(e.merged,s,a,r),u=await jpe(c);if(u&&(global.statuslineOutput=u),R.changeLanguage(c.getLanguage()),c.getDebugMode()&&Dyc(),byc.setDefaultResultOrder(wyc(e.merged.dnsResolutionOrder)),r.promptInteractive&&!process.stdin.isTTY&&(console.error(R.t("gemini.errors.promptInteractiveFlagNotSupported")),process.exit(1)),c.getListExtensions()){console.debug(R.t("gemini.installedExtensions"));for(let A of s)console.debug(`- ${A.config.name}`);process.exit(0)}if(r._&&r._[0]==="agent"){let{agentCommand:A}=await Promise.resolve().then(()=>(uvr(),j$i)),y=(await Promise.resolve().then(()=>(gSr(),mSr))).default;await y().scriptName("iflow").command(A).help().version(!1).parse(),process.exit(0)}if(r._&&r._[0]==="commands"){let{commandsCommand:A}=await Promise.resolve().then(()=>(cvr(),T$i)),y=(await Promise.resolve().then(()=>(gSr(),mSr))).default;await y().scriptName("iflow").command(A).help().version(!1).parse(),process.exit(0)}if(e.merged.selectedAuthType||process.env.CLOUD_SHELL==="true"&&e.setValue("User","selectedAuthType",er.CLOUD_SHELL),SHi(c.getDebugMode()),await c.initialize(),c.getExperimentalAcp()?c.setUsageMode("sdk"):c.setUsageMode("interactive"),ba.loadCustomThemes(e.merged.customThemes),e.merged.theme&&(ba.setActiveTheme(e.merged.theme)||console.warn(R.t("gemini.themeNotFound",{theme:e.merged.theme}))),!process.env.SANDBOX){let A=e.merged.autoConfigureMaxOldSpaceSize?xyc(c):[],y=c.getSandbox();if(y){if(e.merged.selectedAuthType&&!e.merged.useExternalAuth)try{let E=Q$(e.merged.selectedAuthType);if(E)throw new Error(E);await c.refreshAuth(e.merged.selectedAuthType,{apiKey:e.merged.apiKey,baseUrl:e.merged.baseUrl,modelName:e.merged.modelName})}catch(E){E instanceof Error&&E.message.includes("SERVER_OAUTH2_REQUIRED")?(console.error(R.t("gemini.serverOAuth2Required")||"\u68C0\u6D4B\u5230\u670D\u52A1\u5668\u73AF\u5883\uFF0C\u9700\u8981\u624B\u52A8\u8FDB\u884COAuth2\u8BA4\u8BC1\u3002\u8BF7\u5728\u975E\u6C99\u7BB1\u6A21\u5F0F\u4E0B\u8FD0\u884CCLI\u8FDB\u884C\u8BA4\u8BC1\u3002"),console.error("\u8BF7\u5C1D\u8BD5\u4E0D\u4F7F\u7528\u6C99\u7BB1\u6A21\u5F0F\u542F\u52A8\uFF0C\u6216\u8005\u5148\u5728\u672C\u5730\u73AF\u5883\u4E0B\u5B8C\u6210\u8BA4\u8BC1\u3002")):console.error(R.t("gemini.errorAuthenticating"),E),process.exit(1)}await zno(y,A,c),process.exit(0)}else A.length>0&&(await Tyc(A),process.exit(0))}if(e.merged.selectedAuthType===er.LOGIN_WITH_IFLOW&&c.isBrowserLaunchSuppressed())try{await nG(e.merged.selectedAuthType,c)}catch(A){if(!(A instanceof Error&&A.message.includes("SERVER_OAUTH2_REQUIRED")))throw A}if(c.getExperimentalAcp())return c.getAcpPort()?await vio(c,e,s,r,c.getAcpPort()):hio(c,e,s,r);let d=c.getQuestion(),f=[...await Yno()];if(!!r.promptInteractive||!!r.continue||!!r.resume&&!n||process.stdin.isTTY&&d?.length===0){console.clear();let A=await J$();loo(coo(t),e);try{await RVi()}catch(k){c.getDebugMode()&&console.warn("Failed to detect/enable Kitty protocol:",k)}if(Xh())try{await c.setIdeModeAndSyncConnection(!0)}catch(k){console.error(R.t("gemini.failedToConnectToIdeServer"),k)}let E,v=async()=>{try{if(console.clear(),loo(coo(t),e),E)try{E.unmount(),await new Promise(P=>process.nextTick(P))}catch(P){console.error(R.t("gemini.errorDuringUnmount"),P)}let{executeSessionStartHooks:k}=await Promise.resolve().then(()=>(UN(),Aj)),I=await k(c,"resume");E=I7e((0,KDe.jsx)(ASr.default.StrictMode,{children:(0,KDe.jsx)(w4r,{instance:()=>E,config:c,settings:e,startupWarnings:f,version:A,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,fgMode:!0,sessionStartContext:I})}),{exitOnCtrlC:!1,isScreenReaderEnabled:!1,stdout:sbr(),maxFps:20})}catch(k){console.error(R.t("gemini.errorDuringResume"),k)}};process.on("SIGCONT",v),y8e(()=>{process.off("SIGCONT",v)});let b="startup";(r.continue||r.resume)&&(b="resume");let{executeSessionStartHooks:S}=await Promise.resolve().then(()=>(UN(),Aj)),x=await S(c,b);E=I7e((0,KDe.jsx)(ASr.default.StrictMode,{children:(0,KDe.jsx)(w4r,{instance:()=>E,config:c,settings:e,startupWarnings:f,version:A,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,sessionStartContext:x})}),{exitOnCtrlC:!1,isScreenReaderEnabled:!1,stdout:sbr()}),e.merged.disableAutoUpdate||l1t().then(k=>{eji(k,e,c.getProjectRoot())}).catch(k=>{c.getDebugMode()&&console.error(R.t("gemini.updateCheckFailed"),k)}),y8e(()=>E.unmount());return}!process.stdin.isTTY&&!d&&(d+=await qno()),d||(console.error(R.t("gemini.noInputProvidedViaStdin")),process.exit(1));let h=Math.random().toString(16).slice(2);Nne(c,{"event.name":"user_prompt","event.timestamp":new Date().toISOString(),prompt:d,prompt_id:h,auth_type:c.getContentGeneratorConfig()?.authType,prompt_length:d.length});let m=await Iyc(c,s,e,r),g=r.outputFile||r.output_file;await Zno(m,d,h,g),process.exit(0)}function loo(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 Iyc(t,e,r,n){let o=t;if(t.getApprovalMode()!==Sn.YOLO){let s=r.merged.excludeTools||[],a=[$c.Name,kp.Name,_d.Name],c=[...new Set([...s,...a])],u={...r.merged,excludeTools:c},d={...n};o=await PK(u,e,t.getSessionId(),d),await o.initialize()}return await Ryc(r.merged.selectedAuthType,o,r)}async function Ryc(t,e,r){!t&&!process.env.IFLOW_API_KEY&&!wGe()&&(console.error(R.t("gemini.pleaseSetAuthMethod",{userSettingsPath:_K})),process.exit(1)),t||(wGe()?t=er.IFLOW:t=er.IFLOW);let n=Q$(t);return n!=null&&(console.error(n),process.exit(1)),await e.refreshAuth(t,{apiKey:r.merged.apiKey,baseUrl:r.merged.baseUrl,modelName:e.getModel()}),e}doo().catch(t=>{console.error("An unexpected critical error occurred:"),t instanceof Error?console.error(t.stack):console.error(String(t)),process.exit(1)});
7298
7298
  /**
7299
7299
  * @license
7300
7300
  * Copyright 2025 Google LLC