@claude-sessions/web 0.3.1 → 0.3.2

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 (112) hide show
  1. package/build/client/_app/immutable/assets/0.C_YxZDIf.css +1 -0
  2. package/build/client/_app/immutable/assets/0.C_YxZDIf.css.br +0 -0
  3. package/build/client/_app/immutable/assets/0.C_YxZDIf.css.gz +0 -0
  4. package/build/client/_app/immutable/chunks/BP5t7ykZ.js +94 -0
  5. package/build/client/_app/immutable/chunks/BP5t7ykZ.js.br +0 -0
  6. package/build/client/_app/immutable/chunks/BP5t7ykZ.js.gz +0 -0
  7. package/build/client/_app/immutable/chunks/Bf4Mh4fJ.js +1 -0
  8. package/build/client/_app/immutable/chunks/Bf4Mh4fJ.js.br +0 -0
  9. package/build/client/_app/immutable/chunks/Bf4Mh4fJ.js.gz +0 -0
  10. package/build/client/_app/immutable/chunks/{byP5FZXC.js → C8BpnBJR.js} +1 -1
  11. package/build/client/_app/immutable/chunks/C8BpnBJR.js.br +0 -0
  12. package/build/client/_app/immutable/chunks/C8BpnBJR.js.gz +0 -0
  13. package/build/client/_app/immutable/chunks/{BK2z9s18.js → Cu6SENYs.js} +1 -1
  14. package/build/client/_app/immutable/chunks/Cu6SENYs.js.br +0 -0
  15. package/build/client/_app/immutable/chunks/Cu6SENYs.js.gz +0 -0
  16. package/build/client/_app/immutable/chunks/{DvQL1cTO.js → D71lck_z.js} +1 -1
  17. package/build/client/_app/immutable/chunks/D71lck_z.js.br +0 -0
  18. package/build/client/_app/immutable/chunks/D71lck_z.js.gz +0 -0
  19. package/build/client/_app/immutable/chunks/{B0nKMdd0.js → DIdjjLDW.js} +1 -1
  20. package/build/client/_app/immutable/chunks/DIdjjLDW.js.br +0 -0
  21. package/build/client/_app/immutable/chunks/DIdjjLDW.js.gz +0 -0
  22. package/build/client/_app/immutable/chunks/{CSn8t8Ix.js → DmNCCSQw.js} +2 -2
  23. package/build/client/_app/immutable/chunks/DmNCCSQw.js.br +0 -0
  24. package/build/client/_app/immutable/chunks/DmNCCSQw.js.gz +0 -0
  25. package/build/client/_app/immutable/chunks/{elvo9mAG.js → OjxSOZcB.js} +1 -1
  26. package/build/client/_app/immutable/chunks/OjxSOZcB.js.br +0 -0
  27. package/build/client/_app/immutable/chunks/{elvo9mAG.js.gz → OjxSOZcB.js.gz} +0 -0
  28. package/build/client/_app/immutable/chunks/{Cu54-bNJ.js → fVyzbufM.js} +1 -1
  29. package/build/client/_app/immutable/chunks/fVyzbufM.js.br +0 -0
  30. package/build/client/_app/immutable/chunks/fVyzbufM.js.gz +0 -0
  31. package/build/client/_app/immutable/entry/{app.DDSmw1G2.js → app.D2mPZqo0.js} +2 -2
  32. package/build/client/_app/immutable/entry/app.D2mPZqo0.js.br +0 -0
  33. package/build/client/_app/immutable/entry/app.D2mPZqo0.js.gz +0 -0
  34. package/build/client/_app/immutable/entry/start.D-EDPZW7.js +1 -0
  35. package/build/client/_app/immutable/entry/start.D-EDPZW7.js.br +2 -0
  36. package/build/client/_app/immutable/entry/start.D-EDPZW7.js.gz +0 -0
  37. package/build/client/_app/immutable/nodes/{0.C3TdraPu.js → 0.0CZy4xUC.js} +1 -1
  38. package/build/client/_app/immutable/nodes/0.0CZy4xUC.js.br +0 -0
  39. package/build/client/_app/immutable/nodes/0.0CZy4xUC.js.gz +0 -0
  40. package/build/client/_app/immutable/nodes/{1.Bm6PSLR5.js → 1.8IhRVLrX.js} +1 -1
  41. package/build/client/_app/immutable/nodes/1.8IhRVLrX.js.br +0 -0
  42. package/build/client/_app/immutable/nodes/1.8IhRVLrX.js.gz +0 -0
  43. package/build/client/_app/immutable/nodes/{2.DWRsPVe4.js → 2.DcPferVT.js} +1 -1
  44. package/build/client/_app/immutable/nodes/2.DcPferVT.js.br +0 -0
  45. package/build/client/_app/immutable/nodes/2.DcPferVT.js.gz +0 -0
  46. package/build/client/_app/immutable/nodes/3.nf0kVMc_.js +5 -0
  47. package/build/client/_app/immutable/nodes/3.nf0kVMc_.js.br +0 -0
  48. package/build/client/_app/immutable/nodes/3.nf0kVMc_.js.gz +0 -0
  49. package/build/client/_app/version.json +1 -1
  50. package/build/client/_app/version.json.br +0 -0
  51. package/build/client/_app/version.json.gz +0 -0
  52. package/build/server/chunks/0-RARlikIe.js +17 -0
  53. package/build/server/chunks/{0-DpMV9SJd.js.map → 0-RARlikIe.js.map} +1 -1
  54. package/build/server/chunks/{1-D9TH1iwG.js → 1-DirgYWzm.js} +2 -2
  55. package/build/server/chunks/{1-D9TH1iwG.js.map → 1-DirgYWzm.js.map} +1 -1
  56. package/build/server/chunks/2-He-7jSrz.js +9 -0
  57. package/build/server/chunks/{2-tlqE1QP7.js.map → 2-He-7jSrz.js.map} +1 -1
  58. package/build/server/chunks/3-n2Dcnd8v.js +9 -0
  59. package/build/server/chunks/{3-BGGlUEp-.js.map → 3-n2Dcnd8v.js.map} +1 -1
  60. package/build/server/chunks/{_page.svelte-DEQJ0oPW.js → _page.svelte-BIsm-wEQ.js} +36 -23
  61. package/build/server/chunks/_page.svelte-BIsm-wEQ.js.map +1 -0
  62. package/build/server/chunks/_page.svelte-BZnd_diC.js +34 -0
  63. package/build/server/chunks/_page.svelte-BZnd_diC.js.map +1 -0
  64. package/build/server/chunks/{_server.ts-g_2jTmWg.js → _server.ts-BpfO1Oxd.js} +2 -2
  65. package/build/server/chunks/{_server.ts-g_2jTmWg.js.map → _server.ts-BpfO1Oxd.js.map} +1 -1
  66. package/build/server/index.js +1 -1
  67. package/build/server/index.js.map +1 -1
  68. package/build/server/manifest.js +6 -6
  69. package/build/server/manifest.js.map +1 -1
  70. package/package.json +2 -2
  71. package/build/client/_app/immutable/assets/0.DHKfs7JC.css +0 -1
  72. package/build/client/_app/immutable/assets/0.DHKfs7JC.css.br +0 -0
  73. package/build/client/_app/immutable/assets/0.DHKfs7JC.css.gz +0 -0
  74. package/build/client/_app/immutable/chunks/B0nKMdd0.js.br +0 -0
  75. package/build/client/_app/immutable/chunks/B0nKMdd0.js.gz +0 -0
  76. package/build/client/_app/immutable/chunks/BK2z9s18.js.br +0 -0
  77. package/build/client/_app/immutable/chunks/BK2z9s18.js.gz +0 -0
  78. package/build/client/_app/immutable/chunks/Bk8SkFX_.js +0 -1
  79. package/build/client/_app/immutable/chunks/Bk8SkFX_.js.br +0 -0
  80. package/build/client/_app/immutable/chunks/Bk8SkFX_.js.gz +0 -0
  81. package/build/client/_app/immutable/chunks/CSn8t8Ix.js.br +0 -0
  82. package/build/client/_app/immutable/chunks/CSn8t8Ix.js.gz +0 -0
  83. package/build/client/_app/immutable/chunks/Cu54-bNJ.js.br +0 -0
  84. package/build/client/_app/immutable/chunks/Cu54-bNJ.js.gz +0 -0
  85. package/build/client/_app/immutable/chunks/DvQL1cTO.js.br +0 -0
  86. package/build/client/_app/immutable/chunks/DvQL1cTO.js.gz +0 -0
  87. package/build/client/_app/immutable/chunks/QKEgeM73.js +0 -94
  88. package/build/client/_app/immutable/chunks/QKEgeM73.js.br +0 -0
  89. package/build/client/_app/immutable/chunks/QKEgeM73.js.gz +0 -0
  90. package/build/client/_app/immutable/chunks/byP5FZXC.js.br +0 -0
  91. package/build/client/_app/immutable/chunks/byP5FZXC.js.gz +0 -0
  92. package/build/client/_app/immutable/chunks/elvo9mAG.js.br +0 -0
  93. package/build/client/_app/immutable/entry/app.DDSmw1G2.js.br +0 -0
  94. package/build/client/_app/immutable/entry/app.DDSmw1G2.js.gz +0 -0
  95. package/build/client/_app/immutable/entry/start.BBRU_Ybm.js +0 -1
  96. package/build/client/_app/immutable/entry/start.BBRU_Ybm.js.br +0 -2
  97. package/build/client/_app/immutable/entry/start.BBRU_Ybm.js.gz +0 -0
  98. package/build/client/_app/immutable/nodes/0.C3TdraPu.js.br +0 -0
  99. package/build/client/_app/immutable/nodes/0.C3TdraPu.js.gz +0 -0
  100. package/build/client/_app/immutable/nodes/1.Bm6PSLR5.js.br +0 -2
  101. package/build/client/_app/immutable/nodes/1.Bm6PSLR5.js.gz +0 -0
  102. package/build/client/_app/immutable/nodes/2.DWRsPVe4.js.br +0 -0
  103. package/build/client/_app/immutable/nodes/2.DWRsPVe4.js.gz +0 -0
  104. package/build/client/_app/immutable/nodes/3.DMWHz6-z.js +0 -5
  105. package/build/client/_app/immutable/nodes/3.DMWHz6-z.js.br +0 -0
  106. package/build/client/_app/immutable/nodes/3.DMWHz6-z.js.gz +0 -0
  107. package/build/server/chunks/0-DpMV9SJd.js +0 -17
  108. package/build/server/chunks/2-tlqE1QP7.js +0 -9
  109. package/build/server/chunks/3-BGGlUEp-.js +0 -9
  110. package/build/server/chunks/_page.svelte-DEQJ0oPW.js.map +0 -1
  111. package/build/server/chunks/_page.svelte-DfZkatW6.js +0 -35
  112. package/build/server/chunks/_page.svelte-DfZkatW6.js.map +0 -1
