@inkeep/open-knowledge 0.47.1 → 0.47.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/dist/{acp-harness-probe-qJUo1ApO.mjs → acp-harness-probe-QNrRVJhc.mjs} +2 -2
  2. package/dist/cli.mjs +7 -7
  3. package/dist/config-schema.json +10 -1
  4. package/dist/config.user.schema.json +10 -1
  5. package/dist/constants-C5EnGQBy.mjs +2 -0
  6. package/dist/fs-traced-C-HqiL6u.mjs +1 -0
  7. package/dist/{fs-traced-OS6B1cZZ.mjs → fs-traced-D12ehU8a.mjs} +2 -2
  8. package/dist/{git-handle-RLYVdszV.mjs → git-handle-CllEzrX4.mjs} +2 -2
  9. package/dist/git-handle-DJPLRe3o.mjs +1 -0
  10. package/dist/index.d.mts +1 -0
  11. package/dist/index.mjs +1 -1
  12. package/dist/{init-C55e2NNl.mjs → init-DL_j9FNQ.mjs} +3 -3
  13. package/dist/init-I4_eavst.mjs +1 -0
  14. package/dist/{launch-json-removal-D3Q9yvyd.mjs → launch-json-removal-B-K7szy8.mjs} +2 -2
  15. package/dist/{loader-BsX_JrrA.mjs → loader-Ro5TBLoF.mjs} +2 -2
  16. package/dist/loader-_DlE802w.mjs +1 -0
  17. package/dist/md-manager-DqRVEVmJ.mjs +2 -0
  18. package/dist/{open-browser-4sOlBbCM.mjs → open-browser-DiR8zaBV.mjs} +2 -2
  19. package/dist/parse-worker.mjs +1 -1
  20. package/dist/preview-CwNUTst2.mjs +1 -0
  21. package/dist/{preview-BAWt2Pnh.mjs → preview-CyVtre2s.mjs} +2 -2
  22. package/dist/public/assets/{ActivityModeContent-DnjDjPFp.js → ActivityModeContent-2l8BA531.js} +1 -1
  23. package/dist/public/assets/{AgentDiffPane-Th6j3NhO.js → AgentDiffPane-wqdF9lpR.js} +1 -1
  24. package/dist/public/assets/{AgentThreadClientBinder-BVm5Ldhz.js → AgentThreadClientBinder-56IhVeqo.js} +1 -1
  25. package/dist/public/assets/{ChangedOutsideBadge-DVfCTGd2.js → ChangedOutsideBadge-eT1ODdAD.js} +1 -1
  26. package/dist/public/assets/{CodeMirrorPropInput-DmM8F7PJ.js → CodeMirrorPropInput-L7fbBlLy.js} +1 -1
  27. package/dist/public/assets/{DocumentContext-B0g_vd8N.js → DocumentContext-DD95gIt4.js} +1 -1
  28. package/dist/public/assets/{EditorModeToggle-DKuXrb9b.js → EditorModeToggle-CR5jA0YM.js} +1 -1
  29. package/dist/public/assets/{EnableSyncConfirmDialog-BQttSYlY.js → EnableSyncConfirmDialog-C5fNw26t.js} +1 -1
  30. package/dist/public/assets/FeedbackForm-macxQS8x.js +1 -0
  31. package/dist/public/assets/{GraphPanel-DK2w8FEz.js → GraphPanel-BDGxPSvY.js} +1 -1
  32. package/dist/public/assets/{ImportSkillDialog-DHfVuiKL.js → ImportSkillDialog-B2ilfqxe.js} +1 -1
  33. package/dist/public/assets/{LintConfigEditor-B-7Pe22_.js → LintConfigEditor-ByUOzhaw.js} +1 -1
  34. package/dist/public/assets/{ManagedArtifactProperties-B-Y5eayN.js → ManagedArtifactProperties-CVGjtd3P.js} +2 -2
  35. package/dist/public/assets/ManagedArtifactProperties-m1GRSrIt.js +1 -0
  36. package/dist/public/assets/{McpConsentDialogBody-DPMIdjmd.js → McpConsentDialogBody-B3ubISnW.js} +1 -1
  37. package/dist/public/assets/{MermaidDocEditor-CBHNf1No.js → MermaidDocEditor-CftVeU4U.js} +1 -1
  38. package/dist/public/assets/{ReportBugDialogBody-CXLxw7Fr.js → ReportBugDialogBody-CWbkwdNL.js} +1 -1
  39. package/dist/public/assets/{SchemaConfigEditor-DG-dOTBT.js → SchemaConfigEditor-UkvF3UAn.js} +1 -1
  40. package/dist/public/assets/{SessionsHost-DjbdveAp.js → SessionsHost-Pa6hY3sI.js} +2 -2
  41. package/dist/public/assets/{SettingsDialogBody-CFwua7VK.js → SettingsDialogBody-Be8P3Vqa.js} +1 -1
  42. package/dist/public/assets/{ShareBranchSwitchDialog-CyWPLWZG.js → ShareBranchSwitchDialog-BmGWQCY6.js} +1 -1
  43. package/dist/public/assets/{ShareReceiveDialog-C-fxd4DJ.js → ShareReceiveDialog-BoqZXYhT.js} +1 -1
  44. package/dist/public/assets/{ShareReceiveMissDialog-Y4PyuUCZ.js → ShareReceiveMissDialog-B_DT1dz2.js} +1 -1
  45. package/dist/public/assets/{SkillEditBanner-Dbu0PwqP.js → SkillEditBanner-hcLaEQ2F.js} +1 -1
  46. package/dist/public/assets/{SkillOriginInline-DuFc7cZs.js → SkillOriginInline-CtSdZ4_j.js} +1 -1
  47. package/dist/public/assets/{SkillToolbarControls-B4k3LXLX.js → SkillToolbarControls-DQYbvJTe.js} +1 -1
  48. package/dist/public/assets/{SourceEditor-BCMM4zJn.js → SourceEditor-DX9L1Mci.js} +1 -1
  49. package/dist/public/assets/{TerminalPanel-DkXL03UX.js → TerminalPanel-WTiFd3Z6.js} +1 -1
  50. package/dist/public/assets/{TerminalWindowApp-DH34WwKL.js → TerminalWindowApp-CnhrK_tv.js} +1 -1
  51. package/dist/public/assets/{TextDocEditor-DEdxUQxb.js → TextDocEditor-BGlQEeBq.js} +1 -1
  52. package/dist/public/assets/{ThreadView-ktubIY9d.js → ThreadView-CExveDEV.js} +1 -1
  53. package/dist/public/assets/{TimelineDiffPane-DSvFVt40.js → TimelineDiffPane-DDFvXSlv.js} +1 -1
  54. package/dist/public/assets/{agent-diff-store-BX4UT3y1.js → agent-diff-store-jazihC28.js} +1 -1
  55. package/dist/public/assets/{agent-visibility-CYBYXsoR.js → agent-visibility-Ch0XQMkJ.js} +1 -1
  56. package/dist/public/assets/{auth-state-cache-ZZgXmLCf.js → auth-state-cache-D47fide1.js} +2 -2
  57. package/dist/public/assets/{client-version-DN8Gnc8R.js → client-version-CHRlMl4l.js} +1 -1
  58. package/dist/public/assets/{config-context-CdjtvoAz.js → config-context-B2fceTMP.js} +1 -1
  59. package/dist/public/assets/{config-provider-CKct7q_G.js → config-provider-Cb43FIW2.js} +1 -1
  60. package/dist/public/assets/{dist-DIn3VYDc2.js → dist-5ovMzVKN2.js} +1 -1
  61. package/dist/public/assets/{doc-paths-KCjzuC60.js → doc-paths-BFNbv2er.js} +1 -1
  62. package/dist/public/assets/{documents-events-FrlFXuC-.js → documents-events-BM8xyAJz.js} +1 -1
  63. package/dist/public/assets/{file-tree-adapter-BBMHbQG5.js → file-tree-adapter-C1zJK1Gk.js} +1 -1
  64. package/dist/public/assets/{file-tree-utils-DeyBapi2.js → file-tree-utils-Dma5c4k_.js} +1 -1
  65. package/dist/public/assets/{folder-config-api-OU19qNKs.js → folder-config-api-BxuLFuqM.js} +1 -1
  66. package/dist/public/assets/{globals-D4ycChQP.js → globals-DliH2YSL.js} +1 -1
  67. package/dist/public/assets/{index-Bnezs-Zg.js → index-DlH6tzhG.js} +108 -108
  68. package/dist/public/assets/{lint-config-client-D7DpNIwn.js → lint-config-client-DDxBMTZk.js} +1 -1
  69. package/dist/public/assets/{markdownlint-rule-browser-eFxHHf9q.js → markdownlint-rule-browser-c2Uv_5Ry.js} +1 -1
  70. package/dist/public/assets/{navigation-targets-BDSeZX3c.js → navigation-targets-D9VW9WdW.js} +1 -1
  71. package/dist/public/assets/{open-managed-artifact-tab-Wkw7QMir.js → open-managed-artifact-tab-CLwVAGCD.js} +1 -1
  72. package/dist/public/assets/{pending-receive-nav-store-BN0afFCO.js → pending-receive-nav-store-BmcjNZOu.js} +1 -1
  73. package/dist/public/assets/{prop-types-MABP6X1c.js → prop-types-BPmLSxhG.js} +1 -1
  74. package/dist/public/assets/{receive-store-CTNYU3q-.js → receive-store-BlAqmJZT.js} +1 -1
  75. package/dist/public/assets/{selection-context-BgucOSM-.js → selection-context-DJvv-kK_.js} +1 -1
  76. package/dist/public/assets/{skill-actions-By3ZQhYp.js → skill-actions-CfQkZqK6.js} +1 -1
  77. package/dist/public/assets/{skill-scope-DkGQeaIH.js → skill-scope-DwJ84s_r.js} +1 -1
  78. package/dist/public/assets/{skills-api-BCiYKVSk.js → skills-api-BTy9LAk0.js} +1 -1
  79. package/dist/public/assets/{src-C_O1F_4l.js → src-hNXjwMT1.js} +1 -1
  80. package/dist/public/assets/{tag-pill-input-3Bkld5bN.js → tag-pill-input-DVdwNfBT.js} +1 -1
  81. package/dist/public/assets/{target-navigation-intent-BZ8rve8n.js → target-navigation-intent-C6AhTsfc.js} +1 -1
  82. package/dist/public/assets/{terminal-launch-events-DbpTBIvl.js → terminal-launch-events-B1DGOVIv.js} +1 -1
  83. package/dist/public/assets/{terminal-telemetry-BMiT9GUh.js → terminal-telemetry-CviFLmIq.js} +1 -1
  84. package/dist/public/assets/{typing-burst-detector-DDN6b6N7.js → typing-burst-detector-B4AQIJp7.js} +1 -1
  85. package/dist/public/assets/{uninstall-DJBDkbwq.js → uninstall-CfW-qETg.js} +1 -1
  86. package/dist/public/assets/{use-activity-panel-CInEut0L.js → use-activity-panel-D8pDT3xu.js} +1 -1
  87. package/dist/public/assets/{use-collab-url-ecWCytiv.js → use-collab-url-CUHlgRv5.js} +1 -1
  88. package/dist/public/assets/{use-live-xterm-theme-Bf72FxVk.js → use-live-xterm-theme-CLCjRdjJ.js} +1 -1
  89. package/dist/public/assets/{use-open-skill-C3UqDa0B.js → use-open-skill-akwbVkG4.js} +1 -1
  90. package/dist/public/assets/{use-settings-route-CYvmk4XT.js → use-settings-route-BnOIfxuB.js} +1 -1
  91. package/dist/public/assets/{use-skill-directory-Ce1Wy5Qf.js → use-skill-directory-CSx9txvQ.js} +1 -1
  92. package/dist/public/assets/{use-skill-origin-DscI7Fo0.js → use-skill-origin-DvSOmIz_.js} +1 -1
  93. package/dist/public/assets/{use-skills-B19yYlmR.js → use-skills-DcLUuUJ9.js} +1 -1
  94. package/dist/public/assets/{use-terminal-enabled-D556BQSW.js → use-terminal-enabled-CgG0yd-l.js} +1 -1
  95. package/dist/public/assets/{use-timeline-entry-diff-C_2VFthE.js → use-timeline-entry-diff-DD-1OHsM.js} +1 -1
  96. package/dist/public/assets/{use-workspace-008C-zhL.js → use-workspace-J5QvjwOx.js} +1 -1
  97. package/dist/public/index.html +42 -42
  98. package/dist/public/uninstall.html +3 -3
  99. package/dist/{repair-launch-json-BLWZjHxK.mjs → repair-launch-json-DlAJs_pz.mjs} +2 -2
  100. package/dist/{repair-mcp-configs-CTYAl0ua.mjs → repair-mcp-configs-Bg-qmFa_.mjs} +2 -2
  101. package/dist/{repair-skills-BikzcmQr.mjs → repair-skills-CYkvjSVb.mjs} +2 -2
  102. package/dist/repair-skills-R8jaRgSC.mjs +1 -0
  103. package/dist/schemas/v0/config.user.schema.json +10 -1
  104. package/dist/{server-lock-DgWnoftI.mjs → server-lock-CmYdHyX7.mjs} +2 -2
  105. package/dist/server-lock-D61z37T2.mjs +1 -0
  106. package/dist/{sleep-C5OfWWWx.mjs → sleep-jUpHbV7f.mjs} +2 -2
  107. package/dist/{src-Cgpp8Pf-.mjs → src--MxQA4BK.mjs} +2 -2
  108. package/dist/{src-CWDcUomk.mjs → src-2gMaOH-l.mjs} +311 -311
  109. package/dist/{src-CGOjzQCL.mjs → src-B7qPUQHJ.mjs} +1 -1
  110. package/dist/{src-pJ6LEXKc.mjs → src-CHSJwcpc.mjs} +2 -2
  111. package/dist/start-BFzPdz8R.mjs +1 -0
  112. package/dist/{start-TnxpB5de.mjs → start-CszIxyyk.mjs} +3 -3
  113. package/dist/{write-project-skill-B8LGhuHT.mjs → write-project-skill-jk9SeWrA.mjs} +2 -2
  114. package/package.json +5 -5
  115. package/dist/constants-CUaf8eE_.mjs +0 -2
  116. package/dist/fs-traced-CbQ-GS7x.mjs +0 -1
  117. package/dist/git-handle-D0uAjBAd.mjs +0 -1
  118. package/dist/init-D8a-XbzA.mjs +0 -1
  119. package/dist/loader-O6z6lVhP.mjs +0 -1
  120. package/dist/md-manager-CrYbAiKl.mjs +0 -2
  121. package/dist/preview-Bq9cv2G5.mjs +0 -1
  122. package/dist/public/assets/FeedbackForm-FbNH_TYS.js +0 -1
  123. package/dist/public/assets/ManagedArtifactProperties-Ddk1e_f6.js +0 -1
  124. package/dist/repair-skills-CCM2p_7S.mjs +0 -1
  125. package/dist/server-lock-CiN5OJ-t.mjs +0 -1
  126. package/dist/start-tOC8nkMr.mjs +0 -1
