hud-sdk
Version:
Hud's Node SDK
1 lines • 150 kB
JavaScript
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(global,(()=>(()=>{var e={214:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(1377),n=r(2119),i=r(7668),s=r(2847),a=r(461);class u extends i.FrameworkPatcher{_patch(e){return this._patchSendRequest(e),o.instrument_logger.info("Patched @codegenie/serverless-express/src/frameworks/express.js successfully"),e}_patchSendRequest(e){const t=e.sendRequest;e.sendRequest=function(e){let r,n;const i=s.HttpEndpointMetric.createUsableMetric();try{if(r=e.request,n=e.response,!r||!n)return t.call(this,e);i.start(),i.setRequestAttributes(r),r[a.metricSymbol]=i}catch(e){o.instrument_logger.error("Failed to start flowMetric during sendRequest patching",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}const u=t.call(this,e);try{n.once("finish",(function(){try{i.setResponseAttributes(n),i.end()}catch(e){o.instrument_logger.error("Failed to end flowMetric during sendRequest patching",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}))}catch(e){o.instrument_logger.error("Failed to end flowMetric during sendRequest patching",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return u},(0,n.copyPropertiesToTarget)(t,e.sendRequest)}}t.default=u},290:e=>{"use strict";e.exports=require("async_hooks")},398:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.loopLogProcessPerformance=t.getCpuLimit=t.getCpuLimitUnsafe=t.loopLogThreadPerformance=void 0;const a=r(2987),u=s(r(857)),c=i(r(1493)),l=r(1765),d=r(9896),f=r(1954);function p(e){e.info("Trying to detect CPU limit");try{const t=(0,d.readFileSync)("/sys/fs/cgroup/cpu/cpu.cfs_quota_us","utf8"),r=(0,d.readFileSync)("/sys/fs/cgroup/cpu/cpu.cfs_period_us","utf8");return e.info("CPU limit detected for cgroups v1",{cpuQuota:t,cpuPeriod:r}),parseInt(t.toString())/parseInt(r.toString())}catch(t){try{const t=(0,d.readFileSync)("/sys/fs/cgroup/cpu.max","utf8"),[r,o,n]=t.trim().split(" ");return e.info("CPU limit detected for cgroups v2",{max:r,period:o}),r&&o?"max"===r?"unlimited":parseInt(r)/parseInt(o):void e.info("cpu.max file is not in the expected format",t)}catch(r){return void e.info("Failed to detect CPU limit",{e:t,e2:r})}}}t.loopLogThreadPerformance=async function(e,t,r){let o=a.performance.eventLoopUtilization(),n=a.performance.nodeTiming.toJSON();for await(const i of(0,l.unrefSetInterval)(t,void 0,{signal:r}))try{const t=a.performance.eventLoopUtilization(),r=a.performance.eventLoopUtilization(t,o);o=t;const i=c.getHeapStatistics(),s=a.performance.nodeTiming.toJSON(),u=s.idleTime-n.idleTime,l=s.duration-n.duration,d=u/l;n=s,e.info("thread performance statistics",{thread_elu_percentage:100*r.utilization,memory:{thread_heap_utilization_percentage:i.total_heap_size/i.heap_size_limit*100},idleTime:u,totalTime:l,idleTimePercentage:d})}catch(t){e.error("Failed logging thread performance statistics",{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0})}},t.getCpuLimitUnsafe=p,t.getCpuLimit=(0,f.suppressTraces)(p),t.loopLogProcessPerformance=async function(e,r,o){const n=u.default.totalmem(),i=(0,t.getCpuLimit)(e);let s=process.cpuUsage();for await(const t of(0,l.unrefSetInterval)(r,void 0,{signal:o}))try{const t=process.memoryUsage(),o=process.uptime(),a=process.cpuUsage(s);s=process.cpuUsage();let u=(a.user+a.system)/(1e3*r);i&&"number"==typeof i&&(u/=i),e.info("process performance statistics",{memory:{process_memory_rss:t.rss,process_memory_utilization_percentage:t.rss/n*100},cpu:100*u,cpuStats:{limit:i,usagePercentage:100*u},uptime:o})}catch(t){e.error("Failed logging process performance statistics",{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0})}}},405:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(1377),n=r(2119),i=r(7668),s=r(2847),a=r(461),u=r(2578),c=r(3425);class l extends i.FrameworkPatcher{_patch(e){return this._patchEmit(e),o.instrument_logger.info("Patched http successfully"),e}_patchEmit(e){const t=e.Server.prototype.emit;e.Server.prototype.emit=function(e,...r){if("request"!==e)return t.apply(this,[e,...r]);try{const e=r[0],t=r[1],n=s.HttpEndpointMetric.createUsableMetric();n.start(),(0,c.createNewInvestigation)(),n.setRequestAttributes(e),t.once("finish",(function(){try{(0,u.finishHttpInvestigation)(e,t,n),n.setResponseAttributes(t),n.end()}catch(e){o.instrument_logger.error("Failed to set response attributes",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}})),e[a.metricSymbol]=n}catch(e){o.instrument_logger.error("Failed to patch http.Server.prototype.emit",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return t.apply(this,[e,...r])},(0,n.copyPropertiesToTarget)(t,e.Server.prototype.emit)}}t.default=l},436:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(1377),n=r(2119),i=r(2119),s=r(7668),a=r(461),u=r(1973);class c extends s.FrameworkPatcher{_patch(e){return this._patchCreate(e),o.instrument_logger.info("Patched NestJS RouterExecutionContext successfully"),e}_patchCreate(e){const t=e.RouterExecutionContext.prototype.create;e.RouterExecutionContext.prototype.create=function(...e){try{const t=e[0],r=e[1];if("function"==typeof t.constructor&&"function"==typeof r){const n=(0,u.generateKey)(t,r);n&&(e[1]=(0,i.wrapFlow)((()=>{try{const e=(0,u.getRequestByCallback)(n);if(!e)return void o.instrument_logger.error("No request object found for key",{key:n});const t=function(e){if(e&&!e.raw&&e.socket)return e[a.metricSymbol]?e[a.metricSymbol].getFlowId?e[a.metricSymbol].getFlowId():void o.instrument_logger.error("No getFlowId function found on metric object"):void o.instrument_logger.error("No metric found on nestjs request object")}(e);return t||o.instrument_logger.error("No flow id found for key",{key:n}),t}catch(e){o.instrument_logger.error("Error in NestJS getFlowId",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}),r))}else o.instrument_logger.error("Invalid args in NestJS RouterExecutionContext.create",{args:e})}catch(e){o.instrument_logger.error("Error in NestJS RouterExecutionContext patcher",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return t.apply(this,e)},(0,n.copyPropertiesToTarget)(t,e.RouterExecutionContext.prototype.create)}}t.default=c},461:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(2323),t)},523:e=>{"use strict";e.exports=require("./logger")},713:function(e,t,r){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.hookMessageChannel=t.resetGlobals=t.initGlobals=void 0,r(1999);const n=r(765),i=r(6601),s=o(r(1019)),a=r(2243),u=r(8167),c=r(6022);function l(){globalThis.hudProcessedFiles=[],globalThis.hudManager=new i.SketchManager(s.default.huddBinWidth),globalThis._hud_S=new Array(1e3).fill(""),globalThis._hud_SI={value:0},globalThis.hudLoadedModules=[],globalThis.hudPatched=new Set,globalThis.HudSourceMapCache=new Map,globalThis.hudExpressState=[]}t.initGlobals=function(){globalThis.hudGlobalInitGuard||(globalThis.hudGlobalInitGuard=!0,globalThis.hudRunMutex=!1,globalThis.hudRanOnRequire=!1,globalThis.hudRanOnImport=!1,globalThis.hudInitGuard=void 0,globalThis.hudInstrumentationIndicator=void 0,globalThis.hudMetricsIndicator=void 0,globalThis.hudDeclarationsFound=!1,globalThis.hudStartTime=new Date,globalThis.hudCalls={},globalThis.hudRunningMode=n.HudRunningMode.enabled,globalThis.hudExtensionId=void 0,globalThis._hud_F="",globalThis.hudShouldLinkFunction=!1,globalThis.hudExecutionFlowMaxLength=s.default.investigation.limits.executionFlowMaxLength,globalThis.hudExceptionMaxLength=s.default.investigation.limits.exceptionMaxLength,globalThis.hudEnableInvestigation=s.default.dynamicConfig.enableInvestigation,(0,a.initHudSampleTable)(),l())},t.resetGlobals=l,t.hookMessageChannel=function(){const{port1:e,port2:t}=new u.MessageChannel;return e.on("message",(e=>{"HudModulePatch"===e.key?(globalThis.hudPatched.add(e.hudPatched),globalThis.hudProcessedFiles.push(e.hudProcessedFiles),globalThis.hudInstrumentationIndicator&&((0,c.clearInstrumentationIndicator)(),globalThis.hudDeclarationsFound=!0)):"HudRetrieveFileCache"===e.key&&globalThis.HudSourceMapCache.set(e.filename,e.content)})),e.unref(),globalThis.hudHookPort=e,t}},732:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.WorkerKeepaliveGuard=void 0;const s=i(r(1377)),a=r(765),u=s.app_logger;t.WorkerKeepaliveGuard=class{worker;keepaliveGrace;timeoutId=void 0;eventHandler=this.keepalive.bind(this);constructor(e,t){this.worker=e,this.keepaliveGrace=t}keepalive(e){try{if(e.msg!==a.KeepAliveMessage.msg)return;this._restartTimeout()}catch(e){u.error("Error in keepalive",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}_restartTimeout(){const e=setTimeout((()=>{}),this.keepaliveGrace);clearTimeout(this.timeoutId),this.timeoutId=e}start(){this.stop(),this.worker.on("message",this.eventHandler).unref()}stop(){void 0!==this.timeoutId&&clearTimeout(this.timeoutId),this.worker.off("message",this.eventHandler),this.timeoutId=void 0}}},765:(e,t)=>{"use strict";var r,o;Object.defineProperty(t,"__esModule",{value:!0}),t.HudSessionInitStatus=t.HudRunningMode=t.KeepAliveMessage=void 0,t.KeepAliveMessage={msg:"keep-alive"},function(e){e[e.detached=0]="detached",e[e.disabled=1]="disabled",e[e.enabled=2]="enabled"}(r||(t.HudRunningMode=r={})),function(e){e[e.success=0]="success",e[e.throttled=1]="throttled"}(o||(t.HudSessionInitStatus=o={}))},857:e=>{"use strict";e.exports=require("os")},878:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.GraphQLSupportedOperations=void 0,function(e){e.query="query",e.mutation="mutation"}(r||(t.GraphQLSupportedOperations=r={}))},893:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.extractEndpointsFromRouter=t.patchUse=t.ExpressRouterPatcher=void 0;const a=s(r(1019)),u=r(2119),c=r(1377),l=r(6538),d=r(6603),f=i(r(6982)),p=r(8054);class g{static hudRoutes=Symbol.for(a.default.express.routeNamesVarName);static layerState=Symbol.for(a.default.express.layerStateVarName);static hudMarked=Symbol.for(a.default.express.markedVarName)}function h(e){e[g.hudMarked]||(globalThis.hudExpressState.push(e),e[g.hudMarked]=!0)}function m(e,t){const r=[];for(const[o,n]of Object.entries(e.route[g.layerState]))r.push(new l.EndpointDeclaration(o,n.methods,"express",t,n.layerPath));return Array.from(r.values())}t.ExpressRouterPatcher=g,t.patchUse=function(e,t,r=!0){const o=e.use;e.use=function(e){const n=o.apply(this,arguments);try{let o=this[d.uuidSymbol];!o&&d.isVerboseLoggingEnabled&&(o=f.randomUUID(),this[d.uuidSymbol]=o,c.instrument_logger.info("Express use setting uuid",{kind:t,uuid:o})),"application"===t?function(e,t,r,o){try{r&&(e._router?h(e._router):e.router?h(e.router):c.instrument_logger.warn("Express application doesn't have router or _router")),o&&d.isVerboseLoggingEnabled&&c.instrument_logger.info("Express use app",{parent:o,child:t[1]?.[d.uuidSymbol]||"no uuid",path:t[0]})}catch(e){c.instrument_logger.error("Failed to save express app router",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}(this,arguments,r,o):"router"===t&&function(e,t,r,o,n){try{if(!e.stack)return void c.instrument_logger.error("Express router without stack");if(0===e.stack.length)return void c.instrument_logger.warn("Express router with an empty stack");"query"===e.stack[0].name?h(e):d.isVerboseLoggingEnabled&&!d.skipLayerNamesLogs.has(e.stack[0].name)&&(d.skipLayerNamesLogs.add(e.stack[0].name),c.instrument_logger.warn("Found unknown stack name",{stack:e.stack[0].name}));const{path:i,offset:s}=function(e){let t=0,r="/";if("function"!=typeof e){let o=e;for(;Array.isArray(o)&&0!==o.length;)o=o[0];"function"!=typeof o&&(t=1,r=e)}return{path:r,offset:t}}(n),a=p(Array.prototype.slice.call(t,s));for(let t=0;t<a.length&&t<e.stack.length;t++){const n=e.stack[e.stack.length-t-1],s=a[a.length-t-1];"router"===n.name?(s&&!s[d.uuidSymbol]&&d.isVerboseLoggingEnabled&&(s[d.uuidSymbol]=f.randomUUID(),c.instrument_logger.info("Express handle router setting uuid",{uuid:s[d.uuidSymbol]})),r&&(n[g.hudRoutes]=i)):d.isVerboseLoggingEnabled&&!d.skipLayerNamesLogs.has(n.name)&&(d.skipLayerNamesLogs.add(n.name),c.instrument_logger.warn("Found unknown layer name",{layer:n.name,parent:o,child:s[d.uuidSymbol]||"no uuid",path:i}))}}catch(e){c.instrument_logger.error("Failed to patch router.use function",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}(this,arguments,r,o,e)}catch(e){c.instrument_logger.error("Failed to patch express.use function",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return n},(0,u.copyPropertiesToTarget)(o,e.use)},t.extractEndpointsFromRouter=function e(t,r){let o=[];if(!r.stack)return c.instrument_logger.error("Router without stack - bad OTEL version",{router:r}),o;for(const n of r.stack)if("router"===n.name){if(!n[g.hudRoutes]){c.instrument_logger.error("Router layer without routes",{layer:n});continue}const r=t+n[g.hudRoutes];o=o.concat(e(r,n.handle))}else n.route&&n.route[g.layerState]?o=o.concat(m(n,t)):d.isVerboseLoggingEnabled&&!d.skipLayerNamesLogs.has(n.name)&&(d.skipLayerNamesLogs.add(n.name),c.instrument_logger.warn("Found unknown layer name when extracting endpoints",{layer:n.name}));return o}},932:e=>{"use strict";e.exports=require("process")},938:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GraphQLMetric=void 0;const o=r(461);class n extends o.FlowMetric{constructor(e){super(e)}_createUsableMetric(e){return this}toRaw(){return{flow_id:this.flowId,type:"GraphQLMetric",duration:this.duration}}}t.GraphQLMetric=n},1019:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=i(r(5809));n(r(5809),t),t.default=s.default},1064:function(e,t,r){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(1377),i=r(9514),s=r(2119),a=r(7668),u=r(5331),c=r(6626),l=r(9514),d=r(3425),f=o(r(1019)),p=r(5094);class g extends a.FrameworkPatcher{isSupported(e,t,r,o){const s=f.default.userConfig.enableDapulse?.value?o.mondayVersion:o.bbcVersion,u=(0,a.extractModuleVersion)(e);return!!(0,a.isSupportedVersion)(u,s)||(n.instrument_logger.warn("Unsupported sqs-consumer version",{framework:"SqsConsumer",version:u,supportedVersion:s,basedir:e,isDapulse:f.default.userConfig.enableDapulse?.value}),n.customer_logger.log(i.UserErrorLogs.UnsupportedFrameworkVersion("sqs-consumer")),!1)}_patch(e){return function(e){const t=e.Consumer.create;e.Consumer.create=function(...e){const r=t.apply(this,e);try{!function(e){const t=e.queueUrl;if(!t)throw new l.HudNoQueueUrlInSqsConsumer;const r=h(t);if(e.handleMessageBatch&&"function"==typeof e.handleMessageBatch){const t="handleMessageBatch",o=(0,p.generateSqsFlowId)(r,t);(0,u.storeSqsQueueDeclaration)({flow_id:o,queue_name:r,handle_type:t});const n=e.handleMessageBatch,i=(0,s.wrapFlow)((()=>o),n,m,_,y);e.handleMessageBatch=i}else if(e.handleMessage&&"function"==typeof e.handleMessage){const t="handleMessage",o=(0,p.generateSqsFlowId)(r,t);(0,u.storeSqsQueueDeclaration)({flow_id:o,queue_name:r,handle_type:t});const n=e.handleMessage,i=(0,s.wrapFlow)((()=>o),n,m,_,y);e.handleMessage=i}else n.instrument_logger.warn("Unable to getFlowId - No handleMessage or handleMessageBatch found in SqsConsumer.Consumer",{queueName:r})}(r),function(e){const t=e.on;e.on=function(...r){try{const t=r[0];if(!t||"string"!=typeof t)throw new l.HudNoEventTypeInSqsConsumerOn;const o=r[1];if(!o||"function"!=typeof o)throw new l.HudNoCallbackInSqsConsumerOn;const n=h(e.queueUrl),i="event",a=(0,p.generateSqsFlowId)(n,i,t);(0,u.storeSqsQueueDeclaration)({flow_id:a,queue_name:n,handle_type:i,event_type:t}),r[1]=(0,s.wrapFlow)((()=>a),o,v,_,y)}catch(e){n.instrument_logger.error("Error in SqsConsumer.Consumer.on patched logic",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return t.apply(this,r)}}(r)}catch(e){n.instrument_logger.error("Error in patching SqsConsumer.Consumer",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return r},(0,s.copyPropertiesToTarget)(t,e.Consumer.create)}(e),n.instrument_logger.info("Patched sqs-consumer successfully",{isDapulse:f.default.userConfig.enableDapulse?.value}),e}}function h(e){const t=e.split("/").pop();if(!t)throw new l.HudFailExtractSqsQueueName(`Url: ${e}`);return t}function m(e,t,r){const o=c.SqsMetric.createUsableMetric(e);o.start();const i=r[0];if(!i)return n.instrument_logger.warn("No messages pass to sqs handler",{flowId:e}),void(t.flowMetric=o);if(Array.isArray(i)){if(o.msgCount=i.length,i[0]?.Attributes?.SentTimestamp){const t=i.reduce(((e,t)=>{const r=Number.parseInt(t?.Attributes?.SentTimestamp);return isNaN(r)?e:Math.min(e,r)}),1/0);t!==1/0?o.e2eEpocStartTimeMS=t:n.instrument_logger.warn("No valid SentTimestamp found eventhough the first element had SentTimestamp",{flowId:e})}}else o.msgCount=1,i?.Attributes?.SentTimestamp&&(o.e2eEpocStartTimeMS=i.Attributes.SentTimestamp);t.flowMetric=o}function v(e,t,r){const o=c.SqsMetric.createUsableMetric(e);o.start(),t.flowMetric=o}function _(e,t){const r=t.flowMetric;r?r.end():n.instrument_logger.warn("No flowMetric found for message during catch",{flowId:e})}function y(e,t,r){const o=t.flowMetric;o?(o.error=(0,d.extractName)(r),o.end()):n.instrument_logger.warn("No flowMetric found for message during catch",{flowId:e})}t.default=g},1306:(e,t,r)=>{var o={"./codeGenieServerlessExpress":214,"./codeGenieServerlessExpress.ts":214,"./express":7697,"./express.ts":7697,"./express/methods":1528,"./express/methods.ts":1528,"./express/route":8607,"./express/route.ts":8607,"./express/router":893,"./express/router.ts":893,"./express/verbosity":6603,"./express/verbosity.ts":6603,"./expressApplication":7815,"./expressApplication.ts":7815,"./frameworkPatcher":7668,"./frameworkPatcher.ts":7668,"./graphql":9788,"./graphql.ts":9788,"./graphql/metadata":6530,"./graphql/metadata.ts":6530,"./graphql/resolversDeclarations":6257,"./graphql/resolversDeclarations.ts":6257,"./graphql/resolversMapping":7868,"./graphql/resolversMapping.ts":7868,"./http":405,"./http.ts":405,"./kafkajs":2680,"./kafkajs.ts":2680,"./kafkajs/topicsDeclarations":5202,"./kafkajs/topicsDeclarations.ts":5202,"./koa":7436,"./koa.ts":7436,"./nestjsInterceptor":1973,"./nestjsInterceptor.ts":1973,"./nestjsRouterExecutionContext":436,"./nestjsRouterExecutionContext.ts":436,"./nestjsRpcContextCreator":7636,"./nestjsRpcContextCreator.ts":7636,"./router":9368,"./router.ts":9368,"./serverlessHttp":4859,"./serverlessHttp.ts":4859,"./sqs/SqsDeclarations":5331,"./sqs/SqsDeclarations.ts":5331,"./sqsConsumer":1064,"./sqsConsumer.ts":1064};function n(e){var t=i(e);return r(t)}function i(e){if(!r.o(o,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return o[e]}n.keys=function(){return Object.keys(o)},n.resolve=i,e.exports=n,n.id=1306},1321:e=>{"use strict";e.exports=require("reflect-metadata")},1377:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(523),t)},1493:e=>{"use strict";e.exports=require("v8")},1528:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.patchMethods=t.getMethods=void 0;const s=r(1377),a=r(2119),u=r(893),c=r(6603),l=i(r(6982));function d(){const e=r(8611);return e.METHODS&&e.METHODS.map((function(e){return e.toLowerCase()}))||["get","post","put","head","delete","options","trace","copy","lock","mkcol","move","purge","propfind","proppatch","unlock","report","mkactivity","checkout","merge","m-search","notify","subscribe","unsubscribe","patch","search","connect"]}t.getMethods=d,t.patchMethods=function(e,t){d().concat("all").forEach((function(r){const o=e[r];if(!o)return void(c.isVerboseLoggingEnabled&&s.instrument_logger.warn("Method not found",{method:r}));const n="all"===r;e[r]=function(){try{if(arguments.length<2)return o.apply(this,arguments);let e=this[c.uuidSymbol];c.isVerboseLoggingEnabled&&(e||(e=l.randomUUID(),this[c.uuidSymbol]=e,s.instrument_logger.info("Express method setting uuid",{uuid:e,kind:t})),s.instrument_logger.info("Express added new method",{method:r,uuid:e,path:arguments[0]}));const i=Array.prototype.slice.call(arguments);if(i[1][u.ExpressRouterPatcher.layerState]={flowId:[],kind:t,allMethod:n},Array.isArray(i[0]))for(const e of i[0]){const e=l.randomUUID();i[1][u.ExpressRouterPatcher.layerState].flowId.push(e)}else i[1][u.ExpressRouterPatcher.layerState].flowId.push(l.randomUUID());const a=o.apply(this,i);try{delete i[1][u.ExpressRouterPatcher.layerState]}catch(e){}return a}catch(e){s.instrument_logger.error("Failed to patch method",{kind:t,method:r,msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return o.apply(this,arguments)},(0,a.copyPropertiesToTarget)(o,e[r])}))}},1533:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UserLogs=void 0,t.UserLogs={HudInitSuccess:()=>({level:"info",message:"Session started"}),FirstDecalarationSent:()=>({level:"info",message:"First code mapping sent successfully"}),FirstInvocationSent:()=>({level:"info",message:"First invocation sent successfully"}),HappyFlowCompleted:()=>({level:"info",message:"Your service is sending data successfully"}),FilesLoadedBeforeRegister:()=>({level:"info",message:"Files loaded before register():"}),FileBeforeRegisterTemplate:(e,t)=>({level:"info",message:`${e}. ${t}`}),InitIdleMode:()=>({level:"info",message:"Initialized successfully in idle mode."})}},1582:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SketchManager=void 0;const o=r(5009);t.SketchManager=class{binWidth;logBinWidth;constructor(e){this.binWidth=e,this.logBinWidth=Math.log(e)}binIndex(e){return Math.floor(Math.log(e)/this.logBinWidth)}indexToBinStart(e){return this.binWidth**e}newSketchDataWithValue(e){const t=this.binIndex(e),r=new o.SketchData;return r.indexShift=t,r[0]=1,r}add(e,t){const r=this.binIndex(t);let o=r-e.indexShift;o<0?(e.unshift(...new Array(-o).fill(0)),e.indexShift=r,o=r-e.indexShift):o>=e.length&&e.push(...new Array(o-e.length+1).fill(0)),e[o]+=1}zero(e){e.fill(0)}copy(e){const t=new o.SketchData;return t.indexShift=e.indexShift,t.push(...e),t}mergeIntoNoChecks(e,t){const r=t.indexShift-e.indexShift;for(let o=0;o<t.length;o++)e[o+r]+=t[o]}mergeInto(e,t){t.indexShift<e.indexShift&&(e.unshift(...new Array(e.indexShift-t.indexShift).fill(0)),e.indexShift=t.indexShift),t.indexShift+t.length>e.indexShift+e.length&&e.push(...new Array(t.indexShift+t.length-(e.indexShift+e.length)).fill(0)),this.mergeIntoNoChecks(e,t)}mergeMany(e){if(0===e.length)throw new Error("Cannot merge empty list of SketchData.");if(1===e.length)return this.copy(e[0]);let t=1/0,r=-1/0;for(const o of e)t=Math.min(t,o.indexShift),r=Math.max(r,o.indexShift+o.length-1);const n=new o.SketchData;n.indexShift=t,n.push(...new Array(r-t+1).fill(0));for(const t of e)this.mergeIntoNoChecks(n,t);return n}getQuantile(e,t){const r=e.reduce(((e,t)=>e+t),0);if(0===r)throw new Error("Cannot get quantile of empty SketchData.");const o=r*t;let n,i=0;for(n=0;n<e.length&&(i+=e[n],!(i>=o));n++);const s=this.indexToBinStart(n+e.indexShift),a=(i-o)/e[n];return s*this.binWidth**(1-a)}encode(e){return{binWidth:this.binWidth,indexShift:e.indexShift,data:Array.from(e)}}decode(e){if(e.binWidth!==this.binWidth)throw new Error(`Should not decode sketch data with bin width ${e.binWidth} using SketchManager with bin width ${this.binWidth}.`);const t=new o.SketchData;return t.indexShift=e.indexShift,t.push(...e.data),t}}},1765:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.unrefSetInterval=t.unrefSetTimeout=t.unrefSetImmediate=void 0;const s=i(r(6460));t.unrefSetImmediate=function(e,t){return s.setImmediate(e,{...t,ref:!1})},t.unrefSetTimeout=function(e,t,r){return s.setTimeout(e,t,{...r,ref:!1})},t.unrefSetInterval=function(e,t,r){return s.setInterval(e,t,{...r,ref:!1})}},1836:function(e,t,r){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getPodMemoryLimit=void 0;const n=r(9896),i=o(r(857));let s=null;function a(e,t){const r=parseInt(e);if(isNaN(r))return null;const o=Math.floor(r/1048576);return o<=0||o>=131072?(t.debug(`Treating memory value (${e} bytes) as unlimited.`),null):o}function u(e,t,r){if(!e)return{podMemoryLimitMB:null,source:null};const o=a(e,r);return null!==o?{podMemoryLimitMB:o,source:t}:{podMemoryLimitMB:null,source:null}}function c(e){try{return(0,n.readFileSync)(e,"utf8")}catch{return null}}function l(){const e=i.default.totalmem();return{podMemoryLimitMB:Math.floor(e/1048576),source:"system-memory"}}t.getPodMemoryLimit=function(e){if(null!==s)return s;if("linux"!==i.default.platform())return s=l(),s;let t=function(e,t){for(const e of["/sys/fs/cgroup/memory.max","/sys/fs/cgroup/memory.high"]){const r=c(e);if(!r)continue;const o=r.trim();if("max"===o){t.debug(`Found 'max' value in ${e}, will use system memory instead`);continue}const n=a(o,t);if(null!==n)return{podMemoryLimitMB:n,source:e}}return{podMemoryLimitMB:null,source:null}}(0,e);return null!==t.podMemoryLimitMB?(e.info(`Found pod memory limit: ${t.podMemoryLimitMB}MB from ${t.source}`),t):(t=function(e,t){for(const e of["/sys/fs/cgroup/memory/memory.stat","/sys/fs/cgroup/memory/memory.limit_in_bytes"]){const r=c(e);if(r)if(e.endsWith("memory.stat")){const o=["hierarchical_memory_limit","memory.limit_in_bytes","limit_in_bytes"],n=r.split("\n");for(const r of o){const o=n.find((e=>e.startsWith(r)));if(o){const n=u(o.split(" ")[1],`${e}:${r}`,t);if(null!==n.podMemoryLimitMB)return n}}}else{const o=u(r.trim(),e,t);if(null!==o.podMemoryLimitMB)return o}}return{podMemoryLimitMB:null,source:null}}(0,e),null!==t.podMemoryLimitMB?(e.info(`Found pod memory limit: ${t.podMemoryLimitMB}MB from ${t.source}`),t):(t=l(),e.info(`No container memory limit found, using system memory: ${t.podMemoryLimitMB}MB`),s=t,t))}},1954:function(e,t,r){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.suppressTraces=void 0;const n=o(r(1019)),i=r(1377),s=r(2676);let a,u;try{const e=(0,s.myRequire)("@opentelemetry/api"),t=(0,s.myRequire)("@opentelemetry/core");a=e.context,u=t.suppressTracing,i.app_logger.info("OpenTelemetry exists",{suppressConfig:n.default.suppressTraces})}catch(e){i.app_logger.info("OpenTelemetry api/core does not exist")}t.suppressTraces=function(e){return function(...t){return n.default.suppressTraces&&a&&u?(i.app_logger.debug("Running with Suppressed traces"),a.with(u(a.active()),(()=>e(...t)))):e(...t)}}},1973:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateKey=t.getRequestByCallback=void 0,r(1321);const o=r(1377),n=r(2119),i=r(7668),s=new Map;function a(e,t){const r=Reflect.getMetadata("path",t)??Reflect.getMetadata("microservices:pattern",t);if(!r)return void o.instrument_logger.error("No callback path found on callback",{callback:t});const n=e.constructor.CONTROLLER_ID;if(n)return`${n}.${r}`;o.instrument_logger.error("No controller id found on controller",{controller:e})}t.getRequestByCallback=function(e){const t=s.get(e);return t&&s.delete(e),t},t.generateKey=a;class u extends i.FrameworkPatcher{_patch(e){return this._patchIntercept(e),o.instrument_logger.info("Patched NestJS intercept successfully"),e}_patchIntercept(e){const t=e.InterceptorsConsumer.prototype.intercept;e.InterceptorsConsumer.prototype.intercept=async function(...e){return function(e){try{const t=e[2],r=e[3];if("function"==typeof t.constructor&&"function"==typeof r){let o;if("rpc"===e[5])o=e[1][1].args[0];else if(o=e[1][0],!o||o.raw)return;const n=a(t,r);if(!n)return;s.set(n,o)}else o.instrument_logger.error("Invalid args in NestJS InterceptorsConsumer.intercept",{args:e})}catch(e){o.instrument_logger.error("Error in NestJS intercept patcher",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}(e),await t.apply(this,e)},(0,n.copyPropertiesToTarget)(t,e.InterceptorsConsumer.prototype.intercept)}}t.default=u},1999:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},2119:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.copyPropertiesToTarget=t.wrapFlow=void 0;const o=r(765),n=r(6121),i=r(1377);function s(e,t){const r=Object.getOwnPropertyDescriptors(e),o=Reflect.ownKeys(r);Object.setPrototypeOf(t,e),o.forEach((e=>{try{Object.defineProperty(t,e,r[e])}catch(e){}}))}t.wrapFlow=function(e,t,r,a,u){let c;return c=t instanceof n.AsyncFunction?async function(...n){let s;try{s=e(n)}catch(e){i.instrument_logger.error("Failed to get flowId",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}if(!s||hudRunningMode!==o.HudRunningMode.enabled)return await t.apply(this,n);_hud_F=s,hudShouldLinkFunction=!0;const c={};if(r)try{r(s,c,n)}catch(e){i.instrument_logger.error("Failed to execute beforeCallbackHook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}try{const e=t.apply(this,n);_hud_F="";const r=await e;if(a)try{a(s,c)}catch(e){i.instrument_logger.error("Failed to execute afterCallbackHook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return r}catch(e){if(u)try{u(s,c,e)}catch(e){i.instrument_logger.error("Failed to execute catchCallbackHook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}throw e}finally{_hud_F="",hudShouldLinkFunction=!1}}:function(...n){let s;try{s=e(n)}catch(e){i.instrument_logger.error("Failed to get flowId",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}if(!s||hudRunningMode!==o.HudRunningMode.enabled)return t.apply(this,n);_hud_F=s,hudShouldLinkFunction=!0;const c={};if(r)try{r(s,c,n)}catch(e){i.instrument_logger.error("Failed to execute beforeCallbackHook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}try{const e=t.apply(this,n);if(a)if(e instanceof Promise)e.then((()=>{try{a(s,c)}catch(e){i.instrument_logger.error("Failed to execute afterCallbackHook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}));else try{a(s,c)}catch(e){i.instrument_logger.error("Failed to execute afterCallbackHook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return e}catch(e){if(u)try{u(s,c,e)}catch(e){i.instrument_logger.error("Failed to execute catchCallbackHook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}throw e}finally{_hud_F="",hudShouldLinkFunction=!1}},s(t,c),c},t.copyPropertiesToTarget=s},2147:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.shouldRunHud=t.isSupportedNative=t.isDebuggerAttached=void 0;const a=s(r(5809)),u=r(9514),c=r(5339),l=i(r(6592));function d(){if("true"===process.env.HUD_ALLOW_DEBUGGER)return!1;if(process.execArgv.some((e=>e.includes("--inspect")||e.includes("--debug")||e.includes("--inspect-brk")||e.includes("--debug-brk"))))return!0;try{return"string"==typeof l.url()}catch(e){return!1}}function f(){return void 0!==r(2784).transform}t.isDebuggerAttached=d,t.isSupportedNative=f,t.shouldRunHud=function(){return"false"===process.env.HUD_ENABLE?{shouldRun:!1,error:u.UserErrorLogs.HudEnableIsFalse()}:process.versions.bun?{shouldRun:!1,error:u.UserErrorLogs.RunningInBun()}:"win32"===process.platform?{shouldRun:!1,error:u.UserErrorLogs.RunningOnWindows()}:function(){const e=process.versions.node.split(".")[0];return!!a.default.supportedNodeVersions.includes(e)}()?process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE&&!function(){try{return"1"===process.env.HUD_INTERNAL_EXEC_WRAPPER_USED}catch(e){return!1}}()?{shouldRun:!1,error:u.UserErrorLogs.LambdaNotViaLayer()}:d()?{shouldRun:!1,error:u.UserErrorLogs.DebuggerAttached()}:function(){const e=(0,c.getMemoryLimitInfo)();return!!(0,c.isMemoryLimitBigEnough)(e)}()?f()?{shouldRun:!0}:{shouldRun:!1,error:u.UserErrorLogs.UnsupportedNativeBuild()}:{shouldRun:!1,error:u.UserErrorLogs.PodMemoryLimitTooLow(a.default.minPodMemoryLimit)}:{shouldRun:!1,error:u.UserErrorLogs.UnsupportedNodeVersion()}}},2243:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.edit=t.editInSplits=t.initHudSampleTable=t.splitCode=t.getFunctionWrapperTemplate=void 0;const a=s(r(3176)),u=r(3903),c=r(1377),l=s(r(1019)),d=r(7022),f=r(2676),p=r(3868),g=i(r(2784)),h=r(5339),m=/([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})/;function v(e,t,r=!1){const o=`${e}_hudTemp`,n="BODY_PLACEHOLDER",i="FUNCTION_ID_PLACEHOLDER",s="AWAITABLE_PLACEHOLDER";let a;return a=r?[]:t===d.Format.esm?[`import { createRequire as ${e}_createRequire } from "module";`,`const ${e}_require = ${e}_createRequire(import.meta.url);`,`let ${e}_temp;`,`try { ${e}_temp = ${e}_require("${f.myRequire.resolve(l.default.hudModuleName+"/wrap")}"); } catch (e) { ${e}_temp = { wrapperInitial: () => {}, wrapperCatch: () => {}, wrapperFinally: () => {}, fixStack: () => {} }; }`,`const { wrapperInitial: ${e}_wi, wrapperCatch: ${e}_wc, wrapperFinally: ${e}_wf, fixStack: ${e}_fs, asyncIteratorWrapper: ${e}_aiw } = ${e}_temp;`]:[`let ${e}_temp;`,`try { ${e}_temp = require("${f.myRequire.resolve(l.default.hudModuleName+"/wrap")}"); } catch (e) { ${e}_temp = { wrapperInitial: () => {}, wrapperCatch: () => {}, wrapperFinally: () => {}, fixStack: () => {} }; }`,`const { wrapperInitial: ${e}_wi, wrapperCatch: ${e}_wc, wrapperFinally: ${e}_wf, fixStack: ${e}_fs, asyncIteratorWrapper: ${e}_aiw } = ${e}_temp;`],{functionWrapper:`{\n let ${o};\n const ${l.default.functionIdVarName} = ${i};\n const ${e}_cc = {};\n try {\n ${e}_wi(${l.default.functionIdVarName}, ${e}_cc);\n } catch (e) {\n globalThis._hud_SI = { value: 0 };\n globalThis._hud_S = [];\n }\n try {\n ${n}\n } catch (e) {\n try {\n ${e}_wc(${l.default.functionIdVarName}, ${e}_cc, e);\n } catch (e) {}\n throw e;\n } finally {\n try {\n ${e}_wf(${l.default.functionIdVarName}, ${e}_cc);\n } catch (e) {}\n }\n }`,awaitWrapper:`(${o} = ${s}, _hud_SI.value--, _hud_F = "", ${e}_cc.ff = true, ${o} = await ${o}, _hud_S[++_hud_SI.value] = ${l.default.functionIdVarName}, _hud_F = ${e}_cc.currentFlowId, ${e}_cc.ff= false, ${o})`,yieldWrapper:`\n function* ${e}_generatorWrapper() {\n return (${o} = ${s}, _hud_SI.value--, _hud_F = "", ${e}_cc.ff = true, ${o} = yield ${o}, _hud_S[++_hud_SI.value] = ${l.default.functionIdVarName}, _hud_F = ${e}_cc.currentFlowId, ${e}_cc.ff= false, ${o})\n }`,yieldStarWrapper:`\n function* ${e}_generatorWrapper() {\n return (${o} = ${s}, _hud_SI.value--, _hud_F = "", ${e}_cc.ff = true, ${o} = yield* ${o}, _hud_S[++_hud_SI.value] = ${l.default.functionIdVarName}, _hud_F = ${e}_cc.currentFlowId, ${e}_cc.ff= false, ${o})\n }`,initialStatements:a,bodyPlaceholder:n,functionIdPlaceholder:i,awaitablePlaceholder:s,fixStackFunction:`\n try{\n ${e}_fs(${l.default.functionIdVarName}, ${e}_cc)\n }catch(e){};`,asyncIteratorWrapper:`${e}_aiw`,awaitableVariable:o}}function _(e,t,r=!0,o=!1){const n=Error.prepareStackTrace;let i=!1,s=function(e){const t=e.match(`${l.default.bundlerBuildIdVarName}="${m.source}"`);if(t&&t.length>0)return t[1]}(e);s||(s=function(e){return(0,u.v5)(e,l.default.bundlerBuildUuidNamespace)}(e),i=!0);const d=(0,u.v5)(e,l.default.functionUuidNamespace),f=(0,a.default)(t.filename).readUInt32BE(),p=(0,a.default)(e).readUInt32BE(),_={data:t,bundlerBuildId:s,prefix:l.default.wrapVarPrefix,...v(l.default.wrapVarPrefix,t.format,o),uuidNamespace:l.default.functionUuidNamespace,fileHash:d,useInputSourcemap:r},y=g.transform(e,_);return(0,h.incrementInstrumentedFunctionsCount)(y.functionsIds.length),Error.prepareStackTrace=n,c.instrument_logger.debug(`Successfully transformed ${t.filename}`),{code:y.code,map:y.map,functionIds:y.functionsIds,filename:t.filename,hasInputMap:y.isInputSourcemap,bundlerBuildId:s,bundlerBuildIdGenerated:i,file_path_checksum:f,file_checksum:p,sourceCodeHash:d,moduleBase:y.moduleBase}}t.getFunctionWrapperTemplate=v;class y extends Error{}function b(e,t){if(e&&t)throw new y("Start mark found inside mark");if(!e&&!t)throw new y("End mark found outside mark")}function w(e,t,r,o){const n=e.split("\n");let i=r,s=o;return i+=n.length-1,i+=t.split("\n").length-1,i===r?s+=n.pop()?.length||0:s=n.pop()?.length||0,{lineOffset:i,columnOffset:s}}function*E(e){let t=!1,r=0,o=0,n=!1,i=0,s=0;const a=new RegExp(`globalThis\\s*?&&\\s*?\\(globalThis\\.${l.default.esbuildGlobalVar}\\s*?=\\s*?"(Start|End):(?<fileName>.*?)"\\);?`,"g");for(const u of e.matchAll(a)){if(n=!0,!u.groups)throw new y("No groups found in match");const{fileName:a}=u.groups,[c,l]=u,d="Start"===l;b(d,t);let f="";if(t){const t=u.index+c.length;f=e.slice(r,t);const n=o+Buffer.byteLength(f,"utf8");yield{edit:!0,code:f,fileName:a,lineOffset:i,columnOffset:s,indexOffset:o,indexOffsetEnd:n},r=t,o=n}else{const t=u.index;f=e.slice(r,t),o+=Buffer.byteLength(f,"utf8"),r=t,yield{edit:!1,code:f}}t=!!d,({lineOffset:i,columnOffset:s}=w(f,c,i,s))}if(t)throw new y("End mark found outside mark");n?r<e.length&&(yield{edit:!1,code:e.slice(r)}):yield{edit:!1,code:e}}function k(e,t,r){c.instrument_logger.debug("Edit chunk",{fileName:e.fileName,size:e.code.length,edit:t}),r?.push({fileName:e.fileName,size:e.code.length,edit:t})}function S(e,t,r){const o=_(e.code,{filename:t,format:r},!1,!0),n=o.code;return o.mapRelativeToChunk=o.map,o.map=function(e,t,r){"string"==typeof e&&(e=JSON.parse(e));const o=(0,p.decode)(e.mappings);return o.forEach((e=>{e.forEach((e=>{e.length>=4&&"number"==typeof e[2]&&("number"==typeof e[3]&&0===e[2]&&(e[3]+=r),e[2]+=t)}))})),JSON.stringify({...e,mappings:(0,p.encode)(o),sourcesContent:void 0})}(o.map,e.lineOffset,e.columnOffset),{codeToAppend:n,metadata:{...o,filename:t,lineOffset:e.lineOffset,columnOffset:e.columnOffset}}}function M(e,t,r,o=!1,n=()=>!0){let i="",s=0,a=0;const u=[];let d=0;const f=o?[]:void 0,p=v(l.default.wrapVarPrefix,r).initialStatements.join("\n"),g=function(e){return e.slice(l.default.esbuildMark.length,l.default.esbuildMark.length+36)}(e);for(const o of E(e)){d++;try{let e="",c=!1;if(o.edit&&(c=n(o.fileName),f&&k(o,c,f)),o.edit&&c){const n=S(o,t,r);e=n.codeToAppend,u.push({...n.metadata,bundlerBuildId:g,transformedLineOffset:s,transformedColumnOffset:a,indexOffset:o.indexOffset,indexOffsetEnd:o.indexOffsetEnd})}else e=0===i.length?I(o.code,p):o.code;({transformedCodeLineOffset:s,transformedCodeColumnOffset:a}=C(e,s,a)),i+=e}catch(r){return c.instrument_logger.error("Failed to patch index",{index:d,filename:t,msg:r instanceof Error?r.message:void 0,stack:r instanceof Error?r.stack:void 0}),{transformedCode:e,metadatas:[],editedChunksSizes:f}}}return{transformedCode:i,metadatas:u,editedChunksSizes:f}}function I(e,t){let r="";return e.startsWith('"use strict";')?(r+='"use strict";',r+=t,r+=e.slice(13),r):(r+=t,r+=e,r)}function C(e,t,r){const o=e.split("\n");return o.length>1?(t+=o.length-1,r=o.pop()?.length||0):r+=e.length,{transformedCodeLineOffset:t,transformedCodeColumnOffset:r}}t.splitCode=E,t.initHudSampleTable=function(){globalThis.hudSampleTable=[];const e=[[10,1],[30,2],[100,3],[500,11],[1e3,23],[5e3,53]];let t=0;for(const[r,o]of e){for(let e=t;e<r;e++)globalThis.hudSampleTable.push(e%o===0);t=r}},t.editInSplits=M,t.edit=function(e,t,r){if(e.startsWith(l.default.esbuildMark))return c.instrument_logger.info("Editing in splits"),M(e,t,r,!1);{const o=_(e,{filename:t,format:r},l.default.userConfig.disableSourceMapsResolution?.value??!0);return{transformedCode:o.code,metadatas:[o]}}}},2305:e=>{"use strict";e.exports=require("form-data")},2323:e=>{"use strict";e.exports=require("./flow")},2578:function(e,t,r){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.finishHttpInvestigation=t.getStacktraceUniqString=t.censorInvestigation=t.storeInvestigation=t.initInvestigationStorage=t.serializableInvestigation=t.storeClosedInvestigation=t.getClosedInvestigations=t.resetInvestigationDedupingCache=t.increaseInvestigationDedupingCache=t.increaseGlobalInvestigationTracking=t.setGlobalInvestigationTracking=t.hudInvestigationDedupingCache=t.globalInvestigationTracking=void 0;const n=r(290),i=r(1377),s=o(r(1019)),a=r(3425);let u=[];function c(){t.globalInvestigationTracking++}function l(e,r){const o=t.hudInvestigationDedupingCache.get(e)??new Map,n=(o.get(r)??0)+1;o.set(r,n),t.hudInvestigationDedupingCache.set(e,o)}function d(e){u.push(e)}t.globalInvestigationTracking=0,t.hudInvestigationDedupingCache=new Map,t.setGlobalInvestigationTracking=function(e){t.globalInvestigationTracking=e},t.increaseGlobalInvestigationTracking=c,t.increaseInvestigationDedupingCache=l,t.resetInvestigationDedupingCache=function(){t.hudInvestigationDedupingCache.clear()},t.getClosedInvestigations=function(){const e=u;return u=[],e},t.storeClosedInvestigation=d;const f=/(?:\n\s*at.*)+$/;function p(e){return{status:e.status,context:e.context,exceptions:Array.from(Array.from(e.exceptions?.values()??[]).map((({exception:e,executionFlow:t})=>{return{name:(0,a.extractNameOptional)(e),message:(0,a.extractMessage)(e),stackTrace:(r=e,r?.stack?.match(f)?.[0]),executionFlow:t};var r}))??[])}}function g(e,t){e.context=t,d(p(e))}function h(e){for(const t of s.default.investigation.censorshipRegexes)e=e.replace(t.regex,t.replacement);return e}function m(e){if("string"==typeof e)return h(e);if("object"==typeof e&&null!==e)for(const t in e)s.default.investigation.blacklistParams.includes(t)?e[t]="[REDACTED]":e[t]=m(e[t]);return e}t.serializableInvestigation=p,t.initInvestigationStorage=function(){return new n.AsyncLocalStorage},t.storeInvestigation=g,t.censorInvestigation=function(e){const t=e.context?{type:e.context.type,endpoint_uuid:e.context.endpoint_uuid,status_code:e.context.status_code,route:h(e.context?.route),params:m(e.context?.params),query:m(e.context?.query),request_body:m(e.context?.request_body),method:e.context?.method,timestamp:e.context?.timestamp}:void 0;return{status:e.status,context:t,exceptions:e.exceptions.map((e=>({name:e.name,message:e.message?h(e.message):void 0,stackTrace:e.stackTrace,executionFlow:e.executionFlow})))}};const v=/.*\((.*):(\d+):(\d+)\)/,_=/.*?(\S*):(\d+):(\d+)/;function y(e){const t=Error.prepareStackTrace;if(void 0===t||"function"!=typeof t)return;let r,o;try{Error.prepareStackTrace=(e,t)=>{r=t[0],o=t};const n=e.stack;if(void 0!==n&&void 0===r){const t=function(e){const t=e.indexOf("\n");if(-1===t)return;const r=e.indexOf("\n",t+1);return e.slice(t+1,-1===r?void 0:r)}(n);if(!t)return;const r=t.match(v);if(r&&r[1]&&r[2]&&r[3])return`${e.name}@${r[1]}:${r[2]}:${r[3]}`;const o=t.match(_);return o&&o[1]&&o[2]&&o[3]?`${e.name}@${o[1]}:${o[2]}:${o[3]}`:void 0}if(void 0===r||void 0===o)return;Object.defineProperty(e,"stack",{configurable:!0,enumerable:!1,