@@ -1,94 +0,0 @@
1
- var ig=Object.defineProperty;var Tc=e=>{throw TypeError(e)};var ag=(e,t,n)=>t in e?ig(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var h=(e,t,n)=>ag(e,typeof t!="symbol"?t+"":t,n),Rc=(e,t,n)=>t.has(e)||Tc("Cannot "+n);var Ec=(e,t,n)=>(Rc(e,t,"read from private field"),n?n.call(e):t.get(e)),Oc=(e,t,n)=>t.has(e)?Tc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Cc=(e,t,n,r)=>(Rc(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);import{d as pr,f as T,a as y,s as O,e as bn,c as _e,t as $r}from"./DvQL1cTO.js";import{ag as og,ap as cg,aX as lg,k as Is,E as ug,aY as hg,j as fg,aZ as Mc,I as dg,q as gg,J as pg,n as ta,V as mg,ab as na,ad as Ac,ae as Nc,a_ as _g,ay as bg,a$ as yg,b0 as vg,at as kg,b1 as xg,p as ns,s as Ct,a as _a,t as j,b as rs,c as E,d as v,r as b,g as l,u as $,e as ae,f as le,b2 as Sg,M as ra}from"./elvo9mAG.js";import{B as wg,i as N}from"./Cu54-bNJ.js";import{t as wt,v as $t,o as dt,f as et,w as ba,x as lo,y as Lu,z as Ig,A as Tg,B as Rg,c as Eg}from"./CSn8t8Ix.js";import{p as cn,b as Og}from"./BK2z9s18.js";const Cg=[];function Mg(e,t=!1,n=!1){return js(e,new Map,"",Cg,null,n)}function js(e,t,n,r,s=null,i=!1){if(typeof e=="object"&&e!==null){var a=t.get(e);if(a!==void 0)return a;if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);if(og(e)){var o=Array(e.length);t.set(e,o),s!==null&&t.set(s,o);for(var c=0;c<e.length;c+=1){var u=e[c];c in e&&(o[c]=js(u,t,n,r,null,i))}return o}if(cg(e)===lg){o={},t.set(e,o),s!==null&&t.set(s,o);for(var f in e)o[f]=js(e[f],t,n,r,null,i);return o}if(e instanceof Date)return structuredClone(e);if(typeof e.toJSON=="function"&&!i)return js(e.toJSON(),t,n,r,e)}if(e instanceof EventTarget)return e;try{return structuredClone(e)}catch{return e}}const Fc=0,sa=1;function ya(e,t,n,r,s){Is&&ug();var i=hg(),a=xg,o=i?Ac(a):Nc(a,!1,!1),c=i?Ac(a):Nc(a,!1,!1),u=new wg(e);fg(()=>{var f=t(),g=!1;let p=Is&&Mc(f)===(e.data===dg);if(p&&(gg(pg()),ta(!1)),Mc(f)){var d=_g(),_=!1;const x=w=>{if(!g){_=!0,d(!1),bg.ensure(),Is&&ta(!1);try{w()}finally{yg(),vg||kg()}}};f.then(w=>{x(()=>{na(o,w),u.ensure(sa,r&&(A=>r(A,o)))})},w=>{x(()=>{if(na(c,w),u.ensure(sa,s&&(A=>s(A,c))),!s)throw c.v})}),Is?u.ensure(Fc,n):mg(()=>{_||x(()=>{u.ensure(Fc,n)})})}else na(o,f),u.ensure(sa,r&&(x=>r(x,o)));return p&&ta(!0),()=>{g=!0}})}function uo(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Pn=uo();function ju(e){Pn=e}var Lr={exec:()=>null};function be(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(s,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(pt.caret,"$1"),n=n.replace(s,a),r},getRegex:()=>new RegExp(n,t)};return r}var Ag=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),pt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},Ng=/^(?:[ \t]*(?:\n|$))+/,Fg=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Pg=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ss=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,$g=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ho=/(?:[*+-]|\d{1,9}[.)])/,Du=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,qu=be(Du).replace(/bull/g,ho).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Lg=be(Du).replace(/bull/g,ho).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),fo=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,jg=/^[^\n]+/,go=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Dg=be(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",go).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),qg=be(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ho).getRegex(),vi="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",po=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Bg=be("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",po).replace("tag",vi).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Bu=be(fo).replace("hr",ss).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",vi).getRegex(),zg=be(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Bu).getRegex(),mo={blockquote:zg,code:Fg,def:Dg,fences:Pg,heading:$g,hr:ss,html:Bg,lheading:qu,list:qg,newline:Ng,paragraph:Bu,table:Lr,text:jg},Pc=be("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ss).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",vi).getRegex(),Ug={...mo,lheading:Lg,table:Pc,paragraph:be(fo).replace("hr",ss).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Pc).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",vi).getRegex()},Vg={...mo,html:be(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",po).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Lr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:be(fo).replace("hr",ss).replace("heading",` *#{1,6} *[^
2
- ]`).replace("lheading",qu).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Kg=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Hg=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,zu=/^( {2,}|\\)\n(?!\s*$)/,Gg=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ki=/[\p{P}\p{S}]/u,_o=/[\s\p{P}\p{S}]/u,Uu=/[^\s\p{P}\p{S}]/u,Jg=be(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,_o).getRegex(),Vu=/(?!~)[\p{P}\p{S}]/u,Wg=/(?!~)[\s\p{P}\p{S}]/u,Yg=/(?:[^\s\p{P}\p{S}]|~)/u,Zg=be(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Ag?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ku=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Qg=be(Ku,"u").replace(/punct/g,ki).getRegex(),Xg=be(Ku,"u").replace(/punct/g,Vu).getRegex(),Hu="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ep=be(Hu,"gu").replace(/notPunctSpace/g,Uu).replace(/punctSpace/g,_o).replace(/punct/g,ki).getRegex(),tp=be(Hu,"gu").replace(/notPunctSpace/g,Yg).replace(/punctSpace/g,Wg).replace(/punct/g,Vu).getRegex(),np=be("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Uu).replace(/punctSpace/g,_o).replace(/punct/g,ki).getRegex(),rp=be(/\\(punct)/,"gu").replace(/punct/g,ki).getRegex(),sp=be(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ip=be(po).replace("(?:-->|$)","-->").getRegex(),ap=be("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",ip).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Gs=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,op=be(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Gs).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Gu=be(/^!?\[(label)\]\[(ref)\]/).replace("label",Gs).replace("ref",go).getRegex(),Ju=be(/^!?\[(ref)\](?:\[\])?/).replace("ref",go).getRegex(),cp=be("reflink|nolink(?!\\()","g").replace("reflink",Gu).replace("nolink",Ju).getRegex(),$c=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,bo={_backpedal:Lr,anyPunctuation:rp,autolink:sp,blockSkip:Zg,br:zu,code:Hg,del:Lr,emStrongLDelim:Qg,emStrongRDelimAst:ep,emStrongRDelimUnd:np,escape:Kg,link:op,nolink:Ju,punctuation:Jg,reflink:Gu,reflinkSearch:cp,tag:ap,text:Gg,url:Lr},lp={...bo,link:be(/^!?\[(label)\]\((.*?)\)/).replace("label",Gs).getRegex(),reflink:be(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Gs).getRegex()},va={...bo,emStrongRDelimAst:tp,emStrongLDelim:Xg,url:be(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",$c).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:be(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",$c).getRegex()},up={...va,br:be(zu).replace("{2,}","*").getRegex(),text:be(va.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ts={normal:mo,gfm:Ug,pedantic:Vg},Tr={normal:bo,gfm:va,breaks:up,pedantic:lp},hp={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Lc=e=>hp[e];function Xt(e,t){if(t){if(pt.escapeTest.test(e))return e.replace(pt.escapeReplace,Lc)}else if(pt.escapeTestNoEncode.test(e))return e.replace(pt.escapeReplaceNoEncode,Lc);return e}function jc(e){try{e=encodeURI(e).replace(pt.percentDecode,"%")}catch{return null}return e}function Dc(e,t){var i;let n=e.replace(pt.findPipe,(a,o,c)=>{let u=!1,f=o;for(;--f>=0&&c[f]==="\\";)u=!u;return u?"|":" |"}),r=n.split(pt.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(pt.slashPipe,"|");return r}function Rr(e,t,n){let r=e.length;if(r===0)return"";let s=0;for(;s<r&&e.charAt(r-s-1)===t;)s++;return e.slice(0,r-s)}function fp(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function qc(e,t,n,r,s){let i=t.href,a=t.title||null,o=e[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let c={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:a,text:o,tokens:r.inlineTokens(o)};return r.state.inLink=!1,c}function dp(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let s=r[1];return t.split(`
3
- `).map(i=>{let a=i.match(n.other.beginningSpace);if(a===null)return i;let[o]=a;return o.length>=s.length?i.slice(s.length):i}).join(`
4
- `)}var Js=class{constructor(e){h(this,"options");h(this,"rules");h(this,"lexer");this.options=e||Pn}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Rr(n,`
5
- `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=dp(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let r=Rr(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Rr(t[0],`
6
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Rr(t[0],`
7
- `).split(`
8
- `),r="",s="",i=[];for(;n.length>0;){let a=!1,o=[],c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))o.push(n[c]),a=!0;else if(!a)o.push(n[c]);else break;n=n.slice(c);let u=o.join(`
9
- `),f=u.replace(this.rules.other.blockquoteSetextReplace,`
10
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
11
- ${u}`:u,s=s?`${s}
12
- ${f}`:f;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(f,i,!0),this.lexer.state.top=g,n.length===0)break;let p=i.at(-1);if((p==null?void 0:p.type)==="code")break;if((p==null?void 0:p.type)==="blockquote"){let d=p,_=d.raw+`
13
- `+n.join(`
14
- `),x=this.blockquote(_);i[i.length-1]=x,r=r.substring(0,r.length-d.raw.length)+x.raw,s=s.substring(0,s.length-d.text.length)+x.text;break}else if((p==null?void 0:p.type)==="list"){let d=p,_=d.raw+`
15
- `+n.join(`
16
- `),x=this.list(_);i[i.length-1]=x,r=r.substring(0,r.length-p.raw.length)+x.raw,s=s.substring(0,s.length-d.raw.length)+x.raw,n=_.substring(i.at(-1).raw.length).split(`
17
- `);continue}}return{type:"blockquote",raw:r,tokens:i,text:s}}}list(e){var n,r;let t=this.rules.block.list.exec(e);if(t){let s=t[1].trim(),i=s.length>1,a={type:"list",raw:"",ordered:i,start:i?+s.slice(0,-1):"",loose:!1,items:[]};s=i?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=i?s:"[*+-]");let o=this.rules.other.listItemRegex(s),c=!1;for(;e;){let f=!1,g="",p="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;g=t[0],e=e.substring(g.length);let d=t[2].split(`
18
- `,1)[0].replace(this.rules.other.listReplaceTabs,A=>" ".repeat(3*A.length)),_=e.split(`
19
- `,1)[0],x=!d.trim(),w=0;if(this.options.pedantic?(w=2,p=d.trimStart()):x?w=t[1].length+1:(w=t[2].search(this.rules.other.nonSpaceChar),w=w>4?1:w,p=d.slice(w),w+=t[1].length),x&&this.rules.other.blankLine.test(_)&&(g+=_+`
20
- `,e=e.substring(_.length+1),f=!0),!f){let A=this.rules.other.nextBulletRegex(w),D=this.rules.other.hrRegex(w),oe=this.rules.other.fencesBeginRegex(w),I=this.rules.other.headingBeginRegex(w),S=this.rules.other.htmlBeginRegex(w);for(;e;){let q=e.split(`
21
- `,1)[0],W;if(_=q,this.options.pedantic?(_=_.replace(this.rules.other.listReplaceNesting," "),W=_):W=_.replace(this.rules.other.tabCharGlobal," "),oe.test(_)||I.test(_)||S.test(_)||A.test(_)||D.test(_))break;if(W.search(this.rules.other.nonSpaceChar)>=w||!_.trim())p+=`
22
- `+W.slice(w);else{if(x||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||oe.test(d)||I.test(d)||D.test(d))break;p+=`
23
- `+_}!x&&!_.trim()&&(x=!0),g+=q+`
24
- `,e=e.substring(q.length+1),d=W.slice(w)}}a.loose||(c?a.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(c=!0)),a.items.push({type:"list_item",raw:g,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),a.raw+=g}let u=a.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;a.raw=a.raw.trimEnd();for(let f of a.items){if(this.lexer.state.top=!1,f.tokens=this.lexer.blockTokens(f.text,[]),f.task){if(f.text=f.text.replace(this.rules.other.listReplaceTask,""),((n=f.tokens[0])==null?void 0:n.type)==="text"||((r=f.tokens[0])==null?void 0:r.type)==="paragraph"){f.tokens[0].raw=f.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),f.tokens[0].text=f.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let p=this.lexer.inlineQueue.length-1;p>=0;p--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[p].src)){this.lexer.inlineQueue[p].src=this.lexer.inlineQueue[p].src.replace(this.rules.other.listReplaceTask,"");break}}let g=this.rules.other.listTaskCheckbox.exec(f.raw);if(g){let p={type:"checkbox",raw:g[0]+" ",checked:g[0]!=="[ ]"};f.checked=p.checked,a.loose?f.tokens[0]&&["paragraph","text"].includes(f.tokens[0].type)&&"tokens"in f.tokens[0]&&f.tokens[0].tokens?(f.tokens[0].raw=p.raw+f.tokens[0].raw,f.tokens[0].text=p.raw+f.tokens[0].text,f.tokens[0].tokens.unshift(p)):f.tokens.unshift({type:"paragraph",raw:p.raw,text:p.raw,tokens:[p]}):f.tokens.unshift(p)}}if(!a.loose){let g=f.tokens.filter(d=>d.type==="space"),p=g.length>0&&g.some(d=>this.rules.other.anyLine.test(d.raw));a.loose=p}}if(a.loose)for(let f of a.items){f.loose=!0;for(let g of f.tokens)g.type==="text"&&(g.type="paragraph")}return a}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:r,title:s}}}table(e){var a;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Dc(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(a=t[3])!=null&&a.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
25
- `):[],i={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let o of r)this.rules.other.tableAlignRight.test(o)?i.align.push("right"):this.rules.other.tableAlignCenter.test(o)?i.align.push("center"):this.rules.other.tableAlignLeft.test(o)?i.align.push("left"):i.align.push(null);for(let o=0;o<n.length;o++)i.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:i.align[o]});for(let o of s)i.rows.push(Dc(o,i.header.length).map((c,u)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:i.align[u]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
26
- `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=Rr(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=fp(t[2],"()");if(i===-2)return;if(i>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let r=t[2],s="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],s=i[3])}else s=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),qc(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=t[r.toLowerCase()];if(!s){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return qc(n,s,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let s=[...r[0]].length-1,i,a,o=s,c=0,u=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+s);(r=u.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&s%3&&!((s+a)%3)){c+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+c);let f=[...r[0]][0].length,g=e.slice(0,s+r.index+f+a);if(Math.min(s,a)%2){let d=g.slice(1,-1);return{type:"em",raw:g,text:d,tokens:this.lexer.inlineTokens(d)}}let p=g.slice(2,-2);return{type:"strong",raw:g,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&s&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let r,s;if(t[2]==="@")r=t[0],s="mailto:"+r;else{let i;do i=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(i!==t[0]);r=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},Ft=class ka{constructor(t){h(this,"tokens");h(this,"options");h(this,"state");h(this,"inlineQueue");h(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Pn,this.options.tokenizer=this.options.tokenizer||new Js,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:pt,block:Ts.normal,inline:Tr.normal};this.options.pedantic?(n.block=Ts.pedantic,n.inline=Tr.pedantic):this.options.gfm&&(n.block=Ts.gfm,this.options.breaks?n.inline=Tr.breaks:n.inline=Tr.gfm),this.tokenizer.rules=n}static get rules(){return{block:Ts,inline:Tr}}static lex(t,n){return new ka(n).lex(t)}static lexInline(t,n){return new ka(n).inlineTokens(t)}lex(t){t=t.replace(pt.carriageReturn,`
27
- `),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){var s,i,a;for(this.options.pedantic&&(t=t.replace(pt.tabCharGlobal," ").replace(pt.spaceLine,""));t;){let o;if((i=(s=this.options.extensions)==null?void 0:s.block)!=null&&i.some(u=>(o=u.call({lexer:this},t,n))?(t=t.substring(o.raw.length),n.push(o),!0):!1))continue;if(o=this.tokenizer.space(t)){t=t.substring(o.raw.length);let u=n.at(-1);o.raw.length===1&&u!==void 0?u.raw+=`
28
- `:n.push(o);continue}if(o=this.tokenizer.code(t)){t=t.substring(o.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
29
- `)?"":`
30
- `)+o.raw,u.text+=`
31
- `+o.text,this.inlineQueue.at(-1).src=u.text):n.push(o);continue}if(o=this.tokenizer.fences(t)){t=t.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.heading(t)){t=t.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.hr(t)){t=t.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.blockquote(t)){t=t.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.list(t)){t=t.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.html(t)){t=t.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.def(t)){t=t.substring(o.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
32
- `)?"":`
33
- `)+o.raw,u.text+=`
34
- `+o.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title},n.push(o));continue}if(o=this.tokenizer.table(t)){t=t.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.lheading(t)){t=t.substring(o.raw.length),n.push(o);continue}let c=t;if((a=this.options.extensions)!=null&&a.startBlock){let u=1/0,f=t.slice(1),g;this.options.extensions.startBlock.forEach(p=>{g=p.call({lexer:this},f),typeof g=="number"&&g>=0&&(u=Math.min(u,g))}),u<1/0&&u>=0&&(c=t.substring(0,u+1))}if(this.state.top&&(o=this.tokenizer.paragraph(c))){let u=n.at(-1);r&&(u==null?void 0:u.type)==="paragraph"?(u.raw+=(u.raw.endsWith(`
35
- `)?"":`
36
- `)+o.raw,u.text+=`
37
- `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(o),r=c.length!==t.length,t=t.substring(o.raw.length);continue}if(o=this.tokenizer.text(t)){t=t.substring(o.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
38
- `)?"":`
39
- `)+o.raw,u.text+=`
40
- `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(o);continue}if(t){let u="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var c,u,f,g,p;let r=t,s=null;if(this.tokens.links){let d=Object.keys(this.tokens.links);if(d.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)d.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)i=s[2]?s[2].length:0,r=r.slice(0,s.index+i)+"["+"a".repeat(s[0].length-i-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((u=(c=this.options.hooks)==null?void 0:c.emStrongMask)==null?void 0:u.call({lexer:this},r))??r;let a=!1,o="";for(;t;){a||(o=""),a=!1;let d;if((g=(f=this.options.extensions)==null?void 0:f.inline)!=null&&g.some(x=>(d=x.call({lexer:this},t,n))?(t=t.substring(d.raw.length),n.push(d),!0):!1))continue;if(d=this.tokenizer.escape(t)){t=t.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.tag(t)){t=t.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.link(t)){t=t.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(d.raw.length);let x=n.at(-1);d.type==="text"&&(x==null?void 0:x.type)==="text"?(x.raw+=d.raw,x.text+=d.text):n.push(d);continue}if(d=this.tokenizer.emStrong(t,r,o)){t=t.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.codespan(t)){t=t.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.br(t)){t=t.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.del(t)){t=t.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.autolink(t)){t=t.substring(d.raw.length),n.push(d);continue}if(!this.state.inLink&&(d=this.tokenizer.url(t))){t=t.substring(d.raw.length),n.push(d);continue}let _=t;if((p=this.options.extensions)!=null&&p.startInline){let x=1/0,w=t.slice(1),A;this.options.extensions.startInline.forEach(D=>{A=D.call({lexer:this},w),typeof A=="number"&&A>=0&&(x=Math.min(x,A))}),x<1/0&&x>=0&&(_=t.substring(0,x+1))}if(d=this.tokenizer.inlineText(_)){t=t.substring(d.raw.length),d.raw.slice(-1)!=="_"&&(o=d.raw.slice(-1)),a=!0;let x=n.at(-1);(x==null?void 0:x.type)==="text"?(x.raw+=d.raw,x.text+=d.text):n.push(d);continue}if(t){let x="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return n}},Ws=class{constructor(e){h(this,"options");h(this,"parser");this.options=e||Pn}space(e){return""}code({text:e,lang:t,escaped:n}){var i;let r=(i=(t||"").match(pt.notSpaceStart))==null?void 0:i[0],s=e.replace(pt.endingNewline,"")+`
41
- `;return r?'<pre><code class="language-'+Xt(r)+'">'+(n?s:Xt(s,!0))+`</code></pre>
42
- `:"<pre><code>"+(n?s:Xt(s,!0))+`</code></pre>
43
- `}blockquote({tokens:e}){return`<blockquote>
44
- ${this.parser.parse(e)}</blockquote>
45
- `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
46
- `}hr(e){return`<hr>
47
- `}list(e){let t=e.ordered,n=e.start,r="";for(let a=0;a<e.items.length;a++){let o=e.items[a];r+=this.listitem(o)}let s=t?"ol":"ul",i=t&&n!==1?' start="'+n+'"':"";return"<"+s+i+`>
48
- `+r+"</"+s+`>
49
- `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
50
- `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
51
- `}table(e){let t="",n="";for(let s=0;s<e.header.length;s++)n+=this.tablecell(e.header[s]);t+=this.tablerow({text:n});let r="";for(let s=0;s<e.rows.length;s++){let i=e.rows[s];n="";for(let a=0;a<i.length;a++)n+=this.tablecell(i[a]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
52
- <thead>
53
- `+t+`</thead>
54
- `+r+`</table>
55
- `}tablerow({text:e}){return`<tr>
56
- ${e}</tr>
57
- `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
58
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Xt(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),s=jc(e);if(s===null)return r;e=s;let i='<a href="'+e+'"';return t&&(i+=' title="'+Xt(t)+'"'),i+=">"+r+"</a>",i}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let s=jc(e);if(s===null)return Xt(n);e=s;let i=`<img src="${e}" alt="${n}"`;return t&&(i+=` title="${Xt(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Xt(e.text)}},yo=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},Pt=class xa{constructor(t){h(this,"options");h(this,"renderer");h(this,"textRenderer");this.options=t||Pn,this.options.renderer=this.options.renderer||new Ws,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new yo}static parse(t,n){return new xa(n).parse(t)}static parseInline(t,n){return new xa(n).parseInline(t)}parse(t){var r,s;let n="";for(let i=0;i<t.length;i++){let a=t[i];if((s=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&s[a.type]){let c=a,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){n+=u||"";continue}}let o=a;switch(o.type){case"space":{n+=this.renderer.space(o);break}case"hr":{n+=this.renderer.hr(o);break}case"heading":{n+=this.renderer.heading(o);break}case"code":{n+=this.renderer.code(o);break}case"table":{n+=this.renderer.table(o);break}case"blockquote":{n+=this.renderer.blockquote(o);break}case"list":{n+=this.renderer.list(o);break}case"checkbox":{n+=this.renderer.checkbox(o);break}case"html":{n+=this.renderer.html(o);break}case"def":{n+=this.renderer.def(o);break}case"paragraph":{n+=this.renderer.paragraph(o);break}case"text":{n+=this.renderer.text(o);break}default:{let c='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return n}parseInline(t,n=this.renderer){var s,i;let r="";for(let a=0;a<t.length;a++){let o=t[a];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[o.type]){let u=this.options.extensions.renderers[o.type].call({parser:this},o);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){r+=u||"";continue}}let c=o;switch(c.type){case"escape":{r+=n.text(c);break}case"html":{r+=n.html(c);break}case"link":{r+=n.link(c);break}case"image":{r+=n.image(c);break}case"checkbox":{r+=n.checkbox(c);break}case"strong":{r+=n.strong(c);break}case"em":{r+=n.em(c);break}case"codespan":{r+=n.codespan(c);break}case"br":{r+=n.br(c);break}case"del":{r+=n.del(c);break}case"text":{r+=n.text(c);break}default:{let u='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return r}},Ls,Fr=(Ls=class{constructor(e){h(this,"options");h(this,"block");this.options=e||Pn}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Ft.lex:Ft.lexInline}provideParser(){return this.block?Pt.parse:Pt.parseInline}},h(Ls,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),h(Ls,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Ls),gp=class{constructor(...e){h(this,"defaults",uo());h(this,"options",this.setOptions);h(this,"parse",this.parseMarkdown(!0));h(this,"parseInline",this.parseMarkdown(!1));h(this,"Parser",Pt);h(this,"Renderer",Ws);h(this,"TextRenderer",yo);h(this,"Lexer",Ft);h(this,"Tokenizer",Js);h(this,"Hooks",Fr);this.use(...e)}walkTokens(e,t){var r,s;let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{let a=i;for(let o of a.header)n=n.concat(this.walkTokens(o.tokens,t));for(let o of a.rows)for(let c of o)n=n.concat(this.walkTokens(c.tokens,t));break}case"list":{let a=i;n=n.concat(this.walkTokens(a.items,t));break}default:{let a=i;(s=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&s[a.type]?this.defaults.extensions.childTokens[a.type].forEach(o=>{let c=a[o].flat(1/0);n=n.concat(this.walkTokens(c,t))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let i=t.renderers[s.name];i?t.renderers[s.name]=function(...a){let o=s.renderer.apply(this,a);return o===!1&&(o=i.apply(this,a)),o}:t.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[s.level];i?i.unshift(s.tokenizer):t[s.level]=[s.tokenizer],s.start&&(s.level==="block"?t.startBlock?t.startBlock.push(s.start):t.startBlock=[s.start]:s.level==="inline"&&(t.startInline?t.startInline.push(s.start):t.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(t.childTokens[s.name]=s.childTokens)}),r.extensions=t),n.renderer){let s=this.defaults.renderer||new Ws(this.defaults);for(let i in n.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let a=i,o=n.renderer[a],c=s[a];s[a]=(...u)=>{let f=o.apply(s,u);return f===!1&&(f=c.apply(s,u)),f||""}}r.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new Js(this.defaults);for(let i in n.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let a=i,o=n.tokenizer[a],c=s[a];s[a]=(...u)=>{let f=o.apply(s,u);return f===!1&&(f=c.apply(s,u)),f}}r.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new Fr;for(let i in n.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let a=i,o=n.hooks[a],c=s[a];Fr.passThroughHooks.has(i)?s[a]=u=>{if(this.defaults.async&&Fr.passThroughHooksRespectAsync.has(i))return(async()=>{let g=await o.call(s,u);return c.call(s,g)})();let f=o.call(s,u);return c.call(s,f)}:s[a]=(...u)=>{if(this.defaults.async)return(async()=>{let g=await o.apply(s,u);return g===!1&&(g=await c.apply(s,u)),g})();let f=o.apply(s,u);return f===!1&&(f=c.apply(s,u)),f}}r.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(a){let o=[];return o.push(i.call(this,a)),s&&(o=o.concat(s.call(this,a))),o}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Ft.lex(e,t??this.defaults)}parser(e,t){return Pt.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},s={...this.defaults,...r},i=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&r.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return(async()=>{let a=s.hooks?await s.hooks.preprocess(t):t,o=await(s.hooks?await s.hooks.provideLexer():e?Ft.lex:Ft.lexInline)(a,s),c=s.hooks?await s.hooks.processAllTokens(o):o;s.walkTokens&&await Promise.all(this.walkTokens(c,s.walkTokens));let u=await(s.hooks?await s.hooks.provideParser():e?Pt.parse:Pt.parseInline)(c,s);return s.hooks?await s.hooks.postprocess(u):u})().catch(i);try{s.hooks&&(t=s.hooks.preprocess(t));let a=(s.hooks?s.hooks.provideLexer():e?Ft.lex:Ft.lexInline)(t,s);s.hooks&&(a=s.hooks.processAllTokens(a)),s.walkTokens&&this.walkTokens(a,s.walkTokens);let o=(s.hooks?s.hooks.provideParser():e?Pt.parse:Pt.parseInline)(a,s);return s.hooks&&(o=s.hooks.postprocess(o)),o}catch(a){return i(a)}}}onError(e,t){return n=>{if(n.message+=`
59
- Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+Xt(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},Tn=new gp;function Se(e,t){return Tn.parse(e,t)}Se.options=Se.setOptions=function(e){return Tn.setOptions(e),Se.defaults=Tn.defaults,ju(Se.defaults),Se};Se.getDefaults=uo;Se.defaults=Pn;Se.use=function(...e){return Tn.use(...e),Se.defaults=Tn.defaults,ju(Se.defaults),Se};Se.walkTokens=function(e,t){return Tn.walkTokens(e,t)};Se.parseInline=Tn.parseInline;Se.Parser=Pt;Se.parser=Pt.parse;Se.Renderer=Ws;Se.TextRenderer=yo;Se.Lexer=Ft;Se.lexer=Ft.lex;Se.Tokenizer=Js;Se.Hooks=Fr;Se.parse=Se;Se.options;Se.setOptions;Se.use;Se.walkTokens;Se.parseInline;Pt.parse;Ft.lex;const pp={},Wu=Object.freeze(Object.defineProperty({__proto__:null,default:pp},Symbol.toStringTag,{value:"Module"})),mp=e=>typeof e=="function",m=function(e,t){if(typeof e=="function")return function(){return e(arguments)?t.apply(this,arguments):n=>t(n,...arguments)};switch(e){case 0:case 1:throw new RangeError(`Invalid arity ${e}`);case 2:return function(n,r){return arguments.length>=2?t(n,r):function(s){return t(s,n)}};case 3:return function(n,r,s){return arguments.length>=3?t(n,r,s):function(i){return t(i,n,r)}};case 4:return function(n,r,s,i){return arguments.length>=4?t(n,r,s,i):function(a){return t(a,n,r,s)}};case 5:return function(n,r,s,i,a){return arguments.length>=5?t(n,r,s,i,a):function(o){return t(o,n,r,s,i)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);const n=arguments;return function(r){return t(r,...n)}}}},Me=e=>e,xi=e=>()=>e,Bc=xi(!0),Sa=xi(!1),Yu=xi(void 0),_p=Yu;function k(e,t,n,r,s,i,a,o,c){switch(arguments.length){case 1:return e;case 2:return t(e);case 3:return n(t(e));case 4:return r(n(t(e)));case 5:return s(r(n(t(e))));case 6:return i(s(r(n(t(e)))));case 7:return a(i(s(r(n(t(e))))));case 8:return o(a(i(s(r(n(t(e)))))));case 9:return c(o(a(i(s(r(n(t(e))))))));default:{let u=arguments[0];for(let f=1;f<arguments.length;f++)u=arguments[f](u);return u}}}const vo=e=>(t,n)=>t===n||e(t,n),bp=m(2,(e,t)=>vo((n,r)=>e(t(n),t(r)))),yp=e=>vo((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0}),Rs="effect/GlobalValue";let Er;const ye=(e,t)=>(Er||(globalThis[Rs]??(globalThis[Rs]=new Map),Er=globalThis[Rs]),Er.has(e)||Er.set(e,t()),Er.get(e)),vp=e=>typeof e=="string",wa=e=>typeof e=="number",kp=e=>typeof e=="bigint",Si=mp,xp=e=>typeof e=="object"&&e!==null,wi=e=>xp(e)||Si(e),re=m(2,(e,t)=>wi(e)&&t in e),Zu=m(2,(e,t)=>re(e,"_tag")&&e._tag===t),qn=e=>e==null,Qu=e=>typeof e=="string"||re(e,Symbol.iterator),Sp=e=>re(e,"then")&&Si(e.then),Ii=e=>`BUG: ${e} - please report an issue at https://github.com/Effect-TS/effect/issues`;let Xu=class eh{constructor(t){h(this,"self");h(this,"called",!1);this.self=t}next(t){return this.called?{value:t,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(t){return{value:t,done:!0}}throw(t){throw t}[Symbol.iterator](){return new eh(this.self)}};const wp=335903614,Ip=4150755663,Tp=1481765933,Rp=1284865837,Ep=9007199254740992,Op=134217728;class Cp{constructor(t,n,r,s){h(this,"_state");return qn(n)&&qn(t)?(n=Math.random()*4294967295>>>0,t=0):qn(n)&&(n=t,t=0),qn(s)&&qn(r)?(s=this._state?this._state[3]:Ip,r=this._state?this._state[2]:wp):qn(s)&&(s=r,r=0),this._state=new Int32Array([0,0,r>>>0,((s||0)|1)>>>0]),this._next(),zc(this._state,this._state[0],this._state[1],t>>>0,n>>>0),this._next(),this}getState(){return[this._state[0],this._state[1],this._state[2],this._state[3]]}setState(t){this._state[0]=t[0],this._state[1]=t[1],this._state[2]=t[2],this._state[3]=t[3]|1}integer(t){return Math.round(this.number()*Number.MAX_SAFE_INTEGER)%t}number(){const t=(this._next()&67108863)*1,n=(this._next()&134217727)*1;return(t*Op+n)/Ep}_next(){const t=this._state[0]>>>0,n=this._state[1]>>>0;Mp(this._state,t,n,Tp,Rp),zc(this._state,this._state[0],this._state[1],this._state[2],this._state[3]);let r=t>>>18,s=(n>>>18|t<<14)>>>0;r=(r^t)>>>0,s=(s^n)>>>0;const i=(s>>>27|r<<5)>>>0,a=t>>>27,o=(-a>>>0&31)>>>0;return(i>>>a|i<<o)>>>0}}function Mp(e,t,n,r,s){let i=(n>>>16)*(s&65535)>>>0,a=(n&65535)*(s>>>16)>>>0,o=(n&65535)*(s&65535)>>>0,c=(n>>>16)*(s>>>16)+((a>>>16)+(i>>>16))>>>0;a=a<<16>>>0,o=o+a>>>0,o>>>0<a>>>0&&(c=c+1>>>0),i=i<<16>>>0,o=o+i>>>0,o>>>0<i>>>0&&(c=c+1>>>0),c=c+Math.imul(n,r)>>>0,c=c+Math.imul(t,s)>>>0,e[0]=c,e[1]=o}function zc(e,t,n,r,s){let i=t+r>>>0;const a=n+s>>>0;a>>>0<n>>>0&&(i=i+1|0),e[0]=i,e[1]=a}const Ia=Symbol.for("effect/Utils/YieldWrap");var ts;class is{constructor(t){Oc(this,ts);Cc(this,ts,t)}[Ia](){return Ec(this,ts)}}ts=new WeakMap;function Ap(e){if(typeof e=="object"&&e!==null&&Ia in e)return e[Ia]();throw new Error(Ii("yieldWrapGet"))}const Et=ye("effect/Utils/isStructuralRegion",()=>({enabled:!1,tester:void 0})),th={effect_internal_function:e=>e()},Np={effect_internal_function:e=>{try{return e()}finally{}}};var Yl;const Fp=((Yl=th.effect_internal_function(()=>new Error().stack))==null?void 0:Yl.includes("effect_internal_function"))===!0,gt=Fp?th.effect_internal_function:Np.effect_internal_function,ia=ye(Symbol.for("effect/Hash/randomHashCache"),()=>new WeakMap),te=Symbol.for("effect/Hash"),P=e=>{if(Et.enabled===!0)return 0;switch(typeof e){case"number":return xo(e);case"bigint":return Ve(e.toString(10));case"boolean":return Ve(String(e));case"symbol":return Ve(String(e));case"string":return Ve(e);case"undefined":return Ve("undefined");case"function":case"object":return e===null?Ve("null"):e instanceof Date?Number.isNaN(e.getTime())?Ve("Invalid Date"):P(e.toISOString()):e instanceof URL?P(e.href):Pp(e)?e[te]():ko(e);default:throw new Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},ko=e=>(ia.has(e)||ia.set(e,xo(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),ia.get(e)),me=e=>t=>t*53^e,Ti=e=>e&3221225471|e>>>1&1073741824,Pp=e=>re(e,te),xo=e=>{if(e!==e||e===1/0)return 0;let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return Ti(t)},Ve=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return Ti(t)},$p=(e,t)=>{let n=12289;for(let r=0;r<t.length;r++)n^=k(Ve(t[r]),me(P(e[t[r]])));return Ti(n)},nh=e=>$p(e,Object.keys(e)),as=e=>{let t=6151;for(let n=0;n<e.length;n++)t=k(t,me(P(e[n])));return Ti(t)},je=function(){if(arguments.length===1){const n=arguments[0];return function(r){return Object.defineProperty(n,te,{value(){return r},enumerable:!1}),r}}const e=arguments[0],t=arguments[1];return Object.defineProperty(e,te,{value(){return t},enumerable:!1}),t},X=Symbol.for("effect/Equal");function ne(){return arguments.length===1?e=>Ys(e,arguments[0]):Ys(arguments[0],arguments[1])}function Ys(e,t){if(e===t)return!0;const n=typeof e;if(n!==typeof t)return!1;if(n==="object"||n==="function"){if(e!==null&&t!==null){if(Zs(e)&&Zs(t))return P(e)===P(t)&&e[X](t)?!0:Et.enabled&&Et.tester?Et.tester(e,t):!1;if(e instanceof Date&&t instanceof Date){const r=e.getTime(),s=t.getTime();return r===s||Number.isNaN(r)&&Number.isNaN(s)}else if(e instanceof URL&&t instanceof URL)return e.href===t.href}if(Et.enabled){if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((r,s)=>Ys(r,t[s]));if(Object.getPrototypeOf(e)===Object.prototype&&Object.getPrototypeOf(e)===Object.prototype){const r=Object.keys(e),s=Object.keys(t);if(r.length===s.length){for(const i of r)if(!(i in t&&Ys(e[i],t[i])))return Et.tester?Et.tester(e,t):!1;return!0}}return Et.tester?Et.tester(e,t):!1}}return Et.enabled&&Et.tester?Et.tester(e,t):!1}const Zs=e=>re(e,X),So=()=>ne,Ke=Symbol.for("nodejs.util.inspect.custom"),rt=e=>{try{if(re(e,"toJSON")&&Si(e.toJSON)&&e.toJSON.length===0)return e.toJSON();if(Array.isArray(e))return e.map(rt)}catch{return{}}return jp(e)},ot=e=>JSON.stringify(e,null,2),Jn=(e,t=2)=>{if(typeof e=="string")return e;try{return typeof e=="object"?rh(e,t):String(e)}catch{return String(e)}},rh=(e,t)=>{let n=[];const r=JSON.stringify(e,(s,i)=>typeof i=="object"&&i!==null?n.includes(i)?void 0:n.push(i)&&(xn.fiberRefs!==void 0&&sh(i)?i[wo](xn.fiberRefs):i):i,t);return n=void 0,r},wo=Symbol.for("effect/Inspectable/Redactable"),sh=e=>typeof e=="object"&&e!==null&&wo in e,xn=ye("effect/Inspectable/redactableState",()=>({fiberRefs:void 0})),Lp=(e,t)=>{const n=xn.fiberRefs;xn.fiberRefs=e;try{return t()}finally{xn.fiberRefs=n}},jp=e=>sh(e)&&xn.fiberRefs!==void 0?e[wo](xn.fiberRefs):e,J=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let r=0,s=t.length;r<s;r++)n=t[r](n);return n}}},jr="Async",Ri="Commit",Dt="Failure",aa="OnFailure",Qs="OnSuccess",Xs="OnSuccessAndFailure",qt="Success",ih="Sync",Dp="Tag",os="UpdateRuntimeFlags",ei="While",Dr="Iterator",ah="WithRuntime",Ds="Yield",Io="RevertFlags";let qp="3.19.12";const To=()=>qp,Bp=Symbol.for("effect/Effect"),zp=Symbol.for("effect/Stream"),Up=Symbol.for("effect/Sink"),Vp=Symbol.for("effect/Channel"),Wn={_R:e=>e,_E:e=>e,_A:e=>e,_V:To()},Kp={_A:e=>e,_In:e=>e,_L:e=>e,_E:e=>e,_R:e=>e},Hp={_Env:e=>e,_InErr:e=>e,_InElem:e=>e,_InDone:e=>e,_OutErr:e=>e,_OutElem:e=>e,_OutDone:e=>e},cs={[Bp]:Wn,[zp]:Wn,[Up]:Kp,[Vp]:Hp,[X](e){return this===e},[te](){return je(this,ko(this))},[Symbol.iterator](){return new Xu(new is(this))},pipe(){return J(this,arguments)}},Ro={[te](){return je(this,nh(this))},[X](e){const t=Object.keys(this),n=Object.keys(e);if(t.length!==n.length)return!1;for(const r of t)if(!(r in e&&ne(this[r],e[r])))return!1;return!0}},ls={...cs,_op:Ri},Gp={...ls,...Ro},Jp=(function(){function e(){}return e.prototype=ls,e})(),oh=Symbol.for("effect/Option"),ch={...cs,[oh]:{_A:e=>e},[Ke](){return this.toJSON()},toString(){return ot(this.toJSON())}},Wp=Object.assign(Object.create(ch),{_tag:"Some",_op:"Some",[X](e){return lh(e)&&hh(e)&&ne(this.value,e.value)},[te](){return je(this,me(P(this._tag))(P(this.value)))},toJSON(){return{_id:"Option",_tag:this._tag,value:rt(this.value)}}}),Yp=P("None"),Zp=Object.assign(Object.create(ch),{_tag:"None",_op:"None",[X](e){return lh(e)&&uh(e)},[te](){return Yp},toJSON(){return{_id:"Option",_tag:this._tag}}}),lh=e=>re(e,oh),uh=e=>e._tag==="None",hh=e=>e._tag==="Some",fh=Object.create(Zp),Ta=e=>{const t=Object.create(Wp);return t.value=e,t},dh=Symbol.for("effect/Either"),gh={...cs,[dh]:{_R:e=>e},[Ke](){return this.toJSON()},toString(){return ot(this.toJSON())}},Qp=Object.assign(Object.create(gh),{_tag:"Right",_op:"Right",[X](e){return ph(e)&&_h(e)&&ne(this.right,e.right)},[te](){return me(P(this._tag))(P(this.right))},toJSON(){return{_id:"Either",_tag:this._tag,right:rt(this.right)}}}),Xp=Object.assign(Object.create(gh),{_tag:"Left",_op:"Left",[X](e){return ph(e)&&mh(e)&&ne(this.left,e.left)},[te](){return me(P(this._tag))(P(this.left))},toJSON(){return{_id:"Either",_tag:this._tag,left:rt(this.left)}}}),ph=e=>re(e,dh),mh=e=>e._tag==="Left",_h=e=>e._tag==="Right",em=e=>{const t=Object.create(Xp);return t.left=e,t},tm=e=>{const t=Object.create(Qp);return t.right=e,t},en=tm,Yn=em,Pr=mh,Es=_h,nm=m(2,(e,{onLeft:t,onRight:n})=>Pr(e)?t(e.left):n(e.right)),rm=nm({onLeft:Me,onRight:Me}),bh=e=>e.length>0,yh=e=>(t,n)=>t===n?0:e(t,n),sm=yh((e,t)=>e<t?-1:1),im=m(2,(e,t)=>yh((n,r)=>e(t(n),t(r)))),am=e=>m(2,(t,n)=>e(t,n)===1),G=()=>fh,de=Ta,_t=uh,Kt=hh,$n=m(2,(e,{onNone:t,onSome:n})=>_t(e)?t():n(e.value)),Rn=m(2,(e,t)=>_t(e)?t():e.value),om=m(2,(e,t)=>_t(e)?de(t()):e),Eo=e=>e==null?G():de(e),mn=Rn(Yu),cm=m(2,(e,t)=>_t(e)?G():de(t(e.value))),lm=m(2,(e,t)=>_t(e)?G():t(e.value)),um=e=>m(2,(t,n)=>_t(t)?!1:e(t.value,n)),hm=So(),fm=um(hm),dm=(...e)=>e,Oo=e=>new Array(e),gm=m(2,(e,t)=>{const n=Math.max(1,Math.floor(e)),r=new Array(n);for(let s=0;s<n;s++)r[s]=t(s);return r}),We=e=>Array.isArray(e)?e:Array.from(e),pm=e=>Array.isArray(e)?e:[e],ti=m(2,(e,t)=>[t,...e]),mm=m(2,(e,t)=>[...e,t]),vh=m(2,(e,t)=>We(e).concat(We(t))),_m=e=>e.length===0,bm=_m,ym=bh,It=bh,kh=(e,t)=>e<0||e>=t.length,vm=(e,t)=>Math.floor(Math.min(Math.max(0,e),t.length)),km=m(2,(e,t)=>{const n=Math.floor(t);return kh(n,e)?G():de(e[n])}),xh=m(2,(e,t)=>{const n=Math.floor(t);if(kh(n,e))throw new Error(`Index ${n} out of bounds`);return e[n]}),qr=km(0),xt=xh(0),xm=e=>It(e)?de(Sh(e)):G(),Sh=e=>e[e.length-1],Zn=e=>e.slice(1),Sm=(e,t)=>{let n=0;for(const r of e){if(!t(r,n))break;n++}return n},wm=m(2,(e,t)=>Em(e,Sm(e,t))),Im=m(2,(e,t)=>{const n=We(e);return n.slice(vm(t,n),n.length)}),Uc=e=>Array.from(e).reverse(),ni=m(2,(e,t)=>{const n=Array.from(e);return n.sort(t),n}),Vc=m(2,(e,t)=>Tm(e,t,dm)),Tm=m(3,(e,t,n)=>{const r=We(e),s=We(t);if(It(r)&&It(s)){const i=[n(xt(r),xt(s))],a=Math.min(r.length,s.length);for(let o=1;o<a;o++)i[o]=n(r[o],s[o]);return i}return[]}),Rm=So(),Em=m(2,(e,t)=>{const n=Array.from(e),r=Math.floor(t);return It(n)?r>=1?Om(n,r):[[],n]:[n,[]]}),Om=m(2,(e,t)=>{const n=Math.max(1,Math.floor(t));return n>=e.length?[Cm(e),[]]:[ti(e.slice(1,n),xt(e)),e.slice(n)]}),Cm=e=>e.slice(),Mm=m(3,(e,t,n)=>{const r=We(e),s=We(t);return It(r)?It(s)?Ih(n)(vh(r,s)):r:s}),qs=m(2,(e,t)=>Mm(e,t,Rm)),Qn=()=>[],Nt=e=>[e],Vn=m(2,(e,t)=>e.map(t)),Am=m(2,(e,t)=>{if(bm(e))return[];const n=[];for(let r=0;r<e.length;r++){const s=t(e[r],r);for(let i=0;i<s.length;i++)n.push(s[i])}return n}),Nm=Am(Me),wh=m(3,(e,t,n)=>We(e).reduce((r,s,i)=>n(r,s,i),t)),Kc=(e,t)=>{const n=[];let r=e,s;for(;Kt(s=t(r));){const[i,a]=s.value;n.push(i),r=a}return n},Co=yp,Ih=m(2,(e,t)=>{const n=We(e);if(It(n)){const r=[xt(n)],s=Zn(n);for(const i of s)r.every(a=>!t(i,a))&&r.push(i);return r}return[]}),Fm=e=>Ih(e,So()),mr=m(2,(e,t)=>We(e).join(t)),Vr=sm,Pm=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&"),$m=Symbol.for("effect/Context/Tag"),ri=Symbol.for("effect/Context/Reference"),Lm="effect/STM",jm=Symbol.for(Lm),Th={...cs,_op:"Tag",[jm]:Wn,[$m]:{_Service:e=>e,_Identifier:e=>e},toString(){return ot(this.toJSON())},toJSON(){return{_id:"Tag",key:this.key,stack:this.stack}},[Ke](){return this.toJSON()},of(e){return e},context(e){return Eh(this,e)}},Dm={...Th,[ri]:ri},qm=e=>{const t=Error.stackTraceLimit;Error.stackTraceLimit=2;const n=new Error;Error.stackTraceLimit=t;const r=Object.create(Th);return Object.defineProperty(r,"stack",{get(){return n.stack}}),r.key=e,r},Bm=()=>(e,t)=>{const n=Error.stackTraceLimit;Error.stackTraceLimit=2;const r=new Error;Error.stackTraceLimit=n;function s(){}return Object.setPrototypeOf(s,Dm),s.key=e,s.defaultValue=t.defaultValue,Object.defineProperty(s,"stack",{get(){return r.stack}}),s},Rh=Symbol.for("effect/Context"),zm={[Rh]:{_Services:e=>e},[X](e){if(Vm(e)&&this.unsafeMap.size===e.unsafeMap.size){for(const t of this.unsafeMap.keys())if(!e.unsafeMap.has(t)||!ne(this.unsafeMap.get(t),e.unsafeMap.get(t)))return!1;return!0}return!1},[te](){return je(this,xo(this.unsafeMap.size))},pipe(){return J(this,arguments)},toString(){return ot(this.toJSON())},toJSON(){return{_id:"Context",services:Array.from(this.unsafeMap).map(rt)}},[Ke](){return this.toJSON()}},Xn=e=>{const t=Object.create(zm);return t.unsafeMap=e,t},Um=e=>{const t=new Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(e.stack){const n=e.stack.split(`
60
- `);if(n.length>2){const r=n[2].match(/at (.*)/);r&&(t.message=t.message+` (defined at ${r[1]})`)}}if(t.stack){const n=t.stack.split(`
61
- `);n.splice(1,3),t.stack=n.join(`
62
- `)}return t},Vm=e=>re(e,Rh),Km=e=>re(e,ri),Hm=Xn(new Map),Gm=()=>Hm,Eh=(e,t)=>Xn(new Map([[e.key,t]])),Jm=m(3,(e,t,n)=>{const r=new Map(e.unsafeMap);return r.set(t.key,n),Xn(r)}),oa=ye("effect/Context/defaultValueCache",()=>new Map),Mo=e=>{if(oa.has(e.key))return oa.get(e.key);const t=e.defaultValue();return oa.set(e.key,t),t},Wm=(e,t)=>e.unsafeMap.has(t.key)?e.unsafeMap.get(t.key):Mo(t),Oh=m(2,(e,t)=>{if(!e.unsafeMap.has(t.key)){if(ri in t)return Mo(t);throw Um(t)}return e.unsafeMap.get(t.key)}),Ym=Oh,Zm=m(2,(e,t)=>e.unsafeMap.has(t.key)?Ta(e.unsafeMap.get(t.key)):Km(t)?Ta(Mo(t)):fh),Qm=m(2,(e,t)=>{const n=new Map(e.unsafeMap);for(const[r,s]of t.unsafeMap)n.set(r,s);return Xn(n)}),Ln=qm,Ch=Gm,Xm=Eh,Or=Jm,Mh=Ym,Ah=Oh,us=Zm,Nh=Qm,Fh=Bm,Ph=Symbol.for("effect/Chunk");function e_(e,t,n,r,s){for(let i=t;i<Math.min(e.length,t+s);i++)n[r+i-t]=e[i];return n}const $h=[],t_=e=>vo((t,n)=>t.length===n.length&&Sn(t).every((r,s)=>e(r,Kn(n,s)))),n_=t_(ne),r_={[Ph]:{_A:e=>e},toString(){return ot(this.toJSON())},toJSON(){return{_id:"Chunk",values:Sn(this).map(rt)}},[Ke](){return this.toJSON()},[X](e){return Lh(e)&&n_(this,e)},[te](){return je(this,as(Sn(this)))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return $h[Symbol.iterator]();default:return Sn(this)[Symbol.iterator]()}},pipe(){return J(this,arguments)}},Xe=e=>{const t=Object.create(r_);switch(t.backing=e,e._tag){case"IEmpty":{t.length=0,t.depth=0,t.left=t,t.right=t;break}case"IConcat":{t.length=e.left.length+e.right.length,t.depth=1+Math.max(e.left.depth,e.right.depth),t.left=e.left,t.right=e.right;break}case"IArray":{t.length=e.array.length,t.depth=0,t.left=Vt,t.right=Vt;break}case"ISingleton":{t.length=1,t.depth=0,t.left=Vt,t.right=Vt;break}case"ISlice":{t.length=e.length,t.depth=e.chunk.depth+1,t.left=Vt,t.right=Vt;break}}return t},Lh=e=>re(e,Ph),Vt=Xe({_tag:"IEmpty"}),rn=()=>Vt,ca=(...e)=>a_(e),Tt=e=>Xe({_tag:"ISingleton",a:e}),jh=e=>Lh(e)?e:Ei(We(e)),Ra=(e,t,n)=>{switch(e.backing._tag){case"IArray":{e_(e.backing.array,0,t,n,e.length);break}case"IConcat":{Ra(e.left,t,n),Ra(e.right,t,n+e.left.length);break}case"ISingleton":{t[n]=e.backing.a;break}case"ISlice":{let r=0,s=n;for(;r<e.length;)t[s]=Kn(e,r),r+=1,s+=1;break}}},s_=e=>{switch(e.backing._tag){case"IEmpty":return $h;case"IArray":return e.backing.array;default:{const t=new Array(e.length);return Ra(e,t,0),e.backing={_tag:"IArray",array:t},e.left=Vt,e.right=Vt,e.depth=0,t}}},Sn=s_,i_=e=>{switch(e.backing._tag){case"IEmpty":case"ISingleton":return e;case"IArray":return Xe({_tag:"IArray",array:Uc(e.backing.array)});case"IConcat":return Xe({_tag:"IConcat",left:er(e.backing.right),right:er(e.backing.left)});case"ISlice":return Ei(Uc(Sn(e)))}},er=i_,Ei=e=>e.length===0?rn():e.length===1?Tt(e[0]):Xe({_tag:"IArray",array:e}),a_=e=>Ei(e),Kn=m(2,(e,t)=>{switch(e.backing._tag){case"IEmpty":throw new Error("Index out of bounds");case"ISingleton":{if(t!==0)throw new Error("Index out of bounds");return e.backing.a}case"IArray":{if(t>=e.length||t<0)throw new Error("Index out of bounds");return e.backing.array[t]}case"IConcat":return t<e.left.length?Kn(e.left,t):Kn(e.right,t-e.left.length);case"ISlice":return Kn(e.backing.chunk,t+e.backing.offset)}}),o_=m(2,(e,t)=>Lt(e,Tt(t))),Bt=m(2,(e,t)=>Lt(Tt(t),e)),Ea=m(2,(e,t)=>{if(t<=0)return e;if(t>=e.length)return Vt;switch(e.backing._tag){case"ISlice":return Xe({_tag:"ISlice",chunk:e.backing.chunk,offset:e.backing.offset+t,length:e.backing.length-t});case"IConcat":return t>e.left.length?Ea(e.right,t-e.left.length):Xe({_tag:"IConcat",left:Ea(e.left,t),right:e.right});default:return Xe({_tag:"ISlice",chunk:e,offset:t,length:e.length-t})}}),Lt=m(2,(e,t)=>{if(e.backing._tag==="IEmpty")return t;if(t.backing._tag==="IEmpty")return e;const n=t.depth-e.depth;if(Math.abs(n)<=1)return Xe({_tag:"IConcat",left:e,right:t});if(n<-1)if(e.left.depth>=e.right.depth){const r=Lt(e.right,t);return Xe({_tag:"IConcat",left:e.left,right:r})}else{const r=Lt(e.right.right,t);if(r.depth===e.depth-3){const s=Xe({_tag:"IConcat",left:e.right.left,right:r});return Xe({_tag:"IConcat",left:e.left,right:s})}else{const s=Xe({_tag:"IConcat",left:e.left,right:e.right.left});return Xe({_tag:"IConcat",left:s,right:r})}}else if(t.right.depth>=t.left.depth){const r=Lt(e,t.left);return Xe({_tag:"IConcat",left:r,right:t.right})}else{const r=Lt(e,t.left.left);if(r.depth===t.depth-3){const s=Xe({_tag:"IConcat",left:r,right:t.left.right});return Xe({_tag:"IConcat",left:s,right:t.right})}else{const s=Xe({_tag:"IConcat",left:t.left.right,right:t.right});return Xe({_tag:"IConcat",left:r,right:s})}}}),c_=e=>e.length===0,tr=e=>e.length>0,Dh=e=>Kn(e,0),nr=Dh,yn=e=>Ea(e,1),Oa=Symbol.for("effect/Duration"),qh=BigInt(0),Hc=BigInt(24),Os=BigInt(60),Ca=BigInt(1e3),Gc=BigInt(1e6),Jc=BigInt(1e9),l_=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,sn=e=>{if(Bh(e))return e;if(wa(e))return Ma(e);if(kp(e))return la(e);if(Array.isArray(e)&&e.length===2&&e.every(wa))return e[0]===-1/0||e[1]===-1/0||Number.isNaN(e[0])||Number.isNaN(e[1])?zh:e[0]===1/0||e[1]===1/0?d_:la(BigInt(Math.round(e[0]*1e9))+BigInt(Math.round(e[1])));if(vp(e)){const t=l_.exec(e);if(t){const[n,r,s]=t,i=Number(r);switch(s){case"nano":case"nanos":return la(BigInt(r));case"micro":case"micros":return g_(BigInt(r));case"milli":case"millis":return Ma(i);case"second":case"seconds":return p_(i);case"minute":case"minutes":return m_(i);case"hour":case"hours":return __(i);case"day":case"days":return b_(i);case"week":case"weeks":return y_(i)}}}throw new Error("Invalid DurationInput")},Wc={_tag:"Millis",millis:0},u_={_tag:"Infinity"},h_={[Oa]:Oa,[te](){return je(this,nh(this.value))},[X](e){return Bh(e)&&T_(this,e)},toString(){return`Duration(${E_(this)})`},toJSON(){switch(this.value._tag){case"Millis":return{_id:"Duration",_tag:"Millis",millis:this.value.millis};case"Nanos":return{_id:"Duration",_tag:"Nanos",hrtime:k_(this)};case"Infinity":return{_id:"Duration",_tag:"Infinity"}}},[Ke](){return this.toJSON()},pipe(){return J(this,arguments)}},Gt=e=>{const t=Object.create(h_);return wa(e)?isNaN(e)||e<=0?t.value=Wc:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:"Millis",millis:e}:t.value={_tag:"Nanos",nanos:BigInt(Math.round(e*1e6))}:t.value=u_:e<=qh?t.value=Wc:t.value={_tag:"Nanos",nanos:e},t},Bh=e=>re(e,Oa),f_=e=>{switch(e.value._tag){case"Millis":return e.value.millis===0;case"Nanos":return e.value.nanos===qh;case"Infinity":return!1}},zh=Gt(0),d_=Gt(1/0),la=e=>Gt(e),g_=e=>Gt(e*Ca),Ma=e=>Gt(e),p_=e=>Gt(e*1e3),m_=e=>Gt(e*6e4),__=e=>Gt(e*36e5),b_=e=>Gt(e*864e5),y_=e=>Gt(e*6048e5),Aa=e=>x_(e,{onMillis:t=>t,onNanos:t=>Number(t)/1e6}),v_=e=>{const t=sn(e);switch(t.value._tag){case"Infinity":throw new Error("Cannot convert infinite duration to nanos");case"Nanos":return t.value.nanos;case"Millis":return BigInt(Math.round(t.value.millis*1e6))}},k_=e=>{const t=sn(e);switch(t.value._tag){case"Infinity":return[1/0,0];case"Nanos":return[Number(t.value.nanos/Jc),Number(t.value.nanos%Jc)];case"Millis":return[Math.floor(t.value.millis/1e3),Math.round(t.value.millis%1e3*1e6)]}},x_=m(2,(e,t)=>{const n=sn(e);switch(n.value._tag){case"Nanos":return t.onNanos(n.value.nanos);case"Infinity":return t.onMillis(1/0);case"Millis":return t.onMillis(n.value.millis)}}),Ao=m(3,(e,t,n)=>{const r=sn(e),s=sn(t);if(r.value._tag==="Infinity"||s.value._tag==="Infinity")return n.onMillis(Aa(r),Aa(s));if(r.value._tag==="Nanos"||s.value._tag==="Nanos"){const i=r.value._tag==="Nanos"?r.value.nanos:BigInt(Math.round(r.value.millis*1e6)),a=s.value._tag==="Nanos"?s.value.nanos:BigInt(Math.round(s.value.millis*1e6));return n.onNanos(i,a)}return n.onMillis(r.value.millis,s.value.millis)}),S_=(e,t)=>Ao(e,t,{onMillis:(n,r)=>n===r,onNanos:(n,r)=>n===r}),w_=m(2,(e,t)=>Ao(e,t,{onMillis:(n,r)=>n<=r,onNanos:(n,r)=>n<=r})),I_=m(2,(e,t)=>Ao(e,t,{onMillis:(n,r)=>n>=r,onNanos:(n,r)=>n>=r})),T_=m(2,(e,t)=>S_(sn(e),sn(t))),R_=e=>{const t=sn(e);if(t.value._tag==="Infinity")return{days:1/0,hours:1/0,minutes:1/0,seconds:1/0,millis:1/0,nanos:1/0};const n=v_(t),r=n/Gc,s=r/Ca,i=s/Os,a=i/Os,o=a/Hc;return{days:Number(o),hours:Number(a%Hc),minutes:Number(i%Os),seconds:Number(s%Os),millis:Number(r%Ca),nanos:Number(n%Gc)}},E_=e=>{const t=sn(e);if(t.value._tag==="Infinity")return"Infinity";if(f_(t))return"0";const n=R_(t),r=[];return n.days!==0&&r.push(`${n.days}d`),n.hours!==0&&r.push(`${n.hours}h`),n.minutes!==0&&r.push(`${n.minutes}m`),n.seconds!==0&&r.push(`${n.seconds}s`),n.millis!==0&&r.push(`${n.millis}ms`),n.nanos!==0&&r.push(`${n.nanos}ns`),r.join(" ")},En=5,No=Math.pow(2,En),O_=No-1,C_=No/2,M_=No/4;function A_(e){return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),e=e+(e>>4)&252645135,e+=e>>8,e+=e>>16,e&127}function rr(e,t){return t>>>e&O_}function Un(e){return 1<<e}function Uh(e,t){return A_(e&t-1)}const N_=(e,t)=>({value:e,previous:t});function Hn(e,t,n,r){let s=r;if(!e){const i=r.length;s=new Array(i);for(let a=0;a<i;++a)s[a]=r[a]}return s[t]=n,s}function Vh(e,t,n){const r=n.length-1;let s=0,i=0,a=n;if(e)s=i=t;else for(a=new Array(r);s<t;)a[i++]=n[s++];for(++s;s<=r;)a[i++]=n[s++];return e&&(a.length=r),a}function F_(e,t,n,r){const s=r.length;if(e){let c=s;for(;c>=t;)r[c--]=r[c];return r[t]=n,r}let i=0,a=0;const o=new Array(s+1);for(;i<t;)o[a++]=r[i++];for(o[t]=n;i<s;)o[++a]=r[i++];return o}class fn{constructor(){h(this,"_tag","EmptyNode")}modify(t,n,r,s,i,a){const o=r(G());return _t(o)?new fn:(++a.value,new wn(t,s,i,o))}}function jt(e){return Zu(e,"EmptyNode")}function P_(e){return jt(e)||e._tag==="LeafNode"||e._tag==="CollisionNode"}function Oi(e,t){return jt(e)?!1:t===e.edit}class wn{constructor(t,n,r,s){h(this,"edit");h(this,"hash");h(this,"key");h(this,"value");h(this,"_tag","LeafNode");this.edit=t,this.hash=n,this.key=r,this.value=s}modify(t,n,r,s,i,a){if(ne(i,this.key)){const c=r(this.value);return c===this.value?this:_t(c)?(--a.value,new fn):Oi(this,t)?(this.value=c,this):new wn(t,s,i,c)}const o=r(G());return _t(o)?this:(++a.value,Kh(t,n,this.hash,this,s,new wn(t,s,i,o)))}}class Fo{constructor(t,n,r){h(this,"edit");h(this,"hash");h(this,"children");h(this,"_tag","CollisionNode");this.edit=t,this.hash=n,this.children=r}modify(t,n,r,s,i,a){if(s===this.hash){const c=Oi(this,t),u=this.updateCollisionList(c,t,this.hash,this.children,r,i,a);return u===this.children?this:u.length>1?new Fo(t,this.hash,u):u[0]}const o=r(G());return _t(o)?this:(++a.value,Kh(t,n,this.hash,this,s,new wn(t,s,i,o)))}updateCollisionList(t,n,r,s,i,a,o){const c=s.length;for(let f=0;f<c;++f){const g=s[f];if("key"in g&&ne(a,g.key)){const p=g.value,d=i(p);return d===p?s:_t(d)?(--o.value,Vh(t,f,s)):Hn(t,f,new wn(n,r,a,d),s)}}const u=i(G());return _t(u)?s:(++o.value,Hn(t,c,new wn(n,r,a,u),s))}}class sr{constructor(t,n,r){h(this,"edit");h(this,"mask");h(this,"children");h(this,"_tag","IndexedNode");this.edit=t,this.mask=n,this.children=r}modify(t,n,r,s,i,a){const o=this.mask,c=this.children,u=rr(n,s),f=Un(u),g=Uh(o,f),p=o&f,d=Oi(this,t);if(!p){const D=new fn().modify(t,n+En,r,s,i,a);return D?c.length>=C_?L_(t,u,D,o,c):new sr(t,o|f,F_(d,g,D,c)):this}const _=c[g],x=_.modify(t,n+En,r,s,i,a);if(_===x)return this;let w=o,A;if(jt(x)){if(w&=~f,!w)return new fn;if(c.length<=2&&P_(c[g^1]))return c[g^1];A=Vh(d,g,c)}else A=Hn(d,g,x,c);return d?(this.mask=w,this.children=A,this):new sr(t,w,A)}}class Po{constructor(t,n,r){h(this,"edit");h(this,"size");h(this,"children");h(this,"_tag","ArrayNode");this.edit=t,this.size=n,this.children=r}modify(t,n,r,s,i,a){let o=this.size;const c=this.children,u=rr(n,s),f=c[u],g=(f||new fn).modify(t,n+En,r,s,i,a);if(f===g)return this;const p=Oi(this,t);let d;if(jt(f)&&!jt(g))++o,d=Hn(p,u,g,c);else if(!jt(f)&&jt(g)){if(--o,o<=M_)return $_(t,o,u,c);d=Hn(p,u,new fn,c)}else d=Hn(p,u,g,c);return p?(this.size=o,this.children=d,this):new Po(t,o,d)}}function $_(e,t,n,r){const s=new Array(t-1);let i=0,a=0;for(let o=0,c=r.length;o<c;++o)if(o!==n){const u=r[o];u&&!jt(u)&&(s[i++]=u,a|=1<<o)}return new sr(e,a,s)}function L_(e,t,n,r,s){const i=[];let a=r,o=0;for(let c=0;a;++c)a&1&&(i[c]=s[o++]),a>>>=1;return i[t]=n,new Po(e,o+1,i)}function j_(e,t,n,r,s,i){if(n===s)return new Fo(e,n,[i,r]);const a=rr(t,n),o=rr(t,s);if(a===o)return c=>new sr(e,Un(a)|Un(o),[c]);{const c=a<o?[r,i]:[i,r];return new sr(e,Un(a)|Un(o),c)}}function Kh(e,t,n,r,s,i){let a,o=t;for(;;){const c=j_(e,o,n,r,s,i);if(typeof c=="function")a=N_(c,a),o=o+En;else{let u=c;for(;a!=null;)u=a.value(u),a=a.previous;return u}}}const Hh="effect/HashMap",Na=Symbol.for(Hh),D_={[Na]:Na,[Symbol.iterator](){return new Ci(this,(e,t)=>[e,t])},[te](){let e=P(Hh);for(const t of this)e^=k(P(t[0]),me(P(t[1])));return je(this,e)},[X](e){if(z_(e)){if(e._size!==this._size)return!1;for(const t of this){const n=k(e,Lo(t[0],P(t[0])));if(_t(n))return!1;if(!ne(t[1],n.value))return!1}return!0}return!1},toString(){return ot(this.toJSON())},toJSON(){return{_id:"HashMap",values:Array.from(this).map(rt)}},[Ke](){return this.toJSON()},pipe(){return J(this,arguments)}},$o=(e,t,n,r)=>{const s=Object.create(D_);return s._editable=e,s._edit=t,s._root=n,s._size=r,s};class Ci{constructor(t,n){h(this,"map");h(this,"f");h(this,"v");this.map=t,this.f=n,this.v=Gh(this.map._root,this.f,void 0)}next(){if(_t(this.v))return{done:!0,value:void 0};const t=this.v.value;return this.v=si(t.cont),{done:!1,value:t.value}}[Symbol.iterator](){return new Ci(this.map,this.f)}}const si=e=>e?Jh(e[0],e[1],e[2],e[3],e[4]):G(),Gh=(e,t,n=void 0)=>{switch(e._tag){case"LeafNode":return Kt(e.value)?de({value:t(e.key,e.value.value),cont:n}):si(n);case"CollisionNode":case"ArrayNode":case"IndexedNode":{const r=e.children;return Jh(r.length,r,0,t,n)}default:return si(n)}},Jh=(e,t,n,r,s)=>{for(;n<e;){const i=t[n++];if(i&&!jt(i))return Gh(i,r,[e,t,n,r,s])}return si(s)},q_=$o(!1,0,new fn,0),Mi=()=>q_,B_=e=>{const t=Yh(Mi());for(const n of e)Kr(t,n[0],n[1]);return G_(t)},z_=e=>re(e,Na),U_=e=>e&&jt(e._root),V_=m(2,(e,t)=>Lo(e,t,P(t))),Lo=m(3,(e,t,n)=>{let r=e._root,s=0;for(;;)switch(r._tag){case"LeafNode":return ne(t,r.key)?r.value:G();case"CollisionNode":{if(n===r.hash){const i=r.children;for(let a=0,o=i.length;a<o;++a){const c=i[a];if("key"in c&&ne(t,c.key))return c.value}}return G()}case"IndexedNode":{const i=rr(s,n),a=Un(i);if(r.mask&a){r=r.children[Uh(r.mask,a)],s+=En;break}return G()}case"ArrayNode":{if(r=r.children[rr(s,n)],r){s+=En;break}return G()}default:return G()}}),K_=m(2,(e,t)=>Kt(Lo(e,t,P(t)))),Kr=m(3,(e,t,n)=>jo(e,t,()=>de(n))),H_=m(3,(e,t,n)=>e._editable?(e._root=t,e._size=n,e):t===e._root?e:$o(e._editable,e._edit,t,n)),Wh=e=>new Ci(e,t=>t),Fa=e=>e._size,Yh=e=>$o(!0,e._edit+1,e._root,e._size),G_=e=>(e._editable=!1,e),jo=m(3,(e,t,n)=>J_(e,t,P(t),n)),J_=m(4,(e,t,n,r)=>{const s={value:e._size},i=e._root.modify(e._editable?e._edit:NaN,0,r,n,t,s);return k(e,H_(i,s.value))}),Yc=m(2,(e,t)=>jo(e,t,G)),W_=m(2,(e,t)=>Ai(e,Mi(),(n,r,s)=>Kr(n,s,t(r,s)))),Y_=m(2,(e,t)=>Ai(e,void 0,(n,r,s)=>t(r,s))),Ai=m(3,(e,t,n)=>{const r=e._root;if(r._tag==="LeafNode")return Kt(r.value)?n(t,r.value.value,r.key):t;if(r._tag==="EmptyNode")return t;const s=[r.children];let i;for(;i=s.pop();)for(let a=0,o=i.length;a<o;){const c=i[a++];c&&!jt(c)&&(c._tag==="LeafNode"?Kt(c.value)&&(t=n(t,c.value.value,c.key)):s.push(c.children))}return t}),Zh="effect/HashSet",Pa=Symbol.for(Zh),Z_={[Pa]:Pa,[Symbol.iterator](){return Wh(this._keyMap)},[te](){return je(this,me(P(this._keyMap))(P(Zh)))},[X](e){return Q_(e)?Fa(this._keyMap)===Fa(e._keyMap)&&ne(this._keyMap,e._keyMap):!1},toString(){return ot(this.toJSON())},toJSON(){return{_id:"HashSet",values:Array.from(this).map(rt)}},[Ke](){return this.toJSON()},pipe(){return J(this,arguments)}},Ni=e=>{const t=Object.create(Z_);return t._keyMap=e,t},Q_=e=>re(e,Pa),X_=Ni(Mi()),Fi=()=>X_,eb=e=>{const t=Do(Fi());for(const n of e)Hr(t,n);return qo(t)},tb=(...e)=>{const t=Do(Fi());for(const n of e)Hr(t,n);return qo(t)},nb=m(2,(e,t)=>K_(e._keyMap,t)),rb=e=>Fa(e._keyMap),Do=e=>Ni(Yh(e._keyMap)),qo=e=>(e._keyMap._editable=!1,e),Qh=m(2,(e,t)=>{const n=Do(e);return t(n),qo(n)}),Hr=m(2,(e,t)=>e._keyMap._editable?(Kr(t,!0)(e._keyMap),e):Ni(Kr(t,!0)(e._keyMap))),Xh=m(2,(e,t)=>e._keyMap._editable?(Yc(t)(e._keyMap),e):Ni(Yc(t)(e._keyMap))),sb=m(2,(e,t)=>Qh(e,n=>{for(const r of t)Xh(n,r)})),ib=m(2,(e,t)=>Qh(Fi(),n=>{ab(e,r=>Hr(n,r));for(const r of t)Hr(n,r)})),ab=m(2,(e,t)=>Y_(e._keyMap,(n,r)=>t(r))),ob=m(3,(e,t,n)=>Ai(e._keyMap,t,(r,s,i)=>n(r,i))),On=Fi,cb=eb,Bo=tb,lb=nb,ef=rb,Br=Hr,tf=Xh,Zc=sb,Gr=ib,ii=ob,Qc=Symbol.for("effect/MutableRef"),ub={[Qc]:Qc,toString(){return ot(this.toJSON())},toJSON(){return{_id:"MutableRef",current:rt(this.current)}},[Ke](){return this.toJSON()},pipe(){return J(this,arguments)}},nf=e=>{const t=Object.create(ub);return t.current=e,t},Pi=e=>e.current,rf=m(2,(e,t)=>(e.current=t,e)),zo="effect/FiberId",Jr=Symbol.for(zo),ai="None",$a="Runtime",hb="Composite",fb=Ve(`${zo}-${ai}`);var Zl;let db=class{constructor(){h(this,Zl,Jr);h(this,"_tag",ai);h(this,"id",-1);h(this,"startTimeMillis",-1)}[(Zl=Jr,te)](){return fb}[X](t){return sf(t)&&t._tag===ai}toString(){return ot(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag}}[Ke](){return this.toJSON()}};var Ql;class gb{constructor(t,n){h(this,"id");h(this,"startTimeMillis");h(this,Ql,Jr);h(this,"_tag",$a);this.id=t,this.startTimeMillis=n}[(Ql=Jr,te)](){return je(this,Ve(`${zo}-${this._tag}-${this.id}-${this.startTimeMillis}`))}[X](t){return sf(t)&&t._tag===$a&&this.id===t.id&&this.startTimeMillis===t.startTimeMillis}toString(){return ot(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag,id:this.id,startTimeMillis:this.startTimeMillis}}[Ke](){return this.toJSON()}}const pb=new db,sf=e=>re(e,Jr),La=e=>{switch(e._tag){case ai:return On();case $a:return Bo(e.id);case hb:return k(La(e.left),Gr(La(e.right)))}},Xc=ye(Symbol.for("effect/Fiber/Id/_fiberCounter"),()=>nf(0)),af=e=>Array.from(La(e)).map(n=>`#${n}`).join(","),mb=()=>{const e=Pi(Xc);return k(Xc,rf(e+1)),new gb(e,Date.now())},ir=pb,_b=af,bb=mb,Uo=Mi,yb=B_,vb=U_,of=V_,cf=Kr,lf=Wh,kb=jo,xb=W_,uf=Ai,Wr=Symbol.for("effect/List"),ja=e=>We(e),Sb=e=>bp(Co(e),ja),wb=Sb(ne),Ib={[Wr]:Wr,_tag:"Cons",toString(){return ot(this.toJSON())},toJSON(){return{_id:"List",_tag:"Cons",values:ja(this).map(rt)}},[Ke](){return this.toJSON()},[X](e){return ff(e)&&this._tag===e._tag&&wb(this,e)},[te](){return je(this,as(ja(this)))},[Symbol.iterator](){let e=!1,t=this;return{next(){if(e)return this.return();if(t._tag==="Nil")return e=!0,this.return();const n=t.head;return t=t.tail,{done:e,value:n}},return(n){return e||(e=!0),{done:!0,value:n}}}},pipe(){return J(this,arguments)}},oi=(e,t)=>{const n=Object.create(Ib);return n.head=e,n.tail=t,n},Tb=Ve("Nil"),Rb={[Wr]:Wr,_tag:"Nil",toString(){return ot(this.toJSON())},toJSON(){return{_id:"List",_tag:"Nil"}},[Ke](){return this.toJSON()},[te](){return Tb},[X](e){return ff(e)&&this._tag===e._tag},[Symbol.iterator](){return{next(){return{done:!0,value:void 0}}}},pipe(){return J(this,arguments)}},hf=Object.create(Rb),ff=e=>re(e,Wr),tn=e=>e._tag==="Nil",Eb=e=>e._tag==="Cons",Ob=()=>hf,Cn=(e,t)=>oi(e,t),ar=Ob,Vo=e=>oi(e,hf),Cb=m(2,(e,t)=>Ab(t,e)),Mb=m(2,(e,t)=>Cn(t,e)),Ab=m(2,(e,t)=>{if(tn(e))return t;if(tn(t))return e;{const n=oi(t.head,e);let r=n,s=t.tail;for(;!tn(s);){const i=oi(s.head,e);r.tail=i,r=i,s=s.tail}return n}}),Nb=m(3,(e,t,n)=>{let r=t,s=e;for(;!tn(s);)r=n(r,s.head),s=s.tail;return r}),Fb=e=>{let t=ar(),n=e;for(;!tn(n);)t=Mb(t,n.head),n=n.tail;return t},Ko=(function(){function e(t){t&&Object.assign(this,t)}return e.prototype=Ro,e})(),Pb=Symbol.for("effect/DifferContextPatch");function el(e){return e}const hs={...Ko.prototype,[Pb]:{_Value:el,_Patch:el}},$b=Object.assign(Object.create(hs),{_tag:"Empty"}),Lb=Object.create($b),df=()=>Lb,jb=Object.assign(Object.create(hs),{_tag:"AndThen"}),Db=(e,t)=>{const n=Object.create(jb);return n.first=e,n.second=t,n},qb=Object.assign(Object.create(hs),{_tag:"AddService"}),Bb=(e,t)=>{const n=Object.create(qb);return n.key=e,n.service=t,n},zb=Object.assign(Object.create(hs),{_tag:"RemoveService"}),Ub=e=>{const t=Object.create(zb);return t.key=e,t},Vb=Object.assign(Object.create(hs),{_tag:"UpdateService"}),Kb=(e,t)=>{const n=Object.create(Vb);return n.key=e,n.update=t,n},Hb=(e,t)=>{const n=new Map(e.unsafeMap);let r=df();for(const[s,i]of t.unsafeMap.entries())if(n.has(s)){const a=n.get(s);n.delete(s),ne(a,i)||(r=Bs(Kb(s,()=>i))(r))}else n.delete(s),r=Bs(Bb(s,i))(r);for(const[s]of n.entries())r=Bs(Ub(s))(r);return r},Bs=m(2,(e,t)=>Db(e,t)),Gb=m(2,(e,t)=>{if(e._tag==="Empty")return t;let n=!1,r=Tt(e);const s=new Map(t.unsafeMap);for(;tr(r);){const a=nr(r),o=yn(r);switch(a._tag){case"Empty":{r=o;break}case"AddService":{s.set(a.key,a.service),r=o;break}case"AndThen":{r=Bt(Bt(o,a.second),a.first);break}case"RemoveService":{s.delete(a.key),r=o;break}case"UpdateService":{s.set(a.key,a.update(s.get(a.key))),n=!0,r=o;break}}}if(!n)return Xn(s);const i=new Map;for(const[a]of t.unsafeMap)s.has(a)&&(i.set(a,s.get(a)),s.delete(a));for(const[a,o]of s)i.set(a,o);return Xn(i)}),Jb=Symbol.for("effect/DifferHashSetPatch");function ua(e){return e}const $i={...Ko.prototype,[Jb]:{_Value:ua,_Key:ua,_Patch:ua}},Wb=Object.assign(Object.create($i),{_tag:"Empty"}),Yb=Object.create(Wb),gf=()=>Yb,Zb=Object.assign(Object.create($i),{_tag:"AndThen"}),Qb=(e,t)=>{const n=Object.create(Zb);return n.first=e,n.second=t,n},Xb=Object.assign(Object.create($i),{_tag:"Add"}),ey=e=>{const t=Object.create(Xb);return t.value=e,t},ty=Object.assign(Object.create($i),{_tag:"Remove"}),ny=e=>{const t=Object.create(ty);return t.value=e,t},ry=(e,t)=>{const[n,r]=ii([e,gf()],([s,i],a)=>lb(a)(s)?[tf(a)(s),i]:[s,Da(ey(a))(i)])(t);return ii(r,(s,i)=>Da(ny(i))(s))(n)},Da=m(2,(e,t)=>Qb(e,t)),sy=m(2,(e,t)=>{if(e._tag==="Empty")return t;let n=t,r=Tt(e);for(;tr(r);){const s=nr(r),i=yn(r);switch(s._tag){case"Empty":{r=i;break}case"AndThen":{r=Bt(s.first)(Bt(s.second)(i));break}case"Add":{n=Br(s.value)(n),r=i;break}case"Remove":n=tf(s.value)(n),r=i}}return n}),iy=Symbol.for("effect/DifferReadonlyArrayPatch");function tl(e){return e}const fs={...Ko.prototype,[iy]:{_Value:tl,_Patch:tl}},ay=Object.assign(Object.create(fs),{_tag:"Empty"}),oy=Object.create(ay),pf=()=>oy,cy=Object.assign(Object.create(fs),{_tag:"AndThen"}),ly=(e,t)=>{const n=Object.create(cy);return n.first=e,n.second=t,n},uy=Object.assign(Object.create(fs),{_tag:"Append"}),hy=e=>{const t=Object.create(uy);return t.values=e,t},fy=Object.assign(Object.create(fs),{_tag:"Slice"}),dy=(e,t)=>{const n=Object.create(fy);return n.from=e,n.until=t,n},gy=Object.assign(Object.create(fs),{_tag:"Update"}),py=(e,t)=>{const n=Object.create(gy);return n.index=e,n.patch=t,n},my=e=>{let t=0,n=pf();for(;t<e.oldValue.length&&t<e.newValue.length;){const r=e.oldValue[t],s=e.newValue[t],i=e.differ.diff(r,s);ne(i,e.differ.empty)||(n=zs(n,py(t,i))),t=t+1}return t<e.oldValue.length&&(n=zs(n,dy(0,t))),t<e.newValue.length&&(n=zs(n,hy(Im(t)(e.newValue)))),n},zs=m(2,(e,t)=>ly(e,t)),_y=m(3,(e,t,n)=>{if(e._tag==="Empty")return t;let r=t.slice(),s=Nt(e);for(;ym(s);){const i=xt(s),a=Zn(s);switch(i._tag){case"Empty":{s=a;break}case"AndThen":{a.unshift(i.first,i.second),s=a;break}case"Append":{for(const o of i.values)r.push(o);s=a;break}case"Slice":{r=r.slice(i.from,i.until),s=a;break}case"Update":{r[i.index]=n.patch(i.patch,r[i.index]),s=a;break}}}return r}),by=Symbol.for("effect/Differ"),yy={[by]:{_P:Me,_V:Me},pipe(){return J(this,arguments)}},_r=e=>{const t=Object.create(yy);return t.empty=e.empty,t.diff=e.diff,t.combine=e.combine,t.patch=e.patch,t},vy=()=>_r({empty:df(),combine:(e,t)=>Bs(t)(e),diff:(e,t)=>Hb(e,t),patch:(e,t)=>Gb(t)(e)}),ky=()=>_r({empty:gf(),combine:(e,t)=>Da(t)(e),diff:(e,t)=>ry(e,t),patch:(e,t)=>sy(t)(e)}),xy=e=>_r({empty:pf(),combine:(t,n)=>zs(t,n),diff:(t,n)=>my({oldValue:t,newValue:n,differ:e}),patch:(t,n)=>_y(t,n,e)}),mf=()=>Sy((e,t)=>t),Sy=e=>_r({empty:Me,combine:(t,n)=>t===Me?n:n===Me?t:r=>n(t(r)),diff:(t,n)=>ne(t,n)?Me:xi(n),patch:(t,n)=>e(n,t(n))}),Yr=255,_f=8,qa=e=>e&Yr,Ba=e=>e>>_f&Yr,ds=(e,t)=>(e&Yr)+((t&e&Yr)<<_f),wy=ds(0,0),Iy=e=>ds(e,e),Ty=e=>ds(e,0),Ry=m(2,(e,t)=>ds(qa(e)&~t,Ba(e))),Ey=m(2,(e,t)=>e|t),Oy=e=>~e>>>0&Yr,Cy=0,gs=1,My=2,Ay=4,za=16,Ny=32,Fy=e=>Li(e,Ny),Py=m(2,(e,t)=>e|t),ln=e=>bf(e)&&!jy(e),bf=e=>Li(e,gs),Li=m(2,(e,t)=>(e&t)!==0),$y=(...e)=>e.reduce((t,n)=>t|n,0),Ly=$y(Cy),nl=e=>Li(e,Ay),jy=e=>Li(e,za),Us=m(2,(e,t)=>ds(e^t,t)),Vs=m(2,(e,t)=>e&(Oy(qa(t))|Ba(t))|qa(t)&Ba(t)),rl=_r({empty:wy,diff:(e,t)=>Us(e,t),combine:(e,t)=>Ey(t)(e),patch:(e,t)=>Vs(t,e)}),Dy=Iy,yf=Ty,sl=Ry,vf=(e,t)=>({_tag:"Par",left:e,right:t}),Cs=(e,t)=>({_tag:"Seq",left:e,right:t}),qy=e=>{let t=Vo(e),n=ar();for(;;){const[r,s]=Nb(t,[kf(),ar()],([i,a],o)=>{const[c,u]=By(o);return[Hy(i,c),Cb(a,u)]});if(n=zy(n,r),tn(s))return Fb(n);t=s}throw new Error("BUG: BlockedRequests.flatten - please report an issue at https://github.com/Effect-TS/effect/issues")},By=e=>{let t=e,n=kf(),r=ar(),s=ar();for(;;)switch(t._tag){case"Empty":{if(tn(r))return[n,s];t=r.head,r=r.tail;break}case"Par":{r=Cn(t.right,r),t=t.left;break}case"Seq":{const i=t.left,a=t.right;switch(i._tag){case"Empty":{t=a;break}case"Par":{const o=i.left,c=i.right;t=vf(Cs(o,a),Cs(c,a));break}case"Seq":{const o=i.left,c=i.right;t=Cs(o,Cs(c,a));break}case"Single":{t=i,s=Cn(a,s);break}}break}case"Single":{if(n=Ky(n,t),tn(r))return[n,s];t=r.head,r=r.tail;break}}throw new Error("BUG: BlockedRequests.step - please report an issue at https://github.com/Effect-TS/effect/issues")},zy=(e,t)=>{if(tn(e))return Vo(ha(t));if(Gy(t))return e;const n=Xy(e.head),r=Jy(t);return n.length===1&&r.length===1&&ne(n[0],r[0])?Cn(Qy(e.head,ha(t)),e.tail):Cn(ha(t),e)},Uy=Symbol.for("effect/RequestBlock/RequestBlockParallel"),Vy={_R:e=>e};var Xl;Xl=Uy;class Ho{constructor(t){h(this,"map");h(this,Xl,Vy);this.map=t}}const kf=()=>new Ho(Uo()),Ky=(e,t)=>new Ho(kb(e.map,t.dataSource,n=>om(cm(n,o_(t.blockedRequest)),()=>Tt(t.blockedRequest)))),Hy=(e,t)=>new Ho(uf(e.map,t.map,(n,r,s)=>cf(n,s,$n(of(n,s),{onNone:()=>r,onSome:i=>Lt(r,i)})))),Gy=e=>vb(e.map),Jy=e=>Array.from(lf(e.map)),ha=e=>Zy(xb(e.map,t=>Tt(t))),Wy=Symbol.for("effect/RequestBlock/RequestBlockSequential"),Yy={_R:e=>e};var eu;eu=Wy;class xf{constructor(t){h(this,"map");h(this,eu,Yy);this.map=t}}const Zy=e=>new xf(e),Qy=(e,t)=>new xf(uf(t.map,e.map,(n,r,s)=>cf(n,s,$n(of(n,s),{onNone:()=>rn(),onSome:i=>Lt(i,r)})))),Xy=e=>Array.from(lf(e.map)),ev=e=>Array.from(e.map),ps="Die",Mn="Empty",br="Fail",yr="Interrupt",or="Parallel",cr="Sequential",Sf="effect/Cause",wf=Symbol.for(Sf),tv={_E:e=>e},vr={[wf]:tv,[te](){return k(P(Sf),me(P(gv(this))),je(this))},[X](e){return nv(e)&&dv(this,e)},pipe(){return J(this,arguments)},toJSON(){switch(this._tag){case"Empty":return{_id:"Cause",_tag:this._tag};case"Die":return{_id:"Cause",_tag:this._tag,defect:rt(this.defect)};case"Interrupt":return{_id:"Cause",_tag:this._tag,fiberId:this.fiberId.toJSON()};case"Fail":return{_id:"Cause",_tag:this._tag,failure:rt(this.error)};case"Sequential":case"Parallel":return{_id:"Cause",_tag:this._tag,left:rt(this.left),right:rt(this.right)}}},toString(){return Di(this)},[Ke](){return this.toJSON()}},lr=(()=>{const e=Object.create(vr);return e._tag=Mn,e})(),Ua=e=>{const t=Object.create(vr);return t._tag=br,t.error=e,t},nn=e=>{const t=Object.create(vr);return t._tag=ps,t.defect=e,t},un=e=>{const t=Object.create(vr);return t._tag=yr,t.fiberId=e,t},ji=(e,t)=>{const n=Object.create(vr);return n._tag=or,n.left=e,n.right=t,n},Mt=(e,t)=>{const n=Object.create(vr);return n._tag=cr,n.left=e,n.right=t,n},nv=e=>re(e,wf),rv=e=>e._tag===Mn,sv=e=>e._tag===Mn?!0:ur(e,!0,(t,n)=>{switch(n._tag){case Mn:return de(t);case ps:case br:case yr:return de(!1);default:return G()}}),iv=e=>Kt(hv(e)),Go=e=>Jo(void 0,mv)(e),av=e=>er(ur(e,rn(),(t,n)=>n._tag===br?de(k(t,Bt(n.error))):G())),ov=e=>er(ur(e,rn(),(t,n)=>n._tag===ps?de(k(t,Bt(n.defect))):G())),cv=e=>ur(e,On(),(t,n)=>n._tag===yr?de(k(t,Br(n.fiberId))):G()),lv=e=>If(e,t=>t._tag===br?de(t.error):G()),uv=e=>{const t=lv(e);switch(t._tag){case"None":return en(e);case"Some":return Yn(t.value)}},hv=e=>If(e,t=>t._tag===yr?de(t.fiberId):G()),il=e=>Tf(e,{onEmpty:lr,onFail:()=>lr,onDie:nn,onInterrupt:un,onSequential:Mt,onParallel:ji}),fv=e=>Tf(e,{onEmpty:lr,onFail:nn,onDie:nn,onInterrupt:un,onSequential:Mt,onParallel:ji}),dv=(e,t)=>{let n=Tt(e),r=Tt(t);for(;tr(n)&&tr(r);){const[s,i]=k(nr(n),ur([On(),rn()],([c,u],f)=>{const[g,p]=Va(f);return de([k(c,Gr(g)),k(u,Lt(p))])})),[a,o]=k(nr(r),ur([On(),rn()],([c,u],f)=>{const[g,p]=Va(f);return de([k(c,Gr(g)),k(u,Lt(p))])}));if(!ne(s,a))return!1;n=i,r=o}return!0},gv=e=>pv(Tt(e),rn()),pv=(e,t)=>{for(;;){const[n,r]=k(e,wh([On(),rn()],([i,a],o)=>{const[c,u]=Va(o);return[k(i,Gr(c)),k(a,Lt(u))]})),s=ef(n)>0?k(t,Bt(n)):t;if(c_(r))return er(s);e=r,t=s}throw new Error(Ii("Cause.flattenCauseLoop"))},If=m(2,(e,t)=>{const n=[e];for(;n.length>0;){const r=n.pop(),s=t(r);switch(s._tag){case"None":{switch(r._tag){case cr:case or:{n.push(r.right),n.push(r.left);break}}break}case"Some":return s}}return G()}),Va=e=>{let t=e;const n=[];let r=On(),s=rn();for(;t!==void 0;)switch(t._tag){case Mn:{if(n.length===0)return[r,s];t=n.pop();break}case br:{if(r=Br(r,ca(t._tag,t.error)),n.length===0)return[r,s];t=n.pop();break}case ps:{if(r=Br(r,ca(t._tag,t.defect)),n.length===0)return[r,s];t=n.pop();break}case yr:{if(r=Br(r,ca(t._tag,t.fiberId)),n.length===0)return[r,s];t=n.pop();break}case cr:{switch(t.left._tag){case Mn:{t=t.right;break}case cr:{t=Mt(t.left.left,Mt(t.left.right,t.right));break}case or:{t=ji(Mt(t.left.left,t.right),Mt(t.left.right,t.right));break}default:{s=Bt(s,t.right),t=t.left;break}}break}case or:{n.push(t.right),t=t.left;break}}throw new Error(Ii("Cause.evaluateCauseLoop"))},mv={emptyCase:Bc,failCase:Sa,dieCase:Sa,interruptCase:Bc,sequentialCase:(e,t,n)=>t&&n,parallelCase:(e,t,n)=>t&&n},al="SequentialCase",ol="ParallelCase",Tf=m(2,(e,{onDie:t,onEmpty:n,onFail:r,onInterrupt:s,onParallel:i,onSequential:a})=>Jo(e,void 0,{emptyCase:()=>n,failCase:(o,c)=>r(c),dieCase:(o,c)=>t(c),interruptCase:(o,c)=>s(c),sequentialCase:(o,c,u)=>a(c,u),parallelCase:(o,c,u)=>i(c,u)})),ur=m(3,(e,t,n)=>{let r=t,s=e;const i=[];for(;s!==void 0;){const a=n(r,s);switch(r=Kt(a)?a.value:r,s._tag){case cr:{i.push(s.right),s=s.left;break}case or:{i.push(s.right),s=s.left;break}default:{s=void 0;break}}s===void 0&&i.length>0&&(s=i.pop())}return r}),Jo=m(3,(e,t,n)=>{const r=[e],s=[];for(;r.length>0;){const a=r.pop();switch(a._tag){case Mn:{s.push(en(n.emptyCase(t)));break}case br:{s.push(en(n.failCase(t,a.error)));break}case ps:{s.push(en(n.dieCase(t,a.defect)));break}case yr:{s.push(en(n.interruptCase(t,a.fiberId)));break}case cr:{r.push(a.right),r.push(a.left),s.push(Yn({_tag:al}));break}case or:{r.push(a.right),r.push(a.left),s.push(Yn({_tag:ol}));break}}}const i=[];for(;s.length>0;){const a=s.pop();switch(a._tag){case"Left":{switch(a.left._tag){case al:{const o=i.pop(),c=i.pop(),u=n.sequentialCase(t,o,c);i.push(u);break}case ol:{const o=i.pop(),c=i.pop(),u=n.parallelCase(t,o,c);i.push(u);break}}break}case"Right":{i.push(a.right);break}}}if(i.length===0)throw new Error("BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");return i.pop()}),Di=(e,t)=>Go(e)?"All fibers interrupted without errors.":kv(e).map(function(n){return(t==null?void 0:t.renderErrorCause)!==!0||n.cause===void 0?n.stack:`${n.stack} {
63
- ${Rf(n.cause," ")}
64
- }`}).join(`
65
- `),Rf=(e,t)=>{const n=e.stack.split(`
66
- `);let r=`${t}[cause]: ${n[0]}`;for(let s=1,i=n.length;s<i;s++)r+=`
67
- ${t}${n[s]}`;return e.cause&&(r+=` {
68
- ${Rf(e.cause,`${t} `)}
69
- ${t}}`),r};class ci extends globalThis.Error{constructor(n){const r=typeof n=="object"&&n!==null,s=Error.stackTraceLimit;Error.stackTraceLimit=1;super(_v(n),r&&"cause"in n&&typeof n.cause<"u"?{cause:new ci(n.cause)}:void 0);h(this,"span");this.message===""&&(this.message="An error has occurred"),Error.stackTraceLimit=s,this.name=n instanceof Error?n.name:"Error",r&&(hr in n&&(this.span=n[hr]),Object.keys(n).forEach(i=>{i in this||(this[i]=n[i])})),this.stack=vv(`${this.name}: ${this.message}`,n instanceof Error&&n.stack?n.stack:"",this.span)}}const _v=e=>{if(typeof e=="string")return e;if(typeof e=="object"&&e!==null&&e instanceof Error)return e.message;try{if(re(e,"toString")&&Si(e.toString)&&e.toString!==Object.prototype.toString&&e.toString!==globalThis.Array.prototype.toString)return e.toString()}catch{}return rh(e)},bv=/\((.*)\)/g,yv=ye("effect/Tracer/spanToTrace",()=>new WeakMap),vv=(e,t,n)=>{const r=[e],s=t.startsWith(e)?t.slice(e.length).split(`
70
- `):t.split(`
71
- `);for(let i=1;i<s.length;i++){if(s[i].includes(" at new BaseEffectError")||s[i].includes(" at new YieldableError")){i++;continue}if(s[i].includes("Generator.next")||s[i].includes("effect_internal_function"))break;r.push(s[i].replace(/at .*effect_instruction_i.*\((.*)\)/,"at $1").replace(/EffectPrimitive\.\w+/,"<anonymous>"))}if(n){let i=n,a=0;for(;i&&i._tag==="Span"&&a<10;){const o=yv.get(i);if(typeof o=="function"){const c=o();if(typeof c=="string"){const u=c.matchAll(bv);let f=!1;for(const[,g]of u)f=!0,r.push(` at ${i.name} (${g})`);f||r.push(` at ${i.name} (${c.replace(/^at /,"")})`)}else r.push(` at ${i.name}`)}else r.push(` at ${i.name}`);i=mn(i.parent),a++}}return r.join(`
72
- `)},hr=Symbol.for("effect/SpanAnnotation"),kv=e=>Jo(e,void 0,{emptyCase:()=>[],dieCase:(t,n)=>[new ci(n)],failCase:(t,n)=>[new ci(n)],interruptCase:()=>[],parallelCase:(t,n,r)=>[...n,...r],sequentialCase:(t,n,r)=>[...n,...r]}),qi="Pending",Ef="Done",xv="effect/Deferred",Sv=Symbol.for(xv),wv={_E:e=>e,_A:e=>e},Iv=e=>({_tag:qi,joiners:e}),Tv=e=>({_tag:Ef,effect:e});class ms{constructor(t){h(this,"self");h(this,"called",!1);this.self=t}next(t){return this.called?{value:t,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(t){return{value:t,done:!0}}throw(t){throw t}[Symbol.iterator](){return new ms(this.self)}}const Of=(e,t)=>{const n=new ct("Blocked");return n.effect_instruction_i0=e,n.effect_instruction_i1=t,n},Rv=e=>{const t=new ct("RunBlocked");return t.effect_instruction_i0=e,t},fr=Symbol.for("effect/Effect");class Ev{constructor(t,n){h(this,"patch");h(this,"op");h(this,"_op",Io);this.patch=t,this.op=n}}var tu;class ct{constructor(t){h(this,"_op");h(this,"effect_instruction_i0");h(this,"effect_instruction_i1");h(this,"effect_instruction_i2");h(this,"trace");h(this,tu,Wn);this._op=t}[(tu=fr,X)](t){return this===t}[te](){return je(this,ko(this))}pipe(){return J(this,arguments)}toJSON(){return{_id:"Effect",_op:this._op,effect_instruction_i0:rt(this.effect_instruction_i0),effect_instruction_i1:rt(this.effect_instruction_i1),effect_instruction_i2:rt(this.effect_instruction_i2)}}toString(){return ot(this.toJSON())}[Ke](){return this.toJSON()}[Symbol.iterator](){return new ms(new is(this))}}var nu;class Cf{constructor(t){h(this,"_op");h(this,"effect_instruction_i0");h(this,"effect_instruction_i1");h(this,"effect_instruction_i2");h(this,"trace");h(this,nu,Wn);this._op=t,this._tag=t}[(nu=fr,X)](t){return Hi(t)&&t._op==="Failure"&&ne(this.effect_instruction_i0,t.effect_instruction_i0)}[te](){return k(Ve(this._tag),me(P(this.effect_instruction_i0)),je(this))}get cause(){return this.effect_instruction_i0}pipe(){return J(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,cause:this.cause.toJSON()}}toString(){return ot(this.toJSON())}[Ke](){return this.toJSON()}[Symbol.iterator](){return new ms(new is(this))}}var ru;class Mf{constructor(t){h(this,"_op");h(this,"effect_instruction_i0");h(this,"effect_instruction_i1");h(this,"effect_instruction_i2");h(this,"trace");h(this,ru,Wn);this._op=t,this._tag=t}[(ru=fr,X)](t){return Hi(t)&&t._op==="Success"&&ne(this.effect_instruction_i0,t.effect_instruction_i0)}[te](){return k(Ve(this._tag),me(P(this.effect_instruction_i0)),je(this))}get value(){return this.effect_instruction_i0}pipe(){return J(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,value:rt(this.value)}}toString(){return ot(this.toJSON())}[Ke](){return this.toJSON()}[Symbol.iterator](){return new ms(new is(this))}}const Wo=e=>re(e,fr),Rt=e=>{const t=new ct(ah);return t.effect_instruction_i0=e,t},Ov=m(3,(e,t,n)=>Ui(r=>H(e,s=>H(Ff(tt(()=>r(t(s)))),i=>tt(()=>n(s,i)).pipe(dr({onFailure:a=>{switch(i._tag){case Dt:return zt(Mt(i.effect_instruction_i0,a));case qt:return zt(a)}},onSuccess:()=>i})))))),_s=m(2,(e,t)=>H(e,()=>Oe(t))),Bi=e=>_s(e,void 0),Af=function(){const e=new ct(Ri);switch(arguments.length){case 2:{e.effect_instruction_i0=arguments[0],e.commit=arguments[1];break}case 3:{e.effect_instruction_i0=arguments[0],e.effect_instruction_i1=arguments[1],e.commit=arguments[2];break}case 4:{e.effect_instruction_i0=arguments[0],e.effect_instruction_i1=arguments[1],e.effect_instruction_i2=arguments[2],e.commit=arguments[3];break}default:throw new Error(Ii("you're not supposed to end up here"))}return e},li=(e,t=ir)=>{const n=new ct(jr);let r;return n.effect_instruction_i0=s=>{r=e(s)},n.effect_instruction_i1=t,Df(n,s=>Wo(r)?r:Ht)},Cv=(e,t=ir)=>tt(()=>li(e,t)),An=(e,t=ir)=>Af(e,function(){let n,r;function s(c){n?n(c):r===void 0&&(r=c)}const i=new ct(jr);i.effect_instruction_i0=c=>{n=c,r&&c(r)},i.effect_instruction_i1=t;let a,o;return this.effect_instruction_i0.length!==1?(o=new AbortController,a=gt(()=>this.effect_instruction_i0(s,o.signal))):a=gt(()=>this.effect_instruction_i0(s)),a||o?Df(i,c=>(o&&o.abort(),a??Ht)):i}),cl=m(2,(e,t)=>Zo(e,{onFailure:t,onSuccess:Oe})),ll=Symbol.for("effect/OriginalAnnotation"),Nf=(e,t)=>Kt(t)?new Proxy(e,{has(n,r){return r===hr||r===ll||r in n},get(n,r){return r===hr?t.value:r===ll?e:n[r]}}):e,ul=e=>wi(e)&&!(hr in e)?Rt(t=>zt(nn(Nf(e,Xf(t))))):zt(nn(e)),Mv=e=>Av(()=>nn(new hk(e))),Zr=e=>Zo(e,{onFailure:t=>Oe(Yn(t)),onSuccess:t=>Oe(en(t))}),Ff=e=>$v(e,{onFailure:Pe,onSuccess:at}),ht=e=>wi(e)&&!(hr in e)?Rt(t=>zt(Ua(Nf(e,Xf(t))))):zt(Ua(e)),Yo=e=>H(K(e),ht),zt=e=>{const t=new Cf(Dt);return t.effect_instruction_i0=e,t},Av=e=>H(K(e),zt),Nv=Rt(e=>Oe(e.id())),Fv=e=>Rt(t=>e(t.id())),H=m(2,(e,t)=>{const n=new ct(Qs);return n.effect_instruction_i0=e,n.effect_instruction_i1=t,n}),Pv=e=>{const t=new ct("OnStep");return t.effect_instruction_i0=e,t},Pf=e=>H(e,Me),$v=m(2,(e,t)=>dr(e,{onFailure:n=>Oe(t.onFailure(n)),onSuccess:n=>Oe(t.onSuccess(n))})),dr=m(2,(e,t)=>{const n=new ct(Xs);return n.effect_instruction_i0=e,n.effect_instruction_i1=t.onFailure,n.effect_instruction_i2=t.onSuccess,n}),Zo=m(2,(e,t)=>dr(e,{onFailure:n=>{if(ov(n).length>0)return zt(fv(n));const s=av(n);return s.length>0?t.onFailure(Dh(s)):zt(n)},onSuccess:t.onSuccess})),hn=m(2,(e,t)=>tt(()=>{const n=We(e),r=Oo(n.length);let s=0;return _s(Xo({while:()=>s<n.length,body:()=>t(n[s],s),step:i=>{r[s++]=i}}),r)})),zi=m(2,(e,t)=>tt(()=>{const n=We(e);let r=0;return Xo({while:()=>r<n.length,body:()=>t(n[r],r),step:()=>{r++}})})),$f=e=>{const t=new ct(os);return t.effect_instruction_i0=Dy(gs),t.effect_instruction_i1=()=>e,t},mt=m(2,(e,t)=>H(e,n=>K(()=>t(n)))),Lf=m(2,(e,t)=>Zo(e,{onFailure:n=>Yo(()=>t.onFailure(n)),onSuccess:n=>K(()=>t.onSuccess(n))})),Qo=m(2,(e,t)=>dr(e,{onFailure:n=>{const r=uv(n);switch(r._tag){case"Left":return Yo(()=>t(r.left));case"Right":return zt(r.right)}},onSuccess:Oe})),jf=m(2,(e,t)=>Ui(n=>dr(n(e),{onFailure:r=>{const s=Pe(r);return dr(t(s),{onFailure:i=>Pe(Mt(r,i)),onSuccess:()=>s})},onSuccess:r=>{const s=at(r);return tc(t(s),s)}}))),Df=m(2,(e,t)=>jf(e,Yf({onFailure:n=>Go(n)?Bi(t(cv(n))):Ht,onSuccess:()=>Ht}))),Oe=e=>{const t=new Mf(qt);return t.effect_instruction_i0=e,t},tt=e=>{const t=new ct(Ri);return t.commit=e,t},K=e=>{const t=new ct(ih);return t.effect_instruction_i0=e,t},Lv=m(e=>e.length===3||e.length===2&&!(wi(e[1])&&"onlyEffect"in e[1]),(e,t)=>H(e,n=>{const r=typeof t=="function"?t(n):t;return Wo(r)?_s(r,n):Sp(r)?li(s=>{r.then(i=>s(Oe(n)),i=>s(ht(new Wf(i,"An unknown error occurred in Effect.tap"))))}):Oe(n)})),jv=e=>Rt(t=>{const n=t.getFiberRef(Ha),r=k(n,Rn(()=>t.scope()));return e(Vi(Ha,de(r)))}),qf=e=>{const t=new ct(os);return t.effect_instruction_i0=yf(gs),t.effect_instruction_i1=()=>e,t},Ui=e=>Af(e,function(){const t=new ct(os);return t.effect_instruction_i0=yf(gs),t.effect_instruction_i1=n=>bf(n)?gt(()=>this.effect_instruction_i0($f)):gt(()=>this.effect_instruction_i0(qf)),t}),Ht=Oe(void 0),Dv=e=>{const t=new ct(os);return t.effect_instruction_i0=e,t.effect_instruction_i1=void 0,t},Xo=e=>{const t=new ct(ei);return t.effect_instruction_i0=e.while,t.effect_instruction_i1=e.body,t.effect_instruction_i2=e.step,t},qv=e=>tt(()=>{const t=new ct(Dr);return t.effect_instruction_i0=e(),t}),Bv=function(){const e=arguments.length===1?arguments[0]:arguments[1].bind(arguments[0]);return qv(()=>e(k))},ec=e=>{const t=new ct(Ds);return typeof(e==null?void 0:e.priority)<"u"?ak(t,e.priority):t},Bf=m(2,(e,t)=>H(e,n=>mt(t,r=>[n,r]))),zf=m(2,(e,t)=>H(e,n=>_s(t,n))),tc=m(2,(e,t)=>H(e,()=>t)),zv=e=>H(Nv,t=>k(e,Uv(t))),Uv=m(2,(e,t)=>H(e.interruptAsFork(t),()=>e.await)),Vv={_tag:"All",syslog:0,label:"ALL",ordinal:Number.MIN_SAFE_INTEGER,pipe(){return J(this,arguments)}},Kv={_tag:"Fatal",syslog:2,label:"FATAL",ordinal:5e4,pipe(){return J(this,arguments)}},Hv={_tag:"Error",syslog:3,label:"ERROR",ordinal:4e4,pipe(){return J(this,arguments)}},Uf={_tag:"Warning",syslog:4,label:"WARN",ordinal:3e4,pipe(){return J(this,arguments)}},Vf={_tag:"Info",syslog:6,label:"INFO",ordinal:2e4,pipe(){return J(this,arguments)}},Kf={_tag:"Debug",syslog:7,label:"DEBUG",ordinal:1e4,pipe(){return J(this,arguments)}},Gv={_tag:"Trace",syslog:7,label:"TRACE",ordinal:0,pipe(){return J(this,arguments)}},Jv={_tag:"None",syslog:7,label:"OFF",ordinal:Number.MAX_SAFE_INTEGER,pipe(){return J(this,arguments)}},Wv="effect/FiberRef",Yv=Symbol.for(Wv),Zv={_A:e=>e},nc=e=>Rt(t=>at(t.getFiberRef(e))),rc=m(2,(e,t)=>H(nc(e),t)),hl=m(2,(e,t)=>Qv(e,()=>[void 0,t])),Qv=m(2,(e,t)=>Rt(n=>{const[r,s]=t(n.getFiberRef(e));return n.setFiberRef(e,s),Oe(r)})),Vi=m(3,(e,t,n)=>Ov(zf(nc(t),hl(t,n)),()=>e,r=>hl(t,r))),St=(e,t)=>kr(e,{differ:mf(),fork:(t==null?void 0:t.fork)??Me,join:t==null?void 0:t.join}),Xv=e=>{const t=ky();return kr(e,{differ:t,fork:t.empty})},ek=e=>{const t=xy(mf());return kr(e,{differ:t,fork:t.empty})},Hf=e=>{const t=vy();return kr(e,{differ:t,fork:t.empty})},kr=(e,t)=>({...ls,[Yv]:Zv,initial:e,commit(){return nc(this)},diff:(r,s)=>t.differ.diff(r,s),combine:(r,s)=>t.differ.combine(r,s),patch:r=>s=>t.differ.patch(r,s),fork:t.fork,join:t.join??((r,s)=>s)}),tk=e=>kr(e,{differ:rl,fork:rl.empty}),Ki=ye(Symbol.for("effect/FiberRef/currentContext"),()=>Hf(Ch())),sc=ye(Symbol.for("effect/FiberRef/currentSchedulingPriority"),()=>St(0)),nk=ye(Symbol.for("effect/FiberRef/currentMaxOpsBeforeYield"),()=>St(2048)),rk=ye(Symbol.for("effect/FiberRef/currentLogAnnotation"),()=>St(Uo())),sk=ye(Symbol.for("effect/FiberRef/currentLogLevel"),()=>St(Vf)),ik=ye(Symbol.for("effect/FiberRef/currentLogSpan"),()=>St(ar())),ak=m(2,(e,t)=>Vi(e,sc,t)),ok=ye(Symbol.for("effect/FiberRef/currentConcurrency"),()=>St("unbounded")),ck=ye(Symbol.for("effect/FiberRef/currentRequestBatching"),()=>St(!0)),lk=ye(Symbol.for("effect/FiberRef/currentUnhandledErrorLogLevel"),()=>St(de(Kf))),uk=ye(Symbol.for("effect/FiberRef/versionMismatchErrorLogLevel"),()=>St(de(Uf))),Ka=ye(Symbol.for("effect/FiberRef/currentMetricLabels"),()=>ek(Qn())),Ha=ye(Symbol.for("effect/FiberRef/currentForkScopeOverride"),()=>St(G(),{fork:()=>G(),join:(e,t)=>e})),Ms=ye(Symbol.for("effect/FiberRef/currentInterruptedCause"),()=>St(lr,{fork:()=>lr,join:(e,t)=>e})),ic=(e,t)=>e.fork(t),Gf=(function(){class e extends globalThis.Error{commit(){return ht(this)}toJSON(){const n={...this};return this.message&&(n.message=this.message),this.cause&&(n.cause=this.cause),n}[Ke](){return this.toString!==globalThis.Error.prototype.toString?this.stack?`${this.toString()}
73
- ${this.stack.split(`
74
- `).slice(1).join(`
75
- `)}`:this.toString():"Bun"in globalThis?Di(Ua(this),{renderErrorCause:!0}):this}}return Object.assign(e.prototype,Gp),e})(),Jf=(e,t)=>{class n extends Gf{constructor(){super(...arguments);h(this,"_tag",t)}}return Object.assign(n.prototype,e),n.prototype.name=t,n},fl=Symbol.for("effect/Cause/errors/RuntimeException"),hk=Jf({[fl]:fl},"RuntimeException"),fk=Symbol.for("effect/Cause/errors/InterruptedException"),dk=e=>re(e,fk),dl=Symbol.for("effect/Cause/errors/NoSuchElement"),gk=Jf({[dl]:dl},"NoSuchElementException"),gl=Symbol.for("effect/Cause/errors/UnknownException"),Wf=(function(){class e extends Gf{constructor(r,s){super(s??"An unknown error occurred",{cause:r});h(this,"_tag","UnknownException");h(this,"error");this.error=r}}return Object.assign(e.prototype,{[gl]:gl,name:"UnknownException"}),e})(),Hi=e=>Wo(e)&&"_tag"in e&&(e._tag==="Success"||e._tag==="Failure"),pl=(e,t)=>_k(e,t!=null&&t.parallel?ji:Mt),Pe=e=>{const t=new Cf(Dt);return t.effect_instruction_i0=e,t},pk=e=>Pe(un(e)),fa=m(2,(e,t)=>{switch(e._tag){case Dt:return Pe(e.effect_instruction_i0);case qt:return at(t(e.effect_instruction_i0))}}),Yf=m(2,(e,{onFailure:t,onSuccess:n})=>{switch(e._tag){case Dt:return t(e.effect_instruction_i0);case qt:return n(e.effect_instruction_i0)}}),at=e=>{const t=new Mf(qt);return t.effect_instruction_i0=e,t},vn=at(void 0),mk=m(3,(e,t,{onFailure:n,onSuccess:r})=>{switch(e._tag){case Dt:switch(t._tag){case qt:return Pe(e.effect_instruction_i0);case Dt:return Pe(n(e.effect_instruction_i0,t.effect_instruction_i0))}case qt:switch(t._tag){case qt:return at(r(e.effect_instruction_i0,t.effect_instruction_i0));case Dt:return Pe(t.effect_instruction_i0)}}}),_k=(e,t)=>{const n=jh(e);return tr(n)?k(yn(n),wh(k(nr(n),fa(Tt)),(r,s)=>k(r,mk(s,{onSuccess:(i,a)=>k(i,Bt(a)),onFailure:t}))),fa(er),fa(r=>Sn(r)),de):G()},bk=e=>({...ls,[Sv]:wv,state:nf(Iv([])),commit(){return Zf(this)},blockingOn:e}),Zf=e=>Cv(t=>{const n=Pi(e.state);switch(n._tag){case Ef:return t(n.effect);case qi:return n.joiners.push(t),yk(e,t)}},e.blockingOn),Qf=(e,t)=>{const n=Pi(e.state);if(n._tag===qi){rf(e.state,Tv(t));for(let r=0,s=n.joiners.length;r<s;r++)n.joiners[r](t)}},yk=(e,t)=>K(()=>{const n=Pi(e.state);if(n._tag===qi){const r=n.joiners.indexOf(t);r>=0&&n.joiners.splice(r,1)}}),vk=Rt(e=>at(e.currentContext)),kk=()=>vk,bs=e=>H(kk(),e),xk=m(2,(e,t)=>Vi(Ki,t)(e)),Sk=m(2,(e,t)=>bs(n=>xk(e,t(n)))),Xf=e=>{const t=e.currentSpan;return t!==void 0&&t._tag==="Span"?de(t):G()},ml=Symbol.for("effect/MutableHashMap"),wk={[ml]:ml,[Symbol.iterator](){return new ac(this)},toString(){return ot(this.toJSON())},toJSON(){return{_id:"MutableHashMap",values:Array.from(this).map(rt)}},[Ke](){return this.toJSON()},pipe(){return J(this,arguments)}};class ac{constructor(t){h(this,"self");h(this,"referentialIterator");h(this,"bucketIterator");this.self=t,this.referentialIterator=t.referential[Symbol.iterator]()}next(){if(this.bucketIterator!==void 0)return this.bucketIterator.next();const t=this.referentialIterator.next();return t.done?(this.bucketIterator=new Ik(this.self.buckets.values()),this.next()):t}[Symbol.iterator](){return new ac(this.self)}}class Ik{constructor(t){h(this,"backing");h(this,"currentBucket");this.backing=t}next(){if(this.currentBucket===void 0){const n=this.backing.next();if(n.done)return n;this.currentBucket=n.value[Symbol.iterator]()}const t=this.currentBucket.next();return t.done?(this.currentBucket=void 0,this.next()):t}}const Tk=()=>{const e=Object.create(wk);return e.referential=new Map,e.buckets=new Map,e.bucketsSize=0,e},_n=m(2,(e,t)=>{if(Zs(t)===!1)return e.referential.has(t)?de(e.referential.get(t)):G();const n=t[te](),r=e.buckets.get(n);return r===void 0?G():Rk(e,r,t)}),Rk=(e,t,n,r=!1)=>{for(let s=0,i=t.length;s<i;s++)if(n[X](t[s][0])){const a=t[s][1];return r&&(t.splice(s,1),e.bucketsSize--),de(a)}return G()},Cr=m(2,(e,t)=>Kt(_n(e,t))),Mr=m(3,(e,t,n)=>{if(Zs(t)===!1)return e.referential.set(t,n),e;const r=t[te](),s=e.buckets.get(r);return s===void 0?(e.buckets.set(r,[[t,n]]),e.bucketsSize++,e):(Ek(e,s,t),s.push([t,n]),e.bucketsSize++,e)}),Ek=(e,t,n)=>{for(let r=0,s=t.length;r<s;r++)if(n[X](t[r][0])){t.splice(r,1),e.bucketsSize--;return}},Ok="effect/Clock",_l=Symbol.for(Ok),oc=Ln("effect/Clock"),Ck=2**31-1,bl={unsafeSchedule(e,t){const n=Aa(t);if(n>Ck)return Sa;let r=!1;const s=setTimeout(()=>{r=!0,e()},n);return()=>(clearTimeout(s),!r)}},yl=(function(){const e=BigInt(1e6);if(typeof performance>"u"||typeof performance.now!="function")return()=>BigInt(Date.now())*e;let t;return()=>(t===void 0&&(t=BigInt(Date.now())*e-BigInt(Math.round(performance.now()*1e6))),t+BigInt(Math.round(performance.now()*1e6)))})(),Mk=(function(){const e=typeof process=="object"&&"hrtime"in process&&typeof process.hrtime.bigint=="function"?process.hrtime:void 0;if(!e)return yl;const t=yl()-e.bigint();return()=>t+e.bigint()})();var su;su=_l;class Ak{constructor(){h(this,su,_l);h(this,"currentTimeMillis",K(()=>this.unsafeCurrentTimeMillis()));h(this,"currentTimeNanos",K(()=>this.unsafeCurrentTimeNanos()))}unsafeCurrentTimeMillis(){return Date.now()}unsafeCurrentTimeNanos(){return Mk()}scheduler(){return Oe(bl)}sleep(t){return An(n=>{const r=bl.unsafeSchedule(()=>n(Ht),t);return Bi(K(r))})}}const Nk=()=>new Ak,ed="And",td="Or",nd="InvalidData",rd="MissingData",sd="SourceUnavailable",id="Unsupported",Fk="effect/ConfigError",vl=Symbol.for(Fk),xr={_tag:"ConfigError",[vl]:vl},ad=(e,t)=>{const n=Object.create(xr);return n._op=ed,n.left=e,n.right=t,Object.defineProperty(n,"toString",{enumerable:!1,value(){return`${this.left} and ${this.right}`}}),Object.defineProperty(n,"message",{enumerable:!1,get(){return this.toString()}}),n},od=(e,t)=>{const n=Object.create(xr);return n._op=td,n.left=e,n.right=t,Object.defineProperty(n,"toString",{enumerable:!1,value(){return`${this.left} or ${this.right}`}}),Object.defineProperty(n,"message",{enumerable:!1,get(){return this.toString()}}),n},Pk=(e,t,n={pathDelim:"."})=>{const r=Object.create(xr);return r._op=nd,r.path=e,r.message=t,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`(Invalid data at ${k(this.path,mr(n.pathDelim))}: "${this.message}")`}}),r},Nn=(e,t,n={pathDelim:"."})=>{const r=Object.create(xr);return r._op=rd,r.path=e,r.message=t,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`(Missing data at ${k(this.path,mr(n.pathDelim))}: "${this.message}")`}}),r},$k=(e,t,n,r={pathDelim:"."})=>{const s=Object.create(xr);return s._op=sd,s.path=e,s.message=t,s.cause=n,Object.defineProperty(s,"toString",{enumerable:!1,value(){return`(Source unavailable at ${k(this.path,mr(r.pathDelim))}: "${this.message}")`}}),s},Lk=(e,t,n={pathDelim:"."})=>{const r=Object.create(xr);return r._op=id,r.path=e,r.message=t,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`(Unsupported operation at ${k(this.path,mr(n.pathDelim))}: "${this.message}")`}}),r},kn=m(2,(e,t)=>{switch(e._op){case ed:return ad(kn(e.left,t),kn(e.right,t));case td:return od(kn(e.left,t),kn(e.right,t));case nd:return Pk([...t,...e.path],e.message);case rd:return Nn([...t,...e.path],e.message);case sd:return $k([...t,...e.path],e.message,e.cause);case id:return Lk([...t,...e.path],e.message)}}),jk={_tag:"Empty"},da=m(2,(e,t)=>{let n=Vo(t),r=e;for(;Eb(n);){const s=n.head;switch(s._tag){case"Empty":{n=n.tail;break}case"AndThen":{n=Cn(s.first,Cn(s.second,n.tail));break}case"MapName":{r=Vn(r,s.f),n=n.tail;break}case"Nested":{r=ti(r,s.name),n=n.tail;break}case"Unnested":{if(k(qr(r),fm(s.name)))r=Zn(r),n=n.tail;else return Yn(Nn(r,`Expected ${s.name} to be in path in ConfigProvider#unnested`));break}}}return en(r)}),Dk="Constant",qk="Fail",Bk="Fallback",zk="Described",Uk="Lazy",Vk="MapOrFail",Kk="Nested",Hk="Primitive",Gk="Sequence",Jk="HashMap",Wk="ZipWith";var kl={};const ui=(e,t)=>[...e,...t],Yk="effect/ConfigProvider",xl=Symbol.for(Yk),Zk=Ln("effect/ConfigProvider"),Qk="effect/ConfigProviderFlat",Sl=Symbol.for(Qk),Xk=e=>({[xl]:xl,pipe(){return J(this,arguments)},...e}),e0=e=>({[Sl]:Sl,patch:e.patch,load:(t,n,r=!0)=>e.load(t,n,r),enumerateChildren:e.enumerateChildren}),t0=e=>Xk({load:t=>H(Ot(e,Qn(),t,!1),n=>$n(qr(n),{onNone:()=>ht(Nn(Qn(),`Expected a single value having structure: ${t}`)),onSome:Oe})),flattened:e}),n0=e=>{const{pathDelim:t,seqDelim:n}=Object.assign({},{pathDelim:"_",seqDelim:","},e),r=c=>k(c,mr(t)),s=c=>c.split(t),i=()=>typeof process<"u"&&"env"in process&&typeof kl=="object"?kl:{};return t0(e0({load:(c,u,f=!0)=>{const g=r(c),p=i(),d=g in p?de(p[g]):G();return k(d,Qo(()=>Nn(c,`Expected ${g} to exist in the process context`)),H(_=>o0(_,c,u,n,f)))},enumerateChildren:c=>K(()=>{const u=i(),p=Object.keys(u).map(d=>s(d.toUpperCase())).filter(d=>{for(let _=0;_<c.length;_++){const x=k(c,xh(_)),w=d[_];if(w===void 0||x!==w)return!1}return!0}).flatMap(d=>d.slice(c.length,c.length+1));return cb(p)}),patch:jk}))},r0=(e,t,n,r)=>{const s=Kc(n.length,c=>c>=r.length?G():de([e(c),c+1])),i=Kc(r.length,c=>c>=n.length?G():de([t(c),c+1])),a=ui(n,s),o=ui(r,i);return[a,o]},s0=(e,t)=>{let n=t;if(n._tag==="Nested"){const r=e.slice();for(;n._tag==="Nested";)r.push(n.name),n=n.config;return r}return e},Ot=(e,t,n,r)=>{const s=n;switch(s._tag){case Dk:return Oe(Nt(s.value));case zk:return tt(()=>Ot(e,t,s.config,r));case qk:return ht(Nn(t,s.message));case Bk:return k(tt(()=>Ot(e,t,s.first,r)),cl(i=>s.condition(i)?k(Ot(e,t,s.second,r),cl(a=>ht(od(i,a)))):ht(i)));case Uk:return tt(()=>Ot(e,t,s.config(),r));case Vk:return tt(()=>k(Ot(e,t,s.original,r),H(hn(i=>k(s.mapOrFail(i),Qo(kn(s0(t,s.original))))))));case Kk:return tt(()=>Ot(e,ui(t,Nt(s.name)),s.config,r));case Hk:return k(da(t,e.patch),H(i=>k(e.load(i,s,r),H(a=>{if(a.length===0){const o=k(xm(i),Rn(()=>"<n/a>"));return ht(Nn([],`Expected ${s.description} with name ${o}`))}return Oe(a)}))));case Gk:return k(da(t,e.patch),H(i=>k(e.enumerateChildren(i),H(l0),H(a=>a.length===0?tt(()=>mt(Ot(e,t,s.config,!0),Nt)):k(hn(a,o=>Ot(e,mm(t,`[${o}]`),s.config,!0)),mt(o=>{const c=Nm(o);return c.length===0?Nt(Qn()):Nt(c)}))))));case Jk:return tt(()=>k(da(t,e.patch),H(i=>k(e.enumerateChildren(i),H(a=>k(a,hn(o=>Ot(e,ui(i,Nt(o)),s.valueConfig,r)),mt(o=>o.length===0?Nt(Uo()):k(c0(o),Vn(c=>yb(Vc(We(a),c)))))))))));case Wk:return tt(()=>k(Ot(e,t,s.left,r),Zr,H(i=>k(Ot(e,t,s.right,r),Zr,H(a=>{if(Pr(i)&&Pr(a))return ht(ad(i.left,a.left));if(Pr(i)&&Es(a))return ht(i.left);if(Es(i)&&Pr(a))return ht(a.left);if(Es(i)&&Es(a)){const o=k(t,mr(".")),c=i0(t,o),[u,f]=r0(c,c,k(i.right,Vn(en)),k(a.right,Vn(en)));return k(u,Vc(f),hn(([g,p])=>k(Bf(g,p),mt(([d,_])=>s.zip(d,_)))))}throw new Error("BUG: ConfigProvider.fromFlatLoop - please report an issue at https://github.com/Effect-TS/effect/issues")})))))}},i0=(e,t)=>n=>Yn(Nn(e,`The element at index ${n} in a sequence at path "${t}" was missing`)),a0=(e,t)=>e.split(new RegExp(`\\s*${Pm(t)}\\s*`)),o0=(e,t,n,r,s)=>s?k(a0(e,r),hn(i=>n.parse(i.trim())),Qo(kn(t))):k(n.parse(e),Lf({onFailure:kn(t),onSuccess:Nt})),c0=e=>Object.keys(e[0]).map(t=>e.map(n=>n[t])),l0=e=>k(hn(e,h0),Lf({onFailure:()=>Qn(),onSuccess:ni(Vr)}),Zr,mt(rm)),u0=/^(\[(\d+)\])$/,h0=e=>{const t=e.match(u0);if(t!==null){const n=t[2];return k(n!==void 0&&n.length>0?de(n):G(),lm(f0))}return G()},f0=e=>{const t=Number.parseInt(e);return Number.isNaN(t)?G():de(t)},wl=Symbol.for("effect/Console"),cd=Ln("effect/Console"),d0={[wl]:wl,assert(e,...t){return K(()=>{console.assert(e,...t)})},clear:K(()=>{console.clear()}),count(e){return K(()=>{console.count(e)})},countReset(e){return K(()=>{console.countReset(e)})},debug(...e){return K(()=>{console.debug(...e)})},dir(e,t){return K(()=>{console.dir(e,t)})},dirxml(...e){return K(()=>{console.dirxml(...e)})},error(...e){return K(()=>{console.error(...e)})},group(e){return e!=null&&e.collapsed?K(()=>console.groupCollapsed(e==null?void 0:e.label)):K(()=>console.group(e==null?void 0:e.label))},groupEnd:K(()=>{console.groupEnd()}),info(...e){return K(()=>{console.info(...e)})},log(...e){return K(()=>{console.log(...e)})},table(e,t){return K(()=>{console.table(e,t)})},time(e){return K(()=>console.time(e))},timeEnd(e){return K(()=>console.timeEnd(e))},timeLog(e,...t){return K(()=>{console.timeLog(e,...t)})},trace(...e){return K(()=>{console.trace(...e)})},warn(...e){return K(()=>{console.warn(...e)})},unsafe:console},g0="effect/Random",Il=Symbol.for(g0),p0=Ln("effect/Random");var iu;iu=Il;class m0{constructor(t){h(this,"seed");h(this,iu,Il);h(this,"PRNG");this.seed=t,this.PRNG=new Cp(t)}get next(){return K(()=>this.PRNG.number())}get nextBoolean(){return mt(this.next,t=>t>.5)}get nextInt(){return K(()=>this.PRNG.integer(Number.MAX_SAFE_INTEGER))}nextRange(t,n){return mt(this.next,r=>(n-t)*r+t)}nextIntBetween(t,n){return K(()=>this.PRNG.integer(n-t)+t)}shuffle(t){return _0(t,n=>this.nextIntBetween(0,n))}}const _0=(e,t)=>tt(()=>k(K(()=>Array.from(e)),H(n=>{const r=[];for(let s=n.length;s>=2;s=s-1)r.push(s);return k(r,zi(s=>k(t(s),mt(i=>b0(n,s-1,i)))),_s(jh(n)))}))),b0=(e,t,n)=>{const r=e[t];return e[t]=e[n],e[n]=r,e},y0=e=>new m0(P(e)),Tl=Symbol.for("effect/Tracer"),v0=e=>({[Tl]:Tl,...e}),ld=Ln("effect/Tracer"),ud=Ln("effect/ParentSpan"),Rl=(function(){const e="abcdef0123456789",t=e.length;return function(n){let r="";for(let s=0;s<n;s++)r+=e.charAt(Math.floor(Math.random()*t));return r}})();class k0{constructor(t,n,r,s,i,a){h(this,"name");h(this,"parent");h(this,"context");h(this,"startTime");h(this,"kind");h(this,"_tag","Span");h(this,"spanId");h(this,"traceId","native");h(this,"sampled",!0);h(this,"status");h(this,"attributes");h(this,"events",[]);h(this,"links");this.name=t,this.parent=n,this.context=r,this.startTime=i,this.kind=a,this.status={_tag:"Started",startTime:i},this.attributes=new Map,this.traceId=n._tag==="Some"?n.value.traceId:Rl(32),this.spanId=Rl(16),this.links=Array.from(s)}end(t,n){this.status={_tag:"Ended",endTime:t,exit:n,startTime:this.status.startTime}}attribute(t,n){this.attributes.set(t,n)}event(t,n,r){this.events.push([t,n,r??{}])}addLinks(t){this.links.push(...t)}}const x0=v0({span:(e,t,n,r,s,i)=>new k0(e,t,n,r,s,i),context:e=>e()}),S0=k(Ch(),Or(oc,Nk()),Or(cd,d0),Or(p0,y0(Math.random())),Or(Zk,n0()),Or(ld,x0)),hi=ye(Symbol.for("effect/DefaultServices/currentServices"),()=>Hf(S0)),El=Symbol.for("effect/FiberRefs");var au;au=El;class Qr{constructor(t){h(this,"locals");h(this,au,El);this.locals=t}pipe(){return J(this,arguments)}}const w0=(e,t,n,r=!1)=>{const s=e;let i=t,a=n,o=r,c;for(;c===void 0;)if(It(i)&&It(a)){const u=xt(i)[0],f=Zn(i),g=xt(a)[0],p=xt(a)[1],d=Zn(a);u.startTimeMillis<g.startTimeMillis?(a=d,o=!0):u.startTimeMillis>g.startTimeMillis?i=f:u.id<g.id?(a=d,o=!0):u.id>g.id?i=f:c=[p,o]}else c=[s.initial,!0];return c},I0=m(3,(e,t,n)=>{const r=new Map(e.locals);return n.locals.forEach((s,i)=>{const a=s[0][1];if(!s[0][0][X](t)){if(!r.has(i)){if(ne(a,i.initial))return;r.set(i,[[t,i.join(i.initial,a)]]);return}const o=r.get(i),[c,u]=w0(i,o,s);if(u){const f=i.diff(c,a),g=o[0][1],p=i.join(g,i.patch(f)(g));if(!ne(g,p)){let d;const _=o[0][0];_[X](t)?d=[[_,p],...o.slice(1)]:d=[[t,p],...o],r.set(i,d)}}}}),new Qr(r)}),T0=m(2,(e,t)=>{const n=new Map;return R0(e,n,t),new Qr(n)}),R0=(e,t,n)=>{e.locals.forEach((r,s)=>{const i=r[0][1],a=s.patch(s.fork)(i);ne(i,a)?t.set(s,r):t.set(s,[[n,a],...r])})},hd=m(2,(e,t)=>{const n=new Map(e.locals);return n.delete(t),new Qr(n)}),E0=m(2,(e,t)=>e.locals.has(t)?de(xt(e.locals.get(t))[1]):G()),Xr=m(2,(e,t)=>k(E0(e,t),Rn(()=>t.initial))),Ga=m(2,(e,{fiberId:t,fiberRef:n,value:r})=>{if(e.locals.size===0)return new Qr(new Map([[n,[[t,r]]]]));const s=new Map(e.locals);return O0(s,t,n,r),new Qr(s)}),O0=(e,t,n,r)=>{const s=e.get(n)??[];let i;if(It(s)){const[a,o]=xt(s);if(a[X](t)){if(ne(o,r))return;i=[[t,r],...s.slice(1)]}else i=[[t,r],...s]}else i=[[t,r]];e.set(n,i)},C0=Xr,M0=Vv,A0=Kv,N0=Hv,F0=Uf,P0=Vf,$0=Kf,L0=Gv,j0=Jv,D0=k(Vr,im(e=>e.ordinal)),q0=am(D0),B0=e=>{switch(e){case"All":return M0;case"Debug":return $0;case"Error":return N0;case"Fatal":return A0;case"Info":return P0;case"Trace":return L0;case"None":return j0;case"Warning":return F0}},fd=e=>e.replace(/[\s="]/g,"_"),z0=e=>t=>`${fd(t.label)}=${e-t.startTime}ms`,U0=cs,V0=Jp;class K0 extends V0{}const dd="Empty",gd="Add",pd="Remove",md="Update",_d="AndThen",H0={_tag:dd},G0=(e,t)=>{const n=new Map(e.locals);let r=H0;for(const[s,i]of t.locals.entries()){const a=xt(i)[1],o=n.get(s);if(o!==void 0){const c=xt(o)[1];ne(c,a)||(r=ga({_tag:md,fiberRef:s,patch:s.diff(c,a)})(r))}else r=ga({_tag:gd,fiberRef:s,value:a})(r);n.delete(s)}for(const[s]of n.entries())r=ga({_tag:pd,fiberRef:s})(r);return r},ga=m(2,(e,t)=>({_tag:_d,first:e,second:t})),J0=m(3,(e,t,n)=>{let r=n,s=Nt(e);for(;It(s);){const i=xt(s),a=Zn(s);switch(i._tag){case dd:{s=a;break}case gd:{r=Ga(r,{fiberId:t,fiberRef:i.fiberRef,value:i.value}),s=a;break}case pd:{r=hd(r,i.fiberRef),s=a;break}case md:{const o=Xr(r,i.fiberRef);r=Ga(r,{fiberId:t,fiberRef:i.fiberRef,value:i.fiberRef.patch(i.patch)(o)}),s=a;break}case _d:{s=ti(i.first)(ti(i.second)(a));break}}}return r}),bd="effect/MetricLabel",Ja=Symbol.for(bd);var ou;class W0{constructor(t,n){h(this,"key");h(this,"value");h(this,ou,Ja);h(this,"_hash");this.key=t,this.value=n,this._hash=Ve(bd+this.key+this.value)}[(ou=Ja,te)](){return this._hash}[X](t){return Z0(t)&&this.key===t.key&&this.value===t.value}pipe(){return J(this,arguments)}}const Y0=(e,t)=>new W0(e,t),Z0=e=>re(e,Ja),Q0=e=>{let t,n;typeof e=="function"?t=e:(t=e.try,n=e.catch);const r=s=>n?Yo(()=>n(s)):ht(new Wf(s,"An unknown error occurred in Effect.tryPromise"));return t.length>=1?An((s,i)=>{try{t(i).then(a=>s(Oe(a)),a=>s(r(a)))}catch(a){s(r(a))}}):An(s=>{try{t().then(i=>s(Oe(i)),i=>s(r(i)))}catch(i){s(r(i))}})},X0="Sequential",ex="Parallel",tx="ParallelN",nx={_tag:X0},rx={_tag:ex},sx=e=>({_tag:tx,parallelism:e}),Wa=nx,Ya=rx,Za=sx,ix=G0,ax=J0,Gi="effect/FiberStatus",Fn=Symbol.for(Gi),fi="Done",Ol="Running",Cl="Suspended",ox=Ve(`${Gi}-${fi}`);var cu;class cx{constructor(){h(this,cu,Fn);h(this,"_tag",fi)}[(cu=Fn,te)](){return ox}[X](t){return cc(t)&&t._tag===fi}}var lu;class lx{constructor(t){h(this,"runtimeFlags");h(this,lu,Fn);h(this,"_tag",Ol);this.runtimeFlags=t}[(lu=Fn,te)](){return k(P(Gi),me(P(this._tag)),me(P(this.runtimeFlags)),je(this))}[X](t){return cc(t)&&t._tag===Ol&&this.runtimeFlags===t.runtimeFlags}}var uu;class ux{constructor(t,n){h(this,"runtimeFlags");h(this,"blockingOn");h(this,uu,Fn);h(this,"_tag",Cl);this.runtimeFlags=t,this.blockingOn=n}[(uu=Fn,te)](){return k(P(Gi),me(P(this._tag)),me(P(this.runtimeFlags)),me(P(this.blockingOn)),je(this))}[X](t){return cc(t)&&t._tag===Cl&&this.runtimeFlags===t.runtimeFlags&&ne(this.blockingOn,t.blockingOn)}}const hx=new cx,fx=e=>new lx(e),dx=(e,t)=>new ux(e,t),cc=e=>re(e,Fn),gx=e=>e._tag===fi,px=hx,yd=fx,mx=dx,_x=gx,bx=Symbol.for("effect/Micro"),di=Symbol.for("effect/Micro/MicroExit"),Ml=Symbol.for("effect/Micro/MicroCause"),yx={_E:Me};var hu;class vd extends globalThis.Error{constructor(n,r,s){const i=`MicroCause.${n}`;let a,o,c;if(r instanceof globalThis.Error){a=`(${i}) ${r.name}`,o=r.message;const u=o.split(`
76
- `).length;c=r.stack?`(${i}) ${r.stack.split(`
77
- `).slice(0,u+3).join(`
78
- `)}`:`${a}: ${o}`}else a=i,o=Jn(r,0),c=`${a}: ${o}`;s.length>0&&(c+=`
79
- ${s.join(`
80
- `)}`);super(o);h(this,"_tag");h(this,"traces");h(this,hu);this._tag=n,this.traces=s,this[Ml]=yx,this.name=a,this.stack=c}pipe(){return J(this,arguments)}toString(){return this.stack}[(hu=Ml,Ke)](){return this.stack}}class vx extends vd{constructor(n,r=[]){super("Die",n,r);h(this,"defect");this.defect=n}}const kx=(e,t=[])=>new vx(e,t);class xx extends vd{constructor(t=[]){super("Interrupt","interrupted",t)}}const Sx=(e=[])=>new xx(e),wx=e=>e._tag==="Interrupt",Al=Symbol.for("effect/Micro/MicroFiber"),Ix={_A:Me,_E:Me};var fu;fu=Al;class Tx{constructor(t,n=!0){h(this,"context");h(this,"interruptible");h(this,fu);h(this,"_stack",[]);h(this,"_observers",[]);h(this,"_exit");h(this,"_children");h(this,"currentOpCount",0);h(this,"_interrupted",!1);h(this,"_yielded");this.context=t,this.interruptible=n,this[Al]=Ix}getRef(t){return Wm(this.context,t)}addObserver(t){return this._exit?(t(this._exit),_p):(this._observers.push(t),()=>{const n=this._observers.indexOf(t);n>=0&&this._observers.splice(n,1)})}unsafeInterrupt(){this._exit||(this._interrupted=!0,this.interruptible&&this.evaluate(dc))}unsafePoll(){return this._exit}evaluate(t){if(this._exit)return;if(this._yielded!==void 0){const s=this._yielded;this._yielded=void 0,s()}const n=this.runLoop(t);if(n===As)return;const r=Nl.interruptChildren&&Nl.interruptChildren(this);if(r!==void 0)return this.evaluate(pi(r,()=>n));this._exit=n;for(let s=0;s<this._observers.length;s++)this._observers[s](n);this._observers.length=0}runLoop(t){let n=!1,r=t;this.currentOpCount=0;try{for(;;){if(this.currentOpCount++,!n&&this.getRef(gc).shouldYield(this)){n=!0;const s=r;r=pi(Mx,()=>s)}if(r=r[Qa](this),r===As){const s=this._yielded;return di in s?(this._yielded=void 0,s):As}}}catch(s){return re(r,Qa)?Xa(s):Xa(`MicroFiber.runLoop: Not a valid effect: ${String(r)}`)}}getCont(t){for(;;){const n=this._stack.pop();if(!n)return;const r=n[gi]&&n[gi](this);if(r)return{[t]:r};if(n[t])return n}}yieldWith(t){return this._yielded=t,As}children(){return this._children??(this._children=new Set)}}const Nl=ye("effect/Micro/fiberMiddleware",()=>({interruptChildren:void 0})),kd=Symbol.for("effect/Micro/identifier"),nt=Symbol.for("effect/Micro/args"),Qa=Symbol.for("effect/Micro/evaluate"),gr=Symbol.for("effect/Micro/successCont"),Gn=Symbol.for("effect/Micro/failureCont"),gi=Symbol.for("effect/Micro/ensureCont"),As=Symbol.for("effect/Micro/Yield"),Rx={_A:Me,_E:Me,_R:Me},Ex={...U0,_op:"Micro",[bx]:Rx,pipe(){return J(this,arguments)},[Symbol.iterator](){return new Xu(new is(this))},toJSON(){return{_id:"Micro",op:this[kd],...nt in this?{args:this[nt]}:void 0}},toString(){return ot(this)},[Ke](){return ot(this)}};function Ox(e){return Xa("Micro.evaluate: Not implemented")}const Ji=e=>({...Ex,[kd]:e.op,[Qa]:e.eval??Ox,[gr]:e.contA,[Gn]:e.contE,[gi]:e.ensure}),lc=e=>{const t=Ji(e);return function(){const n=Object.create(t);return n[nt]=e.single===!1?arguments:arguments[0],n}},xd=e=>{const t={...Ji(e),[di]:di,_tag:e.op,get[e.prop](){return this[nt]},toJSON(){return{_id:"MicroExit",_tag:e.op,[e.prop]:this[nt]}},[X](n){return Fx(n)&&n._tag===e.op&&ne(this[nt],n[nt])},[te](){return je(this,me(Ve(e.op))(P(this[nt])))}};return function(n){const r=Object.create(t);return r[nt]=n,r[gr]=void 0,r[Gn]=void 0,r[gi]=void 0,r}},uc=xd({op:"Success",prop:"value",eval(e){const t=e.getCont(gr);return t?t[gr](this[nt],e):e.yieldWith(this)}}),Sd=xd({op:"Failure",prop:"cause",eval(e){let t=e.getCont(Gn);for(;wx(this[nt])&&t&&e.interruptible;)t=e.getCont(Gn);return t?t[Gn](this[nt],e):e.yieldWith(this)}}),Cx=lc({op:"Yield",eval(e){let t=!1;return e.getRef(gc).scheduleTask(()=>{t||e.evaluate(Px)},this[nt]??0),e.yieldWith(()=>{t=!0})}}),Mx=Cx(0),Ax=uc(void 0),hc=lc({op:"WithMicroFiber",eval(e){return this[nt](e)}}),pi=m(2,(e,t)=>{const n=Object.create(Nx);return n[nt]=e,n[gr]=t,n}),Nx=Ji({op:"OnSuccess",eval(e){return e._stack.push(this),this[nt]}}),Fx=e=>re(e,di),wd=uc,fc=Sd,dc=fc(Sx()),Xa=e=>fc(kx(e)),Px=wd(void 0),$x="setImmediate"in globalThis?globalThis.setImmediate:e=>setTimeout(e,0);class Id{constructor(){h(this,"tasks",[]);h(this,"running",!1);h(this,"afterScheduled",()=>{this.running=!1,this.runTasks()})}scheduleTask(t,n){this.tasks.push(t),this.running||(this.running=!0,$x(this.afterScheduled))}runTasks(){const t=this.tasks;this.tasks=[];for(let n=0,r=t.length;n<r;n++)t[n]()}shouldYield(t){return t.currentOpCount>=t.getRef(Dx)}flush(){for(;this.tasks.length>0;)this.runTasks()}}const Lx=m(2,(e,t)=>hc(n=>{const r=n.context;return n.context=t(r),zx(e,()=>(n.context=r,Ax))})),jx=m(2,(e,t)=>Lx(e,Nh(t)));class Dx extends Fh()("effect/Micro/currentMaxOpsBeforeYield",{defaultValue:()=>2048}){}class gc extends Fh()("effect/Micro/currentScheduler",{defaultValue:()=>new Id}){}const qx=m(2,(e,t)=>{const n=Object.create(Bx);return n[nt]=e,n[gr]=t.onSuccess,n[Gn]=t.onFailure,n}),Bx=Ji({op:"OnSuccessAndFailure",eval(e){return e._stack.push(this),this[nt]}}),zx=m(2,(e,t)=>Vx(n=>qx(n(e),{onFailure:r=>pi(t(fc(r)),()=>Sd(r)),onSuccess:r=>pi(t(wd(r)),()=>uc(r))}))),Td=lc({op:"SetInterruptible",ensure(e){if(e.interruptible=this[nt],e._interrupted&&e.interruptible)return()=>dc}}),Ux=e=>hc(t=>t.interruptible?e:(t.interruptible=!0,t._stack.push(Td(!1)),t._interrupted?dc:e)),Vx=e=>hc(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Td(!0)),e(Ux)):e(Me)),Kx=(e,t)=>{const n=new Tx(gc.context(new Id));return n.evaluate(e),n};class Hx{constructor(){h(this,"buckets",[])}scheduleTask(t,n){const r=this.buckets.length;let s,i=0;for(;i<r&&this.buckets[i][0]<=n;i++)s=this.buckets[i];s&&s[0]===n?s[1].push(t):i===r?this.buckets.push([n,[t]]):this.buckets.splice(i,0,[n,[t]])}}class Gx{constructor(t){h(this,"maxNextTickBeforeTimer");h(this,"running",!1);h(this,"tasks",new Hx);this.maxNextTickBeforeTimer=t}starveInternal(t){const n=this.tasks.buckets;this.tasks.buckets=[];for(const[r,s]of n)for(let i=0;i<s.length;i++)s[i]();this.tasks.buckets.length===0?this.running=!1:this.starve(t)}starve(t=0){t>=this.maxNextTickBeforeTimer?setTimeout(()=>this.starveInternal(0),0):Promise.resolve(void 0).then(()=>this.starveInternal(t+1))}shouldYield(t){return t.currentOpCount>t.getFiberRef(nk)?t.getFiberRef(sc):!1}scheduleTask(t,n){this.tasks.scheduleTask(t,n),this.running||(this.running=!0,this.starve())}}const Jx=ye(Symbol.for("effect/Scheduler/defaultScheduler"),()=>new Gx(2048)),Wx=ye(Symbol.for("effect/FiberRef/currentScheduler"),()=>St(Jx)),Rd=ye(Symbol.for("effect/FiberRef/currentRequestMap"),()=>St(new Map)),Fl=(e,t,n,r)=>{switch(e){case void 0:return t();case"unbounded":return n();case"inherit":return rc(ok,s=>s==="unbounded"?n():s>1?r(s):t());default:return e>1?r(e):t()}},pc="InterruptSignal",mc="Stateful",_c="Resume",bc="YieldNow",pa=e=>({_tag:pc,cause:e}),Ks=e=>({_tag:mc,onFiber:e}),Bn=e=>({_tag:_c,effect:e}),Yx=()=>({_tag:bc}),Zx="effect/FiberScope",mi=Symbol.for(Zx);var du;du=mi;class Qx{constructor(){h(this,du,mi);h(this,"fiberId",ir);h(this,"roots",new Set)}add(t,n){this.roots.add(n),n.addObserver(()=>{this.roots.delete(n)})}}var gu;gu=mi;class Xx{constructor(t,n){h(this,"fiberId");h(this,"parent");h(this,gu,mi);this.fiberId=t,this.parent=n}add(t,n){this.parent.tell(Ks(r=>{r.addChild(n),n.addObserver(()=>{r.removeChild(n)})}))}}const eS=e=>new Xx(e.id(),e),Ed=ye(Symbol.for("effect/FiberScope/Global"),()=>new Qx),tS="effect/Fiber",nS=Symbol.for(tS),rS={_E:e=>e,_A:e=>e},sS="effect/Fiber",iS=Symbol.for(sS),Od=e=>zf(Pf(e.await),e.inheritAll);({...ls});const pn="effect/FiberCurrent",aS="effect/Logger",oS=Symbol.for(aS),cS={_Message:e=>e,_Output:e=>e},yc=e=>({[oS]:cS,log:e,pipe(){return J(this,arguments)}}),lS=/^[^\s"=]*$/,uS=(e,t)=>({annotations:n,cause:r,date:s,fiberId:i,logLevel:a,message:o,spans:c})=>{const u=_=>_.match(lS)?_:e(_),f=(_,x)=>`${fd(_)}=${u(x)}`,g=(_,x)=>" "+f(_,x);let p=f("timestamp",s.toISOString());p+=g("level",a.label),p+=g("fiber",af(i));const d=pm(o);for(let _=0;_<d.length;_++)p+=g("message",Jn(d[_],t));rv(r)||(p+=g("cause",Di(r,{renderErrorCause:!0})));for(const _ of c)p+=" "+z0(s.getTime())(_);for(const[_,x]of n)p+=g(_,Jn(x,t));return p},hS=e=>`"${e.replace(/\\([\s\S])|(")/g,"\\$1$2")}"`,fS=yc(uS(hS)),dS=typeof process=="object"&&process!==null&&typeof process.stdout=="object"&&process.stdout!==null;dS&&process.stdout.isTTY;const Cd="effect/MetricBoundaries",eo=Symbol.for(Cd);var pu;class gS{constructor(t){h(this,"values");h(this,pu,eo);h(this,"_hash");this.values=t,this._hash=k(Ve(Cd),me(as(this.values)))}[(pu=eo,te)](){return this._hash}[X](t){return pS(t)&&ne(this.values,t.values)}pipe(){return J(this,arguments)}}const pS=e=>re(e,eo),mS=e=>{const t=k(e,vh(Tt(Number.POSITIVE_INFINITY)),Fm);return new gS(t)},_S=e=>k(gm(e.count-1,t=>e.start*Math.pow(e.factor,t)),Ei,mS),bS="effect/MetricKeyType",Md=Symbol.for(bS),Ad="effect/MetricKeyType/Counter",to=Symbol.for(Ad),yS="effect/MetricKeyType/Frequency",vS=Symbol.for(yS),kS="effect/MetricKeyType/Gauge",xS=Symbol.for(kS),Nd="effect/MetricKeyType/Histogram",no=Symbol.for(Nd),SS="effect/MetricKeyType/Summary",wS=Symbol.for(SS),Fd={_In:e=>e,_Out:e=>e};var mu,_u;class IS{constructor(t,n){h(this,"incremental");h(this,"bigint");h(this,_u,Fd);h(this,mu,to);h(this,"_hash");this.incremental=t,this.bigint=n,this._hash=Ve(Ad)}[(_u=Md,mu=to,te)](){return this._hash}[X](t){return Pd(t)}pipe(){return J(this,arguments)}}var bu,yu;class TS{constructor(t){h(this,"boundaries");h(this,yu,Fd);h(this,bu,no);h(this,"_hash");this.boundaries=t,this._hash=k(Ve(Nd),me(P(this.boundaries)))}[(yu=Md,bu=no,te)](){return this._hash}[X](t){return $d(t)&&ne(this.boundaries,t.boundaries)}pipe(){return J(this,arguments)}}const RS=e=>new IS((e==null?void 0:e.incremental)??!1,(e==null?void 0:e.bigint)??!1),ES=e=>new TS(e),Pd=e=>re(e,to),OS=e=>re(e,vS),CS=e=>re(e,xS),$d=e=>re(e,no),MS=e=>re(e,wS),AS="effect/MetricKey",Ld=Symbol.for(AS),NS={_Type:e=>e},FS=Co(ne);var vu;class vc{constructor(t,n,r,s=[]){h(this,"name");h(this,"keyType");h(this,"description");h(this,"tags");h(this,vu,NS);h(this,"_hash");this.name=t,this.keyType=n,this.description=r,this.tags=s,this._hash=k(Ve(this.name+this.description),me(P(this.keyType)),me(as(this.tags)))}[(vu=Ld,te)](){return this._hash}[X](t){return PS(t)&&this.name===t.name&&ne(this.keyType,t.keyType)&&ne(this.description,t.description)&&FS(this.tags,t.tags)}pipe(){return J(this,arguments)}}const PS=e=>re(e,Ld),$S=(e,t)=>new vc(e,RS(t),Eo(t==null?void 0:t.description)),LS=(e,t,n)=>new vc(e,ES(t),Eo(n)),jS=m(2,(e,t)=>t.length===0?e:new vc(e.name,e.keyType,e.description,qs(e.tags,t))),DS="effect/MetricState",ys=Symbol.for(DS),jd="effect/MetricState/Counter",ro=Symbol.for(jd),Dd="effect/MetricState/Frequency",so=Symbol.for(Dd),qd="effect/MetricState/Gauge",io=Symbol.for(qd),Bd="effect/MetricState/Histogram",ao=Symbol.for(Bd),zd="effect/MetricState/Summary",oo=Symbol.for(zd),vs={_A:e=>e};var ku,xu;class qS{constructor(t){h(this,"count");h(this,xu,vs);h(this,ku,ro);this.count=t}[(xu=ys,ku=ro,te)](){return k(P(jd),me(P(this.count)),je(this))}[X](t){return ZS(t)&&this.count===t.count}pipe(){return J(this,arguments)}}const BS=Co(ne);var Su,wu;class zS{constructor(t){h(this,"occurrences");h(this,wu,vs);h(this,Su,so);h(this,"_hash");this.occurrences=t}[(wu=ys,Su=so,te)](){return k(Ve(Dd),me(as(We(this.occurrences.entries()))),je(this))}[X](t){return QS(t)&&BS(We(this.occurrences.entries()),We(t.occurrences.entries()))}pipe(){return J(this,arguments)}}var Iu,Tu;class US{constructor(t){h(this,"value");h(this,Tu,vs);h(this,Iu,io);this.value=t}[(Tu=ys,Iu=io,te)](){return k(P(qd),me(P(this.value)),je(this))}[X](t){return XS(t)&&this.value===t.value}pipe(){return J(this,arguments)}}var Ru,Eu;class VS{constructor(t,n,r,s,i){h(this,"buckets");h(this,"count");h(this,"min");h(this,"max");h(this,"sum");h(this,Eu,vs);h(this,Ru,ao);this.buckets=t,this.count=n,this.min=r,this.max=s,this.sum=i}[(Eu=ys,Ru=ao,te)](){return k(P(Bd),me(P(this.buckets)),me(P(this.count)),me(P(this.min)),me(P(this.max)),me(P(this.sum)),je(this))}[X](t){return e1(t)&&ne(this.buckets,t.buckets)&&this.count===t.count&&this.min===t.min&&this.max===t.max&&this.sum===t.sum}pipe(){return J(this,arguments)}}var Ou,Cu;class KS{constructor(t,n,r,s,i,a){h(this,"error");h(this,"quantiles");h(this,"count");h(this,"min");h(this,"max");h(this,"sum");h(this,Cu,vs);h(this,Ou,oo);this.error=t,this.quantiles=n,this.count=r,this.min=s,this.max=i,this.sum=a}[(Cu=ys,Ou=oo,te)](){return k(P(zd),me(P(this.error)),me(P(this.quantiles)),me(P(this.count)),me(P(this.min)),me(P(this.max)),me(P(this.sum)),je(this))}[X](t){return t1(t)&&this.error===t.error&&ne(this.quantiles,t.quantiles)&&this.count===t.count&&this.min===t.min&&this.max===t.max&&this.sum===t.sum}pipe(){return J(this,arguments)}}const HS=e=>new qS(e),GS=e=>new zS(e),JS=e=>new US(e),WS=e=>new VS(e.buckets,e.count,e.min,e.max,e.sum),YS=e=>new KS(e.error,e.quantiles,e.count,e.min,e.max,e.sum),ZS=e=>re(e,ro),QS=e=>re(e,so),XS=e=>re(e,io),e1=e=>re(e,ao),t1=e=>re(e,oo),n1="effect/MetricHook",r1=Symbol.for(n1),s1={_In:e=>e,_Out:e=>e},ks=e=>({[r1]:s1,pipe(){return J(this,arguments)},...e}),Pl=BigInt(0),i1=e=>{let t=e.keyType.bigint?Pl:0;const n=e.keyType.incremental?e.keyType.bigint?s=>s>=Pl:s=>s>=0:s=>!0,r=s=>{n(s)&&(t=t+s)};return ks({get:()=>HS(t),update:r,modify:r})},a1=e=>{const t=new Map;for(const r of e.keyType.preregisteredWords)t.set(r,0);const n=r=>{const s=t.get(r)??0;t.set(r,s+1)};return ks({get:()=>GS(t),update:n,modify:n})},o1=(e,t)=>{let n=t;return ks({get:()=>JS(n),update:r=>{n=r},modify:r=>{n=n+r}})},c1=e=>{const t=e.keyType.boundaries.values,n=t.length,r=new Uint32Array(n+1),s=new Float64Array(n);let i=0,a=0,o=Number.MAX_VALUE,c=Number.MIN_VALUE;k(t,ni(Vr),Vn((g,p)=>{s[p]=g}));const u=g=>{let p=0,d=n;for(;p!==d;){const _=Math.floor(p+(d-p)/2),x=s[_];g<=x?d=_:p=_,d===p+1&&(g<=s[p]?d=p:p=d)}r[p]=r[p]+1,i=i+1,a=a+g,g<o&&(o=g),g>c&&(c=g)},f=()=>{const g=Oo(n);let p=0;for(let d=0;d<n;d++){const _=s[d],x=r[d];p=p+x,g[d]=[_,p]}return g};return ks({get:()=>WS({buckets:f(),count:i,min:o,max:c,sum:a}),update:u,modify:u})},l1=e=>{const{error:t,maxAge:n,maxSize:r,quantiles:s}=e.keyType,i=k(s,ni(Vr)),a=Oo(r);let o=0,c=0,u=0,f=0,g=0;const p=_=>{const x=[];let w=0;for(;w!==r-1;){const A=a[w];if(A!=null){const[D,oe]=A,I=Ma(_-D);I_(I,zh)&&w_(I,n)&&x.push(oe)}w=w+1}return u1(t,i,ni(x,Vr))},d=(_,x)=>{if(r>0){o=o+1;const w=o%r;a[w]=[x,_]}f=c===0?_:Math.min(f,_),g=c===0?_:Math.max(g,_),c=c+1,u=u+_};return ks({get:()=>YS({error:t,quantiles:p(Date.now()),count:c,min:f,max:g,sum:u}),update:([_,x])=>d(_,x),modify:([_,x])=>d(_,x)})},u1=(e,t,n)=>{const r=n.length;if(!It(t))return Qn();const s=t[0],i=t.slice(1),a=$l(e,r,G(),0,s,n),o=Nt(a);return i.forEach(c=>{o.push($l(e,r,a.value,a.consumed,c,a.rest))}),Vn(o,c=>[c.quantile,c.value])},$l=(e,t,n,r,s,i)=>{let a=e,o=t,c=n,u=r,f=s,g=i,p=e,d=t,_=n,x=r,w=s,A=i;for(;;){if(!It(g))return{quantile:f,value:G(),consumed:u,rest:[]};if(f===1)return{quantile:f,value:de(Sh(g)),consumed:u+g.length,rest:[]};const D=xt(g),oe=wm(g,C=>C===D),I=f*o,S=a/2*I,q=u+oe[0].length,W=Math.abs(q-I);if(q<I-S){p=a,d=o,_=qr(g),x=q,w=f,A=oe[1],a=p,o=d,c=_,u=x,f=w,g=A;continue}if(q>I+S){const C=_t(c)?de(D):c;return{quantile:f,value:C,consumed:u,rest:g}}switch(c._tag){case"None":{p=a,d=o,_=qr(g),x=q,w=f,A=oe[1],a=p,o=d,c=_,u=x,f=w,g=A;continue}case"Some":{const C=Math.abs(I-c.value);if(W<C){p=a,d=o,_=qr(g),x=q,w=f,A=oe[1],a=p,o=d,c=_,u=x,f=w,g=A;continue}return{quantile:f,value:de(c.value),consumed:u,rest:g}}}}throw new Error("BUG: MetricHook.resolveQuantiles - please report an issue at https://github.com/Effect-TS/effect/issues")},h1="effect/MetricPair",f1=Symbol.for(h1),d1={_Type:e=>e},g1=(e,t)=>({[f1]:d1,metricKey:e,metricState:t,pipe(){return J(this,arguments)}}),p1="effect/MetricRegistry",Ll=Symbol.for(p1);var Mu;Mu=Ll;class m1{constructor(){h(this,Mu,Ll);h(this,"map",Tk())}snapshot(){const t=[];for(const[n,r]of this.map)t.push(g1(n,r.get()));return t}get(t){const n=k(this.map,_n(t),mn);if(n==null){if(Pd(t.keyType))return this.getCounter(t);if(CS(t.keyType))return this.getGauge(t);if(OS(t.keyType))return this.getFrequency(t);if($d(t.keyType))return this.getHistogram(t);if(MS(t.keyType))return this.getSummary(t);throw new Error("BUG: MetricRegistry.get - unknown MetricKeyType - please report an issue at https://github.com/Effect-TS/effect/issues")}else return n}getCounter(t){let n=k(this.map,_n(t),mn);if(n==null){const r=i1(t);k(this.map,Cr(t))||k(this.map,Mr(t,r)),n=r}return n}getFrequency(t){let n=k(this.map,_n(t),mn);if(n==null){const r=a1(t);k(this.map,Cr(t))||k(this.map,Mr(t,r)),n=r}return n}getGauge(t){let n=k(this.map,_n(t),mn);if(n==null){const r=o1(t,t.keyType.bigint?BigInt(0):0);k(this.map,Cr(t))||k(this.map,Mr(t,r)),n=r}return n}getHistogram(t){let n=k(this.map,_n(t),mn);if(n==null){const r=c1(t);k(this.map,Cr(t))||k(this.map,Mr(t,r)),n=r}return n}getSummary(t){let n=k(this.map,_n(t),mn);if(n==null){const r=l1(t);k(this.map,Cr(t))||k(this.map,Mr(t,r)),n=r}return n}}const _1=()=>new m1,b1="effect/Metric",y1=Symbol.for(b1),v1={_Type:e=>e,_In:e=>e,_Out:e=>e},jl=ye(Symbol.for("effect/Metric/globalMetricRegistry"),()=>_1()),Ud=function(e,t,n,r){const s=Object.assign(i=>Lv(i,a=>w1(s,a)),{[y1]:v1,keyType:e,unsafeUpdate:t,unsafeValue:n,unsafeModify:r,register(){return this.unsafeValue([]),this},pipe(){return J(this,arguments)}});return s},Wi=(e,t)=>Vd($S(e,t)),Vd=e=>{let t;const n=new WeakMap,r=s=>{if(s.length===0)return t!==void 0||(t=jl.get(e)),t;let i=n.get(s);return i!==void 0||(i=jl.get(jS(e,s)),n.set(s,i)),i};return Ud(e.keyType,(s,i)=>r(i).update(s),s=>r(s).get(),(s,i)=>r(i).modify(s))},k1=(e,t,n)=>Vd(LS(e,t,n)),x1=m(3,(e,t,n)=>S1(e,[Y0(t,n)])),S1=m(2,(e,t)=>Ud(e.keyType,(n,r)=>e.unsafeUpdate(n,qs(t,r)),n=>e.unsafeValue(qs(t,n)),(n,r)=>e.unsafeModify(n,qs(t,r)))),w1=m(2,(e,t)=>rc(Ka,n=>K(()=>e.unsafeUpdate(t,n))));({...Ro});const I1=m(2,(e,t)=>rc(Rd,n=>K(()=>{if(n.has(e)){const r=n.get(e);r.state.completed||(r.state.completed=!0,Qf(r.result,t))}}))),T1="effect/Supervisor",Yi=Symbol.for(T1),kc={_T:e=>e};var Au;Au=Yi;const wc=class wc{constructor(t,n){h(this,"underlying");h(this,"value0");h(this,Au,kc);this.underlying=t,this.value0=n}get value(){return this.value0}onStart(t,n,r,s){this.underlying.onStart(t,n,r,s)}onEnd(t,n){this.underlying.onEnd(t,n)}onEffect(t,n){this.underlying.onEffect(t,n)}onSuspend(t){this.underlying.onSuspend(t)}onResume(t){this.underlying.onResume(t)}map(t){return new wc(this,k(this.value,mt(t)))}zip(t){return new bi(this,t)}};let _i=wc;var Nu;Nu=Yi;const Ic=class Ic{constructor(t,n){h(this,"left");h(this,"right");h(this,"_tag","Zip");h(this,Nu,kc);this.left=t,this.right=n}get value(){return Bf(this.left.value,this.right.value)}onStart(t,n,r,s){this.left.onStart(t,n,r,s),this.right.onStart(t,n,r,s)}onEnd(t,n){this.left.onEnd(t,n),this.right.onEnd(t,n)}onEffect(t,n){this.left.onEffect(t,n),this.right.onEffect(t,n)}onSuspend(t){this.left.onSuspend(t),this.right.onSuspend(t)}onResume(t){this.left.onResume(t),this.right.onResume(t)}map(t){return new _i(this,k(this.value,mt(t)))}zip(t){return new Ic(this,t)}};let bi=Ic;const Kd=e=>re(e,Yi)&&Zu(e,"Zip");var Fu;Fu=Yi;class R1{constructor(t){h(this,"effect");h(this,Fu,kc);this.effect=t}get value(){return this.effect}onStart(t,n,r,s){}onEnd(t,n){}onEffect(t,n){}onSuspend(t){}onResume(t){}map(t){return new _i(this,k(this.value,mt(t)))}zip(t){return new bi(this,t)}onRun(t,n){return t()}}const E1=e=>new R1(e),xc=ye("effect/Supervisor/none",()=>E1(Ht)),O1=_r,Hd="Empty",Gd="AddSupervisor",Jd="RemoveSupervisor",Wd="AndThen",zr={_tag:Hd},Hs=(e,t)=>({_tag:Wd,first:e,second:t}),C1=(e,t)=>M1(t,Tt(e)),M1=(e,t)=>{let n=e,r=t;for(;tr(r);){const s=nr(r);switch(s._tag){case Hd:{r=yn(r);break}case Gd:{n=n.zip(s.supervisor),r=yn(r);break}case Jd:{n=co(n,s.supervisor),r=yn(r);break}case Wd:{r=Bt(s.first)(Bt(s.second)(yn(r)));break}}}return n},co=(e,t)=>ne(e,t)?xc:Kd(e)?co(e.left,t).zip(co(e.right,t)):e,yi=e=>ne(e,xc)?On():Kd(e)?k(yi(e.left),Gr(yi(e.right))):Bo(e),A1=(e,t)=>{if(ne(e,t))return zr;const n=yi(e),r=yi(t),s=k(r,Zc(n),ii(zr,(a,o)=>Hs(a,{_tag:Gd,supervisor:o}))),i=k(n,Zc(r),ii(zr,(a,o)=>Hs(a,{_tag:Jd,supervisor:o})));return Hs(s,i)},N1=O1({empty:zr,patch:C1,combine:Hs,diff:A1}),F1=Wi("effect_fiber_started",{incremental:!0}),Dl=Wi("effect_fiber_active"),P1=Wi("effect_fiber_successes",{incremental:!0}),$1=Wi("effect_fiber_failures",{incremental:!0}),L1=x1(k1("effect_fiber_lifetimes",_S({start:.5,factor:2,count:35})),"time_unit","milliseconds"),Ar="Continue",j1="Done",ql="Yield",D1={_E:e=>e,_A:e=>e},Ns=e=>{throw new Error(`BUG: FiberRuntime - ${Jn(e)} - please report an issue at https://github.com/Effect-TS/effect/issues`)},Zt=Symbol.for("effect/internal/fiberRuntime/YieldedOp"),Qt=ye("effect/internal/fiberRuntime/yieldedOpChannel",()=>({currentOp:null})),Nr={[Qs]:(e,t,n)=>gt(()=>t.effect_instruction_i1(n)),OnStep:(e,t,n)=>at(at(n)),[Xs]:(e,t,n)=>gt(()=>t.effect_instruction_i2(n)),[Io]:(e,t,n)=>(e.patchRuntimeFlags(e.currentRuntimeFlags,t.patch),ln(e.currentRuntimeFlags)&&e.isInterrupted()?Pe(e.getInterruptedCause()):at(n)),[ei]:(e,t,n)=>(gt(()=>t.effect_instruction_i2(n)),gt(()=>t.effect_instruction_i0())?(e.pushStack(t),gt(()=>t.effect_instruction_i1())):Ht),[Dr]:(e,t,n)=>{for(;;){const r=gt(()=>t.effect_instruction_i0.next(n));if(r.done)return at(r.value);const s=Ap(r.value);if(Hi(s)){if(s._tag==="Failure")return s}else return e.pushStack(t),s;n=s.value}}},q1={[pc]:(e,t,n,r)=>(e.processNewInterruptSignal(r.cause),ln(t)?Pe(r.cause):n),[_c]:(e,t,n,r)=>{throw new Error("It is illegal to have multiple concurrent run loops in a single fiber")},[mc]:(e,t,n,r)=>(r.onFiber(e,yd(t)),n),[bc]:(e,t,n,r)=>H(ec(),()=>n)},B1=e=>zi(qy(e),t=>In(ev(t),([n,r])=>{const s=new Map,i=[];for(const o of r){i.push(Sn(o));for(const c of o)s.set(c.request,c)}const a=i.flat();return Vi(iw(n.runAll(i),a,()=>a.forEach(o=>{o.listeners.interrupted=!0})),Rd,s)},!1,!1)),z1=To();var Pu,$u;class U1 extends K0{constructor(n,r,s){super();h(this,$u,rS);h(this,Pu,D1);h(this,"_fiberRefs");h(this,"_fiberId");h(this,"_queue",new Array);h(this,"_children",null);h(this,"_observers",new Array);h(this,"_running",!1);h(this,"_stack",[]);h(this,"_asyncInterruptor",null);h(this,"_asyncBlockingOn",null);h(this,"_exitValue",null);h(this,"_steps",[]);h(this,"_isYielding",!1);h(this,"currentRuntimeFlags");h(this,"currentOpCount",0);h(this,"currentSupervisor");h(this,"currentScheduler");h(this,"currentTracer");h(this,"currentSpan");h(this,"currentContext");h(this,"currentDefaultServices");h(this,"run",()=>{this.drainQueueOnCurrentThread()});if(this.currentRuntimeFlags=s,this._fiberId=n,this._fiberRefs=r,nl(s)){const i=this.getFiberRef(Ka);F1.unsafeUpdate(1,i),Dl.unsafeUpdate(1,i)}this.refreshRefCache()}commit(){return Od(this)}id(){return this._fiberId}resume(n){this.tell(Bn(n))}get status(){return this.ask((n,r)=>r)}get runtimeFlags(){return this.ask((n,r)=>_x(r)?n.currentRuntimeFlags:r.runtimeFlags)}scope(){return eS(this)}get children(){return this.ask(n=>Array.from(n.getChildren()))}getChildren(){return this._children===null&&(this._children=new Set),this._children}getInterruptedCause(){return this.getFiberRef(Ms)}fiberRefs(){return this.ask(n=>n.getFiberRefs())}ask(n){return tt(()=>{const r=bk(this._fiberId);return this.tell(Ks((s,i)=>{Qf(r,K(()=>n(s,i)))})),Zf(r)})}tell(n){this._queue.push(n),this._running||(this._running=!0,this.drainQueueLaterOnExecutor())}get await(){return An(n=>{const r=s=>n(Oe(s));return this.tell(Ks((s,i)=>{s._exitValue!==null?r(this._exitValue):s.addObserver(r)})),K(()=>this.tell(Ks((s,i)=>{s.removeObserver(r)})))},this.id())}get inheritAll(){return Rt((n,r)=>{const s=n.id(),i=n.getFiberRefs(),a=r.runtimeFlags,o=this.getFiberRefs(),c=I0(i,s,o);n.setFiberRefs(c);const u=n.getFiberRef(Kl),f=k(Us(a,u),sl(gs),sl(za));return Dv(f)})}get poll(){return K(()=>Eo(this._exitValue))}unsafePoll(){return this._exitValue}interruptAsFork(n){return K(()=>this.tell(pa(un(n))))}unsafeInterruptAsFork(n){this.tell(pa(un(n)))}addObserver(n){this._exitValue!==null?n(this._exitValue):this._observers.push(n)}removeObserver(n){this._observers=this._observers.filter(r=>r!==n)}getFiberRefs(){return this.setFiberRef(Kl,this.currentRuntimeFlags),this._fiberRefs}unsafeDeleteFiberRef(n){this._fiberRefs=hd(this._fiberRefs,n)}getFiberRef(n){return this._fiberRefs.locals.has(n)?this._fiberRefs.locals.get(n)[0][1]:n.initial}setFiberRef(n,r){this._fiberRefs=Ga(this._fiberRefs,{fiberId:this._fiberId,fiberRef:n,value:r}),this.refreshRefCache()}refreshRefCache(){this.currentDefaultServices=this.getFiberRef(hi),this.currentTracer=this.currentDefaultServices.unsafeMap.get(ld.key),this.currentSupervisor=this.getFiberRef(sw),this.currentScheduler=this.getFiberRef(Wx),this.currentContext=this.getFiberRef(Ki),this.currentSpan=this.currentContext.unsafeMap.get(ud.key)}setFiberRefs(n){this._fiberRefs=n,this.refreshRefCache()}addChild(n){this.getChildren().add(n)}removeChild(n){this.getChildren().delete(n)}transferChildren(n){const r=this._children;if(this._children=null,r!==null&&r.size>0)for(const s of r)s._exitValue===null&&n.add(this.currentRuntimeFlags,s)}drainQueueOnCurrentThread(){let n=!0;for(;n;){let r=Ar;const s=globalThis[pn];globalThis[pn]=this;try{for(;r===Ar;)r=this._queue.length===0?j1:this.evaluateMessageWhileSuspended(this._queue.splice(0,1)[0])}finally{this._running=!1,globalThis[pn]=s}this._queue.length>0&&!this._running?(this._running=!0,r===ql?(this.drainQueueLaterOnExecutor(),n=!1):n=!0):n=!1}}drainQueueLaterOnExecutor(){this.currentScheduler.scheduleTask(this.run,this.getFiberRef(sc))}drainQueueWhileRunning(n,r){let s=r;for(;this._queue.length>0;){const i=this._queue.splice(0,1)[0];s=q1[i._tag](this,n,s,i)}return s}isInterrupted(){return!sv(this.getFiberRef(Ms))}addInterruptedCause(n){const r=this.getFiberRef(Ms);this.setFiberRef(Ms,Mt(r,n))}processNewInterruptSignal(n){this.addInterruptedCause(n),this.sendInterruptSignalToAllChildren()}sendInterruptSignalToAllChildren(){if(this._children===null||this._children.size===0)return!1;let n=!1;for(const r of this._children)r.tell(pa(un(this.id()))),n=!0;return n}interruptAllChildren(){if(this.sendInterruptSignalToAllChildren()){const n=this._children.values();this._children=null;let r=!1;return Xo({while:()=>!r,body:()=>{const i=n.next();return i.done?K(()=>{r=!0}):Bi(i.value.await)},step:()=>{}})}return null}reportExitValue(n){if(nl(this.currentRuntimeFlags)){const r=this.getFiberRef(Ka),s=this.id().startTimeMillis,i=Date.now();switch(L1.unsafeUpdate(i-s,r),Dl.unsafeUpdate(-1,r),n._tag){case qt:{P1.unsafeUpdate(1,r);break}case Dt:{$1.unsafeUpdate(1,r);break}}}if(n._tag==="Failure"){const r=this.getFiberRef(lk);!Go(n.cause)&&r._tag==="Some"&&this.log("Fiber terminated with an unhandled error",n.cause,r)}}setExitValue(n){this._exitValue=n,this.reportExitValue(n);for(let r=this._observers.length-1;r>=0;r--)this._observers[r](n);this._observers=[]}getLoggers(){return this.getFiberRef(J1)}log(n,r,s){const i=Kt(s)?s.value:this.getFiberRef(sk),a=this.getFiberRef(V1);if(q0(a,i))return;const o=this.getFiberRef(ik),c=this.getFiberRef(rk),u=this.getLoggers(),f=this.getFiberRefs();if(ef(u)>0){const g=Mh(this.getFiberRef(hi),oc),p=new Date(g.unsafeCurrentTimeMillis());Lp(f,()=>{for(const d of u)d.log({fiberId:this.id(),logLevel:i,message:n,cause:r,context:f,spans:o,annotations:c,date:p})})}}evaluateMessageWhileSuspended(n){switch(n._tag){case bc:return ql;case pc:return this.processNewInterruptSignal(n.cause),this._asyncInterruptor!==null&&(this._asyncInterruptor(Pe(n.cause)),this._asyncInterruptor=null),Ar;case _c:return this._asyncInterruptor=null,this._asyncBlockingOn=null,this.evaluateEffect(n.effect),Ar;case mc:return n.onFiber(this,this._exitValue!==null?px:mx(this.currentRuntimeFlags,this._asyncBlockingOn)),Ar;default:return Ns(n)}}evaluateEffect(n){this.currentSupervisor.onResume(this);try{let r=ln(this.currentRuntimeFlags)&&this.isInterrupted()?Pe(this.getInterruptedCause()):n;for(;r!==null;){const s=r,i=this.runLoop(s);if(i===Zt){const a=Qt.currentOp;Qt.currentOp=null,a._op===Ds?Fy(this.currentRuntimeFlags)?(this.tell(Yx()),this.tell(Bn(vn)),r=null):r=vn:a._op===jr&&(r=null)}else{this.currentRuntimeFlags=k(this.currentRuntimeFlags,Py(za));const a=this.interruptAllChildren();a!==null?r=H(a,()=>i):(this._queue.length===0?this.setExitValue(i):this.tell(Bn(i)),r=null)}}}finally{this.currentSupervisor.onSuspend(this)}}start(n){if(this._running)this.tell(Bn(n));else{this._running=!0;const r=globalThis[pn];globalThis[pn]=this;try{this.evaluateEffect(n)}finally{this._running=!1,globalThis[pn]=r,this._queue.length>0&&this.drainQueueLaterOnExecutor()}}}startFork(n){this.tell(Bn(n))}patchRuntimeFlags(n,r){const s=Vs(n,r);return globalThis[pn]=this,this.currentRuntimeFlags=s,s}initiateAsync(n,r){let s=!1;const i=a=>{s||(s=!0,this.tell(Bn(a)))};ln(n)&&(this._asyncInterruptor=i);try{r(i)}catch(a){i(zt(nn(a)))}}pushStack(n){this._stack.push(n),n._op==="OnStep"&&this._steps.push({refs:this.getFiberRefs(),flags:this.currentRuntimeFlags})}popStack(){const n=this._stack.pop();if(n)return n._op==="OnStep"&&this._steps.pop(),n}getNextSuccessCont(){let n=this.popStack();for(;n;){if(n._op!==aa)return n;n=this.popStack()}}getNextFailCont(){let n=this.popStack();for(;n;){if(n._op!==Qs&&n._op!==ei&&n._op!==Dr)return n;n=this.popStack()}}[($u=nS,Pu=iS,Dp)](n){return K(()=>Ah(this.currentContext,n))}Left(n){return ht(n.left)}None(n){return ht(new gk)}Right(n){return at(n.right)}Some(n){return at(n.value)}Micro(n){return li(r=>{let s=r;const i=Kx(jx(n,this.currentContext));return i.addObserver(a=>{if(a._tag==="Success")return s(at(a.value));switch(a.cause._tag){case"Interrupt":return s(Pe(un(ir)));case"Fail":return s(ht(a.cause.error));case"Die":return s(ul(a.cause.defect))}}),li(a=>{s=o=>{a(Ht)},i.unsafeInterrupt()})})}[ih](n){const r=gt(()=>n.effect_instruction_i0()),s=this.getNextSuccessCont();return s!==void 0?(s._op in Nr||Ns(s),Nr[s._op](this,s,r)):(Qt.currentOp=at(r),Zt)}[qt](n){const r=n,s=this.getNextSuccessCont();return s!==void 0?(s._op in Nr||Ns(s),Nr[s._op](this,s,r.effect_instruction_i0)):(Qt.currentOp=r,Zt)}[Dt](n){const r=n.effect_instruction_i0,s=this.getNextFailCont();if(s!==void 0)switch(s._op){case aa:case Xs:return ln(this.currentRuntimeFlags)&&this.isInterrupted()?Pe(il(r)):gt(()=>s.effect_instruction_i1(r));case"OnStep":return ln(this.currentRuntimeFlags)&&this.isInterrupted()?Pe(il(r)):at(Pe(r));case Io:return this.patchRuntimeFlags(this.currentRuntimeFlags,s.patch),ln(this.currentRuntimeFlags)&&this.isInterrupted()?Pe(Mt(r,this.getInterruptedCause())):Pe(r);default:Ns(s)}else return Qt.currentOp=Pe(r),Zt}[ah](n){return gt(()=>n.effect_instruction_i0(this,yd(this.currentRuntimeFlags)))}Blocked(n){const r=this.getFiberRefs(),s=this.currentRuntimeFlags;if(this._steps.length>0){const i=[],a=this._steps[this._steps.length-1];let o=this.popStack();for(;o&&o._op!=="OnStep";)i.push(o),o=this.popStack();this.setFiberRefs(a.refs),this.currentRuntimeFlags=a.flags;const c=ix(a.refs,r),u=Us(a.flags,s);return at(Of(n.effect_instruction_i0,Rt(f=>{for(;i.length>0;)f.pushStack(i.pop());return f.setFiberRefs(ax(f.id(),f.getFiberRefs())(c)),f.currentRuntimeFlags=Vs(u)(f.currentRuntimeFlags),n.effect_instruction_i1})))}return Ui(i=>H(Yd(Rv(n.effect_instruction_i0)),()=>i(n.effect_instruction_i1)))}RunBlocked(n){return B1(n.effect_instruction_i0)}[os](n){const r=n.effect_instruction_i0,s=this.currentRuntimeFlags,i=Vs(s,r);if(ln(i)&&this.isInterrupted())return Pe(this.getInterruptedCause());if(this.patchRuntimeFlags(this.currentRuntimeFlags,r),n.effect_instruction_i1){const a=Us(i,s);return this.pushStack(new Ev(a,n)),gt(()=>n.effect_instruction_i1(s))}else return vn}[Qs](n){return this.pushStack(n),n.effect_instruction_i0}OnStep(n){return this.pushStack(n),n.effect_instruction_i0}[aa](n){return this.pushStack(n),n.effect_instruction_i0}[Xs](n){return this.pushStack(n),n.effect_instruction_i0}[jr](n){return this._asyncBlockingOn=n.effect_instruction_i1,this.initiateAsync(this.currentRuntimeFlags,n.effect_instruction_i0),Qt.currentOp=n,Zt}[Ds](n){return this._isYielding=!1,Qt.currentOp=n,Zt}[ei](n){const r=n.effect_instruction_i0,s=n.effect_instruction_i1;return r()?(this.pushStack(n),s()):vn}[Dr](n){return Nr[Dr](this,n,void 0)}[Ri](n){return gt(()=>n.commit())}runLoop(n){let r=n;for(this.currentOpCount=0;;){if((this.currentRuntimeFlags&My)!==0&&this.currentSupervisor.onEffect(this,r),this._queue.length>0&&(r=this.drainQueueWhileRunning(this.currentRuntimeFlags,r)),!this._isYielding){this.currentOpCount+=1;const s=this.currentScheduler.shouldYield(this);if(s!==!1){this._isYielding=!0,this.currentOpCount=0;const i=r;r=H(ec({priority:s}),()=>i)}}try{if(r=this.currentTracer.context(()=>{if(z1!==r[fr]._V){const s=this.getFiberRef(uk);if(s._tag==="Some"){const i=r[fr]._V;this.log(`Executing an Effect versioned ${i} with a Runtime of version ${To()}, you may want to dedupe the effect dependencies, you can use the language service plugin to detect this at compile time: https://github.com/Effect-TS/language-service`,lr,s)}}return this[r._op](r)},this),r===Zt){const s=Qt.currentOp;return s._op===Ds||s._op===jr?Zt:(Qt.currentOp=null,s._op===qt||s._op===Dt?s:Pe(nn(s)))}}catch(s){r!==Zt&&!re(r,"_op")||!(r._op in this)?r=Mv(`Not a valid effect: ${Jn(r)}`):dk(s)?r=Pe(Mt(nn(s),un(ir))):r=ul(s)}}}}const V1=ye("effect/FiberRef/currentMinimumLogLevel",()=>St(B0("Info"))),K1=e=>yc(t=>{const n=C0(t.context,hi);Mh(n,cd).unsafe.log(e.log(t))}),H1=ye(Symbol.for("effect/Logger/defaultLogger"),()=>K1(fS)),G1=ye(Symbol.for("effect/Logger/tracerLogger"),()=>yc(({annotations:e,cause:t,context:n,fiberId:r,logLevel:s,message:i})=>{const a=us(Xr(n,Ki),ud);if(a._tag==="None"||a.value._tag==="ExternalSpan")return;const o=Ah(Xr(n,hi),oc),c={};for(const[u,f]of e)c[u]=f;c["effect.fiberId"]=_b(r),c["effect.logLevel"]=s.label,t!==null&&t._tag!=="Empty"&&(c["effect.cause"]=Di(t,{renderErrorCause:!0})),a.value.event(Jn(Array.isArray(i)&&i.length===1?i[0]:i),o.unsafeCurrentTimeNanos(),c)})),J1=ye(Symbol.for("effect/FiberRef/currentLoggers"),()=>Xv(Bo(H1,G1))),W1=e=>{if(Array.isArray(e)||Qu(e))return[e,G()];const t=Object.keys(e),n=t.length;return[t.map(r=>e[r]),de(r=>{const s={};for(let i=0;i<n;i++)s[t[i]]=r[i];return s})]},Y1=(e,t,n)=>{const r=[];for(const s of e)r.push(Zr(s));return H(es(r,Me,{concurrency:n==null?void 0:n.concurrency,batching:n==null?void 0:n.batching,concurrentFinalizers:n==null?void 0:n.concurrentFinalizers}),s=>{const i=G(),a=s.length,o=new Array(a),c=new Array(a);let u=!1;for(let f=0;f<a;f++){const g=s[f];g._tag==="Left"?(o[f]=de(g.left),u=!0):(c[f]=g.right,o[f]=i)}return u?t._tag==="Some"?ht(t.value(o)):ht(o):n!=null&&n.discard?Ht:t._tag==="Some"?Oe(t.value(c)):Oe(c)})},Z1=(e,t,n)=>{const r=[];for(const s of e)r.push(Zr(s));return n!=null&&n.discard?es(r,Me,{concurrency:n==null?void 0:n.concurrency,batching:n==null?void 0:n.batching,discard:!0,concurrentFinalizers:n==null?void 0:n.concurrentFinalizers}):mt(es(r,Me,{concurrency:n==null?void 0:n.concurrency,batching:n==null?void 0:n.batching,concurrentFinalizers:n==null?void 0:n.concurrentFinalizers}),s=>t._tag==="Some"?t.value(s):s)},Q1=(e,t)=>{const[n,r]=W1(e);return(t==null?void 0:t.mode)==="validate"?Y1(n,r,t):(t==null?void 0:t.mode)==="either"?Z1(n,r,t):(t==null?void 0:t.discard)!==!0&&r._tag==="Some"?mt(es(n,Me,t),r.value):es(n,Me,t)},es=m(e=>Qu(e[0]),(e,t,n)=>Rt(r=>{const s=(n==null?void 0:n.batching)===!0||(n==null?void 0:n.batching)==="inherit"&&r.getFiberRef(ck);return n!=null&&n.discard?Fl(n.concurrency,()=>zn(Wa,n==null?void 0:n.concurrentFinalizers)(i=>s?In(e,(a,o)=>i(t(a,o)),!0,!1,1):zi(e,(a,o)=>i(t(a,o)))),()=>zn(Ya,n==null?void 0:n.concurrentFinalizers)(i=>In(e,(a,o)=>i(t(a,o)),s,!1)),i=>zn(Za(i),n==null?void 0:n.concurrentFinalizers)(a=>In(e,(o,c)=>a(t(o,c)),s,!1,i))):Fl(n==null?void 0:n.concurrency,()=>zn(Wa,n==null?void 0:n.concurrentFinalizers)(i=>s?Bl(e,1,(a,o)=>i(t(a,o)),!0):hn(e,(a,o)=>i(t(a,o)))),()=>zn(Ya,n==null?void 0:n.concurrentFinalizers)(i=>X1(e,(a,o)=>i(t(a,o)),s)),i=>zn(Za(i),n==null?void 0:n.concurrentFinalizers)(a=>Bl(e,i,(o,c)=>a(t(o,c)),s)))})),X1=(e,t,n)=>tt(()=>{const r=We(e),s=new Array(r.length);return tc(In(r,(a,o)=>H(t(a,o),c=>K(()=>s[o]=c)),n,!1),Oe(s))}),In=(e,t,n,r,s)=>Ui(i=>jv(a=>Rt(o=>{let c=Array.from(e).reverse(),u=c.length;if(u===0)return Ht;let f=0,g=!1;const p=s?Math.min(c.length,s):c.length,d=new Set,_=new Array,x=()=>d.forEach(C=>{C.currentScheduler.scheduleTask(()=>{C.unsafeInterruptAsFork(o.id())},0)}),w=new Array,A=new Array,D=new Array,oe=()=>{const C=_.filter(({exit:ue})=>ue._tag==="Failure").sort((ue,Ce)=>ue.index<Ce.index?-1:ue.index===Ce.index?0:1).map(({exit:ue})=>ue);return C.length===0&&C.push(vn),C},I=(C,ue=!1)=>{const Ce=qf(a(C)),M=tw(Ce,o,o.currentRuntimeFlags,Ed);return o.currentScheduler.scheduleTask(()=>{ue&&M.unsafeInterruptAsFork(o.id()),M.resume(Ce)},0),M},S=()=>{r||(u-=c.length,c=[]),g=!0,x()},q=n?Pv:Ff,W=I(An(C=>{const ue=(M,B)=>{M._op==="Blocked"?D.push(M):(_.push({index:B,exit:M}),M._op==="Failure"&&!g&&S())},Ce=()=>{if(c.length>0){const M=c.pop();let B=f++;const Te=()=>{const ce=c.pop();return B=f++,H(ec(),()=>H(q(i(t(ce,B))),xe))},xe=ce=>c.length>0&&(ue(ce,B),c.length>0)?Te():Oe(ce),$e=H(q(i(t(M,B))),xe),we=I($e);w.push(we),d.add(we),g&&we.currentScheduler.scheduleTask(()=>{we.unsafeInterruptAsFork(o.id())},0),we.addObserver(ce=>{let Ye;if(ce._op==="Failure"?Ye=ce:Ye=ce.effect_instruction_i0,A.push(we),d.delete(we),ue(Ye,B),_.length===u)C(Oe(Rn(pl(oe(),{parallel:!0}),()=>vn)));else if(D.length+_.length===u){const bt=oe(),Jt=D.map(Ze=>Ze.effect_instruction_i0).reduce(vf);C(Oe(Of(Jt,In([Rn(pl(bt,{parallel:!0}),()=>vn),...D.map(Ze=>Ze.effect_instruction_i1)],Ze=>Ze,n,!0,s))))}else Ce()})}};for(let M=0;M<p;M++)Ce()}));return Bi(jf(Pf(i(Od(W))),Yf({onFailure:C=>{S();const ue=D.length+1,Ce=Math.min(typeof s=="number"?s:D.length,D.length),M=Array.from(D);return An(B=>{let Te=0,xe=0;const $e=(ce,Ye)=>bt=>{Te++,Te===ue&&B(at(Pe(C))),M.length>0&&Ye&&we()},we=()=>{I(M.pop(),!0).addObserver($e(xe,!0)),xe++};W.addObserver($e(xe,!1)),xe++;for(let ce=0;ce<Ce;ce++)we()})},onSuccess:()=>hn(A,C=>C.inheritAll)})))}))),Bl=(e,t,n,r)=>tt(()=>{const s=We(e),i=new Array(s.length);return tc(In(s,(o,c)=>mt(n(o,c),u=>i[c]=u),r,!1,t),Oe(i))}),Yd=e=>nw(e,Ed),ew=(e,t,n,r=null)=>{const s=Zd(e,t,n,r);return s.resume(e),s},tw=(e,t,n,r=null)=>Zd(e,t,n,r),Zd=(e,t,n,r=null)=>{const s=bb(),i=t.getFiberRefs(),a=T0(i,s),o=new U1(s,a,n),c=Xr(a,Ki),u=o.currentSupervisor;return u.onStart(c,e,de(t),o),o.addObserver(g=>u.onEnd(g,o)),(r!==null?r:k(t.getFiberRef(Ha),Rn(()=>t.scope()))).add(n,o),o},nw=(e,t)=>Rt((n,r)=>Oe(ew(e,n,r.runtimeFlags,t))),zl=e=>bs(t=>$n(us(t,xs),{onNone:()=>e,onSome:n=>{switch(n.strategy._tag){case"Parallel":return e;case"Sequential":case"ParallelN":return H(ic(n,Ya),r=>Sc(e,r))}}})),Ul=e=>t=>bs(n=>$n(us(n,xs),{onNone:()=>t,onSome:r=>r.strategy._tag==="ParallelN"&&r.strategy.parallelism===e?t:H(ic(r,Za(e)),s=>Sc(t,s))})),zn=(e,t)=>n=>bs(r=>$n(us(r,xs),{onNone:()=>n(Me),onSome:s=>{if(t===!0){const i=e._tag==="Parallel"?zl:e._tag==="Sequential"?Vl:Ul(e.parallelism);switch(s.strategy._tag){case"Parallel":return i(n(zl));case"Sequential":return i(n(Vl));case"ParallelN":return i(n(Ul(s.strategy.parallelism)))}}else return n(Me)}})),Vl=e=>bs(t=>$n(us(t,xs),{onNone:()=>e,onSome:n=>{switch(n.strategy._tag){case"Sequential":return e;case"Parallel":case"ParallelN":return H(ic(n,Wa),r=>Sc(e,r))}}})),xs=Ln("effect/Scope"),Sc=m(2,(e,t)=>Sk(e,Nh(Xm(xs,t)))),rw=e=>kr(e,{differ:N1,fork:zr}),Kl=tk(Ly),sw=rw(xc),iw=(e,t,n)=>Fv(r=>H(H(Yd($f(e)),s=>An(i=>{const a=t.map(u=>u.listeners.count),o=()=>{a.every(u=>u===0)&&t.every(u=>u.result.state.current._tag==="Pending"?!0:!!(u.result.state.current._tag==="Done"&&Hi(u.result.state.current.effect)&&u.result.state.current.effect._tag==="Failure"&&iv(u.result.state.current.effect.cause)))&&(c.forEach(u=>u()),n==null||n(),i(zv(s)))};s.addObserver(u=>{c.forEach(f=>f()),i(u)});const c=t.map((u,f)=>{const g=p=>{a[f]=p,o()};return u.listeners.addObserver(g),()=>u.listeners.removeObserver(g)});return o(),K(()=>{c.forEach(u=>u())})})),()=>tt(()=>{const s=t.flatMap(i=>i.state.completed?[]:[i]);return zi(s,i=>I1(i.request,pk(r)))}))),aw=Q1,Hl=Bv,ma=Q0;var ow={debug:(e,...t)=>console.debug(`[DEBUG] ${e}`,...t),info:(e,...t)=>console.info(`[INFO] ${e}`,...t),warn:(e,...t)=>console.warn(`[WARN] ${e}`,...t),error:(e,...t)=>console.error(`[ERROR] ${e}`,...t)},Fs=ow,cw=e=>({debug:(t,...n)=>Fs.debug(`[${e}] ${t}`,...n),info:(t,...n)=>Fs.info(`[${e}] ${t}`,...n),warn:(t,...n)=>Fs.warn(`[${e}] ${t}`,...n),error:(t,...n)=>Fs.error(`[${e}] ${t}`,...n)}),Qd=cw("paths"),Xd=()=>(void 0)((void 0)(),".claude","projects"),lw=e=>{const t=e.split(`
81
- `).filter(n=>n.trim());for(const n of t)try{const r=JSON.parse(n);if(r!=null&&r.cwd)return r.cwd}catch{}return null},uw=e=>e.endsWith(".jsonl")&&!e.startsWith("agent-"),Gl=(e,t)=>{const n=e.replace(/\\/g,"/"),r=t.replace(/\\/g,"/");return n===r?"~":n.startsWith(r+"/")?"~"+n.slice(r.length):e},hw=e=>{const t=e.match(/^([A-Za-z])--/);if(t){const n=t[1],r=e.slice(3);return n+":\\"+r.replace(/--/g,"\\.").replace(/-/g,"\\")}return e.replace(/^-/,"/").replace(/--/g,"/.").replace(/-/g,"/")},fw=e=>{const t=r=>[...r].map(s=>s.charCodeAt(0)<=127?s:"-").join(""),n=e.match(/^([A-Za-z]):[/\\]/);if(n){const r=n[1].toLowerCase(),s=e.slice(3);return r+"--"+t(s).replace(/[/\\]\./g,"--").replace(/[/\\]/g,"-").replace(/\./g,"-")}return t(e).replace(/^\//g,"-").replace(/\/\./g,"--").replace(/\//g,"-").replace(/\./g,"-")},dw=(e,t=Wu,n=Qd)=>{const r=(void 0)(e);try{const s=t.readFileSync(e,"utf-8"),i=lw(s);if(i===null){const a=s.split(`
82
- `).filter(o=>o.trim());return a.length===0?n.debug(`tryGetCwdFromFile: ${r} -> empty file`):n.debug(`tryGetCwdFromFile: ${r} -> no cwd found in ${a.length} lines`),null}return i}catch(s){return n.warn(`tryGetCwdFromFile: ${r} -> read error: ${s}`),null}},gw=(e,t=Xd(),n=Wu,r=Qd)=>{const s=(void 0)(t,e);try{const i=n.readdirSync(s).filter(uw),a=[];for(const c of i){const u=dw((void 0)(s,c),n,r);u!==null&&a.push(u)}const o=a.find(c=>fw(c)===e);return o||(a.length>0?r.warn(`getRealPathFromSession: ${e} -> no match, cwds found: ${a.join(", ")}`):r.warn(`getRealPathFromSession: ${e} -> no valid cwd in any session`),null)}catch{return null}},pw=e=>{const t=(void 0)(),n=gw(e);if(n)return Gl(n,t);const r=hw(e);return Gl(r,t)},mw=(e,t,n,r=60,s="Untitled")=>e||(t?t.length>r?t.slice(0,r-3)+"...":t:n&&n!=="Untitled"?n:s);Hl(function*(){const e=Xd();if(!(yield*ma(()=>(void 0)(e).then(()=>!0).catch(()=>!1))))return[];const n=yield*ma(()=>(void 0)(e,{withFileTypes:!0}));return yield*aw(n.filter(s=>s.isDirectory()&&!s.name.startsWith(".")).map(s=>Hl(function*(){const i=(void 0)(e,s.name),o=(yield*ma(()=>(void 0)(i))).filter(c=>c.endsWith(".jsonl")&&!c.startsWith("agent-"));return{name:s.name,displayName:pw(s.name),path:i,sessionCount:o.length}})),{concurrency:10})});Se.setOptions({breaks:!0,gfm:!0});const Ps=e=>e?new Date(e).toLocaleString():"-",_w=(e,t)=>e.length>t?e.slice(0,t)+"...":e,bw=e=>e.replace(/^\/Users\/[^/]+/,"~"),Ur=e=>typeof e=="string"?e:Array.isArray(e)?e.map(Ur).join(""):e.type==="text"?e.text??"":e.type==="thinking"?"":e.type==="tool_result"?e.content?Ur(e.content):"0":e.content?Ur(e.content):"",Jl=e=>{if(e.summary)return e.summary;if(e.content)return Ur(e.content);const t=e.message;return t!=null&&t.content?Ur(t.content):""},yw=e=>{const t=[],n=/<(ide_[^>]+)>([\s\S]*?)<\/\1>/g;let r=0,s;for(;(s=n.exec(e))!==null;){if(s.index>r){const i=e.slice(r,s.index).trim();i&&t.push({type:"text",content:i})}t.push({type:"ide_tag",tag:s[1],content:s[2].trim()}),r=n.lastIndex}if(r<e.length){const i=e.slice(r).trim();i&&t.push({type:"text",content:i})}return t};var vw=T('<li class="py-2 px-8 text-gh-text-secondary text-sm">Loading...</li>'),kw=T('<button class="flex-shrink-0 w-5 h-8 flex items-center justify-center bg-transparent border-none cursor-pointer text-gh-text-secondary text-xs ml-1 z-10 relative"> </button>'),xw=T('<span class="w-5 ml-1"></span>'),Sw=T('<span class="flex items-center gap-0.5"><span>🤖</span><span> </span></span>'),ww=T('<span class="flex items-center gap-0.5"><span>📋</span><span> </span></span>'),Iw=T('<span class="pl-6 text-[10px] text-gh-text-secondary/70"> </span>'),Tw=T('<li><div class="flex items-start gap-2"><span class="flex-shrink-0">📝</span> <span class="overflow-hidden text-ellipsis line-clamp-2"> </span></div> <!></li>'),Rw=T('<li class="py-1.5 px-4 pl-8 text-gh-text-secondary hover:bg-gh-border-subtle/50 flex items-start gap-2"><span class="flex-shrink-0">📋</span> <span> </span></li>'),Ew=T('<li class="py-1.5 px-4 pl-8 text-gh-text-secondary hover:bg-gh-border-subtle/50 flex items-start gap-2"><span class="flex-shrink-0">📋</span> <span> </span></li>'),Ow=T('<li class="py-1.5 px-4 pl-8 text-gh-text-secondary hover:bg-gh-border-subtle/50 flex items-start gap-2"><span class="flex-shrink-0">🤖</span> <span class="overflow-hidden text-ellipsis whitespace-nowrap"> </span></li>'),Cw=T('<ul class="bg-gh-bg-secondary/50 border-t border-gh-border-subtle text-xs"><!> <!> <!> <!></ul>'),Mw=T(`<li draggable="true"><div class="flex items-center"><!> <button class="flex-1 min-w-0 py-2 pr-2 bg-transparent border-none text-gh-text cursor-pointer text-left flex items-center gap-2 text-sm"><span> </span> <span class="flex-shrink-0 flex items-center gap-2 text-xs text-gh-text-secondary"><span class="flex items-center gap-0.5"><span>💬</span><span> </span></span> <!> <!></span></button> <div><span class="flex-1 min-w-0 pl-7 pr-2 text-xs text-gh-text-secondary italic overflow-hidden text-ellipsis whitespace-nowrap"><!></span> <div class="flex-shrink-0 flex gap-0.5 pr-2 pointer-events-auto"><button class="bg-transparent border-none cursor-pointer p-1 rounded
83
- hover:bg-gh-border text-xs" title="Rename">✏️</button> <button class="bg-transparent border-none cursor-pointer p-1 rounded
84
- hover:bg-gh-red/20 text-xs" title="Delete">🗑️</button></div></div></div> <!></li>`),Aw=T('<ul class="bg-gh-bg"><!></ul>'),Nw=T('<li class="border-b border-gh-border-subtle"><button><span class="text-xs w-3 text-gh-text-secondary"> </span> <span class="flex-1 overflow-hidden text-ellipsis whitespace-nowrap"> </span> <span class="bg-gh-border px-2 py-0.5 rounded-full text-xs font-normal"> </span></button> <!></li>'),Fw=T('<aside class="bg-gh-bg-secondary border border-gh-border rounded-lg overflow-hidden flex flex-col"><h2 class="p-4 text-base font-semibold border-b border-gh-border bg-gh-bg"> </h2> <ul class="overflow-y-auto flex-1"></ul></aside>');function X2(e,t){ns(t,!0);const n=(I,S)=>{var q;return(q=t.projectSessionData.get(I))==null?void 0:q.get(S)},r=I=>{const S=n(I.projectName,I.id);if(S!=null&&S.customTitle)return S.customTitle;if(S!=null&&S.currentSummary){const q=S.currentSummary;return q.length>60?q.slice(0,57)+"...":q}return I.title&&I.title!=="Untitled"?I.title:"Untitled"},s=I=>{const S=n(I.projectName,I.id);return S!=null&&S.customTitle&&(S!=null&&S.currentSummary)?S.currentSummary:S!=null&&S.currentSummary&&I.title&&I.title!=="Untitled"?I.title:S!=null&&S.currentSummary?S.currentSummary:I.title??"No summary available"},i=I=>{const S=n(I.projectName,I.id),q=S!=null&&S.todos?S.todos.sessionTodos.length+S.todos.agentTodos.reduce((W,C)=>W+C.todos.length,0):0;return{agents:(S==null?void 0:S.agents.length)??0,todos:q,summaries:(S==null?void 0:S.summaries.length)??0}},a=$(()=>t.projects.filter(I=>I.sessionCount>0));let o=Ct(_a(new Set));const c=(I,S)=>{I.stopPropagation(),l(o).has(S)?l(o).delete(S):l(o).add(S),ae(o,new Set(l(o)),!0)};let u=Ct(null),f=Ct(null);const g=(I,S)=>{I.dataTransfer&&(ae(u,S,!0),I.dataTransfer.effectAllowed="move",I.dataTransfer.setData("text/plain",JSON.stringify({id:S.id,project:S.projectName})))},p=()=>{ae(u,null),ae(f,null)},d=(I,S)=>{!l(u)||l(u).projectName===S||(I.preventDefault(),I.dataTransfer&&(I.dataTransfer.dropEffect="move"),ae(f,S,!0))},_=()=>{ae(f,null)},x=(I,S)=>{var q;I.preventDefault(),ae(f,null),!(!l(u)||l(u).projectName===S)&&((q=t.onMoveSession)==null||q.call(t,l(u),S),ae(u,null))};var w=Fw(),A=v(w),D=v(A);b(A);var oe=E(A,2);wt(oe,21,()=>l(a),$t,(I,S)=>{const q=$(()=>l(f)===l(S).name);var W=Nw(),C=v(W);C.__click=()=>t.onToggleProject(l(S).name);var ue=v(C),Ce=v(ue,!0);b(ue);var M=E(ue,2),B=v(M,!0);b(M);var Te=E(M,2),xe=v(Te,!0);b(Te),b(C);var $e=E(C,2);{var we=ce=>{var Ye=Aw(),bt=v(Ye);{var Jt=He=>{var R=vw();y(He,R)},Ze=He=>{var R=_e(),Y=le(R);wt(Y,17,()=>t.projectSessions.get(l(S).name)??[],$t,(se,L)=>{const ge=$(()=>{var V;return((V=t.selectedSession)==null?void 0:V.id)===l(L).id}),Re=$(()=>{var V;return((V=l(u))==null?void 0:V.id)===l(L).id}),ie=$(()=>i(l(L))),Z=$(()=>r(l(L))),Q=$(()=>s(l(L))),F=$(()=>n(l(L).projectName,l(L).id)),z=$(()=>{var V,fe;return!((V=l(F))!=null&&V.customTitle)&&!((fe=l(F))!=null&&fe.currentSummary)}),ee=$(()=>l(o).has(l(L).id)),Ee=$(()=>l(ie).summaries>0||l(ie).agents>0||l(ie).todos>0);var ve=Mw(),ke=v(ve),pe=v(ke);{var Ie=V=>{var fe=kw();fe.__click=Yt=>c(Yt,l(L).id);var Qe=v(fe,!0);b(fe),j(()=>{et(fe,"title",l(ee)?"Collapse":"Expand"),O(Qe,l(ee)?"▼":"▶")}),y(V,fe)},lt=V=>{var fe=xw();y(V,fe)};N(pe,V=>{l(Ee)?V(Ie):V(lt,!1)})}var st=E(pe,2);st.__click=()=>t.onSelectSession(l(L));var Ae=v(st),Ge=v(Ae,!0);b(Ae);var De=E(Ae,2),qe=v(De),ft=E(v(qe)),Be=v(ft,!0);b(ft),b(qe);var he=E(qe,2);{var U=V=>{var fe=Sw(),Qe=E(v(fe)),Yt=v(Qe,!0);b(Qe),b(fe),j(()=>{et(fe,"title",`${l(ie).agents??""} agent(s)`),O(Yt,l(ie).agents)}),y(V,fe)};N(he,V=>{l(ie).agents>0&&V(U)})}var Le=E(he,2);{var Ne=V=>{var fe=ww(),Qe=E(v(fe)),Yt=v(Qe,!0);b(Qe),b(fe),j(()=>{et(fe,"title",`${l(ie).todos??""} todo(s)`),O(Yt,l(ie).todos)}),y(V,fe)};N(Le,V=>{l(ie).todos>0&&V(Ne)})}b(De),b(st);var Je=E(st,2),ze=v(Je),Ue=v(ze);{var yt=V=>{var fe=$r();j(Qe=>O(fe,Qe),[()=>l(F).currentSummary.length>50?l(F).currentSummary.slice(0,47)+"...":l(F).currentSummary]),y(V,fe)},Wt=V=>{var fe=$r();j(()=>O(fe,l(Z))),y(V,fe)};N(Ue,V=>{var fe;(fe=l(F))!=null&&fe.currentSummary?V(yt):V(Wt,!1)})}b(ze);var an=E(ze,2),jn=v(an);jn.__click=V=>t.onRenameSession(V,l(L));var it=E(jn,2);it.__click=V=>t.onDeleteSession(V,l(L)),b(an),b(Je),b(ke);var Dn=E(ke,2);{var Zi=V=>{var fe=Cw(),Qe=v(fe);{var Yt=ut=>{var Fe=_e(),vt=le(Fe);wt(vt,17,()=>l(F).summaries,$t,(dn,kt,Ut)=>{var At=Tw();dt(At,1,`py-1.5 px-4 pl-8 hover:bg-gh-border-subtle/50 flex flex-col gap-0.5 ${Ut===0?"text-gh-text":"text-gh-text-secondary"}`);var gn=v(At),ws=E(v(gn),2),eg=v(ws,!0);b(ws),b(gn);var tg=E(gn,2);{var ng=Ir=>{var ea=Iw(),rg=v(ea,!0);b(ea),j(sg=>O(rg,sg),[()=>new Date(l(kt).timestamp).toLocaleString()]),y(Ir,ea)};N(tg,Ir=>{l(kt).timestamp&&Ir(ng)})}b(At),j(Ir=>{et(At,"title",l(kt).summary),O(eg,Ir)},[()=>l(kt).summary.length>100?l(kt).summary.slice(0,97)+"...":l(kt).summary]),y(dn,At)}),y(ut,Fe)};N(Qe,ut=>{var Fe;(Fe=l(F))!=null&&Fe.summaries&&l(F).summaries.length>0&&ut(Yt)})}var Sr=E(Qe,2);{var Qi=ut=>{var Fe=Rw(),vt=E(v(Fe),2),dn=v(vt);b(vt),b(Fe),j(()=>O(dn,`Session Todos (${l(F).todos.sessionTodos.length??""})`)),y(ut,Fe)};N(Sr,ut=>{var Fe,vt;(vt=(Fe=l(F))==null?void 0:Fe.todos)!=null&&vt.sessionTodos&&l(F).todos.sessionTodos.length>0&&ut(Qi)})}var Ss=E(Sr,2);{var Xi=ut=>{var Fe=_e(),vt=le(Fe);wt(vt,17,()=>l(F).todos.agentTodos,$t,(dn,kt)=>{var Ut=Ew(),At=E(v(Ut),2),gn=v(At);b(At),b(Ut),j(()=>O(gn,`Agent Todos (${l(kt).todos.length??""})`)),y(dn,Ut)}),y(ut,Fe)};N(Ss,ut=>{var Fe,vt;(vt=(Fe=l(F))==null?void 0:Fe.todos)!=null&&vt.agentTodos&&ut(Xi)})}var on=E(Ss,2);{var wr=ut=>{var Fe=_e(),vt=le(Fe);wt(vt,17,()=>l(F).agents,$t,(dn,kt)=>{var Ut=Ow(),At=E(v(Ut),2),gn=v(At);b(At),b(Ut),j(ws=>{et(Ut,"title",l(kt).name??l(kt).id),O(gn,`${ws??""} (${l(kt).messageCount??""} msgs)`)},[()=>l(kt).name??l(kt).id.slice(0,12)+"..."]),y(dn,Ut)}),y(ut,Fe)};N(on,ut=>{var Fe;(Fe=l(F))!=null&&Fe.agents&&l(F).agents.length>0&&ut(wr)})}b(fe),y(V,fe)};N(Dn,V=>{l(ee)&&l(Ee)&&V(Zi)})}b(ve),j(()=>{dt(ve,1,`relative border-t border-gh-border-subtle group ${l(ge)?"bg-gh-accent/20 border-l-3 border-l-gh-accent":""} ${l(Re)?"opacity-50":""}`),et(st,"title",l(Q)),dt(Ae,1,`flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap ${l(z)?"italic text-gh-text-secondary":""}`),O(Ge,l(Z)),et(qe,"title",`${l(L).messageCount??""} messages`),O(Be,l(L).messageCount),dt(Je,1,`absolute left-0 right-0 top-0 h-8 flex items-center opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none ${l(ge)?"bg-gradient-to-r from-[color-mix(in_srgb,var(--color-gh-accent)_20%,var(--color-gh-bg))] via-[color-mix(in_srgb,var(--color-gh-accent)_20%,var(--color-gh-bg))] to-[color-mix(in_srgb,var(--color-gh-accent)_20%,var(--color-gh-bg))]":"bg-gradient-to-r from-gh-bg via-gh-bg to-gh-bg"}`)}),bn("dragstart",ve,V=>g(V,l(L))),bn("dragend",ve,p),y(se,ve)}),y(He,R)};N(bt,He=>{t.loadingProject===l(S).name?He(Jt):He(Ze,!1)})}b(Ye),y(ce,Ye)};N($e,ce=>{t.expandedProjects.has(l(S).name)&&ce(we)})}b(W),j((ce,Ye,bt)=>{dt(C,1,`w-full py-3 px-4 bg-transparent border-none text-gh-text cursor-pointer text-left flex items-center gap-2 font-medium hover:bg-gh-border-subtle ${ce??""} ${l(q)?"bg-gh-green/20 ring-2 ring-gh-green ring-inset":""}`),O(Ce,Ye),et(M,"title",l(S).displayName),O(B,bt),O(xe,l(S).sessionCount)},[()=>t.expandedProjects.has(l(S).name)?"bg-gh-accent/10":"",()=>t.expandedProjects.has(l(S).name)?"▼":"▶",()=>bw(l(S).displayName)]),bn("dragover",C,ce=>d(ce,l(S).name)),bn("dragleave",C,_),bn("drop",C,ce=>x(ce,l(S).name)),y(I,W)}),b(oe),b(w),j(()=>O(D,`Projects (${l(a).length??""})`)),y(e,w),rs()}pr(["click"]);var Pw=T('<pre class="whitespace-pre-wrap font-mono text-xs text-gh-text-secondary overflow-x-auto"><code> </code></pre>'),$w=T('<pre class="whitespace-pre-wrap font-mono text-xs text-gh-text-secondary overflow-x-auto"> </pre>'),Lw=T('<button class="absolute bottom-1 left-1/2 -translate-x-1/2 px-3 py-1 text-xs bg-gh-border hover:bg-gh-border-muted rounded-full cursor-pointer border-none text-gh-text-secondary transition-all"> </button>'),jw=T('<div class="absolute bottom-0 left-0 right-0 h-8 bg-gradient-to-t from-gh-canvas to-transparent pointer-events-none"></div> <!>',1),Dw=T('<button class="mt-2 px-3 py-1 text-xs bg-gh-border hover:bg-gh-border-muted rounded-full cursor-pointer border-none text-gh-text-secondary">Collapse</button>'),qw=T('<div class="relative"><!> <!></div>'),Bw=T('<pre class="whitespace-pre-wrap font-mono text-xs text-gh-text-secondary overflow-x-auto"><code> </code></pre>'),zw=T('<pre class="whitespace-pre-wrap font-mono text-xs text-gh-text-secondary overflow-x-auto"> </pre>');function $s(e,t){ns(t,!0);let n=cn(t,"maxLines",3,10),r=Ct(!1),s=Ct(!1);const i=$(()=>t.content.split(`
85
- `)),a=$(()=>l(i).length>n()),o=$(()=>l(a)&&!l(r)?l(i).slice(0,n()).join(`
86
- `):t.content);var c=_e(),u=le(c);{var f=p=>{var d=qw(),_=v(d);{var x=I=>{var S=Pw(),q=v(S),W=v(q,!0);b(q),b(S),j(()=>{dt(q,1,`language-${t.lang??""}`),O(W,l(o))}),y(I,S)},w=I=>{var S=$w(),q=v(S,!0);b(S),j(()=>O(q,l(o))),y(I,S)};N(_,I=>{t.lang?I(x):I(w,!1)})}var A=E(_,2);{var D=I=>{var S=jw(),q=E(le(S),2);{var W=C=>{var ue=Lw();ue.__click=()=>ae(r,!0);var Ce=v(ue);b(ue),j(()=>O(Ce,`Click to expand (${l(i).length-n()} more lines)`)),y(C,ue)};N(q,C=>{l(s)&&C(W)})}y(I,S)},oe=I=>{var S=Dw();S.__click=()=>ae(r,!1),y(I,S)};N(A,I=>{l(r)?I(oe,!1):I(D)})}b(d),bn("mouseenter",d,()=>ae(s,!0)),bn("mouseleave",d,()=>ae(s,!1)),y(p,d)},g=p=>{var d=_e(),_=le(d);{var x=A=>{var D=Bw(),oe=v(D),I=v(oe,!0);b(oe),b(D),j(()=>{dt(oe,1,`language-${t.lang??""}`),O(I,t.content)}),y(A,D)},w=A=>{var D=zw(),oe=v(D,!0);b(D),j(()=>O(oe,t.content)),y(A,D)};N(_,A=>{t.lang?A(x):A(w,!1)},!0)}y(p,d)};N(u,p=>{l(a)?p(f):p(g,!1)})}y(e,c),rs()}pr(["click"]);var Uw=T('<button class="font-mono hover:underline cursor-pointer bg-transparent border-none text-blue-400 p-0"> </button>'),Vw=T('<span class="font-mono opacity-60"> </span>'),Kw=T('<span class="font-mono"> </span>'),Hw=T('<span class="opacity-60"> </span>'),Gw=T('<div class="flex items-center gap-2 text-xs text-blue-400 bg-blue-900/20 rounded px-2 py-1"><span class="opacity-60">📂</span> <!></div>'),Jw=T('<button class="font-mono hover:underline cursor-pointer bg-transparent border-none text-purple-400 p-0"> </button>'),Ww=T('<span class="font-mono opacity-60"> </span>'),Yw=T('<span class="font-mono"> </span>'),Zw=T('<span class="font-mono"> </span>'),Qw=T('<div class="text-xs text-purple-400 bg-purple-900/20 rounded px-2 py-1"><div class="flex items-center gap-2"><span class="opacity-60">✂️</span> <!></div></div>'),Xw=T('<div class="text-xs text-yellow-400 bg-yellow-900/20 rounded px-2 py-1"><span class="opacity-60">⚠️</span> <span class="font-mono"> </span> <span class="opacity-60 ml-1"> </span></div>');function e2(e,t){ns(t,!0);const n=$(()=>{const u=t.content.match(/(?:opened the file |selected.*from )(\/[^\s]+)/);return u?u[1]:t.content.trim().startsWith("/")?t.content.trim().split(`
87
- `)[0].split(" ")[0]:null}),r=$(()=>{const u=t.content.match(/lines? (\d+)(?:\s*to\s*(\d+))?/);return u?u[2]?`L${u[1]}-${u[2]}`:`L${u[1]}`:null}),s=async()=>{l(n)&&await lo(l(n))};var i=_e(),a=le(i);{var o=u=>{var f=Gw(),g=E(v(f),2);{var p=_=>{var x=_e(),w=le(x);ya(w,()=>ba(l(n)),A=>{var D=Kw(),oe=v(D,!0);b(D),j(I=>O(oe,I),[()=>l(n).split("/").pop()]),y(A,D)},(A,D)=>{var oe=_e(),I=le(oe);{var S=W=>{var C=Uw();C.__click=s;var ue=v(C);b(C),j(Ce=>{et(C,"title",l(n)),O(ue,`${Ce??""}${l(r)?`:${l(r)}`:""}`)},[()=>l(n).split("/").pop()]),y(W,C)},q=W=>{var C=Vw(),ue=v(C,!0);b(C),j(Ce=>{et(C,"title",l(n)),O(ue,Ce)},[()=>l(n).split("/").pop()]),y(W,C)};N(I,W=>{l(D)?W(S):W(q,!1)})}y(A,oe)}),y(_,x)},d=_=>{var x=Hw(),w=v(x,!0);b(x),j(()=>O(w,t.content)),y(_,x)};N(g,_=>{l(n)?_(p):_(d,!1)})}b(f),y(u,f)},c=u=>{var f=_e(),g=le(f);{var p=_=>{var x=Qw(),w=v(x),A=E(v(w),2);{var D=I=>{var S=_e(),q=le(S);ya(q,()=>ba(l(n)),W=>{var C=Yw(),ue=v(C);b(C),j(Ce=>O(ue,`${Ce??""}${l(r)?`:${l(r)}`:""}`),[()=>l(n).split("/").pop()]),y(W,C)},(W,C)=>{var ue=_e(),Ce=le(ue);{var M=Te=>{var xe=Jw();xe.__click=s;var $e=v(xe);b(xe),j(we=>{et(xe,"title",l(n)),O($e,`${we??""}${l(r)?`:${l(r)}`:""}`)},[()=>l(n).split("/").pop()]),y(Te,xe)},B=Te=>{var xe=Ww(),$e=v(xe);b(xe),j(we=>{et(xe,"title",l(n)),O($e,`${we??""}${l(r)?`:${l(r)}`:""}`)},[()=>l(n).split("/").pop()]),y(Te,xe)};N(Ce,Te=>{l(C)?Te(M):Te(B,!1)})}y(W,ue)}),y(I,S)},oe=I=>{var S=Zw(),q=v(S,!0);b(S),j(W=>O(q,W),[()=>t.content.split(`
88
- `)[0].slice(0,60)]),y(I,S)};N(A,I=>{l(n)?I(D):I(oe,!1)})}b(w),b(x),y(_,x)},d=_=>{var x=Xw(),w=E(v(x),2),A=v(w);b(w);var D=E(w,2),oe=v(D);b(D),b(x),j(I=>{O(A,`<${t.tag??""}>`),O(oe,`${I??""}${t.content.length>50?"...":""}`)},[()=>t.content.slice(0,50)]),y(_,x)};N(g,_=>{t.tag==="ide_selection"?_(p):_(d,!1)},!0)}y(u,f)};N(a,u=>{t.tag==="ide_opened_file"?u(o):u(c,!1)})}y(e,i),rs()}pr(["click"]);var t2=T('<li><span class="flex-shrink-0"> </span> <span> </span></li>'),n2=T('<ul class="space-y-1.5 mt-1"></ul>');function r2(e,t){const n=i=>{switch(i){case"completed":return"✅";case"in_progress":return"🔄";case"pending":return"⬜"}},r=i=>{switch(i){case"completed":return"text-gh-green";case"in_progress":return"text-gh-accent";case"pending":return"text-gh-text-secondary"}};var s=n2();wt(s,21,()=>t.todos,$t,(i,a)=>{var o=t2(),c=v(o),u=v(c,!0);b(c);var f=E(c,2),g=v(f,!0);b(f),b(o),j((p,d)=>{dt(o,1,`flex items-start gap-2 text-sm ${p??""}`),O(u,d),dt(f,1,Lu(l(a).status==="completed"?"line-through opacity-70":"")),O(g,l(a).status==="in_progress"?l(a).activeForm:l(a).content)},[()=>r(l(a).status),()=>n(l(a).status)]),y(i,o)}),b(s),y(e,s)}var s2=T('<button class="opacity-0 group-hover:opacity-100 transition-opacity bg-transparent border-none cursor-pointer p-1 rounded hover:bg-gh-accent/20 text-xs" title="Split session from this message">✂️</button>'),i2=T('<button class="opacity-0 group-hover:opacity-100 transition-opacity bg-transparent border-none cursor-pointer p-1 rounded hover:bg-gh-red/20 text-xs" title="Delete message">🗑️</button>'),a2=T('<button class="text-gh-accent hover:underline cursor-pointer bg-transparent border-none p-0" title="Open backup in VS Code"> </button>'),o2=T('<span class="text-gh-text-secondary"> </span>'),c2=T('<li class="font-mono text-xs truncate"><!></li>'),l2=T('<div class="p-4 rounded-lg bg-amber-500/10 border-l-3 border-l-amber-500 group relative"><div class="flex justify-between mb-2 text-xs text-gh-text-secondary"><span class="uppercase font-semibold text-amber-400"> </span> <div class="flex items-center gap-2"><span> </span> <!> <!></div></div> <ul class="space-y-1"></ul></div>'),u2=T('<p class="mt-1 text-sm text-gh-text-secondary"> </p>'),h2=T('<div class="p-3 rounded-lg bg-cyan-500/10 border-l-3 border-l-cyan-500 group relative"><div class="flex justify-between items-center text-xs text-gh-text-secondary"><span class="font-semibold text-cyan-400"> </span> <div class="flex items-center gap-2"><span> </span> <!> <!></div></div> <!></div>'),f2=T('<button class="mt-1 text-sm text-gh-accent hover:underline cursor-pointer bg-transparent border-none p-0 font-mono truncate block max-w-full text-left"> </button>'),d2=T('<span class="mt-1 text-sm text-gh-text-secondary font-mono"> </span>'),g2=T('<span class="mt-1 text-sm text-gh-text-secondary font-mono"> </span>'),p2=T('<p class="mt-1 text-sm text-gh-text-secondary"> </p>'),m2=T("<!> <!>",1),_2=T(" <!>",1),b2=T('<div class="p-3 rounded-lg bg-violet-500/10 border-l-3 border-l-violet-500 group relative"><div class="flex justify-between items-center text-xs text-gh-text-secondary"><span class="font-semibold text-violet-400"> </span> <div class="flex items-center gap-2"><span> </span> <!> <!></div></div> <!></div>'),y2=T('<button class="opacity-0 group-hover:opacity-100 transition-opacity bg-transparent border-none cursor-pointer p-1 rounded hover:bg-gh-border text-xs" title="Edit title">✏️</button>'),v2=T('<details class="text-gh-text-secondary"><summary class="cursor-pointer text-xs italic hover:text-gh-text select-none"> </summary> <p class="mt-1 whitespace-pre-wrap italic opacity-70"> </p></details>'),k2=T('<div class="message-content text-sm"></div>'),x2=T('<span class="font-semibold text-purple-400"> </span>'),S2=T('<p class="whitespace-pre-wrap"> </p>'),w2=T('<div class="message-content text-sm"><!></div>'),I2=T('<div><div class="flex justify-between text-xs text-gh-text-secondary"><span class="uppercase font-semibold"> </span> <div class="flex items-center gap-2"><span class="group-hover:hidden"> </span> <span class="hidden group-hover:inline font-mono text-gh-text-secondary/70"> </span> <!> <!> <!></div></div> <!> <!></div>');function Wl(e,t){ns(t,!0);const n=M=>{var B=_e(),Te=le(B);{var xe=$e=>{var we=s2();we.__click=()=>t.onSplit(t.msg),y($e,we)};N(Te,$e=>{t.onSplit&&!s()&&$e(xe)})}y(M,B)},r=M=>{var B=i2();B.__click=()=>t.onDelete(t.msg),y(M,B)};let s=cn(t,"isFirst",3,!1);const i=$(()=>t.msg.uuid??""),a=$(()=>t.msg.type==="assistant"),o=$(()=>t.msg.type==="custom-title"),c=$(()=>t.msg.type==="file-history-snapshot"),u=$(()=>t.msg.type==="human"||t.msg.type==="user"),f=$(()=>t.msg.type==="system"&&t.msg.subtype==="local_command"),g=$(()=>t.msg.type==="queue-operation"),p=$(()=>{if(t.msg.type!=="user")return!1;const M=t.msg.message;if(!Array.isArray(M==null?void 0:M.content))return!1;const B=M.content[0];return(B==null?void 0:B.type)==="tool_result"}),d=$(()=>{if(!l(c))return null;const M=t.msg.snapshot,B=(M==null?void 0:M.trackedFileBackups)??{};return{files:Object.entries(B),timestamp:M==null?void 0:M.timestamp}}),_=$(()=>{var xe,$e;if(!l(f))return null;const M=typeof t.msg.content=="string"?t.msg.content:"",B=((xe=M.match(/<command-name>([^<]+)<\/command-name>/))==null?void 0:xe[1])??"",Te=(($e=M.match(/<command-message>([^<]+)<\/command-message>/))==null?void 0:$e[1])??"";return{name:B,message:Te}}),x=["Read","Write","Edit"],w=$(()=>{if(!l(a))return null;const M=t.msg.message;if(!Array.isArray(M==null?void 0:M.content))return null;const B=M.content.find(Te=>typeof Te=="object"&&Te!==null&&Te.type==="tool_use");return B?{name:B.name,input:B.input,filePath:x.includes(B.name)?B.input.file_path:null}:null}),A=$(()=>{if(!l(a))return[];const M=t.msg.message;return Array.isArray(M==null?void 0:M.content)?M.content.filter(B=>typeof B=="object"&&B!==null&&B.type==="thinking"):[]}),D=$(()=>t.msg.customTitle??""),oe=$(()=>t.msg.uuid||t.msg.messageId||""),I=$(()=>{if(l(g))return!1;if(l(c)||l(f)||l(o)||l(w)||Jl(t.msg).trim().length>0)return!0;if(t.msg.type==="user"||t.msg.type==="human"){const B=l(p)?"Tool result":"User message";console.warn(`${B} without content:`,Mg(t.msg))}return!1}),S=$(()=>l(I)||l(A).length>0),q=$(()=>l(u)?"bg-gh-accent/15 border-l-3 border-l-gh-accent":l(a)?"bg-gh-green/15 border-l-3 border-l-gh-green":l(o)?"bg-purple-500/15 border-l-3 border-l-purple-500":"bg-gh-border-subtle");var W=_e(),C=le(W);{var ue=M=>{},Ce=M=>{var B=_e(),Te=le(B);{var xe=we=>{var ce=l2(),Ye=v(ce),bt=v(Ye),Jt=v(bt);b(bt);var Ze=E(bt,2),He=v(Ze),R=v(He,!0);b(He);var Y=E(He,2);n(Y);var se=E(Y,2);r(se),b(Ze),b(Ye);var L=E(Ye,2);wt(L,21,()=>l(d).files,$t,(ge,Re)=>{var ie=$(()=>Sg(l(Re),2));let Z=()=>l(ie)[0],Q=()=>l(ie)[1];const F=$(()=>!!(Q().backupFileName&&t.sessionId));var z=c2(),ee=v(z);{var Ee=ke=>{var pe=a2();pe.__click=()=>Ig(t.sessionId,Q().backupFileName);var Ie=v(pe,!0);b(pe),j(()=>O(Ie,Z())),y(ke,pe)},ve=ke=>{var pe=o2(),Ie=v(pe,!0);b(pe),j(()=>O(Ie,Z())),y(ke,pe)};N(ee,ke=>{l(F)?ke(Ee):ke(ve,!1)})}b(z),j(()=>et(z,"title",Z())),y(ge,z)}),b(L),b(ce),j(ge=>{et(ce,"data-msg-id",l(i)),O(Jt,`📁 File Backups (${l(d).files.length??""})`),O(R,ge)},[()=>Ps(l(d).timestamp)]),y(we,ce)},$e=we=>{var ce=_e(),Ye=le(ce);{var bt=Ze=>{var He=h2(),R=v(He),Y=v(R),se=v(Y);b(Y);var L=E(Y,2),ge=v(L),Re=v(ge,!0);b(ge);var ie=E(ge,2);n(ie);var Z=E(ie,2);r(Z),b(L),b(R);var Q=E(R,2);{var F=z=>{var ee=u2(),Ee=v(ee,!0);b(ee),j(()=>O(Ee,l(_).message)),y(z,ee)};N(Q,z=>{var ee;l(_).message&&l(_).message!==((ee=l(_).name)==null?void 0:ee.slice(1))&&z(F)})}b(He),j(z=>{et(He,"data-msg-id",l(i)),O(se,`⚡ ${(l(_).name||"Command")??""}`),O(Re,z)},[()=>Ps(t.msg.timestamp)]),y(Ze,He)},Jt=Ze=>{var He=_e(),R=le(He);{var Y=L=>{var ge=b2(),Re=v(ge),ie=v(Re),Z=v(ie);b(ie);var Q=E(ie,2),F=v(Q),z=v(F,!0);b(F);var ee=E(F,2);n(ee);var Ee=E(ee,2);r(Ee),b(Q),b(Re);var ve=E(Re,2);{var ke=Ie=>{var lt=_e(),st=le(lt);ya(st,()=>ba(l(w).filePath),Ae=>{var Ge=g2(),De=v(Ge,!0);b(Ge),j(qe=>O(De,qe),[()=>l(w).filePath.split("/").pop()]),y(Ae,Ge)},(Ae,Ge)=>{var De=_e(),qe=le(De);{var ft=he=>{var U=f2();U.__click=()=>lo(l(w).filePath);var Le=v(U,!0);b(U),j(Ne=>{et(U,"title",l(w).filePath),O(Le,Ne)},[()=>l(w).filePath.split("/").pop()]),y(he,U)},Be=he=>{var U=d2(),Le=v(U,!0);b(U),j(Ne=>{et(U,"title",l(w).filePath),O(Le,Ne)},[()=>l(w).filePath.split("/").pop()]),y(he,U)};N(qe,he=>{l(Ge)?he(ft):he(Be,!1)})}y(Ae,De)}),y(Ie,lt)},pe=Ie=>{var lt=_e(),st=le(lt);{var Ae=De=>{var qe=m2(),ft=le(qe);{var Be=U=>{var Le=p2(),Ne=v(Le,!0);b(Le),j(()=>O(Ne,l(w).input.description)),y(U,Le)};N(ft,U=>{l(w).input.description&&U(Be)})}var he=E(ft,2);{let U=$(()=>String(l(w).input.command));$s(he,{get content(){return l(U)},lang:"sh",maxLines:3})}y(De,qe)},Ge=De=>{const qe=$(()=>{const{path:Ne,...Je}=l(w).input;return{_path:Ne,input:Je}}),ft=$(()=>Object.keys(l(qe).input));var Be=_e(),he=le(Be);{var U=Ne=>{const Je=$(()=>l(ft)[0]),ze=$(()=>l(qe).input[l(Je)]);var Ue=_2(),yt=le(Ue),Wt=E(yt);{var an=it=>{r2(it,{get todos(){return l(ze)}})},jn=it=>{{let Dn=$(()=>`${l(Je)} = ${JSON.stringify(l(ze),null,2)}`);$s(it,{get content(){return l(Dn)},lang:"js",maxLines:1})}};N(Wt,it=>{l(Je)==="todos"&&Array.isArray(l(ze))?it(an):it(jn,!1)})}j(it=>O(yt,`${it??""} `),[()=>(console.info(`${l(Je)} =`,l(ze)),"")]),y(Ne,Ue)},Le=Ne=>{{let Je=$(()=>JSON.stringify(l(qe).input,null,2));$s(Ne,{get content(){return l(Je)},lang:"json",maxLines:6})}};N(he,Ne=>{l(ft).length===1?Ne(U):Ne(Le,!1)})}y(De,Be)};N(st,De=>{l(w).input.command?De(Ae):De(Ge,!1)},!0)}y(Ie,lt)};N(ve,Ie=>{l(w).filePath?Ie(ke):Ie(pe,!1)})}b(ge),j(Ie=>{et(ge,"data-msg-id",l(i)),O(Z,`🔧 ${l(w).name??""}`),O(z,Ie)},[()=>Ps(t.msg.timestamp)]),y(L,ge)},se=L=>{var ge=_e(),Re=le(ge);{var ie=Z=>{var Q=I2(),F=v(Q),z=v(F),ee=v(z,!0);b(z);var Ee=E(z,2),ve=v(Ee),ke=v(ve,!0);b(ve);var pe=E(ve,2),Ie=v(pe,!0);b(pe);var lt=E(pe,2);{var st=he=>{var U=y2();U.__click=()=>t.onEditTitle(t.msg),y(he,U)};N(lt,he=>{l(o)&&t.onEditTitle&&he(st)})}var Ae=E(lt,2);n(Ae);var Ge=E(Ae,2);r(Ge),b(Ee),b(F);var De=E(F,2);{var qe=he=>{var U=k2();wt(U,21,()=>l(A),$t,(Le,Ne,Je)=>{var ze=v2(),Ue=v(ze),yt=v(Ue);b(Ue);var Wt=E(Ue,2),an=v(Wt,!0);b(Wt),b(ze),j(()=>{O(yt,`💭 Thinking ${l(A).length>1?`(${Je+1}/${l(A).length})`:""}`),O(an,l(Ne).thinking)}),y(Le,ze)}),b(U),y(he,U)};N(De,he=>{l(A).length>0&&he(qe)})}var ft=E(De,2);{var Be=he=>{var U=w2(),Le=v(U);{var Ne=ze=>{var Ue=x2(),yt=v(Ue,!0);b(Ue),j(()=>O(yt,l(D))),y(ze,Ue)},Je=ze=>{const Ue=$(()=>Jl(t.msg)),yt=$(()=>yw(l(Ue)));var Wt=_e(),an=le(Wt);wt(an,17,()=>l(yt),$t,(jn,it)=>{var Dn=_e(),Zi=le(Dn);{var V=Qe=>{e2(Qe,{get tag(){return l(it).tag},get content(){return l(it).content}})},fe=Qe=>{const Yt=$(()=>l(it).content.split(`
89
- `));var Sr=_e(),Qi=le(Sr);{var Ss=on=>{$s(on,{get content(){return l(it).content},maxLines:10})},Xi=on=>{var wr=S2(),ut=v(wr,!0);b(wr),j(()=>O(ut,l(it).content)),y(on,wr)};N(Qi,on=>{l(Yt).length>10?on(Ss):on(Xi,!1)})}y(Qe,Sr)};N(Zi,Qe=>{l(it).type==="ide_tag"&&l(it).tag?Qe(V):Qe(fe,!1)})}y(jn,Dn)}),y(ze,Wt)};N(Le,ze=>{l(o)?ze(Ne):ze(Je,!1)})}b(U),y(he,U)};N(ft,he=>{l(I)&&he(Be)})}b(Q),j(he=>{et(Q,"data-msg-id",l(i)),dt(Q,1,`p-4 rounded-lg group relative ${l(q)??""} flex flex-col ${l(S)?"gap-2":""}`),O(ee,l(p)?"OUT":t.msg.type),O(ke,he),O(Ie,l(oe))},[()=>Ps(t.msg.timestamp)]),y(Z,Q)};N(Re,Z=>{l(S)&&Z(ie)},!0)}y(L,ge)};N(R,L=>{l(w)?L(Y):L(se,!1)},!0)}y(Ze,He)};N(Ye,Ze=>{l(f)&&l(_)?Ze(bt):Ze(Jt,!1)},!0)}y(we,ce)};N(Te,we=>{l(c)&&l(d)?we(xe):we($e,!1)},!0)}y(M,B)};N(C,M=>{l(g)?M(ue):M(Ce,!1)})}y(e,W),rs()}pr(["click"]);pr(["click"]);var T2=T(`<h2 class="text-base font-semibold"> </h2> <button class="text-xs text-gh-text-secondary font-mono mt-1 hover:text-gh-accent
90
- hover:underline cursor-pointer bg-transparent border-none p-0 text-left" title="Open session file in VSCode"> </button>`,1),R2=T('<h2 class="text-base font-semibold">Messages</h2>'),E2=T(`<button class="px-2 py-1 text-xs rounded border border-gh-border hover:bg-gh-border-subtle
91
- text-gh-text-secondary hover:text-gh-text transition-colors" title="Jump to last compacted point (context continuation)">📍 Last Compacted</button>`),O2=T(`<div class="flex gap-1 flex-shrink-0"><button class="px-2 py-1 text-xs rounded border border-gh-border hover:bg-gh-border-subtle
92
- text-gh-text-secondary hover:text-gh-text transition-colors" title="Go to top">↑ Top</button> <!> <button class="px-2 py-1 text-xs rounded border border-gh-border hover:bg-gh-border-subtle
93
- text-gh-text-secondary hover:text-gh-text transition-colors" title="Go to bottom">↓ Bottom</button></div>`),C2=T('<div class="p-4 border-b border-gh-border bg-gh-bg flex flex-wrap justify-between items-start gap-2"><div class="flex-1 min-w-[200px]"><!></div> <!></div>'),M2=T('<button>🤖 <span class="hidden md:inline"> </span><span class="md:hidden"> </span> </button>'),A2=T("<button> </button>"),N2=T('<div class="flex border-b border-gh-border bg-gh-bg overflow-x-auto"><div class="flex-1 flex justify-center"><button> </button> <!></div> <!></div>'),F2=T('<div class="flex items-center justify-center h-full text-gh-text-secondary">Select a session to view</div>'),P2=T('<div class="flex items-center justify-center h-full text-gh-text-secondary">No messages</div>'),$2=T('<div class="p-4 flex flex-col gap-4"></div>'),L2=T('<div class="text-gh-text-secondary text-center py-8">No todos</div>'),j2=T('<li class="flex items-start gap-2 p-3 bg-gh-bg rounded border border-gh-border"><span class="flex-shrink-0"><!></span> <span> </span></li>'),D2=T('<ul class="space-y-2"></ul>'),q2=T('<div class="p-4"><!></div>'),B2=T('<div class="flex items-center justify-center h-full text-gh-text-secondary">Loading agent messages...</div>'),z2=T('<div class="flex items-center justify-center h-full text-gh-text-secondary">No messages</div>'),U2=T('<div class="p-4 flex flex-col gap-4"></div>'),V2=T(`<div class="fixed bottom-4 left-1/2 -translate-x-1/2 bg-neutral-500/20 border border-neutral-600
94
- rounded-lg shadow-2xl px-4 py-3 flex items-center gap-4 z-50 backdrop-blur-sm"><span class="text-sm text-white"> </span> <span class="text-xs text-gh-text-secondary tabular-nums"> </span> <button class="px-3 py-1 text-sm font-medium text-gh-accent hover:bg-gh-border-subtle rounded transition-colors">Undo</button> <button class="px-2 py-1 text-sm text-gh-text-secondary hover:text-gh-text hover:bg-gh-border-subtle rounded transition-colors" title="Dismiss (already deleted)">✕</button></div>`),K2=T("<section><!> <!> <div><!></div> <!></section>");function eI(e,t){ns(t,!0);let n=cn(t,"todos",19,()=>[]),r=cn(t,"agents",19,()=>[]),s=cn(t,"showHeader",3,!0),i=cn(t,"enableScroll",3,!0),a=cn(t,"externalScrollContainer",3,null),o=cn(t,"fullWidth",3,!1);const c=$(()=>{var R;return mw(t.customTitle,t.currentSummary,(R=t.session)==null?void 0:R.title,50)});let u=Ct("messages"),f=Ct(_a([])),g=Ct(!1),p=Ct(_a([])),d=Ct(0),_=Ct(null);ra(()=>{if(l(d)<=0)return;const R=setInterval(()=>{ae(d,Math.max(0,l(d)-1),!0),l(d)===0&&ae(p,[],!0)},1e3);return()=>clearInterval(R)}),ra(()=>{var R;(R=t.session)==null||R.id,ae(u,"messages"),ae(f,[],!0)});const x=$(()=>l(u).startsWith("agent:")?l(u).slice(6):null);ra(()=>{l(x)&&t.session&&(ae(g,!0),Tg(t.session.projectName,t.session.id,l(x)).then(R=>{ae(f,R,!0)}).catch(R=>{console.error("Failed to load agent messages:",R),ae(f,[],!0)}).finally(()=>{ae(g,!1)}))});const w=async()=>{var Y;if(l(_)&&clearTimeout(l(_)),!t.session||l(p).length===0)return;const R=[...l(p)].reverse();for(const se of R)try{if(await Rg(t.session.projectName,se.sessionId,se.msg,se.index),se.isAgent){const L=[...l(f)];L.splice(se.index,0,se.msg),ae(f,L,!0)}else{const L=[...t.messages];L.splice(se.index,0,se.msg),(Y=t.onMessagesChange)==null||Y.call(t,L)}}catch(L){console.error("Failed to restore message:",L)}ae(p,[],!0),ae(d,0),ae(_,null)},A=async(R,Y)=>{var Re,ie;if(!t.session)return;const se=R.uuid||R.messageId||R.leafUuid;if(!se)return;const L=Y&&l(x)?l(x):t.session.id;let ge;if(Y){if(ge=l(f).findIndex(Z=>(Z.uuid||Z.messageId||Z.leafUuid)===se),ge===-1)return}else if(ge=t.messages.findIndex(Z=>(Z.uuid||Z.messageId||Z.leafUuid)===se),ge===-1)return;try{if(await Eg(t.session.projectName,L,se),Y)ae(f,l(f).filter(Z=>(Z.uuid||Z.messageId||Z.leafUuid)!==se),!0);else{const Z=t.messages.filter(Q=>(Q.uuid||Q.messageId||Q.leafUuid)!==se);(Re=t.onMessagesChange)==null||Re.call(t,Z)}ae(p,[...l(p),{msg:R,index:ge,isAgent:Y,sessionId:L}],!0),l(_)&&clearTimeout(l(_)),ae(d,10),ae(_,setTimeout(()=>{ae(p,[],!0),ae(d,0),ae(_,null)},1e4),!0),(ie=t.onDeleteMessage)==null||ie.call(t,R)}catch(Z){console.error("Failed to delete message:",Z)}},D=R=>{A(R,!0)},oe=R=>{A(R,!1)},I=async()=>{if(!t.session)return;const R=`~/.claude/projects/${t.session.projectName}/${t.session.id}.jsonl`;try{await lo(R)}catch(Y){console.error("Failed to open file:",Y)}},S=$(()=>t.messages.findIndex(R=>R.type==="user"||R.type==="assistant"||R.type==="human")),q=$(()=>{for(let R=t.messages.length-1;R>=0;R--)if(t.messages[R].isCompactSummary)return R;return-1});let W=Ct(void 0);const C=$(()=>a()??l(W)),ue=()=>{var R;(R=l(C))==null||R.scrollTo({top:0,behavior:"smooth"})},Ce=()=>{var R;(R=l(C))==null||R.scrollTo({top:l(C).scrollHeight,behavior:"smooth"})},M=()=>{if(l(q)<0||!l(C))return;const R=t.messages[l(q)].uuid??`idx-${l(q)}`,Y=l(C).querySelector(`[data-msg-id="${R}"]`);Y&&Y.scrollIntoView({behavior:"smooth",block:"start"})};var B=K2(),Te=v(B);{var xe=R=>{var Y=C2(),se=v(Y),L=v(se);{var ge=Q=>{var F=T2(),z=le(F),ee=v(z,!0);b(z);var Ee=E(z,2);Ee.__click=I;var ve=v(Ee,!0);b(Ee),j(ke=>{O(ee,ke),O(ve,t.session.id)},[()=>_w(l(c),50)]),y(Q,F)},Re=Q=>{var F=R2();y(Q,F)};N(L,Q=>{t.session?Q(ge):Q(Re,!1)})}b(se);var ie=E(se,2);{var Z=Q=>{var F=O2(),z=v(F);z.__click=ue;var ee=E(z,2);{var Ee=ke=>{var pe=E2();pe.__click=M,y(ke,pe)};N(ee,ke=>{l(q)>=0&&ke(Ee)})}var ve=E(ee,2);ve.__click=Ce,b(F),y(Q,F)};N(ie,Q=>{t.session&&t.messages.length>0&&l(u)==="messages"&&Q(Z)})}b(Y),y(R,Y)};N(Te,R=>{s()&&R(xe)})}var $e=E(Te,2);{var we=R=>{var Y=N2(),se=v(Y),L=v(se);L.__click=()=>ae(u,"messages");var ge=v(L);b(L);var Re=E(L,2);wt(Re,17,r,$t,(Q,F)=>{var z=M2();z.__click=()=>ae(u,`agent:${l(F).id}`);var ee=E(v(z)),Ee=v(ee,!0);b(ee);var ve=E(ee),ke=v(ve,!0);b(ve);var pe=E(ve);b(z),j(Ie=>{dt(z,1,`px-4 py-2 text-sm font-medium transition-colors whitespace-nowrap ${l(u)===`agent:${l(F).id}`?"text-gh-accent border-b-2 border-gh-accent":"text-gh-text-secondary hover:text-gh-text hover:bg-gh-border-subtle"}`),O(Ee,l(F).id),O(ke,Ie),O(pe,` (${l(F).messageCount??""})`)},[()=>l(F).id.replace("agent-","")]),y(Q,z)}),b(se);var ie=E(se,2);{var Z=Q=>{var F=A2();F.__click=()=>ae(u,"todos");var z=v(F);b(F),j(()=>{dt(F,1,`px-4 py-2 text-sm font-medium transition-colors whitespace-nowrap ${l(u)==="todos"?"text-gh-accent border-b-2 border-gh-accent":"text-gh-text-secondary hover:text-gh-text hover:bg-gh-border-subtle"}`),O(z,`✅ Todos (${n().length??""})`)}),y(Q,F)};N(ie,Q=>{n().length>0&&Q(Z)})}b(Y),j(()=>{dt(L,1,`px-4 py-2 text-sm font-medium transition-colors whitespace-nowrap ${l(u)==="messages"?"text-gh-accent border-b-2 border-gh-accent":"text-gh-text-secondary hover:text-gh-text hover:bg-gh-border-subtle"}`),O(ge,`💬 Messages (${t.messages.length??""})`)}),y(R,Y)};N($e,R=>{t.session&&R(we)})}var ce=E($e,2),Ye=v(ce);{var bt=R=>{var Y=F2();y(R,Y)},Jt=R=>{var Y=_e(),se=le(Y);{var L=Re=>{var ie=_e(),Z=le(ie);{var Q=z=>{var ee=P2();y(z,ee)},F=z=>{var ee=$2();wt(ee,23,()=>t.messages,(Ee,ve)=>Ee.uuid??`idx-${ve}`,(Ee,ve,ke)=>{{let pe=$(()=>{var lt;return((lt=t.session)==null?void 0:lt.id)??""}),Ie=$(()=>l(ke)===l(S));Wl(Ee,{get msg(){return l(ve)},get sessionId(){return l(pe)},onDelete:oe,get onEditTitle(){return t.onEditTitle},get onSplit(){return t.onSplitSession},get isFirst(){return l(Ie)}})}}),b(ee),y(z,ee)};N(Z,z=>{t.messages.length===0?z(Q):z(F,!1)})}y(Re,ie)},ge=Re=>{var ie=_e(),Z=le(ie);{var Q=z=>{var ee=q2(),Ee=v(ee);{var ve=pe=>{var Ie=L2();y(pe,Ie)},ke=pe=>{var Ie=D2();wt(Ie,21,n,$t,(lt,st)=>{var Ae=j2(),Ge=v(Ae),De=v(Ge);{var qe=U=>{var Le=$r("✅");y(U,Le)},ft=U=>{var Le=_e(),Ne=le(Le);{var Je=Ue=>{var yt=$r("🔄");y(Ue,yt)},ze=Ue=>{var yt=$r("⬜");y(Ue,yt)};N(Ne,Ue=>{l(st).status==="in_progress"?Ue(Je):Ue(ze,!1)},!0)}y(U,Le)};N(De,U=>{l(st).status==="completed"?U(qe):U(ft,!1)})}b(Ge);var Be=E(Ge,2),he=v(Be,!0);b(Be),b(Ae),j(()=>{dt(Be,1,Lu(l(st).status==="completed"?"text-gh-text-secondary line-through":"")),O(he,l(st).content)}),y(lt,Ae)}),b(Ie),y(pe,Ie)};N(Ee,pe=>{n().length===0?pe(ve):pe(ke,!1)})}b(ee),y(z,ee)},F=z=>{var ee=_e(),Ee=le(ee);{var ve=ke=>{var pe=_e(),Ie=le(pe);{var lt=Ae=>{var Ge=B2();y(Ae,Ge)},st=Ae=>{var Ge=_e(),De=le(Ge);{var qe=Be=>{var he=z2();y(Be,he)},ft=Be=>{var he=U2();wt(he,23,()=>l(f),U=>U.uuid,(U,Le,Ne)=>{{let Je=$(()=>l(Ne)===0);Wl(U,{get msg(){return l(Le)},get sessionId(){return l(x)},onDelete:D,get isFirst(){return l(Je)}})}}),b(he),y(Be,he)};N(De,Be=>{l(f).length===0?Be(qe):Be(ft,!1)},!0)}y(Ae,Ge)};N(Ie,Ae=>{l(g)?Ae(lt):Ae(st,!1)})}y(ke,pe)};N(Ee,ke=>{l(x)&&ke(ve)},!0)}y(z,ee)};N(Z,z=>{l(u)==="todos"?z(Q):z(F,!1)},!0)}y(Re,ie)};N(se,Re=>{l(u)==="messages"?Re(L):Re(ge,!1)},!0)}y(R,Y)};N(Ye,R=>{t.session?R(Jt,!1):R(bt)})}b(ce),Og(ce,R=>ae(W,R),()=>l(W));var Ze=E(ce,2);{var He=R=>{var Y=V2(),se=v(Y),L=v(se,!0);b(se);var ge=E(se,2),Re=v(ge);b(ge);var ie=E(ge,2);ie.__click=w;var Z=E(ie,2);Z.__click=()=>{l(_)&&clearTimeout(l(_)),ae(p,[],!0),ae(d,0)},b(Y),j(()=>{O(L,l(p).length===1?"Message deleted":`${l(p).length} messages deleted`),O(Re,`${l(d)??""}s`)}),y(R,Y)};N(Ze,R=>{l(p).length>0&&R(He)})}b(B),j(()=>{dt(B,1,`bg-gh-bg-secondary overflow-hidden flex flex-col ${o()?"":"border border-gh-border rounded-lg"}`),dt(ce,1,`flex-1 ${i()?"overflow-y-auto":""}`)}),y(e,B),rs()}pr(["click"]);export{X2 as P,eI as S,mw as g};