@@ -1,4 +1,4 @@
1
- import{a as e,i as t,n,o as r,r as i,t as a}from"./chunk-DTipWd-i.mjs";import{Y as o,_ as s,c,f as l,g as u,h as d,i as f,m as p,n as ee,o as m,p as te,s as ne,t as re,v as ie,w as ae,y as oe}from"./sleep-C5OfWWWx.mjs";import{a as h,c as se,i as ce,n as g,o as _,r as v,s as le,t as y}from"./esm-DxvI2ZVA.mjs";import{C as ue,_ as b,c as de,g as fe,h as pe,m as me,o as he,r as x,v as S,w as ge,y as C}from"./logger-5LePyO3n.mjs";import{basename as w,dirname as T,isAbsolute as _e,join as ve,resolve as ye,sep as E}from"node:path";import{appendFileSync as be,closeSync as xe,cpSync as Se,existsSync as Ce,linkSync as we,mkdirSync as Te,openSync as Ee,readFileSync as De,readdirSync as Oe,renameSync as ke,rmSync as Ae,rmdirSync as je,statSync as Me,symlinkSync as Ne,unlinkSync as D,writeFileSync as Pe}from"node:fs";import{homedir as Fe}from"node:os";import{appendFile as Ie,mkdir as Le,readdir as Re,rename as ze,rm as Be,stat as Ve,unlink as He,writeFile as Ue}from"node:fs/promises";import*as We from"zlib";import{Readable as Ge}from"stream";g();var O=o();function Ke(e,t,n,r){return e.success?{code:`UNKNOWN`,message:`unexpected success in error path`}:{code:`SCHEMA_INVALID`,issues:e.error.issues.map(e=>{let i=e.path.map(e=>typeof e==`symbol`?String(e):e),a=c({file:r,source:n,doc:t,path:i});return{path:i,message:e.message,issueCode:e.code,...a===void 0?{}:{source:a}}})}}function qe(e,t,n){let r=`${e}.invalid-${t.replace(/[:.]/g,`-`)}`;try{return ke(e,r),r}catch(t){n(`[config] Could not sideline invalid config file ${e} → ${r}: ${t instanceof Error?t.message:String(t)}. File left in place; using schema defaults.`);return}}function Je(e){let{absPath:t,sideline:n=!0,timestamp:r=new Date().toISOString()}=e,i=e.warn??(e=>console.warn(e)),a=oe.parse({});if(!Ce(t))return{valid:!0,value:a,source:void 0,diagnostics:[]};let o;try{o=De(t,`utf-8`)}catch(e){let n=e instanceof Error?e.message:String(e);i(`[config] Could not read ${t}: ${n}. Using schema defaults.`);let r={code:`UNREADABLE`,detail:n};return{valid:!1,value:a,error:r,diagnostics:[{...r}]}}let s=(0,O.parseDocument)(o);if(s.errors.length>0){let e=s.errors.map(e=>e.message).join(`; `);i(`[config] ${t} contains invalid YAML (${e}). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let o=n?qe(t,r,i):void 0,c={code:`YAML_PARSE`,detail:e};return{valid:!1,value:a,error:c,diagnostics:[{...c}],...o===void 0?{}:{sidelinedTo:o}}}let c=s.toJSON()??{},u=m({value:c,file:t,source:o,doc:s}),d=u.length>0?ne(c):c,f=oe.safeParse(d);if(!f.success){let e=Ke(f,s,o,t);i(`[config] ${t} fails schema validation (${f.error.issues.length} issue(s)). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let c=n?qe(t,r,i):void 0;return{valid:!1,value:a,error:e,diagnostics:[...u,...l(e)&&e.code===`SCHEMA_INVALID`?[{...e}]:[]],...c===void 0?{}:{sidelinedTo:c}}}return{valid:!0,value:f.data,source:t,diagnostics:u}}const Ye=3e4,Xe={writeFile:(e,t,n)=>Ue(e,t,n),rename:(e,t)=>ze(e,t)};async function Ze(e){try{let t=T(e),n=`${w(e)}.tmp.`,r=Date.now()-Ye,i=await Re(t);await Promise.all(i.map(async e=>{if(!e.startsWith(n))return;let i=ve(t,e);try{(await Ve(i)).mtimeMs<r&&await He(i)}catch{}}))}catch{}}function Qe(e){try{let t=T(e),n=`${w(e)}.tmp.`,r=Date.now()-Ye;for(let e of Oe(t)){if(!e.startsWith(n))continue;let i=ve(t,e);try{Me(i).mtimeMs<r&&D(i)}catch{}}}catch{}}async function $e(e,t,n={}){await Ze(e);let r=n.fs??Xe,i=`${e}.tmp.${crypto.randomUUID()}`;try{await r.writeFile(i,t,{encoding:`utf-8`,mode:n.mode??420}),await r.rename(i,e)}catch(e){try{D(i)}catch{}throw e}}function et(e,t,n={}){Qe(e);let r=`${e}.tmp.${crypto.randomUUID()}`;try{Pe(r,t,{encoding:`utf-8`,mode:n.mode??420}),ke(r,e)}catch(e){try{D(r)}catch{}throw e}}var k=class extends Error{code=`LOCK_TIMEOUT`;lockPath;timeoutMs;constructor(e,t){super(`Could not acquire file lock at ${e} within ${t}ms`),this.name=`FileLockTimeoutError`,this.lockPath=e,this.timeoutMs=t}};async function tt(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r;for(;;){let s;try{s=Ee(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=Me(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{D(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new k(e,r);await re(i);continue}try{return await t()}finally{try{xe(s)}catch{}try{D(e)}catch{}}}}function nt(e){let t=Date.now()+e;for(;Date.now()<t;);}function rt(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r;for(;;){let s;try{s=Ee(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=Me(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{D(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new k(e,r);nt(i);continue}try{return t()}finally{try{xe(s)}catch{}try{D(e)}catch{}}}}const it=`config.yml`;function at(e){return`https://unpkg.com/@inkeep/open-knowledge@latest/dist/schemas/${f}/${e===`user`?`config.user.schema.json`:e===`project-local`?`config.project-local.schema.json`:`config.project.schema.json`}`}function ot(e){return`# yaml-language-server: $schema=${at(e)}\n`}function st(e,t,n){if(e===`user`)return ye(n??Fe(),`.ok`,`global.yml`);let r=_e(t)?t:ye(t);return e===`project-local`?ye(r,`.ok`,ee,it):ye(r,`.ok`,it)}function A(e){return{ok:!1,error:e}}function ct(e){return{ok:!0,...e}}async function lt(e){return s(`config.patch`,{"config.scope":e.scope,"config.transport":`fs`},async t=>{let n=await ut(e);return t.setAttribute(`config.outcome`,n.ok?`success`:`rejected`),n.ok||t.setAttribute(`config.error.code`,n.error.code),n})}async function ut(e){let{cwd:t,scope:n,patch:r,homedirOverride:i}=e,a=st(n,t,i),o=d(r,n);if(o!==null)return A(o);try{await Le(T(a),{recursive:!0})}catch(e){return A({code:`WRITE_ERROR`,detail:`Could not create parent directory for ${a}: ${e instanceof Error?e.message:String(e)}`})}try{return await tt(`${a}.lock`,()=>dt(e,a))}catch(e){if(e instanceof k)return A({code:`WRITE_ERROR`,detail:e.message});throw e}}async function dt(e,t){let{patch:n,scope:r,firstWriteHeader:i}=e,a=``,o=!1;if(Ce(t)){o=!0;try{a=De(t,`utf-8`)}catch(e){return A({code:`WRITE_ERROR`,detail:`Could not read existing config: ${e instanceof Error?e.message:String(e)}`})}}let s=(0,O.parseDocument)(a);if(s.errors.length>0)return A({code:`YAML_PARSE`,detail:s.errors.map(e=>e.message).join(`; `)});if(s.contents===null)s.contents=s.createNode({});else if(!(0,O.isMap)(s.contents))return A({code:`YAML_PARSE`,detail:`Top-level YAML value must be a mapping (object), got ${(0,O.isSeq)(s.contents)?`sequence`:`scalar`}`});let c=te(s,n),l=s.toJSON(),d=ie(`config.validate`,{"config.scope":r,"config.validation.layer":`L2`},e=>{let t=oe.safeParse(l);if(e.setAttribute(`config.outcome`,t.success?`success`:`rejected`),!t.success)for(let e of t.error.issues)u(`config.validation.issue`,{"issue.path":e.path.map(e=>String(e)).join(`.`),"issue.message":e.message});return t});if(!d.success)return A({code:`SCHEMA_INVALID`,issues:d.error.issues.map(p)});let f=s.toString();if(!o){let e=i===void 0?ot(r):i??``;e.length>0&&(f=`${e.endsWith(`
1
+ import{a as e,i as t,n,o as r,r as i,t as a}from"./chunk-DTipWd-i.mjs";import{Y as o,_ as s,c,f as l,g as u,h as d,i as f,m as p,n as ee,o as m,p as te,s as ne,t as re,v as ie,w as ae,y as oe}from"./sleep-jUpHbV7f.mjs";import{a as h,c as se,i as ce,n as g,o as _,r as v,s as le,t as y}from"./esm-DxvI2ZVA.mjs";import{C as ue,_ as b,c as de,g as fe,h as pe,m as me,o as he,r as x,v as S,w as ge,y as C}from"./logger-5LePyO3n.mjs";import{basename as w,dirname as T,isAbsolute as _e,join as ve,resolve as ye,sep as E}from"node:path";import{appendFileSync as be,closeSync as xe,cpSync as Se,existsSync as Ce,linkSync as we,mkdirSync as Te,openSync as Ee,readFileSync as De,readdirSync as Oe,renameSync as ke,rmSync as Ae,rmdirSync as je,statSync as Me,symlinkSync as Ne,unlinkSync as D,writeFileSync as Pe}from"node:fs";import{homedir as Fe}from"node:os";import{appendFile as Ie,mkdir as Le,readdir as Re,rename as ze,rm as Be,stat as Ve,unlink as He,writeFile as Ue}from"node:fs/promises";import*as We from"zlib";import{Readable as Ge}from"stream";g();var O=o();function Ke(e,t,n,r){return e.success?{code:`UNKNOWN`,message:`unexpected success in error path`}:{code:`SCHEMA_INVALID`,issues:e.error.issues.map(e=>{let i=e.path.map(e=>typeof e==`symbol`?String(e):e),a=c({file:r,source:n,doc:t,path:i});return{path:i,message:e.message,issueCode:e.code,...a===void 0?{}:{source:a}}})}}function qe(e,t,n){let r=`${e}.invalid-${t.replace(/[:.]/g,`-`)}`;try{return ke(e,r),r}catch(t){n(`[config] Could not sideline invalid config file ${e} → ${r}: ${t instanceof Error?t.message:String(t)}. File left in place; using schema defaults.`);return}}function Je(e){let{absPath:t,sideline:n=!0,timestamp:r=new Date().toISOString()}=e,i=e.warn??(e=>console.warn(e)),a=oe.parse({});if(!Ce(t))return{valid:!0,value:a,source:void 0,diagnostics:[]};let o;try{o=De(t,`utf-8`)}catch(e){let n=e instanceof Error?e.message:String(e);i(`[config] Could not read ${t}: ${n}. Using schema defaults.`);let r={code:`UNREADABLE`,detail:n};return{valid:!1,value:a,error:r,diagnostics:[{...r}]}}let s=(0,O.parseDocument)(o);if(s.errors.length>0){let e=s.errors.map(e=>e.message).join(`; `);i(`[config] ${t} contains invalid YAML (${e}). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let o=n?qe(t,r,i):void 0,c={code:`YAML_PARSE`,detail:e};return{valid:!1,value:a,error:c,diagnostics:[{...c}],...o===void 0?{}:{sidelinedTo:o}}}let c=s.toJSON()??{},u=m({value:c,file:t,source:o,doc:s}),d=u.length>0?ne(c):c,f=oe.safeParse(d);if(!f.success){let e=Ke(f,s,o,t);i(`[config] ${t} fails schema validation (${f.error.issues.length} issue(s)). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let c=n?qe(t,r,i):void 0;return{valid:!1,value:a,error:e,diagnostics:[...u,...l(e)&&e.code===`SCHEMA_INVALID`?[{...e}]:[]],...c===void 0?{}:{sidelinedTo:c}}}return{valid:!0,value:f.data,source:t,diagnostics:u}}const Ye=3e4,Xe={writeFile:(e,t,n)=>Ue(e,t,n),rename:(e,t)=>ze(e,t)};async function Ze(e){try{let t=T(e),n=`${w(e)}.tmp.`,r=Date.now()-Ye,i=await Re(t);await Promise.all(i.map(async e=>{if(!e.startsWith(n))return;let i=ve(t,e);try{(await Ve(i)).mtimeMs<r&&await He(i)}catch{}}))}catch{}}function Qe(e){try{let t=T(e),n=`${w(e)}.tmp.`,r=Date.now()-Ye;for(let e of Oe(t)){if(!e.startsWith(n))continue;let i=ve(t,e);try{Me(i).mtimeMs<r&&D(i)}catch{}}}catch{}}async function $e(e,t,n={}){await Ze(e);let r=n.fs??Xe,i=`${e}.tmp.${crypto.randomUUID()}`;try{await r.writeFile(i,t,{encoding:`utf-8`,mode:n.mode??420}),await r.rename(i,e)}catch(e){try{D(i)}catch{}throw e}}function et(e,t,n={}){Qe(e);let r=`${e}.tmp.${crypto.randomUUID()}`;try{Pe(r,t,{encoding:`utf-8`,mode:n.mode??420}),ke(r,e)}catch(e){try{D(r)}catch{}throw e}}var k=class extends Error{code=`LOCK_TIMEOUT`;lockPath;timeoutMs;constructor(e,t){super(`Could not acquire file lock at ${e} within ${t}ms`),this.name=`FileLockTimeoutError`,this.lockPath=e,this.timeoutMs=t}};async function tt(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r;for(;;){let s;try{s=Ee(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=Me(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{D(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new k(e,r);await re(i);continue}try{return await t()}finally{try{xe(s)}catch{}try{D(e)}catch{}}}}function nt(e){let t=Date.now()+e;for(;Date.now()<t;);}function rt(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r;for(;;){let s;try{s=Ee(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=Me(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{D(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new k(e,r);nt(i);continue}try{return t()}finally{try{xe(s)}catch{}try{D(e)}catch{}}}}const it=`config.yml`;function at(e){return`https://unpkg.com/@inkeep/open-knowledge@latest/dist/schemas/${f}/${e===`user`?`config.user.schema.json`:e===`project-local`?`config.project-local.schema.json`:`config.project.schema.json`}`}function ot(e){return`# yaml-language-server: $schema=${at(e)}\n`}function st(e,t,n){if(e===`user`)return ye(n??Fe(),`.ok`,`global.yml`);let r=_e(t)?t:ye(t);return e===`project-local`?ye(r,`.ok`,ee,it):ye(r,`.ok`,it)}function A(e){return{ok:!1,error:e}}function ct(e){return{ok:!0,...e}}async function lt(e){return s(`config.patch`,{"config.scope":e.scope,"config.transport":`fs`},async t=>{let n=await ut(e);return t.setAttribute(`config.outcome`,n.ok?`success`:`rejected`),n.ok||t.setAttribute(`config.error.code`,n.error.code),n})}async function ut(e){let{cwd:t,scope:n,patch:r,homedirOverride:i}=e,a=st(n,t,i),o=d(r,n);if(o!==null)return A(o);try{await Le(T(a),{recursive:!0})}catch(e){return A({code:`WRITE_ERROR`,detail:`Could not create parent directory for ${a}: ${e instanceof Error?e.message:String(e)}`})}try{return await tt(`${a}.lock`,()=>dt(e,a))}catch(e){if(e instanceof k)return A({code:`WRITE_ERROR`,detail:e.message});throw e}}async function dt(e,t){let{patch:n,scope:r,firstWriteHeader:i}=e,a=``,o=!1;if(Ce(t)){o=!0;try{a=De(t,`utf-8`)}catch(e){return A({code:`WRITE_ERROR`,detail:`Could not read existing config: ${e instanceof Error?e.message:String(e)}`})}}let s=(0,O.parseDocument)(a);if(s.errors.length>0)return A({code:`YAML_PARSE`,detail:s.errors.map(e=>e.message).join(`; `)});if(s.contents===null)s.contents=s.createNode({});else if(!(0,O.isMap)(s.contents))return A({code:`YAML_PARSE`,detail:`Top-level YAML value must be a mapping (object), got ${(0,O.isSeq)(s.contents)?`sequence`:`scalar`}`});let c=te(s,n),l=s.toJSON(),d=ie(`config.validate`,{"config.scope":r,"config.validation.layer":`L2`},e=>{let t=oe.safeParse(l);if(e.setAttribute(`config.outcome`,t.success?`success`:`rejected`),!t.success)for(let e of t.error.issues)u(`config.validation.issue`,{"issue.path":e.path.map(e=>String(e)).join(`.`),"issue.message":e.message});return t});if(!d.success)return A({code:`SCHEMA_INVALID`,issues:d.error.issues.map(p)});let f=s.toString();if(!o){let e=i===void 0?ot(r):i??``;e.length>0&&(f=`${e.endsWith(`
2
2
  `)?e:`${e}\n`}${f}`)}try{await Le(T(t),{recursive:!0})}catch(e){return A({code:`WRITE_ERROR`,detail:`Could not create parent directory for ${t}: ${e instanceof Error?e.message:String(e)}`})}try{await $e(t,f)}catch(e){return A({code:`WRITE_ERROR`,detail:`Could not write ${t}: ${e instanceof Error?e.message:String(e)}`})}return ct({effective:d.data,appliedPaths:c,path:t,created:!o})}const ft=[`user`,`project`,`project-local`];function pt(e){let t=[];for(let n of ft){let r=st(n,e.cwd,e.homedirOverride),i=Je({absPath:r,sideline:!1,...e.warn?{warn:e.warn}:{}});for(let e of i.diagnostics)t.push(mt(e,n,r))}return{diagnostics:t}}function mt(e,t,n){switch(e.code){case`REMOVED_KEY`:return{code:`REMOVED_KEY`,scope:t,file:n,path:e.path,redirect:e.redirect};case`YAML_PARSE`:return{code:`YAML_PARSE`,scope:t,file:n};case`SCHEMA_INVALID`:return{code:`SCHEMA_INVALID`,scope:t,file:n};case`UNREADABLE`:return{code:`UNREADABLE`,scope:t,file:n}}}var ht=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AbstractAsyncHooksContextManager=void 0;let n=t(`events`),r=[`addListener`,`on`,`once`,`prependListener`,`prependOnceListener`];e.AbstractAsyncHooksContextManager=class{bind(e,t){return t instanceof n.EventEmitter?this._bindEventEmitter(e,t):typeof t==`function`?this._bindFunction(e,t):t}_bindFunction(e,t){let n=this,r=function(...r){return n.with(e,()=>t.apply(this,r))};return Object.defineProperty(r,`length`,{enumerable:!1,configurable:!0,writable:!1,value:t.length}),r}_bindEventEmitter(e,t){return this._getPatchMap(t)===void 0?(this._createPatchMap(t),r.forEach(n=>{t[n]!==void 0&&(t[n]=this._patchAddListener(t,t[n],e))}),typeof t.removeListener==`function`&&(t.removeListener=this._patchRemoveListener(t,t.removeListener)),typeof t.off==`function`&&(t.off=this._patchRemoveListener(t,t.off)),typeof t.removeAllListeners==`function`&&(t.removeAllListeners=this._patchRemoveAllListeners(t,t.removeAllListeners)),t):t}_patchRemoveListener(e,t){let n=this;return function(r,i){let a=n._getPatchMap(e)?.[r];if(a===void 0)return t.call(this,r,i);let o=a.get(i);return t.call(this,r,o||i)}}_patchRemoveAllListeners(e,t){let n=this;return function(r){let i=n._getPatchMap(e);return i!==void 0&&(arguments.length===0?n._createPatchMap(e):i[r]!==void 0&&delete i[r]),t.apply(this,arguments)}}_patchAddListener(e,t,n){let r=this;return function(i,a){if(r._wrapped)return t.call(this,i,a);let o=r._getPatchMap(e);o===void 0&&(o=r._createPatchMap(e));let s=o[i];s===void 0&&(s=new WeakMap,o[i]=s);let c=r.bind(n,a);s.set(a,c),r._wrapped=!0;try{return t.call(this,i,c)}finally{r._wrapped=!1}}}_createPatchMap(e){let t=Object.create(null);return e[this._kOtListeners]=t,t}_getPatchMap(e){return e[this._kOtListeners]}_kOtListeners=Symbol(`OtListeners`);_wrapped=!1}})),gt=a((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AsyncHooksContextManager=void 0;let r=(g(),e(y)),i=t(`async_hooks`),a=ht();n.AsyncHooksContextManager=class extends a.AbstractAsyncHooksContextManager{_asyncHook;_contexts=new Map;_stack=[];constructor(){super(),this._asyncHook=i.createHook({init:this._init.bind(this),before:this._before.bind(this),after:this._after.bind(this),destroy:this._destroy.bind(this),promiseResolve:this._destroy.bind(this)})}active(){return this._stack[this._stack.length-1]??r.ROOT_CONTEXT}with(e,t,n,...r){this._enterContext(e);try{return t.call(n,...r)}finally{this._exitContext()}}enable(){return this._asyncHook.enable(),this}disable(){return this._asyncHook.disable(),this._contexts.clear(),this._stack=[],this}_init(e,t){if(t===`TIMERWRAP`)return;let n=this._stack[this._stack.length-1];n!==void 0&&this._contexts.set(e,n)}_destroy(e){this._contexts.delete(e)}_before(e){let t=this._contexts.get(e);t!==void 0&&this._enterContext(t)}_after(){this._exitContext()}_enterContext(e){this._stack.push(e)}_exitContext(){this._stack.pop()}}})),_t=a((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AsyncLocalStorageContextManager=void 0;let r=(g(),e(y)),i=t(`async_hooks`),a=ht();n.AsyncLocalStorageContextManager=class extends a.AbstractAsyncHooksContextManager{_asyncLocalStorage;constructor(){super(),this._asyncLocalStorage=new i.AsyncLocalStorage}active(){return this._asyncLocalStorage.getStore()??r.ROOT_CONTEXT}with(e,t,n,...r){let i=n==null?t:t.bind(n);return this._asyncLocalStorage.run(e,i,...r)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}}})),vt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AsyncLocalStorageContextManager=e.AsyncHooksContextManager=void 0;var t=gt();Object.defineProperty(e,`AsyncHooksContextManager`,{enumerable:!0,get:function(){return t.AsyncHooksContextManager}});var n=_t();Object.defineProperty(e,`AsyncLocalStorageContextManager`,{enumerable:!0,get:function(){return n.AsyncLocalStorageContextManager}})})),yt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AggregationTemporalityPreference=void 0,(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`,e[e.LOWMEMORY=2]=`LOWMEMORY`})(e.AggregationTemporalityPreference||={})})),bt,xt=n((()=>{bt=class{_delegate;constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}})),j,St=n((()=>{j=class extends Error{code;name=`OTLPExporterError`;data;constructor(e,t,n){super(e),this.data=n,this.code=t}}}));function Ct(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function wt(e){if(e!=null)return()=>e}function Tt(e,t,n){return{timeoutMillis:Ct(e.timeoutMillis??t.timeoutMillis??n.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??n.concurrencyLimit,compression:e.compression??t.compression??n.compression}}function Et(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}var M=n((()=>{})),Dt,Ot=n((()=>{(function(e){e.NONE=`none`,e.GZIP=`gzip`})(Dt||={})}));function kt(e){return new At(e.concurrencyLimit)}var At,jt=n((()=>{At=class{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}}));function Mt(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function Nt(){return{handleResponse(e){e==null||!Mt(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||_.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}var Pt=n((()=>{}));function Ft(e,t){return new It(e.transport,e.serializer,Nt(),e.promiseHandler,t.timeout)}var N,It,Lt=n((()=>{N=fe(),St(),Pt(),g(),It=class{_transport;_serializer;_responseHandler;_promiseQueue;_timeout;_diagLogger;constructor(e,t,n,r,i){this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=_.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:N.ExportResultCode.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:N.ExportResultCode.FAILED,error:Error(`Nothing to send`)});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(e.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(e.data))}catch(t){this._diagLogger.warn(`Export succeeded but could not deserialize response - is the response specification compliant?`,t,e.data)}t({code:N.ExportResultCode.SUCCESS});return}else if(e.status===`failure`&&e.error){t({code:N.ExportResultCode.FAILED,error:e.error});return}else e.status===`retryable`?t({code:N.ExportResultCode.FAILED,error:new j(`Export failed with retryable status`)}):t({code:N.ExportResultCode.FAILED,error:new j(`Export failed with unknown error`)})},e=>t({code:N.ExportResultCode.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug(`shutdown started`),await this.forceFlush(),this._transport.shutdown()}}}));function Rt(e,t,n){return Ft({transport:n,serializer:t,promiseHandler:kt(e)},{timeout:e.timeoutMillis})}var zt=n((()=>{jt(),Lt()})),Bt=i({CompressionAlgorithm:()=>Dt,OTLPExporterBase:()=>bt,OTLPExporterError:()=>j,createOtlpNetworkExportDelegate:()=>Rt,getSharedConfigurationDefaults:()=>Et,mergeOtlpSharedConfigurationWithDefaults:()=>Tt}),Vt=n((()=>{xt(),St(),M(),Ot(),zt()})),Ht=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.OTLPMetricExporterBase=t.LowMemoryTemporalitySelector=t.DeltaTemporalitySelector=t.CumulativeTemporalitySelector=void 0;let n=fe(),r=pe(),i=yt(),a=(Vt(),e(Bt)),o=(g(),e(y));t.CumulativeTemporalitySelector=()=>r.AggregationTemporality.CUMULATIVE,t.DeltaTemporalitySelector=e=>{switch(e){case r.InstrumentType.COUNTER:case r.InstrumentType.OBSERVABLE_COUNTER:case r.InstrumentType.GAUGE:case r.InstrumentType.HISTOGRAM:case r.InstrumentType.OBSERVABLE_GAUGE:return r.AggregationTemporality.DELTA;case r.InstrumentType.UP_DOWN_COUNTER:case r.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:return r.AggregationTemporality.CUMULATIVE}},t.LowMemoryTemporalitySelector=e=>{switch(e){case r.InstrumentType.COUNTER:case r.InstrumentType.HISTOGRAM:return r.AggregationTemporality.DELTA;case r.InstrumentType.GAUGE:case r.InstrumentType.UP_DOWN_COUNTER:case r.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:case r.InstrumentType.OBSERVABLE_COUNTER:case r.InstrumentType.OBSERVABLE_GAUGE:return r.AggregationTemporality.CUMULATIVE}};function s(){let e=((0,n.getStringFromEnv)(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE`)??`cumulative`).toLowerCase();return e===`cumulative`?t.CumulativeTemporalitySelector:e===`delta`?t.DeltaTemporalitySelector:e===`lowmemory`?t.LowMemoryTemporalitySelector:(o.diag.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${e}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`),t.CumulativeTemporalitySelector)}function c(e){return e==null?s():e===i.AggregationTemporalityPreference.DELTA?t.DeltaTemporalitySelector:e===i.AggregationTemporalityPreference.LOWMEMORY?t.LowMemoryTemporalitySelector:t.CumulativeTemporalitySelector}let l=Object.freeze({type:r.AggregationType.DEFAULT});function u(e){return e?.aggregationPreference??(()=>l)}t.OTLPMetricExporterBase=class extends a.OTLPExporterBase{_aggregationTemporalitySelector;_aggregationSelector;constructor(e,t){super(e),this._aggregationSelector=u(t),this._aggregationTemporalitySelector=c(t?.temporalityPreference)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}}})),Ut=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.VERSION=void 0,e.VERSION=`0.204.0`}));function Wt(e){return()=>{let t={};return Object.entries(e?.()??{}).forEach(([e,n])=>{n===void 0?_.warn(`Header "${e}" has invalid value (${n}) and will be ignored`):t[e]=String(n)}),t}}var Gt=n((()=>{g()}));function Kt(e,t,n){let r={...n()},i={};return()=>(t!=null&&Object.assign(i,t()),e!=null&&Object.assign(i,e()),Object.assign(i,r))}function qt(e){if(e!=null)try{let t=globalThis.location?.href;return new URL(e,t).href}catch{throw Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function Jt(e){return async t=>{let{Agent:n}=await(t===`http:`?import(`http`):import(`https`));return new n(e)}}function Yt(e,t,n){return{...Tt(e,t,n),headers:Kt(Wt(e.headers),t.headers,n.headers),url:qt(e.url)??t.url??n.url,agentFactory:e.agentFactory??t.agentFactory??n.agentFactory}}function Xt(e,t){return{...Et(),headers:()=>e,url:`http://localhost:4318/`+t,agentFactory:Jt({keepAlive:!0})}}var Zt=n((()=>{M(),Gt()}));function Qt(e){return[429,502,503,504].includes(e)}function $t(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let n=new Date(e).getTime()-Date.now();return n>=0?n:0}var en=n((()=>{}));function tn(e,t,n,r,i,a){let o=new URL(t.url),s=e({hostname:o.hostname,port:o.port,path:o.pathname,method:`POST`,headers:{...t.headers()},agent:n},e=>{let t=[];e.on(`data`,e=>t.push(e)),e.on(`end`,()=>{e.statusCode&&e.statusCode<299?i({status:`success`,data:Buffer.concat(t)}):e.statusCode&&Qt(e.statusCode)?i({status:`retryable`,retryInMillis:$t(e.headers[`retry-after`])}):i({status:`failure`,error:new j(e.statusMessage,e.statusCode,Buffer.concat(t).toString())})})});s.setTimeout(a,()=>{s.destroy(),i({status:`failure`,error:Error(`Request Timeout`)})}),s.on(`error`,e=>{i({status:`failure`,error:e})}),nn(s,t.compression,r,e=>{i({status:`failure`,error:e})})}function nn(e,t,n,r){let i=rn(n);t===`gzip`&&(e.setHeader(`Content-Encoding`,`gzip`),i=i.on(`error`,r).pipe(We.createGzip()).on(`error`,r)),i.pipe(e).on(`error`,r)}function rn(e){let t=new Ge;return t.push(e),t.push(null),t}var an=n((()=>{en(),St()}));async function on(e){let{request:t}=await(e===`http:`?import(`http`):import(`https`));return t}function sn(e){return new cn(e)}var cn,ln=n((()=>{an(),cn=class{_parameters;_utils=null;constructor(e){this._parameters=e}async send(e,t){let{agent:n,request:r}=await this._loadUtils();return new Promise(i=>{tn(r,this._parameters,n,e,e=>{i(e)},t)})}shutdown(){}async _loadUtils(){let e=this._utils;if(e===null){let t=new URL(this._parameters.url).protocol,[n,r]=await Promise.all([this._parameters.agentFactory(t),on(t)]);e=this._utils={agent:n,request:r}}return e}}}));function un(){return 2*gn*Math.random()-gn}function dn(e){return new _n(e.transport)}var fn,pn,mn,hn,gn,_n,vn=n((()=>{fn=5,pn=1e3,mn=5e3,hn=1.5,gn=.2,_n=class{_transport;constructor(e){this._transport=e}retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}async send(e,t){let n=Date.now()+t,r=await this._transport.send(e,t),i=fn,a=pn;for(;r.status===`retryable`&&i>0;){i--;let t=Math.max(Math.min(a,mn)+un(),0);a*=hn;let o=r.retryInMillis??t,s=n-Date.now();if(o>s)return r;r=await this.retry(e,s,o)}return r}shutdown(){return this._transport.shutdown()}}}));function yn(e,t){return Ft({transport:dn({transport:sn(e)}),serializer:t,promiseHandler:kt(e)},{timeout:e.timeoutMillis})}var bn=n((()=>{Lt(),ln(),jt(),vn()}));function xn(e){let t=process.env[e]?.trim();if(t!=null&&t!==``){let n=Number(t);if(Number.isFinite(n)&&n>0)return n;_.warn(`Configuration: ${e} is invalid, expected number greater than 0 (actual: ${t})`)}}function Sn(e){let t=xn(`OTEL_EXPORTER_OTLP_${e}_TIMEOUT`),n=xn(`OTEL_EXPORTER_OTLP_TIMEOUT`);return t??n}function Cn(e){let t=process.env[e]?.trim();if(t!==``){if(t==null||t===`none`||t===`gzip`)return t;_.warn(`Configuration: ${e} is invalid, expected 'none' or 'gzip' (actual: '${t}')`)}}function wn(e){let t=Cn(`OTEL_EXPORTER_OTLP_${e}_COMPRESSION`),n=Cn(`OTEL_EXPORTER_OTLP_COMPRESSION`);return t??n}function Tn(e){return{timeoutMillis:Sn(e),compression:wn(e)}}var En=n((()=>{g()}));function Dn(e){let t=(0,P.getStringFromEnv)(`OTEL_EXPORTER_OTLP_${e}_HEADERS`),n=(0,P.getStringFromEnv)(`OTEL_EXPORTER_OTLP_HEADERS`),r=(0,P.parseKeyPairsIntoRecord)(t),i=(0,P.parseKeyPairsIntoRecord)(n);if(!(Object.keys(r).length===0&&Object.keys(i).length===0))return Object.assign({},(0,P.parseKeyPairsIntoRecord)(n),(0,P.parseKeyPairsIntoRecord)(t))}function On(e){try{return new URL(e).toString()}catch{_.warn(`Configuration: Could not parse environment-provided export URL: '${e}', falling back to undefined`);return}}function kn(e,t){try{new URL(e)}catch{_.warn(`Configuration: Could not parse environment-provided export URL: '${e}', falling back to undefined`);return}e.endsWith(`/`)||(e+=`/`),e+=t;try{new URL(e)}catch{_.warn(`Configuration: Provided URL appended with '${t}' is not a valid URL, using 'undefined' instead of '${e}'`);return}return e}function An(e){let t=(0,P.getStringFromEnv)(`OTEL_EXPORTER_OTLP_ENDPOINT`);if(t!==void 0)return kn(t,e)}function jn(e){let t=(0,P.getStringFromEnv)(`OTEL_EXPORTER_OTLP_${e}_ENDPOINT`);if(t!==void 0)return On(t)}function Mn(e,t){return{...Tn(e),url:jn(e)??An(t),headers:wt(Dn(e))}}var P,Nn=n((()=>{P=fe(),g(),En(),M()}));function Pn(e){if(typeof e.httpAgentOptions==`function`)return e.httpAgentOptions;let t=e.httpAgentOptions;if(e.keepAlive!=null&&(t={keepAlive:e.keepAlive,...t}),t!=null)return Jt(t)}function Fn(e,t,n,r){return e.metadata&&_.warn(`Metadata cannot be set when using http`),Yt({url:e.url,headers:wt(e.headers),concurrencyLimit:e.concurrencyLimit,timeoutMillis:e.timeoutMillis,compression:e.compression,agentFactory:Pn(e)},Mn(t,n),Xt(r,n))}var In=n((()=>{Zt(),Nn(),g(),M()})),Ln=i({convertLegacyHttpOptions:()=>Fn,createOtlpHttpExportDelegate:()=>yn,getSharedConfigurationFromEnvironment:()=>Tn,httpAgentFactoryFromOptions:()=>Jt}),Rn=n((()=>{Zt(),bn(),En(),In()})),zn=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.OTLPMetricExporter=void 0;let n=Ht(),r=me(),i=Ut(),a=(Rn(),e(Ln)),o={"User-Agent":`OTel-OTLP-Exporter-JavaScript/${i.VERSION}`};t.OTLPMetricExporter=class extends n.OTLPMetricExporterBase{constructor(e){super((0,a.createOtlpHttpExportDelegate)((0,a.convertLegacyHttpOptions)(e??{},`METRICS`,`v1/metrics`,{...o,"Content-Type":`application/json`}),r.JsonMetricsSerializer),e)}}})),Bn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.OTLPMetricExporter=void 0;var t=zn();Object.defineProperty(e,`OTLPMetricExporter`,{enumerable:!0,get:function(){return t.OTLPMetricExporter}})})),Vn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.OTLPMetricExporter=void 0;var t=Bn();Object.defineProperty(e,`OTLPMetricExporter`,{enumerable:!0,get:function(){return t.OTLPMetricExporter}})})),Hn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.OTLPMetricExporterBase=e.LowMemoryTemporalitySelector=e.DeltaTemporalitySelector=e.CumulativeTemporalitySelector=e.AggregationTemporalityPreference=e.OTLPMetricExporter=void 0;var t=Vn();Object.defineProperty(e,`OTLPMetricExporter`,{enumerable:!0,get:function(){return t.OTLPMetricExporter}});var n=yt();Object.defineProperty(e,`AggregationTemporalityPreference`,{enumerable:!0,get:function(){return n.AggregationTemporalityPreference}});var r=Ht();Object.defineProperty(e,`CumulativeTemporalitySelector`,{enumerable:!0,get:function(){return r.CumulativeTemporalitySelector}}),Object.defineProperty(e,`DeltaTemporalitySelector`,{enumerable:!0,get:function(){return r.DeltaTemporalitySelector}}),Object.defineProperty(e,`LowMemoryTemporalitySelector`,{enumerable:!0,get:function(){return r.LowMemoryTemporalitySelector}}),Object.defineProperty(e,`OTLPMetricExporterBase`,{enumerable:!0,get:function(){return r.OTLPMetricExporterBase}})})),Un=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.VERSION=void 0,e.VERSION=`0.204.0`})),Wn=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.OTLPTraceExporter=void 0;let n=(Vt(),e(Bt)),r=Un(),i=me(),a=(Rn(),e(Ln));t.OTLPTraceExporter=class extends n.OTLPExporterBase{constructor(e={}){super((0,a.createOtlpHttpExportDelegate)((0,a.convertLegacyHttpOptions)(e,`TRACES`,`v1/traces`,{"User-Agent":`OTel-OTLP-Exporter-JavaScript/${r.VERSION}`,"Content-Type":`application/json`}),i.JsonTraceSerializer))}}})),Gn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.OTLPTraceExporter=void 0;var t=Wn();Object.defineProperty(e,`OTLPTraceExporter`,{enumerable:!0,get:function(){return t.OTLPTraceExporter}})})),Kn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.OTLPTraceExporter=void 0;var t=Gn();Object.defineProperty(e,`OTLPTraceExporter`,{enumerable:!0,get:function(){return t.OTLPTraceExporter}})})),qn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.OTLPTraceExporter=void 0;var t=Kn();Object.defineProperty(e,`OTLPTraceExporter`,{enumerable:!0,get:function(){return t.OTLPTraceExporter}})})),Jn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e._clearDefaultServiceNameCache=e.defaultServiceName=void 0;let t;function n(){if(t===void 0)try{let e=globalThis.process.argv0;t=e?`unknown_service:${e}`:`unknown_service`}catch{t=`unknown_service`}return t}e.defaultServiceName=n;function r(){t=void 0}e._clearDefaultServiceNameCache=r})),Yn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isPromiseLike=void 0,e.isPromiseLike=e=>typeof e==`object`&&!!e&&typeof e.then==`function`})),Xn=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.defaultResource=t.emptyResource=t.resourceFromDetectedResource=t.resourceFromAttributes=void 0;let n=(g(),e(y)),r=b(),i=(C(),e(S)),a=Jn(),o=Yn();var s=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=f(t),r._asyncAttributesPending=t.filter(([e,t])=>(0,o.isPromiseLike)(t)).length>0,r}constructor(e,t){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>((0,o.isPromiseLike)(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=f(this._rawAttributes),this._schemaUrl=p(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,(0,o.isPromiseLike)(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&n.diag.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,r]of this._rawAttributes){if((0,o.isPromiseLike)(r)){n.diag.debug(`Unsettled resource attribute ${t} skipped`);continue}r!=null&&(e[t]??=r)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=ee(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function c(e,t){return s.FromAttributeList(Object.entries(e),t)}t.resourceFromAttributes=c;function l(e,t){return new s(e,t)}t.resourceFromDetectedResource=l;function u(){return c({})}t.emptyResource=u;function d(){return c({[i.ATTR_SERVICE_NAME]:(0,a.defaultServiceName)(),[i.ATTR_TELEMETRY_SDK_LANGUAGE]:r.SDK_INFO[i.ATTR_TELEMETRY_SDK_LANGUAGE],[i.ATTR_TELEMETRY_SDK_NAME]:r.SDK_INFO[i.ATTR_TELEMETRY_SDK_NAME],[i.ATTR_TELEMETRY_SDK_VERSION]:r.SDK_INFO[i.ATTR_TELEMETRY_SDK_VERSION]})}t.defaultResource=d;function f(e){return e.map(([e,t])=>(0,o.isPromiseLike)(t)?[e,t.catch(t=>{n.diag.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function p(e){if(typeof e==`string`||e===void 0)return e;n.diag.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function ee(e,t){let r=e?.schemaUrl,i=t?.schemaUrl,a=r===void 0||r===``,o=i===void 0||i===``;if(a)return i;if(o||r===i)return r;n.diag.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,r,i)}})),Zn=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.detectResources=void 0;let n=(g(),e(y)),r=Xn();t.detectResources=(e={})=>(e.detectors||[]).map(t=>{try{let i=(0,r.resourceFromDetectedResource)(t.detect(e));return n.diag.debug(`${t.constructor.name} found resource.`,i),i}catch(e){return n.diag.debug(`${t.constructor.name} failed: ${e.message}`),(0,r.emptyResource)()}}).reduce((e,t)=>e.merge(t),(0,r.emptyResource)())})),Qn=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.envDetector=void 0;let n=(g(),e(y)),r=(C(),e(S)),i=b();t.envDetector=new class{_MAX_LENGTH=255;_COMMA_SEPARATOR=`,`;_LABEL_KEY_VALUE_SPLITTER=`=`;detect(e){let t={},a=(0,i.getStringFromEnv)(`OTEL_RESOURCE_ATTRIBUTES`),o=(0,i.getStringFromEnv)(`OTEL_SERVICE_NAME`);if(a)try{let e=this._parseResourceAttributes(a);Object.assign(t,e)}catch(e){n.diag.debug(`EnvDetector failed: ${e instanceof Error?e.message:e}`)}return o&&(t[r.ATTR_SERVICE_NAME]=o),{attributes:t}}_parseResourceAttributes(e){if(!e)return{};let t={},n=e.split(this._COMMA_SEPARATOR).filter(e=>e.trim()!==``);for(let e of n){let n=e.split(this._LABEL_KEY_VALUE_SPLITTER);if(n.length!==2)throw Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${e}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[r,i]=n,a=r.trim(),o=i.trim();if(a.length===0)throw Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${e}".`);let s,c;try{s=decodeURIComponent(a),c=decodeURIComponent(o)}catch(t){throw Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${e}": ${t instanceof Error?t.message:t}`,{cause:t})}if(s.length>this._MAX_LENGTH)throw Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${s}".`);if(c.length>this._MAX_LENGTH)throw Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${s}".`);t[s]=c}return t}}})),F=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ATTR_WEBENGINE_VERSION=e.ATTR_WEBENGINE_NAME=e.ATTR_WEBENGINE_DESCRIPTION=e.ATTR_SERVICE_NAMESPACE=e.ATTR_SERVICE_INSTANCE_ID=e.ATTR_PROCESS_RUNTIME_VERSION=e.ATTR_PROCESS_RUNTIME_NAME=e.ATTR_PROCESS_RUNTIME_DESCRIPTION=e.ATTR_PROCESS_PID=e.ATTR_PROCESS_OWNER=e.ATTR_PROCESS_EXECUTABLE_PATH=e.ATTR_PROCESS_EXECUTABLE_NAME=e.ATTR_PROCESS_COMMAND_ARGS=e.ATTR_PROCESS_COMMAND=e.ATTR_OS_VERSION=e.ATTR_OS_TYPE=e.ATTR_K8S_POD_NAME=e.ATTR_K8S_NAMESPACE_NAME=e.ATTR_K8S_DEPLOYMENT_NAME=e.ATTR_K8S_CLUSTER_NAME=e.ATTR_HOST_TYPE=e.ATTR_HOST_NAME=e.ATTR_HOST_IMAGE_VERSION=e.ATTR_HOST_IMAGE_NAME=e.ATTR_HOST_IMAGE_ID=e.ATTR_HOST_ID=e.ATTR_HOST_ARCH=e.ATTR_CONTAINER_NAME=e.ATTR_CONTAINER_IMAGE_TAGS=e.ATTR_CONTAINER_IMAGE_NAME=e.ATTR_CONTAINER_ID=e.ATTR_CLOUD_REGION=e.ATTR_CLOUD_PROVIDER=e.ATTR_CLOUD_AVAILABILITY_ZONE=e.ATTR_CLOUD_ACCOUNT_ID=void 0,e.ATTR_CLOUD_ACCOUNT_ID=`cloud.account.id`,e.ATTR_CLOUD_AVAILABILITY_ZONE=`cloud.availability_zone`,e.ATTR_CLOUD_PROVIDER=`cloud.provider`,e.ATTR_CLOUD_REGION=`cloud.region`,e.ATTR_CONTAINER_ID=`container.id`,e.ATTR_CONTAINER_IMAGE_NAME=`container.image.name`,e.ATTR_CONTAINER_IMAGE_TAGS=`container.image.tags`,e.ATTR_CONTAINER_NAME=`container.name`,e.ATTR_HOST_ARCH=`host.arch`,e.ATTR_HOST_ID=`host.id`,e.ATTR_HOST_IMAGE_ID=`host.image.id`,e.ATTR_HOST_IMAGE_NAME=`host.image.name`,e.ATTR_HOST_IMAGE_VERSION=`host.image.version`,e.ATTR_HOST_NAME=`host.name`,e.ATTR_HOST_TYPE=`host.type`,e.ATTR_K8S_CLUSTER_NAME=`k8s.cluster.name`,e.ATTR_K8S_DEPLOYMENT_NAME=`k8s.deployment.name`,e.ATTR_K8S_NAMESPACE_NAME=`k8s.namespace.name`,e.ATTR_K8S_POD_NAME=`k8s.pod.name`,e.ATTR_OS_TYPE=`os.type`,e.ATTR_OS_VERSION=`os.version`,e.ATTR_PROCESS_COMMAND=`process.command`,e.ATTR_PROCESS_COMMAND_ARGS=`process.command_args`,e.ATTR_PROCESS_EXECUTABLE_NAME=`process.executable.name`,e.ATTR_PROCESS_EXECUTABLE_PATH=`process.executable.path`,e.ATTR_PROCESS_OWNER=`process.owner`,e.ATTR_PROCESS_PID=`process.pid`,e.ATTR_PROCESS_RUNTIME_DESCRIPTION=`process.runtime.description`,e.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`,e.ATTR_PROCESS_RUNTIME_VERSION=`process.runtime.version`,e.ATTR_SERVICE_INSTANCE_ID=`service.instance.id`,e.ATTR_SERVICE_NAMESPACE=`service.namespace`,e.ATTR_WEBENGINE_DESCRIPTION=`webengine.description`,e.ATTR_WEBENGINE_NAME=`webengine.name`,e.ATTR_WEBENGINE_VERSION=`webengine.version`})),$n=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getMachineId=void 0;let n=t(`process`),i;async function a(){if(!i)switch(n.platform){case`darwin`:i=(await import(`./getMachineId-darwin-CCtDS2VI.mjs`).then(e=>r(e.default))).getMachineId;break;case`linux`:i=(await import(`./getMachineId-linux-DMjXicei.mjs`).then(e=>r(e.default))).getMachineId;break;case`freebsd`:i=(await import(`./getMachineId-bsd-Ba_eiHKT.mjs`).then(e=>r(e.default))).getMachineId;break;case`win32`:i=(await import(`./getMachineId-win-mbAJtBuz.mjs`).then(e=>r(e.default))).getMachineId;break;default:i=(await import(`./getMachineId-unsupported-x9lk4Rw9.mjs`).then(e=>r(e.default))).getMachineId;break}return i()}e.getMachineId=a})),er=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.normalizeType=e.normalizeArch=void 0,e.normalizeArch=e=>{switch(e){case`arm`:return`arm32`;case`ppc`:return`ppc32`;case`x64`:return`amd64`;default:return e}},e.normalizeType=e=>{switch(e){case`sunos`:return`solaris`;case`win32`:return`windows`;default:return e}}})),tr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hostDetector=void 0;let n=F(),r=t(`os`),i=$n(),a=er();e.hostDetector=new class{detect(e){return{attributes:{[n.ATTR_HOST_NAME]:(0,r.hostname)(),[n.ATTR_HOST_ARCH]:(0,a.normalizeArch)((0,r.arch)()),[n.ATTR_HOST_ID]:(0,i.getMachineId)()}}}}})),nr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.osDetector=void 0;let n=F(),r=t(`os`),i=er();e.osDetector=new class{detect(e){return{attributes:{[n.ATTR_OS_TYPE]:(0,i.normalizeType)((0,r.platform)()),[n.ATTR_OS_VERSION]:(0,r.release)()}}}}})),rr=a((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.processDetector=void 0;let r=(g(),e(y)),i=F(),a=t(`os`);n.processDetector=new class{detect(e){let t={[i.ATTR_PROCESS_PID]:process.pid,[i.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[i.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[i.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[i.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[i.ATTR_PROCESS_RUNTIME_NAME]:`nodejs`,[i.ATTR_PROCESS_RUNTIME_DESCRIPTION]:`Node.js`};process.argv.length>1&&(t[i.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let e=a.userInfo();t[i.ATTR_PROCESS_OWNER]=e.username}catch(e){r.diag.debug(`error obtaining process owner: ${e}`)}return{attributes:t}}}})),ir=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.serviceInstanceIdDetector=void 0;let n=F(),r=t(`crypto`);e.serviceInstanceIdDetector=new class{detect(e){return{attributes:{[n.ATTR_SERVICE_INSTANCE_ID]:(0,r.randomUUID)()}}}}})),ar=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.serviceInstanceIdDetector=e.processDetector=e.osDetector=e.hostDetector=void 0;var t=tr();Object.defineProperty(e,`hostDetector`,{enumerable:!0,get:function(){return t.hostDetector}});var n=nr();Object.defineProperty(e,`osDetector`,{enumerable:!0,get:function(){return n.osDetector}});var r=rr();Object.defineProperty(e,`processDetector`,{enumerable:!0,get:function(){return r.processDetector}});var i=ir();Object.defineProperty(e,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return i.serviceInstanceIdDetector}})})),or=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.serviceInstanceIdDetector=e.processDetector=e.osDetector=e.hostDetector=void 0;var t=ar();Object.defineProperty(e,`hostDetector`,{enumerable:!0,get:function(){return t.hostDetector}}),Object.defineProperty(e,`osDetector`,{enumerable:!0,get:function(){return t.osDetector}}),Object.defineProperty(e,`processDetector`,{enumerable:!0,get:function(){return t.processDetector}}),Object.defineProperty(e,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return t.serviceInstanceIdDetector}})})),sr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.noopDetector=e.NoopDetector=void 0;var t=class{detect(){return{attributes:{}}}};e.NoopDetector=t,e.noopDetector=new t})),cr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.noopDetector=e.serviceInstanceIdDetector=e.processDetector=e.osDetector=e.hostDetector=e.envDetector=void 0;var t=Qn();Object.defineProperty(e,`envDetector`,{enumerable:!0,get:function(){return t.envDetector}});var n=or();Object.defineProperty(e,`hostDetector`,{enumerable:!0,get:function(){return n.hostDetector}}),Object.defineProperty(e,`osDetector`,{enumerable:!0,get:function(){return n.osDetector}}),Object.defineProperty(e,`processDetector`,{enumerable:!0,get:function(){return n.processDetector}}),Object.defineProperty(e,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return n.serviceInstanceIdDetector}});var r=sr();Object.defineProperty(e,`noopDetector`,{enumerable:!0,get:function(){return r.noopDetector}})})),lr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.defaultServiceName=e.emptyResource=e.defaultResource=e.resourceFromAttributes=e.serviceInstanceIdDetector=e.processDetector=e.osDetector=e.hostDetector=e.envDetector=e.detectResources=void 0;var t=Zn();Object.defineProperty(e,`detectResources`,{enumerable:!0,get:function(){return t.detectResources}});var n=cr();Object.defineProperty(e,`envDetector`,{enumerable:!0,get:function(){return n.envDetector}}),Object.defineProperty(e,`hostDetector`,{enumerable:!0,get:function(){return n.hostDetector}}),Object.defineProperty(e,`osDetector`,{enumerable:!0,get:function(){return n.osDetector}}),Object.defineProperty(e,`processDetector`,{enumerable:!0,get:function(){return n.processDetector}}),Object.defineProperty(e,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return n.serviceInstanceIdDetector}});var r=Xn();Object.defineProperty(e,`resourceFromAttributes`,{enumerable:!0,get:function(){return r.resourceFromAttributes}}),Object.defineProperty(e,`defaultResource`,{enumerable:!0,get:function(){return r.defaultResource}}),Object.defineProperty(e,`emptyResource`,{enumerable:!0,get:function(){return r.emptyResource}});var i=Jn();Object.defineProperty(e,`defaultServiceName`,{enumerable:!0,get:function(){return i.defaultServiceName}})})),ur=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AggregationTemporality=void 0,(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(e.AggregationTemporality||={})})),I=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DataPointType=e.InstrumentType=void 0,(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(e.InstrumentType||={}),(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(e.DataPointType||={})})),L=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.equalsCaseInsensitive=e.binarySearchUB=e.setEquals=e.callWithTimeout=e.TimeoutError=e.instrumentationScopeId=e.hashAttributes=void 0;function t(e){let t=Object.keys(e);return t.length===0?``:(t=t.sort(),JSON.stringify(t.map(t=>[t,e[t]])))}e.hashAttributes=t;function n(e){return`${e.name}:${e.version??``}:${e.schemaUrl??``}`}e.instrumentationScopeId=n;var r=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};e.TimeoutError=r;function i(e,t){let n,i=new Promise(function(e,i){n=setTimeout(function(){i(new r(`Operation timed out.`))},t)});return Promise.race([e,i]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}e.callWithTimeout=i;function a(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}e.setEquals=a;function o(e,t){let n=0,r=e.length-1,i=e.length;for(;r>=n;){let a=n+Math.trunc((r-n)/2);e[a]<t?n=a+1:(i=a,r=a-1)}return i}e.binarySearchUB=o;function s(e,t){return e.toLowerCase()===t.toLowerCase()}e.equalsCaseInsensitive=s})),R=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AggregatorKind=void 0,(function(e){e[e.DROP=0]=`DROP`,e[e.SUM=1]=`SUM`,e[e.LAST_VALUE=2]=`LAST_VALUE`,e[e.HISTOGRAM=3]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=4]=`EXPONENTIAL_HISTOGRAM`})(e.AggregatorKind||={})})),dr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DropAggregator=void 0;let t=R();e.DropAggregator=class{kind=t.AggregatorKind.DROP;createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,n,r){}}})),fr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.HistogramAggregator=e.HistogramAccumulation=void 0;let t=R(),n=I(),r=L();function i(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var a=class{startTime;_boundaries;_recordMinMax;_current;constructor(e,t,n=!0,r=i(t)){this.startTime=e,this._boundaries=t,this._recordMinMax=n,this._current=r}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=(0,r.binarySearchUB)(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}};e.HistogramAccumulation=a,e.HistogramAggregator=class{kind=t.AggregatorKind.HISTOGRAM;_boundaries;_recordMinMax;constructor(e,t){this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new a(e,this._boundaries,this._recordMinMax)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,o=r.buckets.counts,s=Array(i.length);for(let e=0;e<i.length;e++)s[e]=i[e]+o[e];let c=1/0,l=-1/0;return this._recordMinMax&&(n.hasMinMax&&r.hasMinMax?(c=Math.min(n.min,r.min),l=Math.max(n.max,r.max)):n.hasMinMax?(c=n.min,l=n.max):r.hasMinMax&&(c=r.min,l=r.max)),new a(e.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:s},count:n.count+r.count,sum:n.sum+r.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||r.hasMinMax),min:c,max:l})}diff(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,o=r.buckets.counts,s=Array(i.length);for(let e=0;e<i.length;e++)s[e]=o[e]-i[e];return new a(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:s},count:r.count-n.count,sum:r.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,r,i){return{descriptor:e,aggregationTemporality:t,dataPointType:n.DataPointType.HISTOGRAM,dataPoints:r.map(([t,r])=>{let a=r.toPointValue(),o=e.type===n.InstrumentType.GAUGE||e.type===n.InstrumentType.UP_DOWN_COUNTER||e.type===n.InstrumentType.OBSERVABLE_GAUGE||e.type===n.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:r.startTime,endTime:i,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:o?void 0:a.sum,buckets:a.buckets,count:a.count}}})}}}})),pr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Buckets=void 0,e.Buckets=class e{backing;indexBase;indexStart;indexEnd;constructor(e=new t,n=0,r=0,i=0){this.backing=e,this.indexBase=n,this.indexStart=r,this.indexEnd=i}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(this.at(e)!==0){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(this.at(e)!==0){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,n=1<<e,r=0,i=0;for(let e=this.indexStart;e<=this.indexEnd;){let a=e%n;a<0&&(a+=n);for(let o=a;o<n&&r<t;o++)this._relocateBucket(i,r),r++,e++;i++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;e!==0&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}};var t=class e{_counts;constructor(e=[0]){this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,n){let r=Array(e).fill(0);r.splice(n,this._counts.length-t,...this._counts.slice(t)),r.splice(0,t,...this._counts.slice(0,t)),this._counts=r}reverse(e,t){let n=Math.floor((e+t)/2)-e;for(let r=0;r<n;r++){let n=this._counts[e+r];this._counts[e+r]=this._counts[t-r-1],this._counts[t-r-1]=n}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new e([...this._counts])}}})),mr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getSignificand=e.getNormalBase2=e.MIN_VALUE=e.MAX_NORMAL_EXPONENT=e.MIN_NORMAL_EXPONENT=e.SIGNIFICAND_WIDTH=void 0,e.SIGNIFICAND_WIDTH=52;let t=1023;e.MIN_NORMAL_EXPONENT=-t+1,e.MAX_NORMAL_EXPONENT=t,e.MIN_VALUE=2**-1022;function n(e){let n=new DataView(new ArrayBuffer(8));return n.setFloat64(0,e),((n.getUint32(0)&2146435072)>>20)-t}e.getNormalBase2=n;function r(e){let t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);let n=t.getUint32(0),r=t.getUint32(4);return(n&1048575)*2**32+r}e.getSignificand=r})),hr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.nextGreaterSquare=e.ldexp=void 0;function t(e,t){return e===0||e===1/0||e===-1/0||Number.isNaN(e)?e:e*2**t}e.ldexp=t;function n(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}e.nextGreaterSquare=n})),gr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MappingError=void 0,e.MappingError=class extends Error{}})),_r=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ExponentMapping=void 0;let t=mr(),n=hr(),r=gr();e.ExponentMapping=class{_shift;constructor(e){this._shift=-e}mapToIndex(e){return e<t.MIN_VALUE?this._minNormalLowerBoundaryIndex():t.getNormalBase2(e)+this._rightShift(t.getSignificand(e)-1,t.SIGNIFICAND_WIDTH)>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new r.MappingError(`underflow: ${e} is < minimum lower boundary: ${t}`);let i=this._maxNormalLowerBoundaryIndex();if(e>i)throw new r.MappingError(`overflow: ${e} is > maximum lower boundary: ${i}`);return n.ldexp(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=t.MIN_NORMAL_EXPONENT>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return t.MAX_NORMAL_EXPONENT>>this._shift}_rightShift(e,t){return Math.floor(e*2**-t)}}})),vr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LogarithmMapping=void 0;let t=mr(),n=hr(),r=gr();e.LogarithmMapping=class{_scale;_scaleFactor;_inverseFactor;constructor(e){this._scale=e,this._scaleFactor=n.ldexp(Math.LOG2E,e),this._inverseFactor=n.ldexp(Math.LN2,-e)}mapToIndex(e){if(e<=t.MIN_VALUE)return this._minNormalLowerBoundaryIndex()-1;if(t.getSignificand(e)===0)return(t.getNormalBase2(e)<<this._scale)-1;let n=Math.floor(Math.log(e)*this._scaleFactor),r=this._maxNormalLowerBoundaryIndex();return n>=r?r:n}lowerBoundary(e){let n=this._maxNormalLowerBoundaryIndex();if(e>=n){if(e===n)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new r.MappingError(`overflow: ${e} is > maximum lower boundary: ${n}`)}let i=this._minNormalLowerBoundaryIndex();if(e<=i){if(e===i)return t.MIN_VALUE;if(e===i-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new r.MappingError(`overflow: ${e} is < minimum lower boundary: ${i}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return t.MIN_NORMAL_EXPONENT<<this._scale}_maxNormalLowerBoundaryIndex(){return(t.MAX_NORMAL_EXPONENT+1<<this._scale)-1}}})),yr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getMapping=void 0;let t=_r(),n=vr(),r=gr(),i=Array.from({length:31},(e,r)=>r>10?new n.LogarithmMapping(r-10):new t.ExponentMapping(r-10));function a(e){if(e>20||e<-10)throw new r.MappingError(`expected scale >= -10 && <= 20, got: ${e}`);return i[e+10]}e.getMapping=a})),br=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ExponentialHistogramAggregator=t.ExponentialHistogramAccumulation=void 0;let n=R(),r=I(),i=(g(),e(y)),a=pr(),o=yr(),s=hr();var c=class e{static combine(t,n){return new e(Math.min(t.low,n.low),Math.max(t.high,n.high))}low;high;constructor(e,t){this.low=e,this.high=t}},l=class e{startTime;_maxSize;_recordMinMax;_sum;_count;_zeroCount;_min;_max;_positive;_negative;_mapping;constructor(e,t=160,n=!0,r=0,s=0,c=0,l=1/0,u=-1/0,d=new a.Buckets,f=new a.Buckets,p=(0,o.getMapping)(20)){this.startTime=e,this._maxSize=t,this._recordMinMax=n,this._sum=r,this._count=s,this._zeroCount=c,this._min=l,this._max=u,this._positive=d,this._negative=f,this._mapping=p,this._maxSize<2&&(i.diag.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
3
3
  changing to the minimum size of: 2`),this._maxSize=2)}record(e){this.updateByIncrement(e,1)}setStartTime(e){this.startTime=e}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(e,t){if(!Number.isNaN(e)){if(e>this._max&&(this._max=e),e<this._min&&(this._min=e),this._count+=t,e===0){this._zeroCount+=t;return}this._sum+=e*t,e>0?this._updateBuckets(this._positive,e,t):this._updateBuckets(this._negative,-e,t)}}merge(e){this._count===0?(this._min=e.min,this._max=e.max):e.count!==0&&(e.min<this.min&&(this._min=e.min),e.max>this.max&&(this._max=e.max)),this.startTime=e.startTime,this._sum+=e.sum,this._count+=e.count,this._zeroCount+=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._mergeBuckets(this.positive,e,e.positive,t),this._mergeBuckets(this.negative,e,e.negative,t)}diff(e){this._min=1/0,this._max=-1/0,this._sum-=e.sum,this._count-=e.count,this._zeroCount-=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._diffBuckets(this.positive,e,e.positive,t),this._diffBuckets(this.negative,e,e.negative,t)}clone(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(e,t,n){let r=this._mapping.mapToIndex(t),i=!1,a=0,o=0;if(e.length===0?(e.indexStart=r,e.indexEnd=e.indexStart,e.indexBase=e.indexStart):r<e.indexStart&&e.indexEnd-r>=this._maxSize?(i=!0,o=r,a=e.indexEnd):r>e.indexEnd&&r-e.indexStart>=this._maxSize&&(i=!0,o=e.indexStart,a=r),i){let e=this._changeScale(a,o);this._downscale(e),r=this._mapping.mapToIndex(t)}this._incrementIndexBy(e,r,n)}_incrementIndexBy(e,t,n){if(n===0)return;if(e.length===0&&(e.indexStart=e.indexEnd=e.indexBase=t),t<e.indexStart){let n=e.indexEnd-t;n>=e.backing.length&&this._grow(e,n+1),e.indexStart=t}else if(t>e.indexEnd){let n=t-e.indexStart;n>=e.backing.length&&this._grow(e,n+1),e.indexEnd=t}let r=t-e.indexBase;r<0&&(r+=e.backing.length),e.incrementBucket(r,n)}_grow(e,t){let n=e.backing.length,r=e.indexBase-e.indexStart,i=n-r,a=(0,s.nextGreaterSquare)(t);a>this._maxSize&&(a=this._maxSize);let o=a-r;e.backing.growTo(a,i,o)}_changeScale(e,t){let n=0;for(;e-t>=this._maxSize;)e>>=1,t>>=1,n++;return n}_downscale(e){if(e===0)return;if(e<0)throw Error(`impossible change of scale: ${this.scale}`);let t=this._mapping.scale-e;this._positive.downscale(e),this._negative.downscale(e),this._mapping=(0,o.getMapping)(t)}_minScale(e){let t=Math.min(this.scale,e.scale),n=c.combine(this._highLowAtScale(this.positive,this.scale,t),this._highLowAtScale(e.positive,e.scale,t)),r=c.combine(this._highLowAtScale(this.negative,this.scale,t),this._highLowAtScale(e.negative,e.scale,t));return Math.min(t-this._changeScale(n.high,n.low),t-this._changeScale(r.high,r.low))}_highLowAtScale(e,t,n){if(e.length===0)return new c(0,-1);let r=t-n;return new c(e.indexStart>>r,e.indexEnd>>r)}_mergeBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++)this._incrementIndexBy(e,i+t>>a,n.at(t))}_diffBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++){let r=(i+t>>a)-e.indexBase;r<0&&(r+=e.backing.length),e.decrementBucket(r,n.at(t))}e.trim()}};t.ExponentialHistogramAccumulation=l,t.ExponentialHistogramAggregator=class{kind=n.AggregatorKind.EXPONENTIAL_HISTOGRAM;_maxSize;_recordMinMax;constructor(e,t){this._maxSize=e,this._recordMinMax=t}createAccumulation(e){return new l(e,this._maxSize,this._recordMinMax)}merge(e,t){let n=t.clone();return n.merge(e),n}diff(e,t){let n=t.clone();return n.diff(e),n}toMetricData(e,t,n,i){return{descriptor:e,aggregationTemporality:t,dataPointType:r.DataPointType.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(([t,n])=>{let a=n.toPointValue(),o=e.type===r.InstrumentType.GAUGE||e.type===r.InstrumentType.UP_DOWN_COUNTER||e.type===r.InstrumentType.OBSERVABLE_GAUGE||e.type===r.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:i,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:o?void 0:a.sum,positive:{offset:a.positive.offset,bucketCounts:a.positive.bucketCounts},negative:{offset:a.negative.offset,bucketCounts:a.negative.bucketCounts},count:a.count,scale:a.scale,zeroCount:a.zeroCount}}})}}}})),xr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LastValueAggregator=e.LastValueAccumulation=void 0;let t=R(),n=b(),r=I();var i=class{startTime;_current;sampleTime;constructor(e,t=0,n=[0,0]){this.startTime=e,this._current=t,this.sampleTime=n}record(e){this._current=e,this.sampleTime=(0,n.millisToHrTime)(Date.now())}setStartTime(e){this.startTime=e}toPointValue(){return this._current}};e.LastValueAccumulation=i,e.LastValueAggregator=class{kind=t.AggregatorKind.LAST_VALUE;createAccumulation(e){return new i(e)}merge(e,t){let r=(0,n.hrTimeToMicroseconds)(t.sampleTime)>=(0,n.hrTimeToMicroseconds)(e.sampleTime)?t:e;return new i(e.startTime,r.toPointValue(),r.sampleTime)}diff(e,t){let r=(0,n.hrTimeToMicroseconds)(t.sampleTime)>=(0,n.hrTimeToMicroseconds)(e.sampleTime)?t:e;return new i(t.startTime,r.toPointValue(),r.sampleTime)}toMetricData(e,t,n,i){return{descriptor:e,aggregationTemporality:t,dataPointType:r.DataPointType.GAUGE,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:i,value:t.toPointValue()}))}}}})),Sr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SumAggregator=e.SumAccumulation=void 0;let t=R(),n=I();var r=class{startTime;monotonic;_current;reset;constructor(e,t,n=0,r=!1){this.startTime=e,this.monotonic=t,this._current=n,this.reset=r}record(e){this.monotonic&&e<0||(this._current+=e)}setStartTime(e){this.startTime=e}toPointValue(){return this._current}};e.SumAccumulation=r,e.SumAggregator=class{kind=t.AggregatorKind.SUM;monotonic;constructor(e){this.monotonic=e}createAccumulation(e){return new r(e,this.monotonic)}merge(e,t){let n=e.toPointValue(),i=t.toPointValue();return t.reset?new r(t.startTime,this.monotonic,i,t.reset):new r(e.startTime,this.monotonic,n+i)}diff(e,t){let n=e.toPointValue(),i=t.toPointValue();return this.monotonic&&n>i?new r(t.startTime,this.monotonic,i,!0):new r(t.startTime,this.monotonic,i-n)}toMetricData(e,t,r,i){return{descriptor:e,aggregationTemporality:t,dataPointType:n.DataPointType.SUM,dataPoints:r.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:i,value:t.toPointValue()})),isMonotonic:this.monotonic}}}})),Cr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SumAggregator=e.SumAccumulation=e.LastValueAggregator=e.LastValueAccumulation=e.ExponentialHistogramAggregator=e.ExponentialHistogramAccumulation=e.HistogramAggregator=e.HistogramAccumulation=e.DropAggregator=void 0;var t=dr();Object.defineProperty(e,`DropAggregator`,{enumerable:!0,get:function(){return t.DropAggregator}});var n=fr();Object.defineProperty(e,`HistogramAccumulation`,{enumerable:!0,get:function(){return n.HistogramAccumulation}}),Object.defineProperty(e,`HistogramAggregator`,{enumerable:!0,get:function(){return n.HistogramAggregator}});var r=br();Object.defineProperty(e,`ExponentialHistogramAccumulation`,{enumerable:!0,get:function(){return r.ExponentialHistogramAccumulation}}),Object.defineProperty(e,`ExponentialHistogramAggregator`,{enumerable:!0,get:function(){return r.ExponentialHistogramAggregator}});var i=xr();Object.defineProperty(e,`LastValueAccumulation`,{enumerable:!0,get:function(){return i.LastValueAccumulation}}),Object.defineProperty(e,`LastValueAggregator`,{enumerable:!0,get:function(){return i.LastValueAggregator}});var a=Sr();Object.defineProperty(e,`SumAccumulation`,{enumerable:!0,get:function(){return a.SumAccumulation}}),Object.defineProperty(e,`SumAggregator`,{enumerable:!0,get:function(){return a.SumAggregator}})})),wr=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DEFAULT_AGGREGATION=t.EXPONENTIAL_HISTOGRAM_AGGREGATION=t.HISTOGRAM_AGGREGATION=t.LAST_VALUE_AGGREGATION=t.SUM_AGGREGATION=t.DROP_AGGREGATION=t.DefaultAggregation=t.ExponentialHistogramAggregation=t.ExplicitBucketHistogramAggregation=t.HistogramAggregation=t.LastValueAggregation=t.SumAggregation=t.DropAggregation=void 0;let n=(g(),e(y)),r=Cr(),i=I();var a=class e{static DEFAULT_INSTANCE=new r.DropAggregator;createAggregator(t){return e.DEFAULT_INSTANCE}};t.DropAggregation=a;var o=class e{static MONOTONIC_INSTANCE=new r.SumAggregator(!0);static NON_MONOTONIC_INSTANCE=new r.SumAggregator(!1);createAggregator(t){switch(t.type){case i.InstrumentType.COUNTER:case i.InstrumentType.OBSERVABLE_COUNTER:case i.InstrumentType.HISTOGRAM:return e.MONOTONIC_INSTANCE;default:return e.NON_MONOTONIC_INSTANCE}}};t.SumAggregation=o;var s=class e{static DEFAULT_INSTANCE=new r.LastValueAggregator;createAggregator(t){return e.DEFAULT_INSTANCE}};t.LastValueAggregation=s;var c=class e{static DEFAULT_INSTANCE=new r.HistogramAggregator([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0);createAggregator(t){return e.DEFAULT_INSTANCE}};t.HistogramAggregation=c;var l=class{_boundaries;_recordMinMax;constructor(e,t=!0){if(e==null)throw Error(`ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array`);e=e.concat(),e=e.sort((e,t)=>e-t);let n=e.lastIndexOf(-1/0),r=e.indexOf(1/0);r===-1&&(r=void 0),this._boundaries=e.slice(n+1,r),this._recordMinMax=t}createAggregator(e){return new r.HistogramAggregator(this._boundaries,this._recordMinMax)}};t.ExplicitBucketHistogramAggregation=l;var u=class{_maxSize;_recordMinMax;constructor(e=160,t=!0){this._maxSize=e,this._recordMinMax=t}createAggregator(e){return new r.ExponentialHistogramAggregator(this._maxSize,this._recordMinMax)}};t.ExponentialHistogramAggregation=u;var d=class{_resolve(e){switch(e.type){case i.InstrumentType.COUNTER:case i.InstrumentType.UP_DOWN_COUNTER:case i.InstrumentType.OBSERVABLE_COUNTER:case i.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:return t.SUM_AGGREGATION;case i.InstrumentType.GAUGE:case i.InstrumentType.OBSERVABLE_GAUGE:return t.LAST_VALUE_AGGREGATION;case i.InstrumentType.HISTOGRAM:return e.advice.explicitBucketBoundaries?new l(e.advice.explicitBucketBoundaries):t.HISTOGRAM_AGGREGATION}return n.diag.warn(`Unable to recognize instrument type: ${e.type}`),t.DROP_AGGREGATION}createAggregator(e){return this._resolve(e).createAggregator(e)}};t.DefaultAggregation=d,t.DROP_AGGREGATION=new a,t.SUM_AGGREGATION=new o,t.LAST_VALUE_AGGREGATION=new s,t.HISTOGRAM_AGGREGATION=new c,t.EXPONENTIAL_HISTOGRAM_AGGREGATION=new u,t.DEFAULT_AGGREGATION=new d})),z=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.toAggregation=e.AggregationType=void 0;let t=wr();var n;(function(e){e[e.DEFAULT=0]=`DEFAULT`,e[e.DROP=1]=`DROP`,e[e.SUM=2]=`SUM`,e[e.LAST_VALUE=3]=`LAST_VALUE`,e[e.EXPLICIT_BUCKET_HISTOGRAM=4]=`EXPLICIT_BUCKET_HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=5]=`EXPONENTIAL_HISTOGRAM`})(n=e.AggregationType||={});function r(e){switch(e.type){case n.DEFAULT:return t.DEFAULT_AGGREGATION;case n.DROP:return t.DROP_AGGREGATION;case n.SUM:return t.SUM_AGGREGATION;case n.LAST_VALUE:return t.LAST_VALUE_AGGREGATION;case n.EXPONENTIAL_HISTOGRAM:{let n=e;return new t.ExponentialHistogramAggregation(n.options?.maxSize,n.options?.recordMinMax)}case n.EXPLICIT_BUCKET_HISTOGRAM:{let n=e;return n.options==null?t.HISTOGRAM_AGGREGATION:new t.ExplicitBucketHistogramAggregation(n.options?.boundaries,n.options?.recordMinMax)}default:throw Error(`Unsupported Aggregation`)}}e.toAggregation=r})),Tr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR=e.DEFAULT_AGGREGATION_SELECTOR=void 0;let t=ur(),n=z();e.DEFAULT_AGGREGATION_SELECTOR=e=>({type:n.AggregationType.DEFAULT}),e.DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR=e=>t.AggregationTemporality.CUMULATIVE})),Er=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ATTR_ERROR_TYPE=e.METRIC_OTEL_SDK_METRIC_READER_COLLECTION_DURATION=e.OTEL_COMPONENT_TYPE_VALUE_PERIODIC_METRIC_READER=e.ATTR_OTEL_COMPONENT_TYPE=e.ATTR_OTEL_COMPONENT_NAME=void 0,e.ATTR_OTEL_COMPONENT_NAME=`otel.component.name`,e.ATTR_OTEL_COMPONENT_TYPE=`otel.component.type`,e.OTEL_COMPONENT_TYPE_VALUE_PERIODIC_METRIC_READER=`periodic_metric_reader`,e.METRIC_OTEL_SDK_METRIC_READER_COLLECTION_DURATION=`otel.sdk.metric_reader.collection.duration`,e.ATTR_ERROR_TYPE=`error.type`})),Dr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MetricReaderMetrics=void 0;let t=Er(),n=new Map;e.MetricReaderMetrics=class{collectionDuration;standardAttrs;constructor(e,r){let i=n.get(e)??0;n.set(e,i+1),this.standardAttrs={[t.ATTR_OTEL_COMPONENT_TYPE]:e,[t.ATTR_OTEL_COMPONENT_NAME]:`${e}/${i}`},this.collectionDuration=r.createHistogram(t.METRIC_OTEL_SDK_METRIC_READER_COLLECTION_DURATION,{unit:`s`,description:`The duration of the collect operation of the metric reader.`,advice:{explicitBucketBoundaries:[]}})}recordCollection(e,n){let r=n?{...this.standardAttrs,[t.ATTR_ERROR_TYPE]:n}:this.standardAttrs;this.collectionDuration.record(e,r)}}})),Or=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.VERSION=void 0,e.VERSION=`2.9.0`})),kr=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.MetricReader=void 0;let n=(g(),e(y)),r=L(),i=Tr(),a=Dr(),o=Or(),s=b();t.MetricReader=class{_shutdown=!1;_metricProducers;_sdkMetricProducer;_selfObsMetrics;_aggregationTemporalitySelector;_aggregationSelector;_cardinalitySelector;_otelComponentType;constructor(e){this._aggregationSelector=e?.aggregationSelector??i.DEFAULT_AGGREGATION_SELECTOR,this._aggregationTemporalitySelector=e?.aggregationTemporalitySelector??i.DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR,this._metricProducers=e?.metricProducers??[],this._cardinalitySelector=e?.cardinalitySelector,this._otelComponentType=e?.otelComponentType??this.constructor.name,this._selfObsMetrics=new a.MetricReaderMetrics(this._otelComponentType,n.createNoopMeter())}setMetricProducer(e){if(this._sdkMetricProducer)throw Error(`MetricReader can not be bound to a MeterProvider again.`);this._sdkMetricProducer=e,this.onInitialized()}_setSelfObsMeterProvider(e){let t=e.getMeter(`@opentelemetry/sdk-metrics`,o.VERSION);this._selfObsMetrics=new a.MetricReaderMetrics(this._otelComponentType,t)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}selectCardinalityLimit(e){return this._cardinalitySelector?this._cardinalitySelector(e):2e3}onInitialized(){}async collect(e){if(this._sdkMetricProducer===void 0)throw Error(`MetricReader is not bound to a MetricProducer`);if(this._shutdown)throw Error(`MetricReader is shutdown`);let t=(0,s.hrTime)(),[n,...r]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:e?.timeoutMillis}),...this._metricProducers.map(t=>t.collect({timeoutMillis:e?.timeoutMillis}))]),i=(0,s.hrTime)(),a=n.errors.concat(r.flatMap(e=>e.errors)),o=(0,s.hrTimeToSeconds)((0,s.hrTimeDuration)(t,i));return this._selfObsMetrics.recordCollection(o,a.length>0?a[0].name??`collect_error`:void 0),{resourceMetrics:{resource:n.resourceMetrics.resource,scopeMetrics:n.resourceMetrics.scopeMetrics.concat(r.flatMap(e=>e.resourceMetrics.scopeMetrics))},errors:a}}async shutdown(e){if(this._shutdown){n.diag.error(`Cannot call shutdown twice.`);return}e?.timeoutMillis==null?await this.onShutdown():await(0,r.callWithTimeout)(this.onShutdown(),e.timeoutMillis),this._shutdown=!0}async forceFlush(e){if(this._shutdown){n.diag.warn(`Cannot forceFlush on already shutdown MetricReader.`);return}if(e?.timeoutMillis==null){await this.onForceFlush();return}await(0,r.callWithTimeout)(this.onForceFlush(),e.timeoutMillis)}}})),Ar=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.splitMetricData=void 0;function t(e,t){if(!Number.isInteger(t)||t<=0)throw Error(`maxExportBatchSize must be a positive integer`);let n=[],r=0,i=[];function a(){i.length>0&&(n.push({resource:e.resource,scopeMetrics:i}),i=[],r=0)}for(let n of e.scopeMetrics){let e=null;for(let o of n.metrics){let s=o.dataPoints;if(s.length===0){e||(e={scope:n.scope,metrics:[]},i.push(e)),e.metrics.push(o);continue}let c=0;for(;c<s.length;){let l=t-r,u=Math.min(l,s.length-c);e||(e={scope:n.scope,metrics:[]},i.push(e));let d={...o,dataPoints:s.slice(c,c+u)};e.metrics.push(d),c+=u,r+=u,r===t&&(a(),e=null)}}}return a(),n}e.splitMetricData=t})),jr=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.PeriodicExportingMetricReader=void 0;let n=(g(),e(y)),r=b(),i=kr(),a=L(),o=I(),s=Ar(),c=Er();t.PeriodicExportingMetricReader=class extends i.MetricReader{_interval;_exporter;_exportInterval;_exportTimeout;_maxExportBatchSize;_ongoingExportPromise=null;constructor(e){let{exporter:t,exportIntervalMillis:r=6e4,metricProducers:i,cardinalityLimits:a,maxExportBatchSize:s}=e,{exportTimeoutMillis:l=3e4}=e;if(super({aggregationSelector:t.selectAggregation?.bind(t),aggregationTemporalitySelector:t.selectAggregationTemporality?.bind(t),otelComponentType:c.OTEL_COMPONENT_TYPE_VALUE_PERIODIC_METRIC_READER,metricProducers:i,cardinalitySelector:e=>{let t={default:2e3,...a};switch(e){case o.InstrumentType.COUNTER:return t.counter??t.default;case o.InstrumentType.GAUGE:return t.gauge??t.default;case o.InstrumentType.HISTOGRAM:return t.histogram??t.default;case o.InstrumentType.OBSERVABLE_COUNTER:return t.observableCounter??t.default;case o.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:return t.observableUpDownCounter??t.default;case o.InstrumentType.OBSERVABLE_GAUGE:return t.observableGauge??t.default;case o.InstrumentType.UP_DOWN_COUNTER:return t.upDownCounter??t.default;default:return t.default}}}),r<=0)throw Error(`exportIntervalMillis must be greater than 0`);if(l<=0)throw Error(`exportTimeoutMillis must be greater than 0`);if(s!==void 0&&(!Number.isInteger(s)||s<=0))throw Error(`maxExportBatchSize must be a positive integer`);if(r<l){if(`exportIntervalMillis`in e&&`exportTimeoutMillis`in e)throw Error(`exportIntervalMillis must be greater than or equal to exportTimeoutMillis`);n.diag.info(`Timeout of ${l} exceeds the interval of ${r}. Clamping timeout to interval duration.`),l=r}this._exportInterval=r,this._exportTimeout=l,this._exporter=t,this._maxExportBatchSize=s}async _runOnce(){try{await this._doRun()}catch(e){(0,r.globalErrorHandler)(e)}}async _doRun(){if(this._ongoingExportPromise){n.diag.debug(`PeriodicExportingMetricReader: export already in progress, skipping`);return}let e=async()=>{let{resourceMetrics:e,errors:t}=await this.collect({timeoutMillis:this._exportTimeout});if(t.length>0&&n.diag.error(`PeriodicExportingMetricReader: metrics collection errors`,...t),e.resource.asyncAttributesPending)try{await e.resource.waitForAsyncAttributes?.()}catch(e){n.diag.debug(`Error while resolving async portion of resource: `,e),(0,r.globalErrorHandler)(e)}if(e.scopeMetrics.length===0)return;let i=this._maxExportBatchSize?(0,s.splitMetricData)(e,this._maxExportBatchSize):[e],o=null;for(let e of i)try{let t=await(0,a.callWithTimeout)(r.internal._export(this._exporter,e),this._exportTimeout);t.code!==r.ExportResultCode.SUCCESS&&(o=Error(`PeriodicExportingMetricReader: metrics export failed (error ${t.error})`))}catch(e){if(e instanceof a.TimeoutError){n.diag.error(`PeriodicExportingMetricReader: metrics export timed out after ${this._exportTimeout}ms`);break}else n.diag.error(`PeriodicExportingMetricReader: metrics export threw error`,e),o=e instanceof Error?e:Error(String(e))}if(o)throw o};this._ongoingExportPromise=e();try{await this._ongoingExportPromise}finally{this._ongoingExportPromise=null}}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!=`number`&&this._interval.unref()}async onForceFlush(){await this._awaitOngoingExport(),this._ongoingExportPromise?await this._awaitOngoingExport():await this._runOnce(),await this._exporter.forceFlush()}async _awaitOngoingExport(){if(this._ongoingExportPromise){n.diag.debug(`PeriodicExportingMetricReader: export already in progress, awaiting ongoing export`);try{await this._ongoingExportPromise}catch{}}}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}}})),Mr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InMemoryMetricExporter=void 0;let t=b();e.InMemoryMetricExporter=class{_shutdown=!1;_aggregationTemporality;_metrics=[];constructor(e){this._aggregationTemporality=e}export(e,n){if(this._shutdown){setTimeout(()=>n({code:t.ExportResultCode.FAILED}),0);return}this._metrics.push(e),setTimeout(()=>n({code:t.ExportResultCode.SUCCESS}),0)}getMetrics(){return this._metrics}forceFlush(){return Promise.resolve()}reset(){this._metrics=[]}selectAggregationTemporality(e){return this._aggregationTemporality}shutdown(){return this._shutdown=!0,Promise.resolve()}}})),Nr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ConsoleMetricExporter=void 0;let t=b(),n=Tr();e.ConsoleMetricExporter=class e{_shutdown=!1;_temporalitySelector;constructor(e){this._temporalitySelector=e?.temporalitySelector??n.DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR}export(n,r){if(this._shutdown){r({code:t.ExportResultCode.FAILED});return}return e._sendMetrics(n,r)}forceFlush(){return Promise.resolve()}selectAggregationTemporality(e){return this._temporalitySelector(e)}shutdown(){return this._shutdown=!0,Promise.resolve()}static _sendMetrics(e,n){for(let t of e.scopeMetrics)for(let e of t.metrics)console.dir({descriptor:e.descriptor,dataPointType:e.dataPointType,dataPoints:e.dataPoints},{depth:null});n({code:t.ExportResultCode.SUCCESS})}}})),Pr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ViewRegistry=void 0,e.ViewRegistry=class{_registeredViews=[];addView(e){this._registeredViews.push(e)}findViews(e,t){return this._registeredViews.filter(n=>this._matchInstrument(n.instrumentSelector,e)&&this._matchMeter(n.meterSelector,t))}_matchInstrument(e,t){return(e.getType()===void 0||t.type===e.getType())&&e.getNameFilter().match(t.name)&&e.getUnitFilter().match(t.unit)}_matchMeter(e,t){return e.getNameFilter().match(t.name)&&(t.version===void 0||e.getVersionFilter().match(t.version))&&(t.schemaUrl===void 0||e.getSchemaUrlFilter().match(t.schemaUrl))}}})),B=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.isValidName=t.isDescriptorCompatibleWith=t.createInstrumentDescriptorWithView=t.createInstrumentDescriptor=void 0;let n=(g(),e(y)),r=L();function i(e,t,r){return c(e)||n.diag.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:r?.description??``,unit:r?.unit??``,valueType:r?.valueType??n.ValueType.DOUBLE,advice:r?.advice??{}}}t.createInstrumentDescriptor=i;function a(e,t){return{name:e.name??t.name,description:e.description??t.description,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}t.createInstrumentDescriptorWithView=a;function o(e,t){return(0,r.equalsCaseInsensitive)(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}t.isDescriptorCompatibleWith=o;let s=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function c(e){return s.test(e)}t.isValidName=c})),Fr=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.isObservableInstrument=t.ObservableUpDownCounterInstrument=t.ObservableGaugeInstrument=t.ObservableCounterInstrument=t.ObservableInstrument=t.HistogramInstrument=t.GaugeInstrument=t.CounterInstrument=t.UpDownCounterInstrument=t.SyncInstrument=void 0;let n=(g(),e(y));var r=class{_writableMetricStorage;_descriptor;constructor(e,t){this._writableMetricStorage=e,this._descriptor=t}_record(e,t={},r){if(typeof e!=`number`){n.diag.warn(`non-number value provided to metric ${this._descriptor.name}: ${e}`);return}this._descriptor.valueType===n.ValueType.INT&&!Number.isInteger(e)&&(n.diag.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._writableMetricStorage.record(e,t,r,Date.now())}};t.SyncInstrument=r,t.UpDownCounterInstrument=class extends r{add(e,t,n){this._record(e,t,n)}},t.CounterInstrument=class extends r{add(e,t,r){if(e<0){n.diag.warn(`negative value provided to counter ${this._descriptor.name}: ${e}`);return}this._record(e,t,r)}},t.GaugeInstrument=class extends r{record(e,t,n){this._record(e,t,n)}},t.HistogramInstrument=class extends r{record(e,t,r){if(e<0){n.diag.warn(`negative value provided to histogram ${this._descriptor.name}: ${e}`);return}this._record(e,t,r)}};var i=class{_metricStorages;_descriptor;_observableRegistry;constructor(e,t,n){this._descriptor=e,this._metricStorages=t,this._observableRegistry=n}addCallback(e){this._observableRegistry.addCallback(e,this)}removeCallback(e){this._observableRegistry.removeCallback(e,this)}};t.ObservableInstrument=i,t.ObservableCounterInstrument=class extends i{},t.ObservableGaugeInstrument=class extends i{},t.ObservableUpDownCounterInstrument=class extends i{};function a(e){return e instanceof i}t.isObservableInstrument=a})),Ir=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Meter=void 0;let t=B(),n=Fr(),r=I();e.Meter=class{_meterSharedState;constructor(e){this._meterSharedState=e}createGauge(e,i){let a=(0,t.createInstrumentDescriptor)(e,r.InstrumentType.GAUGE,i),o=this._meterSharedState.registerMetricStorage(a);return new n.GaugeInstrument(o,a)}createHistogram(e,i){let a=(0,t.createInstrumentDescriptor)(e,r.InstrumentType.HISTOGRAM,i),o=this._meterSharedState.registerMetricStorage(a);return new n.HistogramInstrument(o,a)}createCounter(e,i){let a=(0,t.createInstrumentDescriptor)(e,r.InstrumentType.COUNTER,i),o=this._meterSharedState.registerMetricStorage(a);return new n.CounterInstrument(o,a)}createUpDownCounter(e,i){let a=(0,t.createInstrumentDescriptor)(e,r.InstrumentType.UP_DOWN_COUNTER,i),o=this._meterSharedState.registerMetricStorage(a);return new n.UpDownCounterInstrument(o,a)}createObservableGauge(e,i){let a=(0,t.createInstrumentDescriptor)(e,r.InstrumentType.OBSERVABLE_GAUGE,i),o=this._meterSharedState.registerAsyncMetricStorage(a);return new n.ObservableGaugeInstrument(a,o,this._meterSharedState.observableRegistry)}createObservableCounter(e,i){let a=(0,t.createInstrumentDescriptor)(e,r.InstrumentType.OBSERVABLE_COUNTER,i),o=this._meterSharedState.registerAsyncMetricStorage(a);return new n.ObservableCounterInstrument(a,o,this._meterSharedState.observableRegistry)}createObservableUpDownCounter(e,i){let a=(0,t.createInstrumentDescriptor)(e,r.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER,i),o=this._meterSharedState.registerAsyncMetricStorage(a);return new n.ObservableUpDownCounterInstrument(a,o,this._meterSharedState.observableRegistry)}addBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.addBatchCallback(e,t)}removeBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.removeBatchCallback(e,t)}}})),Lr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MetricStorage=void 0;let t=B();e.MetricStorage=class{_instrumentDescriptor;constructor(e){this._instrumentDescriptor=e}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(e){this._instrumentDescriptor=(0,t.createInstrumentDescriptor)(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:e,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}}})),V=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AttributeHashMap=e.HashMap=void 0;let t=L();var n=class{_valueMap=new Map;_keyMap=new Map;_hash;constructor(e){this._hash=e}get(e,t){return t??=this._hash(e),this._valueMap.get(t)}getOrDefault(e,t){let n=this._hash(e);if(this._valueMap.has(n))return this._valueMap.get(n);let r=t();return this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,r),r}set(e,t,n){n??=this._hash(e),this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,t)}has(e,t){return t??=this._hash(e),this._valueMap.has(t)}*keys(){let e=this._keyMap.entries(),t=e.next();for(;t.done!==!0;)yield[t.value[1],t.value[0]],t=e.next()}*entries(){let e=this._valueMap.entries(),t=e.next();for(;t.done!==!0;)yield[this._keyMap.get(t.value[0]),t.value[1],t.value[0]],t=e.next()}get size(){return this._valueMap.size}};e.HashMap=n,e.AttributeHashMap=class extends n{constructor(){super(t.hashAttributes)}}})),Rr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DeltaMetricProcessor=void 0;let t=b(),n=L(),r=V();e.DeltaMetricProcessor=class{_activeCollectionStorage=new r.AttributeHashMap;_cumulativeMemoStorage=new r.AttributeHashMap;_cardinalityLimit;_overflowAttributes={"otel.metric.overflow":!0};_overflowHashCode;_aggregator;constructor(e,t){this._aggregator=e,this._cardinalityLimit=(t??2e3)-1,this._overflowHashCode=(0,n.hashAttributes)(this._overflowAttributes)}record(e,n,r){let i=this._activeCollectionStorage.get(n);if(!i){let a=(0,t.millisToHrTime)(r);if(this._activeCollectionStorage.size>=this._cardinalityLimit){this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(a))?.record(e);return}i=this._aggregator.createAccumulation(a),this._activeCollectionStorage.set(n,i)}i?.record(e)}batchCumulate(e,t){for(let[n,r,i]of e.entries()){let e=n,a=i,o=this._aggregator.createAccumulation(t);o?.record(r);let s=o;if(this._cumulativeMemoStorage.has(e,a)){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(e=this._overflowAttributes,a=this._overflowHashCode,this._cumulativeMemoStorage.has(e,a))){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}if(this._activeCollectionStorage.has(e,a)){let t=this._activeCollectionStorage.get(e,a);s=this._aggregator.merge(t,s)}this._cumulativeMemoStorage.set(e,o,a),this._activeCollectionStorage.set(e,s,a)}}collect(){let e=this._activeCollectionStorage;return this._activeCollectionStorage=new r.AttributeHashMap,e}}})),zr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TemporalMetricProcessor=void 0;let t=ur(),n=V();e.TemporalMetricProcessor=class e{_aggregator;_unreportedAccumulations=new Map;_reportHistory=new Map;constructor(e,t){this._aggregator=e,t.forEach(e=>{this._unreportedAccumulations.set(e,[])})}buildMetrics(n,i,a,o){this._stashAccumulations(a);let s=this._getMergedUnreportedAccumulations(n),c=s,l;if(this._reportHistory.has(n)){let r=this._reportHistory.get(n),i=r.collectionTime;l=r.aggregationTemporality,c=l===t.AggregationTemporality.CUMULATIVE?e.merge(r.accumulations,s,this._aggregator):e.calibrateStartTime(r.accumulations,s,i)}else l=n.selectAggregationTemporality(i.type);this._reportHistory.set(n,{accumulations:c,collectionTime:o,aggregationTemporality:l});let u=r(c);if(u.length!==0)return this._aggregator.toMetricData(i,l,u,o)}_stashAccumulations(e){let t=this._unreportedAccumulations.keys();for(let n of t){let t=this._unreportedAccumulations.get(n);t===void 0&&(t=[],this._unreportedAccumulations.set(n,t)),t.push(e)}}_getMergedUnreportedAccumulations(t){let r=new n.AttributeHashMap,i=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),i===void 0)return r;for(let t of i)r=e.merge(r,t,this._aggregator);return r}static merge(e,t,n){let r=e,i=t.entries(),a=i.next();for(;a.done!==!0;){let[t,o,s]=a.value;if(e.has(t,s)){let i=e.get(t,s),a=n.merge(i,o);r.set(t,a,s)}else r.set(t,o,s);a=i.next()}return r}static calibrateStartTime(e,t,n){for(let[r,i]of e.keys())t.get(r,i)?.setStartTime(n);return t}};function r(e){return Array.from(e.entries())}})),Br=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AsyncMetricStorage=void 0;let t=Lr(),n=Rr(),r=zr(),i=V();e.AsyncMetricStorage=class extends t.MetricStorage{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(e,t,i,a,o){super(e),this._aggregationCardinalityLimit=o,this._deltaMetricStorage=new n.DeltaMetricProcessor(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new r.TemporalMetricProcessor(t,a),this._attributesProcessor=i}record(e,t){if(this._attributesProcessor===void 0){this._deltaMetricStorage.batchCumulate(e,t);return}let n=new i.AttributeHashMap;for(let[t,r]of e.entries())n.set(this._attributesProcessor.process(t),r);this._deltaMetricStorage.batchCumulate(n,t)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}}})),Vr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getConflictResolutionRecipe=e.getDescriptionResolutionRecipe=e.getTypeConflictResolutionRecipe=e.getUnitConflictResolutionRecipe=e.getValueTypeConflictResolutionRecipe=e.getIncompatibilityDetails=void 0;function t(e,t){let n=``;return e.unit!==t.unit&&(n+=`\t- Unit '${e.unit}' does not match '${t.unit}'\n`),e.type!==t.type&&(n+=`\t- Type '${e.type}' does not match '${t.type}'\n`),e.valueType!==t.valueType&&(n+=`\t- Value Type '${e.valueType}' does not match '${t.valueType}'\n`),e.description!==t.description&&(n+=`\t- Description '${e.description}' does not match '${t.description}'\n`),n}e.getIncompatibilityDetails=t;function n(e,t){return`\t- use valueType '${e.valueType}' on instrument creation or use an instrument name other than '${t.name}'`}e.getValueTypeConflictResolutionRecipe=n;function r(e,t){return`\t- use unit '${e.unit}' on instrument creation or use an instrument name other than '${t.name}'`}e.getUnitConflictResolutionRecipe=r;function i(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'`}e.getTypeConflictResolutionRecipe=i;function a(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'
4
4
  \t- OR - create a new view with the name ${e.name} and description '${e.description}' and InstrumentSelector ${r}
@@ -9,4 +9,4 @@ To resolve the conflict:`,(0,i.getConflictResolutionRecipe)(t,e))),a=o):r.diag.w
9
9
  `,`Details:
10
10
  `,(0,i.getIncompatibilityDetails)(t,e),`To resolve the conflict:
11
11
  `,(0,i.getConflictResolutionRecipe)(t,e))}return a}}})),Ur=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.MultiMetricStorage=void 0;let n=(g(),e(y));t.MultiMetricStorage=class{_backingStorages;hasAttributeProcessor;constructor(e){this._backingStorages=e,this.hasAttributeProcessor=e.some(e=>e.hasAttributeProcessor)}record(e,t,r,i){this.hasAttributeProcessor&&r===void 0&&(r=n.context.active());let a=this._backingStorages;for(let n=0;n<a.length;n++)a[n].record(e,t,r,i)}}})),Wr=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BatchObservableResultImpl=t.ObservableResultImpl=void 0;let n=(g(),e(y)),r=V(),i=Fr();t.ObservableResultImpl=class{_buffer=new r.AttributeHashMap;_instrumentName;_valueType;constructor(e,t){this._instrumentName=e,this._valueType=t}observe(e,t={}){if(typeof e!=`number`){n.diag.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===n.ValueType.INT&&!Number.isInteger(e)&&(n.diag.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._buffer.set(t,e)}},t.BatchObservableResultImpl=class{_buffer=new Map;observe(e,t,a={}){if(!(0,i.isObservableInstrument)(e))return;let o=this._buffer.get(e);if(o??(o=new r.AttributeHashMap,this._buffer.set(e,o)),typeof t!=`number`){n.diag.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`);return}e._descriptor.valueType===n.ValueType.INT&&!Number.isInteger(t)&&(n.diag.warn(`INT value type cannot accept a floating-point value for ${e._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||o.set(a,t)}}})),Gr=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ObservableRegistry=void 0;let n=(g(),e(y)),r=Fr(),i=Wr(),a=L();t.ObservableRegistry=class{_callbacks=[];_batchCallbacks=[];addCallback(e,t){this._findCallback(e,t)>=0||this._callbacks.push({callback:e,instrument:t})}removeCallback(e,t){let n=this._findCallback(e,t);n<0||this._callbacks.splice(n,1)}addBatchCallback(e,t){let i=new Set(t.filter(r.isObservableInstrument));if(i.size===0){n.diag.error(`BatchObservableCallback is not associated with valid instruments`,t);return}this._findBatchCallback(e,i)>=0||this._batchCallbacks.push({callback:e,instruments:i})}removeBatchCallback(e,t){let n=new Set(t.filter(r.isObservableInstrument)),i=this._findBatchCallback(e,n);i<0||this._batchCallbacks.splice(i,1)}async observe(e,t){let n=this._observeCallbacks(e,t),r=this._observeBatchCallbacks(e,t);return(await Promise.allSettled([...n,...r])).filter(e=>e.status===`rejected`).map(e=>e.reason)}_observeCallbacks(e,t){return this._callbacks.map(async({callback:n,instrument:r})=>{let o=new i.ObservableResultImpl(r._descriptor.name,r._descriptor.valueType),s=Promise.resolve(n(o));t!=null&&(s=(0,a.callWithTimeout)(s,t)),await s,r._metricStorages.forEach(t=>{t.record(o._buffer,e)})})}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(async({callback:n,instruments:r})=>{let o=new i.BatchObservableResultImpl,s=Promise.resolve(n(o));t!=null&&(s=(0,a.callWithTimeout)(s,t)),await s,r.forEach(t=>{let n=o._buffer.get(t);n!=null&&t._metricStorages.forEach(t=>{t.record(n,e)})})})}_findCallback(e,t){return this._callbacks.findIndex(n=>n.callback===e&&n.instrument===t)}_findBatchCallback(e,t){return this._batchCallbacks.findIndex(n=>n.callback===e&&(0,a.setEquals)(n.instruments,t))}}})),Kr=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.SyncMetricStorage=void 0;let n=(g(),e(y)),r=Lr(),i=Rr(),a=zr();t.SyncMetricStorage=class extends r.MetricStorage{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(e,t,n,r,o){super(e),this._aggregationCardinalityLimit=o,this._deltaMetricStorage=new i.DeltaMetricProcessor(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new a.TemporalMetricProcessor(t,r),this._attributesProcessor=n,this.hasAttributeProcessor=n!==void 0}hasAttributeProcessor;record(e,t,r,i){this._attributesProcessor!==void 0&&(t=this._attributesProcessor.process(t,r??n.context.active())),this._deltaMetricStorage.record(e,t,i)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}}})),qr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MeterSharedState=void 0;let t=B(),n=Ir(),r=Br(),i=Hr(),a=Ur(),o=Gr(),s=Kr();e.MeterSharedState=class{metricStorageRegistry=new i.MetricStorageRegistry;observableRegistry=new o.ObservableRegistry;meter;_meterProviderSharedState;_instrumentationScope;constructor(e,t){this.meter=new n.Meter(this),this._meterProviderSharedState=e,this._instrumentationScope=t}registerMetricStorage(e){let t=this._registerMetricStorage(e,s.SyncMetricStorage);return t.length===1?t[0]:new a.MultiMetricStorage(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,r.AsyncMetricStorage)}async collect(e,t,n){let r=await this.observableRegistry.observe(t,n?.timeoutMillis),i=this.metricStorageRegistry.getStorages(e);if(i.length===0)return null;let a=[];return i.forEach(n=>{let r=n.collect(e,t);r!=null&&a.push(r)}),a.length===0?{errors:r}:{scopeMetrics:{scope:this._instrumentationScope,metrics:a},errors:r}}_registerMetricStorage(e,n){let r=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(r=>{let i=(0,t.createInstrumentDescriptorWithView)(r,e),a=this.metricStorageRegistry.findOrUpdateCompatibleStorage(i);if(a!=null)return a;let o=new n(i,r.aggregation.createAggregator(i),r.attributesProcessor,this._meterProviderSharedState.metricCollectors,r.aggregationCardinalityLimit);return this.metricStorageRegistry.register(o),o});if(r.length===0){let t=this._meterProviderSharedState.selectAggregations(e.type).map(([t,r])=>{let i=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(t,e);if(i!=null)return i;let a=r.createAggregator(e),o=t.selectCardinalityLimit(e.type),s=new n(e,a,void 0,[t],o);return this.metricStorageRegistry.registerForCollector(t,s),s});r=r.concat(t)}return r}}})),Jr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MeterProviderSharedState=void 0;let t=L(),n=Pr(),r=qr(),i=z();e.MeterProviderSharedState=class{viewRegistry=new n.ViewRegistry;metricCollectors=[];meterSharedStates=new Map;resource;constructor(e){this.resource=e}getMeterSharedState(e){let n=(0,t.instrumentationScopeId)(e),i=this.meterSharedStates.get(n);return i??(i=new r.MeterSharedState(this,e),this.meterSharedStates.set(n,i)),i}selectAggregations(e){let t=[];for(let n of this.metricCollectors)t.push([n,(0,i.toAggregation)(n.selectAggregation(e))]);return t}}})),Yr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MetricCollector=void 0;let t=b();e.MetricCollector=class{_sharedState;_metricReader;constructor(e,t){this._sharedState=e,this._metricReader=t}async collect(e){let n=(0,t.millisToHrTime)(Date.now()),r=[],i=[],a=Array.from(this._sharedState.meterSharedStates.values()).map(async t=>{let a=await t.collect(this,n,e);a?.scopeMetrics!=null&&r.push(a.scopeMetrics),a?.errors!=null&&i.push(...a.errors)});return await Promise.all(a),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:r},errors:i}}async forceFlush(e){await this._metricReader.forceFlush(e)}async shutdown(e){await this._metricReader.shutdown(e)}selectAggregationTemporality(e){return this._metricReader.selectAggregationTemporality(e)}selectAggregation(e){return this._metricReader.selectAggregation(e)}selectCardinalityLimit(e){return this._metricReader.selectCardinalityLimit?.(e)??2e3}}})),Xr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ExactPredicate=e.PatternPredicate=void 0;let t=/[\^$\\.+?()[\]{}|]/g;e.PatternPredicate=class e{_matchAll;_regexp;constructor(t){t===`*`?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(e.escapePattern(t)))}match(e){return this._matchAll?!0:this._regexp.test(e)}static escapePattern(e){return`^${e.replace(t,`\\$&`).replace(`*`,`.*`)}$`}static hasWildcard(e){return e.includes(`*`)}},e.ExactPredicate=class{_matchAll;_pattern;constructor(e){this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}}})),Zr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.createDenyListAttributesProcessor=e.createAllowListAttributesProcessor=e.createMultiAttributesProcessor=e.createNoopAttributesProcessor=void 0;var t=class{process(e,t){return e}},n=class{_processors;constructor(e){this._processors=e}process(e,t){let n=e;for(let e of this._processors)n=e.process(n,t);return n}},r=class{_allowedAttributeNames;constructor(e){this._allowedAttributeNames=new Set(e)}process(e,t){let n={};for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this._allowedAttributeNames.has(t)&&(n[t]=e[t]);return n}},i=class{_deniedAttributeNames;constructor(e){this._deniedAttributeNames=new Set(e)}process(e,t){let n={};for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&!this._deniedAttributeNames.has(t)&&(n[t]=e[t]);return n}};function a(){return l}e.createNoopAttributesProcessor=a;function o(e){return new n(e)}e.createMultiAttributesProcessor=o;function s(e){return new r(e)}e.createAllowListAttributesProcessor=s;function c(e){return new i(e)}e.createDenyListAttributesProcessor=c;let l=new t})),Qr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InstrumentSelector=void 0;let t=Xr();e.InstrumentSelector=class{_nameFilter;_type;_unitFilter;constructor(e){this._nameFilter=new t.PatternPredicate(e?.name??`*`),this._type=e?.type,this._unitFilter=new t.ExactPredicate(e?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}}})),$r=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MeterSelector=void 0;let t=Xr();e.MeterSelector=class{_nameFilter;_versionFilter;_schemaUrlFilter;constructor(e){this._nameFilter=new t.ExactPredicate(e?.name),this._versionFilter=new t.ExactPredicate(e?.version),this._schemaUrlFilter=new t.ExactPredicate(e?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}}})),ei=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.View=void 0;let t=Xr(),n=Zr(),r=Qr(),i=$r(),a=z();function o(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function s(e){if(o(e))throw Error(`Cannot create view with no selector arguments supplied`);if(e.name!=null&&(e?.instrumentName==null||t.PatternPredicate.hasWildcard(e.instrumentName)))throw Error(`Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.`)}e.View=class{name;description;aggregation;attributesProcessor;instrumentSelector;meterSelector;aggregationCardinalityLimit;constructor(e){s(e),e.attributesProcessors==null?this.attributesProcessor=(0,n.createNoopAttributesProcessor)():this.attributesProcessor=(0,n.createMultiAttributesProcessor)(e.attributesProcessors),this.name=e.name,this.description=e.description,this.aggregation=(0,a.toAggregation)(e.aggregation??{type:a.AggregationType.DEFAULT}),this.instrumentSelector=new r.InstrumentSelector({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new i.MeterSelector({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl}),this.aggregationCardinalityLimit=e.aggregationCardinalityLimit}}})),ti=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.MeterProvider=void 0;let n=(g(),e(y)),r=lr(),i=kr(),a=Jr(),o=Yr(),s=ei();t.MeterProvider=class{_sharedState;_shutdown=!1;constructor(e){if(this._sharedState=new a.MeterProviderSharedState(e?.resource??(0,r.defaultResource)()),e?.views!=null&&e.views.length>0)for(let t of e.views)this._sharedState.viewRegistry.addView(new s.View(t));if(e?.readers!=null&&e.readers.length>0)for(let t of e.readers){let n=new o.MetricCollector(this._sharedState,t);t.setMetricProducer(n),this._sharedState.metricCollectors.push(n),e.sdkMetricsEnabled&&t instanceof i.MetricReader&&t._setSelfObsMeterProvider(this)}}getMeter(e,t=``,r={}){return this._shutdown?(n.diag.warn(`A shutdown MeterProvider cannot provide a Meter`),(0,n.createNoopMeter)()):this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:r.schemaUrl}).meter}async shutdown(e){if(this._shutdown){n.diag.warn(`shutdown may only be called once per MeterProvider`);return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(t=>t.shutdown(e)))}async forceFlush(e){if(this._shutdown){n.diag.warn(`invalid attempt to force flush after MeterProvider shutdown`);return}await Promise.all(this._sharedState.metricCollectors.map(t=>t.forceFlush(e)))}}})),ni=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TimeoutError=e.createDenyListAttributesProcessor=e.createAllowListAttributesProcessor=e.AggregationType=e.MeterProvider=e.ConsoleMetricExporter=e.InMemoryMetricExporter=e.PeriodicExportingMetricReader=e.MetricReader=e.InstrumentType=e.DataPointType=e.AggregationTemporality=void 0;var t=ur();Object.defineProperty(e,`AggregationTemporality`,{enumerable:!0,get:function(){return t.AggregationTemporality}});var n=I();Object.defineProperty(e,`DataPointType`,{enumerable:!0,get:function(){return n.DataPointType}}),Object.defineProperty(e,`InstrumentType`,{enumerable:!0,get:function(){return n.InstrumentType}});var r=kr();Object.defineProperty(e,`MetricReader`,{enumerable:!0,get:function(){return r.MetricReader}});var i=jr();Object.defineProperty(e,`PeriodicExportingMetricReader`,{enumerable:!0,get:function(){return i.PeriodicExportingMetricReader}});var a=Mr();Object.defineProperty(e,`InMemoryMetricExporter`,{enumerable:!0,get:function(){return a.InMemoryMetricExporter}});var o=Nr();Object.defineProperty(e,`ConsoleMetricExporter`,{enumerable:!0,get:function(){return o.ConsoleMetricExporter}});var s=ti();Object.defineProperty(e,`MeterProvider`,{enumerable:!0,get:function(){return s.MeterProvider}});var c=z();Object.defineProperty(e,`AggregationType`,{enumerable:!0,get:function(){return c.AggregationType}});var l=Zr();Object.defineProperty(e,`createAllowListAttributesProcessor`,{enumerable:!0,get:function(){return l.createAllowListAttributesProcessor}}),Object.defineProperty(e,`createDenyListAttributesProcessor`,{enumerable:!0,get:function(){return l.createDenyListAttributesProcessor}});var u=L();Object.defineProperty(e,`TimeoutError`,{enumerable:!0,get:function(){return u.TimeoutError}})})),ri=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ExceptionEventName=void 0,e.ExceptionEventName=`exception`})),ii=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatInspect=e.settledResourceAttributes=e.inspectCustom=void 0,e.inspectCustom=Symbol.for(`nodejs.util.inspect.custom`);function t(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!=`function`&&r!=null&&(t[n]??=r);return t}e.settledResourceAttributes=t;function n(e,t,n,r,i){if(typeof n==`number`&&n<0){let t=`[${e}]`;return r?.stylize?r.stylize(t,`special`):t}return typeof i!=`function`||!r?t:`${e} ${i(t,{...r,depth:r.depth==null?r.depth:r.depth-1})}`}e.formatInspect=n})),ai=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.SpanImpl=void 0;let n=(g(),e(y)),r=b(),i=(C(),e(S)),a=ri(),o=ii();t.SpanImpl=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:n.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=r.otperformance.now(),this._performanceOffset=t-(this._performanceStartTime+r.otperformance.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime(e.startTime??t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return n.diag.warn(`Invalid attribute key: ${e}`),this;if(!(0,r.isAttributeValue)(t))return n.diag.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:i}=this._spanLimits,a=!Object.prototype.hasOwnProperty.call(this.attributes,e);return i!==void 0&&this._attributesCount>=i&&a?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),a&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,i){if(this._isSpanEnded())return this;let{eventCountLimit:a}=this._spanLimits;if(a===0)return n.diag.warn(`No events allowed.`),this._droppedEventsCount++,this;a!==void 0&&this.events.length>=a&&(this._droppedEventsCount===0&&n.diag.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),(0,r.isTimeInput)(t)&&((0,r.isTimeInput)(i)||(i=t),t=void 0);let o=(0,r.sanitizeAttributes)(t),{attributePerEventCountLimit:s}=this._spanLimits,c={},l=0,u=0;for(let e in o){if(!Object.prototype.hasOwnProperty.call(o,e))continue;let t=o[e];if(s!==void 0&&u>=s){l++;continue}c[e]=this._truncateToSize(t),u++}return this.events.push({name:e,attributes:c,time:this._getTime(i),droppedAttributesCount:l}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&n.diag.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:i}=this._spanLimits,a=(0,r.sanitizeAttributes)(e.attributes),o={},s=0,c=0;for(let e in a){if(!Object.prototype.hasOwnProperty.call(a,e))continue;let t=a[e];if(i!==void 0&&c>=i){s++;continue}o[e]=this._truncateToSize(t),c++}let l={context:e.context};return c>0&&(l.attributes=o),s>0&&(l.droppedAttributesCount=s),this.links.push(l),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===n.SpanStatusCode.UNSET||this.status.code===n.SpanStatusCode.OK)return this;let t={code:e.code};return e.code===n.SpanStatusCode.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&n.diag.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){if(this._isSpanEnded()){n.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=(0,r.hrTimeDuration)(this.startTime,this.endTime),this._duration[0]<0&&(n.diag.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&n.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&n.diag.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=r.otperformance.now())return(0,r.hrTime)(e+this._performanceOffset);if(typeof e==`number`)return(0,r.millisToHrTime)(e);if(e instanceof Date)return(0,r.millisToHrTime)(e.getTime());if((0,r.isTimeInputHrTime)(e))return e;if(this._startTimeProvided)return(0,r.millisToHrTime)(Date.now());let t=r.otperformance.now()-this._performanceStartTime;return(0,r.addHrTimes)(this.startTime,(0,r.millisToHrTime)(t))}isRecording(){return this._ended===!1}recordException(e,t){let r={};typeof e==`string`?r[i.ATTR_EXCEPTION_MESSAGE]=e:e&&(e.code?r[i.ATTR_EXCEPTION_TYPE]=e.code.toString():e.name&&(r[i.ATTR_EXCEPTION_TYPE]=e.name),e.message&&(r[i.ATTR_EXCEPTION_MESSAGE]=e.message),e.stack&&(r[i.ATTR_EXCEPTION_STACKTRACE]=e.stack)),r[i.ATTR_EXCEPTION_TYPE]||r[i.ATTR_EXCEPTION_MESSAGE]?this.addEvent(a.ExceptionEventName,r,t):n.diag.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);n.diag.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(n.diag.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}[o.inspectCustom](e,t,n){let r={name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:(0,o.settledResourceAttributes)(this.resource)}};return(0,o.formatInspect)(`SpanImpl`,r,e,t,n)}}})),H=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SamplingDecision=void 0,(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(e.SamplingDecision||={})})),U=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.OTEL_COMPONENT_TYPE_VALUE_SIMPLE_SPAN_PROCESSOR=e.OTEL_COMPONENT_TYPE_VALUE_BATCHING_SPAN_PROCESSOR=e.METRIC_OTEL_SDK_SPAN_STARTED=e.METRIC_OTEL_SDK_SPAN_LIVE=e.METRIC_OTEL_SDK_PROCESSOR_SPAN_QUEUE_SIZE=e.METRIC_OTEL_SDK_PROCESSOR_SPAN_QUEUE_CAPACITY=e.METRIC_OTEL_SDK_PROCESSOR_SPAN_PROCESSED=e.ATTR_OTEL_SPAN_SAMPLING_RESULT=e.ATTR_OTEL_SPAN_PARENT_ORIGIN=e.ATTR_OTEL_COMPONENT_TYPE=e.ATTR_OTEL_COMPONENT_NAME=void 0,e.ATTR_OTEL_COMPONENT_NAME=`otel.component.name`,e.ATTR_OTEL_COMPONENT_TYPE=`otel.component.type`,e.ATTR_OTEL_SPAN_PARENT_ORIGIN=`otel.span.parent.origin`,e.ATTR_OTEL_SPAN_SAMPLING_RESULT=`otel.span.sampling_result`,e.METRIC_OTEL_SDK_PROCESSOR_SPAN_PROCESSED=`otel.sdk.processor.span.processed`,e.METRIC_OTEL_SDK_PROCESSOR_SPAN_QUEUE_CAPACITY=`otel.sdk.processor.span.queue.capacity`,e.METRIC_OTEL_SDK_PROCESSOR_SPAN_QUEUE_SIZE=`otel.sdk.processor.span.queue.size`,e.METRIC_OTEL_SDK_SPAN_LIVE=`otel.sdk.span.live`,e.METRIC_OTEL_SDK_SPAN_STARTED=`otel.sdk.span.started`,e.OTEL_COMPONENT_TYPE_VALUE_BATCHING_SPAN_PROCESSOR=`batching_span_processor`,e.OTEL_COMPONENT_TYPE_VALUE_SIMPLE_SPAN_PROCESSOR=`simple_span_processor`})),oi=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TracerMetrics=void 0;let t=H(),n=U();e.TracerMetrics=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(n.METRIC_OTEL_SDK_SPAN_STARTED,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(n.METRIC_OTEL_SDK_SPAN_LIVE,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,a){let o=i(a);if(this.startedSpans.add(1,{[n.ATTR_OTEL_SPAN_PARENT_ORIGIN]:r(e),[n.ATTR_OTEL_SPAN_SAMPLING_RESULT]:o}),a===t.SamplingDecision.NOT_RECORD)return()=>{};let s={[n.ATTR_OTEL_SPAN_SAMPLING_RESULT]:o};return this.liveSpans.add(1,s),()=>{this.liveSpans.add(-1,s)}}};function r(e){return e?e.isRemote?`remote`:`local`:`none`}function i(e){switch(e){case t.SamplingDecision.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case t.SamplingDecision.RECORD:return`RECORD_ONLY`;case t.SamplingDecision.NOT_RECORD:return`DROP`}}})),si=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.VERSION=void 0,e.VERSION=`2.9.0`})),ci=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Tracer=void 0;let n=(g(),e(y)),r=b(),i=ai(),a=oi(),o=si(),s=ii();t.Tracer=class{_sampler;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t){this.instrumentationScope=e,this._sampler=t.sampler,this._spanLimits=t.spanLimits,this._resource=t.resource,this._idGenerator=t.idGenerator,this._spanProcessor=t.spanProcessor;let n=t.meterProvider.getMeter(`@opentelemetry/sdk-trace`,o.VERSION);this._tracerMetrics=new a.TracerMetrics(n)}startSpan(e,t={},a=n.context.active()){t.root&&(a=n.trace.deleteSpan(a));let o=n.trace.getSpan(a);if((0,r.isTracingSuppressed)(a))return n.diag.debug(`Instrumentation suppressed, returning Noop Span`),n.trace.wrapSpanContext(n.INVALID_SPAN_CONTEXT);let s=o?.spanContext(),c=this._idGenerator.generateSpanId(),l,u,d;!s||!n.trace.isSpanContextValid(s)?u=this._idGenerator.generateTraceId():(u=s.traceId,d=s.traceState,l=s);let f=t.kind??n.SpanKind.INTERNAL,p=(t.links??[]).map(e=>({context:e.context,attributes:(0,r.sanitizeAttributes)(e.attributes)})),ee=(0,r.sanitizeAttributes)(t.attributes),m=this._sampler.shouldSample(a,u,e,f,ee,p),te=this._tracerMetrics.startSpan(s,m.decision);d=m.traceState??d;let ne=m.decision===n.SamplingDecision.RECORD_AND_SAMPLED?n.TraceFlags.SAMPLED:n.TraceFlags.NONE,re={traceId:u,spanId:c,traceFlags:ne,traceState:d};if(m.decision===n.SamplingDecision.NOT_RECORD)return n.diag.debug(`Recording is off, propagating context in a non-recording span`),n.trace.wrapSpanContext(re);let ie=(0,r.sanitizeAttributes)(Object.assign(ee,m.attributes));return new i.SpanImpl({resource:this._resource,scope:this.instrumentationScope,context:a,spanContext:re,name:e,kind:f,links:p,parentSpanContext:l,attributes:ie,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:te})}startActiveSpan(e,t,r,i){let a,o,s;if(arguments.length<2)return;arguments.length===2?s=t:arguments.length===3?(a=t,s=r):(a=t,o=r,s=i);let c=o??n.context.active(),l=this.startSpan(e,a,c),u=n.trace.setSpan(c,l);return n.context.with(u,s,void 0,l)}[s.inspectCustom](e,t,n){let r={instrumentationScope:this.instrumentationScope,resource:{attributes:(0,s.settledResourceAttributes)(this._resource)},spanLimits:this._spanLimits};return(0,s.formatInspect)(`Tracer`,r,e,t,n)}}})),li=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MultiSpanProcessor=void 0;let t=b();e.MultiSpanProcessor=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(n=>{Promise.all(e).then(()=>{n()}).catch(e=>{(0,t.globalErrorHandler)(e||Error(`MultiSpanProcessor: forceFlush failed`)),n()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}}})),ui=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AlwaysOffSampler=void 0;let t=H();e.AlwaysOffSampler=class{shouldSample(){return{decision:t.SamplingDecision.NOT_RECORD}}toString(){return`AlwaysOffSampler`}}})),di=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AlwaysOnSampler=void 0;let t=H();e.AlwaysOnSampler=class{shouldSample(){return{decision:t.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}}})),fi=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ParentBasedSampler=void 0;let n=(g(),e(y)),r=b(),i=ui(),a=di();t.ParentBasedSampler=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=((0,r.globalErrorHandler)(Error(`ParentBasedSampler must have a root sampler configured`)),new a.AlwaysOnSampler),this._remoteParentSampled=e.remoteParentSampled??new a.AlwaysOnSampler,this._remoteParentNotSampled=e.remoteParentNotSampled??new i.AlwaysOffSampler,this._localParentSampled=e.localParentSampled??new a.AlwaysOnSampler,this._localParentNotSampled=e.localParentNotSampled??new i.AlwaysOffSampler}shouldSample(e,t,r,i,a,o){let s=n.trace.getSpanContext(e);return!s||!(0,n.isSpanContextValid)(s)?this._root.shouldSample(e,t,r,i,a,o):s.isRemote?s.traceFlags&n.TraceFlags.SAMPLED?this._remoteParentSampled.shouldSample(e,t,r,i,a,o):this._remoteParentNotSampled.shouldSample(e,t,r,i,a,o):s.traceFlags&n.TraceFlags.SAMPLED?this._localParentSampled.shouldSample(e,t,r,i,a,o):this._localParentNotSampled.shouldSample(e,t,r,i,a,o)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}})),pi=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.SpanProcessorMetrics=void 0;let n=(C(),e(S)),r=U(),i=new Map;t.SpanProcessorMetrics=class{processedSpans;queueSize;queueSizeCallback;standardAttrs;droppedAttrs;constructor(e,t,a){let o=i.get(e)??0;if(i.set(e,o+1),this.standardAttrs={[r.ATTR_OTEL_COMPONENT_TYPE]:e,[r.ATTR_OTEL_COMPONENT_NAME]:`${e}/${o}`},this.droppedAttrs={...this.standardAttrs,[n.ATTR_ERROR_TYPE]:`queue_full`},this.processedSpans=t.createCounter(r.METRIC_OTEL_SDK_PROCESSOR_SPAN_PROCESSED,{unit:`{span}`,description:`The number of spans for which the processing has finished, either successful or failed.`}),a){let{capacity:e,getQueueSize:n}=a;t.createUpDownCounter(r.METRIC_OTEL_SDK_PROCESSOR_SPAN_QUEUE_CAPACITY,{unit:`{span}`,description:`The maximum number of spans the queue of a given instance of an SDK span processor can hold.`}).add(e,this.standardAttrs),this.queueSize=t.createObservableUpDownCounter(r.METRIC_OTEL_SDK_PROCESSOR_SPAN_QUEUE_SIZE,{unit:`{span}`,description:`The number of spans in the queue of a given instance of an SDK span processor.`}),this.queueSizeCallback=e=>e.observe(n(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(e){this.processedSpans.add(e,this.droppedAttrs)}finishSpans(e,t){if(!t){this.processedSpans.add(e,this.standardAttrs);return}let r={...this.standardAttrs,[n.ATTR_ERROR_TYPE]:t.name};this.processedSpans.add(e,r)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}}})),mi=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BatchSpanProcessorBase=void 0;let n=(g(),e(y)),r=b(),i=pi(),a=U();t.BatchSpanProcessorBase=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_metrics;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e){this._exporter=e.exporter,this._maxExportBatchSize=e.maxExportBatchSize??512,this._maxQueueSize=e.maxQueueSize??2048,this._scheduledDelayMillis=e.scheduledDelayMillis??5e3,this._exportTimeoutMillis=e.exportTimeoutMillis??3e4,this._shutdownOnce=new r.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(n.diag.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize);let t=e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-trace`):(0,n.createNoopMeter)();this._metrics=new i.SpanProcessorMetrics(a.OTEL_COMPONENT_TYPE_VALUE_BATCHING_SPAN_PROCESSOR,t,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&n.TraceFlags.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>(this._metrics.shutdown(),this._exporter.shutdown()))}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&n.diag.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++,this._metrics.dropSpans(1);return}this._droppedSpansCount>0&&(n.diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let i=setTimeout(()=>{t(Error(`Timeout`))},this._exportTimeoutMillis);n.context.with((0,r.suppressTracing)(n.context.active()),()=>{let n;this._finishedSpans.length<=this._maxExportBatchSize?(n=this._finishedSpans,this._finishedSpans=[]):n=this._finishedSpans.splice(0,this._maxExportBatchSize);let a=()=>this._exporter.export(n,a=>{clearTimeout(i),this._metrics.finishSpans(n.length,a.error),a.code===r.ExportResultCode.SUCCESS?e():t(a.error??Error(`BatchSpanProcessor: span export failed`))}),o=null;for(let e=0,t=n.length;e<t;e++){let t=n[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(o??=[],o.push(t.resource.waitForAsyncAttributes()))}o===null?a():Promise.all(o).then(a,e=>{(0,r.globalErrorHandler)(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,(0,r.globalErrorHandler)(e)})};if(this._finishedSpans.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)}}})),hi=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BatchSpanProcessor=void 0;let t=mi();e.BatchSpanProcessor=class extends t.BatchSpanProcessorBase{onShutdown(){}}})),gi=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.RandomIdGenerator=void 0,e.RandomIdGenerator=class{generateTraceId=n(16);generateSpanId=n(8)};let t=Buffer.allocUnsafe(16);function n(e){return function(){for(let n=0;n<e/4;n++)t.writeUInt32BE(Math.random()*2**32>>>0,n*4);for(let n=0;n<e&&!(t[n]>0);n++)n===e-1&&(t[e-1]=1);return t.toString(`hex`,0,e)}}})),_i=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.RandomIdGenerator=e.BatchSpanProcessor=void 0;var t=hi();Object.defineProperty(e,`BatchSpanProcessor`,{enumerable:!0,get:function(){return t.BatchSpanProcessor}});var n=gi();Object.defineProperty(e,`RandomIdGenerator`,{enumerable:!0,get:function(){return n.RandomIdGenerator}})})),vi=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.RandomIdGenerator=e.BatchSpanProcessor=void 0;var t=_i();Object.defineProperty(e,`BatchSpanProcessor`,{enumerable:!0,get:function(){return t.BatchSpanProcessor}}),Object.defineProperty(e,`RandomIdGenerator`,{enumerable:!0,get:function(){return t.RandomIdGenerator}})})),yi=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.TracerProvider=void 0;let n=(g(),e(y)),r=lr(),i=ci(),a=li(),o=fi(),s=di(),c=vi(),l=ii();var u;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(u||={}),t.TracerProvider=class{_resource;_activeSpanProcessor;_forceFlushTimeoutMillis;_tracerOptions;_tracers=new Map;constructor(e={}){this._forceFlushTimeoutMillis=e.forceFlushTimeoutMillis??3e4,this._resource=e.resource??(0,r.defaultResource)();let t=e.spanProcessors??[];this._activeSpanProcessor=new a.MultiSpanProcessor(t),this._tracerOptions={resource:this._resource,sampler:e.sampler??new o.ParentBasedSampler({root:new s.AlwaysOnSampler}),spanLimits:{attributeCountLimit:e.spanLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.spanLimits?.attributeValueLengthLimit??1/0,eventCountLimit:e.spanLimits?.eventCountLimit??128,linkCountLimit:e.spanLimits?.linkCountLimit??128,attributePerEventCountLimit:e.spanLimits?.attributePerEventCountLimit??128,attributePerLinkCountLimit:e.spanLimits?.attributePerLinkCountLimit??128},idGenerator:e.idGenerator||new c.RandomIdGenerator,spanProcessor:this._activeSpanProcessor,meterProvider:e.meterProvider??{getMeter(){return(0,n.createNoopMeter)()}}}}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new i.Tracer({name:e,version:t,schemaUrl:n?.schemaUrl},this._tracerOptions)),this._tracers.get(r)}forceFlush(){let e=this._forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${e} ms`)),r=u.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==u.timeout&&(r=u.resolved,n(r))}).catch(e=>{clearTimeout(i),r=u.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==u.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[l.inspectCustom](e,t,n){let r=this._activeSpanProcessor._spanProcessors,i={resource:{attributes:(0,l.settledResourceAttributes)(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>e.constructor?.name??`SpanProcessor`)};return(0,l.formatInspect)(`TracerProvider`,i,e,t,n)}}})),bi=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ConsoleSpanExporter=void 0;let t=b();e.ConsoleSpanExporter=class{export(e,t){return this._sendSpans(e,t)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:(0,t.hrTimeToMicroseconds)(e.startTime),duration:(0,t.hrTimeToMicroseconds)(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(e,n){for(let t of e)console.dir(this._exportInfo(t),{depth:3});if(n)return n({code:t.ExportResultCode.SUCCESS})}}})),xi=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InMemorySpanExporter=void 0;let t=b();e.InMemorySpanExporter=class{_finishedSpans=[];_stopped=!1;export(e,n){if(this._stopped)return n({code:t.ExportResultCode.FAILED,error:Error(`Exporter has been stopped`)});this._finishedSpans.push(...e),setTimeout(()=>n({code:t.ExportResultCode.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}})),Si=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.SimpleSpanProcessor=void 0;let n=(g(),e(y)),r=b(),i=pi(),a=U();t.SimpleSpanProcessor=class{_exporter;_metrics;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e.exporter,this._shutdownOnce=new r.BindOnceFuture(this._shutdown,this),this._pendingExports=new Set;let t=e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-trace`):(0,n.createNoopMeter)();this._metrics=new i.SpanProcessorMetrics(a.OTEL_COMPONENT_TYPE_VALUE_SIMPLE_SPAN_PROCESSOR,t)}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(e,t){}onEnd(e){if(this._shutdownOnce.isCalled||(e.spanContext().traceFlags&n.TraceFlags.SAMPLED)===0)return;let t=this._doExport(e).catch(e=>(0,r.globalErrorHandler)(e));this._pendingExports.add(t),t.finally(()=>this._pendingExports.delete(t))}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();let t=await r.internal._export(this._exporter,[e]);if(this._metrics.finishSpans(1,t.error),t.code!==r.ExportResultCode.SUCCESS)throw t.error??Error(`SimpleSpanProcessor: span export failed (status ${t})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._metrics.shutdown(),this._exporter.shutdown()}}})),Ci=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.NoopSpanProcessor=void 0,e.NoopSpanProcessor=class{onStart(e,t){}onEnd(e){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}})),wi=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.createAlwaysRecordSampler=void 0;let t=H();function n(e){if(!e)throw Error(`createAlwaysRecordSampler requires a delegate sampler`);return{shouldSample(n,r,i,a,o,s){let c=e.shouldSample(n,r,i,a,o,s);return c.decision===t.SamplingDecision.NOT_RECORD?{decision:t.SamplingDecision.RECORD,attributes:c.attributes,traceState:c.traceState}:c},toString(){return`AlwaysRecordSampler{${e.toString()}}`}}}e.createAlwaysRecordSampler=n})),Ti=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.TraceIdRatioBasedSampler=void 0;let n=(g(),e(y)),r=H();t.TraceIdRatioBasedSampler=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:(0,n.isValidTraceId)(t)&&this._accumulate(t)<this._upperBound?r.SamplingDecision.RECORD_AND_SAMPLED:r.SamplingDecision.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}}})),W=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SamplingDecision=e.TraceIdRatioBasedSampler=e.ParentBasedSampler=e.createAlwaysRecordSampler=e.AlwaysOnSampler=e.AlwaysOffSampler=e.NoopSpanProcessor=e.SimpleSpanProcessor=e.InMemorySpanExporter=e.ConsoleSpanExporter=e.RandomIdGenerator=e.BatchSpanProcessor=e.TracerProvider=void 0;var t=yi();Object.defineProperty(e,`TracerProvider`,{enumerable:!0,get:function(){return t.TracerProvider}});var n=vi();Object.defineProperty(e,`BatchSpanProcessor`,{enumerable:!0,get:function(){return n.BatchSpanProcessor}}),Object.defineProperty(e,`RandomIdGenerator`,{enumerable:!0,get:function(){return n.RandomIdGenerator}});var r=bi();Object.defineProperty(e,`ConsoleSpanExporter`,{enumerable:!0,get:function(){return r.ConsoleSpanExporter}});var i=xi();Object.defineProperty(e,`InMemorySpanExporter`,{enumerable:!0,get:function(){return i.InMemorySpanExporter}});var a=Si();Object.defineProperty(e,`SimpleSpanProcessor`,{enumerable:!0,get:function(){return a.SimpleSpanProcessor}});var o=Ci();Object.defineProperty(e,`NoopSpanProcessor`,{enumerable:!0,get:function(){return o.NoopSpanProcessor}});var s=ui();Object.defineProperty(e,`AlwaysOffSampler`,{enumerable:!0,get:function(){return s.AlwaysOffSampler}});var c=di();Object.defineProperty(e,`AlwaysOnSampler`,{enumerable:!0,get:function(){return c.AlwaysOnSampler}});var l=wi();Object.defineProperty(e,`createAlwaysRecordSampler`,{enumerable:!0,get:function(){return l.createAlwaysRecordSampler}});var u=fi();Object.defineProperty(e,`ParentBasedSampler`,{enumerable:!0,get:function(){return u.ParentBasedSampler}});var d=Ti();Object.defineProperty(e,`TraceIdRatioBasedSampler`,{enumerable:!0,get:function(){return d.TraceIdRatioBasedSampler}});var f=H();Object.defineProperty(e,`SamplingDecision`,{enumerable:!0,get:function(){return f.SamplingDecision}})})),Ei=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.buildSamplerFromEnv=t.loadDefaultConfig=void 0;let n=(g(),e(y)),r=b(),i=W();var a;(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(a||={});function o(){return{sampler:s(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:(0,r.getNumberFromEnv)(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:(0,r.getNumberFromEnv)(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:(0,r.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:(0,r.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:(0,r.getNumberFromEnv)(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:(0,r.getNumberFromEnv)(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:(0,r.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:(0,r.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}t.loadDefaultConfig=o;function s(){let e=(0,r.getStringFromEnv)(`OTEL_TRACES_SAMPLER`)??a.ParentBasedAlwaysOn;switch(e){case a.AlwaysOn:return new i.AlwaysOnSampler;case a.AlwaysOff:return new i.AlwaysOffSampler;case a.ParentBasedAlwaysOn:return new i.ParentBasedSampler({root:new i.AlwaysOnSampler});case a.ParentBasedAlwaysOff:return new i.ParentBasedSampler({root:new i.AlwaysOffSampler});case a.TraceIdRatio:return new i.TraceIdRatioBasedSampler(c());case a.ParentBasedTraceIdRatio:return new i.ParentBasedSampler({root:new i.TraceIdRatioBasedSampler(c())});default:return n.diag.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${a.ParentBasedAlwaysOn}".`),new i.ParentBasedSampler({root:new i.AlwaysOnSampler})}}t.buildSamplerFromEnv=s;function c(){let e=(0,r.getNumberFromEnv)(`OTEL_TRACES_SAMPLER_ARG`);return e==null?(n.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to 1.`),1):e<0||e>1?(n.diag.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to 1.`),1):e}})),Di=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.reconfigureLimits=e.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=e.DEFAULT_ATTRIBUTE_COUNT_LIMIT=void 0;let t=b();e.DEFAULT_ATTRIBUTE_COUNT_LIMIT=128,e.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=1/0;function n(n){let r=Object.assign({},n.spanLimits);return r.attributeCountLimit=n.spanLimits?.attributeCountLimit??n.generalLimits?.attributeCountLimit??(0,t.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??(0,t.getNumberFromEnv)(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??e.DEFAULT_ATTRIBUTE_COUNT_LIMIT,r.attributeValueLengthLimit=n.spanLimits?.attributeValueLengthLimit??n.generalLimits?.attributeValueLengthLimit??(0,t.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??(0,t.getNumberFromEnv)(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??e.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,Object.assign({},n,{spanLimits:r})}e.reconfigureLimits=n})),Oi=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BasicTracerProvider=void 0;let t=b(),n=Ei(),r=Di(),i=W();e.BasicTracerProvider=class extends i.TracerProvider{constructor(e={}){let i=(0,t.merge)({},(0,n.loadDefaultConfig)(),(0,r.reconfigureLimits)(e));delete i.generalLimits,super(i)}}})),ki=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BatchSpanProcessor=void 0;let t=b(),n=W();e.BatchSpanProcessor=class extends n.BatchSpanProcessor{constructor(e,n){n||={};for(let[e,r]of[[`maxExportBatchSize`,`OTEL_BSP_MAX_EXPORT_BATCH_SIZE`],[`maxQueueSize`,`OTEL_BSP_MAX_QUEUE_SIZE`],[`scheduledDelayMillis`,`OTEL_BSP_SCHEDULE_DELAY`],[`exportTimeoutMillis`,`OTEL_BSP_EXPORT_TIMEOUT`]])if(n[e]===void 0){let i=(0,t.getNumberFromEnv)(r);i!==void 0&&(n[e]=i)}super({exporter:e,...n})}}})),Ai=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SimpleSpanProcessor=void 0;let t=W();e.SimpleSpanProcessor=class extends t.SimpleSpanProcessor{constructor(e){super({exporter:e})}}})),ji=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SamplingDecision=e.TraceIdRatioBasedSampler=e.ParentBasedSampler=e.AlwaysOnSampler=e.AlwaysOffSampler=e.NoopSpanProcessor=e.InMemorySpanExporter=e.RandomIdGenerator=e.ConsoleSpanExporter=e.SimpleSpanProcessor=e.BatchSpanProcessor=e.BasicTracerProvider=void 0;var t=Oi();Object.defineProperty(e,`BasicTracerProvider`,{enumerable:!0,get:function(){return t.BasicTracerProvider}});var n=ki();Object.defineProperty(e,`BatchSpanProcessor`,{enumerable:!0,get:function(){return n.BatchSpanProcessor}});var r=Ai();Object.defineProperty(e,`SimpleSpanProcessor`,{enumerable:!0,get:function(){return r.SimpleSpanProcessor}});var i=W();Object.defineProperty(e,`ConsoleSpanExporter`,{enumerable:!0,get:function(){return i.ConsoleSpanExporter}}),Object.defineProperty(e,`RandomIdGenerator`,{enumerable:!0,get:function(){return i.RandomIdGenerator}}),Object.defineProperty(e,`InMemorySpanExporter`,{enumerable:!0,get:function(){return i.InMemorySpanExporter}}),Object.defineProperty(e,`NoopSpanProcessor`,{enumerable:!0,get:function(){return i.NoopSpanProcessor}}),Object.defineProperty(e,`AlwaysOffSampler`,{enumerable:!0,get:function(){return i.AlwaysOffSampler}}),Object.defineProperty(e,`AlwaysOnSampler`,{enumerable:!0,get:function(){return i.AlwaysOnSampler}}),Object.defineProperty(e,`ParentBasedSampler`,{enumerable:!0,get:function(){return i.ParentBasedSampler}}),Object.defineProperty(e,`TraceIdRatioBasedSampler`,{enumerable:!0,get:function(){return i.TraceIdRatioBasedSampler}}),Object.defineProperty(e,`SamplingDecision`,{enumerable:!0,get:function(){return i.SamplingDecision}})}));g();var Mi=vt(),Ni=b(),Pi=Hn(),Fi=qn(),Ii=lr(),Li=ni(),Ri=ji();C();const G=`open-knowledge-server`;let K=null,q=null,J=null;function zi(){return{tracer:v.getTracer(G),meter:h.getMeter(G)}}function Bi(e={}){let t=e.localSink!==void 0,n=process.env.OTEL_SDK_DISABLED===`false`;if(!t&&!n||K)return zi();try{let r=(0,Ii.resourceFromAttributes)({[ue]:process.env.OTEL_SERVICE_NAME||`open-knowledge-server`,[ge]:process.env.OTEL_SERVICE_VERSION||`0.2.0`}),i=new Mi.AsyncLocalStorageContextManager;le.setGlobalContextManager(i);let a=[],o=e.localSink?.attributeDenylist??ae;a.push(new de({attributeDenylist:o})),t&&e.localSink!==void 0&&(J=new he({projectDir:e.localSink.projectDir,maxBytes:e.localSink.spansMaxBytes}),a.push(new Ri.SimpleSpanProcessor(J))),n&&a.push(new Ri.BatchSpanProcessor(new Fi.OTLPTraceExporter));let s=new Ri.BasicTracerProvider({resource:r,spanProcessors:a});v.setGlobalTracerProvider(s),K=s;try{ce.setGlobalPropagator(new Ni.W3CTraceContextPropagator)}catch(e){x(`telemetry`).warn({err:e},`OpenTelemetry propagator init failed — file sink active, distributed trace correlation degraded`)}let c=null;n&&(c=new Li.MeterProvider({resource:r,readers:[new Li.PeriodicExportingMetricReader({exporter:new Pi.OTLPMetricExporter})]}),h.setGlobalMeterProvider(c)),q=c,x(`telemetry`).info({file_sink_enabled:t,otlp_push_enabled:n,otlp_endpoint:n?process.env.OTEL_EXPORTER_OTLP_ENDPOINT||`http://localhost:4318`:null,service_name:r.attributes[ue]},`OpenTelemetry initialized`)}catch(e){let t=x(`telemetry`);K===null?(t.error({err:e},`failed to initialize OpenTelemetry — falling back to no-op`),q=null,J=null):(t.warn({err:e},`OpenTelemetry metrics init failed — traces still active, metrics degraded`),q=null)}return zi()}const Vi=5e3,Hi=new Set;function Ui(e){Hi.add(e)}async function Wi(){let e=x(`telemetry`);for(let t of Hi)try{t()}catch(t){e.warn({err:t},`telemetry shutdown reset hook threw; continuing teardown`)}if(!K&&!q)return;let t=(J?J.forceFlush().catch(t=>{e.warn({err:t},`telemetry file-sink flush failed during shutdown`)}):Promise.resolve()).then(()=>Promise.all([K?.shutdown().catch(t=>{e.warn({err:t},`tracer provider shutdown failed`)}),q?.shutdown().catch(t=>{e.warn({err:t},`meter provider shutdown failed`)})])),n;await Promise.race([t.then(()=>(n!==void 0&&clearTimeout(n),!1)),new Promise(e=>{n=setTimeout(()=>e(!0),Vi),n.unref?.()})])&&e.warn({},`telemetry shutdown timed out after ${Vi}ms — data may be lost`),K=null,q=null,J=null,v.disable(),h.disable(),le.disable()}function Gi(){return v.getTracer(G)}function Ki(){return h.getMeter(G)}async function Y(e,t,n){return Gi().startActiveSpan(e,t??{},async e=>{try{let t=await n(e);return e.isRecording(),t}catch(t){throw e.recordException(t),e.setStatus({code:se.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function X(e,t,n){return Gi().startActiveSpan(e,t??{},e=>{try{return n(e)}catch(t){throw e.recordException(t),e.setStatus({code:se.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function qi(e){let t=v.getSpan(le.active());t&&t.setAttributes(e)}function Z(e){let t=e.split(E).filter(Boolean);return t.length<=2?e:`...${E}${t.slice(-2).join(E)}`}function Ji(e){return e.includes(`${E}.git${E}ok${E}`)||e.includes(`shadow-repo`)?`shadow-repo`:e.includes(`${E}.git${E}`)?`git`:w(e).endsWith(`.lock`)||w(e)===`lock`?`lock`:w(e)===`principal.json`?`principal`:e.includes(`${E}.ok${E}`)&&(w(e)===`conflicts.json`||e.includes(`${E}conflicts${E}`))?`conflict`:e.includes(`${E}.ok${E}`)?`ok-internal`:e.endsWith(`.md`)||e.endsWith(`.mdx`)?`content-md`:`other`}function Q(e,t,n){let r={"fs.operation":e,"fs.path":Z(t),"fs.path.role":Ji(t)};return n&&Object.assign(r,n),r}function $(e){return typeof e==`string`?Buffer.byteLength(e,`utf-8`):e instanceof Uint8Array?e.byteLength:e.byteLength??0}async function Yi(e,t,n){return Y(`fs.writeFile`,{attributes:Q(`writeFile`,e,{"fs.bytes":$(t)})},async()=>{await Ue(e,t,n)})}async function Xi(e,t,n){return Y(`fs.appendFile`,{attributes:Q(`appendFile`,e,{"fs.bytes":$(t)})},async()=>{await Ie(e,t,n)})}async function Zi(e,t){return Y(`fs.rm`,{attributes:Q(`rm`,e)},async()=>{await Be(e,t)})}async function Qi(e,t){return Y(`fs.rename`,{attributes:Q(`rename`,t,{"fs.source_path":Z(e)})},async()=>{await ze(e,t)})}async function $i(e,t){return Y(`fs.mkdir`,{attributes:Q(`mkdir`,e)},async()=>Le(e,t))}function ea(e,t,n){X(`fs.writeFileSync`,{attributes:Q(`writeFileSync`,e,{"fs.bytes":$(t)})},()=>{Pe(e,t,n)})}function ta(e,t,n){X(`fs.appendFileSync`,{attributes:Q(`appendFileSync`,e,{"fs.bytes":$(t)})},()=>{be(e,t,n)})}function na(e,t){return X(`fs.mkdirSync`,{attributes:Q(`mkdirSync`,e)},()=>Te(e,t))}function ra(e,t){X(`fs.renameSync`,{attributes:Q(`renameSync`,t,{"fs.source_path":Z(e)})},()=>{ke(e,t)})}function ia(e,t,n){X(`fs.cpSync`,{attributes:Q(`cpSync`,t,{"fs.source_path":Z(e)})},()=>{Se(e,t,n)})}function aa(e){X(`fs.unlinkSync`,{attributes:Q(`unlinkSync`,e)},()=>{D(e)})}function oa(e,t){X(`fs.linkSync`,{attributes:Q(`linkSync`,t,{"fs.source_path":Z(e)})},()=>{we(e,t)})}function sa(e,t,n){X(`fs.symlinkSync`,{attributes:Q(`symlinkSync`,t,{"fs.source_path":Z(e)})},()=>{Ne(e,t,n)})}function ca(e,t){X(`fs.rmSync`,{attributes:Q(`rmSync`,e)},()=>{Ae(e,t)})}function la(e){X(`fs.rmdirSync`,{attributes:Q(`rmdirSync`,e)},()=>{je(e)})}const ua={writeFile:(e,t,n)=>Yi(e,t,n),rename:(e,t)=>Qi(e,t)};export{k as A,qi as C,pt as D,X as E,Je as F,rt as M,$e as N,st as O,et as P,Ui as S,Y as T,Yi as _,ua as a,Gi as b,$i as c,ra as d,Zi as f,aa as g,sa as h,ta as i,tt as j,lt as k,na as l,la as m,Z as n,ia as o,ca as p,Xi as r,oa as s,Ji as t,Qi as u,ea as v,Wi as w,Bi as x,Ki as y};
12
- //# sourceMappingURL=fs-traced-OS6B1cZZ.mjs.map
12
+ //# sourceMappingURL=fs-traced-D12ehU8a.mjs.map
@@ -1,4 +1,4 @@
1
- import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{mo as r}from"./src-pJ6LEXKc.mjs";import{delimiter as i,normalize as a,resolve as o}from"node:path";import{existsSync as s,statSync as c}from"node:fs";import{homedir as l}from"node:os";import{EventEmitter as u}from"node:events";import{spawn as d}from"child_process";var f=n(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}})),p=n(((e,t)=>{function n(e){n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=i,n.enabled=s,n.humanize=f(),n.destroy=l,Object.keys(e).forEach(t=>{n[t]=e[t]}),n.names=[],n.skips=[],n.formatters={};function t(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]}n.selectColor=t;function n(e){let t,i=null,a,o;function s(...e){if(!s.enabled)return;let r=s,i=Number(new Date);r.diff=i-(t||i),r.prev=t,r.curr=i,t=i,e[0]=n.coerce(e[0]),typeof e[0]!=`string`&&e.unshift(`%O`);let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,i)=>{if(t===`%%`)return`%`;a++;let o=n.formatters[i];if(typeof o==`function`){let n=e[a];t=o.call(r,n),e.splice(a,1),a--}return t}),n.formatArgs.call(r,e),(r.log||n.log).apply(r,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=r,s.destroy=n.destroy,Object.defineProperty(s,`enabled`,{enumerable:!0,configurable:!1,get:()=>i===null?(a!==n.namespaces&&(a=n.namespaces,o=n.enabled(e)),o):i,set:e=>{i=e}}),typeof n.init==`function`&&n.init(s),s}function r(e,t){let r=n(this.namespace+(t===void 0?`:`:t)+e);return r.log=this.log,r}function i(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];let t=(typeof e==`string`?e:``).trim().replace(/\s+/g,`,`).split(`,`).filter(Boolean);for(let e of t)e[0]===`-`?n.skips.push(e.slice(1)):n.names.push(e)}function a(e,t){let n=0,r=0,i=-1,a=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||t[r]===`*`))t[r]===`*`?(i=r,a=n,r++):(n++,r++);else if(i!==-1)r=i+1,a++,n=a;else return!1;for(;r<t.length&&t[r]===`*`;)r++;return r===t.length}function o(){let e=[...n.names,...n.skips.map(e=>`-`+e)].join(`,`);return n.enable(``),e}function s(e){for(let t of n.skips)if(a(e,t))return!1;for(let t of n.names)if(a(e,t))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}t.exports=n})),m=n(((e,t)=>{e.formatArgs=r,e.save=i,e.load=a,e.useColors=n,e.storage=o(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=`#0000CC.#0000FF.#0033CC.#0033FF.#0066CC.#0066FF.#0099CC.#0099FF.#00CC00.#00CC33.#00CC66.#00CC99.#00CCCC.#00CCFF.#3300CC.#3300FF.#3333CC.#3333FF.#3366CC.#3366FF.#3399CC.#3399FF.#33CC00.#33CC33.#33CC66.#33CC99.#33CCCC.#33CCFF.#6600CC.#6600FF.#6633CC.#6633FF.#66CC00.#66CC33.#9900CC.#9900FF.#9933CC.#9933FF.#99CC00.#99CC33.#CC0000.#CC0033.#CC0066.#CC0099.#CC00CC.#CC00FF.#CC3300.#CC3333.#CC3366.#CC3399.#CC33CC.#CC33FF.#CC6600.#CC6633.#CC9900.#CC9933.#CCCC00.#CCCC33.#FF0000.#FF0033.#FF0066.#FF0099.#FF00CC.#FF00FF.#FF3300.#FF3333.#FF3366.#FF3399.#FF33CC.#FF33FF.#FF6600.#FF6633.#FF9900.#FF9933.#FFCC00.#FFCC33`.split(`.`);function n(){if(typeof window<`u`&&window.process&&(window.process.type===`renderer`||window.process.__nwjs))return!0;if(typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<`u`&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<`u`&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<`u`&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(e){if(e[0]=(this.useColors?`%c`:``)+this.namespace+(this.useColors?` %c`:` `)+e[0]+(this.useColors?`%c `:` `)+`+`+t.exports.humanize(this.diff),!this.useColors)return;let n=`color: `+this.color;e.splice(1,0,n,`color: inherit`);let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{e!==`%%`&&(r++,e===`%c`&&(i=r))}),e.splice(i,0,n)}e.log=console.debug||console.log||(()=>{});function i(t){try{t?e.storage.setItem(`debug`,t):e.storage.removeItem(`debug`)}catch{}}function a(){let t;try{t=e.storage.getItem(`debug`)||e.storage.getItem(`DEBUG`)}catch{}return!t&&typeof process<`u`&&`env`in process&&(t=process.env.DEBUG),t}function o(){try{return localStorage}catch{}}t.exports=p()(e);let{formatters:s}=t.exports;s.j=function(e){try{return JSON.stringify(e)}catch(e){return`[UnexpectedJSONParseError]: `+e.message}}})),ee=n(((e,t)=>{t.exports=(e,t=process.argv)=>{let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)}})),te=n(((t,n)=>{let r=e(`os`),i=e(`tty`),a=ee(),{env:o}=process,s;a(`no-color`)||a(`no-colors`)||a(`color=false`)||a(`color=never`)?s=0:(a(`color`)||a(`colors`)||a(`color=true`)||a(`color=always`))&&(s=1),`FORCE_COLOR`in o&&(s=o.FORCE_COLOR===`true`?1:o.FORCE_COLOR===`false`?0:o.FORCE_COLOR.length===0?1:Math.min(parseInt(o.FORCE_COLOR,10),3));function c(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function l(e,t){if(s===0)return 0;if(a(`color=16m`)||a(`color=full`)||a(`color=truecolor`))return 3;if(a(`color=256`))return 2;if(e&&!t&&s===void 0)return 0;let n=s||0;if(o.TERM===`dumb`)return n;if(process.platform===`win32`){let e=r.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in o)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`].some(e=>e in o)||o.CI_NAME===`codeship`?1:n;if(`TEAMCITY_VERSION`in o)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(o.TEAMCITY_VERSION);if(o.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in o){let e=parseInt((o.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(o.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(o.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(o.TERM)||`COLORTERM`in o?1:n}function u(e){return c(l(e,e&&e.isTTY))}n.exports={supportsColor:u,stdout:c(l(!0,i.isatty(1))),stderr:c(l(!0,i.isatty(2)))}})),ne=n(((t,n)=>{let r=e(`tty`),i=e(`util`);t.init=d,t.log=c,t.formatArgs=o,t.save=l,t.load=u,t.useColors=a,t.destroy=i.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{let e=te();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}t.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase()),r=process.env[t];return r=/^(yes|on|true|enabled)$/i.test(r)?!0:/^(no|off|false|disabled)$/i.test(r)?!1:r===`null`?null:Number(r),e[n]=r,e},{});function a(){return`colors`in t.inspectOpts?!!t.inspectOpts.colors:r.isatty(process.stderr.fd)}function o(e){let{namespace:t,useColors:r}=this;if(r){let r=this.color,i=`\x1B[3`+(r<8?r:`8;5;`+r),a=` ${i};1m${t} \u001B[0m`;e[0]=a+e[0].split(`
1
+ import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{mo as r}from"./src-CHSJwcpc.mjs";import{delimiter as i,normalize as a,resolve as o}from"node:path";import{existsSync as s,statSync as c}from"node:fs";import{homedir as l}from"node:os";import{EventEmitter as u}from"node:events";import{spawn as d}from"child_process";var f=n(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}})),p=n(((e,t)=>{function n(e){n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=i,n.enabled=s,n.humanize=f(),n.destroy=l,Object.keys(e).forEach(t=>{n[t]=e[t]}),n.names=[],n.skips=[],n.formatters={};function t(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]}n.selectColor=t;function n(e){let t,i=null,a,o;function s(...e){if(!s.enabled)return;let r=s,i=Number(new Date);r.diff=i-(t||i),r.prev=t,r.curr=i,t=i,e[0]=n.coerce(e[0]),typeof e[0]!=`string`&&e.unshift(`%O`);let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,i)=>{if(t===`%%`)return`%`;a++;let o=n.formatters[i];if(typeof o==`function`){let n=e[a];t=o.call(r,n),e.splice(a,1),a--}return t}),n.formatArgs.call(r,e),(r.log||n.log).apply(r,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=r,s.destroy=n.destroy,Object.defineProperty(s,`enabled`,{enumerable:!0,configurable:!1,get:()=>i===null?(a!==n.namespaces&&(a=n.namespaces,o=n.enabled(e)),o):i,set:e=>{i=e}}),typeof n.init==`function`&&n.init(s),s}function r(e,t){let r=n(this.namespace+(t===void 0?`:`:t)+e);return r.log=this.log,r}function i(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];let t=(typeof e==`string`?e:``).trim().replace(/\s+/g,`,`).split(`,`).filter(Boolean);for(let e of t)e[0]===`-`?n.skips.push(e.slice(1)):n.names.push(e)}function a(e,t){let n=0,r=0,i=-1,a=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||t[r]===`*`))t[r]===`*`?(i=r,a=n,r++):(n++,r++);else if(i!==-1)r=i+1,a++,n=a;else return!1;for(;r<t.length&&t[r]===`*`;)r++;return r===t.length}function o(){let e=[...n.names,...n.skips.map(e=>`-`+e)].join(`,`);return n.enable(``),e}function s(e){for(let t of n.skips)if(a(e,t))return!1;for(let t of n.names)if(a(e,t))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}t.exports=n})),m=n(((e,t)=>{e.formatArgs=r,e.save=i,e.load=a,e.useColors=n,e.storage=o(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=`#0000CC.#0000FF.#0033CC.#0033FF.#0066CC.#0066FF.#0099CC.#0099FF.#00CC00.#00CC33.#00CC66.#00CC99.#00CCCC.#00CCFF.#3300CC.#3300FF.#3333CC.#3333FF.#3366CC.#3366FF.#3399CC.#3399FF.#33CC00.#33CC33.#33CC66.#33CC99.#33CCCC.#33CCFF.#6600CC.#6600FF.#6633CC.#6633FF.#66CC00.#66CC33.#9900CC.#9900FF.#9933CC.#9933FF.#99CC00.#99CC33.#CC0000.#CC0033.#CC0066.#CC0099.#CC00CC.#CC00FF.#CC3300.#CC3333.#CC3366.#CC3399.#CC33CC.#CC33FF.#CC6600.#CC6633.#CC9900.#CC9933.#CCCC00.#CCCC33.#FF0000.#FF0033.#FF0066.#FF0099.#FF00CC.#FF00FF.#FF3300.#FF3333.#FF3366.#FF3399.#FF33CC.#FF33FF.#FF6600.#FF6633.#FF9900.#FF9933.#FFCC00.#FFCC33`.split(`.`);function n(){if(typeof window<`u`&&window.process&&(window.process.type===`renderer`||window.process.__nwjs))return!0;if(typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<`u`&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<`u`&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<`u`&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(e){if(e[0]=(this.useColors?`%c`:``)+this.namespace+(this.useColors?` %c`:` `)+e[0]+(this.useColors?`%c `:` `)+`+`+t.exports.humanize(this.diff),!this.useColors)return;let n=`color: `+this.color;e.splice(1,0,n,`color: inherit`);let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{e!==`%%`&&(r++,e===`%c`&&(i=r))}),e.splice(i,0,n)}e.log=console.debug||console.log||(()=>{});function i(t){try{t?e.storage.setItem(`debug`,t):e.storage.removeItem(`debug`)}catch{}}function a(){let t;try{t=e.storage.getItem(`debug`)||e.storage.getItem(`DEBUG`)}catch{}return!t&&typeof process<`u`&&`env`in process&&(t=process.env.DEBUG),t}function o(){try{return localStorage}catch{}}t.exports=p()(e);let{formatters:s}=t.exports;s.j=function(e){try{return JSON.stringify(e)}catch(e){return`[UnexpectedJSONParseError]: `+e.message}}})),ee=n(((e,t)=>{t.exports=(e,t=process.argv)=>{let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)}})),te=n(((t,n)=>{let r=e(`os`),i=e(`tty`),a=ee(),{env:o}=process,s;a(`no-color`)||a(`no-colors`)||a(`color=false`)||a(`color=never`)?s=0:(a(`color`)||a(`colors`)||a(`color=true`)||a(`color=always`))&&(s=1),`FORCE_COLOR`in o&&(s=o.FORCE_COLOR===`true`?1:o.FORCE_COLOR===`false`?0:o.FORCE_COLOR.length===0?1:Math.min(parseInt(o.FORCE_COLOR,10),3));function c(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function l(e,t){if(s===0)return 0;if(a(`color=16m`)||a(`color=full`)||a(`color=truecolor`))return 3;if(a(`color=256`))return 2;if(e&&!t&&s===void 0)return 0;let n=s||0;if(o.TERM===`dumb`)return n;if(process.platform===`win32`){let e=r.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in o)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`].some(e=>e in o)||o.CI_NAME===`codeship`?1:n;if(`TEAMCITY_VERSION`in o)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(o.TEAMCITY_VERSION);if(o.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in o){let e=parseInt((o.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(o.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(o.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(o.TERM)||`COLORTERM`in o?1:n}function u(e){return c(l(e,e&&e.isTTY))}n.exports={supportsColor:u,stdout:c(l(!0,i.isatty(1))),stderr:c(l(!0,i.isatty(2)))}})),ne=n(((t,n)=>{let r=e(`tty`),i=e(`util`);t.init=d,t.log=c,t.formatArgs=o,t.save=l,t.load=u,t.useColors=a,t.destroy=i.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{let e=te();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}t.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase()),r=process.env[t];return r=/^(yes|on|true|enabled)$/i.test(r)?!0:/^(no|off|false|disabled)$/i.test(r)?!1:r===`null`?null:Number(r),e[n]=r,e},{});function a(){return`colors`in t.inspectOpts?!!t.inspectOpts.colors:r.isatty(process.stderr.fd)}function o(e){let{namespace:t,useColors:r}=this;if(r){let r=this.color,i=`\x1B[3`+(r<8?r:`8;5;`+r),a=` ${i};1m${t} \u001B[0m`;e[0]=a+e[0].split(`
2
2
  `).join(`
3
3
  `+a),e.push(i+`m+`+n.exports.humanize(this.diff)+`\x1B[0m`)}else e[0]=s()+t+` `+e[0]}function s(){return t.inspectOpts.hideDate?``:new Date().toISOString()+` `}function c(...e){return process.stderr.write(i.formatWithOptions(t.inspectOpts,...e)+`
4
4
  `)}function l(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function u(){return process.env.DEBUG}function d(e){e.inspectOpts={};let n=Object.keys(t.inspectOpts);for(let r=0;r<n.length;r++)e.inspectOpts[n[r]]=t.inspectOpts[n[r]]}n.exports=p()(t);let{formatters:f}=n.exports;f.o=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts).split(`
@@ -7,4 +7,4 @@ import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{mo as r}from"./src
7
7
  `)){let e=it(i,`
8
8
  `);a=e[0],i=e[1]}yield{file:r,key:a,value:i}}}var Tn,En=S({"src/lib/responses/ConfigList.ts"(){q(),Tn=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||=this.files.reduce((e,t)=>Object.assign(e,this.values[t]),{}),this._all}addFile(e){if(!(e in this.values)){let t=O(this.files);this.values[e]=t?Object.create(this.values[t]):{},this.files.push(e)}return this.values[e]}addValue(e,t,n){let r=this.addFile(e);Object.hasOwn(r,t)?Array.isArray(r[t])?r[t].push(n):r[t]=[r[t],n]:r[t]=n,this._all=void 0}}}});function Dn(e,t){return typeof e==`string`&&Object.hasOwn(Mn,e)?e:t}function On(e,t,n,r){let i=[`config`,`--${r}`];return n&&i.push(`--add`),i.push(e,t),{commands:i,format:`utf-8`,parser(e){return e}}}function kn(e,t){let n=[`config`,`--null`,`--show-origin`,`--get-all`,e];return t&&n.splice(1,0,`--${t}`),{commands:n,format:`utf-8`,parser(t){return Sn(t,e)}}}function An(e){let t=[`config`,`--list`,`--show-origin`,`--null`];return e&&t.push(`--${e}`),{commands:t,format:`utf-8`,parser(e){return xn(e)}}}function jn(){return{addConfig(e,t,...n){return this._runTask(On(e,t,n[0]===!0,Dn(n[1],`local`)),G(arguments))},getConfig(e,t){return this._runTask(kn(e,Dn(t,void 0)),G(arguments))},listConfig(...e){return this._runTask(An(Dn(e[0],void 0)),G(arguments))}}}var Mn,Nn=S({"src/lib/tasks/config.ts"(){En(),q(),Mn=(e=>(e.system=`system`,e.global=`global`,e.local=`local`,e.worktree=`worktree`,e))(Mn||{})}});function Pn(e){return In.has(e)}var Fn,In,Ln=S({"src/lib/tasks/diff-name-status.ts"(){Fn=(e=>(e.ADDED=`A`,e.COPIED=`C`,e.DELETED=`D`,e.MODIFIED=`M`,e.RENAMED=`R`,e.CHANGED=`T`,e.UNMERGED=`U`,e.UNKNOWN=`X`,e.BROKEN=`B`,e))(Fn||{}),In=new Set(Object.values(Fn))}});function Rn(...e){return new Wn().param(...e)}function zn(e){let t=new Set,n={};return st(e,e=>{let[r,i,a]=e.split(I);t.add(r),(n[r]=n[r]||[]).push({line:N(i),path:r,preview:a})}),{paths:t,results:n}}function Bn(){return{grep(e){let t=G(arguments),n=W(arguments);for(let e of Vn)if(n.includes(e))return this._runTask(J(`git.grep: use of "${e}" is not supported.`),t);typeof e==`string`&&(e=Rn().param(e));let r=[`grep`,`--null`,`-n`,`--full-name`,...n,...e];return this._runTask({commands:r,format:`utf-8`,parser(e){return zn(e)}},t)}}}var Vn,Hn,Un,Wn,Gn=S({"src/lib/tasks/grep.ts"(){q(),X(),Vn=[`-h`],Hn=Symbol(`grepQuery`),Wn=class{constructor(){this[Un]=[]}*[(Un=Hn,Symbol.iterator)](){for(let e of this[Hn])yield e}and(...e){return e.length&&this[Hn].push(`--and`,`(`,...P(e,`-e`),`)`),this}param(...e){return this[Hn].push(...P(e,`-e`)),this}}}}),Kn={};C(Kn,{ResetMode:()=>Xn,getResetMode:()=>Jn,resetTask:()=>qn});function qn(e,t){let n=[`reset`];return Yn(e)&&n.push(`--${e}`),n.push(...t),Y(n)}function Jn(e){if(Yn(e))return e;switch(typeof e){case`string`:case`undefined`:return`soft`}}function Yn(e){return typeof e==`string`&&Zn.includes(e)}var Xn,Zn,Qn=S({"src/lib/tasks/reset.ts"(){q(),X(),Xn=(e=>(e.MIXED=`mixed`,e.SOFT=`soft`,e.HARD=`hard`,e.MERGE=`merge`,e.KEEP=`keep`,e))(Xn||{}),Zn=M(Object.values(Xn))}});function $n(){return(0,ue.default)(`simple-git`)}function er(e,t,n){return!t||!String(t).replace(/\s*/,``)?n?(t,...r)=>{e(t,...r),n(t,...r)}:e:(r,...i)=>{e(`%s ${r}`,t,...i),n&&n(r,...i)}}function tr(e,t,{namespace:n}){if(typeof e==`string`)return e;let r=t&&t.namespace||``;return r.startsWith(n)?r.substr(n.length+1):r||n}function nr(e,t,n,r=$n()){let i=e&&`[${e}]`||``,a=[],o=typeof t==`string`?r.extend(t):t,s=tr(z(t,V),o,r);return l(n);function c(t,n){return A(a,nr(e,s.replace(/^[^:]+/,t),n,r))}function l(t){let n=t&&`[${t}]`||``,a=o&&er(o,n)||L,s=er(r,`${i} ${n}`,a);return Object.assign(o?a:s,{label:e,sibling:c,info:s,step:l})}}var rr=S({"src/lib/git-logger.ts"(){q(),ue.default.formatters.L=e=>String(xt(e)?e.length:`-`),ue.default.formatters.B=e=>Buffer.isBuffer(e)?e.toString(`utf8`):R(e)}}),ir,ar=S({"src/lib/runners/tasks-pending-queue.ts"(){E(),rr(),ir=class e{constructor(e=`GitExecutor`){this.logLabel=e,this._queue=new Map}withProgress(e){return this._queue.get(e)}createProgress(t){let n=e.getName(t.commands[0]);return{task:t,logger:nr(this.logLabel,n),name:n}}push(e){let t=this.createProgress(e);return t.logger(`Adding task to the queue, commands = %o`,e.commands),this._queue.set(e,t),t}fatal(e){for(let[t,{logger:n}]of Array.from(this._queue.entries()))t===e.task?(n.info(`Failed %o`,e),n(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`)):n.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`,e.message),this.complete(t);if(this._queue.size!==0)throw Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(e){this.withProgress(e)&&this._queue.delete(e)}attempt(e){let t=this.withProgress(e);if(!t)throw new T(void 0,`TasksPendingQueue: attempt called for an unknown task`);return t.logger(`Starting task`),t}static getName(t=`empty`){return`task:${t}:${++e.counter}`}static{this.counter=0}}}});function Z(e,t){return{method:at(e.commands)||``,commands:t}}function or(e,t){return n=>{t(`[ERROR] child process exception %o`,n),e.push(Buffer.from(String(n.stack),`ascii`))}}function sr(e,t,n,r){return i=>{n(`%s received %L bytes`,t,i),r(`%B`,i),e.push(i)}}var cr,lr=S({"src/lib/runners/git-executor-chain.ts"(){E(),X(),q(),ar(),cr=class{constructor(e,t,n){this._executor=e,this._scheduler=t,this._plugins=n,this._chain=Promise.resolve(),this._queue=new ir}get cwd(){return this._cwd||this._executor.cwd}set cwd(e){this._cwd=e}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(e){return this._queue.push(e),this._chain=this._chain.then(()=>this.attemptTask(e))}async attemptTask(e){let t=await this._scheduler.next(),n=()=>this._queue.complete(e);try{let{logger:t}=this._queue.attempt(e);return await(an(e)?this.attemptEmptyTask(e,t):this.attemptRemoteTask(e,t))}catch(t){throw this.onFatalException(e,t)}finally{n(),t()}}onFatalException(e,t){let n=t instanceof T?Object.assign(t,{task:e}):new T(e,t&&String(t));return this._chain=Promise.resolve(),this._queue.fatal(n),n}async attemptRemoteTask(e,t){let n=this._plugins.exec(`spawn.binary`,``,Z(e,e.commands)),r=this._plugins.exec(`spawn.args`,[...e.commands],{...Z(e,e.commands),env:{...this.env}}),i=await this.gitResponse(e,n,r,this.outputHandler,t.step(`SPAWN`)),a=await this.handleTaskData(e,r,i,t.step(`HANDLE`));return t(`passing response to task's parser as a %s`,e.format),rn(e)?It(e.parser,a):It(e.parser,a.asStrings())}async attemptEmptyTask(e,t){return t(`empty task bypassing child process to call to task's parser`),e.parser(this)}handleTaskData(e,t,n,r){let{exitCode:i,rejection:a,stdOut:o,stdErr:s}=n;return new Promise((c,l)=>{r(`Preparing to handle process response exitCode=%d stdOut=`,i);let{error:u}=this._plugins.exec(`task.error`,{error:a},{...Z(e,t),...n});if(u&&e.onError)return r.info(`exitCode=%s handling with custom error handler`),e.onError(n,u,e=>{r.info(`custom error handler treated as success`),r(`custom error returned a %s`,R(e)),c(new Tt(Array.isArray(e)?Buffer.concat(e):e,Buffer.concat(s)))},l);if(u)return r.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`,i,s.length,a),l(u);r.info(`retrieving task output complete`),c(new Tt(Buffer.concat(o),Buffer.concat(s)))})}async gitResponse(e,t,n,r,i){let a=i.sibling(`output`),o=this._plugins.exec(`spawn.options`,{cwd:this.cwd,env:this.env,windowsHide:!0},Z(e,e.commands));return new Promise(s=>{let c=[],l=[];i.info(`%s %o`,t,n),i(`%O`,o);let u=this._beforeSpawn(e,n);if(u)return s({stdOut:c,stdErr:l,exitCode:9901,rejection:u});this._plugins.exec(`spawn.before`,void 0,{...Z(e,n),kill(e){u=e||u}});let f=d(t,n,o);f.stdout.on(`data`,sr(c,`stdOut`,i,a.step(`stdOut`))),f.stderr.on(`data`,sr(l,`stdErr`,i,a.step(`stdErr`))),f.on(`error`,or(l,i)),r&&(i(`Passing child process stdOut/stdErr to custom outputHandler`),r(t,f.stdout,f.stderr,[...n])),this._plugins.exec(`spawn.after`,void 0,{...Z(e,n),spawned:f,close(e,t){s({stdOut:c,stdErr:l,exitCode:e,rejection:u||t})},kill(e){f.killed||(u=e,f.kill(`SIGINT`))}})})}_beforeSpawn(e,t){let n;return this._plugins.exec(`spawn.before`,void 0,{...Z(e,t),kill(e){n=e||n}}),n}}}}),ur={};C(ur,{GitExecutor:()=>dr});var dr,fr=S({"src/lib/runners/git-executor.ts"(){lr(),dr=class{constructor(e,t,n){this.cwd=e,this._scheduler=t,this._plugins=n,this._chain=new cr(this,this._scheduler,this._plugins)}chain(){return new cr(this,this._scheduler,this._plugins)}push(e){return this._chain.push(e)}}}});function pr(e,t,n=L){t.then(e=>{n(null,e)},t=>{t?.task===e&&n(t instanceof $e?mr(t):t,void 0)})}function mr(e){let t=e=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${e} should be GitResponseError.git.${e}, this will no longer be available in version 3`),t=L};return Object.create(e,Object.getOwnPropertyNames(e.git).reduce(n,{}));function n(n,r){return r in e||(n[r]={enumerable:!1,configurable:!1,get(){return t(r),e.git[r]}}),n}}var hr=S({"src/lib/task-callback.ts"(){D(),q()}});function gr(e,t){return tn(n=>{if(!ct(e))throw Error(`Git.cwd: cannot change to non-directory "${e}"`);return(t||n).cwd=e})}var _r=S({"src/lib/tasks/change-working-directory.ts"(){q(),X()}});function vr(e){let t=[`checkout`,...e];return t[1]===`-b`&&t.includes(`-B`)&&(t[1]=ut(t,`-B`)),Y(t)}function yr(){return{checkout(){return this._runTask(vr(W(arguments,1)),G(arguments))},checkoutBranch(e,t){return this._runTask(vr([`-b`,e,t,...W(arguments)]),G(arguments))},checkoutLocalBranch(e){return this._runTask(vr([`-b`,e,...W(arguments)]),G(arguments))}}}var br=S({"src/lib/tasks/checkout.ts"(){q(),X()}});function xr(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function Sr(){return{countObjects(){return this._runTask({commands:[`count-objects`,`--verbose`],format:`utf-8`,parser(e){return K(xr(),[Cr],e)}})}}}var Cr,wr=S({"src/lib/tasks/count-objects.ts"(){q(),Cr=new H(/([a-z-]+): (\d+)$/,(e,[t,n])=>{let r=dt(t);Object.hasOwn(e,r)&&(e[r]=N(n))})}});function Tr(e){return K({author:null,branch:``,commit:``,root:!1,summary:{changes:0,insertions:0,deletions:0}},Er,e)}var Er,Dr=S({"src/lib/parsers/parse-commit.ts"(){q(),Er=[new H(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(e,[t,n,r])=>{e.branch=t,e.commit=r,e.root=!!n}),new H(/\s*Author:\s(.+)/i,(e,[t])=>{let n=t.split(`<`),r=n.pop();!r||!r.includes(`@`)||(e.author={email:r.substr(0,r.length-1),name:n.join(`<`).trim()})}),new H(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(e,[t,n,r])=>{e.summary.changes=parseInt(t,10)||0,e.summary.insertions=parseInt(n,10)||0,e.summary.deletions=parseInt(r,10)||0}),new H(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(e,[t,n,r])=>{e.summary.changes=parseInt(t,10)||0;let i=parseInt(n,10)||0;r===`-`?e.summary.deletions=i:r===`+`&&(e.summary.insertions=i)})]}});function Or(e,t,n){return{commands:[`-c`,`core.abbrev=40`,`commit`,...P(e,`-m`),...t,...n],format:`utf-8`,parser:Tr}}function kr(){return{commit(t,...n){let r=G(arguments),i=e(t)||Or(j(t),j(z(n[0],bt,[])),[...M(z(n[1],B,[])),...W(arguments,0,!0)]);return this._runTask(i,r)}};function e(e){return!bt(e)&&J(`git.commit: requires the commit message to be supplied as a string/string[]`)}}var Ar=S({"src/lib/tasks/commit.ts"(){Dr(),q(),X()}});function jr(){return{firstCommit(){return this._runTask(Y([`rev-list`,`--max-parents=0`,`HEAD`],!0),G(arguments))}}}var Mr=S({"src/lib/tasks/first-commit.ts"(){q(),X()}});function Nr(e,t){let n=[`hash-object`,e];return t&&n.push(`-w`),Y(n,!0)}var Pr=S({"src/lib/tasks/hash-object.ts"(){X()}});function Fr(e,t,n){let r=String(n).trim(),i;if(i=Lr.exec(r))return new Ir(e,t,!1,i[1]);if(i=Rr.exec(r))return new Ir(e,t,!0,i[1]);let a=``,o=r.split(` `);for(;o.length;)if(o.shift()===`in`){a=o.join(` `);break}return new Ir(e,t,/^re/i.test(r),a)}var Ir,Lr,Rr,zr=S({"src/lib/responses/InitSummary.ts"(){Ir=class{constructor(e,t,n,r){this.bare=e,this.path=t,this.existing=n,this.gitDir=r}},Lr=/^Init.+ repository in (.+)$/,Rr=/^Rein.+ in (.+)$/}});function Br(e){return e.includes(Hr)}function Vr(e=!1,t,n){let r=[`init`,...n];return e&&!Br(r)&&r.splice(1,0,Hr),{commands:r,format:`utf-8`,parser(e){return Fr(r.includes(`--bare`),t,e)}}}var Hr,Ur=S({"src/lib/tasks/init.ts"(){zr(),Hr=`--bare`}});function Wr(e){for(let t=0;t<e.length;t++){let n=Kr.exec(e[t]);if(n)return`--${n[1]}`}return``}function Gr(e){return Kr.test(e)}var Kr,qr=S({"src/lib/args/log-format.ts"(){Kr=/^--(stat|numstat|name-only|name-status)(=|$)/}}),Jr,Yr=S({"src/lib/responses/DiffSummary.ts"(){Jr=class{constructor(){this.changed=0,this.deletions=0,this.insertions=0,this.files=[]}}}});function Xr(e=``){let t=ti[e];return e=>K(new Jr,t,e,!1)}var Zr,Qr,$r,ei,ti,ni=S({"src/lib/parsers/parse-diff-summary.ts"(){qr(),Yr(),Ln(),q(),Zr=[new H(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(e,[t,n,r=``])=>{e.files.push({file:t.trim(),changes:N(n),insertions:r.replace(/[^+]/g,``).length,deletions:r.replace(/[^-]/g,``).length,binary:!1})}),new H(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(e,[t,n,r])=>{e.files.push({file:t.trim(),before:N(n),after:N(r),binary:!0})}),new H(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(e,[t,n])=>{let r=/(\d+) i/.exec(n),i=/(\d+) d/.exec(n);e.changed=N(t),e.insertions=N(r?.[1]),e.deletions=N(i?.[1])})],Qr=[new H(/(\d+)\t(\d+)\t(.+)$/,(e,[t,n,r])=>{let i=N(t),a=N(n);e.changed++,e.insertions+=i,e.deletions+=a,e.files.push({file:r,changes:i+a,insertions:i,deletions:a,binary:!1})}),new H(/-\t-\t(.+)$/,(e,[t])=>{e.changed++,e.files.push({file:t,after:0,before:0,binary:!0})})],$r=[new H(/(.+)$/,(e,[t])=>{e.changed++,e.files.push({file:t,changes:0,insertions:0,deletions:0,binary:!1})})],ei=[new H(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(e,[t,n,r,i,a])=>{e.changed++,e.files.push({file:a??r,changes:0,insertions:0,deletions:0,binary:!1,status:mt(Pn(t)&&t),from:mt(!!a&&r!==a&&r),similarity:N(n)})})],ti={"":Zr,"--stat":Zr,"--numstat":Qr,"--name-status":ei,"--name-only":$r}}});function ri(e,t){return t.reduce((t,n,r)=>(t[n]=e[r]||``,t),Object.create({diff:null}))}function ii(e=si,t=ci,n=``){let r=Xr(n);return function(n){let i=k(n.trim(),!1,ai).map(function(n){let i=n.split(oi),a=ri(i[0].split(e),t);return i.length>1&&i[1].trim()&&(a.diff=r(i[1])),a});return{all:i,latest:i.length&&i[0]||null,total:i.length}}}var ai,oi,si,ci,li=S({"src/lib/parsers/parse-list-log-summary.ts"(){q(),ni(),qr(),ai=`òòòòòò `,oi=` òò`,si=` ò `,ci=[`hash`,`date`,`message`,`refs`,`author_name`,`author_email`]}}),ui={};C(ui,{diffSummaryTask:()=>di,validateLogFormatConfig:()=>fi});function di(e){let t=Wr(e),n=[`diff`];return t===``&&(t=`--stat`,n.push(`--stat=4096`)),n.push(...e),fi(n)||{commands:n,format:`utf-8`,parser:Xr(t)}}function fi(e){let t=e.filter(Gr);if(t.length>1)return J(`Summary flags are mutually exclusive - pick one of ${t.join(`,`)}`);if(t.length&&e.includes(`-z`))return J(`Summary flag ${t} parsing is not compatible with null termination option '-z'`)}var pi=S({"src/lib/tasks/diff.ts"(){qr(),ni(),X()}});function mi(e,t){let n=[],r=[];return Object.keys(e).forEach(t=>{n.push(t),r.push(String(e[t]))}),[n,r.join(t)]}function hi(e){return Object.keys(e).reduce((t,n)=>(n in yi||(t[n]=e[n]),t),{})}function gi(e={},t=[]){let n=z(e.splitter,V,si),[r,i]=mi(_t(e.format)?e.format:{hash:`%H`,date:e.strictDate===!1?`%ai`:`%aI`,message:`%s`,refs:`%D`,body:e.multiLine?`%B`:`%b`,author_name:e.mailMap===!1?`%an`:`%aN`,author_email:e.mailMap===!1?`%ae`:`%aE`},n),a=[],o=[`--pretty=format:${ai}${i}${oi}`,...t],s=e.n||e[`max-count`]||e.maxCount;if(s&&o.push(`--max-count=${s}`),e.from||e.to){let t=e.symmetric===!1?`..`:`...`;a.push(`${e.from||``}${t}${e.to||``}`)}return V(e.file)&&o.push(`--follow`,se(e.file)),Mt(hi(e),o),{fields:r,splitter:n,commands:[...o,...a]}}function _i(e,t,n){let r=ii(e,t,Wr(n));return{commands:[`log`,...n],format:`utf-8`,parser:r}}function vi(){return{log(...n){let r=G(arguments),i=gi(Pt(arguments),M(z(arguments[0],B,[]))),a=t(...n)||fi(i.commands)||e(i);return this._runTask(a,r)}};function e(e){return _i(e.splitter,e.fields,e.commands)}function t(e,t){return V(e)&&V(t)&&J(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`)}}var yi,bi=S({"src/lib/tasks/log.ts"(){qr(),li(),q(),X(),pi(),yi=(e=>(e[e[`--pretty`]=0]=`--pretty`,e[e[`max-count`]=1]=`max-count`,e[e.maxCount=2]=`maxCount`,e[e.n=3]=`n`,e[e.file=4]=`file`,e[e.format=5]=`format`,e[e.from=6]=`from`,e[e.to=7]=`to`,e[e.splitter=8]=`splitter`,e[e.symmetric=9]=`symmetric`,e[e.mailMap=10]=`mailMap`,e[e.multiLine=11]=`multiLine`,e[e.strictDate=12]=`strictDate`,e))(yi||{})}}),xi,Si,Ci=S({"src/lib/responses/MergeSummary.ts"(){xi=class{constructor(e,t=null,n){this.reason=e,this.file=t,this.meta=n}toString(){return`${this.file}:${this.reason}`}},Si=class{constructor(){this.conflicts=[],this.merges=[],this.result=`success`}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){return this.conflicts.length?`CONFLICTS: ${this.conflicts.join(`, `)}`:`OK`}}}}),wi,Ti,Ei=S({"src/lib/responses/PullSummary.ts"(){wi=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},Ti=class{constructor(){this.remote=``,this.hash={local:``,remote:``},this.branch={local:``,remote:``},this.message=``}toString(){return this.message}}}});function Di(e){return e.objects=e.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function Oi(e){let t=/^\s*(\d+)/.exec(e),n=/delta (\d+)/i.exec(e);return{count:N(t&&t[1]||`0`),delta:N(n&&n[1]||`0`)}}var ki,Ai=S({"src/lib/parsers/parse-remote-objects.ts"(){q(),ki=[new U(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(e,[t,n])=>{let r=t.toLowerCase(),i=Di(e.remoteMessages);Object.assign(i,{[r]:N(n)})}),new U(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(e,[t,n])=>{let r=t.toLowerCase(),i=Di(e.remoteMessages);Object.assign(i,{[r]:N(n)})}),new U(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(e,[t,n,r])=>{let i=Di(e.remoteMessages);i.total=Oi(t),i.reused=Oi(n),i.packReused=N(r)})]}});function ji(e,t){return K({remoteMessages:new Ni},Mi,t)}var Mi,Ni,Pi=S({"src/lib/parsers/parse-remote-messages.ts"(){q(),Ai(),Mi=[new U(/^remote:\s*(.+)$/,(e,[t])=>(e.remoteMessages.all.push(t.trim()),!1)),...ki,new U([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(e,[t])=>{e.remoteMessages.pullRequestUrl=t}),new U([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(e,[t,n,r])=>{e.remoteMessages.vulnerabilities={count:N(t),summary:n,url:r}})],Ni=class{constructor(){this.all=[]}}}});function Fi(e,t){let n=K(new Ti,Bi,[e,t]);return n.message&&n}var Ii,Li,Ri,zi,Bi,Vi,Hi,Ui=S({"src/lib/parsers/parse-pull.ts"(){Ei(),q(),Pi(),Ii=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,Li=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,Ri=/^(create|delete) mode \d+ (.+)/,zi=[new H(Ii,(e,[t,n,r])=>{e.files.push(t),n&&(e.insertions[t]=n.length),r&&(e.deletions[t]=r.length)}),new H(Li,(e,[t,,n,,r])=>n!==void 0||r!==void 0?(e.summary.changes=+t||0,e.summary.insertions=+n||0,e.summary.deletions=+r||0,!0):!1),new H(Ri,(e,[t,n])=>{A(e.files,n),A(t===`create`?e.created:e.deleted,n)})],Bi=[new H(/^from\s(.+)$/i,(e,[t])=>void(e.remote=t)),new H(/^fatal:\s(.+)$/,(e,[t])=>void(e.message=t)),new H(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(e,[t,n,r,i])=>{e.branch.local=r,e.hash.local=t,e.branch.remote=i,e.hash.remote=n})],Vi=(e,t)=>K(new wi,zi,[e,t]),Hi=(e,t)=>Object.assign(new wi,Vi(e,t),ji(e,t))}}),Wi,Gi,Ki,qi=S({"src/lib/parsers/parse-merge.ts"(){Ci(),q(),Ui(),Wi=[new H(/^Auto-merging\s+(.+)$/,(e,[t])=>{e.merges.push(t)}),new H(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(e,[t,n])=>{e.conflicts.push(new xi(t,n))}),new H(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(e,[t,n,r])=>{e.conflicts.push(new xi(t,n,{deleteRef:r}))}),new H(/^CONFLICT\s+\((.+)\):/,(e,[t])=>{e.conflicts.push(new xi(t,null))}),new H(/^Automatic merge failed;\s+(.+)$/,(e,[t])=>{e.result=t})],Gi=(e,t)=>Object.assign(Ki(e,t),Hi(e,t)),Ki=e=>K(new Si,Wi,e)}});function Ji(e){return e.length?{commands:[`merge`,...e],format:`utf-8`,parser(e,t){let n=Gi(e,t);if(n.failed)throw new $e(n);return n}}:J(`Git.merge requires at least one option`)}var Yi=S({"src/lib/tasks/merge.ts"(){D(),qi(),X()}});function Xi(e,t,n){let r=n.includes(`deleted`),i=n.includes(`tag`)||/^refs\/tags/.test(e),a=!n.includes(`new`);return{deleted:r,tag:i,branch:!i,new:!a,alreadyUpdated:a,local:e,remote:t}}var Zi,Qi,$i,ea=S({"src/lib/parsers/parse-push.ts"(){q(),Pi(),Zi=[new H(/^Pushing to (.+)$/,(e,[t])=>{e.repo=t}),new H(/^updating local tracking ref '(.+)'/,(e,[t])=>{e.ref={...e.ref||{},local:t}}),new H(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(e,[t,n,r])=>{e.pushed.push(Xi(t,n,r))}),new H(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(e,[t,n,r])=>{e.branch={...e.branch||{},local:t,remote:n,remoteName:r}}),new H(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(e,[t,n,r,i])=>{e.update={head:{local:t,remote:n},hash:{from:r,to:i}}})],Qi=(e,t)=>{let n=$i(e,t),r=ji(e,t);return{...n,...r}},$i=(e,t)=>K({pushed:[]},Zi,[e,t])}}),ta={};C(ta,{pushTagsTask:()=>na,pushTask:()=>ra});function na(e={},t){return A(t,`--tags`),ra(e,t)}function ra(e={},t){let n=[`push`,...t];return e.branch&&n.splice(1,0,e.branch),e.remote&&n.splice(1,0,e.remote),ut(n,`-v`),A(n,`--verbose`),A(n,`--porcelain`),{commands:n,format:`utf-8`,parser:Qi}}var ia=S({"src/lib/tasks/push.ts"(){ea(),q()}});function aa(){return{showBuffer(){let e=[`show`,...W(arguments,1)];return e.includes(`--binary`)||e.splice(1,0,`--binary`),this._runTask(nn(e),G(arguments))},show(){let e=[`show`,...W(arguments,1)];return this._runTask(Y(e),G(arguments))}}}var oa=S({"src/lib/tasks/show.ts"(){q(),X()}}),sa,ca,la=S({"src/lib/responses/FileStatusSummary.ts"(){sa=/^(.+)\0(.+)$/,ca=class{constructor(e,t,n){if(this.path=e,this.index=t,this.working_dir=n,t===`R`||n===`R`){let t=sa.exec(e)||[null,e,e];this.from=t[2]||``,this.path=t[1]||``}}}}});function ua(e){let[t,n]=e.split(I);return{from:n||t,to:t}}function Q(e,t,n){return[`${e}${t}`,n]}function da(e,...t){return t.map(t=>Q(e,t,(e,t)=>e.conflicted.push(t)))}function fa(e,t){let n=t.trim();switch(` `){case n.charAt(2):return r(n.charAt(0),n.charAt(1),n.slice(3));case n.charAt(1):return r(` `,n.charAt(0),n.slice(2));default:return}function r(t,n,r){let i=`${t}${n}`,a=ma.get(i);a&&a(e,r),i!==`##`&&i!==`!!`&&e.files.push(new ca(r,t,n))}}var pa,ma,ha,ga=S({"src/lib/responses/StatusSummary.ts"(){q(),la(),pa=class{constructor(){this.not_added=[],this.conflicted=[],this.created=[],this.deleted=[],this.ignored=void 0,this.modified=[],this.renamed=[],this.files=[],this.staged=[],this.ahead=0,this.behind=0,this.current=null,this.tracking=null,this.detached=!1,this.isClean=()=>!this.files.length}},ma=new Map([Q(` `,`A`,(e,t)=>e.created.push(t)),Q(` `,`D`,(e,t)=>e.deleted.push(t)),Q(` `,`M`,(e,t)=>e.modified.push(t)),Q(`A`,` `,(e,t)=>{e.created.push(t),e.staged.push(t)}),Q(`A`,`M`,(e,t)=>{e.created.push(t),e.staged.push(t),e.modified.push(t)}),Q(`D`,` `,(e,t)=>{e.deleted.push(t),e.staged.push(t)}),Q(`M`,` `,(e,t)=>{e.modified.push(t),e.staged.push(t)}),Q(`M`,`M`,(e,t)=>{e.modified.push(t),e.staged.push(t)}),Q(`R`,` `,(e,t)=>{e.renamed.push(ua(t))}),Q(`R`,`M`,(e,t)=>{let n=ua(t);e.renamed.push(n),e.modified.push(n.to)}),Q(`!`,`!`,(e,t)=>{(e.ignored=e.ignored||[]).push(t)}),Q(`?`,`?`,(e,t)=>e.not_added.push(t)),...da(`A`,`A`,`U`),...da(`D`,`D`,`U`),...da(`U`,`A`,`D`,`U`),[`##`,(e,t)=>{let n=/ahead (\d+)/,r=/behind (\d+)/,i=/^(.+?(?=(?:\.{3}|\s|$)))/,a=/\.{3}(\S*)/,o=/\son\s(\S+?)(?=\.{3}|$)/,s=n.exec(t);e.ahead=s&&+s[1]||0,s=r.exec(t),e.behind=s&&+s[1]||0,s=i.exec(t),e.current=z(s?.[1],V,null),s=a.exec(t),e.tracking=z(s?.[1],V,null),s=o.exec(t),s&&(e.current=z(s?.[1],V,e.current)),e.detached=/\(no branch\)/.test(t)}]]),ha=function(e){let t=e.split(I),n=new pa;for(let e=0,r=t.length;e<r;){let r=t[e++].trim();r&&(r.charAt(0)===`R`&&(r+=I+(t[e++]||``)),fa(n,r))}return n}}});function _a(e){return{format:`utf-8`,commands:[`status`,`--porcelain`,`-b`,`-u`,`--null`,...e.filter(e=>!va.includes(e))],parser(e){return ha(e)}}}var va,ya=S({"src/lib/tasks/status.ts"(){ga(),va=[`--null`,`-z`]}});function ba(e=0,t=0,n=0,r=``,i=!0){return Object.defineProperty({major:e,minor:t,patch:n,agent:r,installed:i},`toString`,{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function xa(){return ba(0,0,0,``,!1)}function Sa(){return{version(){return this._runTask({commands:[`--version`],format:`utf-8`,parser:Ca,onError(e,t,n,r){if(e.exitCode===-2)return n(Buffer.from(wa));r(t)}})}}}function Ca(e){return e===wa?xa():K(ba(0,0,0,e),Ta,e)}var wa,Ta,Ea=S({"src/lib/tasks/version.ts"(){q(),wa=`installed=false`,Ta=[new H(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(e,[t,n,r,i=``])=>{Object.assign(e,ba(N(t),N(n),N(r),i))}),new H(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(e,[t,n,r,i=``])=>{Object.assign(e,ba(N(t),N(n),r,i))})]}});function Da(e,t,n,...r){return V(n)?t(n,z(r[0],V),W(arguments)):J(`git.${e}() requires a string 'repoPath'`)}function Oa(){return{clone(e,...t){return this._runTask(Da(`clone`,ka,z(e,V),...t),G(arguments))},mirror(e,...t){return this._runTask(Da(`mirror`,Aa,z(e,V),...t),G(arguments))}}}var ka,Aa,ja=S({"src/lib/tasks/clone.ts"(){X(),q(),ka=(e,t,n)=>{let r=[`clone`,...n];return V(e)&&r.push(se(e)),V(t)&&r.push(se(t)),Y(r)},Aa=(e,t,n)=>(A(n,`--mirror`),ka(e,t,n))}}),Ma={};C(Ma,{SimpleGitApi:()=>Na});var Na,Pa=S({"src/lib/simple-git-api.ts"(){hr(),_r(),br(),wr(),Ar(),Nn(),Mr(),Gn(),Pr(),Ur(),bi(),Yi(),ia(),oa(),ya(),X(),Ea(),q(),ja(),Na=class{constructor(e){this._executor=e}_runTask(e,t){let n=this._executor.chain(),r=n.push(e);return t&&pr(e,r,t),Object.create(this,{then:{value:r.then.bind(r)},catch:{value:r.catch.bind(r)},_executor:{value:n}})}add(e){return this._runTask(Y([`add`,...j(e)]),G(arguments))}cwd(e){let t=G(arguments);return typeof e==`string`?this._runTask(gr(e,this._executor),t):typeof e?.path==`string`?this._runTask(gr(e.path,e.root&&this._executor||void 0),t):this._runTask(J(`Git.cwd: workingDirectory must be supplied as a string`),t)}hashObject(e,t){return this._runTask(Nr(e,t===!0),G(arguments))}init(e){return this._runTask(Vr(e===!0,this._executor.cwd,W(arguments)),G(arguments))}merge(){return this._runTask(Ji(W(arguments)),G(arguments))}mergeFromTo(e,t){return V(e)&&V(t)?this._runTask(Ji([e,t,...W(arguments)]),G(arguments,!1)):this._runTask(J(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`))}outputHandler(e){return this._executor.outputHandler=e,this}push(){let e=ra({remote:z(arguments[0],V),branch:z(arguments[1],V)},W(arguments));return this._runTask(e,G(arguments))}stash(){return this._runTask(Y([`stash`,...W(arguments)]),G(arguments))}status(){return this._runTask(_a(W(arguments)),G(arguments))}},Object.assign(Na.prototype,yr(),Oa(),kr(),jn(),Sr(),jr(),Bn(),vi(),aa(),Sa())}}),Fa={};C(Fa,{Scheduler:()=>La});var Ia,La,Ra=S({"src/lib/runners/scheduler.ts"(){q(),rr(),Ia=(()=>{let e=0;return()=>{e++;let{promise:t,done:n}=(0,g.createDeferred)();return{promise:t,done:n,id:e}}})(),La=class{constructor(e=2){this.concurrency=e,this.logger=nr(``,`scheduler`),this.pending=[],this.running=[],this.logger(`Constructed, concurrency=%s`,e)}schedule(){if(!this.pending.length||this.running.length>=this.concurrency){this.logger(`Schedule attempt ignored, pending=%s running=%s concurrency=%s`,this.pending.length,this.running.length,this.concurrency);return}let e=A(this.running,this.pending.shift());this.logger(`Attempting id=%s`,e.id),e.done(()=>{this.logger(`Completing id=`,e.id),ut(this.running,e),this.schedule()})}next(){let{promise:e,id:t}=A(this.pending,Ia());return this.logger(`Scheduling id=%s`,t),this.schedule(),e}}}}),za={};C(za,{applyPatchTask:()=>Ba});function Ba(e,t){return Y([`apply`,...t,...e])}var Va=S({"src/lib/tasks/apply-patch.ts"(){X()}});function Ha(e,t){return{branch:e,hash:t,success:!0}}function Ua(e){return{branch:e,hash:null,success:!1}}var Wa,Ga=S({"src/lib/responses/BranchDeleteSummary.ts"(){Wa=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function Ka(e,t){return t===1&&Ja.test(e)}var qa,Ja,Ya,Xa,Za=S({"src/lib/parsers/parse-branch-delete.ts"(){Ga(),q(),qa=/(\S+)\s+\(\S+\s([^)]+)\)/,Ja=/^error[^']+'([^']+)'/m,Ya=[new H(qa,(e,[t,n])=>{let r=Ha(t,n);e.all.push(r),e.branches[t]=r}),new H(Ja,(e,[t])=>{let n=Ua(t);e.errors.push(n),e.all.push(n),e.branches[t]=n})],Xa=(e,t)=>K(new Wa,Ya,[e,t])}}),Qa,$a=S({"src/lib/responses/BranchSummary.ts"(){Qa=class{constructor(){this.all=[],this.branches={},this.current=``,this.detached=!1}push(e,t,n,r,i){e===`*`&&(this.detached=t,this.current=n),this.all.push(n),this.branches[n]={current:e===`*`,linkedWorkTree:e===`+`,name:n,commit:r,label:i}}}}});function eo(e){return e?e.charAt(0):``}function to(e,t=!1){return K(new Qa,t?[ro]:no,e)}var no,ro,io=S({"src/lib/parsers/parse-branch.ts"(){$a(),q(),no=[new H(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(e,[t,n,r,i])=>{e.push(eo(t),!0,n,r,i)}),new H(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(e,[t,n,r,i])=>{e.push(eo(t),!1,n,r,i)})],ro=new H(/^(\S+)$/s,(e,[t])=>{e.push(`*`,!1,t,``,``)})}}),ao={};C(ao,{branchLocalTask:()=>co,branchTask:()=>so,containsDeleteBranchCommand:()=>oo,deleteBranchTask:()=>uo,deleteBranchesTask:()=>lo});function oo(e){let t=[`-d`,`-D`,`--delete`];return e.some(e=>t.includes(e))}function so(e){let t=oo(e),n=e.includes(`--show-current`),r=[`branch`,...e];return r.length===1&&r.push(`-a`),r.includes(`-v`)||r.splice(1,0,`-v`),{format:`utf-8`,commands:r,parser(e,r){return t?Xa(e,r).all[0]:to(e,n)}}}function co(){return{format:`utf-8`,commands:[`branch`,`-v`],parser(e){return to(e)}}}function lo(e,t=!1){return{format:`utf-8`,commands:[`branch`,`-v`,t?`-D`:`-d`,...e],parser(e,t){return Xa(e,t)},onError({exitCode:e,stdOut:t},n,r,i){if(!Ka(String(n),e))return i(n);r(t)}}}function uo(e,t=!1){let n={format:`utf-8`,commands:[`branch`,`-v`,t?`-D`:`-d`,e],parser(t,n){return Xa(t,n).branches[e]},onError({exitCode:e,stdErr:t,stdOut:r},i,a,o){if(!Ka(String(i),e))return o(i);throw new $e(n.parser(F(r),F(t)),String(i))}};return n}var fo=S({"src/lib/tasks/branch.ts"(){D(),Za(),io(),q()}});function po(e){let t=e.trim().replace(/^["']|["']$/g,``);return t&&a(t)}var mo,ho=S({"src/lib/responses/CheckIgnore.ts"(){mo=e=>e.split(/\n/g).map(po).filter(Boolean)}}),go={};C(go,{checkIgnoreTask:()=>_o});function _o(e){return{commands:[`check-ignore`,...e],format:`utf-8`,parser:mo}}var vo=S({"src/lib/tasks/check-ignore.ts"(){ho()}});function yo(e,t){return K({raw:e,remote:null,branches:[],tags:[],updated:[],deleted:[]},bo,[e,t])}var bo,xo=S({"src/lib/parsers/parse-fetch.ts"(){q(),bo=[new H(/From (.+)$/,(e,[t])=>{e.remote=t}),new H(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(e,[t,n])=>{e.branches.push({name:t,tracking:n})}),new H(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(e,[t,n])=>{e.tags.push({name:t,tracking:n})}),new H(/- \[deleted]\s+\S+\s*-> (.+)$/,(e,[t])=>{e.deleted.push({tracking:t})}),new H(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(e,[t,n,r,i])=>{e.updated.push({name:r,tracking:i,to:n,from:t})})]}}),So={};C(So,{fetchTask:()=>wo});function Co(e){return/^--upload-pack(=|$)/.test(e)}function wo(e,t,n){let r=[`fetch`,...n];return e&&t&&r.push(e,t),r.find(Co)?J(`git.fetch: potential exploit argument blocked.`):{commands:r,format:`utf-8`,parser:yo}}var To=S({"src/lib/tasks/fetch.ts"(){xo(),X()}});function Eo(e){return K({moves:[]},Do,e)}var Do,Oo=S({"src/lib/parsers/parse-move.ts"(){q(),Do=[new H(/^Renaming (.+) to (.+)$/,(e,[t,n])=>{e.moves.push({from:t,to:n})})]}}),ko={};C(ko,{moveTask:()=>Ao});function Ao(e,t){return{commands:[`mv`,`-v`,...j(e),t],format:`utf-8`,parser:Eo}}var jo=S({"src/lib/tasks/move.ts"(){Oo(),q()}}),Mo={};C(Mo,{pullTask:()=>No});function No(e,t,n){let r=[`pull`,...n];return e&&t&&r.splice(1,0,e,t),{commands:r,format:`utf-8`,parser(e,t){return Hi(e,t)},onError(e,t,n,r){let i=Fi(F(e.stdOut),F(e.stdErr));if(i)return r(new $e(i));r(t)}}}var Po=S({"src/lib/tasks/pull.ts"(){D(),Ui(),q()}});function Fo(e){let t={};return Lo(e,([e])=>t[e]={name:e}),Object.values(t)}function Io(e){let t={};return Lo(e,([e,n,r])=>{Object.hasOwn(t,e)||(t[e]={name:e,refs:{fetch:``,push:``}}),r&&n&&(t[e].refs[r.replace(/[^a-z]/g,``)]=n)}),Object.values(t)}function Lo(e,t){st(e,e=>t(e.split(/\s+/)))}var Ro=S({"src/lib/responses/GetRemoteSummary.ts"(){q()}}),zo={};C(zo,{addRemoteTask:()=>Bo,getRemotesTask:()=>Vo,listRemotesTask:()=>Ho,remoteTask:()=>Uo,removeRemoteTask:()=>Wo});function Bo(e,t,n){return Y([`remote`,`add`,...n,e,t])}function Vo(e){let t=[`remote`];return e&&t.push(`-v`),{commands:t,format:`utf-8`,parser:e?Io:Fo}}function Ho(e){let t=[...e];return t[0]!==`ls-remote`&&t.unshift(`ls-remote`),Y(t)}function Uo(e){let t=[...e];return t[0]!==`remote`&&t.unshift(`remote`),Y(t)}function Wo(e){return Y([`remote`,`remove`,e])}var Go=S({"src/lib/tasks/remote.ts"(){Ro(),X()}}),Ko={};C(Ko,{stashListTask:()=>qo});function qo(e={},t){let n=gi(e),r=[`stash`,`list`,...n.commands,...t],i=ii(n.splitter,n.fields,Wr(r));return fi(r)||{commands:r,format:`utf-8`,parser:i}}var Jo=S({"src/lib/tasks/stash-list.ts"(){qr(),li(),pi(),bi()}}),Yo={};C(Yo,{addSubModuleTask:()=>Xo,initSubModuleTask:()=>Zo,subModuleTask:()=>Qo,updateSubModuleTask:()=>$o});function Xo(e,t){return Qo([`add`,e,t])}function Zo(e){return Qo([`init`,...e])}function Qo(e){let t=[...e];return t[0]!==`submodule`&&t.unshift(`submodule`),Y(t)}function $o(e){return Qo([`update`,...e])}var es=S({"src/lib/tasks/sub-module.ts"(){X()}});function ts(e,t){let n=Number.isNaN(e);return n===Number.isNaN(t)?n?ns(e,t):0:n?1:-1}function ns(e,t){return e===t?0:e>t?1:-1}function rs(e){return e.trim()}function is(e){return typeof e==`string`&&parseInt(e.replace(/^\D+/g,``),10)||0}var as,os,ss=S({"src/lib/responses/TagList.ts"(){as=class{constructor(e,t){this.all=e,this.latest=t}},os=function(e,t=!1){let n=e.split(`
9
9
  `).map(rs).filter(Boolean);t||n.sort(function(e,t){let n=e.split(`.`),r=t.split(`.`);if(n.length===1||r.length===1)return ts(is(n[0]),is(r[0]));for(let e=0,t=Math.max(n.length,r.length);e<t;e++){let t=ns(is(n[e]),is(r[e]));if(t)return t}return 0});let r=t?n[0]:[...n].reverse().find(e=>e.indexOf(`.`)>=0);return new as(n,r)}}}),cs={};C(cs,{addAnnotatedTagTask:()=>ds,addTagTask:()=>us,tagListTask:()=>ls});function ls(e=[]){let t=e.some(e=>/^--sort=/.test(e));return{format:`utf-8`,commands:[`tag`,`-l`,...e],parser(e){return os(e,t)}}}function us(e){return{format:`utf-8`,commands:[`tag`,e],parser(){return{name:e}}}}function ds(e,t){return{format:`utf-8`,commands:[`tag`,`-a`,`-m`,t,e],parser(){return{name:e}}}}var fs=S({"src/lib/tasks/tag.ts"(){ss()}}),ps=Ze({"src/git.js"(e,t){var{GitExecutor:n}=(fr(),w(ur)),{SimpleGitApi:r}=(Pa(),w(Ma)),{Scheduler:i}=(Ra(),w(Fa)),{adhocExecTask:a,configurationErrorTask:o}=(X(),w(en)),{asArray:s,filterArray:c,filterPrimitives:l,filterString:u,filterStringOrStringArray:d,filterType:f,getTrailingOptions:p,trailingFunctionArgument:m,trailingOptionsArgument:ee}=(q(),w(Rt)),{applyPatchTask:te}=(Va(),w(za)),{branchTask:ne,branchLocalTask:re,deleteBranchesTask:ie,deleteBranchTask:ae}=(fo(),w(ao)),{checkIgnoreTask:oe}=(vo(),w(go)),{checkIsRepoTask:se}=(qt(),w(zt)),{cleanWithOptionsTask:h,isCleanOptionsArray:ce}=(bn(),w(sn)),{diffSummaryTask:le}=(pi(),w(ui)),{fetchTask:ue}=(To(),w(So)),{moveTask:g}=(jo(),w(ko)),{pullTask:de}=(Po(),w(Mo)),{pushTagsTask:fe}=(ia(),w(ta)),{addRemoteTask:pe,getRemotesTask:me,listRemotesTask:he,remoteTask:ge,removeRemoteTask:_}=(Go(),w(zo)),{getResetMode:_e,resetTask:ve}=(Qn(),w(Kn)),{stashListTask:ye}=(Jo(),w(Ko)),{addSubModuleTask:be,initSubModuleTask:xe,subModuleTask:Se,updateSubModuleTask:Ce}=(es(),w(Yo)),{addAnnotatedTagTask:we,addTagTask:Te,tagListTask:Ee}=(fs(),w(cs)),{straightThroughBufferTask:De,straightThroughStringTask:v}=(X(),w(en));function y(e,t){this._plugins=t,this._executor=new n(e.baseDir,new i(e.maxConcurrentProcesses),t),this._trimmed=e.trimmed}(y.prototype=Object.create(r.prototype)).constructor=y,y.prototype.customBinary=function(e){return this._plugins.reconfigure(`binary`,e),this},y.prototype.env=function(e,t){return arguments.length===1&&typeof e==`object`?this._executor.env=e:(this._executor.env=this._executor.env||{})[e]=t,this},y.prototype.stashList=function(e){return this._runTask(ye(ee(arguments)||{},c(e)&&e||[]),m(arguments))},y.prototype.mv=function(e,t){return this._runTask(g(e,t),m(arguments))},y.prototype.checkoutLatestTag=function(e){var t=this;return this.pull(function(){t.tags(function(n,r){t.checkout(r.latest,e)})})},y.prototype.pull=function(e,t,n,r){return this._runTask(de(f(e,u),f(t,u),p(arguments)),m(arguments))},y.prototype.fetch=function(e,t){return this._runTask(ue(f(e,u),f(t,u),p(arguments)),m(arguments))},y.prototype.silent=function(e){return this._runTask(a(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},y.prototype.tags=function(e,t){return this._runTask(Ee(p(arguments)),m(arguments))},y.prototype.rebase=function(){return this._runTask(v([`rebase`,...p(arguments)]),m(arguments))},y.prototype.reset=function(e){return this._runTask(ve(_e(e),p(arguments)),m(arguments))},y.prototype.revert=function(e){let t=m(arguments);return typeof e==`string`?this._runTask(v([`revert`,...p(arguments,0,!0),e]),t):this._runTask(o(`Commit must be a string`),t)},y.prototype.addTag=function(e){let t=typeof e==`string`?Te(e):o(`Git.addTag requires a tag name`);return this._runTask(t,m(arguments))},y.prototype.addAnnotatedTag=function(e,t){return this._runTask(we(e,t),m(arguments))},y.prototype.deleteLocalBranch=function(e,t,n){return this._runTask(ae(e,typeof t==`boolean`?t:!1),m(arguments))},y.prototype.deleteLocalBranches=function(e,t,n){return this._runTask(ie(e,typeof t==`boolean`?t:!1),m(arguments))},y.prototype.branch=function(e,t){return this._runTask(ne(p(arguments)),m(arguments))},y.prototype.branchLocal=function(e){return this._runTask(re(),m(arguments))},y.prototype.raw=function(e){let t=!Array.isArray(e),n=[].slice.call(t?arguments:e,0);for(let e=0;e<n.length&&t;e++)if(!l(n[e])){n.splice(e,n.length-e);break}n.push(...p(arguments,0,!0));var r=m(arguments);return n.length?this._runTask(v(n,this._trimmed),r):this._runTask(o(`Raw: must supply one or more command to execute`),r)},y.prototype.submoduleAdd=function(e,t,n){return this._runTask(be(e,t),m(arguments))},y.prototype.submoduleUpdate=function(e,t){return this._runTask(Ce(p(arguments,!0)),m(arguments))},y.prototype.submoduleInit=function(e,t){return this._runTask(xe(p(arguments,!0)),m(arguments))},y.prototype.subModule=function(e,t){return this._runTask(Se(p(arguments)),m(arguments))},y.prototype.listRemote=function(){return this._runTask(he(p(arguments)),m(arguments))},y.prototype.addRemote=function(e,t,n){return this._runTask(pe(e,t,p(arguments)),m(arguments))},y.prototype.removeRemote=function(e,t){return this._runTask(_(e),m(arguments))},y.prototype.getRemotes=function(e,t){return this._runTask(me(e===!0),m(arguments))},y.prototype.remote=function(e,t){return this._runTask(ge(p(arguments)),m(arguments))},y.prototype.tag=function(e,t){let n=p(arguments);return n[0]!==`tag`&&n.unshift(`tag`),this._runTask(v(n),m(arguments))},y.prototype.updateServerInfo=function(e){return this._runTask(v([`update-server-info`]),m(arguments))},y.prototype.pushTags=function(e,t){let n=fe({remote:f(e,u)},p(arguments));return this._runTask(n,m(arguments))},y.prototype.rm=function(e){return this._runTask(v([`rm`,`-f`,...s(e)]),m(arguments))},y.prototype.rmKeepLocal=function(e){return this._runTask(v([`rm`,`--cached`,...s(e)]),m(arguments))},y.prototype.catFile=function(e,t){return this._catFile(`utf-8`,arguments)},y.prototype.binaryCatFile=function(){return this._catFile(`buffer`,arguments)},y.prototype._catFile=function(e,t){var n=m(t),r=[`cat-file`],i=t[0];if(typeof i==`string`)return this._runTask(o(`Git.catFile: options must be supplied as an array of strings`),n);Array.isArray(i)&&r.push.apply(r,i);let a=e===`buffer`?De(r):v(r);return this._runTask(a,n)},y.prototype.diff=function(e,t){let n=u(e)?o(`git.diff: supplying options as a single string is no longer supported, switch to an array of strings`):v([`diff`,...p(arguments)]);return this._runTask(n,m(arguments))},y.prototype.diffSummary=function(){return this._runTask(le(p(arguments,1)),m(arguments))},y.prototype.applyPatch=function(e){let t=d(e)?te(s(e),p([].slice.call(arguments,1))):o(`git.applyPatch requires one or more string patches as the first argument`);return this._runTask(t,m(arguments))},y.prototype.revparse=function(){let e=[`rev-parse`,...p(arguments,!0)];return this._runTask(v(e,!0),m(arguments))},y.prototype.clean=function(e,t,n){let r=ce(e),i=r&&e.join(``)||f(e,u)||``,a=p([].slice.call(arguments,+!!r));return this._runTask(h(i,a),m(arguments))},y.prototype.exec=function(e){return this._runTask({commands:[],format:`utf-8`,parser(){typeof e==`function`&&e()}})},y.prototype.clearQueue=function(){return this._runTask(a(()=>console.warn(`simple-git deprecation notice: clearQueue() is deprecated and will be removed, switch to using the abortPlugin instead.`)))},y.prototype.checkIgnore=function(e,t){return this._runTask(oe(s(f(e,d,[]))),m(arguments))},y.prototype.checkIsRepo=function(e,t){return this._runTask(se(f(e,u)),m(arguments))},t.exports=y}});E();var ms=class extends T{constructor(e,t){super(void 0,t),this.config=e}};E(),E();var $=class extends T{constructor(e,t,n){super(e,n),this.task=e,this.plugin=t,Object.setPrototypeOf(this,new.target.prototype)}};D(),tt(),qt(),bn(),Nn(),Ln(),Gn(),Qn();function hs(e){if(e)return[{type:`spawn.before`,action(t,n){e.aborted&&n.kill(new $(void 0,`abort`,`Abort already signaled`))}},{type:`spawn.after`,action(t,n){function r(){n.kill(new $(void 0,`abort`,`Abort signal received`))}e.addEventListener(`abort`,r),n.spawned.on(`close`,()=>e.removeEventListener(`abort`,r))}}]}function gs(e={}){return{type:`spawn.args`,action(t,{env:n}){for(let r of Ke(t,n))if(e[r.category]!==!0)throw new $(void 0,`unsafe`,r.message);return t}}}q();function _s(e){let t=P(e,`-c`);return{type:`spawn.args`,action(e){return[...t,...e]}}}q();var vs=(0,g.deferred)().promise;function ys({onClose:e=!0,onExit:t=50}={}){function n(){let n=-1,i={close:(0,g.deferred)(),closeTimeout:(0,g.deferred)(),exit:(0,g.deferred)(),exitTimeout:(0,g.deferred)()},a=Promise.race([e===!1?vs:i.closeTimeout.promise,t===!1?vs:i.exitTimeout.promise]);return r(e,i.close,i.closeTimeout),r(t,i.exit,i.exitTimeout),{close(e){n=e,i.close.done()},exit(e){n=e,i.exit.done()},get exitCode(){return n},result:a}}function r(e,t,n){e!==!1&&(e===!0?t.promise:t.promise.then(()=>pt(e))).then(n.done)}return{type:`spawn.after`,async action(e,{spawned:t,close:r}){let i=n(),a=!0,o=()=>void(a=!1);t.stdout?.on(`data`,o),t.stderr?.on(`data`,o),t.on(`error`,o),t.on(`close`,e=>i.close(e)),t.on(`exit`,e=>i.exit(e));try{await i.result,a&&await pt(50),r(i.exitCode)}catch(e){r(i.exitCode,e)}}}}q();var bs=`Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings`,xs=`Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option`;function Ss(e){return!e||!/^([a-z]:)?([a-z0-9/.\\_~-]+)$/i.test(e)}function Cs(e,t){if(e.length<1||e.length>2)throw new $(void 0,`binary`,bs);if(e.some(Ss))if(t)console.warn(xs);else throw new $(void 0,`binary`,xs);let[n,r]=e;return{binary:n,prefix:r}}function ws(e,t=[`git`],n=!1){let r=Cs(j(t),n);e.on(`binary`,e=>{r=Cs(j(e),n)}),e.append(`spawn.binary`,()=>r.binary),e.append(`spawn.args`,e=>r.prefix?[r.prefix,...e]:e)}E();function Ts(e){return!!(e.exitCode&&e.stdErr.length)}function Es(e){return Buffer.concat([...e.stdOut,...e.stdErr])}function Ds(e=!1,t=Ts,n=Es){return(r,i)=>!e&&r||!t(i)?r:n(i)}function Os(e){return{type:`task.error`,action(t,n){let r=e(t.error,{stdErr:n.stdErr,stdOut:n.stdOut,exitCode:n.exitCode});return Buffer.isBuffer(r)?{error:new T(void 0,r.toString(`utf-8`))}:{error:r}}}}q();var ks=class{constructor(){this.plugins=new Set,this.events=new u}on(e,t){this.events.on(e,t)}reconfigure(e,t){this.events.emit(e,t)}append(e,t){let n=A(this.plugins,{type:e,action:t});return()=>this.plugins.delete(n)}add(e){let t=[];return j(e).forEach(e=>e&&this.plugins.add(A(t,e))),()=>{t.forEach(e=>this.plugins.delete(e))}}exec(e,t,n){let r=t,i=Object.freeze(Object.create(n));for(let t of this.plugins)t.type===e&&(r=t.action(r,i));return r}};q();function As(e){let t=`--progress`,n=[`checkout`,`clone`,`fetch`,`pull`,`push`];return[{type:`spawn.args`,action(e,r){return n.includes(r.method)?lt(e,t):e}},{type:`spawn.after`,action(n,r){r.commands.includes(t)&&r.spawned.stderr?.on(`data`,t=>{let n=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(t.toString(`utf8`));n&&e({method:r.method,stage:js(n[1]),progress:N(n[2]),processed:N(n[3]),total:N(n[4])})})}}]}function js(e){return String(e.toLowerCase().split(` `,1))||`unknown`}q();function Ms(e){let t=ft(e,[`uid`,`gid`]);return{type:`spawn.options`,action(e){return{...t,...e}}}}function Ns({block:e,stdErr:t=!0,stdOut:n=!0}){if(e>0)return{type:`spawn.after`,action(r,i){let a;function o(){a&&clearTimeout(a),a=setTimeout(c,e)}function s(){i.spawned.stdout?.off(`data`,o),i.spawned.stderr?.off(`data`,o),i.spawned.off(`exit`,s),i.spawned.off(`close`,s),a&&clearTimeout(a)}function c(){s(),i.kill(new $(void 0,`timeout`,`block timeout reached`))}n&&i.spawned.stdout?.on(`data`,o),t&&i.spawned.stderr?.on(`data`,o),i.spawned.on(`exit`,s),i.spawned.on(`close`,s),o()}}}function Ps(){return{type:`spawn.args`,action(e){let t=[],n;function r(e){(n||=[]).push(...e)}for(let n=0;n<e.length;n++){let i=e[n];if(h(i)){r(ce(i));continue}if(i===`--`){r(e.slice(n+1).flatMap(e=>h(e)&&ce(e)||e));break}t.push(i)}return n?[...t,`--`,...n.map(String)]:t}}}q();var Fs=ps();function Is(e,t){let n=new ks,r=kt(e&&(typeof e==`string`?{baseDir:e}:e)||{},t);if(!ct(r.baseDir))throw new ms(r,`Cannot use simple-git on a directory that does not exist`);return Array.isArray(r.config)&&n.add(_s(r.config)),n.add(gs(r.unsafe)),n.add(ys(r.completion)),r.abort&&n.add(hs(r.abort)),r.progress&&n.add(As(r.progress)),r.timeout&&n.add(Ns(r.timeout)),r.spawnOptions&&n.add(Ms(r.spawnOptions)),n.add(Ps()),n.add(Os(Ds(!0))),r.errors&&n.add(Os(r.errors)),ws(n,r.binary,r.unsafe?.allowUnsafeCustomBinary),new Fs(r,n)}D();var Ls=Is,Rs=Is;const zs=new class{_tail=Promise.resolve();enqueue(e){let t=this._tail.then(()=>e());return this._tail=t.catch(()=>void 0),t}};function Bs(e){return zs.enqueue(e)}function Vs(e){try{return s(e)&&c(e).isDirectory()}catch{return!1}}const Hs=[`HOME`,`USERPROFILE`,`HOMEDRIVE`,`HOMEPATH`,`APPDATA`,`LOCALAPPDATA`,`ProgramData`,`ALLUSERSPROFILE`,`SystemRoot`,`WINDIR`,`windir`,`ComSpec`,`TEMP`,`TMP`,`USERNAME`,`USERDOMAIN`,`PATHEXT`,`SSH_AUTH_SOCK`,`ELECTRON_RUN_AS_NODE`];function Us(e){let t={LANG:`C`,LC_ALL:`C`,GIT_TERMINAL_PROMPT:`0`,GIT_MERGE_AUTOEDIT:`no`};t.PATH=r(process.env.PATH??process.env.Path,{platform:process.platform,homeDir:l(),isDir:Vs,delimiter:i});for(let e of Hs){let n=process.env[e];n!==void 0&&(t[e]=n)}return e&&(t.OK_GH_TOKEN=e.token,t.OK_GH_TOKEN_HOST=e.host),t}function Ws(e,t){let n={...e.env};for(let[e,r]of Object.entries(t))r!==void 0&&(n[e]=r);return e.git.env(n)}function Gs(e,t={}){let{credentialArgs:n=[],gitIndexFile:r,ghToken:i,timeoutMs:a}=t,s=Us(i);return r&&(s.GIT_INDEX_FILE=o(e,r)),{git:Rs({baseDir:e,config:[`commit.gpgsign=false`,`core.autocrlf=false`,`credential.interactive=false`,...n.length>=2?[n[1]]:[]],unsafe:{allowUnsafeCredentialHelper:!0},...a===void 0?{}:{timeout:{block:a}}}).env(s),projectDir:e,credentialArgs:n,env:s}}export{Rs as a,Bs as i,Us as n,Ls as o,Gs as r,re as s,Ws as t};
10
- //# sourceMappingURL=git-handle-RLYVdszV.mjs.map
10
+ //# sourceMappingURL=git-handle-CllEzrX4.mjs.map
@@ -0,0 +1 @@
1
+ import{r as e}from"./git-handle-CllEzrX4.mjs";export{e as createGitInstance};
package/dist/index.d.mts CHANGED
@@ -2382,6 +2382,7 @@ declare const ConfigSchema: ZodObject<{
2382
2382
  }, $loose>>;
2383
2383
  editor: ZodDefault<ZodObject<{
2384
2384
  wordWrap: ZodDefault<ZodBoolean>;
2385
+ previewTabs: ZodDefault<ZodBoolean>;
2385
2386
  }, $loose>>;
2386
2387
  agents: ZodDefault<ZodObject<{
2387
2388
  autoApproveOkTools: ZodDefault<ZodBoolean>;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{xs as e}from"./src-pJ6LEXKc.mjs";import{_ as t,b as n,c as r,d as i,f as a,g as o,i as s,l as c,r as l,s as u,t as d,u as f,v as p,x as m}from"./write-project-skill-B8LGhuHT.mjs";import{C as h,_ as g,b as _,c as v,f as y,g as b,h as x,i as S,l as C,n as w,r as T,s as E,t as D,u as O,v as k,w as A}from"./src-Cgpp8Pf-.mjs";import{a as j,i as M,n as N,t as P}from"./acp-harness-probe-qJUo1ApO.mjs";import{A as F,F as I,I as L,M as R,N as z,O as B,P as V,d as H,j as U,k as W,n as G,o as K,s as q,v as J,x as Y,y as X}from"./init-C55e2NNl.mjs";import{n as Z}from"./loader-BsX_JrrA.mjs";import{n as Q}from"./preview-BAWt2Pnh.mjs";import{n as $,t as ee}from"./mcp-migrate-event-CWx0WLdE.mjs";export{c as ALL_EDITOR_IDS,f as EDITOR_LABELS,i as EDITOR_TARGETS,a as HOSTS_WITH_USER_SKILL_DIR,G as LAUNCH_CONFIG_NAME,v as PATH_SHIM_BEGIN,C as PATH_SHIM_BLOCK_RE,O as PATH_SHIM_END,B as addOkPathsToGitExclude,d as assertProjectPathSafe,o as buildManagedServerEntry,T as buildMcpConfigDeclineEvent,ee as buildMcpConfigMigrateEvent,K as classifyExistingMcpEntry,_ as collectReportBundle,M as createTokenStore,h as defaultBugReportZipPath,N as detectGh,q as detectInstalledEditors,t as editorConfigPathDisplay,p as editorEntryLocator,W as formatTrackedRemediation,F as getExcludedOkPaths,U as getOkArtifactPaths,n as isEntryUpToDate,m as isOwnManagedEntry,Z as loadConfig,j as makeLazyProbeTokenStore,A as okBugReportsDir,x as parseGitHubBlobUrl,b as parseGitHubShareUrl,g as parseGitHubTreeUrl,k as parseGitUrl,y as pathInstallMarkerPath,Q as previewContent,P as probeOwnManagedEditorMcpEntry,R as probeTrackedOkPaths,H as readExistingMcpEntry,z as readSharingMode,V as readSkillsShared,e as redactContent,I as removeOkPathsFromGitExclude,E as removeOwnMcpEntry,l as removeProjectSkill,u as removeUserGlobalSkillBundle,Y as resolveProjectRoot,S as runStop,L as setSkillsShared,$ as truncatePriorEntry,r as userGlobalSkillBundleTargets,w as validateLocalFolderForShare,J as writeEditorMcpConfig,D as writeProjectAiIntegrations,s as writeProjectSkill,X as writeUserMcpConfigs};
1
+ import{xs as e}from"./src-CHSJwcpc.mjs";import{_ as t,b as n,c as r,d as i,f as a,g as o,i as s,l as c,r as l,s as u,t as d,u as f,v as p,x as m}from"./write-project-skill-jk9SeWrA.mjs";import{C as h,_ as g,b as _,c as v,f as y,g as b,h as x,i as S,l as C,n as w,r as T,s as E,t as D,u as O,v as k,w as A}from"./src--MxQA4BK.mjs";import{a as j,i as M,n as N,t as P}from"./acp-harness-probe-QNrRVJhc.mjs";import{A as F,F as I,I as L,M as R,N as z,O as B,P as V,d as H,j as U,k as W,n as G,o as K,s as q,v as J,x as Y,y as X}from"./init-DL_j9FNQ.mjs";import{n as Z}from"./loader-Ro5TBLoF.mjs";import{n as Q}from"./preview-CyVtre2s.mjs";import{n as $,t as ee}from"./mcp-migrate-event-CWx0WLdE.mjs";export{c as ALL_EDITOR_IDS,f as EDITOR_LABELS,i as EDITOR_TARGETS,a as HOSTS_WITH_USER_SKILL_DIR,G as LAUNCH_CONFIG_NAME,v as PATH_SHIM_BEGIN,C as PATH_SHIM_BLOCK_RE,O as PATH_SHIM_END,B as addOkPathsToGitExclude,d as assertProjectPathSafe,o as buildManagedServerEntry,T as buildMcpConfigDeclineEvent,ee as buildMcpConfigMigrateEvent,K as classifyExistingMcpEntry,_ as collectReportBundle,M as createTokenStore,h as defaultBugReportZipPath,N as detectGh,q as detectInstalledEditors,t as editorConfigPathDisplay,p as editorEntryLocator,W as formatTrackedRemediation,F as getExcludedOkPaths,U as getOkArtifactPaths,n as isEntryUpToDate,m as isOwnManagedEntry,Z as loadConfig,j as makeLazyProbeTokenStore,A as okBugReportsDir,x as parseGitHubBlobUrl,b as parseGitHubShareUrl,g as parseGitHubTreeUrl,k as parseGitUrl,y as pathInstallMarkerPath,Q as previewContent,P as probeOwnManagedEditorMcpEntry,R as probeTrackedOkPaths,H as readExistingMcpEntry,z as readSharingMode,V as readSkillsShared,e as redactContent,I as removeOkPathsFromGitExclude,E as removeOwnMcpEntry,l as removeProjectSkill,u as removeUserGlobalSkillBundle,Y as resolveProjectRoot,S as runStop,L as setSkillsShared,$ as truncatePriorEntry,r as userGlobalSkillBundleTargets,w as validateLocalFolderForShare,J as writeEditorMcpConfig,D as writeProjectAiIntegrations,s as writeProjectSkill,X as writeUserMcpConfigs};