@neuralnomads/codenomad 0.15.0 → 0.16.0

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 (131) hide show
  1. package/dist/filesystem/__tests__/browser.test.js +65 -0
  2. package/dist/filesystem/__tests__/search-cache.test.js +2 -2
  3. package/dist/filesystem/browser.js +25 -4
  4. package/dist/index.js +4 -0
  5. package/dist/opencode-plugin/codenomad-opencode-plugin.tgz +0 -0
  6. package/dist/opencode-plugin.js +146 -0
  7. package/dist/opencode-plugin.test.js +28 -0
  8. package/dist/previews/manager.js +63 -0
  9. package/dist/server/http-server.js +372 -14
  10. package/dist/server/routes/filesystem.js +13 -0
  11. package/dist/server/routes/previews.js +25 -0
  12. package/dist/server/routes/workspaces.js +23 -1
  13. package/dist/workspaces/__tests__/git-clone.test.js +141 -0
  14. package/dist/workspaces/__tests__/spawn.test.js +26 -8
  15. package/dist/workspaces/git-clone.js +148 -0
  16. package/dist/workspaces/manager.js +8 -5
  17. package/dist/workspaces/spawn.js +35 -9
  18. package/package.json +3 -3
  19. package/public/assets/{ChangesTab-ovdqLHc3.js → ChangesTab-CxrJwz2Z.js} +2 -2
  20. package/public/assets/{DiffToolbar-B12EfXMX.js → DiffToolbar-CqJttTgx.js} +1 -1
  21. package/public/assets/{FilesTab-nb_itEXG.js → FilesTab-tBrdrLID.js} +2 -2
  22. package/public/assets/GitChangesTab-DUUJn4Va.js +2 -0
  23. package/public/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  24. package/public/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  25. package/public/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  26. package/public/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  27. package/public/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  28. package/public/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  29. package/public/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  30. package/public/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  31. package/public/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  32. package/public/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  33. package/public/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  34. package/public/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  35. package/public/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  36. package/public/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  37. package/public/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  38. package/public/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  39. package/public/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  40. package/public/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  41. package/public/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  42. package/public/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  43. package/public/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  44. package/public/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  45. package/public/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  46. package/public/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  47. package/public/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  48. package/public/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  49. package/public/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  50. package/public/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  51. package/public/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  52. package/public/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  53. package/public/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  54. package/public/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  55. package/public/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  56. package/public/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  57. package/public/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  58. package/public/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  59. package/public/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  60. package/public/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  61. package/public/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  62. package/public/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  63. package/public/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  64. package/public/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  65. package/public/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  66. package/public/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  67. package/public/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  68. package/public/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  69. package/public/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  70. package/public/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  71. package/public/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  72. package/public/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  73. package/public/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  74. package/public/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  75. package/public/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  76. package/public/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  77. package/public/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  78. package/public/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  79. package/public/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  80. package/public/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  81. package/public/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  82. package/public/assets/{SplitFilePanel-BOHH3F--.js → SplitFilePanel-CiZrHI3o.js} +1 -1
  83. package/public/assets/StatusTab-DN31GijL.js +1 -0
  84. package/public/assets/{align-justify-9zpyaAdy.js → align-justify-CKbOni6U.js} +1 -1
  85. package/public/assets/{bundle-full-xFW13Lny.js → bundle-full-B_MbXXHv.js} +1 -1
  86. package/public/assets/{diff-viewer-xG9yjpN8.js → diff-viewer-CersJruo.js} +1 -1
  87. package/public/assets/index-BTenW4sL.js +1 -0
  88. package/public/assets/index-BsYORY4z.js +1 -0
  89. package/public/assets/index-BvfQjuig.js +1 -0
  90. package/public/assets/{index-CCAZZY0l.js → index-CK51N0B7.js} +1 -1
  91. package/public/assets/index-Chghci_R.js +1 -0
  92. package/public/assets/{index-Cz_fl8aY.js → index-DYa3o0_M.js} +1 -1
  93. package/public/assets/index-DskBWxXS.js +2 -0
  94. package/public/assets/index-DslkXxdb.js +1 -0
  95. package/public/assets/index-UCZ7MxNK.js +1 -0
  96. package/public/assets/index-i5UooSrU.css +1 -0
  97. package/public/assets/{loading-HUhLEgb_.js → loading-hkCubi3k.js} +1 -1
  98. package/public/assets/main-CXJTHRp1.js +62 -0
  99. package/public/assets/markdown-Cy9tCAXp.js +315 -0
  100. package/public/assets/monaco-viewer-B3iAKbO0.js +26 -0
  101. package/public/assets/tool-call-DhWimeRu.js +59 -0
  102. package/public/assets/{unified-picker-DuNuUpLy.js → unified-picker-C47f5lFi.js} +1 -1
  103. package/public/assets/{wrap-text-zghCl6wN.js → wrap-text-hwXbREuU.js} +1 -1
  104. package/public/index.html +4 -4
  105. package/public/loading.html +4 -4
  106. package/public/sw.js +1 -1
  107. package/public/ui-version.json +1 -1
  108. package/dist/opencode-config/README.md +0 -32
  109. package/dist/opencode-config/opencode.jsonc +0 -3
  110. package/dist/opencode-config/package-lock.json +0 -380
  111. package/dist/opencode-config/package.json +0 -9
  112. package/dist/opencode-config/plugin/codenomad.ts +0 -62
  113. package/dist/opencode-config/plugin/lib/background-process.ts +0 -265
  114. package/dist/opencode-config/plugin/lib/client.ts +0 -133
  115. package/dist/opencode-config/plugin/lib/request.ts +0 -214
  116. package/dist/opencode-config.js +0 -26
  117. package/public/assets/GitChangesTab-DcT_4BL2.js +0 -2
  118. package/public/assets/StatusTab-Dyt_EG33.js +0 -1
  119. package/public/assets/index-7DpT014-.js +0 -1
  120. package/public/assets/index-BDK4V9L0.js +0 -1
  121. package/public/assets/index-Bx-Bezt2.js +0 -1
  122. package/public/assets/index-CEcZq5WB.js +0 -1
  123. package/public/assets/index-CQCmSDHL.js +0 -1
  124. package/public/assets/index-Dcgftm1m.css +0 -1
  125. package/public/assets/index-m4C3yx3J.js +0 -1
  126. package/public/assets/index-mh_z9p40.js +0 -2
  127. package/public/assets/main-CKhfaeKI.js +0 -48
  128. package/public/assets/markdown-BeXU9Z-x.js +0 -58
  129. package/public/assets/monaco-viewer-BgP6xpZ6.js +0 -26
  130. package/public/assets/todo-D6PVVp_f.js +0 -1
  131. package/public/assets/tool-call-Dgn3NlA8.js +0 -60
@@ -0,0 +1,26 @@
1
+ var to=Object.defineProperty;var no=(e,t,n)=>t in e?to(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ot=(e,t,n)=>no(e,typeof t!="symbol"?t+"":t,n);import{c as L,a as ce,u as Ge,s as kt,b as K,r as ro,d as M,e as Hn,o as le,g as pn,f as I,$ as U,h as Ae,i as ht,j as Je,k as Ne,l as Ye,m as Gn,n as ue,p as oo,q as so,t as $t,v as io,S as ao}from"./git-diff-vendor-CSgooKT_.js";import{g as co}from"./fast-diff-vendor-DgdwVvTQ.js";const lo=["allowfullscreen","async","alpha","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","adauctionheaders","browsingtopics","credentialless","defaultchecked","defaultmuted","defaultselected","defer","disablepictureinpicture","disableremoteplayback","preservespitch","shadowrootclonable","shadowrootcustomelementregistry","shadowrootdelegatesfocus","shadowrootserializable","sharedstoragewritable"],uo=new Set(["className","value","readOnly","noValidate","formNoValidate","isMap","noModule","playsInline","adAuctionHeaders","allowFullscreen","browsingTopics","defaultChecked","defaultMuted","defaultSelected","disablePictureInPicture","disableRemotePlayback","preservesPitch","shadowRootClonable","shadowRootCustomElementRegistry","shadowRootDelegatesFocus","shadowRootSerializable","sharedStorageWritable",...lo]),fo=new Set(["innerHTML","textContent","innerText","children"]),go=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),ho=Object.assign(Object.create(null),{class:"className",novalidate:{$:"noValidate",FORM:1},formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1},adauctionheaders:{$:"adAuctionHeaders",IFRAME:1},allowfullscreen:{$:"allowFullscreen",IFRAME:1},browsingtopics:{$:"browsingTopics",IMG:1},defaultchecked:{$:"defaultChecked",INPUT:1},defaultmuted:{$:"defaultMuted",AUDIO:1,VIDEO:1},defaultselected:{$:"defaultSelected",OPTION:1},disablepictureinpicture:{$:"disablePictureInPicture",VIDEO:1},disableremoteplayback:{$:"disableRemotePlayback",AUDIO:1,VIDEO:1},preservespitch:{$:"preservesPitch",AUDIO:1,VIDEO:1},shadowrootclonable:{$:"shadowRootClonable",TEMPLATE:1},shadowrootdelegatesfocus:{$:"shadowRootDelegatesFocus",TEMPLATE:1},shadowrootserializable:{$:"shadowRootSerializable",TEMPLATE:1},sharedstoragewritable:{$:"sharedStorageWritable",IFRAME:1,IMG:1}});function mo(e,t){const n=ho[e];return typeof n=="object"?n[t]?n.$:void 0:n}const po=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),Jn=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),yo={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},bo=e=>L(()=>e());function wo(e,t,n){let r=n.length,o=t.length,s=r,i=0,a=0,c=t[o-1].nextSibling,l=null;for(;i<o||a<s;){if(t[i]===n[a]){i++,a++;continue}for(;t[o-1]===n[s-1];)o--,s--;if(o===i){const u=s<r?a?n[a-1].nextSibling:n[s-a]:c;for(;a<s;)e.insertBefore(n[a++],u)}else if(s===a)for(;i<o;)(!l||!l.has(t[i]))&&t[i].remove(),i++;else if(t[i]===n[s-1]&&n[a]===t[o-1]){const u=t[--o].nextSibling;e.insertBefore(n[a++],t[i++].nextSibling),e.insertBefore(n[--s],u),t[o]=n[s]}else{if(!l){l=new Map;let d=a;for(;d<s;)l.set(n[d],d++)}const u=l.get(t[i]);if(u!=null)if(a<u&&u<s){let d=i,g=1,m;for(;++d<o&&d<s&&!((m=l.get(t[d]))==null||m!==u+g);)g++;if(g>u-a){const p=t[i];for(;a<u;)e.insertBefore(n[a++],p)}else e.replaceChild(n[a++],t[i++])}else i++;else t[i++].remove()}}}const yn="_$DX_DELEGATE";function Fc(e,t,n,r={}){let o;return Hn(s=>{o=s,t===document?e():mt(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{o(),t.textContent=""}}function on(e,t,n,r){let o;const s=()=>{const a=r?document.createElementNS("http://www.w3.org/1998/Math/MathML","template"):document.createElement("template");return a.innerHTML=e,n?a.content.firstChild.firstChild:r?a.firstChild:a.content.firstChild},i=t?()=>Ge(()=>document.importNode(o||(o=s()),!0)):()=>(o||(o=s())).cloneNode(!0);return i.cloneNode=i,i}function qn(e,t=window.document){const n=t[yn]||(t[yn]=new Set);for(let r=0,o=e.length;r<o;r++){const s=e[r];n.has(s)||(n.add(s),t.addEventListener(s,To))}}function qe(e,t,n){we(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function Co(e,t,n,r){we(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function So(e,t,n){we(e)||(n?e.setAttribute(t,""):e.removeAttribute(t))}function xo(e,t){we(e)||(t==null?e.removeAttribute("class"):e.className=t)}function Oo(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){const o=n[0];e.addEventListener(t,n[0]=s=>o.call(e,n[1],s))}else e.addEventListener(t,n,typeof n!="function"&&n)}function vo(e,t,n={}){const r=Object.keys(t||{}),o=Object.keys(n);let s,i;for(s=0,i=o.length;s<i;s++){const a=o[s];!a||a==="undefined"||t[a]||(wn(e,a,!1),delete n[a])}for(s=0,i=r.length;s<i;s++){const a=r[s],c=!!t[a];!a||a==="undefined"||n[a]===c||!c||(wn(e,a,!0),n[a]=c)}return n}function ko(e,t,n){if(!t)return n?qe(e,"style"):t;const r=e.style;if(typeof t=="string")return r.cssText=t;typeof n=="string"&&(r.cssText=n=void 0),n||(n={}),t||(t={});let o,s;for(s in n)t[s]==null&&r.removeProperty(s),delete n[s];for(s in t)o=t[s],o!==n[s]&&(r.setProperty(s,o),n[s]=o);return n}function bn(e,t,n){n!=null?e.style.setProperty(t,n):e.style.removeProperty(t)}function Xn(e,t={},n,r){const o={};return r||ce(()=>o.children=Xe(e,t.children,o.children)),ce(()=>typeof t.ref=="function"&&sn(t.ref,e)),ce(()=>$o(e,t,n,!0,o,!0)),o}function sn(e,t,n){return Ge(()=>e(t,n))}function mt(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!="function")return Xe(e,t,r,n);ce(o=>Xe(e,t(),o,n),r)}function $o(e,t,n,r,o={},s=!1){t||(t={});for(const i in o)if(!(i in t)){if(i==="children")continue;o[i]=Cn(e,i,null,o[i],n,s,t)}for(const i in t){if(i==="children")continue;const a=t[i];o[i]=Cn(e,i,a,o[i],n,s,t)}}function Yn(e){let t,n;return!we()||!(t=I.registry.get(n=Mo()))?e():(I.completed&&I.completed.add(t),I.registry.delete(n),t)}function we(e){return!!I.context&&!I.done&&(!e||e.isConnected)}function Ao(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function wn(e,t,n){const r=t.trim().split(/\s+/);for(let o=0,s=r.length;o<s;o++)e.classList.toggle(r[o],n)}function Cn(e,t,n,r,o,s,i){let a,c,l,u,d;if(t==="style")return ko(e,n,r);if(t==="classList")return vo(e,n,r);if(n===r)return r;if(t==="ref")s||n(e);else if(t.slice(0,3)==="on:"){const g=t.slice(3);r&&e.removeEventListener(g,r,typeof r!="function"&&r),n&&e.addEventListener(g,n,typeof n!="function"&&n)}else if(t.slice(0,10)==="oncapture:"){const g=t.slice(10);r&&e.removeEventListener(g,r,!0),n&&e.addEventListener(g,n,!0)}else if(t.slice(0,2)==="on"){const g=t.slice(2).toLowerCase(),m=po.has(g);if(!m&&r){const p=Array.isArray(r)?r[0]:r;e.removeEventListener(g,p)}(m||n)&&(Oo(e,g,n,m),m&&qn([g]))}else if(t.slice(0,5)==="attr:")qe(e,t.slice(5),n);else if(t.slice(0,5)==="bool:")So(e,t.slice(5),n);else if((d=t.slice(0,5)==="prop:")||(l=fo.has(t))||!o&&((u=mo(t,e.tagName))||(c=uo.has(t)))||(a=e.nodeName.includes("-")||"is"in i)){if(d)t=t.slice(5),c=!0;else if(we(e))return n;t==="class"||t==="className"?xo(e,n):a&&!c&&!l?e[Ao(t)]=n:e[u||t]=n}else{const g=o&&t.indexOf(":")>-1&&yo[t.split(":")[0]];g?Co(e,g,t,n):qe(e,go[t]||t,n)}return n}function To(e){if(I.registry&&I.events&&I.events.find(([c,l])=>l===e))return;let t=e.target;const n=`$$${e.type}`,r=e.target,o=e.currentTarget,s=c=>Object.defineProperty(e,"target",{configurable:!0,value:c}),i=()=>{const c=t[n];if(c&&!t.disabled){const l=t[`${n}Data`];if(l!==void 0?c.call(t,l,e):c.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&s(t.host),!0},a=()=>{for(;i()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),I.registry&&!I.done&&(I.done=_$HY.done=!0),e.composedPath){const c=e.composedPath();s(c[0]);for(let l=0;l<c.length-2&&(t=c[l],!!i());l++){if(t._$host){t=t._$host,a();break}if(t.parentNode===o)break}}else a();s(r)}function Xe(e,t,n,r,o){const s=we(e);if(s){!n&&(n=[...e.childNodes]);let c=[];for(let l=0;l<n.length;l++){const u=n[l];u.nodeType===8&&u.data.slice(0,2)==="!$"?u.remove():c.push(u)}n=c}for(;typeof n=="function";)n=n();if(t===n)return n;const i=typeof t,a=r!==void 0;if(e=a&&n[0]&&n[0].parentNode||e,i==="string"||i==="number"){if(s||i==="number"&&(t=t.toString(),t===n))return n;if(a){let c=n[0];c&&c.nodeType===3?c.data!==t&&(c.data=t):c=document.createTextNode(t),n=Oe(e,n,r,c)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||i==="boolean"){if(s)return n;n=Oe(e,n,r)}else{if(i==="function")return ce(()=>{let c=t();for(;typeof c=="function";)c=c();n=Xe(e,c,n,r)}),()=>n;if(Array.isArray(t)){const c=[],l=n&&Array.isArray(n);if(zt(c,t,n,o))return ce(()=>n=Xe(e,c,n,r,!0)),()=>n;if(s){if(!c.length)return n;if(r===void 0)return n=[...e.childNodes];let u=c[0];if(u.parentNode!==e)return n;const d=[u];for(;(u=u.nextSibling)!==r;)d.push(u);return n=d}if(c.length===0){if(n=Oe(e,n,r),a)return n}else l?n.length===0?Sn(e,c,r):wo(e,n,c):(n&&Oe(e),Sn(e,c));n=c}else if(t.nodeType){if(s&&t.parentNode)return n=a?[t]:t;if(Array.isArray(n)){if(a)return n=Oe(e,n,r,t);Oe(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function zt(e,t,n,r){let o=!1;for(let s=0,i=t.length;s<i;s++){let a=t[s],c=n&&n[e.length],l;if(!(a==null||a===!0||a===!1))if((l=typeof a)=="object"&&a.nodeType)e.push(a);else if(Array.isArray(a))o=zt(e,a,c)||o;else if(l==="function")if(r){for(;typeof a=="function";)a=a();o=zt(e,Array.isArray(a)?a:[a],Array.isArray(c)?c:[c])||o}else e.push(a),o=!0;else{const u=String(a);c&&c.nodeType===3&&c.data===u?e.push(c):e.push(document.createTextNode(u))}}return o}function Sn(e,t,n=null){for(let r=0,o=t.length;r<o;r++)e.insertBefore(t[r],n)}function Oe(e,t,n,r){if(n===void 0)return e.textContent="";const o=r||document.createTextNode("");if(t.length){let s=!1;for(let i=t.length-1;i>=0;i--){const a=t[i];if(o!==a){const c=a.parentNode===e;!s&&!i?c?e.replaceChild(o,a):e.insertBefore(o,n):c&&a.remove()}else s=!0}}else e.insertBefore(o,n);return[o]}function Mo(){return I.getNextContextId()}const Eo="http://www.w3.org/2000/svg";function Zn(e,t=!1,n=void 0){return t?document.createElementNS(Eo,e):document.createElement(e,{is:n})}function Rc(e){const{useShadow:t}=e,n=document.createTextNode(""),r=()=>e.mount||document.body,o=pn();let s,i=!!I.context;return K(()=>{i&&(pn().user=i=!1),s||(s=ro(o,()=>L(()=>e.children)));const a=r();if(a instanceof HTMLHeadElement){const[c,l]=M(!1),u=()=>l(!0);Hn(d=>mt(a,()=>c()?d():s(),null)),le(u)}else{const c=Zn(e.isSVG?"g":"div",e.isSVG),l=t&&c.attachShadow?c.attachShadow({mode:"open"}):c;Object.defineProperty(c,"_$host",{get(){return n.parentNode},configurable:!0}),mt(l,s),a.appendChild(c),e.ref&&e.ref(c),le(()=>a.removeChild(c))}},void 0,{render:!i}),n}function Po(e,t){const n=L(e);return L(()=>{const r=n();switch(typeof r){case"function":return Ge(()=>r(t));case"string":const o=Jn.has(r),s=I.context?Yn():Zn(r,o,Ge(()=>t.is));return Xn(s,t,o),s}})}function Nc(e){const[,t]=kt(e,["component"]);return Po(()=>e.component,t)}const Le=Symbol("store-raw"),ne=Symbol("store-node"),H=Symbol("store-has"),Qn=Symbol("store-self");function er(e){let t=e[U];if(!t&&(Object.defineProperty(e,U,{value:t=new Proxy(e,Lo)}),!Array.isArray(e))){const n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e);for(let o=0,s=n.length;o<s;o++){const i=n[o];r[i].get&&Object.defineProperty(e,i,{enumerable:r[i].enumerable,get:r[i].get.bind(t)})}}return t}function Z(e){let t;return e!=null&&typeof e=="object"&&(e[U]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function oe(e,t=new Set){let n,r,o,s;if(n=e!=null&&e[Le])return n;if(!Z(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let i=0,a=e.length;i<a;i++)o=e[i],(r=oe(o,t))!==o&&(e[i]=r)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);const i=Object.keys(e),a=Object.getOwnPropertyDescriptors(e);for(let c=0,l=i.length;c<l;c++)s=i[c],!a[s].get&&(o=e[s],(r=oe(o,t))!==o&&(e[s]=r))}return e}function De(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function pe(e,t,n){if(e[t])return e[t];const[r,o]=M(n,{equals:!1,internal:!0});return r.$=o,e[t]=r}function Io(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===U||t===ne||(delete n.value,delete n.writable,n.get=()=>e[U][t]),n}function an(e){Je()&&pe(De(e,ne),Qn)()}function tr(e){return an(e),Reflect.ownKeys(e)}const Lo={get(e,t,n){if(t===Le)return e;if(t===U)return n;if(t===ht)return an(e),n;const r=De(e,ne),o=r[t];let s=o?o():e[t];if(t===ne||t===H||t==="__proto__")return s;if(!o){const i=Object.getOwnPropertyDescriptor(e,t);Je()&&(typeof s!="function"||e.hasOwnProperty(t))&&!(i&&i.get)&&(s=pe(r,t,s)())}return Z(s)?er(s):s},has(e,t){return t===Le||t===U||t===ht||t===ne||t===H||t==="__proto__"?!0:(Je()&&pe(De(e,H),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:tr,getOwnPropertyDescriptor:Io};function F(e,t,n,r=!1){if(!r&&e[t]===n)return;const o=e[t],s=e.length;n===void 0?(delete e[t],e[H]&&e[H][t]&&o!==void 0&&e[H][t].$()):(e[t]=n,e[H]&&e[H][t]&&o===void 0&&e[H][t].$());let i=De(e,ne),a;if((a=pe(i,t,o))&&a.$(()=>n),Array.isArray(e)&&e.length!==s){for(let c=e.length;c<s;c++)(a=i[c])&&a.$();(a=pe(i,"length",s))&&a.$(e.length)}(a=i[Qn])&&a.$()}function nr(e,t){const n=Object.keys(t);for(let r=0;r<n.length;r+=1){const o=n[r];F(e,o,t[o])}}function Do(e,t){if(typeof t=="function"&&(t=t(e)),t=oe(t),Array.isArray(t)){if(e===t)return;let n=0,r=t.length;for(;n<r;n++){const o=t[n];e[n]!==o&&F(e,n,o)}F(e,"length",r)}else nr(e,t)}function Ve(e,t,n=[]){let r,o=e;if(t.length>1){r=t.shift();const i=typeof r,a=Array.isArray(e);if(Array.isArray(r)){for(let c=0;c<r.length;c++)Ve(e,[r[c]].concat(t),n);return}else if(a&&i==="function"){for(let c=0;c<e.length;c++)r(e[c],c)&&Ve(e,[c].concat(t),n);return}else if(a&&i==="object"){const{from:c=0,to:l=e.length-1,by:u=1}=r;for(let d=c;d<=l;d+=u)Ve(e,[d].concat(t),n);return}else if(t.length>1){Ve(e[r],t,[r].concat(n));return}o=e[r],n=[r].concat(n)}let s=t[0];typeof s=="function"&&(s=s(o,n),s===o)||r===void 0&&s==null||(s=oe(s),r===void 0||Z(o)&&Z(s)&&!Array.isArray(s)?nr(o,s):F(e,r,s))}function Uc(...[e,t]){const n=oe(e||{}),r=Array.isArray(n),o=er(n);function s(...i){Ae(()=>{r&&i.length===1?Do(n,i[0]):Ve(n,i)})}return[o,s]}function Fo(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||n.set||!n.configurable||t===U||t===ne||(delete n.value,delete n.writable,n.get=()=>e[U][t],n.set=r=>e[U][t]=r),n}const Ro={get(e,t,n){if(t===Le)return e;if(t===U)return n;if(t===ht)return an(e),n;const r=De(e,ne),o=r[t];let s=o?o():e[t];if(t===ne||t===H||t==="__proto__")return s;if(!o){const i=Object.getOwnPropertyDescriptor(e,t),a=typeof s=="function";if(Je()&&(!a||e.hasOwnProperty(t))&&!(i&&i.get))s=pe(r,t,s)();else if(s!=null&&a&&s===Array.prototype[t])return(...c)=>Ae(()=>Array.prototype[t].apply(n,c))}return Z(s)?rr(s):s},has(e,t){return t===Le||t===U||t===ht||t===ne||t===H||t==="__proto__"?!0:(Je()&&pe(De(e,H),t)(),t in e)},set(e,t,n){return Ae(()=>F(e,t,oe(n))),!0},deleteProperty(e,t){return Ae(()=>F(e,t,void 0,!0)),!0},ownKeys:tr,getOwnPropertyDescriptor:Fo};function rr(e){let t=e[U];if(!t){Object.defineProperty(e,U,{value:t=new Proxy(e,Ro)});const n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e),o=Object.getPrototypeOf(e),s=o!==null&&e!==null&&typeof e=="object"&&!Array.isArray(e)&&o!==Object.prototype;if(s){let i=o;for(;i!=null;){const a=Object.getOwnPropertyDescriptors(i);n.push(...Object.keys(a)),Object.assign(r,a),i=Object.getPrototypeOf(i)}}for(let i=0,a=n.length;i<a;i++){const c=n[i];if(!(s&&c==="constructor")){if(r[c].get){const l=r[c].get.bind(t);Object.defineProperty(e,c,{get:l,configurable:!0})}if(r[c].set){const l=r[c].set;Object.defineProperty(e,c,{set:d=>Ae(()=>l.call(t,d)),configurable:!0})}}}}return t}function No(e,t){const n=oe(e||{});return rr(n)}const Kt=Symbol("store-root");function ke(e,t,n,r,o){const s=t[n];if(e===s)return;const i=Array.isArray(e);if(n!==Kt&&(!Z(e)||!Z(s)||i!==Array.isArray(s)||o&&e[o]!==s[o])){F(t,n,e);return}if(i){if(e.length&&s.length&&(!r||o&&e[0]&&e[0][o]!=null)){let l,u,d,g,m,p,C,b;for(d=0,g=Math.min(s.length,e.length);d<g&&(s[d]===e[d]||o&&s[d]&&e[d]&&s[d][o]&&s[d][o]===e[d][o]);d++)ke(e[d],s,d,r,o);const P=new Array(e.length),R=new Map;for(g=s.length-1,m=e.length-1;g>=d&&m>=d&&(s[g]===e[m]||o&&s[g]&&e[m]&&s[g][o]&&s[g][o]===e[m][o]);g--,m--)P[m]=s[g];if(d>m||d>g){for(u=d;u<=m;u++)F(s,u,e[u]);for(;u<e.length;u++)F(s,u,P[u]),ke(e[u],s,u,r,o);s.length>e.length&&F(s,"length",e.length);return}for(C=new Array(m+1),u=m;u>=d;u--)p=e[u],b=o&&p?p[o]:p,l=R.get(b),C[u]=l===void 0?-1:l,R.set(b,u);for(l=d;l<=g;l++)p=s[l],b=o&&p?p[o]:p,u=R.get(b),u!==void 0&&u!==-1&&(P[u]=s[l],u=C[u],R.set(b,u));for(u=d;u<e.length;u++)u in P?(F(s,u,P[u]),ke(e[u],s,u,r,o)):F(s,u,e[u])}else for(let l=0,u=e.length;l<u;l++)ke(e[l],s,l,r,o);s.length>e.length&&F(s,"length",e.length);return}const a=Object.keys(e);for(let l=0,u=a.length;l<u;l++)ke(e[a[l]],s,a[l],r,o);const c=Object.keys(s);for(let l=0,u=c.length;l<u;l++)e[c[l]]===void 0&&F(s,c[l],void 0)}function Bc(e,t={}){const{merge:n,key:r="id"}=t,o=oe(e);return s=>{if(!Z(s)||!Z(o))return o;const i=ke(o,{[Kt]:s},Kt,n,r);return i===void 0?s:i}}const pt=new WeakMap,or={get(e,t){if(t===Le)return e;const n=e[t];let r;return Z(n)?pt.get(n)||(pt.set(n,r=new Proxy(n,or)),r):n},set(e,t,n){return F(e,t,oe(n)),!0},deleteProperty(e,t){return F(e,t,void 0,!0),!0}};function _c(e){return t=>{if(Z(t)){let n;(n=pt.get(t))||pt.set(t,n=new Proxy(t,or)),e(n)}return t}}function cn(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function Uo(e){e=e.substr(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&n[0].length===1&&(n=n.map(r=>r+r)),n?`rgb${n.length===4?"a":""}(${n.map((r,o)=>o<3?parseInt(r,16):Math.round(parseInt(r,16)/255*1e3)/1e3).join(", ")})`:""}function ye(e){if(typeof e!="string")return e;if(e.charAt(0)==="#")return ye(Uo(e));const t=e.indexOf("("),n=e.substring(0,t);if(["rgb","rgba","hsl","hsla","color"].indexOf(n)===-1)throw new Error("MUI: Unsupported `%s` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color(). "+e);const r=e.substring(t+1,e.length-1);let o,s;if(n==="color"){if(o=r.split(" "),s=o.shift(),o.length===4&&o[3].charAt(0)==="/"&&(o[3]=o[3].substr(1)),["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(s)===-1)throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020. "+s)}else o=r.split(",");return{type:n,values:o.map(i=>parseFloat(i)),colorSpace:s}}function At(e){const{type:t,colorSpace:n}=e,{values:r}=e;let o;return t.indexOf("rgb")!==-1?o=r.map((s,i)=>i<3?parseInt(s.toString(),10):s).join(","):t.indexOf("hsl")!==-1&&(o=r.map((s,i)=>i===1||i===2?`${s}%`:s).join(",")),t.indexOf("color")!==-1?o=`${n} ${r.join(" ")}`:o=`${r.join(", ")}`,`${t}(${o})`}function Bo(e){const t=ye(e),{values:n}=t,r=n[0],o=n[1]/100,s=n[2]/100,i=o*Math.min(s,1-s),a=(u,d=(u+r/30)%12)=>s-i*Math.max(Math.min(d-3,9-d,1),-1);let c="rgb";const l=[Math.round(a(0)*255),Math.round(a(8)*255),Math.round(a(4)*255)];return t.type==="hsla"&&(c+="a",l.push(n[3])),At({type:c,values:l})}function xn(e){const{type:t,values:n}=ye(e);let r=t==="hsl"?ye(Bo(e)).values:n;return r=r.map(o=>(t!=="color"&&(o/=255),o<=.03928?o/12.92:((o+.055)/1.055)**2.4)),Number((.2126*r[0]+.7152*r[1]+.0722*r[2]).toFixed(3))}function _o(e,t){const n=xn(e),r=xn(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function jc(e,t){let{type:n,values:r}=ye(e);return t=cn(t),(n==="rgb"||n==="hsl")&&(n+="a"),n==="color"?r[3]=`/${t}`:r[3]=t,At({type:n,values:r})}function jo(e,t){const n=ye(e);if(t=cn(t),n.type.indexOf("hsl")!==-1)n.values[2]*=1-t;else if(n.type.indexOf("rgb")!==-1||n.type.indexOf("color")!==-1)for(let r=0;r<3;r+=1)n.values[r]*=1-t;return At(n)}function Vo(e,t){const n=ye(e);if(t=cn(t),n.type.indexOf("hsl")!==-1)n.values[2]+=(100-n.values[2])*t;else if(n.type.indexOf("rgb")!==-1)for(let r=0;r<3;r+=1)n.values[r]+=(255-n.values[r])*t;else if(n.type.indexOf("color")!==-1)for(let r=0;r<3;r+=1)n.values[r]+=(1-n.values[r])*t;return At(n)}const Wo={xs:0,sm:600,md:900,lg:1200,xl:1536};function zo(e,t,n){const r=e.theme||{};if(Array.isArray(t)){const s=r.breakpoints;return t.reduce((i,a,c)=>(i={...i,...s.up(s.keys[c],n(t[c]))},i),{})}if(typeof t=="object"){const s=r.breakpoints;return Object.keys(t).reduce((a,c)=>{if(Object.keys(s.values||Wo).indexOf(c)!==-1)a={...a,...s.up(c,n(t[c],c))};else{const l=c;a[l]=t[l]}return a},{})}return n(t)}const Ko={cleanupStyles:!0},Ho=Ne(Ko),be={black:"#000",white:"#fff"},Te={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},Me={50:"#f3e5f5",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",700:"#7b1fa2"},Ee={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},Pe={300:"#4fc3f7",400:"#29b6f6",700:"#0288d1",800:"#0277bd",900:"#01579b"},Ie={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"},Ke={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},Go={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"};function We(e){return e!==null&&typeof e=="object"&&e.constructor===Object}function Jo(e,t){for(const n of t){const r=e[n];delete e[n],e[n]=r}}function ln(e,t,n={clone:!0}){const r=n.clone?{...e}:e,o=n.sortKeys?[]:void 0;return We(e)&&We(t)&&(Object.keys(t).forEach(s=>{if(s==="__proto__")return;o&&o.push(s);let i,a;We(i=t[s])&&s in e&&We(a=e[s])?r[s]=ln(a,i,n):i!==void 0&&(r[s]=i)}),o&&Jo(r,o)),r}function Ht(e){if(Array.isArray(e)){const t=[];for(const n of e)t.push(Ht(n));return t}else if(We(e)){const t={};for(const n in e)n!=="__proto__"&&(t[n]=Ht(e[n]));return t}else return e}function Ze(e,...t){for(const n of t)ln(e,Ht(n),{clone:!1});return e}const qo=()=>({text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:be.white,default:be.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}}),Xo={primary:{main:Ee[700],light:Ee[400],dark:Ee[800]},secondary:{main:Me[500],light:Me[300],dark:Me[700]},error:{main:Te[700],light:Te[400],dark:Te[800]},info:{main:Pe[700],light:Pe[800],dark:Pe[900]},success:{main:Ie[800],light:Ie[500],dark:Ie[900]},warning:{main:"#ED6C02",light:Ke[500],dark:Ke[900]}},Yo=()=>({text:{primary:be.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:be.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}}),Zo={primary:{main:Ee[200],light:Ee[50],dark:Ee[400]},secondary:{main:Me[200],light:Me[50],dark:Me[400]},error:{main:Te[500],light:Te[300],dark:Te[700]},info:{main:Pe[400],light:Pe[300],dark:Pe[700]},success:{main:Ie[400],light:Ie[300],dark:Ie[700]},warning:{main:Ke[400],light:Ke[300],dark:Ke[700]}},Qo={light:qo,dark:Yo};function sr(e,t){return _o(e,be.white)>=t?be.white:"rgba(0, 0, 0, 0.87)"}function On(e,t,n,r){const o=typeof r=="number"?r:r.light,s=typeof r=="number"?r*1.5:r.dark;e[t]||(e.hasOwnProperty(n)?e[t]=e[n]:t==="light"?e.light=Vo(e.main,o):t==="dark"&&(e.dark=jo(e.main,s)))}function es(e){const t={...e.color},n=e.mainShade??500;return!e.color.main&&e.color[n]&&(t.main=e.color[n]),On(t,"light",e.lightShade??300,e.tonalOffset),On(t,"dark",e.darkShade??700,e.tonalOffset),t.contrastText||(t.contrastText=sr(t.main,e.contrastThreshold)),t}const ts=()=>({mode:"light",tonalOffset:.2,contrastThreshold:3,grey:Go,common:be});function ns(e){const t=["error","info","primary","secondary","success","warning"],n=ts(),r={...Ze({},n,Qo[(e==null?void 0:e.mode)??n.mode](),e),isColorName(s){return t.includes(s)},getColorObject(s){return r[s]},getColor(s){return r.mode==="light"?r[s].light:r[s].dark},augmentColor(s){return es({...s,tonalOffset:r.tonalOffset,contrastThreshold:r.contrastThreshold})},getContrastText(s){return sr(s,r.contrastThreshold)}},o=s=>r.mode==="light"?Xo[s]:Zo[s];return r.primary=r.augmentColor({color:r.primary||o("primary")}),r.secondary=r.augmentColor({color:r.secondary||o("secondary"),mainShade:"A400",lightShade:"A200",darkShade:"A700"}),r.error=r.augmentColor({color:r.error||o("error")}),r.warning=r.augmentColor({color:r.warning||o("warning")}),r.info=r.augmentColor({color:r.info||o("info")}),r.success=r.augmentColor({color:r.success||o("success")}),r}const rs={};function os(e){return{...Ze({},rs,e??{})}}function ss(e,t=void 0,n={}){return{toolbar:{minHeight:56,[`${e.up("xs")} and (orientation: landscape)`]:{minHeight:48},[e.up("sm")]:{minHeight:64}},...n}}const Ft={},is=.2,as=.14,cs=.12;function k(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,${is})`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,${as})`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,${cs})`].join(",")}const ls=[()=>"none",()=>k(0,2,1,-1,0,1,1,0,0,1,3,0),()=>k(0,3,1,-2,0,2,2,0,0,1,5,0),()=>k(0,3,3,-2,0,3,4,0,0,1,8,0),()=>k(0,2,4,-1,0,4,5,0,0,1,10,0),()=>k(0,3,5,-1,0,5,8,0,0,1,14,0),()=>k(0,3,5,-1,0,6,10,0,0,1,18,0),()=>k(0,4,5,-2,0,7,10,1,0,2,16,1),()=>k(0,5,5,-3,0,8,10,1,0,3,14,2),()=>k(0,5,6,-3,0,9,12,1,0,3,16,2),()=>k(0,6,6,-3,0,10,14,1,0,4,18,3),()=>k(0,6,7,-4,0,11,15,1,0,4,20,3),()=>k(0,7,8,-4,0,12,17,2,0,5,22,4),()=>k(0,7,8,-4,0,13,19,2,0,5,24,4),()=>k(0,7,9,-4,0,14,21,2,0,5,26,4),()=>k(0,8,9,-5,0,15,22,2,0,6,28,5),()=>k(0,8,10,-5,0,16,24,2,0,6,30,5),()=>k(0,8,11,-5,0,17,26,2,0,6,32,5),()=>k(0,9,11,-5,0,18,28,2,0,7,34,6),()=>k(0,9,12,-6,0,19,29,2,0,7,36,6),()=>k(0,10,13,-6,0,20,31,3,0,8,38,7),()=>k(0,10,13,-6,0,21,33,3,0,8,40,7),()=>k(0,10,14,-6,0,22,35,3,0,8,42,7),()=>k(0,11,14,-7,0,23,36,3,0,9,44,8),()=>k(0,11,15,-7,0,24,38,3,0,9,46,8)];function us(){return new Proxy([],{get:(e,t)=>typeof t!="string"||isNaN(Number(t))?e[t]:t in Ft?Ft[t]:Ft[t]=ls[t]()})}const ds={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},fs={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function vn(e){return`${Math.round(e)}ms`}function gs(e){if(!e)return 0;const t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function hs(e){const t={...ds,...e.easing},n={...fs,...e.duration};return{getAutoHeightDuration:gs,create:(o=["all"],s={})=>{const{duration:i=n.standard,easing:a=t.easeInOut,delay:c=0,...l}=s;return(Array.isArray(o)?o:[o]).map(u=>`${u} ${typeof i=="string"?i:vn(i)} ${a} ${typeof c=="string"?c:vn(c)}`).join(",")},...e,easing:t,duration:n}}const j={light:300,regular:400,medium:500},st={fontFamily:'"Roboto", "Helvetica", "Arial", sans-serif',fontSize:14,htmlFontSize:16,h1:{},h2:{},h3:{},h4:{},h5:{},h6:{},subtitle1:{},subtitle2:{},body1:{},body2:{},button:{},caption:{},overline:{},fontWeightLight:300,fontWeightRegular:400,fontWeightMedium:500,fontWeightBold:700};function ms(e){return Math.round(e*1e5)/1e5}function V(e,t,n,r,o,s){return{fontFamily:e.fontFamily,fontWeight:t,fontSize:e.pxToRem(n),lineHeight:`${r}`,letterSpacing:`${ms(o/n)}em`,...s?{textTransform:"uppercase"}:{}}}function ps(e={}){const t={fontFamily:e.fontFamily??st.fontFamily,fontSize:e.fontSize??st.fontSize,htmlFontSize:(e==null?void 0:e.htmlFontSize)??st.htmlFontSize,pxToRem:n=>{const r=t.fontSize/14;return`${n/t.htmlFontSize*r}rem`}};return Ze(st,t,{h1:V(t,j.light,96,1.167,-1.5),h2:V(t,j.light,60,1.2,-.5),h3:V(t,j.regular,48,1.167,0),h4:V(t,j.regular,34,1.235,.25),h5:V(t,j.regular,24,1.334,0),h6:V(t,j.medium,20,1.6,.15),subtitle1:V(t,j.regular,16,1.75,.15),subtitle2:V(t,j.medium,14,1.57,.1),body1:V(t,j.regular,16,1.5,.15),body2:V(t,j.regular,14,1.43,.15),button:V(t,j.medium,14,1.75,.4,!0),caption:V(t,j.regular,12,1.66,.4),overline:V(t,j.regular,12,2.66,1,!0)},e)}const ys={mobileStepper:1e3,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function bs(e){return{...Ze({},ys,e)}}function Rt(e,t,n="px"){let r;if(e==="up")r=`(min-width:${t}${n})`;else if(e==="down")r=`(max-width:${t}${n})`;else if(e==="between"){const[o,s]=t;r=`(max-width:${o}${n}) and (min-width:${s}${n})`}else throw new Error(`Invalid comparator: ${e}`);return`@media ${r}`}const ws={columns:12,keys:["xs","sm","md","lg","xl"],values:{xs:0,sm:600,md:900,lg:1200,xl:1536},unit:"px"};function ir(e){const t={...ws,...e??{},up:(n,r)=>{const o=Rt("up",t.resolve(n));return r?{[o]:r}:o},down:(n,r)=>{const o=Rt("down",t.resolve(n));return r?{[o]:r}:o},between:(n,r)=>{const o=Rt("between",[t.resolve(n[0]),t.resolve(n[1])]);return r?{[o]:r}:o},resolve:n=>typeof n=="number"?n:t.values[n]};return t}function ar(e){return typeof e=="function"?e:(...n)=>n.map(r=>typeof r=="number"?`${r*(e??8)}px`:r).join(" ")}const Cs={borderRadius:4};function cr(e){return{...Ze({},Cs,e)}}function lr(e={}){const t={direction:"ltr",...e};function n(r,o){const s=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,...typeof s=="function"?{get:s}:{value:o({[r]:s})}})}return n("breakpoints",r=>ir(r.breakpoints)),n("components",r=>os(r.components)),n("palette",r=>ns(r.palette)),n("shape",r=>cr(r.shape)),n("spacing",r=>ar(r.spacing)),n("typography",r=>ps(r.typography)),n("shadows",()=>us()),n("transitions",()=>hs({})),n("zIndex",r=>bs(r.zIndex)),n("mixins",()=>ss(t.breakpoints)),t}function ur(e){let t;return function(){return t||(t=e()),t}}const Ss=ur(lr);let dr;dr=Ne({});const Tt=dr;function xs(e){return{direction:"ltr",shadows:void 0,transitions:void 0,components:void 0,palette:void 0,typography:void 0,zIndex:void 0,mixins:void 0,...e,breakpoints:ir(e==null?void 0:e.breakpoints),shape:cr(e==null?void 0:e.shape),spacing:ar(e==null?void 0:e.spacing)}}const Os=ur(xs);function vs(e){for(const t in e)return!1;return!0}function un(e=Os,t=Tt){const n=Ye(t);if(typeof n=="function")return new Proxy({},{get:(r,o)=>n()[o]});if(vs(n)&&e)return typeof e=="function"?e():e;if(!n)throw new Error("Theme is not defined");return n}function fr(e=Ss){return un(e,Tt)}function ks(e){return un(e,Tt)}function $s(e){var s,i;const t=[],n=typeof e.propDefaults=="function"?e.propDefaults({set:a=>a,inProps:e.props}):e.propDefaults,o=(i=(s=ks().components)==null?void 0:s[e.name])==null?void 0:i.defaultProps;return n&&t.push(n),o&&t.push(o),t.length?Gn(...t,e.props):e.props}function As(e){return ue(Tt.Provider,{get value(){return e.theme},get children(){return e.children}})}function Ts(e,t=!1){return t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}function Ms(e,t){switch(typeof e){case"function":return Object.assign(e,{[oo]:!0}),Ge(()=>e(t));case"string":const n=Jn.has(e),r=I.context?Yn():Ts(e,n);return Xn(r,t,n),r}}function gr(e,t){const n=L(e);return L(()=>Ms(n(),t))}function Vc(e){const[t,n]=kt(e,["$component"]);return gr(()=>t.$component,n)}function Es(e){const t=e.reduce((n,r)=>("name"in r&&(n[`--${r.name}`]="0"),ln(n,r,{clone:!1,sortKeys:!0}),n),{});return delete t.name,t}function hr(e){return e.startsWith("--")}function Ps(e){return e.startsWith("__")}function mr(e){return/[^a-z-]/i.test(e)&&!hr(e)}function pr(e){return e.startsWith("@global")}function Gt(e){return e.startsWith("@media")}function yr(e){return e.startsWith("@keyframes")}function kn(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function $n(e,t,n=[],r={}){const o=e.split(",").map(s=>(s=s.trim(),s.includes("&")?s:`& ${s}`));return yt(t,(n.length?n:[""]).flatMap(s=>o.map(i=>i.replace(/&/g,s).trim())),{...r})}function An(e,t){if(!t)return kn(e);let n=t.get(e);return n||(t.set(e,n=kn(e)),n)}function yt(e,t=[],n={}){const r=[],o=[];for(let i in e){const a=e[i];if(!Ps(i))if(pr(i))for(const c in a)o.push(...$n(c,a[c],[],n));else if(Gt(i))o.push(...yt(a,t,{...n,sublevel:!0}).map(c=>`${i} {
2
+ ${c}
3
+ }`));else if(hr(i))a!=null&&r.push(`${i}: ${a};`);else if(yr(i)){const c=[];for(const l in a)c.push(...yt(a[l],[/^\d+$/.test(l)?`${l}%`:l],{...n,sublevel:!0}));o.push(`${i} {
4
+ ${c.join(`
5
+ `)}
6
+ }`)}else if(mr(i))o.push(...$n(i,a,t,n));else if(n.extraProperties&&i in n.extraProperties){const c=n.extraProperties[i](a);for(const l in c){const u=c[l],d=n.onPropertyValue?n.onPropertyValue(l,u):u;d!=null&&r.push(`${An(l,n.propertyNameCache)}: ${d};`)}}else{i=An(i,n.propertyNameCache);const c=n.onPropertyValue?n.onPropertyValue(i,a):a;c!=null&&r.push(`${i}: ${c};`)}}const s=i=>{const a=" ".repeat(i);return`${a}${r.join(`
7
+ ${a}`)}`};if(t.length){const i=n.sublevel?" ":"",a=i+t.join(`,
8
+ ${i}`);return[...r.length?[`${a} {
9
+ ${s(n.sublevel?2:1)}
10
+ ${i}}`]:[],...o]}else return[...r.length?[s(0)]:[],...o]}function Is(e){return e?Array.isArray(e)?e:[e]:[]}function Ls(e){return typeof e=="function"&&(e=e()),e}class Ds{constructor(){ot(this,"ids",new Map);ot(this,"rules",new Map);ot(this,"propertyNames",new Map)}create(t,n,r){let o=this.rules.get(n);if(o)return o;let s=this.ids.get(r);return typeof s=="number"&&(this.ids.set(r,++s),r+=`_${s}`),o=br(t,n,r),this.save(o,n),o}save(t,n){this.ids.set(t.id,0),this.rules.set(n,t)}delete(t){this.ids.delete(t.id),this.rules.delete(t.rules)}}function br(e,t,n){return{id:n,name:e,className:`${e}-${n}`,rules:t.replaceAll("$id",`${n}`)}}function Fs(e){var s,i;const t=`${e.name}-$id`,n=Is(Ls(e.props)),r=(s=e.cache)==null?void 0:s.propertyNames,o=n.map(a=>typeof a=="string"?`.${t} {
11
+ ${a}
12
+ }`:yt(a,[`.${t}`],{extraProperties:e.extraProperties,propertyNameCache:r}).join(`
13
+ `)).join(`
14
+ `);return((i=e.cache)==null?void 0:i.create(e.name,o,e.componentId))||br(e.name,o,e.componentId)}function wr(e,t){"styleSheet"in e?e.styleSheet.cssText=t:(e.innerText="",e.appendChild(document.createTextNode(t)))}function Rs(e,t){for(const n in t){const r=t[n];r!==void 0&&(r===null?e.removeAttribute(n):e.setAttribute(n,r))}}function Ns(e,t){const n=document.createElement("style");return n.type="text/css",t&&Rs(n,t),wr(n,e),n}function Jt(e){let t=Number(e.getAttribute("data-uses"));t++,e.setAttribute("data-uses",t.toString())}const Tn="suid-injectFirst";function Us(e,t,n){Array.isArray(e)&&(e=e.join(`
15
+ `));const r=t==null?void 0:t.id,o=document.head||document.getElementsByTagName("head")[0],s=r&&document.getElementById(r);if(s&&s instanceof HTMLStyleElement)return wr(s,e),Jt(s),s;{s&&s.remove();const i=Ns(e,t);if(Jt(i),n){let a=o.querySelector(`#${Tn}`);a||(a=document.createElement("style"),a.setAttribute("id",Tn),o.prepend(a)),o.insertBefore(i,a)}else o.appendChild(i);return i}}function Bs(e,t="css-"){if(typeof e=="string")return document.getElementById(e);const n=[...e.classList].find(r=>r.startsWith(t));if(n)return document.getElementById(n.slice(t.length))}function Mn(e,t=!0){let n=Number(e.getAttribute("data-uses"));n--,n<=0?t?e.remove():e.setAttribute("data-uses","0"):e.setAttribute("data-uses",n.toString())}function Wc(e){if(typeof e!="string")throw new Error("MUI: `capitalize(string)` expects a string argument.");return e.charAt(0).toUpperCase()+e.slice(1)}function zc(e,t=166){let n;function r(...o){const s=()=>{e.apply(null,o)};clearTimeout(n),n=setTimeout(s,t)}return r.clear=()=>{clearTimeout(n)},r}function Kc(e){const t=e.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}function _s(e){return e&&e.ownerDocument||document}function Hc(e){return _s(e).defaultView||window}function Cr(){return Math.random().toString(36).substring(2,15).slice(0,8)}let Mt=!0,qt=!1,En;const js={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function Vs(e){const{type:t,tagName:n}=e;return!!(n==="INPUT"&&js[t]&&!e.readOnly||n==="TEXTAREA"&&!e.readOnly||e.isContentEditable)}function Ws(e){e.metaKey||e.altKey||e.ctrlKey||(Mt=!0)}function Nt(){Mt=!1}function zs(){this.visibilityState==="hidden"&&qt&&(Mt=!0)}function Ks(e){e.addEventListener("keydown",Ws,!0),e.addEventListener("mousedown",Nt,!0),e.addEventListener("pointerdown",Nt,!0),e.addEventListener("touchstart",Nt,!0),e.addEventListener("visibilitychange",zs,!0)}function Hs(e){const{target:t}=e;try{return t.matches(":focus-visible")}catch{}return Mt||Vs(t)}function Gc(){const e=s=>{s!=null&&Ks(s.ownerDocument)},[t,n]=M(!1);function r(){return t()?(qt=!0,window.clearTimeout(En),En=window.setTimeout(()=>{qt=!1},100),n(!1),!0):!1}function o(s){return Hs(s)?(n(!0),!0):!1}return{isFocusVisibleRef:{get current(){return t()}},onFocus:o,onBlur:r,ref:e}}const Gs=new Ds;function Js(e){return e?Array.isArray(e)?e.flat(1/0).filter(t=>!!t):[e]:[]}function qs(){if(!I.context)return Cr();const e=so().replaceAll("-",""),t=9,n=Math.ceil(e.length/t),r=[];for(let o=1;o<=n;++o){const s=(o-1)*t,i=Number(e.slice(s,s+t));r.push(i.toString(32))}return r.join("-")}function Sr(e){const t=Ye(Ho),[n,r]=M(""),o=qs();let s,i=!1;return ce(a=>{var u;const c=e();let l;if(c){const d=Es(Js(c));i="@global"in d,l=Fs({name:"css",props:d,cache:Gs,componentId:o}),s=Bs(l.id),s?Jt(s):s=Us(l.rules,{id:l.id,nonce:(u=t.cache)==null?void 0:u.nonce},t.injectFirst),a!=null&&a.styleElement&&Mn(a.styleElement)}return typeof(l==null?void 0:l.className)=="string"?r(l.className):r(""),{className:l==null?void 0:l.className,styleElement:s}},void 0),le(()=>{s&&Mn(s,t.cleanupStyles??i)}),n}function $e(e,t,n={}){for(const r in e){const o=e[r];if(pr(r))n[r]=$e(o,t);else if(Gt(r))n[r]=$e(o,t);else if(yr(r)){n[r]={};for(const s in o)n[r][s]=$e(o[s],t)}else if(mr(r))n[r]=$e(o,t);else{const s=t(r,o);if(s)for(const i in s)n[i]=Gt(i)?{...n[i],...s[i]}:s[i];else n[r]=o}}return n}const Xs=new Set(["animationIterationCount","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","msGridRow","msGridRowSpan","msGridColumn","msGridColumnSpan","fontWeight","lineHeight","opacity","order","orphans","tabSize","widows","zIndex","zoom","WebkitLineClamp","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]);function xr(e,t){if(typeof t=="number")return{[e]:Xs.has(e)?t.toString():`${t}px`}}function Pn(e,t={}){return $e(e,xr,t)}function bt(e,t,n){if(typeof n!="string")return n;const r=n.split(".");let o=e[t];for(let s=0;s<r.length&&(o=o==null?void 0:o[r[s]],!!o);s++);return o??n}function Ys(e,t){return t.split(".").reduce((n,r)=>n&&n[r]?n[r]:null,e)}function Zs(e,t,n,r){const o=Ys(e,t)||n;return typeof o=="number"?s=>typeof s=="string"?s:o*s:Array.isArray(o)?s=>typeof s=="string"?s:o[s]:typeof o=="function"?o:()=>{}}const ie={x:["Left","Right"],y:["Top","Bottom"]};function Or(e){return typeof e=="number"?`${e}px`:e}function vr(e,t){return(n,r)=>t(e,n,r)}function f(e,t){return t?(n,r)=>({[e]:t(e,n,r)}):n=>({[e]:n})}function ze(e){return f(e,(t,n)=>Or(n))}function z(e,t,n){const r=t.map(o=>`${e}${o}`);return n?(o,s)=>r.reduce((i,a)=>(i[a]=n(a,o,s),i),{}):o=>r.reduce((s,i)=>(s[i]=o,s),{})}function Qs(){return{...ei(),...ti(),...ni(),...ri(),...oi(),...si(),...ii(),...ci(),...ai()}}function ei(){return{displayPrint:vr("displayPrint",(e,t)=>({"@media print":{display:t}})),displayRaw:f("display"),overflow:f("overflow"),textOverflow:f("textOverflow"),visibility:f("visibility"),whiteSpace:f("whiteSpace")}}function ti(){return{flexBasis:f("flexBasis"),flexDirection:f("flexDirection"),flexWrap:f("flexWrap"),justifyContent:f("justifyContent"),alignItems:f("alignItems"),alignContent:f("alignContent"),order:f("order"),flex:f("flex"),flexGrow:f("flexGrow"),flexShrink:f("flexShrink"),alignSelf:f("alignSelf"),justifyItems:f("justifyItems"),justifySelf:f("justifySelf")}}function ni(){const e=(t,n,r)=>Zs(r,"spacing",8)(n);return{gap:f("gap",e),columnGap:f("columnGap",e),rowGap:f("rowGap",e),gridColumn:f("gridColumn"),gridRow:f("gridRow"),gridAutoFlow:f("gridAutoFlow"),gridAutoColumns:f("gridAutoColumns"),gridAutoRows:f("gridAutoRows"),gridTemplateColumns:f("gridTemplateColumns"),gridTemplateRows:f("gridTemplateRows"),gridTemplateAreas:f("gridTemplateAreas"),gridArea:f("gridArea")}}function ri(){return{position:f("position"),zIndex:f("zIndex",(e,t,n)=>{var r;return((r=n.zIndex)==null?void 0:r[e])??t}),top:ze("top"),right:ze("right"),bottom:ze("bottom"),left:ze("left")}}function oi(){const e=(t,n,r)=>bt(r,"palette",n);return{color:f("color",e),bgcolor:f("backgroundColor",e),backgroundColor:f("backgroundColor",e)}}function si(){const e=(t,n,r)=>(t==="maxWidth"&&(n=r.breakpoints.values[t]??n),typeof n=="number"&&(n=n>0&&n<=1?`${n*100}%`:`${n}px`),n);return{width:f("width",e),maxWidth:f("maxWidth",e),minWidth:f("minWidth",e),height:f("height",e),maxHeight:f("maxHeight",e),minHeight:f("minHeight",e),boxSizing:f("boxSizing",e)}}function ii(){const e=(n,r)=>typeof r=="number"?`${r}px solid`:r,t=(n,r,o)=>bt(o,"palette",r);return{border:f("border",e),borderTop:f("borderTop",e),borderRight:f("borderRight",e),borderBottom:f("borderBottom",e),borderLeft:f("borderLeft",e),borderColor:f("borderColor",t),borderTopColor:f("borderTopColor",t),borderRightColor:f("borderRightColor",t),borderBottomColor:f("borderBottomColor",t),borderLeftColor:f("borderLeftColor",t),borderRadius:f("borderRadius",(n,r,o)=>typeof r=="number"?`${o.shape.borderRadius*r}px`:r)}}function ai(){const e=(t,n,r)=>bt(r,"typography",n);return{typography:vr("typography",(t,n,r)=>bt(r,"typography",n)),fontFamily:f("fontFamily",e),fontSize:f("fontSize",(t,n,r)=>Or(e(t,n,r))),fontStyle:f("fontStyle",e),fontWeight:f("fontWeight",e),letterSpacing:ze("letterSpacing"),lineHeight:f("lineHeight"),textAlign:f("textAlign"),textTransform:f("textTransform")}}function ci(){const e=(r,o,s)=>s.spacing(o),t="margin",n="padding";return{m:f(t,e),mt:f("marginTop",e),mr:f("marginRight",e),mb:f("marginBottom",e),ml:f("marginLeft",e),mx:z(t,ie.x,e),my:z(t,ie.y,e),margin:f(t,e),marginTop:f("marginTop",e),marginRight:f("marginRight",e),marginBottom:f("marginBottom",e),marginLeft:f("marginLeft",e),marginX:z(t,ie.x,e),marginY:z(t,ie.y,e),marginInline:z(t,["Inline","InlineStart"],e),marginInlineStart:f("marginInlineStart",e),marginInlineEnd:f("marginInlineEnd",e),marginBlock:z(t,["BlockStart","BlockEnd"],e),marginBlockStart:f("marginBlockStart",e),marginBlockEnd:f("marginBlockEnd",e),p:f(n,e),pt:f("paddingTop",e),pr:f("paddingRight",e),pb:f("paddingBottom",e),pl:f("paddingLeft",e),px:z(n,ie.x,e),py:z(n,ie.y,e),padding:f(n,e),paddingTop:f("paddingTop",e),paddingRight:f("paddingRight",e),paddingBottom:f("paddingBottom",e),paddingLeft:f("paddingLeft",e),paddingX:z(n,ie.x,e),paddingY:z(n,ie.y,e),paddingInline:z(n,["Inline","InlineStart"],e),paddingInlineStart:f("paddingInlineStart",e),paddingInlineEnd:f("paddingInlineEnd",e),paddingBlock:z(n,["BlockStart","BlockEnd"],e),paddingBlockStart:f("paddingBlockStart",e),paddingBlockEnd:f("paddingBlockEnd",e)}}const dn=Qs(),Jc=Object.keys(dn);function li(e,t,n){return dn[e](t,n)}function In(e,t,n){return e in dn?li(e,t,n):xr(e,t)}function ui(e,t){return $e(e,(n,r)=>{if(typeof r=="function"&&(r=r(t)),r==null)return r;if(typeof r=="object"){const o={};for(const s of t.breakpoints.keys)o[t.breakpoints.up(s)]={};return Object.assign(o,zo({theme:t},r,s=>In(n,s,t)??{[n]:s}))}else return In(n,r,t)})}function kr(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=kr(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function di(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=kr(e))&&(r&&(r+=" "),r+=t);return r}const $r=["ownerState","theme","sx","as"];function fi(e,t){var n,r;return(r=(n=t.components)==null?void 0:n[e])==null?void 0:r.styleOverrides}function gi(e,t,n,r,o={}){return L(()=>{const s=e(),i=fi(o.name,s),a=r.ownerState,c=n.reduce((u,d)=>{let g;return typeof d=="function"?g=d({ownerState:a,theme:s,get sx(){return r.sx},get as(){return r.as},props:r}):d&&(g=d),g&&u.push(Pn(g,{name:t,__resolved:!0})),u},[]);let l=[];return o.overridesResolver&&typeof o.overridesResolver=="function"&&i&&(l=o.overridesResolver(r,i).map(u=>u?Pn(u,{}):null).filter(Boolean)),c.concat(l)})}function Ar(e,t){e.__suid=t}function Ln(e){if(typeof e=="function")return e.__suid}function hi(e){return function(n,r={}){let o,s;if(r.name){const a=r.slot||"Root";s=o=`${r.name}-${a.slice(0,1).toLowerCase()+a.slice(1)}`}else s=`styled-${Cr()}`,o="css";const i=Ln(n);return function(...a){function c(l){let u;const d=()=>{const D=l.theme;return D||u||(u=e&&e.onUseTheme?e.onUseTheme():un())},[,g]=kt(l,r.skipProps||$r),m=gi(d,o,a,l,r),p=()=>{const D=l.sx;return D?Array.isArray(D)?D:[D]:[]},C=()=>{if(i)return n;const D=l.as;return D||n},b=i?()=>i:L(()=>Ln(C())),P=r.skipSx?()=>m():()=>{const D=d();return[...m(),...p().map(J=>J.__resolved?J:ui(J,D))]},R=Sr(()=>b()?void 0:P());return gr(C,Gn(g,{get children(){return l.children},get component(){return b()?l.component:null},get as(){return i?l.as:void 0},get sx(){return b()?P():void 0},get ownerState(){return b()==="system"?l.ownerState:void 0},get class(){return di([...new Set([l.class,s,R()])])}}))}return Ar(c,"system"),s&&(c.toString=()=>`.${s}`),c}}}const qc=[...$r,"classes"],Xc=hi({onUseTheme:()=>fr()}),mi="codenomad.client-id",pi="codenomad.connection-id";let it=null,at=null;function Xt(){return{clientId:yi(),connectionId:bi()}}function yi(){return it||(it=Tr(mi,window.localStorage),it)}function bi(){return at||(at=Tr(pi,window.sessionStorage),at)}function Tr(e,t){if(typeof window>"u")return Ut();try{const r=t.getItem(e);if(r&&r.trim())return r.trim()}catch{return Ut()}const n=Ut();try{t.setItem(e,n)}catch{}return n}function Ut(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var Yt={exports:{}},Bt,Dn;function wi(){if(Dn)return Bt;Dn=1;var e=1e3,t=e*60,n=t*60,r=n*24,o=r*7,s=r*365.25;Bt=function(u,d){d=d||{};var g=typeof u;if(g==="string"&&u.length>0)return i(u);if(g==="number"&&isFinite(u))return d.long?c(u):a(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function i(u){if(u=String(u),!(u.length>100)){var d=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(d){var g=parseFloat(d[1]),m=(d[2]||"ms").toLowerCase();switch(m){case"years":case"year":case"yrs":case"yr":case"y":return g*s;case"weeks":case"week":case"w":return g*o;case"days":case"day":case"d":return g*r;case"hours":case"hour":case"hrs":case"hr":case"h":return g*n;case"minutes":case"minute":case"mins":case"min":case"m":return g*t;case"seconds":case"second":case"secs":case"sec":case"s":return g*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return g;default:return}}}}function a(u){var d=Math.abs(u);return d>=r?Math.round(u/r)+"d":d>=n?Math.round(u/n)+"h":d>=t?Math.round(u/t)+"m":d>=e?Math.round(u/e)+"s":u+"ms"}function c(u){var d=Math.abs(u);return d>=r?l(u,d,r,"day"):d>=n?l(u,d,n,"hour"):d>=t?l(u,d,t,"minute"):d>=e?l(u,d,e,"second"):u+" ms"}function l(u,d,g,m){var p=d>=g*1.5;return Math.round(u/g)+" "+m+(p?"s":"")}return Bt}function Ci(e){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=a,n.humanize=wi(),n.destroy=l,Object.keys(e).forEach(u=>{n[u]=e[u]}),n.names=[],n.skips=[],n.formatters={};function t(u){let d=0;for(let g=0;g<u.length;g++)d=(d<<5)-d+u.charCodeAt(g),d|=0;return n.colors[Math.abs(d)%n.colors.length]}n.selectColor=t;function n(u){let d,g=null,m,p;function C(...b){if(!C.enabled)return;const P=C,R=Number(new Date),D=R-(d||R);P.diff=D,P.prev=d,P.curr=R,d=R,b[0]=n.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let J=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(_,h)=>{if(_==="%%")return"%";J++;const w=n.formatters[h];if(typeof w=="function"){const v=b[J];_=w.call(P,v),b.splice(J,1),J--}return _}),n.formatArgs.call(P,b),(P.log||n.log).apply(P,b)}return C.namespace=u,C.useColors=n.useColors(),C.color=n.selectColor(u),C.extend=r,C.destroy=n.destroy,Object.defineProperty(C,"enabled",{enumerable:!0,configurable:!1,get:()=>g!==null?g:(m!==n.namespaces&&(m=n.namespaces,p=n.enabled(u)),p),set:b=>{g=b}}),typeof n.init=="function"&&n.init(C),C}function r(u,d){const g=n(this.namespace+(typeof d>"u"?":":d)+u);return g.log=this.log,g}function o(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];const d=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const g of d)g[0]==="-"?n.skips.push(g.slice(1)):n.names.push(g)}function s(u,d){let g=0,m=0,p=-1,C=0;for(;g<u.length;)if(m<d.length&&(d[m]===u[g]||d[m]==="*"))d[m]==="*"?(p=m,C=g,m++):(g++,m++);else if(p!==-1)m=p+1,C++,g=C;else return!1;for(;m<d.length&&d[m]==="*";)m++;return m===d.length}function i(){const u=[...n.names,...n.skips.map(d=>"-"+d)].join(",");return n.enable(""),u}function a(u){for(const d of n.skips)if(s(u,d))return!1;for(const d of n.names)if(s(u,d))return!0;return!1}function c(u){return u instanceof Error?u.stack||u.message:u}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}var Si=Ci;(function(e,t){var n={};t.formatArgs=o,t.save=s,t.load=i,t.useColors=r,t.storage=a(),t.destroy=(()=>{let l=!1;return()=>{l||(l=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let l;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(l=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(l[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;l.splice(1,0,u,"color: inherit");let d=0,g=0;l[0].replace(/%[a-zA-Z%]/g,m=>{m!=="%%"&&(d++,m==="%c"&&(g=d))}),l.splice(g,0,u)}t.log=console.debug||console.log||(()=>{});function s(l){try{l?t.storage.setItem("debug",l):t.storage.removeItem("debug")}catch{}}function i(){let l;try{l=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!l&&typeof process<"u"&&"env"in process&&(l=n.DEBUG),l}function a(){try{return localStorage}catch{}}e.exports=Si(t);const{formatters:c}=e.exports;c.j=function(l){try{return JSON.stringify(l)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(Yt,Yt.exports);var xi=Yt.exports;const Zt=co(xi),Ue=["sse","api","session","actions"],Mr="opencode:logger:namespaces",_t=new Map,Q=new Set,te=typeof globalThis<"u"?globalThis.console:void 0;function Qe(){Q.size===0?Zt.disable():Zt.enable(Array.from(Q).join(","))}function Et(){var e;if(!(typeof window>"u"||!(window!=null&&window.localStorage)))try{window.localStorage.setItem(Mr,JSON.stringify(Array.from(Q)))}catch(t){(e=te==null?void 0:te.warn)==null||e.call(te,"Failed to persist logger namespaces",t)}}function Oi(){var e;if(!(typeof window>"u"||!(window!=null&&window.localStorage)))try{const t=window.localStorage.getItem(Mr);if(!t)return;const n=JSON.parse(t);if(!Array.isArray(n))return;for(const r of n)Ue.includes(r)&&Q.add(r)}catch(t){(e=te==null?void 0:te.warn)==null||e.call(te,"Failed to hydrate logger namespaces",t)}}Oi();Qe();function vi(e){const n=Zt(e),r=(o,s)=>{n(o,...s)};return{log:(...o)=>n(...o),info:(...o)=>n(...o),warn:(...o)=>r("[warn]",o),error:(...o)=>r("[error]",o)}}function Ce(e){if(!Ue.includes(e))throw new Error(`Unknown logger namespace: ${e}`);return _t.has(e)||_t.set(e,vi(e)),_t.get(e)}function ki(){return Ue.map(e=>({name:e,enabled:Q.has(e)}))}function $i(e){if(!Ue.includes(e))throw new Error(`Unknown logger namespace: ${e}`);Q.has(e)||(Q.add(e),Et(),Qe())}function Ai(e){if(!Ue.includes(e))throw new Error(`Unknown logger namespace: ${e}`);Q.has(e)&&(Q.delete(e),Et(),Qe())}function Ti(){Q.clear(),Et(),Qe()}function Mi(){Ue.forEach(e=>Q.add(e)),Et(),Qe()}const Ei={listLoggerNamespaces:ki,enableLogger:$i,disableLogger:Ai,enableAllLoggers:Mi,disableAllLoggers:Ti};function Pi(){typeof window>"u"||(window.codenomadLogger=Ei)}Pi();function Ii(e,t){let n=!1;e.onmessage=o=>{try{const s=JSON.parse(o.data);t.onEvent(s)}catch(s){t.logger.error("Failed to parse event",s)}};const r=o=>{var s;n||(n=!0,t.logger.warn(o),(s=t.onError)==null||s.call(t))};e.onerror=()=>{r("EventSource error, closing stream")},e.onclose=()=>{r("EventSource closed")},e.addEventListener("close",()=>{r("EventSource closed")}),e.addEventListener("codenomad.client.ping",o=>{var s;try{const i=o.data?JSON.parse(o.data):{};(s=t.onPing)==null||s.call(t,i)}catch(i){t.logger.error("Failed to parse ping event",i)}})}var Kn;const Li=typeof window<"u"?(Kn=window.location)==null?void 0:Kn.origin:void 0,Di=typeof window<"u"?window.__CODENOMAD_API_BASE__??Li:void 0,Fi=typeof window<"u"?window.__CODENOMAD_EVENTS_URL__??"/api/events":"/api/events",de=Di,jt=Ri(de,Fi),Yc=de;function Zc(e,t){const n=encodeURIComponent(e),r=encodeURIComponent(t);return Ni(`/workspaces/${n}/plugin/background-processes/${r}/stream`)}function Ri(e,t){if(t.startsWith("http://")||t.startsWith("https://"))return t;if(e){const n=t.startsWith("/")?t:`/${t}`;return`${e}${n}`}return t}function Ni(e){if(e.startsWith("http://")||e.startsWith("https://")||!de)return e;const t=e.startsWith("/")?e:`/${e}`;return`${de}${t}`}const Fn=Ce("api"),Rn=Ce("sse");function Er(e){const t={};if(!e)return t;if(e instanceof Headers)return e.forEach((n,r)=>{t[r]=n}),t;if(Array.isArray(e)){for(const[n,r]of e)t[n]=r;return t}return{...e}}function me(e,t){if(t){Fn.info(e,t);return}Fn.info(e)}async function Pr(e){const t=await e.text();if(!t)return`Request failed with ${e.status}`;try{const n=JSON.parse(t);if(typeof(n==null?void 0:n.error)=="string"&&n.error.trim())return n.error;if(typeof(n==null?void 0:n.message)=="string"&&n.message.trim())return n.message}catch{}return t}async function y(e,t){const n=de?new URL(e,de).toString():e,r=Er(t==null?void 0:t.headers);(t==null?void 0:t.body)!==void 0&&(r["Content-Type"]="application/json");const o=((t==null?void 0:t.method)??"GET").toUpperCase(),s=Date.now();me(`${o} ${e}`);try{const i=await fetch(n,{...t,headers:r,credentials:(t==null?void 0:t.credentials)??"include"});if(!i.ok){const c=await Pr(i);throw me(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s,error:c}),new Error(c||`Request failed with ${i.status}`)}const a=Date.now()-s;return me(`${o} ${e} -> ${i.status}`,{durationMs:a}),i.status===204?void 0:await i.json()}catch(i){throw me(`${o} ${e} failed`,{durationMs:Date.now()-s,error:i}),i}}async function Ui(e,t){const n=de?new URL(e,de).toString():e,r=Er(t==null?void 0:t.headers);(t==null?void 0:t.body)!==void 0&&!r["Content-Type"]&&(r["Content-Type"]="application/json");const o=((t==null?void 0:t.method)??"GET").toUpperCase(),s=Date.now();me(`${o} ${e}`);const i=await fetch(n,{...t,headers:r,credentials:(t==null?void 0:t.credentials)??"include"});if(!i.ok){const a=await Pr(i);throw me(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s,error:a}),new Error(a||`Request failed with ${i.status}`)}return me(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s}),i}const ee={fetchWorkspaces(){return y("/api/workspaces")},fetchWorktrees(e){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees`)},createWorktree(e,t){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees`,{method:"POST",body:JSON.stringify(t)})},deleteWorktree(e,t,n){const r=new URLSearchParams;n!=null&&n.force&&r.set("force","true");const o=r.toString()?`?${r.toString()}`:"";return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}${o}`,{method:"DELETE"})},readWorktreeMap(e){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/map`)},writeWorktreeMap(e,t){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/map`,{method:"PUT",body:JSON.stringify(t)})},createWorkspace(e){return y("/api/workspaces",{method:"POST",body:JSON.stringify(e)})},fetchSidecars(){return y("/api/sidecars")},createSidecar(e){return y("/api/sidecars",{method:"POST",body:JSON.stringify(e)})},updateSidecar(e,t){return y(`/api/sidecars/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})},deleteSidecar(e){return y(`/api/sidecars/${encodeURIComponent(e)}`,{method:"DELETE"})},createPreview(e){return y("/api/previews",{method:"POST",body:JSON.stringify(e)})},deletePreview(e){return y(`/api/previews/${encodeURIComponent(e)}`,{method:"DELETE"})},fetchServerMeta(){return y("/api/meta")},probeRemoteServer(e){return y("/api/remote-servers/probe",{method:"POST",body:JSON.stringify(e)})},createRemoteProxySession(e){return y("/api/remote-proxy/sessions",{method:"POST",body:JSON.stringify(e)})},deleteRemoteProxySession(e){return y(`/api/remote-proxy/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})},fetchAuthStatus(){return y("/api/auth/status")},setServerPassword(e){return y("/api/auth/password",{method:"POST",body:JSON.stringify({password:e})})},deleteWorkspace(e){return y(`/api/workspaces/${encodeURIComponent(e)}`,{method:"DELETE"})},cloneWorkspaceRepository(e){return y("/api/workspaces/clone",{method:"POST",body:JSON.stringify(e)})},listWorkspaceFiles(e,t="."){const n=new URLSearchParams({path:t});return y(`/api/workspaces/${encodeURIComponent(e)}/files?${n.toString()}`)},searchWorkspaceFiles(e,t,n){const r=t.trim();if(!r)return Promise.resolve([]);const o=new URLSearchParams({q:r});return n!=null&&n.limit&&o.set("limit",String(n.limit)),n!=null&&n.type&&o.set("type",n.type),y(`/api/workspaces/${encodeURIComponent(e)}/files/search?${o.toString()}`)},readWorkspaceFile(e,t,n){const r=new URLSearchParams({path:t});return n!=null&&n.encoding&&r.set("encoding",n.encoding),y(`/api/workspaces/${encodeURIComponent(e)}/files/content?${r.toString()}`)},writeWorkspaceFile(e,t,n){const r=new URLSearchParams({path:t});return y(`/api/workspaces/${encodeURIComponent(e)}/files/content?${r.toString()}`,{method:"PUT",body:JSON.stringify({contents:n})})},fetchWorktreeGitStatus(e,t){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-status`)},fetchWorktreeGitDiff(e,t,n){const r=new URLSearchParams({path:n.path,scope:n.scope});return n.originalPath&&r.set("originalPath",n.originalPath),y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-diff?${r.toString()}`)},stageWorktreeGitPaths(e,t,n){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-stage`,{method:"POST",body:JSON.stringify(n)})},unstageWorktreeGitPaths(e,t,n){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-unstage`,{method:"POST",body:JSON.stringify(n)})},commitWorktreeGitChanges(e,t,n){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-commit`,{method:"POST",body:JSON.stringify(n)})},fetchConfigOwner(e){return y(`/api/storage/config/${encodeURIComponent(e)}`)},patchConfigOwner(e,t){return y(`/api/storage/config/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t??{})})},fetchStateOwner(e){return y(`/api/storage/state/${encodeURIComponent(e)}`)},patchStateOwner(e,t){return y(`/api/storage/state/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t??{})})},validateBinary(e){return y("/api/storage/binaries/validate",{method:"POST",body:JSON.stringify({path:e})})},fetchSpeechCapabilities(){return y("/api/speech/capabilities")},transcribeAudio(e){return y("/api/speech/transcribe",{method:"POST",body:JSON.stringify(e)})},synthesizeSpeech(e){return y("/api/speech/synthesize",{method:"POST",body:JSON.stringify(e)})},synthesizeSpeechStream(e,t){return Ui("/api/speech/synthesize/stream",{method:"POST",body:JSON.stringify(e),signal:t})},listFileSystem(e,t){const n=new URLSearchParams;e&&e!=="."&&n.set("path",e),(t==null?void 0:t.includeFiles)!==void 0&&n.set("includeFiles",String(t.includeFiles));const r=n.toString();return y(r?`/api/filesystem?${r}`:"/api/filesystem")},createFileSystemFolder(e,t){return y("/api/filesystem/folders",{method:"POST",body:JSON.stringify({parentPath:e,name:t})})},readFileSystemFile(e,t){const n=new URLSearchParams({path:e});return t!=null&&t.encoding&&n.set("encoding",t.encoding),y(`/api/filesystem/files/content?${n.toString()}`)},readInstanceData(e){return y(`/api/storage/instances/${encodeURIComponent(e)}`)},writeInstanceData(e,t){return y(`/api/storage/instances/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})},deleteInstanceData(e){return y(`/api/storage/instances/${encodeURIComponent(e)}`,{method:"DELETE"})},listBackgroundProcesses(e){return y(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes`)},stopBackgroundProcess(e,t){return y(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes/${encodeURIComponent(t)}/stop`,{method:"POST"})},terminateBackgroundProcess(e,t){return y(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes/${encodeURIComponent(t)}/terminate`,{method:"POST"})},updateVoiceMode(e,t){const n=Xt();return y(`/workspaces/${encodeURIComponent(e)}/plugin/voice-mode`,{method:"POST",body:JSON.stringify({...n,enabled:t})})},sendClientConnectionPong(e){return y("/api/client-connections/pong",{method:"POST",body:JSON.stringify(e)})},fetchBackgroundProcessOutput(e,t,n){const r=new URLSearchParams;n!=null&&n.method&&r.set("method",n.method),n!=null&&n.pattern&&r.set("pattern",n.pattern),n!=null&&n.lines&&r.set("lines",String(n.lines)),(n==null?void 0:n.maxBytes)!==void 0&&r.set("maxBytes",String(n.maxBytes));const o=r.toString(),s=o?`?${o}`:"";return y(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes/${encodeURIComponent(t)}/output${s}`)},connectEvents(e,t,n){const r=Xt(),o=Bi(r);Rn.info(`Connecting to ${o}`);const s=new EventSource(o,{withCredentials:!0});return Ii(s,{onEvent:e,onError:t,onPing:n,logger:Rn}),s}};function Bi(e){const t=new URL(jt,typeof window<"u"?window.location.origin:"http://localhost");return t.searchParams.set("clientId",e.clientId),t.searchParams.set("connectionId",e.connectionId),jt.startsWith("http://")||jt.startsWith("https://")?t.toString():`${t.pathname}${t.search}`}const Nn=1e3,_i=1e4,Qt=Ce("sse");function ct(e,t){if(t){Qt.info(e,t);return}Qt.info(e)}class ji{constructor(){this.handlers=new Map,this.openHandlers=new Set,this.source=null,this.retryDelay=Nn,this.reconnectTimer=null,this.connect()}connect(){this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.source&&this.source.close(),ct("Connecting to backend events stream"),this.source=ee.connectEvents(t=>this.dispatch(t),()=>this.scheduleReconnect(),t=>{ee.sendClientConnectionPong({...Xt(),pingTs:t.ts}).catch(n=>{Qt.error("Failed to send client connection pong",n)})}),this.source.onopen=()=>{ct("Events stream connected"),this.retryDelay=Nn,this.openHandlers.forEach(t=>t())}}scheduleReconnect(){if(this.reconnectTimer!==null)return;const t=this.source;this.source=null,ct("Events stream disconnected, scheduling reconnect",{delayMs:this.retryDelay}),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.retryDelay=Math.min(this.retryDelay*2,_i),this.connect()},this.retryDelay),t==null||t.close()}dispatch(t){var n,r;ct(`event ${t.type}`),(n=this.handlers.get("*"))==null||n.forEach(o=>o(t)),(r=this.handlers.get(t.type))==null||r.forEach(o=>o(t))}on(t,n){this.handlers.has(t)||this.handlers.set(t,new Set);const r=this.handlers.get(t);return r.add(n),()=>r.delete(n)}onOpen(t){return this.openHandlers.add(t),()=>this.openHandlers.delete(t)}}const Vt=new ji,Vi=Ce("actions"),Un={messageHistory:[],agentModelSelections:{}};function Bn(e,t){if(e===t)return!0;if(typeof e=="object"&&e!==null&&typeof t=="object"&&t!==null)try{return JSON.stringify(e)===JSON.stringify(t)}catch(n){Vi.warn("Failed to compare config objects",n)}return!1}class Wi{constructor(){this.configOwnerCache=new Map,this.stateOwnerCache=new Map,this.configOwnerLoadPromises=new Map,this.stateOwnerLoadPromises=new Map,this.configOwnerListeners=new Map,this.stateOwnerListeners=new Map,this.instanceDataCache=new Map,this.instanceDataListeners=new Map,this.instanceLoadPromises=new Map,Vt.on("storage.configChanged",t=>{t.type==="storage.configChanged"&&this.setOwnerCache("config",t.owner,t.value)}),Vt.on("storage.stateChanged",t=>{t.type==="storage.stateChanged"&&this.setOwnerCache("state",t.owner,t.value)}),Vt.on("instance.dataChanged",t=>{t.type==="instance.dataChanged"&&this.setInstanceDataCache(t.instanceId,t.data)})}async loadConfigOwner(t){const n=this.configOwnerCache.get(t);if(n)return n;if(!this.configOwnerLoadPromises.has(t)){const r=ee.fetchConfigOwner(t).then(o=>(this.setOwnerCache("config",t,o),o)).finally(()=>{this.configOwnerLoadPromises.delete(t)});this.configOwnerLoadPromises.set(t,r)}return this.configOwnerLoadPromises.get(t)}async patchConfigOwner(t,n){const r=await ee.patchConfigOwner(t,n);return this.setOwnerCache("config",t,r),r}async loadStateOwner(t){const n=this.stateOwnerCache.get(t);if(n)return n;if(!this.stateOwnerLoadPromises.has(t)){const r=ee.fetchStateOwner(t).then(o=>(this.setOwnerCache("state",t,o),o)).finally(()=>{this.stateOwnerLoadPromises.delete(t)});this.stateOwnerLoadPromises.set(t,r)}return this.stateOwnerLoadPromises.get(t)}async patchStateOwner(t,n){const r=await ee.patchStateOwner(t,n);return this.setOwnerCache("state",t,r),r}async loadInstanceData(t){const n=this.instanceDataCache.get(t);if(n)return n;if(!this.instanceLoadPromises.has(t)){const r=ee.readInstanceData(t).then(o=>{const s=this.normalizeInstanceData(o);return this.setInstanceDataCache(t,s),s}).finally(()=>{this.instanceLoadPromises.delete(t)});this.instanceLoadPromises.set(t,r)}return this.instanceLoadPromises.get(t)}async saveInstanceData(t,n){const r=this.normalizeInstanceData(n);await ee.writeInstanceData(t,r),this.setInstanceDataCache(t,r)}async deleteInstanceData(t){await ee.deleteInstanceData(t),this.setInstanceDataCache(t,Un)}onConfigOwnerChanged(t,n){this.configOwnerListeners.has(t)||this.configOwnerListeners.set(t,new Set);const r=this.configOwnerListeners.get(t);r.add(n);const o=this.configOwnerCache.get(t);return o&&n(o),()=>{r.delete(n),r.size===0&&this.configOwnerListeners.delete(t)}}onStateOwnerChanged(t,n){this.stateOwnerListeners.has(t)||this.stateOwnerListeners.set(t,new Set);const r=this.stateOwnerListeners.get(t);r.add(n);const o=this.stateOwnerCache.get(t);return o&&n(o),()=>{r.delete(n),r.size===0&&this.stateOwnerListeners.delete(t)}}onInstanceDataChanged(t,n){this.instanceDataListeners.has(t)||this.instanceDataListeners.set(t,new Set);const r=this.instanceDataListeners.get(t);r.add(n);const o=this.instanceDataCache.get(t);return o&&n(o),()=>{r.delete(n),r.size===0&&this.instanceDataListeners.delete(t)}}setOwnerCache(t,n,r){if(n==="*"){t==="config"?this.configOwnerCache.clear():this.stateOwnerCache.clear();return}const o=t==="config"?this.configOwnerCache:this.stateOwnerCache,s=t==="config"?this.configOwnerListeners:this.stateOwnerListeners,i=o.get(n);if(i&&Bn(i,r)){o.set(n,r);return}o.set(n,r);const a=s.get(n);if(a)for(const c of a)c(r)}normalizeInstanceData(t){const n=t??Un,r=Array.isArray(n.messageHistory)?[...n.messageHistory]:[],o={...n.agentModelSelections??{}};return{...n,messageHistory:r,agentModelSelections:o}}setInstanceDataCache(t,n){const r=this.normalizeInstanceData(n),o=this.instanceDataCache.get(t);if(o&&Bn(o,r)){this.instanceDataCache.set(t,r);return}this.instanceDataCache.set(t,r),this.notifyInstanceDataChanged(t,r)}notifyInstanceDataChanged(t,n){const r=this.instanceDataListeners.get(t);if(r)for(const o of r)o(n)}}const Y=new Wi,Ir=Ce("api"),Pt={messageHistory:[],agentModelSelections:{}},[fn,Lr]=M(new Map),lt=new Map,Fe=new Map;function Dr(e){const t=e??Pt;return{...t,messageHistory:Array.isArray(t.messageHistory)?[...t.messageHistory]:[],agentModelSelections:{...t.agentModelSelections??{}}}}function _n(e){if(Fe.has(e))return;const t=Y.onInstanceDataChanged(e,n=>{wt(e,n)});Fe.set(e,t)}function zi(e){const t=Fe.get(e);t&&(t(),Fe.delete(e))}function wt(e,t){Lr(n=>{const r=new Map(n);return r.set(e,Dr(t)),r})}async function It(e){if(!e||fn().has(e))return;if(lt.has(e)){await lt.get(e);return}const t=Y.loadInstanceData(e).then(n=>{wt(e,n),_n(e)}).catch(n=>{Ir.warn("Failed to load instance data",n),wt(e,Pt),_n(e)}).finally(()=>{lt.delete(e)});lt.set(e,t),await t}async function Fr(e,t){if(!e)return;await It(e);const n=fn().get(e)??Pt,r=Dr(n);t(r);try{await Y.saveInstanceData(e,r)}catch(o){Ir.warn("Failed to persist instance data",o)}wt(e,r)}function Rr(e){return fn().get(e)??Pt}function Ki(e){Lr(t=>{if(!t.has(e))return t;const n=new Map(t);return n.delete(e),n}),zi(e)}const Hi=Ne(),Gi={getInstanceConfig:Rr,ensureInstanceConfig:It,updateInstanceConfig:Fr,clearInstanceConfig:Ki},Qc=e=>(le(()=>{for(const t of Fe.values())t();Fe.clear()}),ue(Hi.Provider,{value:Gi,get children(){return e.children}})),Ji=Ce("api"),[jn,en]=M(null),[el,Vn]=M(!1),[tl,gt]=M(null);let _e=null;async function qi(e=!1){return!e&&jn()?jn():_e||(Vn(!0),gt(null),_e=ee.fetchSpeechCapabilities().then(t=>(en(t),gt(null),t)).catch(t=>(Ji.error("Failed to load speech capabilities",t),en(null),gt(t instanceof Error?t.message:String(t)),null)).finally(()=>{Vn(!1),_e=null}),_e)}function Xi(){en(null),gt(null)}const A=Ce("actions"),Yi=20,Zi=5,Qi=50,T={showThinkingBlocks:!1,showKeyboardShortcutHints:!0,thinkingBlocksExpansion:"expanded",showMessageTimeline:!0,showTimelineTools:!0,holdLongAssistantReplies:!0,promptSubmitOnEnter:!1,showPromptVoiceInput:!0,diffViewMode:"split",toolOutputExpansion:"expanded",diagnosticsExpansion:"expanded",toolInputsVisibility:"collapsed",showUsageMetrics:!0,autoCleanupBlankSessions:!0,keepUnseenSubagentIdleStatus:!1,osNotificationsEnabled:!1,osNotificationsAllowWhenVisible:!1,notifyOnNeedsInput:!0,notifyOnIdle:!0},ve={provider:"openai-compatible",sttModel:"gpt-4o-mini-transcribe",ttsModel:"gpt-4o-mini-tts",ttsVoice:"alloy",playbackMode:"streaming",ttsFormat:"mp3"};function Nr(e){const t=e??{};return{showThinkingBlocks:t.showThinkingBlocks??T.showThinkingBlocks,showKeyboardShortcutHints:t.showKeyboardShortcutHints??T.showKeyboardShortcutHints,thinkingBlocksExpansion:t.thinkingBlocksExpansion??T.thinkingBlocksExpansion,showMessageTimeline:t.showMessageTimeline??T.showMessageTimeline,showTimelineTools:t.showTimelineTools??T.showTimelineTools,holdLongAssistantReplies:t.holdLongAssistantReplies??T.holdLongAssistantReplies,promptSubmitOnEnter:t.promptSubmitOnEnter??T.promptSubmitOnEnter,showPromptVoiceInput:t.showPromptVoiceInput??T.showPromptVoiceInput,locale:t.locale??T.locale,diffViewMode:t.diffViewMode??T.diffViewMode,toolOutputExpansion:t.toolOutputExpansion??T.toolOutputExpansion,diagnosticsExpansion:t.diagnosticsExpansion??T.diagnosticsExpansion,toolInputsVisibility:t.toolInputsVisibility==="hidden"||t.toolInputsVisibility==="collapsed"||t.toolInputsVisibility==="expanded"?t.toolInputsVisibility:T.toolInputsVisibility,showUsageMetrics:t.showUsageMetrics??T.showUsageMetrics,autoCleanupBlankSessions:t.autoCleanupBlankSessions??T.autoCleanupBlankSessions,keepUnseenSubagentIdleStatus:t.keepUnseenSubagentIdleStatus??T.keepUnseenSubagentIdleStatus,osNotificationsEnabled:t.osNotificationsEnabled??T.osNotificationsEnabled,osNotificationsAllowWhenVisible:t.osNotificationsAllowWhenVisible??T.osNotificationsAllowWhenVisible,notifyOnNeedsInput:t.notifyOnNeedsInput??T.notifyOnNeedsInput,notifyOnIdle:t.notifyOnIdle??T.notifyOnIdle}}function Ur(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e))typeof r=="string"&&(t[n]=r);return t}function Br(e){const t=e??{};return{provider:t.provider==="openai-compatible"?t.provider:ve.provider,apiKey:typeof t.apiKey=="string"&&t.apiKey.trim()?t.apiKey.trim():void 0,hasApiKey:t.hasApiKey===!0||typeof t.apiKey=="string"&&t.apiKey.trim().length>0,baseUrl:typeof t.baseUrl=="string"&&t.baseUrl.trim()?t.baseUrl.trim():void 0,sttModel:typeof t.sttModel=="string"&&t.sttModel.trim()?t.sttModel.trim():ve.sttModel,ttsModel:typeof t.ttsModel=="string"&&t.ttsModel.trim()?t.ttsModel.trim():ve.ttsModel,ttsVoice:typeof t.ttsVoice=="string"&&t.ttsVoice.trim()?t.ttsVoice.trim():ve.ttsVoice,playbackMode:t.playbackMode==="buffered"||t.playbackMode==="streaming"?t.playbackMode:ve.playbackMode,ttsFormat:t.ttsFormat==="wav"||t.ttsFormat==="opus"||t.ttsFormat==="aac"||t.ttsFormat==="mp3"?t.ttsFormat:ve.ttsFormat}}function je(e,t){if(!Array.isArray(e))return[];const n=[];for(const r of e){const o=t(r);o&&n.push(o)}return n}function ea(e){var n,r,o;const t=e??{};return{recentFolders:je(t.recentFolders,s=>{if(!s||typeof s!="object")return null;const i=s.path,a=s.lastAccessed;if(typeof i!="string")return null;const c=typeof a=="number"?a:Date.now();return{path:i,lastAccessed:c}}),opencodeBinaries:je(t.opencodeBinaries,s=>{if(!s||typeof s!="object")return null;const i=s.path;if(typeof i!="string")return null;const a=typeof s.lastUsed=="number"?s.lastUsed:Date.now(),c=typeof s.version=="string"?s.version:void 0,l=typeof s.label=="string"?s.label:void 0;return{path:i,version:c,label:l,lastUsed:a}}),remoteServers:je(t.remoteServers,s=>{if(!s||typeof s!="object")return null;const i=typeof s.id=="string"?s.id.trim():"",a=typeof s.name=="string"?s.name.trim():"",c=typeof s.baseUrl=="string"?s.baseUrl.trim():"";if(!i||!a||!c)return null;const l=typeof s.createdAt=="string"?s.createdAt:new Date().toISOString(),u=typeof s.updatedAt=="string"?s.updatedAt:l,d=typeof s.lastConnectedAt=="string"?s.lastConnectedAt:void 0;return{id:i,name:a,baseUrl:c,skipTlsVerify:!!s.skipTlsVerify,createdAt:l,updatedAt:u,lastConnectedAt:d}}).sort((s,i)=>{const a=s.lastConnectedAt??s.updatedAt;return(i.lastConnectedAt??i.updatedAt).localeCompare(a)}),models:{recents:je((n=t.models)==null?void 0:n.recents,s=>{if(!s||typeof s!="object")return null;const i=s.providerId,a=s.modelId;return typeof i!="string"||typeof a!="string"?null:{providerId:i,modelId:a}}),favorites:je((r=t.models)==null?void 0:r.favorites,s=>{if(!s||typeof s!="object")return null;const i=s.providerId,a=s.modelId;return typeof i!="string"||typeof a!="string"?null:{providerId:i,modelId:a}}),thinkingSelections:Ur((o=t.models)==null?void 0:o.thinkingSelections)}}}function ta(e){const t=e??{},n=t.listeningMode==="all"?"all":"local",r=t.logLevel==="INFO"||t.logLevel==="WARN"||t.logLevel==="ERROR"||t.logLevel==="DEBUG"?t.logLevel:"DEBUG",o=typeof t.opencodeBinary=="string"&&t.opencodeBinary.trim()?t.opencodeBinary:"opencode",s=Ur(t.environmentVariables),i=Br(t.speech);return{listeningMode:n,logLevel:r,opencodeBinary:o,environmentVariables:s,speech:i}}function _r(e){return`${e.providerId}/${e.modelId}`}function jr(e,t){const n=t.filter(r=>r.path!==e);return n.unshift({path:e,lastAccessed:Date.now()}),n.slice(0,Yi)}function gn(e,t,n){const r=Date.now(),o=n.find(i=>i.path===e);if(o){const i={...o,lastUsed:r,version:t??o.version},a=n.filter(c=>c.path!==e);return[i,...a]}return[t?{path:e,version:t,lastUsed:r}:{path:e,lastUsed:r},...n].slice(0,10)}function na(e,t){const n=e.id?t.find(o=>o.id===e.id):void 0,r=new Date().toISOString();return{id:(n==null?void 0:n.id)??e.id??ra(),name:e.name.trim(),baseUrl:e.baseUrl.trim(),skipTlsVerify:!!e.skipTlsVerify,createdAt:(n==null?void 0:n.createdAt)??r,updatedAt:r,lastConnectedAt:n==null?void 0:n.lastConnectedAt}}function Vr(e,t){const n=t.filter(r=>r.id!==e.id);return[e,...n].sort((r,o)=>{const s=r.lastConnectedAt??r.updatedAt;return(o.lastConnectedAt??o.updatedAt).localeCompare(s)})}function ra(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`remote-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}const[hn,Ct]=M({}),[oa,St]=M({}),[sa,xt]=M({}),[Wr,He]=M(!1),ia=L(()=>Nr(hn().settings)),zr=L(()=>hn().theme??"system"),Se=L(()=>ta(oa())),re=L(()=>ea(sa())),B=ia,Lt=L(()=>re().recentFolders),et=L(()=>re().opencodeBinaries),Re=L(()=>re().remoteServers);let ut=null;async function Dt(){Wr()||(ut||(ut=Promise.all([Y.loadConfigOwner("ui"),Y.loadConfigOwner("server"),Y.loadStateOwner("ui")]).then(([e,t,n])=>{Ct(e),St(t),xt(n),He(!0)}).catch(e=>{A.error("Failed to load settings",e),Ct({}),St({}),xt({}),He(!0)}).finally(()=>{ut=null})),await ut)}async function se(e,t){await Dt();const n=await Y.patchConfigOwner(e,t);e==="ui"&&Ct(n),e==="server"&&St(n)}async function G(e,t){await Dt();const n=await Y.patchStateOwner(e,t);xt(n)}function W(e){const t=hn(),r={settings:Nr({...t.settings??{},...e})};se("ui",r).catch(o=>A.error("Failed to patch ui settings",o))}function Kr(e){W(e)}function aa(e){zr()!==e&&se("ui",{theme:e}).catch(t=>A.error("Failed to set theme",t))}async function ca(e){Se().listeningMode!==e&&await se("server",{listeningMode:e})}function mn(e){se("server",{environmentVariables:e}).catch(t=>A.error("Failed to update environment variables",t))}function la(e,t){const n=Se().environmentVariables;mn({...n,[e]:t})}function ua(e){const t=Se().environmentVariables,{[e]:n,...r}=t;mn(r)}function da(e){const t=e&&e.trim().length>0?e:"opencode";se("server",{opencodeBinary:t}).catch(r=>A.error("Failed to set default binary",r));const n=gn(t,void 0,et());G("ui",{opencodeBinaries:n}).catch(r=>A.error("Failed to update binary list",r))}function fa(e){se("server",{logLevel:e??"DEBUG"}).catch(n=>A.error("Failed to set log level",n))}async function ga(e){const t=e.apiKey,{apiKey:n,...r}=e,o=Br({...Se().speech,...r,...t===null?{}:{apiKey:t}}),{hasApiKey:s,...i}=o,a={...i,...t===null?{apiKey:null}:{}};try{await se("server",{speech:a})}catch(c){throw A.error("Failed to update speech settings",c),c}}function ha(e,t){const n=gn(e,t,et());G("ui",{opencodeBinaries:n}).catch(r=>A.error("Failed to add binary",r))}function ma(e){const t=et().filter(n=>n.path!==e);G("ui",{opencodeBinaries:t}).catch(n=>A.error("Failed to remove binary",n)),Se().opencodeBinary===e&&se("server",{opencodeBinary:"opencode"}).catch(n=>A.error("Failed to reset default binary",n))}function pa(e){const t=jr(e,Lt());G("ui",{recentFolders:t}).catch(n=>A.error("Failed to add recent folder",n))}function ya(e){const t=Lt().filter(n=>n.path!==e);G("ui",{recentFolders:t}).catch(n=>A.error("Failed to remove recent folder",n))}async function ba(e){const t=na(e,Re());return await G("ui",{remoteServers:Vr(t,Re())}),t}async function wa(e){const t=Re().find(o=>o.id===e);if(!t)return;const n=new Date().toISOString(),r={...t,updatedAt:n,lastConnectedAt:n};await G("ui",{remoteServers:Vr(r,Re())})}function Ca(e){const t=Re().filter(n=>n.id!==e);G("ui",{remoteServers:t}).catch(n=>A.error("Failed to remove remote server",n))}function Sa(e,t){const n=t&&t.trim().length>0?t:Se().opencodeBinary,r=jr(e,Lt()),o=gn(n,void 0,et());G("ui",{recentFolders:r,opencodeBinaries:o}).catch(s=>A.error("Failed to update ui state on launch",s)),se("server",{opencodeBinary:n}).catch(s=>A.error("Failed to persist selected binary",s))}function xa(e){if(!e.providerId||!e.modelId)return;const n=re().models.recents.filter(o=>o.providerId!==e.providerId||o.modelId!==e.modelId),r=[e,...n].slice(0,Zi);G("ui",{models:{recents:r}}).catch(o=>A.error("Failed to update model recents",o))}function Oa(e){return!e.providerId||!e.modelId?!1:re().models.favorites.some(t=>t.providerId===e.providerId&&t.modelId===e.modelId)}function va(e){if(!e.providerId||!e.modelId)return;const t=re().models.favorites,r=t.some(o=>o.providerId===e.providerId&&o.modelId===e.modelId)?t.filter(o=>o.providerId!==e.providerId||o.modelId!==e.modelId):[e,...t.filter(o=>o.providerId!==e.providerId||o.modelId!==e.modelId)].slice(0,Qi);G("ui",{models:{favorites:r}}).catch(o=>A.error("Failed to update model favorites",o))}function ka(e){if(!(!e.providerId||!e.modelId))return re().models.thinkingSelections[_r(e)]}function $a(e,t){if(!e.providerId||!e.modelId)return;const n=_r(e);if(re().models.thinkingSelections[n]===t)return;const o={...re().models.thinkingSelections};t?o[n]=t:delete o[n],G("ui",{models:{thinkingSelections:o}}).catch(s=>A.error("Failed to update thinking selection",s))}function Aa(e){B().diffViewMode!==e&&W({diffViewMode:e})}function Ta(e){B().toolOutputExpansion!==e&&W({toolOutputExpansion:e})}function Ma(e){B().diagnosticsExpansion!==e&&W({diagnosticsExpansion:e})}function Ea(e){B().toolInputsVisibility!==e&&W({toolInputsVisibility:e})}function Pa(e){B().thinkingBlocksExpansion!==e&&W({thinkingBlocksExpansion:e})}function Ia(){W({showThinkingBlocks:!B().showThinkingBlocks})}function La(){Kr({showKeyboardShortcutHints:!B().showKeyboardShortcutHints})}function Da(){W({showTimelineTools:!B().showTimelineTools})}function Fa(){W({showMessageTimeline:!(B().showMessageTimeline??!0)})}function Ra(){W({showUsageMetrics:!B().showUsageMetrics})}function Na(){W({promptSubmitOnEnter:!B().promptSubmitOnEnter})}function Ua(){W({showPromptVoiceInput:!B().showPromptVoiceInput})}function Ba(){const e=!B().autoCleanupBlankSessions;A.info("toggle auto cleanup",{value:e}),W({autoCleanupBlankSessions:e})}async function _a(e,t,n){!e||!t||!n.providerId||!n.modelId||(await It(e),await Fr(e,r=>{const o={...r.agentModelSelections??{}},s=o[t];s&&s.providerId===n.providerId&&s.modelId===n.modelId||(o[t]=n,r.agentModelSelections=o)}))}async function ja(e,t){return!e||!t?void 0:(await It(e),(Rr(e).agentModelSelections??{})[t])}Dt().catch(e=>{A.error("Failed to initialize settings",e)});const Hr=Ne(),Va={isLoaded:Wr,preferences:B,updatePreferences:Kr,themePreference:zr,setThemePreference:aa,serverSettings:Se,setListeningMode:ca,updateEnvironmentVariables:mn,addEnvironmentVariable:la,removeEnvironmentVariable:ua,updateLastUsedBinary:da,updateLogLevel:fa,updateSpeechSettings:ga,recentFolders:Lt,opencodeBinaries:et,remoteServers:Re,uiState:re,addRecentFolder:pa,removeRecentFolder:ya,addOpenCodeBinary:ha,removeOpenCodeBinary:ma,saveRemoteServerProfile:ba,markRemoteServerConnected:wa,removeRemoteServerProfile:Ca,recordWorkspaceLaunch:Sa,addRecentModelPreference:xa,isFavoriteModelPreference:Oa,toggleFavoriteModelPreference:va,getModelThinkingSelection:ka,setModelThinkingSelection:$a,toggleShowThinkingBlocks:Ia,toggleKeyboardShortcutHints:La,toggleShowMessageTimeline:Fa,toggleShowTimelineTools:Da,toggleUsageMetrics:Ra,toggleAutoCleanupBlankSessions:Ba,togglePromptSubmitOnEnter:Na,toggleShowPromptVoiceInput:Ua,setDiffViewMode:Aa,setToolOutputExpansion:Ta,setDiagnosticsExpansion:Ma,setThinkingBlocksExpansion:Pa,setToolInputsVisibility:Ea,setAgentModelPreference:_a,getAgentModelPreference:ja},nl=e=>($t(()=>{Dt().catch(o=>{A.error("Failed to initialize settings",o)});const t=Y.onConfigOwnerChanged("ui",o=>{Ct(o),He(!0)}),n=Y.onConfigOwnerChanged("server",o=>{St(o),He(!0),Xi(),qi(!0)}),r=Y.onStateOwnerChanged("ui",o=>{xt(o),He(!0)});return()=>{t(),n(),r()}}),ue(Hr.Provider,{value:Va,get children(){return e.children}}));function Wa(){const e=Ye(Hr);if(!e)throw new Error("useConfig must be used within ConfigProvider");return e}function za(e,t,n){const r={};return Object.keys(e).forEach(o=>{r[o]=e[o].reduce((s,i)=>(i&&(n&&n[i]&&s.push(n[i]),s.push(t(i))),s),[]).join(" ")}),r}const Ka=Symbol("solid-inspect"),Ha=Ne();function Ga(e){function t(n){var r;return(r=Ye(Ha))!=null&&r.enabled?{Component:t,props:n,$INSPECT:Ka}:e(n)}return Object.defineProperty(t,"name",{value:e.name}),t.toString=e.toString,t}function Gr(){return function(e){function t(a){const c=!!e.slotClasses,l=()=>{if(!e.slotClasses)throw new Error("'slotClasses' option is not defined");if(!e.utilityClass)throw new Error("'utilityClass' option is not defined");return za(e.slotClasses(a),e.utilityClass,a.classes??"")},u=No({});return c&&io(()=>{const d=l();Ae(()=>{for(const g in d)u[g]=d[g]})}),u}function n(a){const[c,l]=kt(a,e.selfPropNames);return{allProps:a,props:c,otherProps:l}}function r(a){return $s({propDefaults:a.propDefaults||e.propDefaults,props:a.props,name:e.name})}function o(a){const c=r({props:a});return n(c)}function s(a,c=!0){return a=Ga(a),a.toString=()=>`.${e.name}-root`,c&&Ar(a,"base"),a}function i(a){const c=s(function(u){const{allProps:d,otherProps:g,props:m}=o(u),p=e.autoCallUseClasses??!0?t(d):{};return a({allProps:d,otherProps:g,props:m,classes:p})});return Object.defineProperty(c,"name",{value:a.name}),c}return{name:e.name,selfPropNames:e.selfPropNames,component:i,defineComponent:s,useClasses:t,useThemeProps:r,useProps:o,splitInProps:n}}}const Ja=Gr()({name:"MuiGlobalStyles",selfPropNames:["styles"]}),qa=Ja.component(function({props:t}){return Sr(()=>({"@global":t.styles||{}})),[]}),Xa=Gr()({name:"MuiCssBaseline",selfPropNames:["children","enableColorScheme"],propDefaults:({set:e})=>e({enableColorScheme:!1})}),Ya=(e,t)=>({WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",boxSizing:"border-box",WebkitTextSizeAdjust:"100%",...t&&{colorScheme:e.palette.mode}}),Za=e=>({color:e.palette.text.primary,...e.typography.body1,backgroundColor:e.palette.background.default,"@media print":{backgroundColor:e.palette.common.white}}),Qa=(e,t=!1)=>({html:Ya(e,t),"*, *::before, *::after":{boxSizing:"inherit"},"strong, b":{fontWeight:e.typography.fontWeightBold},body:{margin:0,...Za(e),"&::backdrop":{backgroundColor:e.palette.background.default}}}),ec=Xa.component(function({props:t}){const n=fr();return ue(qa,{get styles(){return Qa(n,t.enableColorScheme)}})}),Jr=Ne();function Wn(e){if(!(typeof document>"u")){if(e==="system"){document.documentElement.removeAttribute("data-theme");return}document.documentElement.setAttribute("data-theme",e)}}const tc={backgroundDefault:"#ffffff",backgroundPaper:"#f5f5f5",primary:"#0066ff",primaryContrast:"#ffffff",textPrimary:"#1a1a1a",textSecondary:"#666666",divider:"#e0e0e0"},nc={backgroundDefault:"#1a1a1a",backgroundPaper:"#2a2a2a",primary:"#0080ff",primaryContrast:"#1a1a1a",textPrimary:"#cfd4dc",textSecondary:"#999999",divider:"#3a3a3a"},he=(e,t,n)=>{if(!n)return t;const r=n.getPropertyValue(e);return r&&r.trim()||t},rc=e=>{const t=e?nc:tc,n=typeof window<"u"?getComputedStyle(document.documentElement):null;return{backgroundDefault:he("--surface-base",t.backgroundDefault,n),backgroundPaper:he("--surface-secondary",t.backgroundPaper,n),primary:he("--accent-primary",t.primary,n),primaryContrast:he("--text-inverted",t.primaryContrast,n),textPrimary:he("--text-primary",t.textPrimary,n),textSecondary:he("--text-secondary",t.textSecondary,n),divider:he("--border-base",t.divider,n)}};function rl(e){const t=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,{themePreference:n,setThemePreference:r}=Wa(),[o,s]=M(!0),[i,a]=M(0),c=()=>n(),l=()=>{const p=c();return p==="dark"?!0:p==="light"?!1:(t==null?void 0:t.matches)??!1},u=()=>{const p=c(),C=l();Wn(p==="system"?"system":p),s(C),typeof window<"u"?requestAnimationFrame(()=>a(b=>b+1)):a(b=>b+1)};K(()=>{u()}),$t(()=>{if(!t)return;const p=()=>{u()};return t.addEventListener("change",p),()=>{t.removeEventListener("change",p)}});const d=p=>{r(p)},g=()=>{const p=c();d(p==="system"?"light":p==="light"?"dark":"system")},m=L(()=>{i();const p=rc(o());return lr({palette:{mode:o()?"dark":"light",primary:{main:p.primary,contrastText:p.primaryContrast},secondary:{main:p.primary},background:{default:p.backgroundDefault,paper:p.backgroundPaper},text:{primary:p.textPrimary,secondary:p.textSecondary},divider:p.divider},typography:{fontFamily:"var(--font-family-sans)"},shape:{borderRadius:8},components:{MuiIconButton:{styleOverrides:{root:{color:"inherit","&.Mui-disabled":{color:"var(--text-muted)",opacity:.55}}}},MuiDrawer:{styleOverrides:{paper:{backgroundColor:"var(--surface-secondary)",color:"var(--text-primary)"}}},MuiAppBar:{styleOverrides:{root:{backgroundColor:"var(--surface-secondary)",color:"var(--text-primary)",boxShadow:"none",borderBottom:"1px solid var(--border-base)",zIndex:10}}},MuiToolbar:{styleOverrides:{root:{minHeight:"56px"}}}}})});return ue(Jr.Provider,{value:{isDark:o,themeMode:c,setThemeMode:d,cycleThemeMode:g},get children(){return ue(As,{get theme(){return m()},get children(){return[ue(ec,{}),bo(()=>e.children)]}})}})}function qr(){const e=Ye(Jr);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const oc=/(^|\n)@@/m,sc=/(^|\n)(diff --git |--- |\+\+\+)/,ic=/^\*\*\* (Begin|End) Patch/,ac=/^\*\*\* Update File: (.+)$/,cc=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;function lc(e){const t=e.trim();if(!t.startsWith("```"))return t;const n=t.split(`
16
+ `);return n.length<2?"":n[n.length-1].startsWith("```")?n.slice(1,-1).join(`
17
+ `):t}function uc(e){var s;if(!e)return"";const n=lc(e.replace(/\r\n/g,`
18
+ `)).split(`
19
+ `).map(i=>i.replace(/\s+$/u,""));let r=null;const o=[];for(const i of n){if(!i||ic.test(i))continue;const a=i.match(ac);if(a){r=((s=a[1])==null?void 0:s.trim())||null;continue}o.push(i)}return r&&!sc.test(o.join(`
20
+ `))&&(o.unshift(`+++ b/${r}`),o.unshift(`--- a/${r}`)),o.join(`
21
+ `).trim()}function ol(e){if(!e)return!1;const t=uc(e);return t?oc.test(t):!1}function dc(e){if(!e||e.trim().length===0)return{before:"",after:""};const t=e.replace(/\r\n/g,`
22
+ `).split(`
23
+ `),n=[],r=[];for(const o of t)o.startsWith("---")||o.startsWith("+++")||o.startsWith("diff --git")||cc.test(o)||(o.startsWith("-")&&!o.startsWith("---")?n.push(o.slice(1)):o.startsWith("+")&&!o.startsWith("+++")?r.push(o.slice(1)):o.startsWith(" ")?(n.push(o.slice(1)),r.push(o.slice(1))):o===""?(n.push(""),r.push("")):(n.push(o),r.push(o)));for(;n.length>0&&n[n.length-1]==="";)n.pop();for(;r.length>0&&r[r.length-1]==="";)r.pop();return{before:n.join(`
24
+ `),after:r.join(`
25
+ `)}}const fc="0.52.2",tn=`https://cdn.jsdelivr.net/npm/monaco-editor@${fc}/min/vs`,X="/monaco/vs";let dt=null;function gc(e,t){return new Promise((n,r)=>{const o=setTimeout(()=>r(new Error("timeout")),t);e.then(s=>{clearTimeout(o),n(s)}).catch(s=>{clearTimeout(o),r(s)})})}async function hc(){if(typeof fetch>"u")return!1;try{const e=new AbortController,t=fetch(`${tn}/loader.js`,{method:"HEAD",signal:e.signal}),n=await gc(t,1200);return e.abort(),n.ok}catch{return!1}}function mc(){return typeof document>"u"||document.querySelector('script[data-monaco-loader="true"]')?Promise.resolve():new Promise((t,n)=>{const r=document.createElement("script");r.dataset.monacoLoader="true",r.src=`${X}/loader.js`,r.async=!0,r.onload=()=>t(),r.onerror=()=>n(new Error("Failed to load Monaco AMD loader")),document.head.appendChild(r)})}function pc(){if(typeof document>"u"||document.querySelector('link[data-monaco-editor-css="true"]'))return;const t=document.createElement("link");t.rel="stylesheet",t.href=`${X}/editor/editor.main.css`,t.dataset.monacoEditorCss="true",document.head.appendChild(t)}function yc(){const e=globalThis,t=e.MonacoEnvironment??{},n="/monaco.worker.js";e.MonacoEnvironment={...t,getWorkerUrl(r,o){return n}}}function Xr(){const e=globalThis.require;if(!e)throw new Error("Monaco AMD loader is not available");return e}function bc(){const t=Xr().config;if(!t)throw new Error("require.config is not available");return t}function nn(e){const t=Xr();return new Promise((n,r)=>{t(e,(...o)=>n(o),o=>r(o))})}function wc(e){const t=String(e||"plaintext");return!t||t==="plaintext"?null:t==="typescript"||t==="javascript"?"vs/language/typescript/monaco.contribution":t==="json"?"vs/language/json/monaco.contribution":t==="css"||t==="scss"||t==="less"?"vs/language/css/monaco.contribution":t==="html"?"vs/language/html/monaco.contribution":t==="toml"?"vs/basic-languages/toml/toml":`vs/basic-languages/${t}/${t}`}const zn=new Set,Wt=new Map;async function Yr(e){const t=wc(e);if(!t||zn.has(t))return;const n=Wt.get(t);if(n)return n;const r=(async()=>{let o=!1;try{await nn([t]),o=!0}catch{}finally{o&&zn.add(t),Wt.delete(t)}})();return Wt.set(t,r),r}async function Zr(){return dt||(dt=(async()=>{await mc(),yc(),pc();const e=await hc(),t=bc(),n={vs:X};e&&(n["vs/basic-languages"]=`${tn}/basic-languages`,n["vs/language"]=`${tn}/language`,n["vs/basic-languages/python"]=`${X}/basic-languages/python`,n["vs/basic-languages/markdown"]=`${X}/basic-languages/markdown`,n["vs/basic-languages/cpp"]=`${X}/basic-languages/cpp`,n["vs/basic-languages/kotlin"]=`${X}/basic-languages/kotlin`,n["vs/language/typescript"]=`${X}/language/typescript`,n["vs/language/html"]=`${X}/language/html`,n["vs/language/json"]=`${X}/language/json`,n["vs/language/css"]=`${X}/language/css`),t({paths:n,ignoreDuplicateModules:["vs/editor/editor.main"]});const[r]=await nn(["vs/editor/editor.main"]);return await nn(["vs/basic-languages/monaco.contribution"]).catch(()=>[]),globalThis.monaco??r})(),dt)}const Cc=5,ae=new Map;function Sc(e,t){ae.delete(e),ae.set(e,t)}function xc(){for(;ae.size>Cc;){const e=ae.keys().next().value;if(!e)return;const t=ae.get(e);ae.delete(e);try{t==null||t.model.dispose()}catch{}}}function rn(e){const t=ae.get(e.cacheKey);if(t)return Sc(e.cacheKey,t),t.model.getValue()!==e.value&&t.model.setValue(e.value),t.model;const n=e.monaco.Uri.parse(`opencode://model/${encodeURIComponent(e.cacheKey)}`),r=e.monaco.editor.createModel(e.value,"plaintext",n),o={model:r};return ae.set(e.cacheKey,o),xc(),r}let ft=null;function Oc(e){var o;if(ft)return ft;const t=new Map,n=new Map,r=typeof((o=e==null?void 0:e.languages)==null?void 0:o.getLanguages)=="function"?e.languages.getLanguages():[];if(Array.isArray(r))for(const s of r){const i=typeof(s==null?void 0:s.id)=="string"?s.id:null;if(!i)continue;const a=Array.isArray(s==null?void 0:s.filenames)?s.filenames:[];for(const l of a)typeof l=="string"&&(t.has(l)||t.set(l,i));const c=Array.isArray(s==null?void 0:s.extensions)?s.extensions:[];for(const l of c)typeof l=="string"&&(n.has(l)||n.set(l,i))}return ft={fileNameToId:t,extToId:n},ft}function vc(e){return e===".gitignore"||e===".gitattributes"||e===".gitmodules"||e==="Makefile"||e.startsWith("Makefile.")?"shell":null}function Qr(e,t){const n=String(t||"").trim(),r=n.split("/").pop()||n,o=vc(r);if(o)return o;const s=Oc(e),i=s.fileNameToId.get(r);if(i)return i;const a=r.lastIndexOf(".");if(a>0){const c=r.slice(a),l=s.extToId.get(c);if(l)return l}return"plaintext"}var kc=on("<div class=monaco-viewer><div class=git-change-context-overlay>"),$c=on("<div class=git-change-context-widget-host><button type=button class=git-change-context-widget>+");function Ot(e){return e?e.split(`
26
+ `).length:1}function vt(e){return String(Math.max(1,e)).length}function Ac(e){const t=Ot(e.before),n=Ot(e.after),r=vt(t),o=vt(n),s=Math.max(r,o),i=Math.max(0,s-2),a=Math.max(2,r),c=Math.max(2,o),l=Math.max(0,s-3);return{diffEditorLineNumbersMinChars:Math.max(a,c),originalLineNumbersMinChars:a,modifiedLineNumbersMinChars:c,lineDecorationsWidth:6+i*2+l*2}}function Tc(e){const t=Ot(e.before),n=Ot(e.after),r=vt(t),o=vt(n),s=Math.max(r,o),i=Math.max(0,s-2),a=Math.max(2,r),c=Math.max(2,o),l=Math.max(0,s-3);return{diffEditorLineNumbersMinChars:Math.max(a,c),originalLineNumbersMinChars:a,modifiedLineNumbersMinChars:c,lineDecorationsWidth:8+i*2+l}}function Mc(e){const{isDark:t}=qr();let n,r=null,o=null,s=null;const[i,a]=M(!1),[c,l]=M(null),[u,d]=M(null),[g,m]=M(!1),[p,C]=M(null),b=L(()=>e.patch!==void 0&&e.patch!==null?dc(e.patch):{before:e.before??"",after:e.after??""}),P=()=>{try{r==null||r.setModel(null)}catch{}try{r==null||r.dispose()}catch{}r=null},R=()=>{n&&(n.style.removeProperty("--split-original-line-number-width"),n.style.removeProperty("--split-original-delete-sign-left"),n.style.removeProperty("--split-original-gutter-width"))},D=h=>{if(n){if(s!==null&&typeof window<"u"&&(window.cancelAnimationFrame(s),s=null),h.viewMode!=="split"||typeof window>"u"){R();return}s=window.requestAnimationFrame(()=>{if(s=null,!n)return;const w=n.querySelector(".editor.original .line-numbers"),v=(w==null?void 0:w.getBoundingClientRect().width)??0,x=v>0?v:Math.max(12,h.originalLineNumbersMinChars*6);n.style.setProperty("--split-original-line-number-width",`${x}px`),n.style.setProperty("--split-original-delete-sign-left",`${x}px`),n.style.setProperty("--split-original-gutter-width",`${x+h.lineDecorationsWidth}px`)})}},J=()=>{var h;return((h=r==null?void 0:r.getModifiedEditor)==null?void 0:h.call(r))??null},tt=()=>{const h=u();if(h)return h;if(g()&&c())return{startLine:c(),endLine:c()};const w=c();return w?{startLine:w,endLine:w}:null},_=()=>{var x,O,$,S;const h=J(),w=n;if(!h||!w)return;const v=tt();if(!v){C(null);return}try{const E=(x=h.getDomNode)==null?void 0:x.call(h);if(!E){C(null);return}const N=E.querySelector(".margin"),q=E.querySelector(".monaco-scrollable-element.editor-scrollable"),fe=((O=h.getTopForLineNumber)==null?void 0:O.call(h,v.startLine))??0,xe=(($=h.getScrollTop)==null?void 0:$.call(h))??0,nt=Number(((S=h.getOption)==null?void 0:S.call(h,o.editor.EditorOption.lineHeight))??18),Be=E.getBoundingClientRect(),ge=w.getBoundingClientRect(),rt=Be.left-ge.left+((N==null?void 0:N.offsetWidth)??(q==null?void 0:q.offsetLeft)??0),eo=Be.top-ge.top+(fe-xe)+nt/2;C({top:eo,left:rt})}catch{C(null)}};return $t(()=>{let h=!1;(async()=>(o=await Zr(),!h&&(!n||!o||(o.editor.setTheme(t()?"vs-dark":"vs"),r=o.editor.createDiffEditor(n,{readOnly:!0,automaticLayout:!0,renderSideBySide:!0,renderSideBySideInlineBreakpoint:0,renderMarginRevertIcon:!1,minimap:{enabled:!1},scrollBeyondLastLine:!1,renderWhitespace:"selection",fontSize:13,wordWrap:e.wordWrap==="on"?"on":"off",glyphMargin:!1,folding:!1,lineNumbersMinChars:4,lineDecorationsWidth:12,diffAlgorithm:"legacy",maxComputationTime:1e4}),a(!0),_()))))(),le(()=>{h=!0,s!==null&&typeof window<"u"&&(window.cancelAnimationFrame(s),s=null),R(),a(!1),P()})}),K(()=>{!i()||!o||!r||o.editor.setTheme(t()?"vs-dark":"vs")}),K(()=>{n&&(n.dataset.viewMode=e.viewMode==="split"?"split":"unified")}),K(()=>{var v;if(!i()||!o||!r)return;const h=(v=r.getModifiedEditor)==null?void 0:v.call(r);if(!(h!=null&&h.onDidChangeCursorSelection))return;const w=h.onDidChangeCursorSelection(x=>{var $;const O=x==null?void 0:x.selection;if(!O||($=O.isEmpty)!=null&&$.call(O)){d(null),_();return}d({startLine:Math.min(O.startLineNumber,O.endLineNumber),endLine:Math.max(O.startLineNumber,O.endLineNumber)}),_()});le(()=>{var x;try{(x=w==null?void 0:w.dispose)==null||x.call(w)}catch{}})}),K(()=>{var O;if(!i()||!o||!r)return;const h=J();if(!(h!=null&&h.onMouseMove)||!(h!=null&&h.onMouseLeave)||!(h!=null&&h.onMouseDown))return;const w=h.onMouseMove($=>{var E,N;const S=(N=(E=$==null?void 0:$.target)==null?void 0:E.position)==null?void 0:N.lineNumber;l(typeof S=="number"?S:null),_()}),v=h.onMouseLeave(()=>{g()||l(null),_()}),x=(O=h.onDidScrollChange)==null?void 0:O.call(h,()=>{_()});le(()=>{var $,S,E;try{($=w==null?void 0:w.dispose)==null||$.call(w),(S=v==null?void 0:v.dispose)==null||S.call(v),(E=x==null?void 0:x.dispose)==null||E.call(x)}catch{}})}),K(()=>{if(!i()||!o||!r)return;tt()||C(null),_()}),K(()=>{var fe,xe,nt,Be,ge,rt;if(!i()||!o||!r)return;const h=e.viewMode==="unified"?"unified":"split",w=e.contextMode==="collapsed"?"collapsed":"expanded",v=e.wordWrap==="on"?"on":"off",{before:x,after:O}=b(),$=h==="unified"?Ac({before:x,after:O}):Tc({before:x,after:O}),{diffEditorLineNumbersMinChars:S,originalLineNumbersMinChars:E,modifiedLineNumbersMinChars:N,lineDecorationsWidth:q}=$;r.updateOptions({renderSideBySide:h==="split",renderSideBySideInlineBreakpoint:0,renderIndicators:!0,lineNumbersMinChars:S,lineDecorationsWidth:q,hideUnchangedRegions:w==="collapsed"?{enabled:!0}:{enabled:!1},wordWrap:v});try{(nt=(xe=(fe=r.getOriginalEditor)==null?void 0:fe.call(r))==null?void 0:xe.updateOptions)==null||nt.call(xe,{wordWrap:v,lineNumbersMinChars:E,lineDecorationsWidth:q})}catch{}try{(rt=(ge=(Be=r.getModifiedEditor)==null?void 0:Be.call(r))==null?void 0:ge.updateOptions)==null||rt.call(ge,{wordWrap:v,lineNumbersMinChars:N,lineDecorationsWidth:q})}catch{}D({viewMode:h,originalLineNumbersMinChars:E,lineDecorationsWidth:q})}),K(()=>{if(!i()||!o||!r)return;const h=Qr(o,e.path),{before:w,after:v}=b(),x=`${e.scopeKey}:diff:${e.path}:before`,O=`${e.scopeKey}:diff:${e.path}:after`,$=rn({monaco:o,cacheKey:x,value:w}),S=rn({monaco:o,cacheKey:O,value:v});r.setModel({original:$,modified:S}),Yr(h).then(()=>{try{o.editor.setModelLanguage($,h),o.editor.setModelLanguage(S,h)}catch{}})}),(()=>{var h=kc(),w=h.firstChild,v=n;return typeof v=="function"?sn(v,h):n=h,mt(w,ue(ao,{get when(){return p()},children:x=>(()=>{var O=$c(),$=O.firstChild;return O.addEventListener("mouseleave",()=>{m(!1),_()}),O.addEventListener("mouseenter",()=>{m(!0),_()}),$.$$click=S=>{var N;S.preventDefault(),S.stopPropagation();const E=tt();E&&((N=e.onRequestInsertContext)==null||N.call(e,E))},$.$$mousedown=S=>{S.preventDefault(),S.stopPropagation()},ce(S=>{var E=`${x().top}px`,N=`${x().left}px`,q=e.insertContextLabel??"Add git change context to prompt",fe=e.insertContextLabel??"Add git change context to prompt";return E!==S.e&&bn(O,"top",S.e=E),N!==S.t&&bn(O,"left",S.t=N),q!==S.a&&qe($,"aria-label",S.a=q),fe!==S.o&&qe($,"title",S.o=fe),S},{e:void 0,t:void 0,a:void 0,o:void 0}),O})()})),h})()}qn(["mousedown","click"]);const sl=Object.freeze(Object.defineProperty({__proto__:null,MonacoDiffViewer:Mc},Symbol.toStringTag,{value:"Module"}));var Ec=on("<div class=monaco-viewer>");function Pc(e){const{isDark:t}=qr();let n,r=null,o=null;const[s,i]=M(!1),a=()=>{try{r==null||r.setModel(null)}catch{}try{r==null||r.dispose()}catch{}r=null},c=()=>{!r||!e.onSave||e.onSave(r.getValue())};return $t(()=>{let l=!1;(async()=>(o=await Zr(),!l&&(!n||!o||(o.editor.setTheme(t()?"vs-dark":"vs"),r=o.editor.create(n,{value:"",language:"plaintext",readOnly:!1,automaticLayout:!0,lineNumbers:"on",minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"off",renderWhitespace:"selection",fontSize:13}),r.addCommand(o.KeyMod.CtrlCmd|o.KeyCode.KeyS,c),r.onDidChangeModelContent(()=>{e.onContentChange&&e.onContentChange(r.getValue())}),i(!0)))))(),le(()=>{l=!0,i(!1),a()})}),K(()=>{!s()||!o||!r||o.editor.setTheme(t()?"vs-dark":"vs")}),K(()=>{!s()||!r||r.updateOptions({wordWrap:e.wordWrap==="on"?"on":"off"})}),K(()=>{if(!s()||!o||!r)return;const l=Qr(o,e.path),u=`${e.scopeKey}:file:${e.path}`,d=rn({monaco:o,cacheKey:u,value:e.content});r.setModel(d),Yr(l).then(()=>{try{o.editor.setModelLanguage(d,l)}catch{}})}),(()=>{var l=Ec(),u=n;return typeof u=="function"?sn(u,l):n=l,l})()}const il=Object.freeze(Object.defineProperty({__proto__:null,MonacoFileViewer:Pc},Symbol.toStringTag,{value:"Module"}));export{Rr as $,ka as A,It as B,Yc as C,Nc as D,Wa as E,vo as F,Xc as G,jc as H,Gr as I,di as J,Wc as K,Jc as L,hi as M,$r as N,Vc as O,Rc as P,Kc as Q,_s as R,Hc as S,zc as T,qc as U,No as V,Gc as W,Vo as X,jo as Y,qr as Z,ol as _,xo as a,Fr as a0,Zc as a1,va as a2,$a as a3,ca as a4,el as a5,tl as a6,Y as a7,Fc as a8,Qc as a9,rl as aa,nl as ab,uc as ac,sl as ad,il as ae,Xn as b,Uc as c,qe as d,fr as e,qn as f,bn as g,Oo as h,mt as i,ee as j,Ce as k,Vt as l,bo as m,ja as n,re as o,_c as p,_a as q,Bc as r,ko as s,on as t,sn as u,B as v,qi as w,jn as x,Se as y,xa as z};
@@ -0,0 +1,59 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-viewer-CersJruo.js","assets/monaco-viewer-B3iAKbO0.js","assets/git-diff-vendor-CSgooKT_.js","assets/fast-diff-vendor-DgdwVvTQ.js","assets/highlight-vendor-8FKMu9os.js","assets/git-diff-vendor-HAZkIolJ.css","assets/main-CXJTHRp1.js","assets/index-DskBWxXS.js","assets/index-i5UooSrU.css"])))=>i.map(i=>d[i]);
2
+ import{t as B,i as w,u as qe,a as Ie,d as j,m as $e,f as it,h as Qe,E as os,Z as ls,g as ut,k as as}from"./monaco-viewer-B3iAKbO0.js";import{n as A,m as Cn,b as ve,c as _,F as Lt,S as W,a as te,d as re,A as cs,z as us,t as fs,o as gn}from"./git-diff-vendor-CSgooKT_.js";import{I as On,g as ds,a as gs,b as kn,c as In,u as hs,d as ms,e as Mt,C as jt,S as ys,M as bs,m as ps,f as ws,r as Ss,h as vs,i as En,j as $s,k as Cs,A as hn,l as Os,n as ks,o as Is,p as Es,q as As,s as Ts,t as Ns,v as _s,w as Ls,V as Ms,L as js,x as Ds,y as Ps,z as Vs,B as mn,D as Rs,E as Bs,F as Fs,G as Ks}from"./main-CXJTHRp1.js";import{u as Bt,_ as Js}from"./index-DskBWxXS.js";import{A as qs}from"./align-justify-CKbOni6U.js";import{W as Qs}from"./wrap-text-hwXbREuU.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";const Us=[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]],Ws=e=>A(On,Cn(e,{name:"Hourglass",iconNode:Us})),xs=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Hs=e=>A(On,Cn(e,{name:"XCircle",iconNode:xs})),Ft=Symbol.for("yaml.alias"),Dt=Symbol.for("yaml.document"),Ne=Symbol.for("yaml.map"),An=Symbol.for("yaml.pair"),St=Symbol.for("yaml.scalar"),We=Symbol.for("yaml.seq"),ge=Symbol.for("yaml.node.type"),De=e=>!!e&&typeof e=="object"&&e[ge]===Ft,rt=e=>!!e&&typeof e=="object"&&e[ge]===Dt,ot=e=>!!e&&typeof e=="object"&&e[ge]===Ne,z=e=>!!e&&typeof e=="object"&&e[ge]===An,q=e=>!!e&&typeof e=="object"&&e[ge]===St,lt=e=>!!e&&typeof e=="object"&&e[ge]===We;function x(e){if(e&&typeof e=="object")switch(e[ge]){case Ne:case We:return!0}return!1}function H(e){if(e&&typeof e=="object")switch(e[ge]){case Ft:case Ne:case St:case We:return!0}return!1}const Tn=e=>(q(e)||x(e))&&!!e.anchor,Le=Symbol("break visit"),Ys=Symbol("skip children"),tt=Symbol("remove node");function xe(e,t){const n=zs(t);rt(e)?Re(null,e.contents,n,Object.freeze([e]))===tt&&(e.contents=null):Re(null,e,n,Object.freeze([]))}xe.BREAK=Le;xe.SKIP=Ys;xe.REMOVE=tt;function Re(e,t,n,s){const i=Gs(e,t,n,s);if(H(i)||z(i))return Xs(e,s,i),Re(e,i,n,s);if(typeof i!="symbol"){if(x(t)){s=Object.freeze(s.concat(t));for(let r=0;r<t.items.length;++r){const o=Re(r,t.items[r],n,s);if(typeof o=="number")r=o-1;else{if(o===Le)return Le;o===tt&&(t.items.splice(r,1),r-=1)}}}else if(z(t)){s=Object.freeze(s.concat(t));const r=Re("key",t.key,n,s);if(r===Le)return Le;r===tt&&(t.key=null);const o=Re("value",t.value,n,s);if(o===Le)return Le;o===tt&&(t.value=null)}}return i}function zs(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Gs(e,t,n,s){var i,r,o,l,c;if(typeof n=="function")return n(e,t,s);if(ot(t))return(i=n.Map)==null?void 0:i.call(n,e,t,s);if(lt(t))return(r=n.Seq)==null?void 0:r.call(n,e,t,s);if(z(t))return(o=n.Pair)==null?void 0:o.call(n,e,t,s);if(q(t))return(l=n.Scalar)==null?void 0:l.call(n,e,t,s);if(De(t))return(c=n.Alias)==null?void 0:c.call(n,e,t,s)}function Xs(e,t,n){const s=t[t.length-1];if(x(s))s.items[e]=n;else if(z(s))e==="key"?s.key=n:s.value=n;else if(rt(s))s.contents=n;else{const i=De(s)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const Zs={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ei=e=>e.replace(/[!,[\]{}]/g,t=>Zs[t]);class ie{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},ie.defaultYaml,t),this.tags=Object.assign({},ie.defaultTags,n)}clone(){const t=new ie(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new ie(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:ie.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},ie.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:ie.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},ie.defaultTags),this.atNextDocument=!1);const s=t.trim().split(/[ \t]+/),i=s.shift();switch(i){case"%TAG":{if(s.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;const[r,o]=s;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[r]=s;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{const o=/^\d+\.\d+$/.test(r);return n(6,`Unsupported YAML version ${r}`,o),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const o=t.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}const[,s,i]=t.match(/^(.*!)([^!]*)$/s);i||n(`The ${t} tag has no suffix`);const r=this.tags[s];if(r)try{return r+decodeURIComponent(i)}catch(o){return n(String(o)),null}return s==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,s]of Object.entries(this.tags))if(t.startsWith(s))return n+ei(t.substring(s.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags);let i;if(t&&s.length>0&&H(t.contents)){const r={};xe(t.contents,(o,l)=>{H(l)&&l.tag&&(r[l.tag]=!0)}),i=Object.keys(r)}else i=[];for(const[r,o]of s)r==="!!"&&o==="tag:yaml.org,2002:"||(!t||i.some(l=>l.startsWith(o)))&&n.push(`%TAG ${r} ${o}`);return n.join(`
3
+ `)}}ie.defaultYaml={explicit:!1,version:"1.2"};ie.defaultTags={"!!":"tag:yaml.org,2002:"};function Nn(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function _n(e){const t=new Set;return xe(e,{Value(n,s){s.anchor&&t.add(s.anchor)}}),t}function Ln(e,t){for(let n=1;;++n){const s=`${e}${n}`;if(!t.has(s))return s}}function ti(e,t){const n=[],s=new Map;let i=null;return{onAnchor:r=>{n.push(r),i??(i=_n(e));const o=Ln(t,i);return i.add(o),o},setAnchors:()=>{for(const r of n){const o=s.get(r);if(typeof o=="object"&&o.anchor&&(q(o.node)||x(o.node)))o.node.anchor=o.anchor;else{const l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=r,l}}},sourceObjects:s}}function Be(e,t,n,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let i=0,r=s.length;i<r;++i){const o=s[i],l=Be(e,s,String(i),o);l===void 0?delete s[i]:l!==o&&(s[i]=l)}else if(s instanceof Map)for(const i of Array.from(s.keys())){const r=s.get(i),o=Be(e,s,i,r);o===void 0?s.delete(i):o!==r&&s.set(i,o)}else if(s instanceof Set)for(const i of Array.from(s)){const r=Be(e,s,i,i);r===void 0?s.delete(i):r!==i&&(s.delete(i),s.add(r))}else for(const[i,r]of Object.entries(s)){const o=Be(e,s,i,r);o===void 0?delete s[i]:o!==r&&(s[i]=o)}return e.call(t,n,s)}function fe(e,t,n){if(Array.isArray(e))return e.map((s,i)=>fe(s,String(i),n));if(e&&typeof e.toJSON=="function"){if(!n||!Tn(e))return e.toJSON(t,n);const s={aliasCount:0,count:1,res:void 0};n.anchors.set(e,s),n.onCreate=r=>{s.res=r,delete n.onCreate};const i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e=="bigint"&&!(n!=null&&n.keep)?Number(e):e}class Kt{constructor(t){Object.defineProperty(this,ge,{value:t})}clone(){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:s,onAnchor:i,reviver:r}={}){if(!rt(t))throw new TypeError("A document argument is required");const o={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},l=fe(this,"",o);if(typeof i=="function")for(const{count:c,res:a}of o.anchors.values())i(a,c);return typeof r=="function"?Be(r,{"":l},"",l):l}}class Mn extends Kt{constructor(t){super(Ft),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){let s;n!=null&&n.aliasResolveCache?s=n.aliasResolveCache:(s=[],xe(t,{Node:(r,o)=>{(De(o)||Tn(o))&&s.push(o)}}),n&&(n.aliasResolveCache=s));let i;for(const r of s){if(r===this)break;r.anchor===this.source&&(i=r)}return i}toJSON(t,n){if(!n)return{source:this.source};const{anchors:s,doc:i,maxAliasCount:r}=n,o=this.resolve(i,n);if(!o){const c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let l=s.get(o);if(l||(fe(o,null,n),l=s.get(o)),(l==null?void 0:l.res)===void 0){const c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(r>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=ht(i,o,s)),l.count*l.aliasCount>r)){const c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return l.res}toString(t,n,s){const i=`*${this.source}`;if(t){if(Nn(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(t.implicitKey)return`${i} `}return i}}function ht(e,t,n){if(De(t)){const s=t.resolve(e),i=n&&s&&n.get(s);return i?i.count*i.aliasCount:0}else if(x(t)){let s=0;for(const i of t.items){const r=ht(e,i,n);r>s&&(s=r)}return s}else if(z(t)){const s=ht(e,t.key,n),i=ht(e,t.value,n);return Math.max(s,i)}return 1}const jn=e=>!e||typeof e!="function"&&typeof e!="object";class D extends Kt{constructor(t){super(St),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:fe(this.value,t,n)}toString(){return String(this.value)}}D.BLOCK_FOLDED="BLOCK_FOLDED";D.BLOCK_LITERAL="BLOCK_LITERAL";D.PLAIN="PLAIN";D.QUOTE_DOUBLE="QUOTE_DOUBLE";D.QUOTE_SINGLE="QUOTE_SINGLE";const ni="tag:yaml.org,2002:";function si(e,t,n){if(t){const s=n.filter(r=>r.tag===t),i=s.find(r=>!r.format)??s[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return n.find(s=>{var i;return((i=s.identify)==null?void 0:i.call(s,e))&&!s.format})}function st(e,t,n){var p,v,$;if(rt(e)&&(e=e.contents),H(e))return e;if(z(e)){const g=(v=(p=n.schema[Ne]).createNode)==null?void 0:v.call(p,n.schema,null,n);return g.items.push(e),g}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:s,onAnchor:i,onTagObj:r,schema:o,sourceObjects:l}=n;let c;if(s&&e&&typeof e=="object"){if(c=l.get(e),c)return c.anchor??(c.anchor=i(e)),new Mn(c.anchor);c={anchor:null,node:null},l.set(e,c)}t!=null&&t.startsWith("!!")&&(t=ni+t.slice(2));let a=si(e,t,o.tags);if(!a){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const g=new D(e);return c&&(c.node=g),g}a=e instanceof Map?o[Ne]:Symbol.iterator in Object(e)?o[We]:o[Ne]}r&&(r(a),delete n.onTagObj);const b=a!=null&&a.createNode?a.createNode(n.schema,e,n):typeof(($=a==null?void 0:a.nodeClass)==null?void 0:$.from)=="function"?a.nodeClass.from(n.schema,e,n):new D(e);return t?b.tag=t:a.default||(b.tag=a.tag),c&&(c.node=b),b}function bt(e,t,n){let s=n;for(let i=t.length-1;i>=0;--i){const r=t[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){const o=[];o[r]=s,s=o}else s=new Map([[r,s]])}return st(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const et=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;class Dn extends Kt{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){const n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(s=>H(s)||z(s)?s.clone(t):s),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(et(t))this.add(n);else{const[s,...i]=t,r=this.get(s,!0);if(x(r))r.addIn(i,n);else if(r===void 0&&this.schema)this.set(s,bt(this.schema,i,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}deleteIn(t){const[n,...s]=t;if(s.length===0)return this.delete(n);const i=this.get(n,!0);if(x(i))return i.deleteIn(s);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}getIn(t,n){const[s,...i]=t,r=this.get(s,!0);return i.length===0?!n&&q(r)?r.value:r:x(r)?r.getIn(i,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!z(n))return!1;const s=n.value;return s==null||t&&q(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(t){const[n,...s]=t;if(s.length===0)return this.has(n);const i=this.get(n,!0);return x(i)?i.hasIn(s):!1}setIn(t,n){const[s,...i]=t;if(i.length===0)this.set(s,n);else{const r=this.get(s,!0);if(x(r))r.setIn(i,n);else if(r===void 0&&this.schema)this.set(s,bt(this.schema,i,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}}const ii=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function ke(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const Me=(e,t,n)=>e.endsWith(`
4
+ `)?ke(n,t):n.includes(`
5
+ `)?`
6
+ `+ke(n,t):(e.endsWith(" ")?"":" ")+n,Pn="flow",Pt="block",mt="quoted";function vt(e,t,n="flow",{indentAtStart:s,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:l}={}){if(!i||i<0)return e;i<r&&(r=0);const c=Math.max(1+r,1+i-t.length);if(e.length<=c)return e;const a=[],b={};let p=i-t.length;typeof s=="number"&&(s>i-Math.max(2,r)?a.push(0):p=i-s);let v,$,g=!1,u=-1,f=-1,d=-1;n===Pt&&(u=yn(e,u,t.length),u!==-1&&(p=u+c));for(let S;S=e[u+=1];){if(n===mt&&S==="\\"){switch(f=u,e[u+1]){case"x":u+=3;break;case"u":u+=5;break;case"U":u+=9;break;default:u+=1}d=u}if(S===`
7
+ `)n===Pt&&(u=yn(e,u,t.length)),p=u+t.length+c,v=void 0;else{if(S===" "&&$&&$!==" "&&$!==`
8
+ `&&$!==" "){const k=e[u+1];k&&k!==" "&&k!==`
9
+ `&&k!==" "&&(v=u)}if(u>=p)if(v)a.push(v),p=v+c,v=void 0;else if(n===mt){for(;$===" "||$===" ";)$=S,S=e[u+=1],g=!0;const k=u>d+1?u-2:f-1;if(b[k])return e;a.push(k),b[k]=!0,p=k+c,v=void 0}else g=!0}$=S}if(g&&l&&l(),a.length===0)return e;o&&o();let y=e.slice(0,a[0]);for(let S=0;S<a.length;++S){const k=a[S],E=a[S+1]||e.length;k===0?y=`
10
+ ${t}${e.slice(0,E)}`:(n===mt&&b[k]&&(y+=`${e[k]}\\`),y+=`
11
+ ${t}${e.slice(k+1,E)}`)}return y}function yn(e,t,n){let s=t,i=t+1,r=e[i];for(;r===" "||r===" ";)if(t<i+n)r=e[++t];else{do r=e[++t];while(r&&r!==`
12
+ `);s=t,i=t+1,r=e[i]}return s}const $t=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Ct=e=>/^(%|---|\.\.\.)/m.test(e);function ri(e,t,n){if(!t||t<0)return!1;const s=t-n,i=e.length;if(i<=s)return!1;for(let r=0,o=0;r<i;++r)if(e[r]===`
13
+ `){if(r-o>s)return!0;if(o=r+1,i-o<=s)return!1}return!0}function nt(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:s}=t,i=t.options.doubleQuotedMinMultiLineLength,r=t.indent||(Ct(e)?" ":"");let o="",l=0;for(let c=0,a=n[c];a;a=n[++c])if(a===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(o+=n.slice(l,c)+"\\ ",c+=1,l=c,a="\\"),a==="\\")switch(n[c+1]){case"u":{o+=n.slice(l,c);const b=n.substr(c+2,4);switch(b){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:b.substr(0,2)==="00"?o+="\\x"+b.substr(2):o+=n.substr(c,6)}c+=5,l=c+1}break;case"n":if(s||n[c+2]==='"'||n.length<i)c+=1;else{for(o+=n.slice(l,c)+`
14
+
15
+ `;n[c+2]==="\\"&&n[c+3]==="n"&&n[c+4]!=='"';)o+=`
16
+ `,c+=2;o+=r,n[c+2]===" "&&(o+="\\"),c+=1,l=c+1}break;default:c+=1}return o=l?o+n.slice(l):n,s?o:vt(o,r,mt,$t(t,!1))}function Vt(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
17
+ `)||/[ \t]\n|\n[ \t]/.test(e))return nt(e,t);const n=t.indent||(Ct(e)?" ":""),s="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
18
+ ${n}`)+"'";return t.implicitKey?s:vt(s,n,Pn,$t(t,!1))}function Fe(e,t){const{singleQuote:n}=t.options;let s;if(n===!1)s=nt;else{const i=e.includes('"'),r=e.includes("'");i&&!r?s=Vt:r&&!i?s=nt:s=n?Vt:nt}return s(e,t)}let Rt;try{Rt=new RegExp(`(^|(?<!
19
+ ))
20
+ +(?!
21
+ |$)`,"g")}catch{Rt=/\n+(?!\n|$)/g}function yt({comment:e,type:t,value:n},s,i,r){const{blockQuote:o,commentString:l,lineWidth:c}=s.options;if(!o||/\n[\t ]+$/.test(n))return Fe(n,s);const a=s.indent||(s.forceBlockIndent||Ct(n)?" ":""),b=o==="literal"?!0:o==="folded"||t===D.BLOCK_FOLDED?!1:t===D.BLOCK_LITERAL?!0:!ri(n,c,a.length);if(!n)return b?`|
22
+ `:`>
23
+ `;let p,v;for(v=n.length;v>0;--v){const E=n[v-1];if(E!==`
24
+ `&&E!==" "&&E!==" ")break}let $=n.substring(v);const g=$.indexOf(`
25
+ `);g===-1?p="-":n===$||g!==$.length-1?(p="+",r&&r()):p="",$&&(n=n.slice(0,-$.length),$[$.length-1]===`
26
+ `&&($=$.slice(0,-1)),$=$.replace(Rt,`$&${a}`));let u=!1,f,d=-1;for(f=0;f<n.length;++f){const E=n[f];if(E===" ")u=!0;else if(E===`
27
+ `)d=f;else break}let y=n.substring(0,d<f?d+1:f);y&&(n=n.substring(y.length),y=y.replace(/\n+/g,`$&${a}`));let k=(u?a?"2":"1":"")+p;if(e&&(k+=" "+l(e.replace(/ ?[\r\n]+/g," ")),i&&i()),!b){const E=n.replace(/\n+/g,`
28
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${a}`);let P=!1;const N=$t(s,!0);o!=="folded"&&t!==D.BLOCK_FOLDED&&(N.onOverflow=()=>{P=!0});const R=vt(`${y}${E}${$}`,a,Pt,N);if(!P)return`>${k}
29
+ ${a}${R}`}return n=n.replace(/\n+/g,`$&${a}`),`|${k}
30
+ ${a}${y}${n}${$}`}function oi(e,t,n,s){const{type:i,value:r}=e,{actualString:o,implicitKey:l,indent:c,indentStep:a,inFlow:b}=t;if(l&&r.includes(`
31
+ `)||b&&/[[\]{},]/.test(r))return Fe(r,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return l||b||!r.includes(`
32
+ `)?Fe(r,t):yt(e,t,n,s);if(!l&&!b&&i!==D.PLAIN&&r.includes(`
33
+ `))return yt(e,t,n,s);if(Ct(r)){if(c==="")return t.forceBlockIndent=!0,yt(e,t,n,s);if(l&&c===a)return Fe(r,t)}const p=r.replace(/\n+/g,`$&
34
+ ${c}`);if(o){const v=u=>{var f;return u.default&&u.tag!=="tag:yaml.org,2002:str"&&((f=u.test)==null?void 0:f.test(p))},{compat:$,tags:g}=t.doc.schema;if(g.some(v)||$!=null&&$.some(v))return Fe(r,t)}return l?p:vt(p,c,Pn,$t(t,!1))}function Jt(e,t,n,s){const{implicitKey:i,inFlow:r}=t,o=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)});let{type:l}=e;l!==D.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(l=D.QUOTE_DOUBLE);const c=b=>{switch(b){case D.BLOCK_FOLDED:case D.BLOCK_LITERAL:return i||r?Fe(o.value,t):yt(o,t,n,s);case D.QUOTE_DOUBLE:return nt(o.value,t);case D.QUOTE_SINGLE:return Vt(o.value,t);case D.PLAIN:return oi(o,t,n,s);default:return null}};let a=c(l);if(a===null){const{defaultKeyType:b,defaultStringType:p}=t.options,v=i&&b||p;if(a=c(v),a===null)throw new Error(`Unsupported default string type ${v}`)}return a}function Vn(e,t){const n=Object.assign({blockQuote:!0,commentString:ii,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t);let s;switch(n.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:s,options:n}}function li(e,t){var i;if(t.tag){const r=e.filter(o=>o.tag===t.tag);if(r.length>0)return r.find(o=>o.format===t.format)??r[0]}let n,s;if(q(t)){s=t.value;let r=e.filter(o=>{var l;return(l=o.identify)==null?void 0:l.call(o,s)});if(r.length>1){const o=r.filter(l=>l.test);o.length>0&&(r=o)}n=r.find(o=>o.format===t.format)??r.find(o=>!o.format)}else s=t,n=e.find(r=>r.nodeClass&&s instanceof r.nodeClass);if(!n){const r=((i=s==null?void 0:s.constructor)==null?void 0:i.name)??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${r} value`)}return n}function ai(e,t,{anchors:n,doc:s}){if(!s.directives)return"";const i=[],r=(q(e)||x(e))&&e.anchor;r&&Nn(r)&&(n.add(r),i.push(`&${r}`));const o=e.tag??(t.default?null:t.tag);return o&&i.push(s.directives.tagString(o)),i.join(" ")}function Ue(e,t,n,s){var c;if(z(e))return e.toString(t,n,s);if(De(e)){if(t.doc.directives)return e.toString(t);if((c=t.resolvedAliases)!=null&&c.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i;const r=H(e)?e:t.doc.createNode(e,{onTagObj:a=>i=a});i??(i=li(t.doc.schema.tags,r));const o=ai(r,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);const l=typeof i.stringify=="function"?i.stringify(r,t,n,s):q(r)?Jt(r,t,n,s):r.toString(t,n,s);return o?q(r)||l[0]==="{"||l[0]==="["?`${o} ${l}`:`${o}
35
+ ${t.indent}${l}`:l}function ci({key:e,value:t},n,s,i){const{allNullValues:r,doc:o,indent:l,indentStep:c,options:{commentString:a,indentSeq:b,simpleKeys:p}}=n;let v=H(e)&&e.comment||null;if(p){if(v)throw new Error("With simple keys, key nodes cannot have comments");if(x(e)||!H(e)&&typeof e=="object"){const N="With simple keys, collection cannot be used as a key value";throw new Error(N)}}let $=!p&&(!e||v&&t==null&&!n.inFlow||x(e)||(q(e)?e.type===D.BLOCK_FOLDED||e.type===D.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!$&&(p||!r),indent:l+c});let g=!1,u=!1,f=Ue(e,n,()=>g=!0,()=>u=!0);if(!$&&!n.inFlow&&f.length>1024){if(p)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");$=!0}if(n.inFlow){if(r||t==null)return g&&s&&s(),f===""?"?":$?`? ${f}`:f}else if(r&&!p||t==null&&$)return f=`? ${f}`,v&&!g?f+=Me(f,n.indent,a(v)):u&&i&&i(),f;g&&(v=null),$?(v&&(f+=Me(f,n.indent,a(v))),f=`? ${f}
36
+ ${l}:`):(f=`${f}:`,v&&(f+=Me(f,n.indent,a(v))));let d,y,S;H(t)?(d=!!t.spaceBefore,y=t.commentBefore,S=t.comment):(d=!1,y=null,S=null,t&&typeof t=="object"&&(t=o.createNode(t))),n.implicitKey=!1,!$&&!v&&q(t)&&(n.indentAtStart=f.length+1),u=!1,!b&&c.length>=2&&!n.inFlow&&!$&&lt(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let k=!1;const E=Ue(t,n,()=>k=!0,()=>u=!0);let P=" ";if(v||d||y){if(P=d?`
37
+ `:"",y){const N=a(y);P+=`
38
+ ${ke(N,n.indent)}`}E===""&&!n.inFlow?P===`
39
+ `&&S&&(P=`
40
+
41
+ `):P+=`
42
+ ${n.indent}`}else if(!$&&x(t)){const N=E[0],R=E.indexOf(`
43
+ `),K=R!==-1,Q=n.inFlow??t.flow??t.items.length===0;if(K||!Q){let Z=!1;if(K&&(N==="&"||N==="!")){let F=E.indexOf(" ");N==="&"&&F!==-1&&F<R&&E[F+1]==="!"&&(F=E.indexOf(" ",F+1)),(F===-1||R<F)&&(Z=!0)}Z||(P=`
44
+ ${n.indent}`)}}else(E===""||E[0]===`
45
+ `)&&(P="");return f+=P+E,n.inFlow?k&&s&&s():S&&!k?f+=Me(f,n.indent,a(S)):u&&i&&i(),f}function ui(e,t){(e==="debug"||e==="warn")&&console.warn(t)}const ft="<<",Ee={identify:e=>e===ft||typeof e=="symbol"&&e.description===ft,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new D(Symbol(ft)),{addToJSMap:Rn}),stringify:()=>ft},fi=(e,t)=>(Ee.identify(t)||q(t)&&(!t.type||t.type===D.PLAIN)&&Ee.identify(t.value))&&(e==null?void 0:e.doc.schema.tags.some(n=>n.tag===Ee.tag&&n.default));function Rn(e,t,n){if(n=e&&De(n)?n.resolve(e.doc):n,lt(n))for(const s of n.items)Nt(e,t,s);else if(Array.isArray(n))for(const s of n)Nt(e,t,s);else Nt(e,t,n)}function Nt(e,t,n){const s=e&&De(n)?n.resolve(e.doc):n;if(!ot(s))throw new Error("Merge sources must be maps or map aliases");const i=s.toJSON(null,e,Map);for(const[r,o]of i)t instanceof Map?t.has(r)||t.set(r,o):t instanceof Set?t.add(r):Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return t}function Bn(e,t,{key:n,value:s}){if(H(n)&&n.addToJSMap)n.addToJSMap(e,t,s);else if(fi(e,n))Rn(e,t,s);else{const i=fe(n,"",e);if(t instanceof Map)t.set(i,fe(s,i,e));else if(t instanceof Set)t.add(i);else{const r=di(n,i,e),o=fe(s,r,e);r in t?Object.defineProperty(t,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[r]=o}}return t}function di(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(H(e)&&(n!=null&&n.doc)){const s=Vn(n.doc,{});s.anchors=new Set;for(const r of n.anchors.keys())s.anchors.add(r.anchor);s.inFlow=!0,s.inStringifyKey=!0;const i=e.toString(s);if(!n.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),ui(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(t)}function qt(e,t,n){const s=st(e,void 0,n),i=st(t,void 0,n);return new de(s,i)}class de{constructor(t,n=null){Object.defineProperty(this,ge,{value:An}),this.key=t,this.value=n}clone(t){let{key:n,value:s}=this;return H(n)&&(n=n.clone(t)),H(s)&&(s=s.clone(t)),new de(n,s)}toJSON(t,n){const s=n!=null&&n.mapAsMap?new Map:{};return Bn(n,s,this)}toString(t,n,s){return t!=null&&t.doc?ci(this,t,n,s):JSON.stringify(this)}}function Fn(e,t,n){return(t.inFlow??e.flow?hi:gi)(e,t,n)}function gi({comment:e,items:t},n,{blockItemPrefix:s,flowChars:i,itemIndent:r,onChompKeep:o,onComment:l}){const{indent:c,options:{commentString:a}}=n,b=Object.assign({},n,{indent:r,type:null});let p=!1;const v=[];for(let g=0;g<t.length;++g){const u=t[g];let f=null;if(H(u))!p&&u.spaceBefore&&v.push(""),pt(n,v,u.commentBefore,p),u.comment&&(f=u.comment);else if(z(u)){const y=H(u.key)?u.key:null;y&&(!p&&y.spaceBefore&&v.push(""),pt(n,v,y.commentBefore,p))}p=!1;let d=Ue(u,b,()=>f=null,()=>p=!0);f&&(d+=Me(d,r,a(f))),p&&f&&(p=!1),v.push(s+d)}let $;if(v.length===0)$=i.start+i.end;else{$=v[0];for(let g=1;g<v.length;++g){const u=v[g];$+=u?`
46
+ ${c}${u}`:`
47
+ `}}return e?($+=`
48
+ `+ke(a(e),c),l&&l()):p&&o&&o(),$}function hi({items:e},t,{flowChars:n,itemIndent:s}){const{indent:i,indentStep:r,flowCollectionPadding:o,options:{commentString:l}}=t;s+=r;const c=Object.assign({},t,{indent:s,inFlow:!0,type:null});let a=!1,b=0;const p=[];for(let g=0;g<e.length;++g){const u=e[g];let f=null;if(H(u))u.spaceBefore&&p.push(""),pt(t,p,u.commentBefore,!1),u.comment&&(f=u.comment);else if(z(u)){const y=H(u.key)?u.key:null;y&&(y.spaceBefore&&p.push(""),pt(t,p,y.commentBefore,!1),y.comment&&(a=!0));const S=H(u.value)?u.value:null;S?(S.comment&&(f=S.comment),S.commentBefore&&(a=!0)):u.value==null&&(y!=null&&y.comment)&&(f=y.comment)}f&&(a=!0);let d=Ue(u,c,()=>f=null);a||(a=p.length>b||d.includes(`
49
+ `)),g<e.length-1?d+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(a||(a=p.reduce((y,S)=>y+S.length+2,2)+(d.length+2)>t.options.lineWidth)),a&&(d+=",")),f&&(d+=Me(d,s,l(f))),p.push(d),b=p.length}const{start:v,end:$}=n;if(p.length===0)return v+$;if(!a){const g=p.reduce((u,f)=>u+f.length+2,2);a=t.options.lineWidth>0&&g>t.options.lineWidth}if(a){let g=v;for(const u of p)g+=u?`
50
+ ${r}${i}${u}`:`
51
+ `;return`${g}
52
+ ${i}${$}`}else return`${v}${o}${p.join(" ")}${o}${$}`}function pt({indent:e,options:{commentString:t}},n,s,i){if(s&&i&&(s=s.replace(/^\n+/,"")),s){const r=ke(t(s),e);n.push(r.trimStart())}}function je(e,t){const n=q(t)?t.value:t;for(const s of e)if(z(s)&&(s.key===t||s.key===n||q(s.key)&&s.key.value===n))return s}class Te extends Dn{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Ne,t),this.items=[]}static from(t,n,s){const{keepUndefined:i,replacer:r}=s,o=new this(t),l=(c,a)=>{if(typeof r=="function")a=r.call(n,c,a);else if(Array.isArray(r)&&!r.includes(c))return;(a!==void 0||i)&&o.items.push(qt(c,a,s))};if(n instanceof Map)for(const[c,a]of n)l(c,a);else if(n&&typeof n=="object")for(const c of Object.keys(n))l(c,n[c]);return typeof t.sortMapEntries=="function"&&o.items.sort(t.sortMapEntries),o}add(t,n){var o;let s;z(t)?s=t:!t||typeof t!="object"||!("key"in t)?s=new de(t,t==null?void 0:t.value):s=new de(t.key,t.value);const i=je(this.items,s.key),r=(o=this.schema)==null?void 0:o.sortMapEntries;if(i){if(!n)throw new Error(`Key ${s.key} already set`);q(i.value)&&jn(s.value)?i.value.value=s.value:i.value=s.value}else if(r){const l=this.items.findIndex(c=>r(s,c)<0);l===-1?this.items.push(s):this.items.splice(l,0,s)}else this.items.push(s)}delete(t){const n=je(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const s=je(this.items,t),i=s==null?void 0:s.value;return(!n&&q(i)?i.value:i)??void 0}has(t){return!!je(this.items,t)}set(t,n){this.add(new de(t,n),!0)}toJSON(t,n,s){const i=s?new s:n!=null&&n.mapAsMap?new Map:{};n!=null&&n.onCreate&&n.onCreate(i);for(const r of this.items)Bn(n,i,r);return i}toString(t,n,s){if(!t)return JSON.stringify(this);for(const i of this.items)if(!z(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),Fn(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:s,onComment:n})}}const He={collection:"map",default:!0,nodeClass:Te,tag:"tag:yaml.org,2002:map",resolve(e,t){return ot(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Te.from(e,t,n)};class wt extends Dn{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(We,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=dt(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const s=dt(t);if(typeof s!="number")return;const i=this.items[s];return!n&&q(i)?i.value:i}has(t){const n=dt(t);return typeof n=="number"&&n<this.items.length}set(t,n){const s=dt(t);if(typeof s!="number")throw new Error(`Expected a valid index, not ${t}.`);const i=this.items[s];q(i)&&jn(n)?i.value=n:this.items[s]=n}toJSON(t,n){const s=[];n!=null&&n.onCreate&&n.onCreate(s);let i=0;for(const r of this.items)s.push(fe(r,String(i++),n));return s}toString(t,n,s){return t?Fn(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:s,onComment:n}):JSON.stringify(this)}static from(t,n,s){const{replacer:i}=s,r=new this(t);if(n&&Symbol.iterator in Object(n)){let o=0;for(let l of n){if(typeof i=="function"){const c=n instanceof Set?l:String(o++);l=i.call(n,c,l)}r.items.push(st(l,void 0,s))}}return r}}function dt(e){let t=q(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}const Ye={collection:"seq",default:!0,nodeClass:wt,tag:"tag:yaml.org,2002:seq",resolve(e,t){return lt(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>wt.from(e,t,n)},Ot={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,s){return t=Object.assign({actualString:!0},t),Jt(e,t,n,s)}},kt={identify:e=>e==null,createNode:()=>new D(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new D(null),stringify:({source:e},t)=>typeof e=="string"&&kt.test.test(e)?e:t.options.nullStr},Qt={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new D(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&Qt.test.test(e)){const s=e[0]==="t"||e[0]==="T";if(t===s)return e}return t?n.options.trueStr:n.options.falseStr}};function we({format:e,minFractionDigits:t,tag:n,value:s}){if(typeof s=="bigint")return String(s);const i=typeof s=="number"?s:Number(s);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=Object.is(s,-0)?"-0":JSON.stringify(s);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let l=t-(r.length-o-1);for(;l-- >0;)r+="0"}return r}const Kn={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:we},Jn={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():we(e)}},qn={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){const t=new D(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:we},It=e=>typeof e=="bigint"||Number.isInteger(e),Ut=(e,t,n,{intAsBigInt:s})=>s?BigInt(e):parseInt(e.substring(t),n);function Qn(e,t,n){const{value:s}=e;return It(s)&&s>=0?n+s.toString(t):we(e)}const Un={identify:e=>It(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>Ut(e,2,8,n),stringify:e=>Qn(e,8,"0o")},Wn={identify:It,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>Ut(e,0,10,n),stringify:we},xn={identify:e=>It(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>Ut(e,2,16,n),stringify:e=>Qn(e,16,"0x")},mi=[He,Ye,Ot,kt,Qt,Un,Wn,xn,Kn,Jn,qn];function bn(e){return typeof e=="bigint"||Number.isInteger(e)}const gt=({value:e})=>JSON.stringify(e),yi=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:gt},{identify:e=>e==null,createNode:()=>new D(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:gt},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:gt},{identify:bn,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>bn(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:gt}],bi={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},pi=[He,Ye].concat(yi,bi),Wt={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){const n=atob(e.replace(/[\n\r]/g,"")),s=new Uint8Array(n.length);for(let i=0;i<n.length;++i)s[i]=n.charCodeAt(i);return s}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},s,i,r){if(!n)return"";const o=n;let l;if(typeof btoa=="function"){let c="";for(let a=0;a<o.length;++a)c+=String.fromCharCode(o[a]);l=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=D.BLOCK_LITERAL),t!==D.QUOTE_DOUBLE){const c=Math.max(s.options.lineWidth-s.indent.length,s.options.minContentWidth),a=Math.ceil(l.length/c),b=new Array(a);for(let p=0,v=0;p<a;++p,v+=c)b[p]=l.substr(v,c);l=b.join(t===D.BLOCK_LITERAL?`
53
+ `:" ")}return Jt({comment:e,type:t,value:l},s,i,r)}};function Hn(e,t){if(lt(e))for(let n=0;n<e.items.length;++n){let s=e.items[n];if(!z(s)){if(ot(s)){s.items.length>1&&t("Each pair must have its own sequence indicator");const i=s.items[0]||new de(new D(null));if(s.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${s.commentBefore}
54
+ ${i.key.commentBefore}`:s.commentBefore),s.comment){const r=i.value??i.key;r.comment=r.comment?`${s.comment}
55
+ ${r.comment}`:s.comment}s=i}e.items[n]=z(s)?s:new de(s)}}else t("Expected a sequence for this tag");return e}function Yn(e,t,n){const{replacer:s}=n,i=new wt(e);i.tag="tag:yaml.org,2002:pairs";let r=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof s=="function"&&(o=s.call(t,String(r++),o));let l,c;if(Array.isArray(o))if(o.length===2)l=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){const a=Object.keys(o);if(a.length===1)l=a[0],c=o[l];else throw new TypeError(`Expected tuple with one key, not ${a.length} keys`)}else l=o;i.items.push(qt(l,c,n))}return i}const xt={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Hn,createNode:Yn};class Ke extends wt{constructor(){super(),this.add=Te.prototype.add.bind(this),this.delete=Te.prototype.delete.bind(this),this.get=Te.prototype.get.bind(this),this.has=Te.prototype.has.bind(this),this.set=Te.prototype.set.bind(this),this.tag=Ke.tag}toJSON(t,n){if(!n)return super.toJSON(t);const s=new Map;n!=null&&n.onCreate&&n.onCreate(s);for(const i of this.items){let r,o;if(z(i)?(r=fe(i.key,"",n),o=fe(i.value,r,n)):r=fe(i,"",n),s.has(r))throw new Error("Ordered maps must not include duplicate keys");s.set(r,o)}return s}static from(t,n,s){const i=Yn(t,n,s),r=new this;return r.items=i.items,r}}Ke.tag="tag:yaml.org,2002:omap";const Ht={collection:"seq",identify:e=>e instanceof Map,nodeClass:Ke,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=Hn(e,t),s=[];for(const{key:i}of n.items)q(i)&&(s.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):s.push(i.value));return Object.assign(new Ke,n)},createNode:(e,t,n)=>Ke.from(e,t,n)};function zn({value:e,source:t},n){return t&&(e?Gn:Xn).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const Gn={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new D(!0),stringify:zn},Xn={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new D(!1),stringify:zn},wi={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:we},Si={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():we(e)}},vi={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){const t=new D(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){const s=e.substring(n+1).replace(/_/g,"");s[s.length-1]==="0"&&(t.minFractionDigits=s.length)}return t},stringify:we},at=e=>typeof e=="bigint"||Number.isInteger(e);function Et(e,t,n,{intAsBigInt:s}){const i=e[0];if((i==="-"||i==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),s){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}const o=BigInt(e);return i==="-"?BigInt(-1)*o:o}const r=parseInt(e,n);return i==="-"?-1*r:r}function Yt(e,t,n){const{value:s}=e;if(at(s)){const i=s.toString(t);return s<0?"-"+n+i.substr(1):n+i}return we(e)}const $i={identify:at,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Et(e,2,2,n),stringify:e=>Yt(e,2,"0b")},Ci={identify:at,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Et(e,1,8,n),stringify:e=>Yt(e,8,"0")},Oi={identify:at,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Et(e,0,10,n),stringify:we},ki={identify:at,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Et(e,2,16,n),stringify:e=>Yt(e,16,"0x")};class Je extends Te{constructor(t){super(t),this.tag=Je.tag}add(t){let n;z(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new de(t.key,null):n=new de(t,null),je(this.items,n.key)||this.items.push(n)}get(t,n){const s=je(this.items,t);return!n&&z(s)?q(s.key)?s.key.value:s.key:s}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);const s=je(this.items,t);s&&!n?this.items.splice(this.items.indexOf(s),1):!s&&n&&this.items.push(new de(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,s){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,s);throw new Error("Set items must all have null values")}static from(t,n,s){const{replacer:i}=s,r=new this(t);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof i=="function"&&(o=i.call(n,o,o)),r.items.push(qt(o,null,s));return r}}Je.tag="tag:yaml.org,2002:set";const zt={collection:"map",identify:e=>e instanceof Set,nodeClass:Je,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Je.from(e,t,n),resolve(e,t){if(ot(e)){if(e.hasAllNullValues(!0))return Object.assign(new Je,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function Gt(e,t){const n=e[0],s=n==="-"||n==="+"?e.substring(1):e,i=o=>t?BigInt(o):Number(o),r=s.replace(/_/g,"").split(":").reduce((o,l)=>o*i(60)+i(l),i(0));return n==="-"?i(-1)*r:r}function Zn(e){let{value:t}=e,n=o=>o;if(typeof t=="bigint")n=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return we(e);let s="";t<0&&(s="-",t*=n(-1));const i=n(60),r=[t%i];return t<60?r.unshift(0):(t=(t-r[0])/i,r.unshift(t%i),t>=60&&(t=(t-r[0])/i,r.unshift(t))),s+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const es={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>Gt(e,n),stringify:Zn},ts={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Gt(e,!1),stringify:Zn},At={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){const t=e.match(At.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,s,i,r,o,l]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0;let a=Date.UTC(n,s-1,i,r||0,o||0,l||0,c);const b=t[8];if(b&&b!=="Z"){let p=Gt(b,!1);Math.abs(p)<30&&(p*=60),a-=6e4*p}return new Date(a)},stringify:({value:e})=>(e==null?void 0:e.toISOString().replace(/(T00:00:00)?\.000Z$/,""))??""},pn=[He,Ye,Ot,kt,Gn,Xn,$i,Ci,Oi,ki,wi,Si,vi,Wt,Ee,Ht,xt,zt,es,ts,At],wn=new Map([["core",mi],["failsafe",[He,Ye,Ot]],["json",pi],["yaml11",pn],["yaml-1.1",pn]]),Sn={binary:Wt,bool:Qt,float:qn,floatExp:Jn,floatNaN:Kn,floatTime:ts,int:Wn,intHex:xn,intOct:Un,intTime:es,map:He,merge:Ee,null:kt,omap:Ht,pairs:xt,seq:Ye,set:zt,timestamp:At},Ii={"tag:yaml.org,2002:binary":Wt,"tag:yaml.org,2002:merge":Ee,"tag:yaml.org,2002:omap":Ht,"tag:yaml.org,2002:pairs":xt,"tag:yaml.org,2002:set":zt,"tag:yaml.org,2002:timestamp":At};function _t(e,t,n){const s=wn.get(t);if(s&&!e)return n&&!s.includes(Ee)?s.concat(Ee):s.slice();let i=s;if(!i)if(Array.isArray(e))i=[];else{const r=Array.from(wn.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${r} or define customTags array`)}if(Array.isArray(e))for(const r of e)i=i.concat(r);else typeof e=="function"&&(i=e(i.slice()));return n&&(i=i.concat(Ee)),i.reduce((r,o)=>{const l=typeof o=="string"?Sn[o]:o;if(!l){const c=JSON.stringify(o),a=Object.keys(Sn).map(b=>JSON.stringify(b)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${a}`)}return r.includes(l)||r.push(l),r},[])}const Ei=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0;class Xt{constructor({compat:t,customTags:n,merge:s,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:l}){this.compat=Array.isArray(t)?_t(t,"compat"):t?_t(null,t):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?Ii:{},this.tags=_t(n,this.name,s),this.toStringOptions=l??null,Object.defineProperty(this,Ne,{value:He}),Object.defineProperty(this,St,{value:Ot}),Object.defineProperty(this,We,{value:Ye}),this.sortMapEntries=typeof o=="function"?o:o===!0?Ei:null}clone(){const t=Object.create(Xt.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}}function Ai(e,t){var c;const n=[];let s=t.directives===!0;if(t.directives!==!1&&e.directives){const a=e.directives.toString(e);a?(n.push(a),s=!0):e.directives.docStart&&(s=!0)}s&&n.push("---");const i=Vn(e,t),{commentString:r}=i.options;if(e.commentBefore){n.length!==1&&n.unshift("");const a=r(e.commentBefore);n.unshift(ke(a,""))}let o=!1,l=null;if(e.contents){if(H(e.contents)){if(e.contents.spaceBefore&&s&&n.push(""),e.contents.commentBefore){const p=r(e.contents.commentBefore);n.push(ke(p,""))}i.forceBlockIndent=!!e.comment,l=e.contents.comment}const a=l?void 0:()=>o=!0;let b=Ue(e.contents,i,()=>l=null,a);l&&(b+=Me(b,"",r(l))),(b[0]==="|"||b[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${b}`:n.push(b)}else n.push(Ue(e.contents,i));if((c=e.directives)!=null&&c.docEnd)if(e.comment){const a=r(e.comment);a.includes(`
56
+ `)?(n.push("..."),n.push(ke(a,""))):n.push(`... ${a}`)}else n.push("...");else{let a=e.comment;a&&o&&(a=a.replace(/^\n+/,"")),a&&((!o||l)&&n[n.length-1]!==""&&n.push(""),n.push(ke(r(a),"")))}return n.join(`
57
+ `)+`
58
+ `}class Zt{constructor(t,n,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ge,{value:Dt});let i=null;typeof n=="function"||Array.isArray(n)?i=n:s===void 0&&n&&(s=n,n=void 0);const r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},s);this.options=r;let{version:o}=r;s!=null&&s._directives?(this.directives=s._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new ie({version:o}),this.setSchema(o,s),this.contents=t===void 0?null:this.createNode(t,i,s)}clone(){const t=Object.create(Zt.prototype,{[ge]:{value:Dt}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=H(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){Ve(this.contents)&&this.contents.add(t)}addIn(t,n){Ve(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const s=_n(this);t.anchor=!n||s.has(n)?Ln(n||"a",s):n}return new Mn(t.anchor)}createNode(t,n,s){let i;if(typeof n=="function")t=n.call({"":t},"",t),i=n;else if(Array.isArray(n)){const f=y=>typeof y=="number"||y instanceof String||y instanceof Number,d=n.filter(f).map(String);d.length>0&&(n=n.concat(d)),i=n}else s===void 0&&n&&(s=n,n=void 0);const{aliasDuplicateObjects:r,anchorPrefix:o,flow:l,keepUndefined:c,onTagObj:a,tag:b}=s??{},{onAnchor:p,setAnchors:v,sourceObjects:$}=ti(this,o||"a"),g={aliasDuplicateObjects:r??!0,keepUndefined:c??!1,onAnchor:p,onTagObj:a,replacer:i,schema:this.schema,sourceObjects:$},u=st(t,b,g);return l&&x(u)&&(u.flow=!0),v(),u}createPair(t,n,s={}){const i=this.createNode(t,null,s),r=this.createNode(n,null,s);return new de(i,r)}delete(t){return Ve(this.contents)?this.contents.delete(t):!1}deleteIn(t){return et(t)?this.contents==null?!1:(this.contents=null,!0):Ve(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return x(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return et(t)?!n&&q(this.contents)?this.contents.value:this.contents:x(this.contents)?this.contents.getIn(t,n):void 0}has(t){return x(this.contents)?this.contents.has(t):!1}hasIn(t){return et(t)?this.contents!==void 0:x(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=bt(this.schema,[t],n):Ve(this.contents)&&this.contents.set(t,n)}setIn(t,n){et(t)?this.contents=n:this.contents==null?this.contents=bt(this.schema,Array.from(t),n):Ve(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let s;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new ie({version:"1.1"}),s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new ie({version:t}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=null;break;default:{const i=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(s)this.schema=new Xt(Object.assign(s,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:s,maxAliasCount:i,onAnchor:r,reviver:o}={}){const l={anchors:new Map,doc:this,keep:!t,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=fe(this.contents,n??"",l);if(typeof r=="function")for(const{count:a,res:b}of l.anchors.values())r(b,a);return typeof o=="function"?Be(o,{"":c},"",c):c}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){const n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return Ai(this,t)}}function Ve(e){if(x(e))return!0;throw new Error("Expected a YAML collection as document contents")}new Set("0123456789ABCDEFabcdef");new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()");new Set(",[]{}");new Set(` ,[]{}
59
+ \r `);function Ti(e,t,n){let s=null;if(Array.isArray(t)&&(s=t),e===void 0){const{keepUndefined:i}={};if(!i)return}return rt(e)&&!s?e.toString(n):new Zt(e,s,n).toString(n)}var Ni=B("<div class=tool-call-permission-error>"),_i=B('<div class="tool-call-permission-actions px-3 pb-3"><div class=tool-call-permission-buttons><button type=button class=tool-call-permission-button></button><button type=button class=tool-call-permission-button></button></div><div class=tool-call-permission-shortcuts><kbd class=kbd>Enter</kbd><span></span><kbd class=kbd>Esc</kbd><span>'),Li=B('<p class="tool-call-permission-queued-text px-3 pb-3">'),Mi=B('<div><div class=tool-call-permission-body><div class="flex flex-col gap-2">'),ji=B('<div class="text-xs text-muted">'),Di=B('<div class="border border-base bg-surface-secondary p-3 text-primary"><div class="flex items-baseline justify-between gap-2"><div class="text-sm text-primary"> <span class=font-semibold></span></div></div><div class="mt-1 text-sm font-medium text-primary"></div><div class="mt-3 flex flex-col gap-1"><label><input class="mt-0.5 accent-[var(--accent-primary)]"><div class="flex flex-1 flex-col gap-2"><div class="text-sm leading-tight text-primary"></div><input class="w-full rounded-md border border-base bg-surface-base px-2 py-1 text-sm text-primary"type=text>'),Pi=B('<label><input class="mt-0.5 accent-[var(--accent-primary)]"><div class="flex flex-col"><div class="text-sm leading-tight text-primary"></div><div class="text-xs text-muted leading-tight">');function Vi(e){const{t}=Bt();let n;ve(()=>{e.active()&&n&&n.focus()});const s=_(()=>{var f;const g=e.toolState(),u=e.request();return(u==null?void 0:u.id)??((f=g==null?void 0:g.input)==null?void 0:f.requestID)??`question-${e.toolCallId()}`}),i=_(()=>{var S;const g=e.toolState(),u=e.request(),f=e.toolName()==="question";if(!u&&!f)return[];const d=(u==null?void 0:u.questions)??((S=g==null?void 0:g.input)==null?void 0:S.questions)??[];return Array.isArray(d)?d:[]}),r=_(()=>{const g=e.request(),u=e.toolName()==="question";return!!g||u}),o=_(()=>{var S,k;const g=e.toolState(),u=(g==null?void 0:g.status)==="completed"&&Array.isArray((S=g==null?void 0:g.metadata)==null?void 0:S.answers)?g.metadata.answers:void 0;if(u)return u;const f=e.request(),d=(k=f==null?void 0:f.questions)==null?void 0:k.map(E=>E==null?void 0:E.answer);if(Array.isArray(d)&&d.some(E=>Array.isArray(E)&&E.length>0))return d;const y=e.draftAnswers()[s()]??[];return Array.isArray(y)?y:[]}),l=_(()=>{var d;const g=e.toolState();if((g==null?void 0:g.status)==="completed")return!0;const u=e.request(),f=(d=u==null?void 0:u.questions)==null?void 0:d.map(y=>y==null?void 0:y.answer);return Array.isArray(f)&&f.length>0?f.every(y=>Array.isArray(y)&&y.length>0):!1}),c=(g,u)=>{e.active()&&e.setDraftAnswers(f=>{const y=[...f[s()]??[]];return y[g]=u,{...f,[s()]:y}})},a=(g,u)=>{const f=i()[g],d=(f==null?void 0:f.multiple)===!0,y=o()[g]??[];if(d){const S=y.includes(u)?y.filter(k=>k!==u):[...y,u];c(g,S);return}c(g,[u])},b=()=>!e.active()||e.submitting()?!0:i().some((g,u)=>{var f;return(((f=o()[u])==null?void 0:f.length)??0)===0}),p=(g,u)=>{if(!e.active())return;const d=(u==null?void 0:u.value)??"";if(d.trim().length===0)return;const y=i()[g];if(!((y==null?void 0:y.multiple)===!0)){c(g,[]),a(g,d);return}const k=o()[g]??[];k.includes(d)||c(g,[...k,d])},v=(g,u)=>{if(!e.active()||u.length===0)return;const d=(o()[g]??[]).filter(y=>!u.includes(y));c(g,d)},$=(g,u)=>{if(!e.active())return;const f=u.value,d=f.trim(),y=i()[g];if(!((y==null?void 0:y.multiple)===!0)){c(g,d.length>0?[f]:[]);return}const k=new Set(((y==null?void 0:y.options)??[]).map(R=>R.label)),E=o()[g]??[],P=u.dataset.lastValue??"";let N=E.filter(R=>R!==P);d.length>0?(!k.has(d)&&!N.includes(f)?N=[...N,f]:k.has(d)||N.includes(f)||(N=[...N,f]),u.dataset.lastValue=f):delete u.dataset.lastValue,c(g,N)};return A(W,{get when(){return $e(()=>!!r())()&&i().length>0},get children(){var g=Mi(),u=g.firstChild,f=u.firstChild;return w(f,A(Lt,{get each(){return i()},children:(d,y)=>{const S=()=>y(),k=()=>(d==null?void 0:d.multiple)===!0,E=()=>o()[S()]??[],P=()=>k()?"checkbox":"radio",N=()=>`question-${s()}-${S()}`,R=()=>new Set(((d==null?void 0:d.options)??[]).map(F=>F.label)),K=()=>E().filter(F=>!R().has(F)),Q=()=>K()[0]??"",Z=()=>Q().length>0;return(()=>{var F=Di(),ce=F.firstChild,he=ce.firstChild,me=he.firstChild,Se=me.nextSibling,V=ce.nextSibling,ue=V.nextSibling,oe=ue.firstChild,ee=oe.firstChild,ye=ee.nextSibling,se=ye.firstChild,G=se.nextSibling;return w(he,()=>t("toolCall.question.number",{number:S()+1}),me),w(Se,()=>d==null?void 0:d.header),w(ce,A(W,{get when(){return k()},get children(){var C=ji();return w(C,()=>t("toolCall.question.multiple")),C}}),null),w(V,()=>d==null?void 0:d.question),w(ue,A(Lt,{get each(){return(d==null?void 0:d.options)??[]},children:(C,U)=>{const ne=()=>E().includes(C.label);return(()=>{var h=Pi(),O=h.firstChild,I=O.nextSibling,L=I.firstChild,le=L.nextSibling;return O.addEventListener("change",()=>a(S(),C.label)),qe(J=>{S()===0&&U()===0&&(n=J)},O),w(L,()=>C.label),w(le,()=>C.description),te(J=>{var X=`flex items-start gap-2 py-1 ${e.active()?"cursor-pointer":e.request()?"opacity-80":""}`,Pe=C.description,Y=P(),ae=N(),Ce=!e.active()||e.submitting();return X!==J.e&&Ie(h,J.e=X),Pe!==J.t&&j(h,"title",J.t=Pe),Y!==J.a&&j(O,"type",J.a=Y),ae!==J.o&&j(O,"name",J.o=ae),Ce!==J.i&&(O.disabled=J.i=Ce),J},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),te(()=>O.checked=ne()),h})()}}),oe),ee.addEventListener("change",C=>{const U=C.currentTarget.closest("label"),ne=U==null?void 0:U.querySelector("input[type='text']");if(e.active()){if(Z()){v(S(),K()),ne&&delete ne.dataset.lastValue;return}p(S(),ne)}}),qe(C=>{var U;S()===0&&(((U=d==null?void 0:d.options)==null?void 0:U.length)??0)===0&&(n=C)},ee),w(se,()=>t("toolCall.question.custom.label")),G.$$keydown=C=>{C.key==="Enter"&&!C.isComposing&&(b()||e.onSubmit())},G.$$input=C=>$(S(),C.currentTarget),G.addEventListener("focus",C=>{e.active()&&p(S(),C.currentTarget)}),te(C=>{var U=`mt-2 flex items-start gap-2 py-1 ${e.active()?"cursor-pointer":e.request()?"opacity-80":""}`,ne=t("toolCall.question.custom.title"),h=P(),O=N(),I=!e.active()||e.submitting(),L=t("toolCall.question.custom.placeholder"),le=!e.active()||e.submitting();return U!==C.e&&Ie(oe,C.e=U),ne!==C.t&&j(oe,"title",C.t=ne),h!==C.a&&j(ee,"type",C.a=h),O!==C.o&&j(ee,"name",C.o=O),I!==C.i&&(ee.disabled=C.i=I),L!==C.n&&j(G,"placeholder",C.n=L),le!==C.s&&(G.disabled=C.s=le),C},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),te(()=>ee.checked=Z()),te(()=>G.value=Q()),F})()}}),null),w(f,A(W,{get when(){return e.active()},get children(){var d=_i(),y=d.firstChild,S=y.firstChild,k=S.nextSibling,E=y.nextSibling,P=E.firstChild,N=P.nextSibling,R=N.nextSibling,K=R.nextSibling;return S.$$click=()=>e.onSubmit(),w(S,()=>t("toolCall.question.actions.submit")),k.$$click=()=>e.onDismiss(),w(k,()=>t("toolCall.question.actions.dismiss")),w(N,()=>t("toolCall.question.shortcuts.submit")),w(K,()=>t("toolCall.question.shortcuts.dismiss")),w(d,A(W,{get when(){return e.error()},get children(){var Q=Ni();return w(Q,()=>e.error()),Q}}),null),te(Q=>{var Z=b(),F=e.submitting();return Z!==Q.e&&(S.disabled=Q.e=Z),F!==Q.t&&(k.disabled=Q.t=F),Q},{e:void 0,t:void 0}),d}}),null),w(f,A(W,{get when(){return $e(()=>!e.active())()&&e.request()},get children(){var d=Li();return w(d,()=>t("toolCall.question.queuedText")),d}}),null),te(()=>Ie(g,`tool-call-permission p-0 gap-2 ${e.active()?"tool-call-permission-active":"tool-call-permission-queued"} ${l()?"tool-call-permission-answered":""}`)),g}})}it(["click","input","keydown"]);var Ri=B("<p class=tool-call-permission-queued-text>"),Bi=B("<div class=tool-call-permission-shortcuts><kbd class=kbd>Enter</kbd><span></span><kbd class=kbd>A</kbd><span></span><kbd class=kbd>D</kbd><span>"),Fi=B("<div class=tool-call-permission-error>"),Ki=B("<div><div class=tool-call-permission-header><span class=tool-call-permission-label></span><span class=tool-call-permission-type></span></div><div class=tool-call-permission-body><div class=tool-call-permission-title><code></code></div><div class=tool-call-permission-actions><div class=tool-call-permission-buttons><button type=button class=tool-call-permission-button></button><button type=button class=tool-call-permission-button></button><button type=button class=tool-call-permission-button>"),Ji=B("<div class=tool-call-permission-diff>");function qi(e){const{t}=Bt(),n=()=>{const i=e.permission();if(!i)return null;const r=i.metadata??{},o=typeof r.diff=="string"?r.diff:null,l=(()=>{if(typeof r.filePath=="string")return r.filePath;if(typeof r.path=="string")return r.path})();return!o||o.trim().length===0?null:{diffText:o,filePath:l}},s=i=>{const r=e.permission();if(!r)return;const o=In(r)||e.fallbackSessionId();e.onRespond(r,o,i)};return A(W,{get when(){return e.permission()},children:i=>(()=>{var r=Ki(),o=r.firstChild,l=o.firstChild,c=l.nextSibling,a=o.nextSibling,b=a.firstChild,p=b.firstChild,v=b.nextSibling,$=v.firstChild,g=$.firstChild,u=g.nextSibling,f=u.nextSibling;return w(l,(()=>{var d=$e(()=>!!e.active());return()=>d()?t("toolCall.permission.status.required"):t("toolCall.permission.status.queued")})()),w(c,()=>ds(i())),w(p,()=>gs(i())),w(a,A(W,{get when(){return n()},children:d=>(()=>{var y=Ji();return w(y,()=>e.renderDiff(d(),{variant:"permission-diff",disableScrollTracking:!0,label:d().filePath?t("toolCall.permission.requestedDiff.withPath",{path:kn(d().filePath||"")}):t("toolCall.permission.requestedDiff.label")})),y})()}),v),w(a,A(W,{get when(){return!e.active()},get children(){var d=Ri();return w(d,()=>t("toolCall.permission.queuedText")),d}}),v),g.$$click=()=>s("once"),w(g,()=>t("toolCall.permission.actions.allowOnce")),u.$$click=()=>s("always"),w(u,()=>t("toolCall.permission.actions.alwaysAllow")),f.$$click=()=>s("reject"),w(f,()=>t("toolCall.permission.actions.deny")),w(v,A(W,{get when(){return e.active()},get children(){var d=Bi(),y=d.firstChild,S=y.nextSibling,k=S.nextSibling,E=k.nextSibling,P=E.nextSibling,N=P.nextSibling;return w(S,()=>t("toolCall.permission.shortcuts.allowOnce")),w(E,()=>t("toolCall.permission.shortcuts.alwaysAllow")),w(N,()=>t("toolCall.permission.shortcuts.deny")),d}}),null),w(a,A(W,{get when(){return e.error()},get children(){var d=Fi();return w(d,()=>e.error()),d}}),null),te(d=>{var y=`tool-call-permission ${e.active()?"tool-call-permission-active":"tool-call-permission-queued"}`,S=e.submitting(),k=e.submitting(),E=e.submitting();return y!==d.e&&Ie(r,d.e=y),S!==d.t&&(g.disabled=d.t=S),k!==d.a&&(u.disabled=d.a=k),E!==d.o&&(f.disabled=d.o=E),d},{e:void 0,t:void 0,a:void 0,o:void 0}),r})()})}it(["click"]);var Qi=B("<div class=tool-call-diff-viewer><div>"),Ui=B('<div class="message-text tool-call-markdown tool-call-markdown-large tool-call-diff-shell"><div class=tool-call-diff-toolbar role=group><span class=tool-call-diff-toolbar-label></span><div class=file-viewer-toolbar><button type=button class=file-viewer-toolbar-icon-button></button><button type=button class=file-viewer-toolbar-icon-button></button><button type=button>'),Wi=B("<pre class=tool-call-diff-fallback>");const xi=cs(()=>Js(()=>import("./diff-viewer-CersJruo.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(e=>({default:e.ToolCallDiffViewer})));function Hi(e){return fs(()=>{var t;(t=e.onRendered)==null||t.call(e)}),(()=>{var t=Qi(),n=t.firstChild;return te(()=>n.innerHTML=e.html),t})()}function Yi(e){const t=hs("(max-width: 640px)"),[n,s]=re(void 0),[i,r]=re(!0);ve(()=>{t()||s(void 0)});const o=a=>{e.scrollHelpers.registerContainer(a)},l=a=>{e.scrollHelpers.registerContainer(a,{disableTracking:!0})};function c(a,b){const p=a.filePath?kn(a.filePath):"",v=(b==null?void 0:b.label)||(p?e.t("toolCall.diff.label.withPath",{path:p}):e.t("toolCall.diff.label")),g=((b==null?void 0:b.variant)==="permission-diff"?"permission-diff":"diff")==="permission-diff"?e.permissionDiffCache:e.diffCache,u=()=>e.preferences().diffViewMode||"split",f=()=>t()?n()||"unified":u(),d=()=>i(),y=e.isDark()?"dark":"light",S=e.toolState(),k=!!(b!=null&&b.disableScrollTracking||(S==null?void 0:S.status)!=="running"&&(S==null?void 0:S.status)!=="pending"),E=k?l:o,P=g.params(),N=(()=>{const V=typeof(b==null?void 0:b.cacheKey)=="string"?b.cacheKey.trim():"";return V?{...P,cacheId:`${P.cacheId}:${V}`}:P})(),R=_(()=>f()),K=_(()=>d()),Q=_(()=>{const V=ms(N);if(V&&V.text===a.diffText&&V.theme===y&&V.mode===R()&&V.wrap===K())return V.html}),Z=V=>{t()&&s(V),e.setDiffViewMode(V)},F=()=>R()==="split"?"unified":"split",ce=()=>F()==="split"?e.t("toolCall.diff.switchToSplit"):e.t("toolCall.diff.switchToUnified"),he=()=>i()?e.t("toolCall.diff.disableWordWrap"):e.t("toolCall.diff.enableWordWrap"),me=()=>e.t("toolCall.diff.copyPatch"),Se=()=>{var V;e.handleScrollRendered(),(V=e.onContentRendered)==null||V.call(e)};return(()=>{var V=Ui(),ue=V.firstChild,oe=ue.firstChild,ee=oe.nextSibling,ye=ee.firstChild,se=ye.nextSibling,G=se.nextSibling;return Qe(V,"scroll",k?void 0:e.scrollHelpers.handleScroll),qe(E,V),w(oe,v),ye.$$click=()=>void Mt(a.diffText),w(ye,A(jt,{class:"h-4 w-4","aria-hidden":"true"})),se.$$click=()=>Z(F()),w(se,(()=>{var C=$e(()=>F()==="split");return()=>C()?A(ys,{class:"h-4 w-4","aria-hidden":"true"}):A(qs,{class:"h-4 w-4","aria-hidden":"true"})})()),G.$$click=()=>r(C=>!C),w(G,A(Qs,{class:"h-4 w-4","aria-hidden":"true"})),w(V,(()=>{var C=$e(()=>!!Q());return()=>C()?A(Hi,{get html(){return Q()},onRendered:Se}):A(us,{get fallback(){return(()=>{var U=Wi();return w(U,()=>a.diffText),U})()},get children(){return A(xi,{get diffText(){return a.diffText},get filePath(){return a.filePath},theme:y,get mode(){return R()},get wrap(){return K()},cacheEntryParams:N,onRendered:Se})}})})(),null),w(V,()=>e.scrollHelpers.renderSentinel({disableTracking:k}),null),te(C=>{var U=R(),ne=e.t("toolCall.diff.viewMode.ariaLabel"),h=me(),O=me(),I=ce(),L=ce(),le=`file-viewer-toolbar-icon-button${i()?" active":""}`,J=he(),X=he();return U!==C.e&&j(V,"data-diff-mode",C.e=U),ne!==C.t&&j(ue,"aria-label",C.t=ne),h!==C.a&&j(ye,"aria-label",C.a=h),O!==C.o&&j(ye,"title",C.o=O),I!==C.i&&j(se,"aria-label",C.i=I),L!==C.n&&j(se,"title",C.n=L),le!==C.s&&Ie(G,C.s=le),J!==C.h&&j(G,"aria-label",C.h=J),X!==C.r&&j(G,"title",C.r=X),C},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0}),V})()}return{renderDiffContent:c}}it(["click"]);var zi=B('<div><pre class="whitespace-pre-wrap break-words text-sm font-mono"dir=auto>'),Gi=B("<div>");function Xi(e){const t=i=>{e.scrollHelpers.registerContainer(i)},n=i=>{e.scrollHelpers.registerContainer(i,{disableTracking:!0})};function s(i){var u;if(!i.content)return null;const r=i.size||"default",o=i.disableHighlight||!1,l=`message-text tool-call-markdown${r==="large"?" tool-call-markdown-large":""}`,c=e.toolState(),a=i.disableScrollTracking||(c==null?void 0:c.status)!=="running"&&(c==null?void 0:c.status)!=="pending",b=a?n:t;if(!!(c&&(c.status==="running"||c.status==="pending")&&o))return(()=>{var f=zi(),d=f.firstChild;return Qe(f,"scroll",a?void 0:e.scrollHelpers.handleScroll),qe(b,f),Ie(f,l),w(d,()=>i.content),w(f,()=>e.scrollHelpers.renderSentinel({disableTracking:a}),null),f})();const v=typeof i.cacheKey=="string"&&i.cacheKey.length>0?i.cacheKey:void 0,$={id:v?`${e.partId()}:${v}`:e.partId(),type:"text",text:i.content,version:(u=e.partVersion)==null?void 0:u.call(e)},g=()=>{var f;e.handleScrollRendered(),(f=e.onContentRendered)==null||f.call(e)};return(()=>{var f=Gi();return Qe(f,"scroll",a?void 0:e.scrollHelpers.handleScroll),qe(b,f),Ie(f,l),w(f,A(bs,{part:$,get instanceId(){return e.instanceId},get sessionId(){return e.sessionId},get isDark(){return e.isDark()},disableHighlight:o,onRendered:g}),null),w(f,()=>e.scrollHelpers.renderSentinel({disableTracking:a}),null),f})()}return{renderMarkdownContent:s}}var Zi=B("<div class=tool-call-diagnostics role=region><div class=tool-call-diagnostics-body role=list>"),er=B("<div class=tool-call-diagnostics-wrapper><button type=button class=tool-call-diagnostics-heading><span class=tool-call-icon aria-hidden=true></span><span class=tool-call-emoji aria-hidden=true>🛠</span><span class=tool-call-summary></span><span class=tool-call-diagnostics-file>"),tr=B("<div class=tool-call-diagnostic-row role=listitem><span><span class=tool-call-diagnostic-chip-icon></span><span></span></span><span class=tool-call-diagnostic-path><span class=tool-call-diagnostic-coords>:L<!>:C</span></span><span class=tool-call-diagnostic-message dir=auto>");function nr(e,t,n,s,i){return t.length===0?null:(()=>{var r=er(),o=r.firstChild,l=o.firstChild,c=l.nextSibling,a=c.nextSibling,b=a.nextSibling;return Qe(o,"click",s,!0),j(o,"aria-expanded",n),w(l,n?"▼":"▶"),w(a,()=>e("toolCall.diagnostics.title")),j(b,"title",i),w(b,i),w(r,A(W,{when:n,get children(){var p=Zi(),v=p.firstChild;return w(v,A(Lt,{each:t,children:$=>(()=>{var g=tr(),u=g.firstChild,f=u.firstChild,d=f.nextSibling,y=u.nextSibling,S=y.firstChild,k=S.firstChild,E=k.nextSibling;E.nextSibling;var P=y.nextSibling;return w(f,()=>$.icon),w(d,()=>$.label),w(y,()=>$.displayPath,S),w(S,()=>$.line||"-",E),w(S,()=>$.column||"-",null),w(P,()=>$.message),te(N=>{var R=`tool-call-diagnostic-chip tool-call-diagnostic-${$.tone}`,K=$.filePath;return R!==N.e&&Ie(u,N.e=R),K!==N.t&&j(y,"title",N.t=K),N},{e:void 0,t:void 0}),g})()})),te(()=>j(p,"aria-label",e("toolCall.diagnostics.ariaLabel"))),p}}),null),r})()}it(["click"]);var sr=B("<span class=tool-call-header-status aria-hidden=true><span></span><span></span><span></span><span>"),ir=B("<div class=tool-call-error-content><strong></strong> "),vn=B("<div class=tool-call-io-body>"),$n=B("<div class=tool-call-pending-message><span class=spinner-small></span><span>"),rr=B("<div class=tool-call-io-sections><div class=tool-call-io-section><button type=button class=tool-call-io-toggle><span class=tool-call-io-title></span></button></div><div class=tool-call-io-section><button type=button class=tool-call-io-toggle><span class=tool-call-io-title>"),or=B("<div class=tool-call-details>"),lr=B("<button type=button class=tool-call-header-input>"),ar=B("<div data-part-type=tool><div class=tool-call-header><button type=button class=tool-call-header-toggle><span class=tool-call-summary></span></button><button type=button class=tool-call-header-copy>");const Ze=as("session"),cr="tool-call",ur=48;function fr(e,t,n,s="default"){return`${t??"unknown-message"}:${n??e??"unknown-tool-call"}:${s}`}function dr(e){const t=n=>e.status()===n;return(()=>{var n=sr(),s=n.firstChild,i=s.nextSibling,r=i.nextSibling,o=r.nextSibling;return w(s,A(Ws,{class:"w-4 h-4"})),w(i,A(js,{class:"w-4 h-4 animate-spin"})),w(r,A(Ds,{class:"w-4 h-4"})),w(o,A(Hs,{class:"w-4 h-4"})),te(l=>{var c=e.status()||"pending",a=t("pending")?"inline-flex":"none",b=t("running")?"inline-flex":"none",p=t("completed")?"inline-flex":"none",v=t("error")?"inline-flex":"none";return c!==l.e&&j(n,"data-status",l.e=c),a!==l.t&&ut(s,"display",l.t=a),b!==l.a&&ut(i,"display",l.a=b),p!==l.o&&ut(r,"display",l.o=p),v!==l.i&&ut(o,"display",l.i=v),l},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),n})()}function gr(e){const t=_(()=>e.messageVersion),n=_(()=>e.partVersion),s=_(()=>{var h;return{toolCallId:e.toolCallIdentifier(),messageId:e.messageId,partId:((h=e.toolCallMemo())==null?void 0:h.id)??null}}),i=_(()=>typeof e.partVersion=="number"?String(e.partVersion):typeof e.messageVersion=="number"?String(e.messageVersion):"noversion"),r=(h,O)=>Ps({instanceId:()=>e.instanceId,sessionId:()=>e.sessionId,scope:cr,cacheId:()=>{const I=s(),L=typeof h=="function"?h():h;return fr(I.toolCallId||void 0,I.messageId,I.partId,L)},version:()=>O?O():i()}),o=r("diff"),l=r("permission-diff"),c=r("ansi-running",()=>"running"),a=r("ansi-final"),b=_(()=>{var h;return(h=e.pendingPermission())==null?void 0:h.permission}),p=_(()=>{var h;return(h=e.pendingQuestion())==null?void 0:h.request}),v=_(()=>{const h=b();return h&&e.isPermissionActive()?h.id:""}),$=_(()=>{const h=p();return h&&e.isQuestionActive()?h.id:""}),[g,u]=re(!1),[f,d]=re(null),y=Vs({getScrollTopSnapshot:e.scrollTopSnapshot,setScrollTopSnapshot:e.setScrollTopSnapshot,sentinelMarginPx:ur,sentinelClassName:"tool-call-scroll-sentinel"}),S={registerContainer:(h,O)=>{y.registerContainer(h,O)},handleScroll:y.handleScroll,renderSentinel:y.renderSentinel,restoreAfterRender:y.restoreAfterRender},k=()=>{S.restoreAfterRender()};ve(()=>{b()||u(!1),d(null)}),ve(()=>{(v()||$())&&requestAnimationFrame(()=>{var O;(O=e.toolCallRootEl())==null||O.scrollIntoView({block:"center",behavior:"smooth"})})});async function E(h,O){if(h){u(!0),d(null);try{const I=In(h)||e.sessionId;await Rs(e.instanceId,I,h.id,O)}catch(I){Ze.error("Failed to send permission response",I),d(I instanceof Error?I.message:e.t("toolCall.permission.errors.unableToUpdate"))}finally{u(!1)}}}ve(()=>{if(!v())return;const O=I=>{const L=b();!L||!e.isPermissionActive()||(I.key==="Enter"?(I.preventDefault(),E(L,"once")):I.key==="a"||I.key==="A"?(I.preventDefault(),E(L,"always")):(I.key==="d"||I.key==="D")&&(I.preventDefault(),E(L,"reject")))};document.addEventListener("keydown",O),gn(()=>document.removeEventListener("keydown",O))});const[P,N]=re(!1),[R,K]=re(null),[Q,Z]=re({});function F(){const h=document.activeElement;return(h==null?void 0:h.tagName)==="TEXTAREA"||(h==null?void 0:h.tagName)==="INPUT"||((h==null?void 0:h.hasAttribute("contenteditable"))??!1)}async function ce(){const h=p();if(!h||!e.isQuestionActive())return;const O=(Q()[h.id]??[]).map(L=>Array.isArray(L)?L:[]),I=h.questions.map((L,le)=>(O[le]??[]).map(X=>X.trim()).filter(X=>X.length>0));if(I.some(L=>((L==null?void 0:L.length)??0)===0)){K(e.t("toolCall.question.validation.answerAll"));return}N(!0),K(null);try{const L=h.sessionID??h.sessionId??e.sessionId;await Bs(e.instanceId,L,h.id,I)}catch(L){Ze.error("Failed to send question reply",L),K(L instanceof Error?L.message:e.t("toolCall.question.errors.unableToReply"))}finally{N(!1)}}async function he(){const h=p();if(!(!h||!e.isQuestionActive())){N(!0),K(null);try{const O=h.sessionID??h.sessionId??e.sessionId;await Fs(e.instanceId,O,h.id)}catch(O){Ze.error("Failed to reject question",O),K(O instanceof Error?O.message:e.t("toolCall.question.errors.unableToDismiss"))}finally{N(!1)}}}ve(()=>{if(!$())return;const O=I=>{F()||(I.key==="Enter"?(I.preventDefault(),ce()):I.key==="Escape"&&(I.preventDefault(),he()))};document.addEventListener("keydown",O),gn(()=>document.removeEventListener("keydown",O))}),ve(()=>{const h=p();if(!h){N(!1),K(null);return}K(null);const O=h.id;Z(I=>{if(I[O])return I;const L=h.questions.map(()=>[]);return{...I,[O]:L}})});const me=()=>{var h;return((h=e.toolState())==null?void 0:h.status)||""},Se=_(()=>{const h=e.toolInput();if(!h||Object.keys(h).length===0)return null;try{const O=Ti(h);return mn(O,"yaml",!0)}catch(O){Ze.error("Failed to convert tool call input to YAML",O);try{const I=JSON.stringify(h,null,2);return mn(I,"json",!0)}catch(I){return Ze.error("Failed to stringify tool call input",I),null}}}),V=_(()=>En(e.toolName())),{renderAnsiContent:ue}=Ks({ansiRunningCache:c,ansiFinalCache:a,scrollHelpers:S,partVersion:n}),{renderDiffContent:oe}=Yi({toolState:e.toolState,preferences:e.preferences,setDiffViewMode:e.setDiffViewMode,isDark:e.isDark,t:e.t,diffCache:o,permissionDiffCache:l,scrollHelpers:S,handleScrollRendered:k,onContentRendered:e.onContentRendered}),{renderMarkdownContent:ee}=Xi({toolState:e.toolState,partId:e.toolCallIdentifier,partVersion:n,instanceId:e.instanceId,sessionId:e.sessionId,isDark:e.isDark,scrollHelpers:S,handleScrollRendered:k,onContentRendered:e.onContentRendered}),ye={toolCall:e.toolCallMemo,toolState:e.toolState,toolName:e.toolName,instanceId:e.instanceId,sessionId:e.sessionId,t:e.t,messageVersion:t,partVersion:n,renderMarkdown:ee,renderAnsi:ue,renderDiff:oe,renderToolCall:h=>h!=null&&h.toolCall?A(hr,{get toolCall(){return h.toolCall},get toolCallId(){return h.toolCall.id},get messageId(){return h.messageId},get messageVersion(){return h.messageVersion},get partVersion(){return h.partVersion},get instanceId(){return e.instanceId},get sessionId(){return h.sessionId},get onContentRendered(){return e.onContentRendered},get forceCollapsed(){return h.forceCollapsed}}):null,scrollHelpers:S,onContentRendered:e.onContentRendered};let se;ve(()=>{const h=n();h!==void 0&&(se!==void 0&&h===se||(se=h,S.restoreAfterRender()))}),ve(()=>{y.autoScroll()&&S.restoreAfterRender()});const G=()=>V().renderBody(ye),C=()=>{const h=e.toolState();return(h==null?void 0:h.status)==="error"&&h.error?(()=>{var O=ir(),I=O.firstChild;return I.nextSibling,w(I,()=>e.t("toolCall.error.label")),w(O,()=>h.error,null),O})():null},U=()=>A(qi,{permission:b,get active(){return e.isPermissionActive},submitting:g,error:f,renderDiff:oe,fallbackSessionId:()=>e.sessionId,onRespond:(h,O,I)=>void E(h,I)}),ne=()=>A(Vi,{get toolName(){return e.toolName},get toolState(){return e.toolState},get toolCallId(){return e.toolCallIdentifier},request:p,get active(){return e.isQuestionActive},submitting:P,error:R,draftAnswers:Q,setDraftAnswers:Z,onSubmit:()=>void ce(),onDismiss:()=>void he()});return(()=>{var h=or();return w(h,A(W,{get when(){return $e(()=>!!e.isToolInputVisible())()&&e.hasToolInput()},get fallback(){return[$e(G),$e(C),A(W,{get when(){return $e(()=>me()==="pending")()&&!e.pendingPermission()},get children(){var O=$n(),I=O.firstChild,L=I.nextSibling;return w(L,()=>e.t("toolCall.pending.waitingToRun")),O}})]},get children(){var O=rr(),I=O.firstChild,L=I.firstChild,le=L.firstChild,J=I.nextSibling,X=J.firstChild,Pe=X.firstChild;return Qe(L,"click",e.toggleInputSection,!0),w(le,()=>e.t("toolCall.io.input")),w(I,A(W,{get when(){return e.inputSectionExpanded()},get children(){var Y=vn();return w(Y,()=>{const ae=Se();return ae?ee({content:ae,cacheKey:"input"}):null}),Y}}),null),Qe(X,"click",e.toggleOutputSection,!0),w(Pe,()=>e.t("toolCall.io.output")),w(J,A(W,{get when(){return e.outputSectionExpanded()},get children(){var Y=vn();return w(Y,G,null),w(Y,C,null),w(Y,A(W,{get when(){return $e(()=>me()==="pending")()&&!e.pendingPermission()},get children(){var ae=$n(),Ce=ae.firstChild,Tt=Ce.nextSibling;return w(Tt,()=>e.t("toolCall.pending.waitingToRun")),ae}}),null),Y}}),null),te(Y=>{var ae=e.inputSectionExpanded(),Ce=e.outputSectionExpanded();return ae!==Y.e&&j(L,"aria-expanded",Y.e=ae),Ce!==Y.t&&j(X,"aria-expanded",Y.t=Ce),Y},{e:void 0,t:void 0}),O}}),null),w(h,U,null),w(h,ne,null),h})()}function hr(e){const{preferences:t,setDiffViewMode:n}=os(),{isDark:s}=ls(),{t:i}=Bt(),r=_(()=>e.toolCall),o=_(()=>{var m;return((m=r())==null?void 0:m.tool)||""}),l=_(()=>{var T;const m=(T=r())==null?void 0:T.id;if(!m)throw new Error("Tool call requires a part id");return m}),c=_(()=>{var m;return(m=r())==null?void 0:m.state}),a=_(()=>ps.getOrCreate(e.instanceId)),b=_(()=>ws().get(e.instanceId)??null),p=_(()=>a().getPermissionState(e.messageId,l())),v=_(()=>{var T;const m=p();return m?{permission:m.entry.permission,active:m.active}:(T=r())==null?void 0:T.pendingPermission}),$=_(()=>a().getQuestionState(e.messageId,l())),g=_(()=>{const m=$();if(m)return{request:m.entry.request,active:m.active}}),u=_(()=>(t().toolOutputExpansion||"expanded")==="expanded"),f=_(()=>(t().diagnosticsExpansion||"expanded")==="expanded"),d=_(()=>{var be;if(e.forceCollapsed)return!1;const m=u();if((((be=r())==null?void 0:be.tool)||"")==="read"){const Oe=c();return(Oe==null?void 0:Oe.status)==="error"}return m}),[y,S]=re(null),k=_(()=>t().toolInputsVisibility||"collapsed"),[E,P]=re(null),N=_(()=>E()??k()),R=_(()=>N()!=="hidden"),K=_(()=>N()==="expanded"),[Q,Z]=re(null),[F,ce]=re(null),he=()=>{const m=Q();return m!==null?m:K()},me=()=>{const m=F();return m!==null?m:!0},Se=_(()=>{const m=v();if(!(m!=null&&m.permission))return!1;const T=b();return(T==null?void 0:T.kind)==="permission"&&T.id===m.permission.id}),V=_(()=>{const m=g();if(!(m!=null&&m.request))return!1;const T=b();return(T==null?void 0:T.kind)==="question"&&T.id===m.request.id}),ue=()=>{if(Se()||V())return!0;const m=y();return m!==null?m:d()},oe=_(()=>{const m=c();return Ss(m).input}),ee=_(()=>{const m=oe();return m&&Object.keys(m).length>0}),[ye,se]=re(),[G,C]=re(0),[U,ne]=re(void 0),h=()=>{if(Se()||V())return!0;const m=U();return m!==void 0?m:f()},O=_(()=>{const m=c();return m?vs(m):[]}),I=()=>{Z(m=>!(m===null?he():m))},L=()=>{ce(m=>!(m===null?me():m))},le=()=>{var T;return`tool-call-status-${((T=c())==null?void 0:T.status)||"pending"}`},J=()=>{const m=le();return v()||g()?`${m} tool-call-awaiting-permission`:m};function X(){const m=v();m!=null&&m.active||S(T=>!(T===null?d():T))}ve(()=>{k(),P(null),Z(null),ce(null)});const Pe=m=>{m.preventDefault(),m.stopPropagation(),ue()||X();const T=R();P(T?"hidden":"expanded")},Y=_(()=>En(o())),ae=()=>null,Ce=()=>null,Tt=()=>null,ns=()=>null,en={toolCall:r,toolState:c,toolName:o,instanceId:e.instanceId,sessionId:e.sessionId,t:i,messageVersion:()=>e.messageVersion,partVersion:()=>e.partVersion,renderMarkdown:ae,renderAnsi:Ce,renderDiff:Tt,renderToolCall:ns,scrollHelpers:void 0},tn=()=>{var m,T;return((T=(m=Y()).getAction)==null?void 0:T.call(m,en))??Ts(o())},ss=()=>{var Oe,Ae;const m=c(),T=o();if(T!=="task")return As({toolName:T,state:m});if(!m||m.status==="pending")return tn();const be=(Ae=(Oe=Y()).getTitle)==null?void 0:Ae.call(Oe,en);return be||(Ns(m)&&m.title||_s(m)&&m.title?m.title:Ls(T))},ct=_(()=>ss()),nn=_(()=>$s({title:ct(),state:c(),t:i})),_e=Cs({id:()=>`${e.instanceId}:${e.sessionId}:${e.messageId??"message"}:${l()}`,text:nn}),sn=()=>nn().trim().length>0&&_e.canUseSpeech(),is=async m=>{m.preventDefault(),m.stopPropagation();const T=ct();T&&await Mt(T)},rn=()=>{const m=[];return ee()&&m.push({key:"toggle-input",label:R()?i("toolCall.header.hideInputTitle"):i("toolCall.header.showInputTitle"),icon:A(hn,{class:"w-3.5 h-3.5","aria-hidden":"true"}),onSelect:()=>{ue()||X();const T=R();P(T?"hidden":"expanded")}}),m.push({key:"copy",label:i("toolCall.header.copyTitle"),icon:A(jt,{class:"w-3.5 h-3.5","aria-hidden":"true"}),onSelect:async()=>{const T=ct();T&&await Mt(T)}}),sn()&&m.push({key:"speak",label:_e.buttonTitle(),icon:A(Ms,{class:"w-3.5 h-3.5","aria-hidden":"true"}),onSelect:()=>void _e.toggle()}),m},rs=()=>{var m;return((m=c())==null?void 0:m.status)||""};return(()=>{var m=ar(),T=m.firstChild,be=T.firstChild,Oe=be.firstChild,Ae=be.nextSibling;return qe(M=>{se(M||void 0)},m),be.$$click=X,w(Oe,ct),w(T,A(W,{get when(){return ee()},get children(){var M=lr();return M.$$click=Pe,w(M,A(hn,{class:"w-3.5 h-3.5"})),te(pe=>{var ze=R(),Ge=R()?i("toolCall.header.hideInputAriaLabel"):i("toolCall.header.showInputAriaLabel"),Xe=R()?i("toolCall.header.hideInputTitle"):i("toolCall.header.showInputTitle");return ze!==pe.e&&j(M,"aria-pressed",pe.e=ze),Ge!==pe.t&&j(M,"aria-label",pe.t=Ge),Xe!==pe.a&&j(M,"title",pe.a=Xe),pe},{e:void 0,t:void 0,a:void 0}),M}}),Ae),Ae.$$click=is,w(Ae,A(jt,{class:"w-3.5 h-3.5"})),w(T,A(W,{get when(){return sn()},get children(){return A(Os,{class:"tool-call-header-copy",onClick:()=>void _e.toggle(),get title(){return _e.buttonTitle()},get isLoading(){return _e.isLoading()},get isPlaying(){return _e.isPlaying()}})}}),null),w(T,A(ks,{get items(){return rn()},get label(){return i("messageItem.actions.more")},triggerClass:"tool-call-header-copy",minItems:2}),null),w(T,A(dr,{status:rs}),null),w(m,A(W,{get when(){return ue()},get children(){return A(gr,{toolCallMemo:r,toolState:c,toolName:o,toolCallIdentifier:l,get instanceId(){return e.instanceId},get sessionId(){return e.sessionId},get messageId(){return e.messageId},get messageVersion(){return e.messageVersion},get partVersion(){return e.partVersion},get onContentRendered(){return e.onContentRendered},preferences:t,setDiffViewMode:n,isDark:s,t:i,store:a,pendingPermission:v,pendingQuestion:g,isPermissionActive:Se,isQuestionActive:V,hasToolInput:ee,isToolInputVisible:R,toolInput:oe,inputSectionExpanded:he,outputSectionExpanded:me,toggleInputSection:I,toggleOutputSection:L,toolCallRootEl:ye,scrollTopSnapshot:G,setScrollTopSnapshot:C})}}),null),w(m,A(W,{get when(){return O().length},get children(){return nr(i,O(),h(),()=>ne(M=>!(M===void 0?f():M)),Is(O()))}}),null),te(M=>{var pe=`tool-call ${J()}`,ze=o(),Ge=e.instanceId,Xe=e.sessionId,on=e.messageId,ln=l(),an=rn().length>1?"true":void 0,cn=ue(),un=Es(o()),fn=i("toolCall.header.copyAriaLabel"),dn=i("toolCall.header.copyTitle");return pe!==M.e&&Ie(m,M.e=pe),ze!==M.t&&j(m,"data-tool-name",M.t=ze),Ge!==M.a&&j(m,"data-instance-id",M.a=Ge),Xe!==M.o&&j(m,"data-session-id",M.o=Xe),on!==M.i&&j(m,"data-message-id",M.i=on),ln!==M.n&&j(m,"data-part-id",M.n=ln),an!==M.s&&j(T,"data-action-overflow",M.s=an),cn!==M.h&&j(be,"aria-expanded",M.h=cn),un!==M.r&&j(Oe,"data-tool-icon",M.r=un),fn!==M.d&&j(Ae,"aria-label",M.d=fn),dn!==M.l&&j(Ae,"title",M.l=dn),M},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0}),m})()}it(["click"]);export{hr as default};