@neuralnomads/codenomad-dev 0.18.0-dev-20260704-e8623d31 → 0.18.0-dev-20260709-ca06bd99

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 (39) hide show
  1. package/dist/events/bus.js +4 -0
  2. package/dist/permissions/auto-accept-manager.js +215 -0
  3. package/dist/permissions/auto-accept-manager.test.js +528 -0
  4. package/dist/permissions/auto-accept-store.js +115 -0
  5. package/dist/permissions/auto-accept-store.test.js +157 -0
  6. package/dist/permissions/opencode-replier.js +31 -0
  7. package/dist/server/http-server.js +14 -0
  8. package/dist/server/routes/yolo.js +12 -0
  9. package/dist/workspaces/instance-client.js +40 -0
  10. package/package.json +2 -1
  11. package/public/assets/{FilesTab-BvAKbOAe.js → FilesTab-4OYnsEpA.js} +2 -2
  12. package/public/assets/{GitChangesTab-CvmcUbYv.js → GitChangesTab-BRg5IAgC.js} +2 -2
  13. package/public/assets/{SplitFilePanel-CxDUaPOb.js → SplitFilePanel-CBrsPjMw.js} +1 -1
  14. package/public/assets/{StatusTab-D5zJNjO2.js → StatusTab-DKKxkw1O.js} +1 -1
  15. package/public/assets/{align-justify-Bn8CDzlS.js → align-justify-BBbFmxDX.js} +1 -1
  16. package/public/assets/{bundle-full-DBhFsM8v.js → bundle-full-CaqU_-Bu.js} +1 -1
  17. package/public/assets/{diff-viewer-CovNS2gz.js → diff-viewer-X5HokaV7.js} +1 -1
  18. package/public/assets/{index-SO3ktACc.js → index-BVzVj6yO.js} +1 -1
  19. package/public/assets/{index-D0m4YbHz.js → index-B_mSCVdz.js} +1 -1
  20. package/public/assets/{index-CGKhj9MH.js → index-BbH6mwer.js} +1 -1
  21. package/public/assets/{index-D8Us4B7P.js → index-BcHO9P9h.js} +1 -1
  22. package/public/assets/{index-DtbpjUma.js → index-CNR6iBgw.js} +1 -1
  23. package/public/assets/{index-DlKCavfp.js → index-Cb1cfkUb.js} +1 -1
  24. package/public/assets/{index-byf9BI5h.js → index-DHYmm6_R.js} +2 -2
  25. package/public/assets/{index-CWut2MH1.js → index-DcfoDBMN.js} +1 -1
  26. package/public/assets/{index-Df02kJ_l.js → index-DqvdokW8.js} +1 -1
  27. package/public/assets/{index-coIdctUe.js → index-cfYxASJ7.js} +1 -1
  28. package/public/assets/{index-Dwb5ls4Z.js → index-jd2JD4UX.js} +1 -1
  29. package/public/assets/{loading-BitVzHui.js → loading-Bm_4ihk-.js} +1 -1
  30. package/public/assets/main-BYOHwhSs.js +68 -0
  31. package/public/assets/{markdown-0328GCk-.js → markdown-AEVUKCN6.js} +3 -3
  32. package/public/assets/{monaco-viewer-q26M2dw6.js → monaco-viewer-B3Jl6a5p.js} +3 -3
  33. package/public/assets/{tool-call-B8_OPv1H.js → tool-call-Bp55vSts.js} +7 -7
  34. package/public/assets/{unified-picker-bwjTqCPs.js → unified-picker-_ya4P-Mo.js} +1 -1
  35. package/public/assets/{wrap-text-DnuQ9rVl.js → wrap-text-Clu8BV6B.js} +1 -1
  36. package/public/index.html +3 -3
  37. package/public/loading.html +3 -3
  38. package/public/sw.js +1 -1
  39. package/public/assets/main-DMQeFbbj.js +0 -68
@@ -1,4 +1,4 @@
1
- var ko=Object.defineProperty;var $o=(e,t,n)=>t in e?ko(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var mt=(e,t,n)=>$o(e,typeof t!="symbol"?t+"":t,n);import{c as L,a as fe,u as rt,s as Ft,b as z,r as Io,d as $,e as fr,o as he,g as Mn,f as D,$ as U,h as ve,i as Tt,j as ot,k as Ke,l as at,m as hr,n as ge,p as Po,q as Mo,t as Ut,v as Do,S as Lo}from"./git-diff-vendor-CSgooKT_.js";import{g as No}from"./fast-diff-vendor-DgdwVvTQ.js";const Ro=["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"],_o=new Set(["className","value","readOnly","noValidate","formNoValidate","isMap","noModule","playsInline","adAuctionHeaders","allowFullscreen","browsingTopics","defaultChecked","defaultMuted","defaultSelected","disablePictureInPicture","disableRemotePlayback","preservesPitch","shadowRootClonable","shadowRootCustomElementRegistry","shadowRootDelegatesFocus","shadowRootSerializable","sharedStorageWritable",...Ro]),Fo=new Set(["innerHTML","textContent","innerText","children"]),Uo=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),Bo=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 Wo(e,t){const n=Bo[e];return typeof n=="object"?n[t]?n.$:void 0:n}const jo=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),gr=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"]),Vo={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},zo=e=>L(()=>e());function Ko(e,t,n){let r=n.length,o=t.length,s=r,i=0,a=0,c=t[o-1].nextSibling,u=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 l=s<r?a?n[a-1].nextSibling:n[s-a]:c;for(;a<s;)e.insertBefore(n[a++],l)}else if(s===a)for(;i<o;)(!u||!u.has(t[i]))&&t[i].remove(),i++;else if(t[i]===n[s-1]&&n[a]===t[o-1]){const l=t[--o].nextSibling;e.insertBefore(n[a++],t[i++].nextSibling),e.insertBefore(n[--s],l),t[o]=n[s]}else{if(!u){u=new Map;let d=a;for(;d<s;)u.set(n[d],d++)}const l=u.get(t[i]);if(l!=null)if(a<l&&l<s){let d=i,f=1,m;for(;++d<o&&d<s&&!((m=u.get(t[d]))==null||m!==l+f);)f++;if(f>l-a){const y=t[i];for(;a<l;)e.insertBefore(n[a++],y)}else e.replaceChild(n[a++],t[i++])}else i++;else t[i++].remove()}}}const Dn="_$DX_DELEGATE";function Ul(e,t,n,r={}){let o;return fr(s=>{o=s,t===document?e():kt(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{o(),t.textContent=""}}function Sn(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?()=>rt(()=>document.importNode(o||(o=s()),!0)):()=>(o||(o=s())).cloneNode(!0);return i.cloneNode=i,i}function mr(e,t=window.document){const n=t[Dn]||(t[Dn]=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,es))}}function st(e,t,n){Ae(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function Ho(e,t,n,r){Ae(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function Go(e,t,n){Ae(e)||(n?e.setAttribute(t,""):e.removeAttribute(t))}function qo(e,t){Ae(e)||(t==null?e.removeAttribute("class"):e.className=t)}function Jo(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 Yo(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]||(Nn(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||(Nn(e,a,!0),n[a]=c)}return n}function Xo(e,t,n){if(!t)return n?st(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 Ln(e,t,n){n!=null?e.style.setProperty(t,n):e.style.removeProperty(t)}function pr(e,t={},n,r){const o={};return r||fe(()=>o.children=it(e,t.children,o.children)),fe(()=>typeof t.ref=="function"&&vn(t.ref,e)),fe(()=>Zo(e,t,n,!0,o,!0)),o}function vn(e,t,n){return rt(()=>e(t,n))}function kt(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!="function")return it(e,t,r,n);fe(o=>it(e,t(),o,n),r)}function Zo(e,t,n,r,o={},s=!1){t||(t={});for(const i in o)if(!(i in t)){if(i==="children")continue;o[i]=Rn(e,i,null,o[i],n,s,t)}for(const i in t){if(i==="children")continue;const a=t[i];o[i]=Rn(e,i,a,o[i],n,s,t)}}function yr(e){let t,n;return!Ae()||!(t=D.registry.get(n=ts()))?e():(D.completed&&D.completed.add(t),D.registry.delete(n),t)}function Ae(e){return!!D.context&&!D.done&&(!e||e.isConnected)}function Qo(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Nn(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 Rn(e,t,n,r,o,s,i){let a,c,u,l,d;if(t==="style")return Xo(e,n,r);if(t==="classList")return Yo(e,n,r);if(n===r)return r;if(t==="ref")s||n(e);else if(t.slice(0,3)==="on:"){const f=t.slice(3);r&&e.removeEventListener(f,r,typeof r!="function"&&r),n&&e.addEventListener(f,n,typeof n!="function"&&n)}else if(t.slice(0,10)==="oncapture:"){const f=t.slice(10);r&&e.removeEventListener(f,r,!0),n&&e.addEventListener(f,n,!0)}else if(t.slice(0,2)==="on"){const f=t.slice(2).toLowerCase(),m=jo.has(f);if(!m&&r){const y=Array.isArray(r)?r[0]:r;e.removeEventListener(f,y)}(m||n)&&(Jo(e,f,n,m),m&&mr([f]))}else if(t.slice(0,5)==="attr:")st(e,t.slice(5),n);else if(t.slice(0,5)==="bool:")Go(e,t.slice(5),n);else if((d=t.slice(0,5)==="prop:")||(u=Fo.has(t))||!o&&((l=Wo(t,e.tagName))||(c=_o.has(t)))||(a=e.nodeName.includes("-")||"is"in i)){if(d)t=t.slice(5),c=!0;else if(Ae(e))return n;t==="class"||t==="className"?qo(e,n):a&&!c&&!u?e[Qo(t)]=n:e[l||t]=n}else{const f=o&&t.indexOf(":")>-1&&Vo[t.split(":")[0]];f?Ho(e,f,t,n):st(e,Uo[t]||t,n)}return n}function es(e){if(D.registry&&D.events&&D.events.find(([c,u])=>u===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 u=t[`${n}Data`];if(u!==void 0?c.call(t,u,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}}),D.registry&&!D.done&&(D.done=_$HY.done=!0),e.composedPath){const c=e.composedPath();s(c[0]);for(let u=0;u<c.length-2&&(t=c[u],!!i());u++){if(t._$host){t=t._$host,a();break}if(t.parentNode===o)break}}else a();s(r)}function it(e,t,n,r,o){const s=Ae(e);if(s){!n&&(n=[...e.childNodes]);let c=[];for(let u=0;u<n.length;u++){const l=n[u];l.nodeType===8&&l.data.slice(0,2)==="!$"?l.remove():c.push(l)}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=ke(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=ke(e,n,r)}else{if(i==="function")return fe(()=>{let c=t();for(;typeof c=="function";)c=c();n=it(e,c,n,r)}),()=>n;if(Array.isArray(t)){const c=[],u=n&&Array.isArray(n);if(an(c,t,n,o))return fe(()=>n=it(e,c,n,r,!0)),()=>n;if(s){if(!c.length)return n;if(r===void 0)return n=[...e.childNodes];let l=c[0];if(l.parentNode!==e)return n;const d=[l];for(;(l=l.nextSibling)!==r;)d.push(l);return n=d}if(c.length===0){if(n=ke(e,n,r),a)return n}else u?n.length===0?_n(e,c,r):Ko(e,n,c):(n&&ke(e),_n(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=ke(e,n,r,t);ke(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function an(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],u;if(!(a==null||a===!0||a===!1))if((u=typeof a)=="object"&&a.nodeType)e.push(a);else if(Array.isArray(a))o=an(e,a,c)||o;else if(u==="function")if(r){for(;typeof a=="function";)a=a();o=an(e,Array.isArray(a)?a:[a],Array.isArray(c)?c:[c])||o}else e.push(a),o=!0;else{const l=String(a);c&&c.nodeType===3&&c.data===l?e.push(c):e.push(document.createTextNode(l))}}return o}function _n(e,t,n=null){for(let r=0,o=t.length;r<o;r++)e.insertBefore(t[r],n)}function ke(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 ts(){return D.getNextContextId()}const ns="http://www.w3.org/2000/svg";function wr(e,t=!1,n=void 0){return t?document.createElementNS(ns,e):document.createElement(e,{is:n})}function Bl(e){const{useShadow:t}=e,n=document.createTextNode(""),r=()=>e.mount||document.body,o=Mn();let s,i=!!D.context;return z(()=>{i&&(Mn().user=i=!1),s||(s=Io(o,()=>L(()=>e.children)));const a=r();if(a instanceof HTMLHeadElement){const[c,u]=$(!1),l=()=>u(!0);fr(d=>kt(a,()=>c()?d():s(),null)),he(l)}else{const c=wr(e.isSVG?"g":"div",e.isSVG),u=t&&c.attachShadow?c.attachShadow({mode:"open"}):c;Object.defineProperty(c,"_$host",{get(){return n.parentNode},configurable:!0}),kt(u,s),a.appendChild(c),e.ref&&e.ref(c),he(()=>a.removeChild(c))}},void 0,{render:!i}),n}function rs(e,t){const n=L(e);return L(()=>{const r=n();switch(typeof r){case"function":return rt(()=>r(t));case"string":const o=gr.has(r),s=D.context?yr():wr(r,o,rt(()=>t.is));return pr(s,t,o),s}})}function Wl(e){const[,t]=Ft(e,["component"]);return rs(()=>e.component,t)}const Be=Symbol("store-raw"),se=Symbol("store-node"),J=Symbol("store-has"),br=Symbol("store-self");function Cr(e){let t=e[U];if(!t&&(Object.defineProperty(e,U,{value:t=new Proxy(e,ss)}),!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 te(e){let t;return e!=null&&typeof e=="object"&&(e[U]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function le(e,t=new Set){let n,r,o,s;if(n=e!=null&&e[Be])return n;if(!te(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=le(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,u=i.length;c<u;c++)s=i[c],!a[s].get&&(o=e[s],(r=le(o,t))!==o&&(e[s]=r))}return e}function We(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function xe(e,t,n){if(e[t])return e[t];const[r,o]=$(n,{equals:!1,internal:!0});return r.$=o,e[t]=r}function os(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===U||t===se||(delete n.value,delete n.writable,n.get=()=>e[U][t]),n}function xn(e){ot()&&xe(We(e,se),br)()}function Sr(e){return xn(e),Reflect.ownKeys(e)}const ss={get(e,t,n){if(t===Be)return e;if(t===U)return n;if(t===Tt)return xn(e),n;const r=We(e,se),o=r[t];let s=o?o():e[t];if(t===se||t===J||t==="__proto__")return s;if(!o){const i=Object.getOwnPropertyDescriptor(e,t);ot()&&(typeof s!="function"||e.hasOwnProperty(t))&&!(i&&i.get)&&(s=xe(r,t,s)())}return te(s)?Cr(s):s},has(e,t){return t===Be||t===U||t===Tt||t===se||t===J||t==="__proto__"?!0:(ot()&&xe(We(e,J),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:Sr,getOwnPropertyDescriptor:os};function _(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[J]&&e[J][t]&&o!==void 0&&e[J][t].$()):(e[t]=n,e[J]&&e[J][t]&&o===void 0&&e[J][t].$());let i=We(e,se),a;if((a=xe(i,t,o))&&a.$(()=>n),Array.isArray(e)&&e.length!==s){for(let c=e.length;c<s;c++)(a=i[c])&&a.$();(a=xe(i,"length",s))&&a.$(e.length)}(a=i[br])&&a.$()}function vr(e,t){const n=Object.keys(t);for(let r=0;r<n.length;r+=1){const o=n[r];_(e,o,t[o])}}function is(e,t){if(typeof t=="function"&&(t=t(e)),t=le(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&&_(e,n,o)}_(e,"length",r)}else vr(e,t)}function Ze(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++)Ze(e,[r[c]].concat(t),n);return}else if(a&&i==="function"){for(let c=0;c<e.length;c++)r(e[c],c)&&Ze(e,[c].concat(t),n);return}else if(a&&i==="object"){const{from:c=0,to:u=e.length-1,by:l=1}=r;for(let d=c;d<=u;d+=l)Ze(e,[d].concat(t),n);return}else if(t.length>1){Ze(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=le(s),r===void 0||te(o)&&te(s)&&!Array.isArray(s)?vr(o,s):_(e,r,s))}function jl(...[e,t]){const n=le(e||{}),r=Array.isArray(n),o=Cr(n);function s(...i){ve(()=>{r&&i.length===1?is(n,i[0]):Ze(n,i)})}return[o,s]}function as(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||n.set||!n.configurable||t===U||t===se||(delete n.value,delete n.writable,n.get=()=>e[U][t],n.set=r=>e[U][t]=r),n}const cs={get(e,t,n){if(t===Be)return e;if(t===U)return n;if(t===Tt)return xn(e),n;const r=We(e,se),o=r[t];let s=o?o():e[t];if(t===se||t===J||t==="__proto__")return s;if(!o){const i=Object.getOwnPropertyDescriptor(e,t),a=typeof s=="function";if(ot()&&(!a||e.hasOwnProperty(t))&&!(i&&i.get))s=xe(r,t,s)();else if(s!=null&&a&&s===Array.prototype[t])return(...c)=>ve(()=>Array.prototype[t].apply(n,c))}return te(s)?xr(s):s},has(e,t){return t===Be||t===U||t===Tt||t===se||t===J||t==="__proto__"?!0:(ot()&&xe(We(e,J),t)(),t in e)},set(e,t,n){return ve(()=>_(e,t,le(n))),!0},deleteProperty(e,t){return ve(()=>_(e,t,void 0,!0)),!0},ownKeys:Sr,getOwnPropertyDescriptor:as};function xr(e){let t=e[U];if(!t){Object.defineProperty(e,U,{value:t=new Proxy(e,cs)});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 u=r[c].get.bind(t);Object.defineProperty(e,c,{get:u,configurable:!0})}if(r[c].set){const u=r[c].set;Object.defineProperty(e,c,{set:d=>ve(()=>u.call(t,d)),configurable:!0})}}}}return t}function ls(e,t){const n=le(e||{});return xr(n)}const cn=Symbol("store-root");function De(e,t,n,r,o){const s=t[n];if(e===s)return;const i=Array.isArray(e);if(n!==cn&&(!te(e)||!te(s)||i!==Array.isArray(s)||o&&e[o]!==s[o])){_(t,n,e);return}if(i){if(e.length&&s.length&&(!r||o&&e[0]&&e[0][o]!=null)){let u,l,d,f,m,y,g,b;for(d=0,f=Math.min(s.length,e.length);d<f&&(s[d]===e[d]||o&&s[d]&&e[d]&&s[d][o]&&s[d][o]===e[d][o]);d++)De(e[d],s,d,r,o);const A=new Array(e.length),M=new Map;for(f=s.length-1,m=e.length-1;f>=d&&m>=d&&(s[f]===e[m]||o&&s[f]&&e[m]&&s[f][o]&&s[f][o]===e[m][o]);f--,m--)A[m]=s[f];if(d>m||d>f){for(l=d;l<=m;l++)_(s,l,e[l]);for(;l<e.length;l++)_(s,l,A[l]),De(e[l],s,l,r,o);s.length>e.length&&_(s,"length",e.length);return}for(g=new Array(m+1),l=m;l>=d;l--)y=e[l],b=o&&y?y[o]:y,u=M.get(b),g[l]=u===void 0?-1:u,M.set(b,l);for(u=d;u<=f;u++)y=s[u],b=o&&y?y[o]:y,l=M.get(b),l!==void 0&&l!==-1&&(A[l]=s[u],l=g[l],M.set(b,l));for(l=d;l<e.length;l++)l in A?(_(s,l,A[l]),De(e[l],s,l,r,o)):_(s,l,e[l])}else for(let u=0,l=e.length;u<l;u++)De(e[u],s,u,r,o);s.length>e.length&&_(s,"length",e.length);return}const a=Object.keys(e);for(let u=0,l=a.length;u<l;u++)De(e[a[u]],s,a[u],r,o);const c=Object.keys(s);for(let u=0,l=c.length;u<l;u++)e[c[u]]===void 0&&_(s,c[u],void 0)}function Vl(e,t={}){const{merge:n,key:r="id"}=t,o=le(e);return s=>{if(!te(s)||!te(o))return o;const i=De(o,{[cn]:s},cn,n,r);return i===void 0?s:i}}const $t=new WeakMap,Er={get(e,t){if(t===Be)return e;const n=e[t];let r;return te(n)?$t.get(n)||($t.set(n,r=new Proxy(n,Er)),r):n},set(e,t,n){return _(e,t,le(n)),!0},deleteProperty(e,t){return _(e,t,void 0,!0),!0}};function zl(e){return t=>{if(te(t)){let n;(n=$t.get(t))||$t.set(t,n=new Proxy(t,Er)),e(n)}return t}}function En(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function us(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 Ee(e){if(typeof e!="string")return e;if(e.charAt(0)==="#")return Ee(us(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 Bt(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 ds(e){const t=Ee(e),{values:n}=t,r=n[0],o=n[1]/100,s=n[2]/100,i=o*Math.min(s,1-s),a=(l,d=(l+r/30)%12)=>s-i*Math.max(Math.min(d-3,9-d,1),-1);let c="rgb";const u=[Math.round(a(0)*255),Math.round(a(8)*255),Math.round(a(4)*255)];return t.type==="hsla"&&(c+="a",u.push(n[3])),Bt({type:c,values:u})}function Fn(e){const{type:t,values:n}=Ee(e);let r=t==="hsl"?Ee(ds(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 fs(e,t){const n=Fn(e),r=Fn(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Kl(e,t){let{type:n,values:r}=Ee(e);return t=En(t),(n==="rgb"||n==="hsl")&&(n+="a"),n==="color"?r[3]=`/${t}`:r[3]=t,Bt({type:n,values:r})}function hs(e,t){const n=Ee(e);if(t=En(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 Bt(n)}function gs(e,t){const n=Ee(e);if(t=En(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 Bt(n)}const ms={xs:0,sm:600,md:900,lg:1200,xl:1536};function ps(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||ms).indexOf(c)!==-1)a={...a,...s.up(c,n(t[c],c))};else{const u=c;a[u]=t[u]}return a},{})}return n(t)}const ys={cleanupStyles:!0},ws=Ke(ys),Oe={black:"#000",white:"#fff"},Ne={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},Re={50:"#f3e5f5",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",700:"#7b1fa2"},_e={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},Fe={300:"#4fc3f7",400:"#29b6f6",700:"#0288d1",800:"#0277bd",900:"#01579b"},Ue={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"},tt={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},bs={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 Qe(e){return e!==null&&typeof e=="object"&&e.constructor===Object}function Cs(e,t){for(const n of t){const r=e[n];delete e[n],e[n]=r}}function On(e,t,n={clone:!0}){const r=n.clone?{...e}:e,o=n.sortKeys?[]:void 0;return Qe(e)&&Qe(t)&&(Object.keys(t).forEach(s=>{if(s==="__proto__")return;o&&o.push(s);let i,a;Qe(i=t[s])&&s in e&&Qe(a=e[s])?r[s]=On(a,i,n):i!==void 0&&(r[s]=i)}),o&&Cs(r,o)),r}function ln(e){if(Array.isArray(e)){const t=[];for(const n of e)t.push(ln(n));return t}else if(Qe(e)){const t={};for(const n in e)n!=="__proto__"&&(t[n]=ln(e[n]));return t}else return e}function ct(e,...t){for(const n of t)On(e,ln(n),{clone:!1});return e}const Ss=()=>({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:Oe.white,default:Oe.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}}),vs={primary:{main:_e[700],light:_e[400],dark:_e[800]},secondary:{main:Re[500],light:Re[300],dark:Re[700]},error:{main:Ne[700],light:Ne[400],dark:Ne[800]},info:{main:Fe[700],light:Fe[800],dark:Fe[900]},success:{main:Ue[800],light:Ue[500],dark:Ue[900]},warning:{main:"#ED6C02",light:tt[500],dark:tt[900]}},xs=()=>({text:{primary:Oe.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:Oe.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}}),Es={primary:{main:_e[200],light:_e[50],dark:_e[400]},secondary:{main:Re[200],light:Re[50],dark:Re[400]},error:{main:Ne[500],light:Ne[300],dark:Ne[700]},info:{main:Fe[400],light:Fe[300],dark:Fe[700]},success:{main:Ue[400],light:Ue[300],dark:Ue[700]},warning:{main:tt[400],light:tt[300],dark:tt[700]}},Os={light:Ss,dark:xs};function Or(e,t){return fs(e,Oe.white)>=t?Oe.white:"rgba(0, 0, 0, 0.87)"}function Un(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=gs(e.main,o):t==="dark"&&(e.dark=hs(e.main,s)))}function As(e){const t={...e.color},n=e.mainShade??500;return!e.color.main&&e.color[n]&&(t.main=e.color[n]),Un(t,"light",e.lightShade??300,e.tonalOffset),Un(t,"dark",e.darkShade??700,e.tonalOffset),t.contrastText||(t.contrastText=Or(t.main,e.contrastThreshold)),t}const Ts=()=>({mode:"light",tonalOffset:.2,contrastThreshold:3,grey:bs,common:Oe});function ks(e){const t=["error","info","primary","secondary","success","warning"],n=Ts(),r={...ct({},n,Os[(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 As({...s,tonalOffset:r.tonalOffset,contrastThreshold:r.contrastThreshold})},getContrastText(s){return Or(s,r.contrastThreshold)}},o=s=>r.mode==="light"?vs[s]:Es[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 $s={};function Is(e){return{...ct({},$s,e??{})}}function Ps(e,t=void 0,n={}){return{toolbar:{minHeight:56,[`${e.up("xs")} and (orientation: landscape)`]:{minHeight:48},[e.up("sm")]:{minHeight:64}},...n}}const Yt={},Ms=.2,Ds=.14,Ls=.12;function T(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,${Ms})`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,${Ds})`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,${Ls})`].join(",")}const Ns=[()=>"none",()=>T(0,2,1,-1,0,1,1,0,0,1,3,0),()=>T(0,3,1,-2,0,2,2,0,0,1,5,0),()=>T(0,3,3,-2,0,3,4,0,0,1,8,0),()=>T(0,2,4,-1,0,4,5,0,0,1,10,0),()=>T(0,3,5,-1,0,5,8,0,0,1,14,0),()=>T(0,3,5,-1,0,6,10,0,0,1,18,0),()=>T(0,4,5,-2,0,7,10,1,0,2,16,1),()=>T(0,5,5,-3,0,8,10,1,0,3,14,2),()=>T(0,5,6,-3,0,9,12,1,0,3,16,2),()=>T(0,6,6,-3,0,10,14,1,0,4,18,3),()=>T(0,6,7,-4,0,11,15,1,0,4,20,3),()=>T(0,7,8,-4,0,12,17,2,0,5,22,4),()=>T(0,7,8,-4,0,13,19,2,0,5,24,4),()=>T(0,7,9,-4,0,14,21,2,0,5,26,4),()=>T(0,8,9,-5,0,15,22,2,0,6,28,5),()=>T(0,8,10,-5,0,16,24,2,0,6,30,5),()=>T(0,8,11,-5,0,17,26,2,0,6,32,5),()=>T(0,9,11,-5,0,18,28,2,0,7,34,6),()=>T(0,9,12,-6,0,19,29,2,0,7,36,6),()=>T(0,10,13,-6,0,20,31,3,0,8,38,7),()=>T(0,10,13,-6,0,21,33,3,0,8,40,7),()=>T(0,10,14,-6,0,22,35,3,0,8,42,7),()=>T(0,11,14,-7,0,23,36,3,0,9,44,8),()=>T(0,11,15,-7,0,24,38,3,0,9,46,8)];function Rs(){return new Proxy([],{get:(e,t)=>typeof t!="string"||isNaN(Number(t))?e[t]:t in Yt?Yt[t]:Yt[t]=Ns[t]()})}const _s={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 Bn(e){return`${Math.round(e)}ms`}function Us(e){if(!e)return 0;const t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function Bs(e){const t={..._s,...e.easing},n={...Fs,...e.duration};return{getAutoHeightDuration:Us,create:(o=["all"],s={})=>{const{duration:i=n.standard,easing:a=t.easeInOut,delay:c=0,...u}=s;return(Array.isArray(o)?o:[o]).map(l=>`${l} ${typeof i=="string"?i:Bn(i)} ${a} ${typeof c=="string"?c:Bn(c)}`).join(",")},...e,easing:t,duration:n}}const j={light:300,regular:400,medium:500},pt={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 Ws(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:`${Ws(o/n)}em`,...s?{textTransform:"uppercase"}:{}}}function js(e={}){const t={fontFamily:e.fontFamily??pt.fontFamily,fontSize:e.fontSize??pt.fontSize,htmlFontSize:(e==null?void 0:e.htmlFontSize)??pt.htmlFontSize,pxToRem:n=>{const r=t.fontSize/14;return`${n/t.htmlFontSize*r}rem`}};return ct(pt,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 Vs={mobileStepper:1e3,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function zs(e){return{...ct({},Vs,e)}}function Xt(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 Ks={columns:12,keys:["xs","sm","md","lg","xl"],values:{xs:0,sm:600,md:900,lg:1200,xl:1536},unit:"px"};function Ar(e){const t={...Ks,...e??{},up:(n,r)=>{const o=Xt("up",t.resolve(n));return r?{[o]:r}:o},down:(n,r)=>{const o=Xt("down",t.resolve(n));return r?{[o]:r}:o},between:(n,r)=>{const o=Xt("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 Tr(e){return typeof e=="function"?e:(...n)=>n.map(r=>typeof r=="number"?`${r*(e??8)}px`:r).join(" ")}const Hs={borderRadius:4};function kr(e){return{...ct({},Hs,e)}}function $r(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=>Ar(r.breakpoints)),n("components",r=>Is(r.components)),n("palette",r=>ks(r.palette)),n("shape",r=>kr(r.shape)),n("spacing",r=>Tr(r.spacing)),n("typography",r=>js(r.typography)),n("shadows",()=>Rs()),n("transitions",()=>Bs({})),n("zIndex",r=>zs(r.zIndex)),n("mixins",()=>Ps(t.breakpoints)),t}function Ir(e){let t;return function(){return t||(t=e()),t}}const Gs=Ir($r);let Pr;Pr=Ke({});const Wt=Pr;function qs(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:Ar(e==null?void 0:e.breakpoints),shape:kr(e==null?void 0:e.shape),spacing:Tr(e==null?void 0:e.spacing)}}const Js=Ir(qs);function Ys(e){for(const t in e)return!1;return!0}function An(e=Js,t=Wt){const n=at(t);if(typeof n=="function")return new Proxy({},{get:(r,o)=>n()[o]});if(Ys(n)&&e)return typeof e=="function"?e():e;if(!n)throw new Error("Theme is not defined");return n}function Mr(e=Gs){return An(e,Wt)}function Xs(e){return An(e,Wt)}function Zs(e){var s,i;const t=[],n=typeof e.propDefaults=="function"?e.propDefaults({set:a=>a,inProps:e.props}):e.propDefaults,o=(i=(s=Xs().components)==null?void 0:s[e.name])==null?void 0:i.defaultProps;return n&&t.push(n),o&&t.push(o),t.length?hr(...t,e.props):e.props}function Qs(e){return ge(Wt.Provider,{get value(){return e.theme},get children(){return e.children}})}function ei(e,t=!1){return t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}function ti(e,t){switch(typeof e){case"function":return Object.assign(e,{[Po]:!0}),rt(()=>e(t));case"string":const n=gr.has(e),r=D.context?yr():ei(e,n);return pr(r,t,n),r}}function Dr(e,t){const n=L(e);return L(()=>ti(n(),t))}function Hl(e){const[t,n]=Ft(e,["$component"]);return Dr(()=>t.$component,n)}function ni(e){const t=e.reduce((n,r)=>("name"in r&&(n[`--${r.name}`]="0"),On(n,r,{clone:!1,sortKeys:!0}),n),{});return delete t.name,t}function Lr(e){return e.startsWith("--")}function ri(e){return e.startsWith("__")}function Nr(e){return/[^a-z-]/i.test(e)&&!Lr(e)}function Rr(e){return e.startsWith("@global")}function un(e){return e.startsWith("@media")}function _r(e){return e.startsWith("@keyframes")}function Wn(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function jn(e,t,n=[],r={}){const o=e.split(",").map(s=>(s=s.trim(),s.includes("&")?s:`& ${s}`));return It(t,(n.length?n:[""]).flatMap(s=>o.map(i=>i.replace(/&/g,s).trim())),{...r})}function Vn(e,t){if(!t)return Wn(e);let n=t.get(e);return n||(t.set(e,n=Wn(e)),n)}function It(e,t=[],n={}){const r=[],o=[];for(let i in e){const a=e[i];if(!ri(i))if(Rr(i))for(const c in a)o.push(...jn(c,a[c],[],n));else if(un(i))o.push(...It(a,t,{...n,sublevel:!0}).map(c=>`${i} {
1
+ var ko=Object.defineProperty;var $o=(e,t,n)=>t in e?ko(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var mt=(e,t,n)=>$o(e,typeof t!="symbol"?t+"":t,n);import{c as L,a as fe,u as rt,s as Ft,b as z,r as Io,d as $,e as fr,o as he,g as Mn,f as D,$ as U,h as ve,i as Tt,j as ot,k as Ke,l as at,m as hr,n as ge,p as Po,q as Mo,t as Ut,v as Do,S as Lo}from"./git-diff-vendor-CSgooKT_.js";import{g as No}from"./fast-diff-vendor-DgdwVvTQ.js";const Ro=["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"],_o=new Set(["className","value","readOnly","noValidate","formNoValidate","isMap","noModule","playsInline","adAuctionHeaders","allowFullscreen","browsingTopics","defaultChecked","defaultMuted","defaultSelected","disablePictureInPicture","disableRemotePlayback","preservesPitch","shadowRootClonable","shadowRootCustomElementRegistry","shadowRootDelegatesFocus","shadowRootSerializable","sharedStorageWritable",...Ro]),Fo=new Set(["innerHTML","textContent","innerText","children"]),Uo=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),Bo=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 Wo(e,t){const n=Bo[e];return typeof n=="object"?n[t]?n.$:void 0:n}const jo=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),gr=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"]),Vo={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},zo=e=>L(()=>e());function Ko(e,t,n){let r=n.length,o=t.length,s=r,i=0,a=0,c=t[o-1].nextSibling,u=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 l=s<r?a?n[a-1].nextSibling:n[s-a]:c;for(;a<s;)e.insertBefore(n[a++],l)}else if(s===a)for(;i<o;)(!u||!u.has(t[i]))&&t[i].remove(),i++;else if(t[i]===n[s-1]&&n[a]===t[o-1]){const l=t[--o].nextSibling;e.insertBefore(n[a++],t[i++].nextSibling),e.insertBefore(n[--s],l),t[o]=n[s]}else{if(!u){u=new Map;let d=a;for(;d<s;)u.set(n[d],d++)}const l=u.get(t[i]);if(l!=null)if(a<l&&l<s){let d=i,f=1,m;for(;++d<o&&d<s&&!((m=u.get(t[d]))==null||m!==l+f);)f++;if(f>l-a){const w=t[i];for(;a<l;)e.insertBefore(n[a++],w)}else e.replaceChild(n[a++],t[i++])}else i++;else t[i++].remove()}}}const Dn="_$DX_DELEGATE";function Ul(e,t,n,r={}){let o;return fr(s=>{o=s,t===document?e():kt(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{o(),t.textContent=""}}function Sn(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?()=>rt(()=>document.importNode(o||(o=s()),!0)):()=>(o||(o=s())).cloneNode(!0);return i.cloneNode=i,i}function mr(e,t=window.document){const n=t[Dn]||(t[Dn]=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,es))}}function st(e,t,n){Ae(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function Ho(e,t,n,r){Ae(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function Go(e,t,n){Ae(e)||(n?e.setAttribute(t,""):e.removeAttribute(t))}function qo(e,t){Ae(e)||(t==null?e.removeAttribute("class"):e.className=t)}function Jo(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 Yo(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]||(Nn(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||(Nn(e,a,!0),n[a]=c)}return n}function Xo(e,t,n){if(!t)return n?st(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 Ln(e,t,n){n!=null?e.style.setProperty(t,n):e.style.removeProperty(t)}function pr(e,t={},n,r){const o={};return r||fe(()=>o.children=it(e,t.children,o.children)),fe(()=>typeof t.ref=="function"&&vn(t.ref,e)),fe(()=>Zo(e,t,n,!0,o,!0)),o}function vn(e,t,n){return rt(()=>e(t,n))}function kt(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!="function")return it(e,t,r,n);fe(o=>it(e,t(),o,n),r)}function Zo(e,t,n,r,o={},s=!1){t||(t={});for(const i in o)if(!(i in t)){if(i==="children")continue;o[i]=Rn(e,i,null,o[i],n,s,t)}for(const i in t){if(i==="children")continue;const a=t[i];o[i]=Rn(e,i,a,o[i],n,s,t)}}function yr(e){let t,n;return!Ae()||!(t=D.registry.get(n=ts()))?e():(D.completed&&D.completed.add(t),D.registry.delete(n),t)}function Ae(e){return!!D.context&&!D.done&&(!e||e.isConnected)}function Qo(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Nn(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 Rn(e,t,n,r,o,s,i){let a,c,u,l,d;if(t==="style")return Xo(e,n,r);if(t==="classList")return Yo(e,n,r);if(n===r)return r;if(t==="ref")s||n(e);else if(t.slice(0,3)==="on:"){const f=t.slice(3);r&&e.removeEventListener(f,r,typeof r!="function"&&r),n&&e.addEventListener(f,n,typeof n!="function"&&n)}else if(t.slice(0,10)==="oncapture:"){const f=t.slice(10);r&&e.removeEventListener(f,r,!0),n&&e.addEventListener(f,n,!0)}else if(t.slice(0,2)==="on"){const f=t.slice(2).toLowerCase(),m=jo.has(f);if(!m&&r){const w=Array.isArray(r)?r[0]:r;e.removeEventListener(f,w)}(m||n)&&(Jo(e,f,n,m),m&&mr([f]))}else if(t.slice(0,5)==="attr:")st(e,t.slice(5),n);else if(t.slice(0,5)==="bool:")Go(e,t.slice(5),n);else if((d=t.slice(0,5)==="prop:")||(u=Fo.has(t))||!o&&((l=Wo(t,e.tagName))||(c=_o.has(t)))||(a=e.nodeName.includes("-")||"is"in i)){if(d)t=t.slice(5),c=!0;else if(Ae(e))return n;t==="class"||t==="className"?qo(e,n):a&&!c&&!u?e[Qo(t)]=n:e[l||t]=n}else{const f=o&&t.indexOf(":")>-1&&Vo[t.split(":")[0]];f?Ho(e,f,t,n):st(e,Uo[t]||t,n)}return n}function es(e){if(D.registry&&D.events&&D.events.find(([c,u])=>u===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 u=t[`${n}Data`];if(u!==void 0?c.call(t,u,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}}),D.registry&&!D.done&&(D.done=_$HY.done=!0),e.composedPath){const c=e.composedPath();s(c[0]);for(let u=0;u<c.length-2&&(t=c[u],!!i());u++){if(t._$host){t=t._$host,a();break}if(t.parentNode===o)break}}else a();s(r)}function it(e,t,n,r,o){const s=Ae(e);if(s){!n&&(n=[...e.childNodes]);let c=[];for(let u=0;u<n.length;u++){const l=n[u];l.nodeType===8&&l.data.slice(0,2)==="!$"?l.remove():c.push(l)}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=ke(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=ke(e,n,r)}else{if(i==="function")return fe(()=>{let c=t();for(;typeof c=="function";)c=c();n=it(e,c,n,r)}),()=>n;if(Array.isArray(t)){const c=[],u=n&&Array.isArray(n);if(an(c,t,n,o))return fe(()=>n=it(e,c,n,r,!0)),()=>n;if(s){if(!c.length)return n;if(r===void 0)return n=[...e.childNodes];let l=c[0];if(l.parentNode!==e)return n;const d=[l];for(;(l=l.nextSibling)!==r;)d.push(l);return n=d}if(c.length===0){if(n=ke(e,n,r),a)return n}else u?n.length===0?_n(e,c,r):Ko(e,n,c):(n&&ke(e),_n(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=ke(e,n,r,t);ke(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function an(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],u;if(!(a==null||a===!0||a===!1))if((u=typeof a)=="object"&&a.nodeType)e.push(a);else if(Array.isArray(a))o=an(e,a,c)||o;else if(u==="function")if(r){for(;typeof a=="function";)a=a();o=an(e,Array.isArray(a)?a:[a],Array.isArray(c)?c:[c])||o}else e.push(a),o=!0;else{const l=String(a);c&&c.nodeType===3&&c.data===l?e.push(c):e.push(document.createTextNode(l))}}return o}function _n(e,t,n=null){for(let r=0,o=t.length;r<o;r++)e.insertBefore(t[r],n)}function ke(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 ts(){return D.getNextContextId()}const ns="http://www.w3.org/2000/svg";function wr(e,t=!1,n=void 0){return t?document.createElementNS(ns,e):document.createElement(e,{is:n})}function Bl(e){const{useShadow:t}=e,n=document.createTextNode(""),r=()=>e.mount||document.body,o=Mn();let s,i=!!D.context;return z(()=>{i&&(Mn().user=i=!1),s||(s=Io(o,()=>L(()=>e.children)));const a=r();if(a instanceof HTMLHeadElement){const[c,u]=$(!1),l=()=>u(!0);fr(d=>kt(a,()=>c()?d():s(),null)),he(l)}else{const c=wr(e.isSVG?"g":"div",e.isSVG),u=t&&c.attachShadow?c.attachShadow({mode:"open"}):c;Object.defineProperty(c,"_$host",{get(){return n.parentNode},configurable:!0}),kt(u,s),a.appendChild(c),e.ref&&e.ref(c),he(()=>a.removeChild(c))}},void 0,{render:!i}),n}function rs(e,t){const n=L(e);return L(()=>{const r=n();switch(typeof r){case"function":return rt(()=>r(t));case"string":const o=gr.has(r),s=D.context?yr():wr(r,o,rt(()=>t.is));return pr(s,t,o),s}})}function Wl(e){const[,t]=Ft(e,["component"]);return rs(()=>e.component,t)}const Be=Symbol("store-raw"),se=Symbol("store-node"),J=Symbol("store-has"),br=Symbol("store-self");function Cr(e){let t=e[U];if(!t&&(Object.defineProperty(e,U,{value:t=new Proxy(e,ss)}),!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 te(e){let t;return e!=null&&typeof e=="object"&&(e[U]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function le(e,t=new Set){let n,r,o,s;if(n=e!=null&&e[Be])return n;if(!te(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=le(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,u=i.length;c<u;c++)s=i[c],!a[s].get&&(o=e[s],(r=le(o,t))!==o&&(e[s]=r))}return e}function We(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function xe(e,t,n){if(e[t])return e[t];const[r,o]=$(n,{equals:!1,internal:!0});return r.$=o,e[t]=r}function os(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===U||t===se||(delete n.value,delete n.writable,n.get=()=>e[U][t]),n}function xn(e){ot()&&xe(We(e,se),br)()}function Sr(e){return xn(e),Reflect.ownKeys(e)}const ss={get(e,t,n){if(t===Be)return e;if(t===U)return n;if(t===Tt)return xn(e),n;const r=We(e,se),o=r[t];let s=o?o():e[t];if(t===se||t===J||t==="__proto__")return s;if(!o){const i=Object.getOwnPropertyDescriptor(e,t);ot()&&(typeof s!="function"||e.hasOwnProperty(t))&&!(i&&i.get)&&(s=xe(r,t,s)())}return te(s)?Cr(s):s},has(e,t){return t===Be||t===U||t===Tt||t===se||t===J||t==="__proto__"?!0:(ot()&&xe(We(e,J),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:Sr,getOwnPropertyDescriptor:os};function _(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[J]&&e[J][t]&&o!==void 0&&e[J][t].$()):(e[t]=n,e[J]&&e[J][t]&&o===void 0&&e[J][t].$());let i=We(e,se),a;if((a=xe(i,t,o))&&a.$(()=>n),Array.isArray(e)&&e.length!==s){for(let c=e.length;c<s;c++)(a=i[c])&&a.$();(a=xe(i,"length",s))&&a.$(e.length)}(a=i[br])&&a.$()}function vr(e,t){const n=Object.keys(t);for(let r=0;r<n.length;r+=1){const o=n[r];_(e,o,t[o])}}function is(e,t){if(typeof t=="function"&&(t=t(e)),t=le(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&&_(e,n,o)}_(e,"length",r)}else vr(e,t)}function Ze(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++)Ze(e,[r[c]].concat(t),n);return}else if(a&&i==="function"){for(let c=0;c<e.length;c++)r(e[c],c)&&Ze(e,[c].concat(t),n);return}else if(a&&i==="object"){const{from:c=0,to:u=e.length-1,by:l=1}=r;for(let d=c;d<=u;d+=l)Ze(e,[d].concat(t),n);return}else if(t.length>1){Ze(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=le(s),r===void 0||te(o)&&te(s)&&!Array.isArray(s)?vr(o,s):_(e,r,s))}function jl(...[e,t]){const n=le(e||{}),r=Array.isArray(n),o=Cr(n);function s(...i){ve(()=>{r&&i.length===1?is(n,i[0]):Ze(n,i)})}return[o,s]}function as(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||n.set||!n.configurable||t===U||t===se||(delete n.value,delete n.writable,n.get=()=>e[U][t],n.set=r=>e[U][t]=r),n}const cs={get(e,t,n){if(t===Be)return e;if(t===U)return n;if(t===Tt)return xn(e),n;const r=We(e,se),o=r[t];let s=o?o():e[t];if(t===se||t===J||t==="__proto__")return s;if(!o){const i=Object.getOwnPropertyDescriptor(e,t),a=typeof s=="function";if(ot()&&(!a||e.hasOwnProperty(t))&&!(i&&i.get))s=xe(r,t,s)();else if(s!=null&&a&&s===Array.prototype[t])return(...c)=>ve(()=>Array.prototype[t].apply(n,c))}return te(s)?xr(s):s},has(e,t){return t===Be||t===U||t===Tt||t===se||t===J||t==="__proto__"?!0:(ot()&&xe(We(e,J),t)(),t in e)},set(e,t,n){return ve(()=>_(e,t,le(n))),!0},deleteProperty(e,t){return ve(()=>_(e,t,void 0,!0)),!0},ownKeys:Sr,getOwnPropertyDescriptor:as};function xr(e){let t=e[U];if(!t){Object.defineProperty(e,U,{value:t=new Proxy(e,cs)});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 u=r[c].get.bind(t);Object.defineProperty(e,c,{get:u,configurable:!0})}if(r[c].set){const u=r[c].set;Object.defineProperty(e,c,{set:d=>ve(()=>u.call(t,d)),configurable:!0})}}}}return t}function ls(e,t){const n=le(e||{});return xr(n)}const cn=Symbol("store-root");function De(e,t,n,r,o){const s=t[n];if(e===s)return;const i=Array.isArray(e);if(n!==cn&&(!te(e)||!te(s)||i!==Array.isArray(s)||o&&e[o]!==s[o])){_(t,n,e);return}if(i){if(e.length&&s.length&&(!r||o&&e[0]&&e[0][o]!=null)){let u,l,d,f,m,w,g,b;for(d=0,f=Math.min(s.length,e.length);d<f&&(s[d]===e[d]||o&&s[d]&&e[d]&&s[d][o]&&s[d][o]===e[d][o]);d++)De(e[d],s,d,r,o);const A=new Array(e.length),M=new Map;for(f=s.length-1,m=e.length-1;f>=d&&m>=d&&(s[f]===e[m]||o&&s[f]&&e[m]&&s[f][o]&&s[f][o]===e[m][o]);f--,m--)A[m]=s[f];if(d>m||d>f){for(l=d;l<=m;l++)_(s,l,e[l]);for(;l<e.length;l++)_(s,l,A[l]),De(e[l],s,l,r,o);s.length>e.length&&_(s,"length",e.length);return}for(g=new Array(m+1),l=m;l>=d;l--)w=e[l],b=o&&w?w[o]:w,u=M.get(b),g[l]=u===void 0?-1:u,M.set(b,l);for(u=d;u<=f;u++)w=s[u],b=o&&w?w[o]:w,l=M.get(b),l!==void 0&&l!==-1&&(A[l]=s[u],l=g[l],M.set(b,l));for(l=d;l<e.length;l++)l in A?(_(s,l,A[l]),De(e[l],s,l,r,o)):_(s,l,e[l])}else for(let u=0,l=e.length;u<l;u++)De(e[u],s,u,r,o);s.length>e.length&&_(s,"length",e.length);return}const a=Object.keys(e);for(let u=0,l=a.length;u<l;u++)De(e[a[u]],s,a[u],r,o);const c=Object.keys(s);for(let u=0,l=c.length;u<l;u++)e[c[u]]===void 0&&_(s,c[u],void 0)}function Vl(e,t={}){const{merge:n,key:r="id"}=t,o=le(e);return s=>{if(!te(s)||!te(o))return o;const i=De(o,{[cn]:s},cn,n,r);return i===void 0?s:i}}const $t=new WeakMap,Er={get(e,t){if(t===Be)return e;const n=e[t];let r;return te(n)?$t.get(n)||($t.set(n,r=new Proxy(n,Er)),r):n},set(e,t,n){return _(e,t,le(n)),!0},deleteProperty(e,t){return _(e,t,void 0,!0),!0}};function zl(e){return t=>{if(te(t)){let n;(n=$t.get(t))||$t.set(t,n=new Proxy(t,Er)),e(n)}return t}}function En(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function us(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 Ee(e){if(typeof e!="string")return e;if(e.charAt(0)==="#")return Ee(us(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 Bt(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 ds(e){const t=Ee(e),{values:n}=t,r=n[0],o=n[1]/100,s=n[2]/100,i=o*Math.min(s,1-s),a=(l,d=(l+r/30)%12)=>s-i*Math.max(Math.min(d-3,9-d,1),-1);let c="rgb";const u=[Math.round(a(0)*255),Math.round(a(8)*255),Math.round(a(4)*255)];return t.type==="hsla"&&(c+="a",u.push(n[3])),Bt({type:c,values:u})}function Fn(e){const{type:t,values:n}=Ee(e);let r=t==="hsl"?Ee(ds(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 fs(e,t){const n=Fn(e),r=Fn(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Kl(e,t){let{type:n,values:r}=Ee(e);return t=En(t),(n==="rgb"||n==="hsl")&&(n+="a"),n==="color"?r[3]=`/${t}`:r[3]=t,Bt({type:n,values:r})}function hs(e,t){const n=Ee(e);if(t=En(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 Bt(n)}function gs(e,t){const n=Ee(e);if(t=En(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 Bt(n)}const ms={xs:0,sm:600,md:900,lg:1200,xl:1536};function ps(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||ms).indexOf(c)!==-1)a={...a,...s.up(c,n(t[c],c))};else{const u=c;a[u]=t[u]}return a},{})}return n(t)}const ys={cleanupStyles:!0},ws=Ke(ys),Oe={black:"#000",white:"#fff"},Ne={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},Re={50:"#f3e5f5",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",700:"#7b1fa2"},_e={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},Fe={300:"#4fc3f7",400:"#29b6f6",700:"#0288d1",800:"#0277bd",900:"#01579b"},Ue={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"},tt={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},bs={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 Qe(e){return e!==null&&typeof e=="object"&&e.constructor===Object}function Cs(e,t){for(const n of t){const r=e[n];delete e[n],e[n]=r}}function On(e,t,n={clone:!0}){const r=n.clone?{...e}:e,o=n.sortKeys?[]:void 0;return Qe(e)&&Qe(t)&&(Object.keys(t).forEach(s=>{if(s==="__proto__")return;o&&o.push(s);let i,a;Qe(i=t[s])&&s in e&&Qe(a=e[s])?r[s]=On(a,i,n):i!==void 0&&(r[s]=i)}),o&&Cs(r,o)),r}function ln(e){if(Array.isArray(e)){const t=[];for(const n of e)t.push(ln(n));return t}else if(Qe(e)){const t={};for(const n in e)n!=="__proto__"&&(t[n]=ln(e[n]));return t}else return e}function ct(e,...t){for(const n of t)On(e,ln(n),{clone:!1});return e}const Ss=()=>({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:Oe.white,default:Oe.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}}),vs={primary:{main:_e[700],light:_e[400],dark:_e[800]},secondary:{main:Re[500],light:Re[300],dark:Re[700]},error:{main:Ne[700],light:Ne[400],dark:Ne[800]},info:{main:Fe[700],light:Fe[800],dark:Fe[900]},success:{main:Ue[800],light:Ue[500],dark:Ue[900]},warning:{main:"#ED6C02",light:tt[500],dark:tt[900]}},xs=()=>({text:{primary:Oe.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:Oe.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}}),Es={primary:{main:_e[200],light:_e[50],dark:_e[400]},secondary:{main:Re[200],light:Re[50],dark:Re[400]},error:{main:Ne[500],light:Ne[300],dark:Ne[700]},info:{main:Fe[400],light:Fe[300],dark:Fe[700]},success:{main:Ue[400],light:Ue[300],dark:Ue[700]},warning:{main:tt[400],light:tt[300],dark:tt[700]}},Os={light:Ss,dark:xs};function Or(e,t){return fs(e,Oe.white)>=t?Oe.white:"rgba(0, 0, 0, 0.87)"}function Un(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=gs(e.main,o):t==="dark"&&(e.dark=hs(e.main,s)))}function As(e){const t={...e.color},n=e.mainShade??500;return!e.color.main&&e.color[n]&&(t.main=e.color[n]),Un(t,"light",e.lightShade??300,e.tonalOffset),Un(t,"dark",e.darkShade??700,e.tonalOffset),t.contrastText||(t.contrastText=Or(t.main,e.contrastThreshold)),t}const Ts=()=>({mode:"light",tonalOffset:.2,contrastThreshold:3,grey:bs,common:Oe});function ks(e){const t=["error","info","primary","secondary","success","warning"],n=Ts(),r={...ct({},n,Os[(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 As({...s,tonalOffset:r.tonalOffset,contrastThreshold:r.contrastThreshold})},getContrastText(s){return Or(s,r.contrastThreshold)}},o=s=>r.mode==="light"?vs[s]:Es[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 $s={};function Is(e){return{...ct({},$s,e??{})}}function Ps(e,t=void 0,n={}){return{toolbar:{minHeight:56,[`${e.up("xs")} and (orientation: landscape)`]:{minHeight:48},[e.up("sm")]:{minHeight:64}},...n}}const Yt={},Ms=.2,Ds=.14,Ls=.12;function T(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,${Ms})`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,${Ds})`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,${Ls})`].join(",")}const Ns=[()=>"none",()=>T(0,2,1,-1,0,1,1,0,0,1,3,0),()=>T(0,3,1,-2,0,2,2,0,0,1,5,0),()=>T(0,3,3,-2,0,3,4,0,0,1,8,0),()=>T(0,2,4,-1,0,4,5,0,0,1,10,0),()=>T(0,3,5,-1,0,5,8,0,0,1,14,0),()=>T(0,3,5,-1,0,6,10,0,0,1,18,0),()=>T(0,4,5,-2,0,7,10,1,0,2,16,1),()=>T(0,5,5,-3,0,8,10,1,0,3,14,2),()=>T(0,5,6,-3,0,9,12,1,0,3,16,2),()=>T(0,6,6,-3,0,10,14,1,0,4,18,3),()=>T(0,6,7,-4,0,11,15,1,0,4,20,3),()=>T(0,7,8,-4,0,12,17,2,0,5,22,4),()=>T(0,7,8,-4,0,13,19,2,0,5,24,4),()=>T(0,7,9,-4,0,14,21,2,0,5,26,4),()=>T(0,8,9,-5,0,15,22,2,0,6,28,5),()=>T(0,8,10,-5,0,16,24,2,0,6,30,5),()=>T(0,8,11,-5,0,17,26,2,0,6,32,5),()=>T(0,9,11,-5,0,18,28,2,0,7,34,6),()=>T(0,9,12,-6,0,19,29,2,0,7,36,6),()=>T(0,10,13,-6,0,20,31,3,0,8,38,7),()=>T(0,10,13,-6,0,21,33,3,0,8,40,7),()=>T(0,10,14,-6,0,22,35,3,0,8,42,7),()=>T(0,11,14,-7,0,23,36,3,0,9,44,8),()=>T(0,11,15,-7,0,24,38,3,0,9,46,8)];function Rs(){return new Proxy([],{get:(e,t)=>typeof t!="string"||isNaN(Number(t))?e[t]:t in Yt?Yt[t]:Yt[t]=Ns[t]()})}const _s={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 Bn(e){return`${Math.round(e)}ms`}function Us(e){if(!e)return 0;const t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function Bs(e){const t={..._s,...e.easing},n={...Fs,...e.duration};return{getAutoHeightDuration:Us,create:(o=["all"],s={})=>{const{duration:i=n.standard,easing:a=t.easeInOut,delay:c=0,...u}=s;return(Array.isArray(o)?o:[o]).map(l=>`${l} ${typeof i=="string"?i:Bn(i)} ${a} ${typeof c=="string"?c:Bn(c)}`).join(",")},...e,easing:t,duration:n}}const j={light:300,regular:400,medium:500},pt={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 Ws(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:`${Ws(o/n)}em`,...s?{textTransform:"uppercase"}:{}}}function js(e={}){const t={fontFamily:e.fontFamily??pt.fontFamily,fontSize:e.fontSize??pt.fontSize,htmlFontSize:(e==null?void 0:e.htmlFontSize)??pt.htmlFontSize,pxToRem:n=>{const r=t.fontSize/14;return`${n/t.htmlFontSize*r}rem`}};return ct(pt,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 Vs={mobileStepper:1e3,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function zs(e){return{...ct({},Vs,e)}}function Xt(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 Ks={columns:12,keys:["xs","sm","md","lg","xl"],values:{xs:0,sm:600,md:900,lg:1200,xl:1536},unit:"px"};function Ar(e){const t={...Ks,...e??{},up:(n,r)=>{const o=Xt("up",t.resolve(n));return r?{[o]:r}:o},down:(n,r)=>{const o=Xt("down",t.resolve(n));return r?{[o]:r}:o},between:(n,r)=>{const o=Xt("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 Tr(e){return typeof e=="function"?e:(...n)=>n.map(r=>typeof r=="number"?`${r*(e??8)}px`:r).join(" ")}const Hs={borderRadius:4};function kr(e){return{...ct({},Hs,e)}}function $r(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=>Ar(r.breakpoints)),n("components",r=>Is(r.components)),n("palette",r=>ks(r.palette)),n("shape",r=>kr(r.shape)),n("spacing",r=>Tr(r.spacing)),n("typography",r=>js(r.typography)),n("shadows",()=>Rs()),n("transitions",()=>Bs({})),n("zIndex",r=>zs(r.zIndex)),n("mixins",()=>Ps(t.breakpoints)),t}function Ir(e){let t;return function(){return t||(t=e()),t}}const Gs=Ir($r);let Pr;Pr=Ke({});const Wt=Pr;function qs(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:Ar(e==null?void 0:e.breakpoints),shape:kr(e==null?void 0:e.shape),spacing:Tr(e==null?void 0:e.spacing)}}const Js=Ir(qs);function Ys(e){for(const t in e)return!1;return!0}function An(e=Js,t=Wt){const n=at(t);if(typeof n=="function")return new Proxy({},{get:(r,o)=>n()[o]});if(Ys(n)&&e)return typeof e=="function"?e():e;if(!n)throw new Error("Theme is not defined");return n}function Mr(e=Gs){return An(e,Wt)}function Xs(e){return An(e,Wt)}function Zs(e){var s,i;const t=[],n=typeof e.propDefaults=="function"?e.propDefaults({set:a=>a,inProps:e.props}):e.propDefaults,o=(i=(s=Xs().components)==null?void 0:s[e.name])==null?void 0:i.defaultProps;return n&&t.push(n),o&&t.push(o),t.length?hr(...t,e.props):e.props}function Qs(e){return ge(Wt.Provider,{get value(){return e.theme},get children(){return e.children}})}function ei(e,t=!1){return t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}function ti(e,t){switch(typeof e){case"function":return Object.assign(e,{[Po]:!0}),rt(()=>e(t));case"string":const n=gr.has(e),r=D.context?yr():ei(e,n);return pr(r,t,n),r}}function Dr(e,t){const n=L(e);return L(()=>ti(n(),t))}function Hl(e){const[t,n]=Ft(e,["$component"]);return Dr(()=>t.$component,n)}function ni(e){const t=e.reduce((n,r)=>("name"in r&&(n[`--${r.name}`]="0"),On(n,r,{clone:!1,sortKeys:!0}),n),{});return delete t.name,t}function Lr(e){return e.startsWith("--")}function ri(e){return e.startsWith("__")}function Nr(e){return/[^a-z-]/i.test(e)&&!Lr(e)}function Rr(e){return e.startsWith("@global")}function un(e){return e.startsWith("@media")}function _r(e){return e.startsWith("@keyframes")}function Wn(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function jn(e,t,n=[],r={}){const o=e.split(",").map(s=>(s=s.trim(),s.includes("&")?s:`& ${s}`));return It(t,(n.length?n:[""]).flatMap(s=>o.map(i=>i.replace(/&/g,s).trim())),{...r})}function Vn(e,t){if(!t)return Wn(e);let n=t.get(e);return n||(t.set(e,n=Wn(e)),n)}function It(e,t=[],n={}){const r=[],o=[];for(let i in e){const a=e[i];if(!ri(i))if(Rr(i))for(const c in a)o.push(...jn(c,a[c],[],n));else if(un(i))o.push(...It(a,t,{...n,sublevel:!0}).map(c=>`${i} {
2
2
  ${c}
3
3
  }`));else if(Lr(i))a!=null&&r.push(`${i}: ${a};`);else if(_r(i)){const c=[];for(const u in a)c.push(...It(a[u],[/^\d+$/.test(u)?`${u}%`:u],{...n,sublevel:!0}));o.push(`${i} {
4
4
  ${c.join(`
@@ -12,7 +12,7 @@ ${a}
12
12
  }`:It(a,[`.${t}`],{extraProperties:e.extraProperties,propertyNameCache:r}).join(`
13
13
  `)).join(`
14
14
  `);return((i=e.cache)==null?void 0:i.create(e.name,o,e.componentId))||Fr(e.name,o,e.componentId)}function Ur(e,t){"styleSheet"in e?e.styleSheet.cssText=t:(e.innerText="",e.appendChild(document.createTextNode(t)))}function ci(e,t){for(const n in t){const r=t[n];r!==void 0&&(r===null?e.removeAttribute(n):e.setAttribute(n,r))}}function li(e,t){const n=document.createElement("style");return n.type="text/css",t&&ci(n,t),Ur(n,e),n}function dn(e){let t=Number(e.getAttribute("data-uses"));t++,e.setAttribute("data-uses",t.toString())}const zn="suid-injectFirst";function ui(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 Ur(s,e),dn(s),s;{s&&s.remove();const i=li(e,t);if(dn(i),n){let a=o.querySelector(`#${zn}`);a||(a=document.createElement("style"),a.setAttribute("id",zn),o.prepend(a)),o.insertBefore(i,a)}else o.appendChild(i);return i}}function di(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 Kn(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 Gl(e){if(typeof e!="string")throw new Error("MUI: `capitalize(string)` expects a string argument.");return e.charAt(0).toUpperCase()+e.slice(1)}function ql(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 Jl(e){const t=e.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}function fi(e){return e&&e.ownerDocument||document}function Yl(e){return fi(e).defaultView||window}function Br(){return Math.random().toString(36).substring(2,15).slice(0,8)}let jt=!0,fn=!1,Hn;const hi={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 gi(e){const{type:t,tagName:n}=e;return!!(n==="INPUT"&&hi[t]&&!e.readOnly||n==="TEXTAREA"&&!e.readOnly||e.isContentEditable)}function mi(e){e.metaKey||e.altKey||e.ctrlKey||(jt=!0)}function Zt(){jt=!1}function pi(){this.visibilityState==="hidden"&&fn&&(jt=!0)}function yi(e){e.addEventListener("keydown",mi,!0),e.addEventListener("mousedown",Zt,!0),e.addEventListener("pointerdown",Zt,!0),e.addEventListener("touchstart",Zt,!0),e.addEventListener("visibilitychange",pi,!0)}function wi(e){const{target:t}=e;try{return t.matches(":focus-visible")}catch{}return jt||gi(t)}function Xl(){const e=s=>{s!=null&&yi(s.ownerDocument)},[t,n]=$(!1);function r(){return t()?(fn=!0,window.clearTimeout(Hn),Hn=window.setTimeout(()=>{fn=!1},100),n(!1),!0):!1}function o(s){return wi(s)?(n(!0),!0):!1}return{isFocusVisibleRef:{get current(){return t()}},onFocus:o,onBlur:r,ref:e}}const bi=new ii;function Ci(e){return e?Array.isArray(e)?e.flat(1/0).filter(t=>!!t):[e]:[]}function Si(){if(!D.context)return Br();const e=Mo().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 Wr(e){const t=at(ws),[n,r]=$(""),o=Si();let s,i=!1;return fe(a=>{var l;const c=e();let u;if(c){const d=ni(Ci(c));i="@global"in d,u=ai({name:"css",props:d,cache:bi,componentId:o}),s=di(u.id),s?dn(s):s=ui(u.rules,{id:u.id,nonce:(l=t.cache)==null?void 0:l.nonce},t.injectFirst),a!=null&&a.styleElement&&Kn(a.styleElement)}return typeof(u==null?void 0:u.className)=="string"?r(u.className):r(""),{className:u==null?void 0:u.className,styleElement:s}},void 0),he(()=>{s&&Kn(s,t.cleanupStyles??i)}),n}function Le(e,t,n={}){for(const r in e){const o=e[r];if(Rr(r))n[r]=Le(o,t);else if(un(r))n[r]=Le(o,t);else if(_r(r)){n[r]={};for(const s in o)n[r][s]=Le(o[s],t)}else if(Nr(r))n[r]=Le(o,t);else{const s=t(r,o);if(s)for(const i in s)n[i]=un(i)?{...n[i],...s[i]}:s[i];else n[r]=o}}return n}const vi=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 jr(e,t){if(typeof t=="number")return{[e]:vi.has(e)?t.toString():`${t}px`}}function Gn(e,t={}){return Le(e,jr,t)}function Pt(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 xi(e,t){return t.split(".").reduce((n,r)=>n&&n[r]?n[r]:null,e)}function Ei(e,t,n,r){const o=xi(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 ue={x:["Left","Right"],y:["Top","Bottom"]};function Vr(e){return typeof e=="number"?`${e}px`:e}function zr(e,t){return(n,r)=>t(e,n,r)}function h(e,t){return t?(n,r)=>({[e]:t(e,n,r)}):n=>({[e]:n})}function et(e){return h(e,(t,n)=>Vr(n))}function G(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 Oi(){return{...Ai(),...Ti(),...ki(),...$i(),...Ii(),...Pi(),...Mi(),...Li(),...Di()}}function Ai(){return{displayPrint:zr("displayPrint",(e,t)=>({"@media print":{display:t}})),displayRaw:h("display"),overflow:h("overflow"),textOverflow:h("textOverflow"),visibility:h("visibility"),whiteSpace:h("whiteSpace")}}function Ti(){return{flexBasis:h("flexBasis"),flexDirection:h("flexDirection"),flexWrap:h("flexWrap"),justifyContent:h("justifyContent"),alignItems:h("alignItems"),alignContent:h("alignContent"),order:h("order"),flex:h("flex"),flexGrow:h("flexGrow"),flexShrink:h("flexShrink"),alignSelf:h("alignSelf"),justifyItems:h("justifyItems"),justifySelf:h("justifySelf")}}function ki(){const e=(t,n,r)=>Ei(r,"spacing",8)(n);return{gap:h("gap",e),columnGap:h("columnGap",e),rowGap:h("rowGap",e),gridColumn:h("gridColumn"),gridRow:h("gridRow"),gridAutoFlow:h("gridAutoFlow"),gridAutoColumns:h("gridAutoColumns"),gridAutoRows:h("gridAutoRows"),gridTemplateColumns:h("gridTemplateColumns"),gridTemplateRows:h("gridTemplateRows"),gridTemplateAreas:h("gridTemplateAreas"),gridArea:h("gridArea")}}function $i(){return{position:h("position"),zIndex:h("zIndex",(e,t,n)=>{var r;return((r=n.zIndex)==null?void 0:r[e])??t}),top:et("top"),right:et("right"),bottom:et("bottom"),left:et("left")}}function Ii(){const e=(t,n,r)=>Pt(r,"palette",n);return{color:h("color",e),bgcolor:h("backgroundColor",e),backgroundColor:h("backgroundColor",e)}}function Pi(){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:h("width",e),maxWidth:h("maxWidth",e),minWidth:h("minWidth",e),height:h("height",e),maxHeight:h("maxHeight",e),minHeight:h("minHeight",e),boxSizing:h("boxSizing",e)}}function Mi(){const e=(n,r)=>typeof r=="number"?`${r}px solid`:r,t=(n,r,o)=>Pt(o,"palette",r);return{border:h("border",e),borderTop:h("borderTop",e),borderRight:h("borderRight",e),borderBottom:h("borderBottom",e),borderLeft:h("borderLeft",e),borderColor:h("borderColor",t),borderTopColor:h("borderTopColor",t),borderRightColor:h("borderRightColor",t),borderBottomColor:h("borderBottomColor",t),borderLeftColor:h("borderLeftColor",t),borderRadius:h("borderRadius",(n,r,o)=>typeof r=="number"?`${o.shape.borderRadius*r}px`:r)}}function Di(){const e=(t,n,r)=>Pt(r,"typography",n);return{typography:zr("typography",(t,n,r)=>Pt(r,"typography",n)),fontFamily:h("fontFamily",e),fontSize:h("fontSize",(t,n,r)=>Vr(e(t,n,r))),fontStyle:h("fontStyle",e),fontWeight:h("fontWeight",e),letterSpacing:et("letterSpacing"),lineHeight:h("lineHeight"),textAlign:h("textAlign"),textTransform:h("textTransform")}}function Li(){const e=(r,o,s)=>s.spacing(o),t="margin",n="padding";return{m:h(t,e),mt:h("marginTop",e),mr:h("marginRight",e),mb:h("marginBottom",e),ml:h("marginLeft",e),mx:G(t,ue.x,e),my:G(t,ue.y,e),margin:h(t,e),marginTop:h("marginTop",e),marginRight:h("marginRight",e),marginBottom:h("marginBottom",e),marginLeft:h("marginLeft",e),marginX:G(t,ue.x,e),marginY:G(t,ue.y,e),marginInline:G(t,["Inline","InlineStart"],e),marginInlineStart:h("marginInlineStart",e),marginInlineEnd:h("marginInlineEnd",e),marginBlock:G(t,["BlockStart","BlockEnd"],e),marginBlockStart:h("marginBlockStart",e),marginBlockEnd:h("marginBlockEnd",e),p:h(n,e),pt:h("paddingTop",e),pr:h("paddingRight",e),pb:h("paddingBottom",e),pl:h("paddingLeft",e),px:G(n,ue.x,e),py:G(n,ue.y,e),padding:h(n,e),paddingTop:h("paddingTop",e),paddingRight:h("paddingRight",e),paddingBottom:h("paddingBottom",e),paddingLeft:h("paddingLeft",e),paddingX:G(n,ue.x,e),paddingY:G(n,ue.y,e),paddingInline:G(n,["Inline","InlineStart"],e),paddingInlineStart:h("paddingInlineStart",e),paddingInlineEnd:h("paddingInlineEnd",e),paddingBlock:G(n,["BlockStart","BlockEnd"],e),paddingBlockStart:h("paddingBlockStart",e),paddingBlockEnd:h("paddingBlockEnd",e)}}const Tn=Oi(),Zl=Object.keys(Tn);function Ni(e,t,n){return Tn[e](t,n)}function qn(e,t,n){return e in Tn?Ni(e,t,n):jr(e,t)}function Ri(e,t){return Le(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,ps({theme:t},r,s=>qn(n,s,t)??{[n]:s}))}else return qn(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 _i(){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 Hr=["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 Ui(e,t,n,r,o={}){return L(()=>{const s=e(),i=Fi(o.name,s),a=r.ownerState,c=n.reduce((l,d)=>{let f;return typeof d=="function"?f=d({ownerState:a,theme:s,get sx(){return r.sx},get as(){return r.as},props:r}):d&&(f=d),f&&l.push(Gn(f,{name:t,__resolved:!0})),l},[]);let u=[];return o.overridesResolver&&typeof o.overridesResolver=="function"&&i&&(u=o.overridesResolver(r,i).map(l=>l?Gn(l,{}):null).filter(Boolean)),c.concat(u)})}function Gr(e,t){e.__suid=t}function Jn(e){if(typeof e=="function")return e.__suid}function Bi(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-${Br()}`,o="css";const i=Jn(n);return function(...a){function c(u){let l;const d=()=>{const N=u.theme;return N||l||(l=e&&e.onUseTheme?e.onUseTheme():An())},[,f]=Ft(u,r.skipProps||Hr),m=Ui(d,o,a,u,r),y=()=>{const N=u.sx;return N?Array.isArray(N)?N:[N]:[]},g=()=>{if(i)return n;const N=u.as;return N||n},b=i?()=>i:L(()=>Jn(g())),A=r.skipSx?()=>m():()=>{const N=d();return[...m(),...y().map(X=>X.__resolved?X:Ri(X,N))]},M=Wr(()=>b()?void 0:A());return Dr(g,hr(f,{get children(){return u.children},get component(){return b()?u.component:null},get as(){return i?u.as:void 0},get sx(){return b()?A():void 0},get ownerState(){return b()==="system"?u.ownerState:void 0},get class(){return _i([...new Set([u.class,s,M()])])}}))}return Gr(c,"system"),s&&(c.toString=()=>`.${s}`),c}}}const Ql=[...Hr,"classes"],eu=Bi({onUseTheme:()=>Mr()}),Wi="modulepreload",ji=function(e){return"/"+e},Yn={},Vi=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),a=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));o=Promise.allSettled(n.map(c=>{if(c=ji(c),c in Yn)return;Yn[c]=!0;const u=c.endsWith(".css"),l=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${l}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":Wi,u||(d.as="script"),d.crossOrigin="",d.href=c,a&&d.setAttribute("nonce",a),document.head.appendChild(d),u)return new Promise((f,m)=>{d.addEventListener("load",f),d.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(i){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i}return o.then(i=>{for(const a of i||[])a.status==="rejected"&&s(a.reason);return t().catch(s)})},qr="codenomad-use-tauri-native-event-transport";function Jr(){var e;if(typeof window>"u")return!0;try{return((e=window.localStorage)==null?void 0:e.getItem(qr))!=="0"}catch{return!0}}function zi(e){var t;if(!(typeof window>"u"))try{(t=window.localStorage)==null||t.setItem(qr,e?"1":"0")}catch{}}const Ki="codenomad.client-id",Hi="codenomad.connection-id";let yt=null,wt=null;function hn(){return{clientId:Gi(),connectionId:qi()}}function Gi(){return yt||(yt=Yr(Ki,window.localStorage),yt)}function qi(){return wt||(wt=Yr(Hi,window.sessionStorage),wt)}function Yr(e,t){if(typeof window>"u")return Qt();try{const r=t.getItem(e);if(r&&r.trim())return r.trim()}catch{return Qt()}const n=Qt();try{t.setItem(e,n)}catch{}return n}function Qt(){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 gn={exports:{}},en,Xn;function Ji(){if(Xn)return en;Xn=1;var e=1e3,t=e*60,n=t*60,r=n*24,o=r*7,s=r*365.25;en=function(l,d){d=d||{};var f=typeof l;if(f==="string"&&l.length>0)return i(l);if(f==="number"&&isFinite(l))return d.long?c(l):a(l);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(l))};function i(l){if(l=String(l),!(l.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(l);if(d){var f=parseFloat(d[1]),m=(d[2]||"ms").toLowerCase();switch(m){case"years":case"year":case"yrs":case"yr":case"y":return f*s;case"weeks":case"week":case"w":return f*o;case"days":case"day":case"d":return f*r;case"hours":case"hour":case"hrs":case"hr":case"h":return f*n;case"minutes":case"minute":case"mins":case"min":case"m":return f*t;case"seconds":case"second":case"secs":case"sec":case"s":return f*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return f;default:return}}}}function a(l){var d=Math.abs(l);return d>=r?Math.round(l/r)+"d":d>=n?Math.round(l/n)+"h":d>=t?Math.round(l/t)+"m":d>=e?Math.round(l/e)+"s":l+"ms"}function c(l){var d=Math.abs(l);return d>=r?u(l,d,r,"day"):d>=n?u(l,d,n,"hour"):d>=t?u(l,d,t,"minute"):d>=e?u(l,d,e,"second"):l+" ms"}function u(l,d,f,m){var y=d>=f*1.5;return Math.round(l/f)+" "+m+(y?"s":"")}return en}function Yi(e){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=a,n.humanize=Ji(),n.destroy=u,Object.keys(e).forEach(l=>{n[l]=e[l]}),n.names=[],n.skips=[],n.formatters={};function t(l){let d=0;for(let f=0;f<l.length;f++)d=(d<<5)-d+l.charCodeAt(f),d|=0;return n.colors[Math.abs(d)%n.colors.length]}n.selectColor=t;function n(l){let d,f=null,m,y;function g(...b){if(!g.enabled)return;const A=g,M=Number(new Date),N=M-(d||M);A.diff=N,A.prev=d,A.curr=M,d=M,b[0]=n.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let X=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(W,p)=>{if(W==="%%")return"%";X++;const C=n.formatters[p];if(typeof C=="function"){const O=b[X];W=C.call(A,O),b.splice(X,1),X--}return W}),n.formatArgs.call(A,b),(A.log||n.log).apply(A,b)}return g.namespace=l,g.useColors=n.useColors(),g.color=n.selectColor(l),g.extend=r,g.destroy=n.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(m!==n.namespaces&&(m=n.namespaces,y=n.enabled(l)),y),set:b=>{f=b}}),typeof n.init=="function"&&n.init(g),g}function r(l,d){const f=n(this.namespace+(typeof d>"u"?":":d)+l);return f.log=this.log,f}function o(l){n.save(l),n.namespaces=l,n.names=[],n.skips=[];const d=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const f of d)f[0]==="-"?n.skips.push(f.slice(1)):n.names.push(f)}function s(l,d){let f=0,m=0,y=-1,g=0;for(;f<l.length;)if(m<d.length&&(d[m]===l[f]||d[m]==="*"))d[m]==="*"?(y=m,g=f,m++):(f++,m++);else if(y!==-1)m=y+1,g++,f=g;else return!1;for(;m<d.length&&d[m]==="*";)m++;return m===d.length}function i(){const l=[...n.names,...n.skips.map(d=>"-"+d)].join(",");return n.enable(""),l}function a(l){for(const d of n.skips)if(s(l,d))return!1;for(const d of n.names)if(s(l,d))return!0;return!1}function c(l){return l instanceof Error?l.stack||l.message:l}function u(){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 Xi=Yi;(function(e,t){var n={};t.formatArgs=o,t.save=s,t.load=i,t.useColors=r,t.storage=a(),t.destroy=(()=>{let u=!1;return()=>{u||(u=!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 u;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&&(u=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(u[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(u){if(u[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+u[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const l="color: "+this.color;u.splice(1,0,l,"color: inherit");let d=0,f=0;u[0].replace(/%[a-zA-Z%]/g,m=>{m!=="%%"&&(d++,m==="%c"&&(f=d))}),u.splice(f,0,l)}t.log=console.debug||console.log||(()=>{});function s(u){try{u?t.storage.setItem("debug",u):t.storage.removeItem("debug")}catch{}}function i(){let u;try{u=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!u&&typeof process<"u"&&"env"in process&&(u=n.DEBUG),u}function a(){try{return localStorage}catch{}}e.exports=Xi(t);const{formatters:c}=e.exports;c.j=function(u){try{return JSON.stringify(u)}catch(l){return"[UnexpectedJSONParseError]: "+l.message}}})(gn,gn.exports);var Zi=gn.exports;const mn=No(Zi),He=["sse","api","session","actions"],Xr="opencode:logger:namespaces",tn=new Map,ne=new Set,oe=typeof globalThis<"u"?globalThis.console:void 0;function lt(){ne.size===0?mn.disable():mn.enable(Array.from(ne).join(","))}function Vt(){var e;if(!(typeof window>"u"||!(window!=null&&window.localStorage)))try{window.localStorage.setItem(Xr,JSON.stringify(Array.from(ne)))}catch(t){(e=oe==null?void 0:oe.warn)==null||e.call(oe,"Failed to persist logger namespaces",t)}}function Qi(){var e;if(!(typeof window>"u"||!(window!=null&&window.localStorage)))try{const t=window.localStorage.getItem(Xr);if(!t)return;const n=JSON.parse(t);if(!Array.isArray(n))return;for(const r of n)He.includes(r)&&ne.add(r)}catch(t){(e=oe==null?void 0:oe.warn)==null||e.call(oe,"Failed to hydrate logger namespaces",t)}}Qi();lt();function ea(e){const n=mn(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(!He.includes(e))throw new Error(`Unknown logger namespace: ${e}`);return tn.has(e)||tn.set(e,ea(e)),tn.get(e)}function ta(){return He.map(e=>({name:e,enabled:ne.has(e)}))}function na(e){if(!He.includes(e))throw new Error(`Unknown logger namespace: ${e}`);ne.has(e)||(ne.add(e),Vt(),lt())}function ra(e){if(!He.includes(e))throw new Error(`Unknown logger namespace: ${e}`);ne.has(e)&&(ne.delete(e),Vt(),lt())}function oa(){ne.clear(),Vt(),lt()}function sa(){He.forEach(e=>ne.add(e)),Vt(),lt()}const ia={listLoggerNamespaces:ta,enableLogger:na,disableLogger:ra,enableAllLoggers:sa,disableAllLoggers:oa};function aa(){typeof window>"u"||(window.codenomadLogger=ia)}aa();function ca(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)}})}const nn={};var dr;const la=typeof window<"u"?(dr=window.location)==null?void 0:dr.origin:void 0,ua=typeof window<"u"?window.__CODENOMAD_API_BASE__??la:void 0,da=typeof window<"u"?window.__CODENOMAD_EVENTS_URL__??"/api/events":"/api/events",me=(nn==null?void 0:nn.VITE_CODENOMAD_API_BASE)??ua,rn=fa(me,da),tu=me;function nu(e,t){const n=encodeURIComponent(e),r=encodeURIComponent(t);return ha(`/workspaces/${n}/plugin/background-processes/${r}/stream`)}function fa(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 ha(e){if(e.startsWith("http://")||e.startsWith("https://")||!me)return e;const t=e.startsWith("/")?e:`/${e}`;return`${me}${t}`}const Zn=ce("api"),Qn=ce("sse");function Zr(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 Se(e,t){if(t){Zn.info(e,t);return}Zn.info(e)}async function Qr(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 w(e,t){const n=me?new URL(e,me).toString():e,r=Zr(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();Se(`${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 Qr(i);throw Se(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s,error:c}),new Error(c||`Request failed with ${i.status}`)}const a=Date.now()-s;return Se(`${o} ${e} -> ${i.status}`,{durationMs:a}),i.status===204?void 0:await i.json()}catch(i){throw Se(`${o} ${e} failed`,{durationMs:Date.now()-s,error:i}),i}}async function ga(e,t){const n=me?new URL(e,me).toString():e,r=Zr(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();Se(`${o} ${e}`);const i=await fetch(n,{...t,headers:r,credentials:(t==null?void 0:t.credentials)??"include"});if(!i.ok){const a=await Qr(i);throw Se(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s,error:a}),new Error(a||`Request failed with ${i.status}`)}return Se(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s}),i}const re={fetchWorkspaces(){return w("/api/workspaces")},fetchWorktrees(e){return w(`/api/workspaces/${encodeURIComponent(e)}/worktrees`)},createWorktree(e,t){return w(`/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 w(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}${o}`,{method:"DELETE"})},readWorktreeMap(e){return w(`/api/workspaces/${encodeURIComponent(e)}/worktrees/map`)},writeWorktreeMap(e,t){return w(`/api/workspaces/${encodeURIComponent(e)}/worktrees/map`,{method:"PUT",body:JSON.stringify(t)})},createWorkspace(e){return w("/api/workspaces",{method:"POST",body:JSON.stringify(e)})},fetchSidecars(){return w("/api/sidecars")},createSidecar(e){return w("/api/sidecars",{method:"POST",body:JSON.stringify(e)})},updateSidecar(e,t){return w(`/api/sidecars/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})},deleteSidecar(e){return w(`/api/sidecars/${encodeURIComponent(e)}`,{method:"DELETE"})},createPreview(e){return w("/api/previews",{method:"POST",body:JSON.stringify(e)})},deletePreview(e){return w(`/api/previews/${encodeURIComponent(e)}`,{method:"DELETE"})},fetchServerMeta(){return w("/api/meta")},probeRemoteServer(e){return w("/api/remote-servers/probe",{method:"POST",body:JSON.stringify(e)})},createRemoteProxySession(e){return w("/api/remote-proxy/sessions",{method:"POST",body:JSON.stringify(e)})},deleteRemoteProxySession(e){return w(`/api/remote-proxy/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})},fetchAuthStatus(){return w("/api/auth/status")},listConfigFiles(){return w("/api/config-files")},readConfigFile(e){return w(`/api/config-files/${encodeURIComponent(e)}/content`)},writeConfigFile(e,t){const n={contents:t};return w(`/api/config-files/${encodeURIComponent(e)}/content`,{method:"PUT",body:JSON.stringify(n)})},setServerPassword(e){return w("/api/auth/password",{method:"POST",body:JSON.stringify({password:e})})},deleteWorkspace(e){return w(`/api/workspaces/${encodeURIComponent(e)}`,{method:"DELETE"})},cloneWorkspaceRepository(e){return w("/api/workspaces/clone",{method:"POST",body:JSON.stringify(e)})},listWorkspaceFiles(e,t="."){const n=new URLSearchParams({path:t});return w(`/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),w(`/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),w(`/api/workspaces/${encodeURIComponent(e)}/files/content?${r.toString()}`)},writeWorkspaceFile(e,t,n,r){const o=new URLSearchParams({path:t});return r!=null&&r.worktree&&r.worktree!=="root"&&o.set("worktree",r.worktree),w(`/api/workspaces/${encodeURIComponent(e)}/files/content?${o.toString()}`,{method:"PUT",body:JSON.stringify({contents:n})})},fetchWorktreeGitStatus(e,t){return w(`/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),w(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-diff?${r.toString()}`)},stageWorktreeGitPaths(e,t,n){return w(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-stage`,{method:"POST",body:JSON.stringify(n)})},unstageWorktreeGitPaths(e,t,n){return w(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-unstage`,{method:"POST",body:JSON.stringify(n)})},commitWorktreeGitChanges(e,t,n){return w(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-commit`,{method:"POST",body:JSON.stringify(n)})},fetchConfigOwner(e){return w(`/api/storage/config/${encodeURIComponent(e)}`)},patchConfigOwner(e,t){return w(`/api/storage/config/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t??{})})},fetchStateOwner(e){return w(`/api/storage/state/${encodeURIComponent(e)}`)},patchStateOwner(e,t){return w(`/api/storage/state/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t??{})})},validateBinary(e){return w("/api/storage/binaries/validate",{method:"POST",body:JSON.stringify({path:e})})},fetchSpeechCapabilities(){return w("/api/speech/capabilities")},transcribeAudio(e){return w("/api/speech/transcribe",{method:"POST",body:JSON.stringify(e)})},synthesizeSpeech(e){return w("/api/speech/synthesize",{method:"POST",body:JSON.stringify(e)})},synthesizeSpeechStream(e,t){return ga("/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 w(r?`/api/filesystem?${r}`:"/api/filesystem")},createFileSystemFolder(e,t){return w("/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),w(`/api/filesystem/files/content?${n.toString()}`)},readInstanceData(e){return w(`/api/storage/instances/${encodeURIComponent(e)}`)},writeInstanceData(e,t){return w(`/api/storage/instances/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})},deleteInstanceData(e){return w(`/api/storage/instances/${encodeURIComponent(e)}`,{method:"DELETE"})},listBackgroundProcesses(e){return w(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes`)},stopBackgroundProcess(e,t){return w(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes/${encodeURIComponent(t)}/stop`,{method:"POST"})},terminateBackgroundProcess(e,t){return w(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes/${encodeURIComponent(t)}/terminate`,{method:"POST"})},updateVoiceMode(e,t){const n=hn();return w(`/workspaces/${encodeURIComponent(e)}/plugin/voice-mode`,{method:"POST",body:JSON.stringify({...n,enabled:t})})},sendClientConnectionPong(e,t){const n={method:"POST",body:JSON.stringify(e)};return t&&(n.signal=t),w("/api/client-connections/pong",n)},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 w(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes/${encodeURIComponent(t)}/output${s}`)},connectEvents(e,t,n){const r=hn(),o=ma(r);Qn.info(`Connecting to ${o}`);const s=new EventSource(o,{withCredentials:!0});return ca(s,{onEvent:e,onError:t,onPing:n,logger:Qn}),s}};function ma(e){const t=new URL(rn,typeof window<"u"?window.location.origin:"http://localhost");return t.searchParams.set("clientId",e.clientId),t.searchParams.set("connectionId",e.connectionId),rn.startsWith("http://")||rn.startsWith("https://")?t.toString():`${t.pathname}${t.search}`}const pa={initialDelayMs:1e3,maxDelayMs:1e4,multiplier:2};function ya(e){return{reconnect:{...pa,...e==null?void 0:e.reconnect}}}function eo(){if(typeof window>"u"||window.__CODENOMAD_WINDOW_CONTEXT__==="remote")return"remote";if(window.__CODENOMAD_WINDOW_CONTEXT__==="local")return"local";const e=window;return typeof e.electronAPI<"u"||typeof e.__TAURI__<"u"||typeof navigator<"u"&&/tauri/i.test(navigator.userAgent)?"local":"remote"}function zt(){if(typeof window>"u")return"web";const e=window.__CODENOMAD_RUNTIME_HOST__;if(e)return e;const t=window;return typeof t.electronAPI<"u"?"electron":typeof t.__TAURI__<"u"||typeof navigator<"u"&&/tauri/i.test(navigator.userAgent)?"tauri":"web"}function wa(){if(typeof navigator>"u")return"desktop";const e=navigator.userAgentData;if(e!=null&&e.mobile)return"mobile";const t=navigator.userAgent.toLowerCase();return/android|iphone|ipad|ipod|blackberry|mini|windows phone|mobile|silk/.test(t)?"mobile":"desktop"}const ba=ce("actions");let we=null;function Ca(){return we||(we={host:zt(),platform:wa(),windowContext:eo()},typeof window<"u"&&ba.info(`[runtime] host=${we.host} platform=${we.platform} context=${we.windowContext}`),we)}const $e=Ca(),Sa=()=>zt()==="electron",va=()=>zt()==="tauri",ru=()=>zt()==="web",Kt=()=>Sa()||va(),Ht=()=>eo()==="local",ou=()=>Kt()&&Ht(),su=()=>Kt()&&Ht(),iu=()=>Kt()&&Ht(),au=()=>Kt()&&Ht();function R(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)}function qe(e,t,n,r,o){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var be,q,Ie,bt;const er="__TAURI_TO_IPC_KEY__";function to(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class xa{constructor(t){be.set(this,void 0),q.set(this,0),Ie.set(this,[]),bt.set(this,void 0),qe(this,be,t||(()=>{})),this.id=to(n=>{const r=n.index;if("end"in n){r==R(this,q,"f")?this.cleanupCallback():qe(this,bt,r);return}const o=n.message;if(r==R(this,q,"f")){for(R(this,be,"f").call(this,o),qe(this,q,R(this,q,"f")+1);R(this,q,"f")in R(this,Ie,"f");){const s=R(this,Ie,"f")[R(this,q,"f")];R(this,be,"f").call(this,s),delete R(this,Ie,"f")[R(this,q,"f")],qe(this,q,R(this,q,"f")+1)}R(this,q,"f")===R(this,bt,"f")&&this.cleanupCallback()}else R(this,Ie,"f")[r]=o})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){qe(this,be,t)}get onmessage(){return R(this,be,"f")}[(be=new WeakMap,q=new WeakMap,Ie=new WeakMap,bt=new WeakMap,er)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[er]()}}class tr{constructor(t,n,r){this.plugin=t,this.event=n,this.channelId=r}async unregister(){return je(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}}async function cu(e,t,n){const r=new xa(n);try{return await je(`plugin:${e}|register_listener`,{event:t,handler:r}),new tr(e,t,r.id)}catch{return await je(`plugin:${e}|registerListener`,{event:t,handler:r}),new tr(e,t,r.id)}}async function je(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}var nr;(function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_CREATED="tauri://window-created",e.WEBVIEW_CREATED="tauri://webview-created",e.DRAG_ENTER="tauri://drag-enter",e.DRAG_OVER="tauri://drag-over",e.DRAG_DROP="tauri://drag-drop",e.DRAG_LEAVE="tauri://drag-leave"})(nr||(nr={}));async function Ea(e,t){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(e,t),await je("plugin:event|unlisten",{event:e,eventId:t})}async function Oa(e,t,n){var r;const o=typeof(n==null?void 0:n.target)=="string"?{kind:"AnyLabel",label:n.target}:(r=n==null?void 0:n.target)!==null&&r!==void 0?r:{kind:"Any"};return je("plugin:event|listen",{event:e,target:o,handler:to(t)}).then(s=>async()=>Ea(e,s))}const Ct=ce("sse"),Aa={invoke:je,listen:Oa};function Ta(e){let t=!1;return()=>{var n;t||(t=!0,(n=e.onError)==null||n.call(e))}}function ka(e){return e==="connected"?"connected":e==="connecting"?"connecting":"disconnected"}async function $a(e,t,n=Aa){let r=!1,o=!1,s=null;const i=Ta(e),a=[],c=[],u=g=>s===g,l=g=>{var A,M;if(!g||!u(g.generation))return;o||(o=!0,(A=e.onStatus)==null||A.call(e,"connected"),(M=e.onOpen)==null||M.call(e));const b=g.events??[];b.length!==0&&e.onBatch(b)},d=g=>{var b,A;if(!(!g||!u(g.generation))){if((b=e.onStatus)==null||b.call(e,ka(g.state)),g.state==="connected"&&!o&&(o=!0,(A=e.onOpen)==null||A.call(e)),g.state==="unauthorized"?Ct.warn("Native desktop event transport is waiting for authentication",{reason:g.reason,reconnectAttempt:g.reconnectAttempt,nextDelayMs:g.nextDelayMs,stats:g.stats}):g.state==="error"?Ct.warn("Native desktop event transport reported an error",{reason:g.reason,reconnectAttempt:g.reconnectAttempt,nextDelayMs:g.nextDelayMs,statusCode:g.statusCode,stats:g.stats}):(g.state==="disconnected"||g.state==="stopped")&&g.stats&&Ct.info("Native desktop event transport stats",{state:g.state,reconnectAttempt:g.reconnectAttempt,stats:g.stats}),g.state==="stopped"){i();return}g.terminal&&i()}},f=()=>{if(s!==null){for(const g of c.splice(0,c.length))d(g);for(const g of a.splice(0,a.length))l(g)}},m=await n.listen("desktop:event-batch",g=>{if(r)return;const b=g.payload;if(b){if(s===null){a.push(b);return}l(b)}}),y=await n.listen("desktop:event-stream-status",g=>{if(r)return;const b=g.payload;if(b){if(s===null){c.push(b);return}d(b)}});try{const g=await n.invoke("desktop_events_start",{request:t});if(!(g!=null&&g.started))throw new Error((g==null?void 0:g.reason)??"desktop event transport unavailable");s=g.generation??null,f()}catch(g){throw m(),y(),g}return{disconnect(){r||(r=!0,m(),y(),n.invoke("desktop_events_stop").catch(g=>{Ct.warn("Failed to stop native desktop event transport",g)}))}}}const Je=ce("sse");async function Ia(e){const t=()=>{var r,o;(r=e.onStatus)==null||r.call(e,"disconnected"),(o=e.onError)==null||o.call(e)},n=re.connectEvents(r=>{e.onBatch([r])},t,e.onPing);return n.onopen=()=>{var r,o;(r=e.onStatus)==null||r.call(e,"connected"),(o=e.onOpen)==null||o.call(e)},{disconnect(){n.close()}}}async function Pa(e,t){const n=Jr();if($e.host==="tauri"&&$e.windowContext==="local"&&n)try{const r=await $a(e,ya(t));return Je.info("Event transport: rust-native (desktop_event_transport)"),r}catch(r){Je.warn("Failed to start native desktop event transport, falling back to browser EventSource",r)}else $e.host==="tauri"&&$e.windowContext==="remote"?Je.info("Event transport: browser-eventsource forced for remote Tauri window"):$e.host==="tauri"&&Je.info("Event transport: browser-eventsource forced by settings");return Je.info(`Event transport: browser-eventsource (host=${$e.host})`),Ia(e)}async function Ma(e,t={}){const{maxAttempts:n=3,initialDelayMs:r=100,maxDelayMs:o=5e3,backoffMultiplier:s=2,timeoutMs:i,shouldRetry:a=()=>!0}=t;let c=null,u=r;for(let l=1;l<=n;l++)try{if(i){const d=new AbortController,f=setTimeout(()=>d.abort(),i);try{const m=await e(d.signal);return clearTimeout(f),m}catch(m){throw clearTimeout(f),m}}return await e()}catch(d){const f=d instanceof Error?d:new Error(String(d));if(c=f,l<n&&a(f,l))await new Promise(m=>setTimeout(m,u)),u=Math.min(u*s,o);else throw f}throw c||new Error("Failed after retries")}function Da(e){return!!(e.name==="AbortError"||e.name==="TimeoutError"||e.message.includes("Failed to fetch")||e.message.includes("NetworkError")||e.message.includes("timeout"))}const on=1e3,La=1e4,pn=ce("sse");function Pe(e,t){if(t){pn.info(e,t);return}pn.info(e)}class Na{constructor(){this.handlers=new Map,this.openHandlers=new Set,this.statusHandlers=new Set,this.connection=null,this.connectGeneration=0,this.retryDelay=on,this.retryTimer=null,this.connect()}async connect(){const t=++this.connectGeneration;this.clearReconnectTimer(),this.connection&&(this.connection.disconnect(),this.connection=null),Pe("Connecting to backend events stream");try{const n=await Pa({onBatch:r=>this.dispatchBatch(r),onError:()=>{t===this.connectGeneration&&this.scheduleReconnect()},onStatus:r=>{t===this.connectGeneration&&this.emitTransportStatus(r)},onOpen:()=>{t===this.connectGeneration&&(Pe("Events stream connected"),this.retryDelay=on,this.openHandlers.forEach(r=>r()))},onPing:r=>{const s={...hn(),pingTs:r.ts};Ma(i=>re.sendClientConnectionPong(s,i),{maxAttempts:3,initialDelayMs:100,maxDelayMs:2e3,timeoutMs:1e4,shouldRetry:i=>Da(i)}).catch(i=>{pn.warn("Failed to send client connection pong after retries",i)})}});if(t!==this.connectGeneration){n.disconnect();return}this.connection=n}catch(n){if(t!==this.connectGeneration)return;Pe("Events stream failed to connect, scheduling reconnect",{error:n instanceof Error?n.message:String(n)}),this.scheduleReconnect()}}scheduleReconnect(){this.retryTimer||(this.connection&&(this.connection.disconnect(),this.connection=null),this.emitTransportStatus("disconnected"),Pe("Events stream disconnected, scheduling reconnect",{delayMs:this.retryDelay}),this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.retryDelay=Math.min(this.retryDelay*2,La),this.connect()},this.retryDelay))}clearReconnectTimer(){this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null)}dispatch(t){var n,r;(n=this.handlers.get("*"))==null||n.forEach(o=>o(t)),(r=this.handlers.get(t.type))==null||r.forEach(o=>o(t))}dispatchBatch(t){t.length!==0&&(Pe("event batch",{size:t.length}),ve(()=>{for(const n of t)this.dispatch(n)}))}emitTransportStatus(t){this.statusHandlers.forEach(n=>n(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)}onTransportStatus(t){return this.statusHandlers.add(t),()=>this.statusHandlers.delete(t)}restart(t="manual restart"){this.retryDelay=on,this.clearReconnectTimer(),this.connection&&(this.connection.disconnect(),this.connection=null),Pe("Restarting backend events stream",{reason:t}),this.connect()}}const Ot=new Na,Ra=Object.freeze(Object.defineProperty({__proto__:null,serverEvents:Ot},Symbol.toStringTag,{value:"Module"})),_a=ce("actions"),rr={messageHistory:[],agentModelSelections:{}};function or(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){_a.warn("Failed to compare config objects",n)}return!1}class Fa{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,Ot.on("storage.configChanged",t=>{t.type==="storage.configChanged"&&this.setOwnerCache("config",t.owner,t.value)}),Ot.on("storage.stateChanged",t=>{t.type==="storage.stateChanged"&&this.setOwnerCache("state",t.owner,t.value)}),Ot.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=re.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 re.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=re.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 re.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=re.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 re.writeInstanceData(t,r),this.setInstanceDataCache(t,r)}async deleteInstanceData(t){await re.deleteInstanceData(t),this.setInstanceDataCache(t,rr)}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&&or(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??rr,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&&or(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 ee=new Fa,no=ce("api"),Gt={messageHistory:[],agentModelSelections:{}},[kn,ro]=$(new Map),St=new Map,Ve=new Map;function oo(e){const t=e??Gt;return{...t,messageHistory:Array.isArray(t.messageHistory)?[...t.messageHistory]:[],agentModelSelections:{...t.agentModelSelections??{}}}}function sr(e){if(Ve.has(e))return;const t=ee.onInstanceDataChanged(e,n=>{Mt(e,n)});Ve.set(e,t)}function Ua(e){const t=Ve.get(e);t&&(t(),Ve.delete(e))}function Mt(e,t){ro(n=>{const r=new Map(n);return r.set(e,oo(t)),r})}async function qt(e){if(!e||kn().has(e))return;if(St.has(e)){await St.get(e);return}const t=ee.loadInstanceData(e).then(n=>{Mt(e,n),sr(e)}).catch(n=>{no.warn("Failed to load instance data",n),Mt(e,Gt),sr(e)}).finally(()=>{St.delete(e)});St.set(e,t),await t}async function so(e,t){if(!e)return;await qt(e);const n=kn().get(e)??Gt,r=oo(n);t(r);try{await ee.saveInstanceData(e,r)}catch(o){no.warn("Failed to persist instance data",o)}Mt(e,r)}function io(e){return kn().get(e)??Gt}function Ba(e){ro(t=>{if(!t.has(e))return t;const n=new Map(t);return n.delete(e),n}),Ua(e)}const Wa=Ke(),ja={getInstanceConfig:io,ensureInstanceConfig:qt,updateInstanceConfig:so,clearInstanceConfig:Ba},lu=e=>(he(()=>{for(const t of Ve.values())t();Ve.clear()}),ge(Wa.Provider,{value:ja,get children(){return e.children}})),Va=ce("api"),[ir,yn]=$(null),[uu,ar]=$(!1),[du,At]=$(null);let Ye=null;async function za(e=!1){return!e&&ir()?ir():Ye||(ar(!0),At(null),Ye=re.fetchSpeechCapabilities().then(t=>(yn(t),At(null),t)).catch(t=>(Va.error("Failed to load speech capabilities",t),yn(null),At(t instanceof Error?t.message:String(t)),null)).finally(()=>{ar(!1),Ye=null}),Ye)}function Ka(){yn(null),At(null)}const x=ce("actions"),Ha=20,Ga=5,qa=50,ao={preset:"balanced",thinking:"collapsed"},I={showThinkingBlocks:!1,showKeyboardShortcutHints:!0,thinkingBlocksExpansion:"collapsed",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};function cr(e,t){return e==="expanded"||e==="collapsed"?e:t}function Ja(e){return e==="minimal"||e==="balanced"||e==="detailed"||e==="everything"||e==="custom"?e:ao.preset}function Ya(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e))n&&(r==="expanded"||r==="collapsed")&&(t[n]=r);return t}function Xa(e,t){const n=e&&typeof e=="object"&&!Array.isArray(e)?e:void 0,r=cr(t.thinkingBlocksExpansion,ao.thinking);return{preset:Ja(n==null?void 0:n.preset),thinking:cr(n==null?void 0:n.thinking,r),tools:Ya(n==null?void 0:n.tools)}}const Me={provider:"openai-compatible",sttModel:"gpt-4o-mini-transcribe",ttsModel:"gpt-4o-mini-tts",ttsVoice:"alloy",playbackMode:"streaming",ttsFormat:"mp3"};function co(e){const t=e??{};return{showThinkingBlocks:t.showThinkingBlocks??I.showThinkingBlocks,showKeyboardShortcutHints:t.showKeyboardShortcutHints??I.showKeyboardShortcutHints,thinkingBlocksExpansion:t.thinkingBlocksExpansion??I.thinkingBlocksExpansion,showMessageTimeline:t.showMessageTimeline??I.showMessageTimeline,showTimelineTools:t.showTimelineTools??I.showTimelineTools,holdLongAssistantReplies:t.holdLongAssistantReplies??I.holdLongAssistantReplies,promptSubmitOnEnter:t.promptSubmitOnEnter??I.promptSubmitOnEnter,showPromptVoiceInput:t.showPromptVoiceInput??I.showPromptVoiceInput,locale:t.locale??I.locale,diffViewMode:t.diffViewMode??I.diffViewMode,toolCallExpansionDefaults:Xa(t.toolCallExpansionDefaults,t),toolOutputExpansion:t.toolOutputExpansion??I.toolOutputExpansion,diagnosticsExpansion:t.diagnosticsExpansion??I.diagnosticsExpansion,toolInputsVisibility:t.toolInputsVisibility==="hidden"||t.toolInputsVisibility==="collapsed"||t.toolInputsVisibility==="expanded"?t.toolInputsVisibility:I.toolInputsVisibility,showUsageMetrics:t.showUsageMetrics??I.showUsageMetrics,autoCleanupBlankSessions:t.autoCleanupBlankSessions??I.autoCleanupBlankSessions,keepUnseenSubagentIdleStatus:t.keepUnseenSubagentIdleStatus??I.keepUnseenSubagentIdleStatus,osNotificationsEnabled:t.osNotificationsEnabled??I.osNotificationsEnabled,osNotificationsAllowWhenVisible:t.osNotificationsAllowWhenVisible??I.osNotificationsAllowWhenVisible,notifyOnNeedsInput:t.notifyOnNeedsInput??I.notifyOnNeedsInput,notifyOnIdle:t.notifyOnIdle??I.notifyOnIdle}}function lo(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 uo(e){const t=e??{};return{provider:t.provider==="openai-compatible"?t.provider:Me.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():Me.sttModel,ttsModel:typeof t.ttsModel=="string"&&t.ttsModel.trim()?t.ttsModel.trim():Me.ttsModel,ttsVoice:typeof t.ttsVoice=="string"&&t.ttsVoice.trim()?t.ttsVoice.trim():Me.ttsVoice,playbackMode:t.playbackMode==="buffered"||t.playbackMode==="streaming"?t.playbackMode:Me.playbackMode,ttsFormat:t.ttsFormat==="wav"||t.ttsFormat==="opus"||t.ttsFormat==="aac"||t.ttsFormat==="mp3"?t.ttsFormat:Me.ttsFormat}}function Xe(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 Za(e){var n,r,o;const t=e??{};return{recentFolders:Xe(t.recentFolders,s=>{if(!s||typeof s!="object")return null;const i=s.path,a=s.lastAccessed,c=s.projectName;if(typeof i!="string")return null;const u=typeof a=="number"?a:Date.now();return{path:i,lastAccessed:u,...typeof c=="string"&&c.trim()?{projectName:c.trim()}:{}}}),opencodeBinaries:Xe(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,u=typeof s.label=="string"?s.label:void 0;return{path:i,version:c,label:u,lastUsed:a}}),remoteServers:Xe(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 u=typeof s.createdAt=="string"?s.createdAt:new Date().toISOString(),l=typeof s.updatedAt=="string"?s.updatedAt:u,d=typeof s.lastConnectedAt=="string"?s.lastConnectedAt:void 0;return{id:i,name:a,baseUrl:c,skipTlsVerify:!!s.skipTlsVerify,createdAt:u,updatedAt:l,lastConnectedAt:d}}).sort((s,i)=>{const a=s.lastConnectedAt??s.updatedAt;return(i.lastConnectedAt??i.updatedAt).localeCompare(a)}),models:{recents:Xe((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:Xe((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:lo((o=t.models)==null?void 0:o.thinkingSelections)}}}function Qa(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=lo(t.environmentVariables),i=ec(t.secureEnvVars),a=uo(t.speech);return{listeningMode:n,logLevel:r,opencodeBinary:o,environmentVariables:s,secureEnvVars:i,speech:a}}function ec(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function fo(e){return`${e.providerId}/${e.modelId}`}function ho(e,t){const n=t.find(o=>o.path===e),r=t.filter(o=>o.path!==e);return r.unshift({path:e,lastAccessed:Date.now(),...n!=null&&n.projectName?{projectName:n.projectName}:{}}),r.slice(0,Ha)}function $n(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 tc(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??nc(),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 go(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 nc(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`remote-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}const[In,Dt]=$({}),[rc,Lt]=$({}),[oc,Nt]=$({}),[mo,nt]=$(!1),[po,sc]=$(Jr()),ic=L(()=>co(In().settings)),yo=L(()=>In().theme??"system"),ie=L(()=>Qa(rc())),ae=L(()=>Za(oc())),B=ic,ut=L(()=>ae().recentFolders),dt=L(()=>ae().opencodeBinaries),ze=L(()=>ae().remoteServers);let vt=null;async function Jt(){mo()||(vt||(vt=Promise.all([ee.loadConfigOwner("ui"),ee.loadConfigOwner("server"),ee.loadStateOwner("ui")]).then(([e,t,n])=>{Dt(e),Lt(t),Nt(n),nt(!0)}).catch(e=>{x.error("Failed to load settings",e),Dt({}),Lt({}),Nt({}),nt(!0)}).finally(()=>{vt=null})),await vt)}async function Y(e,t){await Jt();const n=await ee.patchConfigOwner(e,t);e==="ui"&&Dt(n),e==="server"&&Lt(n)}function ac(e){po()!==e&&(sc(e),zi(e),Vi(async()=>{const{serverEvents:t}=await Promise.resolve().then(()=>Ra);return{serverEvents:t}},void 0).then(({serverEvents:t})=>{t.restart("desktop transport preference changed")}).catch(t=>{x.error("Failed to restart backend events stream after desktop transport preference change",t)}))}async function K(e,t){await Jt();const n=await ee.patchStateOwner(e,t);Nt(n)}function H(e){const t=In(),r={settings:co({...t.settings??{},...e})};Y("ui",r).catch(o=>x.error("Failed to patch ui settings",o))}function wo(e){H(e)}function cc(e){yo()!==e&&Y("ui",{theme:e}).catch(t=>x.error("Failed to set theme",t))}async function lc(e){ie().listeningMode!==e&&await Y("server",{listeningMode:e})}function Pn(e){Y("server",{environmentVariables:e}).catch(t=>x.error("Failed to update environment variables",t))}function uc(e,t,n=!0){const r=ie().environmentVariables;Pn({...r,[e]:t});const o=ie().secureEnvVars,s=e.toUpperCase(),i=o.some(a=>a.toUpperCase()===s);if(n){if(!i){const a=[...o,e];Y("server",{secureEnvVars:a}).catch(c=>x.error("Failed to add secure env var",c))}}else if(i){const a=o.filter(c=>c.toUpperCase()!==s);Y("server",{secureEnvVars:a}).catch(c=>x.error("Failed to remove secure env var",c))}}function dc(e){const t=ie().environmentVariables,{[e]:n,...r}=t;Pn(r)}function fc(e){return ie().secureEnvVars.some(n=>n.toUpperCase()===e.toUpperCase())}function hc(e){const t=ie().secureEnvVars,n=e.toUpperCase(),o=t.some(s=>s.toUpperCase()===n)?t.filter(s=>s.toUpperCase()!==n):[...t,e];Y("server",{secureEnvVars:o}).catch(s=>x.error("Failed to update secure env vars",s))}function gc(e){const t=e&&e.trim().length>0?e:"opencode";Y("server",{opencodeBinary:t}).catch(r=>x.error("Failed to set default binary",r));const n=$n(t,void 0,dt());K("ui",{opencodeBinaries:n}).catch(r=>x.error("Failed to update binary list",r))}function mc(e){Y("server",{logLevel:e??"DEBUG"}).catch(n=>x.error("Failed to set log level",n))}async function pc(e){const t=e.apiKey,{apiKey:n,...r}=e,o=uo({...ie().speech,...r,...t===null?{}:{apiKey:t}}),{hasApiKey:s,...i}=o,a={...i,...t===null?{apiKey:null}:{}};try{await Y("server",{speech:a})}catch(c){throw x.error("Failed to update speech settings",c),c}}function yc(e,t){const n=$n(e,t,dt());K("ui",{opencodeBinaries:n}).catch(r=>x.error("Failed to add binary",r))}function wc(e){const t=dt().filter(n=>n.path!==e);K("ui",{opencodeBinaries:t}).catch(n=>x.error("Failed to remove binary",n)),ie().opencodeBinary===e&&Y("server",{opencodeBinary:"opencode"}).catch(n=>x.error("Failed to reset default binary",n))}function bc(e){const t=ho(e,ut());K("ui",{recentFolders:t}).catch(n=>x.error("Failed to add recent folder",n))}function Cc(e){const t=ut().filter(n=>n.path!==e);K("ui",{recentFolders:t}).catch(n=>x.error("Failed to remove recent folder",n))}async function Sc(e,t){const n=t.trim();if(!e||!n)return;const r=ut().map(o=>o.path===e?{...o,projectName:n}:o);try{await K("ui",{recentFolders:r})}catch(o){throw x.error("Failed to rename recent folder",o),o}}async function vc(e){const t=tc(e,ze());return await K("ui",{remoteServers:go(t,ze())}),t}async function xc(e){const t=ze().find(o=>o.id===e);if(!t)return;const n=new Date().toISOString(),r={...t,updatedAt:n,lastConnectedAt:n};await K("ui",{remoteServers:go(r,ze())})}function Ec(e){const t=ze().filter(n=>n.id!==e);K("ui",{remoteServers:t}).catch(n=>x.error("Failed to remove remote server",n))}function Oc(e,t){const n=t&&t.trim().length>0?t:ie().opencodeBinary,r=ho(e,ut()),o=$n(n,void 0,dt());K("ui",{recentFolders:r,opencodeBinaries:o}).catch(s=>x.error("Failed to update ui state on launch",s)),Y("server",{opencodeBinary:n}).catch(s=>x.error("Failed to persist selected binary",s))}function Ac(e){if(!e.providerId||!e.modelId)return;const n=ae().models.recents.filter(o=>o.providerId!==e.providerId||o.modelId!==e.modelId),r=[e,...n].slice(0,Ga);K("ui",{models:{recents:r}}).catch(o=>x.error("Failed to update model recents",o))}function Tc(e){return!e.providerId||!e.modelId?!1:ae().models.favorites.some(t=>t.providerId===e.providerId&&t.modelId===e.modelId)}function kc(e){if(!e.providerId||!e.modelId)return;const t=ae().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,qa);K("ui",{models:{favorites:r}}).catch(o=>x.error("Failed to update model favorites",o))}function $c(e){if(!(!e.providerId||!e.modelId))return ae().models.thinkingSelections[fo(e)]}function Ic(e,t){if(!e.providerId||!e.modelId)return;const n=fo(e);if(ae().models.thinkingSelections[n]===t)return;const o={...ae().models.thinkingSelections};t?o[n]=t:delete o[n],K("ui",{models:{thinkingSelections:o}}).catch(s=>x.error("Failed to update thinking selection",s))}function Pc(e){B().diffViewMode!==e&&H({diffViewMode:e})}function Mc(e){const t=B();t.toolOutputExpansion===e&&t.toolCallExpansionDefaults.tools.other===e||H({toolOutputExpansion:e,toolCallExpansionDefaults:{...t.toolCallExpansionDefaults,preset:"custom",tools:{...t.toolCallExpansionDefaults.tools,other:e}}})}function Dc(e){B().diagnosticsExpansion!==e&&H({diagnosticsExpansion:e})}function Lc(e){B().toolInputsVisibility!==e&&H({toolInputsVisibility:e})}function Nc(e){const t=B();t.thinkingBlocksExpansion===e&&t.toolCallExpansionDefaults.thinking===e||H({thinkingBlocksExpansion:e,toolCallExpansionDefaults:{...t.toolCallExpansionDefaults,preset:"custom",thinking:e}})}function Rc(){H({showThinkingBlocks:!B().showThinkingBlocks})}function _c(){wo({showKeyboardShortcutHints:!B().showKeyboardShortcutHints})}function Fc(){H({showTimelineTools:!B().showTimelineTools})}function Uc(){H({showMessageTimeline:!(B().showMessageTimeline??!0)})}function Bc(){H({showUsageMetrics:!B().showUsageMetrics})}function Wc(){H({promptSubmitOnEnter:!B().promptSubmitOnEnter})}function jc(){H({showPromptVoiceInput:!B().showPromptVoiceInput})}function Vc(){const e=!B().autoCleanupBlankSessions;x.info("toggle auto cleanup",{value:e}),H({autoCleanupBlankSessions:e})}async function zc(e,t,n){!e||!t||!n.providerId||!n.modelId||(await qt(e),await so(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 Kc(e,t){return!e||!t?void 0:(await qt(e),(io(e).agentModelSelections??{})[t])}Jt().catch(e=>{x.error("Failed to initialize settings",e)});const bo=Ke(),Hc={isLoaded:mo,preferences:B,useTauriNativeEventTransport:po,setUseTauriNativeEventTransport:ac,updatePreferences:wo,themePreference:yo,setThemePreference:cc,serverSettings:ie,setListeningMode:lc,updateEnvironmentVariables:Pn,addEnvironmentVariable:uc,removeEnvironmentVariable:dc,isSecureEnvVar:fc,toggleSecureEnvVar:hc,updateLastUsedBinary:gc,updateLogLevel:mc,updateSpeechSettings:pc,recentFolders:ut,opencodeBinaries:dt,remoteServers:ze,uiState:ae,addRecentFolder:bc,removeRecentFolder:Cc,renameRecentFolderProject:Sc,addOpenCodeBinary:yc,removeOpenCodeBinary:wc,saveRemoteServerProfile:vc,markRemoteServerConnected:xc,removeRemoteServerProfile:Ec,recordWorkspaceLaunch:Oc,addRecentModelPreference:Ac,isFavoriteModelPreference:Tc,toggleFavoriteModelPreference:kc,getModelThinkingSelection:$c,setModelThinkingSelection:Ic,toggleShowThinkingBlocks:Rc,toggleKeyboardShortcutHints:_c,toggleShowMessageTimeline:Uc,toggleShowTimelineTools:Fc,toggleUsageMetrics:Bc,toggleAutoCleanupBlankSessions:Vc,togglePromptSubmitOnEnter:Wc,toggleShowPromptVoiceInput:jc,setDiffViewMode:Pc,setToolOutputExpansion:Mc,setDiagnosticsExpansion:Dc,setThinkingBlocksExpansion:Nc,setToolInputsVisibility:Lc,setAgentModelPreference:zc,getAgentModelPreference:Kc},fu=e=>(Ut(()=>{Jt().catch(o=>{x.error("Failed to initialize settings",o)});const t=ee.onConfigOwnerChanged("ui",o=>{Dt(o),nt(!0)}),n=ee.onConfigOwnerChanged("server",o=>{Lt(o),nt(!0),Ka(),za(!0)}),r=ee.onStateOwnerChanged("ui",o=>{Nt(o),nt(!0)});return()=>{t(),n(),r()}}),ge(bo.Provider,{value:Hc,get children(){return e.children}}));function Gc(){const e=at(bo);if(!e)throw new Error("useConfig must be used within ConfigProvider");return e}function qc(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 Jc=Symbol("solid-inspect"),Yc=Ke();function Xc(e){function t(n){var r;return(r=at(Yc))!=null&&r.enabled?{Component:t,props:n,$INSPECT:Jc}:e(n)}return Object.defineProperty(t,"name",{value:e.name}),t.toString=e.toString,t}function Co(){return function(e){function t(a){const c=!!e.slotClasses,u=()=>{if(!e.slotClasses)throw new Error("'slotClasses' option is not defined");if(!e.utilityClass)throw new Error("'utilityClass' option is not defined");return qc(e.slotClasses(a),e.utilityClass,a.classes??"")},l=ls({});return c&&Do(()=>{const d=u();ve(()=>{for(const f in d)l[f]=d[f]})}),l}function n(a){const[c,u]=Ft(a,e.selfPropNames);return{allProps:a,props:c,otherProps:u}}function r(a){return Zs({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=Xc(a),a.toString=()=>`.${e.name}-root`,c&&Gr(a,"base"),a}function i(a){const c=s(function(l){const{allProps:d,otherProps:f,props:m}=o(l),y=e.autoCallUseClasses??!0?t(d):{};return a({allProps:d,otherProps:f,props:m,classes:y})});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 Zc=Co()({name:"MuiGlobalStyles",selfPropNames:["styles"]}),Qc=Zc.component(function({props:t}){return Wr(()=>({"@global":t.styles||{}})),[]}),el=Co()({name:"MuiCssBaseline",selfPropNames:["children","enableColorScheme"],propDefaults:({set:e})=>e({enableColorScheme:!1})}),tl=(e,t)=>({WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",boxSizing:"border-box",WebkitTextSizeAdjust:"100%",...t&&{colorScheme:e.palette.mode}}),nl=e=>({color:e.palette.text.primary,...e.typography.body1,backgroundColor:e.palette.background.default,"@media print":{backgroundColor:e.palette.common.white}}),rl=(e,t=!1)=>({html:tl(e,t),"*, *::before, *::after":{boxSizing:"inherit"},"strong, b":{fontWeight:e.typography.fontWeightBold},body:{margin:0,...nl(e),"&::backdrop":{backgroundColor:e.palette.background.default}}}),ol=el.component(function({props:t}){const n=Mr();return ge(Qc,{get styles(){return rl(n,t.enableColorScheme)}})}),So=Ke();function lr(e){if(!(typeof document>"u")){if(e==="system"){document.documentElement.removeAttribute("data-theme");return}document.documentElement.setAttribute("data-theme",e)}}const sl={backgroundDefault:"#ffffff",backgroundPaper:"#f5f5f5",primary:"#0066ff",primaryContrast:"#ffffff",textPrimary:"#1a1a1a",textSecondary:"#666666",divider:"#e0e0e0"},il={backgroundDefault:"#1a1a1a",backgroundPaper:"#2a2a2a",primary:"#0080ff",primaryContrast:"#1a1a1a",textPrimary:"#cfd4dc",textSecondary:"#999999",divider:"#3a3a3a"},Ce=(e,t,n)=>{if(!n)return t;const r=n.getPropertyValue(e);return r&&r.trim()||t},al=e=>{const t=e?il:sl,n=typeof window<"u"?getComputedStyle(document.documentElement):null;return{backgroundDefault:Ce("--surface-base",t.backgroundDefault,n),backgroundPaper:Ce("--surface-secondary",t.backgroundPaper,n),primary:Ce("--accent-primary",t.primary,n),primaryContrast:Ce("--text-inverted",t.primaryContrast,n),textPrimary:Ce("--text-primary",t.textPrimary,n),textSecondary:Ce("--text-secondary",t.textSecondary,n),divider:Ce("--border-base",t.divider,n)}};function hu(e){const t=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,{themePreference:n,setThemePreference:r}=Gc(),[o,s]=$(!0),[i,a]=$(0),c=()=>n(),u=()=>{const y=c();return y==="dark"?!0:y==="light"?!1:(t==null?void 0:t.matches)??!1},l=()=>{const y=c(),g=u();lr(y==="system"?"system":y),s(g),typeof window<"u"?requestAnimationFrame(()=>a(b=>b+1)):a(b=>b+1)};z(()=>{l()}),Ut(()=>{if(!t)return;const y=()=>{l()};return t.addEventListener("change",y),()=>{t.removeEventListener("change",y)}});const d=y=>{r(y)},f=()=>{const y=c();d(y==="system"?"light":y==="light"?"dark":"system")},m=L(()=>{i();const y=al(o());return $r({palette:{mode:o()?"dark":"light",primary:{main:y.primary,contrastText:y.primaryContrast},secondary:{main:y.primary},background:{default:y.backgroundDefault,paper:y.backgroundPaper},text:{primary:y.textPrimary,secondary:y.textSecondary},divider:y.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 ge(So.Provider,{value:{isDark:o,themeMode:c,setThemeMode:d,cycleThemeMode:f},get children(){return ge(Qs,{get theme(){return m()},get children(){return[ge(ol,{}),zo(()=>e.children)]}})}})}function vo(){const e=at(So);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const cl=/(^|\n)@@/m,ll=/(^|\n)(diff --git |--- |\+\+\+)/,ul=/^\*\*\* (Begin|End) Patch/,dl=/^\*\*\* Update File: (.+)$/,fl=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;function hl(e){const t=e.trim();if(!t.startsWith("```"))return t;const n=t.split(`
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 Ur(s,e),dn(s),s;{s&&s.remove();const i=li(e,t);if(dn(i),n){let a=o.querySelector(`#${zn}`);a||(a=document.createElement("style"),a.setAttribute("id",zn),o.prepend(a)),o.insertBefore(i,a)}else o.appendChild(i);return i}}function di(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 Kn(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 Gl(e){if(typeof e!="string")throw new Error("MUI: `capitalize(string)` expects a string argument.");return e.charAt(0).toUpperCase()+e.slice(1)}function ql(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 Jl(e){const t=e.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}function fi(e){return e&&e.ownerDocument||document}function Yl(e){return fi(e).defaultView||window}function Br(){return Math.random().toString(36).substring(2,15).slice(0,8)}let jt=!0,fn=!1,Hn;const hi={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 gi(e){const{type:t,tagName:n}=e;return!!(n==="INPUT"&&hi[t]&&!e.readOnly||n==="TEXTAREA"&&!e.readOnly||e.isContentEditable)}function mi(e){e.metaKey||e.altKey||e.ctrlKey||(jt=!0)}function Zt(){jt=!1}function pi(){this.visibilityState==="hidden"&&fn&&(jt=!0)}function yi(e){e.addEventListener("keydown",mi,!0),e.addEventListener("mousedown",Zt,!0),e.addEventListener("pointerdown",Zt,!0),e.addEventListener("touchstart",Zt,!0),e.addEventListener("visibilitychange",pi,!0)}function wi(e){const{target:t}=e;try{return t.matches(":focus-visible")}catch{}return jt||gi(t)}function Xl(){const e=s=>{s!=null&&yi(s.ownerDocument)},[t,n]=$(!1);function r(){return t()?(fn=!0,window.clearTimeout(Hn),Hn=window.setTimeout(()=>{fn=!1},100),n(!1),!0):!1}function o(s){return wi(s)?(n(!0),!0):!1}return{isFocusVisibleRef:{get current(){return t()}},onFocus:o,onBlur:r,ref:e}}const bi=new ii;function Ci(e){return e?Array.isArray(e)?e.flat(1/0).filter(t=>!!t):[e]:[]}function Si(){if(!D.context)return Br();const e=Mo().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 Wr(e){const t=at(ws),[n,r]=$(""),o=Si();let s,i=!1;return fe(a=>{var l;const c=e();let u;if(c){const d=ni(Ci(c));i="@global"in d,u=ai({name:"css",props:d,cache:bi,componentId:o}),s=di(u.id),s?dn(s):s=ui(u.rules,{id:u.id,nonce:(l=t.cache)==null?void 0:l.nonce},t.injectFirst),a!=null&&a.styleElement&&Kn(a.styleElement)}return typeof(u==null?void 0:u.className)=="string"?r(u.className):r(""),{className:u==null?void 0:u.className,styleElement:s}},void 0),he(()=>{s&&Kn(s,t.cleanupStyles??i)}),n}function Le(e,t,n={}){for(const r in e){const o=e[r];if(Rr(r))n[r]=Le(o,t);else if(un(r))n[r]=Le(o,t);else if(_r(r)){n[r]={};for(const s in o)n[r][s]=Le(o[s],t)}else if(Nr(r))n[r]=Le(o,t);else{const s=t(r,o);if(s)for(const i in s)n[i]=un(i)?{...n[i],...s[i]}:s[i];else n[r]=o}}return n}const vi=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 jr(e,t){if(typeof t=="number")return{[e]:vi.has(e)?t.toString():`${t}px`}}function Gn(e,t={}){return Le(e,jr,t)}function Pt(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 xi(e,t){return t.split(".").reduce((n,r)=>n&&n[r]?n[r]:null,e)}function Ei(e,t,n,r){const o=xi(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 ue={x:["Left","Right"],y:["Top","Bottom"]};function Vr(e){return typeof e=="number"?`${e}px`:e}function zr(e,t){return(n,r)=>t(e,n,r)}function h(e,t){return t?(n,r)=>({[e]:t(e,n,r)}):n=>({[e]:n})}function et(e){return h(e,(t,n)=>Vr(n))}function G(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 Oi(){return{...Ai(),...Ti(),...ki(),...$i(),...Ii(),...Pi(),...Mi(),...Li(),...Di()}}function Ai(){return{displayPrint:zr("displayPrint",(e,t)=>({"@media print":{display:t}})),displayRaw:h("display"),overflow:h("overflow"),textOverflow:h("textOverflow"),visibility:h("visibility"),whiteSpace:h("whiteSpace")}}function Ti(){return{flexBasis:h("flexBasis"),flexDirection:h("flexDirection"),flexWrap:h("flexWrap"),justifyContent:h("justifyContent"),alignItems:h("alignItems"),alignContent:h("alignContent"),order:h("order"),flex:h("flex"),flexGrow:h("flexGrow"),flexShrink:h("flexShrink"),alignSelf:h("alignSelf"),justifyItems:h("justifyItems"),justifySelf:h("justifySelf")}}function ki(){const e=(t,n,r)=>Ei(r,"spacing",8)(n);return{gap:h("gap",e),columnGap:h("columnGap",e),rowGap:h("rowGap",e),gridColumn:h("gridColumn"),gridRow:h("gridRow"),gridAutoFlow:h("gridAutoFlow"),gridAutoColumns:h("gridAutoColumns"),gridAutoRows:h("gridAutoRows"),gridTemplateColumns:h("gridTemplateColumns"),gridTemplateRows:h("gridTemplateRows"),gridTemplateAreas:h("gridTemplateAreas"),gridArea:h("gridArea")}}function $i(){return{position:h("position"),zIndex:h("zIndex",(e,t,n)=>{var r;return((r=n.zIndex)==null?void 0:r[e])??t}),top:et("top"),right:et("right"),bottom:et("bottom"),left:et("left")}}function Ii(){const e=(t,n,r)=>Pt(r,"palette",n);return{color:h("color",e),bgcolor:h("backgroundColor",e),backgroundColor:h("backgroundColor",e)}}function Pi(){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:h("width",e),maxWidth:h("maxWidth",e),minWidth:h("minWidth",e),height:h("height",e),maxHeight:h("maxHeight",e),minHeight:h("minHeight",e),boxSizing:h("boxSizing",e)}}function Mi(){const e=(n,r)=>typeof r=="number"?`${r}px solid`:r,t=(n,r,o)=>Pt(o,"palette",r);return{border:h("border",e),borderTop:h("borderTop",e),borderRight:h("borderRight",e),borderBottom:h("borderBottom",e),borderLeft:h("borderLeft",e),borderColor:h("borderColor",t),borderTopColor:h("borderTopColor",t),borderRightColor:h("borderRightColor",t),borderBottomColor:h("borderBottomColor",t),borderLeftColor:h("borderLeftColor",t),borderRadius:h("borderRadius",(n,r,o)=>typeof r=="number"?`${o.shape.borderRadius*r}px`:r)}}function Di(){const e=(t,n,r)=>Pt(r,"typography",n);return{typography:zr("typography",(t,n,r)=>Pt(r,"typography",n)),fontFamily:h("fontFamily",e),fontSize:h("fontSize",(t,n,r)=>Vr(e(t,n,r))),fontStyle:h("fontStyle",e),fontWeight:h("fontWeight",e),letterSpacing:et("letterSpacing"),lineHeight:h("lineHeight"),textAlign:h("textAlign"),textTransform:h("textTransform")}}function Li(){const e=(r,o,s)=>s.spacing(o),t="margin",n="padding";return{m:h(t,e),mt:h("marginTop",e),mr:h("marginRight",e),mb:h("marginBottom",e),ml:h("marginLeft",e),mx:G(t,ue.x,e),my:G(t,ue.y,e),margin:h(t,e),marginTop:h("marginTop",e),marginRight:h("marginRight",e),marginBottom:h("marginBottom",e),marginLeft:h("marginLeft",e),marginX:G(t,ue.x,e),marginY:G(t,ue.y,e),marginInline:G(t,["Inline","InlineStart"],e),marginInlineStart:h("marginInlineStart",e),marginInlineEnd:h("marginInlineEnd",e),marginBlock:G(t,["BlockStart","BlockEnd"],e),marginBlockStart:h("marginBlockStart",e),marginBlockEnd:h("marginBlockEnd",e),p:h(n,e),pt:h("paddingTop",e),pr:h("paddingRight",e),pb:h("paddingBottom",e),pl:h("paddingLeft",e),px:G(n,ue.x,e),py:G(n,ue.y,e),padding:h(n,e),paddingTop:h("paddingTop",e),paddingRight:h("paddingRight",e),paddingBottom:h("paddingBottom",e),paddingLeft:h("paddingLeft",e),paddingX:G(n,ue.x,e),paddingY:G(n,ue.y,e),paddingInline:G(n,["Inline","InlineStart"],e),paddingInlineStart:h("paddingInlineStart",e),paddingInlineEnd:h("paddingInlineEnd",e),paddingBlock:G(n,["BlockStart","BlockEnd"],e),paddingBlockStart:h("paddingBlockStart",e),paddingBlockEnd:h("paddingBlockEnd",e)}}const Tn=Oi(),Zl=Object.keys(Tn);function Ni(e,t,n){return Tn[e](t,n)}function qn(e,t,n){return e in Tn?Ni(e,t,n):jr(e,t)}function Ri(e,t){return Le(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,ps({theme:t},r,s=>qn(n,s,t)??{[n]:s}))}else return qn(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 _i(){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 Hr=["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 Ui(e,t,n,r,o={}){return L(()=>{const s=e(),i=Fi(o.name,s),a=r.ownerState,c=n.reduce((l,d)=>{let f;return typeof d=="function"?f=d({ownerState:a,theme:s,get sx(){return r.sx},get as(){return r.as},props:r}):d&&(f=d),f&&l.push(Gn(f,{name:t,__resolved:!0})),l},[]);let u=[];return o.overridesResolver&&typeof o.overridesResolver=="function"&&i&&(u=o.overridesResolver(r,i).map(l=>l?Gn(l,{}):null).filter(Boolean)),c.concat(u)})}function Gr(e,t){e.__suid=t}function Jn(e){if(typeof e=="function")return e.__suid}function Bi(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-${Br()}`,o="css";const i=Jn(n);return function(...a){function c(u){let l;const d=()=>{const N=u.theme;return N||l||(l=e&&e.onUseTheme?e.onUseTheme():An())},[,f]=Ft(u,r.skipProps||Hr),m=Ui(d,o,a,u,r),w=()=>{const N=u.sx;return N?Array.isArray(N)?N:[N]:[]},g=()=>{if(i)return n;const N=u.as;return N||n},b=i?()=>i:L(()=>Jn(g())),A=r.skipSx?()=>m():()=>{const N=d();return[...m(),...w().map(X=>X.__resolved?X:Ri(X,N))]},M=Wr(()=>b()?void 0:A());return Dr(g,hr(f,{get children(){return u.children},get component(){return b()?u.component:null},get as(){return i?u.as:void 0},get sx(){return b()?A():void 0},get ownerState(){return b()==="system"?u.ownerState:void 0},get class(){return _i([...new Set([u.class,s,M()])])}}))}return Gr(c,"system"),s&&(c.toString=()=>`.${s}`),c}}}const Ql=[...Hr,"classes"],eu=Bi({onUseTheme:()=>Mr()}),Wi="modulepreload",ji=function(e){return"/"+e},Yn={},Vi=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),a=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));o=Promise.allSettled(n.map(c=>{if(c=ji(c),c in Yn)return;Yn[c]=!0;const u=c.endsWith(".css"),l=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${l}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":Wi,u||(d.as="script"),d.crossOrigin="",d.href=c,a&&d.setAttribute("nonce",a),document.head.appendChild(d),u)return new Promise((f,m)=>{d.addEventListener("load",f),d.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(i){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i}return o.then(i=>{for(const a of i||[])a.status==="rejected"&&s(a.reason);return t().catch(s)})},qr="codenomad-use-tauri-native-event-transport";function Jr(){var e;if(typeof window>"u")return!0;try{return((e=window.localStorage)==null?void 0:e.getItem(qr))!=="0"}catch{return!0}}function zi(e){var t;if(!(typeof window>"u"))try{(t=window.localStorage)==null||t.setItem(qr,e?"1":"0")}catch{}}const Ki="codenomad.client-id",Hi="codenomad.connection-id";let yt=null,wt=null;function hn(){return{clientId:Gi(),connectionId:qi()}}function Gi(){return yt||(yt=Yr(Ki,window.localStorage),yt)}function qi(){return wt||(wt=Yr(Hi,window.sessionStorage),wt)}function Yr(e,t){if(typeof window>"u")return Qt();try{const r=t.getItem(e);if(r&&r.trim())return r.trim()}catch{return Qt()}const n=Qt();try{t.setItem(e,n)}catch{}return n}function Qt(){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 gn={exports:{}},en,Xn;function Ji(){if(Xn)return en;Xn=1;var e=1e3,t=e*60,n=t*60,r=n*24,o=r*7,s=r*365.25;en=function(l,d){d=d||{};var f=typeof l;if(f==="string"&&l.length>0)return i(l);if(f==="number"&&isFinite(l))return d.long?c(l):a(l);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(l))};function i(l){if(l=String(l),!(l.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(l);if(d){var f=parseFloat(d[1]),m=(d[2]||"ms").toLowerCase();switch(m){case"years":case"year":case"yrs":case"yr":case"y":return f*s;case"weeks":case"week":case"w":return f*o;case"days":case"day":case"d":return f*r;case"hours":case"hour":case"hrs":case"hr":case"h":return f*n;case"minutes":case"minute":case"mins":case"min":case"m":return f*t;case"seconds":case"second":case"secs":case"sec":case"s":return f*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return f;default:return}}}}function a(l){var d=Math.abs(l);return d>=r?Math.round(l/r)+"d":d>=n?Math.round(l/n)+"h":d>=t?Math.round(l/t)+"m":d>=e?Math.round(l/e)+"s":l+"ms"}function c(l){var d=Math.abs(l);return d>=r?u(l,d,r,"day"):d>=n?u(l,d,n,"hour"):d>=t?u(l,d,t,"minute"):d>=e?u(l,d,e,"second"):l+" ms"}function u(l,d,f,m){var w=d>=f*1.5;return Math.round(l/f)+" "+m+(w?"s":"")}return en}function Yi(e){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=a,n.humanize=Ji(),n.destroy=u,Object.keys(e).forEach(l=>{n[l]=e[l]}),n.names=[],n.skips=[],n.formatters={};function t(l){let d=0;for(let f=0;f<l.length;f++)d=(d<<5)-d+l.charCodeAt(f),d|=0;return n.colors[Math.abs(d)%n.colors.length]}n.selectColor=t;function n(l){let d,f=null,m,w;function g(...b){if(!g.enabled)return;const A=g,M=Number(new Date),N=M-(d||M);A.diff=N,A.prev=d,A.curr=M,d=M,b[0]=n.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let X=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(W,p)=>{if(W==="%%")return"%";X++;const C=n.formatters[p];if(typeof C=="function"){const O=b[X];W=C.call(A,O),b.splice(X,1),X--}return W}),n.formatArgs.call(A,b),(A.log||n.log).apply(A,b)}return g.namespace=l,g.useColors=n.useColors(),g.color=n.selectColor(l),g.extend=r,g.destroy=n.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(m!==n.namespaces&&(m=n.namespaces,w=n.enabled(l)),w),set:b=>{f=b}}),typeof n.init=="function"&&n.init(g),g}function r(l,d){const f=n(this.namespace+(typeof d>"u"?":":d)+l);return f.log=this.log,f}function o(l){n.save(l),n.namespaces=l,n.names=[],n.skips=[];const d=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const f of d)f[0]==="-"?n.skips.push(f.slice(1)):n.names.push(f)}function s(l,d){let f=0,m=0,w=-1,g=0;for(;f<l.length;)if(m<d.length&&(d[m]===l[f]||d[m]==="*"))d[m]==="*"?(w=m,g=f,m++):(f++,m++);else if(w!==-1)m=w+1,g++,f=g;else return!1;for(;m<d.length&&d[m]==="*";)m++;return m===d.length}function i(){const l=[...n.names,...n.skips.map(d=>"-"+d)].join(",");return n.enable(""),l}function a(l){for(const d of n.skips)if(s(l,d))return!1;for(const d of n.names)if(s(l,d))return!0;return!1}function c(l){return l instanceof Error?l.stack||l.message:l}function u(){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 Xi=Yi;(function(e,t){var n={};t.formatArgs=o,t.save=s,t.load=i,t.useColors=r,t.storage=a(),t.destroy=(()=>{let u=!1;return()=>{u||(u=!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 u;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&&(u=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(u[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(u){if(u[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+u[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const l="color: "+this.color;u.splice(1,0,l,"color: inherit");let d=0,f=0;u[0].replace(/%[a-zA-Z%]/g,m=>{m!=="%%"&&(d++,m==="%c"&&(f=d))}),u.splice(f,0,l)}t.log=console.debug||console.log||(()=>{});function s(u){try{u?t.storage.setItem("debug",u):t.storage.removeItem("debug")}catch{}}function i(){let u;try{u=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!u&&typeof process<"u"&&"env"in process&&(u=n.DEBUG),u}function a(){try{return localStorage}catch{}}e.exports=Xi(t);const{formatters:c}=e.exports;c.j=function(u){try{return JSON.stringify(u)}catch(l){return"[UnexpectedJSONParseError]: "+l.message}}})(gn,gn.exports);var Zi=gn.exports;const mn=No(Zi),He=["sse","api","session","actions"],Xr="opencode:logger:namespaces",tn=new Map,ne=new Set,oe=typeof globalThis<"u"?globalThis.console:void 0;function lt(){ne.size===0?mn.disable():mn.enable(Array.from(ne).join(","))}function Vt(){var e;if(!(typeof window>"u"||!(window!=null&&window.localStorage)))try{window.localStorage.setItem(Xr,JSON.stringify(Array.from(ne)))}catch(t){(e=oe==null?void 0:oe.warn)==null||e.call(oe,"Failed to persist logger namespaces",t)}}function Qi(){var e;if(!(typeof window>"u"||!(window!=null&&window.localStorage)))try{const t=window.localStorage.getItem(Xr);if(!t)return;const n=JSON.parse(t);if(!Array.isArray(n))return;for(const r of n)He.includes(r)&&ne.add(r)}catch(t){(e=oe==null?void 0:oe.warn)==null||e.call(oe,"Failed to hydrate logger namespaces",t)}}Qi();lt();function ea(e){const n=mn(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(!He.includes(e))throw new Error(`Unknown logger namespace: ${e}`);return tn.has(e)||tn.set(e,ea(e)),tn.get(e)}function ta(){return He.map(e=>({name:e,enabled:ne.has(e)}))}function na(e){if(!He.includes(e))throw new Error(`Unknown logger namespace: ${e}`);ne.has(e)||(ne.add(e),Vt(),lt())}function ra(e){if(!He.includes(e))throw new Error(`Unknown logger namespace: ${e}`);ne.has(e)&&(ne.delete(e),Vt(),lt())}function oa(){ne.clear(),Vt(),lt()}function sa(){He.forEach(e=>ne.add(e)),Vt(),lt()}const ia={listLoggerNamespaces:ta,enableLogger:na,disableLogger:ra,enableAllLoggers:sa,disableAllLoggers:oa};function aa(){typeof window>"u"||(window.codenomadLogger=ia)}aa();function ca(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)}})}const nn={};var dr;const la=typeof window<"u"?(dr=window.location)==null?void 0:dr.origin:void 0,ua=typeof window<"u"?window.__CODENOMAD_API_BASE__??la:void 0,da=typeof window<"u"?window.__CODENOMAD_EVENTS_URL__??"/api/events":"/api/events",me=(nn==null?void 0:nn.VITE_CODENOMAD_API_BASE)??ua,rn=fa(me,da),tu=me;function nu(e,t){const n=encodeURIComponent(e),r=encodeURIComponent(t);return ha(`/workspaces/${n}/plugin/background-processes/${r}/stream`)}function fa(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 ha(e){if(e.startsWith("http://")||e.startsWith("https://")||!me)return e;const t=e.startsWith("/")?e:`/${e}`;return`${me}${t}`}const Zn=ce("api"),Qn=ce("sse");function Zr(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 Se(e,t){if(t){Zn.info(e,t);return}Zn.info(e)}async function Qr(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=me?new URL(e,me).toString():e,r=Zr(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();Se(`${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 Qr(i);throw Se(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s,error:c}),new Error(c||`Request failed with ${i.status}`)}const a=Date.now()-s;return Se(`${o} ${e} -> ${i.status}`,{durationMs:a}),i.status===204?void 0:await i.json()}catch(i){throw Se(`${o} ${e} failed`,{durationMs:Date.now()-s,error:i}),i}}async function ga(e,t){const n=me?new URL(e,me).toString():e,r=Zr(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();Se(`${o} ${e}`);const i=await fetch(n,{...t,headers:r,credentials:(t==null?void 0:t.credentials)??"include"});if(!i.ok){const a=await Qr(i);throw Se(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s,error:a}),new Error(a||`Request failed with ${i.status}`)}return Se(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s}),i}const re={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")},listConfigFiles(){return y("/api/config-files")},readConfigFile(e){return y(`/api/config-files/${encodeURIComponent(e)}/content`)},writeConfigFile(e,t){const n={contents:t};return y(`/api/config-files/${encodeURIComponent(e)}/content`,{method:"PUT",body:JSON.stringify(n)})},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,r){const o=new URLSearchParams({path:t});return r!=null&&r.worktree&&r.worktree!=="root"&&o.set("worktree",r.worktree),y(`/api/workspaces/${encodeURIComponent(e)}/files/content?${o.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 ga("/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=hn();return y(`/workspaces/${encodeURIComponent(e)}/plugin/voice-mode`,{method:"POST",body:JSON.stringify({...n,enabled:t})})},getYoloState(e,t){return y(`/workspaces/${encodeURIComponent(e)}/yolo/sessions/${encodeURIComponent(t)}`)},toggleYolo(e,t){return y(`/workspaces/${encodeURIComponent(e)}/yolo/sessions/${encodeURIComponent(t)}/toggle`,{method:"POST"})},sendClientConnectionPong(e,t){const n={method:"POST",body:JSON.stringify(e)};return t&&(n.signal=t),y("/api/client-connections/pong",n)},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=hn(),o=ma(r);Qn.info(`Connecting to ${o}`);const s=new EventSource(o,{withCredentials:!0});return ca(s,{onEvent:e,onError:t,onPing:n,logger:Qn}),s}};function ma(e){const t=new URL(rn,typeof window<"u"?window.location.origin:"http://localhost");return t.searchParams.set("clientId",e.clientId),t.searchParams.set("connectionId",e.connectionId),rn.startsWith("http://")||rn.startsWith("https://")?t.toString():`${t.pathname}${t.search}`}const pa={initialDelayMs:1e3,maxDelayMs:1e4,multiplier:2};function ya(e){return{reconnect:{...pa,...e==null?void 0:e.reconnect}}}function eo(){if(typeof window>"u"||window.__CODENOMAD_WINDOW_CONTEXT__==="remote")return"remote";if(window.__CODENOMAD_WINDOW_CONTEXT__==="local")return"local";const e=window;return typeof e.electronAPI<"u"||typeof e.__TAURI__<"u"||typeof navigator<"u"&&/tauri/i.test(navigator.userAgent)?"local":"remote"}function zt(){if(typeof window>"u")return"web";const e=window.__CODENOMAD_RUNTIME_HOST__;if(e)return e;const t=window;return typeof t.electronAPI<"u"?"electron":typeof t.__TAURI__<"u"||typeof navigator<"u"&&/tauri/i.test(navigator.userAgent)?"tauri":"web"}function wa(){if(typeof navigator>"u")return"desktop";const e=navigator.userAgentData;if(e!=null&&e.mobile)return"mobile";const t=navigator.userAgent.toLowerCase();return/android|iphone|ipad|ipod|blackberry|mini|windows phone|mobile|silk/.test(t)?"mobile":"desktop"}const ba=ce("actions");let we=null;function Ca(){return we||(we={host:zt(),platform:wa(),windowContext:eo()},typeof window<"u"&&ba.info(`[runtime] host=${we.host} platform=${we.platform} context=${we.windowContext}`),we)}const $e=Ca(),Sa=()=>zt()==="electron",va=()=>zt()==="tauri",ru=()=>zt()==="web",Kt=()=>Sa()||va(),Ht=()=>eo()==="local",ou=()=>Kt()&&Ht(),su=()=>Kt()&&Ht(),iu=()=>Kt()&&Ht(),au=()=>Kt()&&Ht();function R(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)}function qe(e,t,n,r,o){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var be,q,Ie,bt;const er="__TAURI_TO_IPC_KEY__";function to(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class xa{constructor(t){be.set(this,void 0),q.set(this,0),Ie.set(this,[]),bt.set(this,void 0),qe(this,be,t||(()=>{})),this.id=to(n=>{const r=n.index;if("end"in n){r==R(this,q,"f")?this.cleanupCallback():qe(this,bt,r);return}const o=n.message;if(r==R(this,q,"f")){for(R(this,be,"f").call(this,o),qe(this,q,R(this,q,"f")+1);R(this,q,"f")in R(this,Ie,"f");){const s=R(this,Ie,"f")[R(this,q,"f")];R(this,be,"f").call(this,s),delete R(this,Ie,"f")[R(this,q,"f")],qe(this,q,R(this,q,"f")+1)}R(this,q,"f")===R(this,bt,"f")&&this.cleanupCallback()}else R(this,Ie,"f")[r]=o})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){qe(this,be,t)}get onmessage(){return R(this,be,"f")}[(be=new WeakMap,q=new WeakMap,Ie=new WeakMap,bt=new WeakMap,er)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[er]()}}class tr{constructor(t,n,r){this.plugin=t,this.event=n,this.channelId=r}async unregister(){return je(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}}async function cu(e,t,n){const r=new xa(n);try{return await je(`plugin:${e}|register_listener`,{event:t,handler:r}),new tr(e,t,r.id)}catch{return await je(`plugin:${e}|registerListener`,{event:t,handler:r}),new tr(e,t,r.id)}}async function je(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}var nr;(function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_CREATED="tauri://window-created",e.WEBVIEW_CREATED="tauri://webview-created",e.DRAG_ENTER="tauri://drag-enter",e.DRAG_OVER="tauri://drag-over",e.DRAG_DROP="tauri://drag-drop",e.DRAG_LEAVE="tauri://drag-leave"})(nr||(nr={}));async function Ea(e,t){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(e,t),await je("plugin:event|unlisten",{event:e,eventId:t})}async function Oa(e,t,n){var r;const o=typeof(n==null?void 0:n.target)=="string"?{kind:"AnyLabel",label:n.target}:(r=n==null?void 0:n.target)!==null&&r!==void 0?r:{kind:"Any"};return je("plugin:event|listen",{event:e,target:o,handler:to(t)}).then(s=>async()=>Ea(e,s))}const Ct=ce("sse"),Aa={invoke:je,listen:Oa};function Ta(e){let t=!1;return()=>{var n;t||(t=!0,(n=e.onError)==null||n.call(e))}}function ka(e){return e==="connected"?"connected":e==="connecting"?"connecting":"disconnected"}async function $a(e,t,n=Aa){let r=!1,o=!1,s=null;const i=Ta(e),a=[],c=[],u=g=>s===g,l=g=>{var A,M;if(!g||!u(g.generation))return;o||(o=!0,(A=e.onStatus)==null||A.call(e,"connected"),(M=e.onOpen)==null||M.call(e));const b=g.events??[];b.length!==0&&e.onBatch(b)},d=g=>{var b,A;if(!(!g||!u(g.generation))){if((b=e.onStatus)==null||b.call(e,ka(g.state)),g.state==="connected"&&!o&&(o=!0,(A=e.onOpen)==null||A.call(e)),g.state==="unauthorized"?Ct.warn("Native desktop event transport is waiting for authentication",{reason:g.reason,reconnectAttempt:g.reconnectAttempt,nextDelayMs:g.nextDelayMs,stats:g.stats}):g.state==="error"?Ct.warn("Native desktop event transport reported an error",{reason:g.reason,reconnectAttempt:g.reconnectAttempt,nextDelayMs:g.nextDelayMs,statusCode:g.statusCode,stats:g.stats}):(g.state==="disconnected"||g.state==="stopped")&&g.stats&&Ct.info("Native desktop event transport stats",{state:g.state,reconnectAttempt:g.reconnectAttempt,stats:g.stats}),g.state==="stopped"){i();return}g.terminal&&i()}},f=()=>{if(s!==null){for(const g of c.splice(0,c.length))d(g);for(const g of a.splice(0,a.length))l(g)}},m=await n.listen("desktop:event-batch",g=>{if(r)return;const b=g.payload;if(b){if(s===null){a.push(b);return}l(b)}}),w=await n.listen("desktop:event-stream-status",g=>{if(r)return;const b=g.payload;if(b){if(s===null){c.push(b);return}d(b)}});try{const g=await n.invoke("desktop_events_start",{request:t});if(!(g!=null&&g.started))throw new Error((g==null?void 0:g.reason)??"desktop event transport unavailable");s=g.generation??null,f()}catch(g){throw m(),w(),g}return{disconnect(){r||(r=!0,m(),w(),n.invoke("desktop_events_stop").catch(g=>{Ct.warn("Failed to stop native desktop event transport",g)}))}}}const Je=ce("sse");async function Ia(e){const t=()=>{var r,o;(r=e.onStatus)==null||r.call(e,"disconnected"),(o=e.onError)==null||o.call(e)},n=re.connectEvents(r=>{e.onBatch([r])},t,e.onPing);return n.onopen=()=>{var r,o;(r=e.onStatus)==null||r.call(e,"connected"),(o=e.onOpen)==null||o.call(e)},{disconnect(){n.close()}}}async function Pa(e,t){const n=Jr();if($e.host==="tauri"&&$e.windowContext==="local"&&n)try{const r=await $a(e,ya(t));return Je.info("Event transport: rust-native (desktop_event_transport)"),r}catch(r){Je.warn("Failed to start native desktop event transport, falling back to browser EventSource",r)}else $e.host==="tauri"&&$e.windowContext==="remote"?Je.info("Event transport: browser-eventsource forced for remote Tauri window"):$e.host==="tauri"&&Je.info("Event transport: browser-eventsource forced by settings");return Je.info(`Event transport: browser-eventsource (host=${$e.host})`),Ia(e)}async function Ma(e,t={}){const{maxAttempts:n=3,initialDelayMs:r=100,maxDelayMs:o=5e3,backoffMultiplier:s=2,timeoutMs:i,shouldRetry:a=()=>!0}=t;let c=null,u=r;for(let l=1;l<=n;l++)try{if(i){const d=new AbortController,f=setTimeout(()=>d.abort(),i);try{const m=await e(d.signal);return clearTimeout(f),m}catch(m){throw clearTimeout(f),m}}return await e()}catch(d){const f=d instanceof Error?d:new Error(String(d));if(c=f,l<n&&a(f,l))await new Promise(m=>setTimeout(m,u)),u=Math.min(u*s,o);else throw f}throw c||new Error("Failed after retries")}function Da(e){return!!(e.name==="AbortError"||e.name==="TimeoutError"||e.message.includes("Failed to fetch")||e.message.includes("NetworkError")||e.message.includes("timeout"))}const on=1e3,La=1e4,pn=ce("sse");function Pe(e,t){if(t){pn.info(e,t);return}pn.info(e)}class Na{constructor(){this.handlers=new Map,this.openHandlers=new Set,this.statusHandlers=new Set,this.connection=null,this.connectGeneration=0,this.retryDelay=on,this.retryTimer=null,this.connect()}async connect(){const t=++this.connectGeneration;this.clearReconnectTimer(),this.connection&&(this.connection.disconnect(),this.connection=null),Pe("Connecting to backend events stream");try{const n=await Pa({onBatch:r=>this.dispatchBatch(r),onError:()=>{t===this.connectGeneration&&this.scheduleReconnect()},onStatus:r=>{t===this.connectGeneration&&this.emitTransportStatus(r)},onOpen:()=>{t===this.connectGeneration&&(Pe("Events stream connected"),this.retryDelay=on,this.openHandlers.forEach(r=>r()))},onPing:r=>{const s={...hn(),pingTs:r.ts};Ma(i=>re.sendClientConnectionPong(s,i),{maxAttempts:3,initialDelayMs:100,maxDelayMs:2e3,timeoutMs:1e4,shouldRetry:i=>Da(i)}).catch(i=>{pn.warn("Failed to send client connection pong after retries",i)})}});if(t!==this.connectGeneration){n.disconnect();return}this.connection=n}catch(n){if(t!==this.connectGeneration)return;Pe("Events stream failed to connect, scheduling reconnect",{error:n instanceof Error?n.message:String(n)}),this.scheduleReconnect()}}scheduleReconnect(){this.retryTimer||(this.connection&&(this.connection.disconnect(),this.connection=null),this.emitTransportStatus("disconnected"),Pe("Events stream disconnected, scheduling reconnect",{delayMs:this.retryDelay}),this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.retryDelay=Math.min(this.retryDelay*2,La),this.connect()},this.retryDelay))}clearReconnectTimer(){this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null)}dispatch(t){var n,r;(n=this.handlers.get("*"))==null||n.forEach(o=>o(t)),(r=this.handlers.get(t.type))==null||r.forEach(o=>o(t))}dispatchBatch(t){t.length!==0&&(Pe("event batch",{size:t.length}),ve(()=>{for(const n of t)this.dispatch(n)}))}emitTransportStatus(t){this.statusHandlers.forEach(n=>n(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)}onTransportStatus(t){return this.statusHandlers.add(t),()=>this.statusHandlers.delete(t)}restart(t="manual restart"){this.retryDelay=on,this.clearReconnectTimer(),this.connection&&(this.connection.disconnect(),this.connection=null),Pe("Restarting backend events stream",{reason:t}),this.connect()}}const Ot=new Na,Ra=Object.freeze(Object.defineProperty({__proto__:null,serverEvents:Ot},Symbol.toStringTag,{value:"Module"})),_a=ce("actions"),rr={messageHistory:[],agentModelSelections:{}};function or(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){_a.warn("Failed to compare config objects",n)}return!1}class Fa{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,Ot.on("storage.configChanged",t=>{t.type==="storage.configChanged"&&this.setOwnerCache("config",t.owner,t.value)}),Ot.on("storage.stateChanged",t=>{t.type==="storage.stateChanged"&&this.setOwnerCache("state",t.owner,t.value)}),Ot.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=re.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 re.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=re.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 re.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=re.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 re.writeInstanceData(t,r),this.setInstanceDataCache(t,r)}async deleteInstanceData(t){await re.deleteInstanceData(t),this.setInstanceDataCache(t,rr)}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&&or(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??rr,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&&or(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 ee=new Fa,no=ce("api"),Gt={messageHistory:[],agentModelSelections:{}},[kn,ro]=$(new Map),St=new Map,Ve=new Map;function oo(e){const t=e??Gt;return{...t,messageHistory:Array.isArray(t.messageHistory)?[...t.messageHistory]:[],agentModelSelections:{...t.agentModelSelections??{}}}}function sr(e){if(Ve.has(e))return;const t=ee.onInstanceDataChanged(e,n=>{Mt(e,n)});Ve.set(e,t)}function Ua(e){const t=Ve.get(e);t&&(t(),Ve.delete(e))}function Mt(e,t){ro(n=>{const r=new Map(n);return r.set(e,oo(t)),r})}async function qt(e){if(!e||kn().has(e))return;if(St.has(e)){await St.get(e);return}const t=ee.loadInstanceData(e).then(n=>{Mt(e,n),sr(e)}).catch(n=>{no.warn("Failed to load instance data",n),Mt(e,Gt),sr(e)}).finally(()=>{St.delete(e)});St.set(e,t),await t}async function so(e,t){if(!e)return;await qt(e);const n=kn().get(e)??Gt,r=oo(n);t(r);try{await ee.saveInstanceData(e,r)}catch(o){no.warn("Failed to persist instance data",o)}Mt(e,r)}function io(e){return kn().get(e)??Gt}function Ba(e){ro(t=>{if(!t.has(e))return t;const n=new Map(t);return n.delete(e),n}),Ua(e)}const Wa=Ke(),ja={getInstanceConfig:io,ensureInstanceConfig:qt,updateInstanceConfig:so,clearInstanceConfig:Ba},lu=e=>(he(()=>{for(const t of Ve.values())t();Ve.clear()}),ge(Wa.Provider,{value:ja,get children(){return e.children}})),Va=ce("api"),[ir,yn]=$(null),[uu,ar]=$(!1),[du,At]=$(null);let Ye=null;async function za(e=!1){return!e&&ir()?ir():Ye||(ar(!0),At(null),Ye=re.fetchSpeechCapabilities().then(t=>(yn(t),At(null),t)).catch(t=>(Va.error("Failed to load speech capabilities",t),yn(null),At(t instanceof Error?t.message:String(t)),null)).finally(()=>{ar(!1),Ye=null}),Ye)}function Ka(){yn(null),At(null)}const x=ce("actions"),Ha=20,Ga=5,qa=50,ao={preset:"balanced",thinking:"collapsed"},I={showThinkingBlocks:!1,showKeyboardShortcutHints:!0,thinkingBlocksExpansion:"collapsed",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};function cr(e,t){return e==="expanded"||e==="collapsed"?e:t}function Ja(e){return e==="minimal"||e==="balanced"||e==="detailed"||e==="everything"||e==="custom"?e:ao.preset}function Ya(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e))n&&(r==="expanded"||r==="collapsed")&&(t[n]=r);return t}function Xa(e,t){const n=e&&typeof e=="object"&&!Array.isArray(e)?e:void 0,r=cr(t.thinkingBlocksExpansion,ao.thinking);return{preset:Ja(n==null?void 0:n.preset),thinking:cr(n==null?void 0:n.thinking,r),tools:Ya(n==null?void 0:n.tools)}}const Me={provider:"openai-compatible",sttModel:"gpt-4o-mini-transcribe",ttsModel:"gpt-4o-mini-tts",ttsVoice:"alloy",playbackMode:"streaming",ttsFormat:"mp3"};function co(e){const t=e??{};return{showThinkingBlocks:t.showThinkingBlocks??I.showThinkingBlocks,showKeyboardShortcutHints:t.showKeyboardShortcutHints??I.showKeyboardShortcutHints,thinkingBlocksExpansion:t.thinkingBlocksExpansion??I.thinkingBlocksExpansion,showMessageTimeline:t.showMessageTimeline??I.showMessageTimeline,showTimelineTools:t.showTimelineTools??I.showTimelineTools,holdLongAssistantReplies:t.holdLongAssistantReplies??I.holdLongAssistantReplies,promptSubmitOnEnter:t.promptSubmitOnEnter??I.promptSubmitOnEnter,showPromptVoiceInput:t.showPromptVoiceInput??I.showPromptVoiceInput,locale:t.locale??I.locale,diffViewMode:t.diffViewMode??I.diffViewMode,toolCallExpansionDefaults:Xa(t.toolCallExpansionDefaults,t),toolOutputExpansion:t.toolOutputExpansion??I.toolOutputExpansion,diagnosticsExpansion:t.diagnosticsExpansion??I.diagnosticsExpansion,toolInputsVisibility:t.toolInputsVisibility==="hidden"||t.toolInputsVisibility==="collapsed"||t.toolInputsVisibility==="expanded"?t.toolInputsVisibility:I.toolInputsVisibility,showUsageMetrics:t.showUsageMetrics??I.showUsageMetrics,autoCleanupBlankSessions:t.autoCleanupBlankSessions??I.autoCleanupBlankSessions,keepUnseenSubagentIdleStatus:t.keepUnseenSubagentIdleStatus??I.keepUnseenSubagentIdleStatus,osNotificationsEnabled:t.osNotificationsEnabled??I.osNotificationsEnabled,osNotificationsAllowWhenVisible:t.osNotificationsAllowWhenVisible??I.osNotificationsAllowWhenVisible,notifyOnNeedsInput:t.notifyOnNeedsInput??I.notifyOnNeedsInput,notifyOnIdle:t.notifyOnIdle??I.notifyOnIdle}}function lo(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 uo(e){const t=e??{};return{provider:t.provider==="openai-compatible"?t.provider:Me.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():Me.sttModel,ttsModel:typeof t.ttsModel=="string"&&t.ttsModel.trim()?t.ttsModel.trim():Me.ttsModel,ttsVoice:typeof t.ttsVoice=="string"&&t.ttsVoice.trim()?t.ttsVoice.trim():Me.ttsVoice,playbackMode:t.playbackMode==="buffered"||t.playbackMode==="streaming"?t.playbackMode:Me.playbackMode,ttsFormat:t.ttsFormat==="wav"||t.ttsFormat==="opus"||t.ttsFormat==="aac"||t.ttsFormat==="mp3"?t.ttsFormat:Me.ttsFormat}}function Xe(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 Za(e){var n,r,o;const t=e??{};return{recentFolders:Xe(t.recentFolders,s=>{if(!s||typeof s!="object")return null;const i=s.path,a=s.lastAccessed,c=s.projectName;if(typeof i!="string")return null;const u=typeof a=="number"?a:Date.now();return{path:i,lastAccessed:u,...typeof c=="string"&&c.trim()?{projectName:c.trim()}:{}}}),opencodeBinaries:Xe(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,u=typeof s.label=="string"?s.label:void 0;return{path:i,version:c,label:u,lastUsed:a}}),remoteServers:Xe(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 u=typeof s.createdAt=="string"?s.createdAt:new Date().toISOString(),l=typeof s.updatedAt=="string"?s.updatedAt:u,d=typeof s.lastConnectedAt=="string"?s.lastConnectedAt:void 0;return{id:i,name:a,baseUrl:c,skipTlsVerify:!!s.skipTlsVerify,createdAt:u,updatedAt:l,lastConnectedAt:d}}).sort((s,i)=>{const a=s.lastConnectedAt??s.updatedAt;return(i.lastConnectedAt??i.updatedAt).localeCompare(a)}),models:{recents:Xe((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:Xe((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:lo((o=t.models)==null?void 0:o.thinkingSelections)}}}function Qa(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=lo(t.environmentVariables),i=ec(t.secureEnvVars),a=uo(t.speech);return{listeningMode:n,logLevel:r,opencodeBinary:o,environmentVariables:s,secureEnvVars:i,speech:a}}function ec(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function fo(e){return`${e.providerId}/${e.modelId}`}function ho(e,t){const n=t.find(o=>o.path===e),r=t.filter(o=>o.path!==e);return r.unshift({path:e,lastAccessed:Date.now(),...n!=null&&n.projectName?{projectName:n.projectName}:{}}),r.slice(0,Ha)}function $n(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 tc(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??nc(),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 go(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 nc(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`remote-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}const[In,Dt]=$({}),[rc,Lt]=$({}),[oc,Nt]=$({}),[mo,nt]=$(!1),[po,sc]=$(Jr()),ic=L(()=>co(In().settings)),yo=L(()=>In().theme??"system"),ie=L(()=>Qa(rc())),ae=L(()=>Za(oc())),B=ic,ut=L(()=>ae().recentFolders),dt=L(()=>ae().opencodeBinaries),ze=L(()=>ae().remoteServers);let vt=null;async function Jt(){mo()||(vt||(vt=Promise.all([ee.loadConfigOwner("ui"),ee.loadConfigOwner("server"),ee.loadStateOwner("ui")]).then(([e,t,n])=>{Dt(e),Lt(t),Nt(n),nt(!0)}).catch(e=>{x.error("Failed to load settings",e),Dt({}),Lt({}),Nt({}),nt(!0)}).finally(()=>{vt=null})),await vt)}async function Y(e,t){await Jt();const n=await ee.patchConfigOwner(e,t);e==="ui"&&Dt(n),e==="server"&&Lt(n)}function ac(e){po()!==e&&(sc(e),zi(e),Vi(async()=>{const{serverEvents:t}=await Promise.resolve().then(()=>Ra);return{serverEvents:t}},void 0).then(({serverEvents:t})=>{t.restart("desktop transport preference changed")}).catch(t=>{x.error("Failed to restart backend events stream after desktop transport preference change",t)}))}async function K(e,t){await Jt();const n=await ee.patchStateOwner(e,t);Nt(n)}function H(e){const t=In(),r={settings:co({...t.settings??{},...e})};Y("ui",r).catch(o=>x.error("Failed to patch ui settings",o))}function wo(e){H(e)}function cc(e){yo()!==e&&Y("ui",{theme:e}).catch(t=>x.error("Failed to set theme",t))}async function lc(e){ie().listeningMode!==e&&await Y("server",{listeningMode:e})}function Pn(e){Y("server",{environmentVariables:e}).catch(t=>x.error("Failed to update environment variables",t))}function uc(e,t,n=!0){const r=ie().environmentVariables;Pn({...r,[e]:t});const o=ie().secureEnvVars,s=e.toUpperCase(),i=o.some(a=>a.toUpperCase()===s);if(n){if(!i){const a=[...o,e];Y("server",{secureEnvVars:a}).catch(c=>x.error("Failed to add secure env var",c))}}else if(i){const a=o.filter(c=>c.toUpperCase()!==s);Y("server",{secureEnvVars:a}).catch(c=>x.error("Failed to remove secure env var",c))}}function dc(e){const t=ie().environmentVariables,{[e]:n,...r}=t;Pn(r)}function fc(e){return ie().secureEnvVars.some(n=>n.toUpperCase()===e.toUpperCase())}function hc(e){const t=ie().secureEnvVars,n=e.toUpperCase(),o=t.some(s=>s.toUpperCase()===n)?t.filter(s=>s.toUpperCase()!==n):[...t,e];Y("server",{secureEnvVars:o}).catch(s=>x.error("Failed to update secure env vars",s))}function gc(e){const t=e&&e.trim().length>0?e:"opencode";Y("server",{opencodeBinary:t}).catch(r=>x.error("Failed to set default binary",r));const n=$n(t,void 0,dt());K("ui",{opencodeBinaries:n}).catch(r=>x.error("Failed to update binary list",r))}function mc(e){Y("server",{logLevel:e??"DEBUG"}).catch(n=>x.error("Failed to set log level",n))}async function pc(e){const t=e.apiKey,{apiKey:n,...r}=e,o=uo({...ie().speech,...r,...t===null?{}:{apiKey:t}}),{hasApiKey:s,...i}=o,a={...i,...t===null?{apiKey:null}:{}};try{await Y("server",{speech:a})}catch(c){throw x.error("Failed to update speech settings",c),c}}function yc(e,t){const n=$n(e,t,dt());K("ui",{opencodeBinaries:n}).catch(r=>x.error("Failed to add binary",r))}function wc(e){const t=dt().filter(n=>n.path!==e);K("ui",{opencodeBinaries:t}).catch(n=>x.error("Failed to remove binary",n)),ie().opencodeBinary===e&&Y("server",{opencodeBinary:"opencode"}).catch(n=>x.error("Failed to reset default binary",n))}function bc(e){const t=ho(e,ut());K("ui",{recentFolders:t}).catch(n=>x.error("Failed to add recent folder",n))}function Cc(e){const t=ut().filter(n=>n.path!==e);K("ui",{recentFolders:t}).catch(n=>x.error("Failed to remove recent folder",n))}async function Sc(e,t){const n=t.trim();if(!e||!n)return;const r=ut().map(o=>o.path===e?{...o,projectName:n}:o);try{await K("ui",{recentFolders:r})}catch(o){throw x.error("Failed to rename recent folder",o),o}}async function vc(e){const t=tc(e,ze());return await K("ui",{remoteServers:go(t,ze())}),t}async function xc(e){const t=ze().find(o=>o.id===e);if(!t)return;const n=new Date().toISOString(),r={...t,updatedAt:n,lastConnectedAt:n};await K("ui",{remoteServers:go(r,ze())})}function Ec(e){const t=ze().filter(n=>n.id!==e);K("ui",{remoteServers:t}).catch(n=>x.error("Failed to remove remote server",n))}function Oc(e,t){const n=t&&t.trim().length>0?t:ie().opencodeBinary,r=ho(e,ut()),o=$n(n,void 0,dt());K("ui",{recentFolders:r,opencodeBinaries:o}).catch(s=>x.error("Failed to update ui state on launch",s)),Y("server",{opencodeBinary:n}).catch(s=>x.error("Failed to persist selected binary",s))}function Ac(e){if(!e.providerId||!e.modelId)return;const n=ae().models.recents.filter(o=>o.providerId!==e.providerId||o.modelId!==e.modelId),r=[e,...n].slice(0,Ga);K("ui",{models:{recents:r}}).catch(o=>x.error("Failed to update model recents",o))}function Tc(e){return!e.providerId||!e.modelId?!1:ae().models.favorites.some(t=>t.providerId===e.providerId&&t.modelId===e.modelId)}function kc(e){if(!e.providerId||!e.modelId)return;const t=ae().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,qa);K("ui",{models:{favorites:r}}).catch(o=>x.error("Failed to update model favorites",o))}function $c(e){if(!(!e.providerId||!e.modelId))return ae().models.thinkingSelections[fo(e)]}function Ic(e,t){if(!e.providerId||!e.modelId)return;const n=fo(e);if(ae().models.thinkingSelections[n]===t)return;const o={...ae().models.thinkingSelections};t?o[n]=t:delete o[n],K("ui",{models:{thinkingSelections:o}}).catch(s=>x.error("Failed to update thinking selection",s))}function Pc(e){B().diffViewMode!==e&&H({diffViewMode:e})}function Mc(e){const t=B();t.toolOutputExpansion===e&&t.toolCallExpansionDefaults.tools.other===e||H({toolOutputExpansion:e,toolCallExpansionDefaults:{...t.toolCallExpansionDefaults,preset:"custom",tools:{...t.toolCallExpansionDefaults.tools,other:e}}})}function Dc(e){B().diagnosticsExpansion!==e&&H({diagnosticsExpansion:e})}function Lc(e){B().toolInputsVisibility!==e&&H({toolInputsVisibility:e})}function Nc(e){const t=B();t.thinkingBlocksExpansion===e&&t.toolCallExpansionDefaults.thinking===e||H({thinkingBlocksExpansion:e,toolCallExpansionDefaults:{...t.toolCallExpansionDefaults,preset:"custom",thinking:e}})}function Rc(){H({showThinkingBlocks:!B().showThinkingBlocks})}function _c(){wo({showKeyboardShortcutHints:!B().showKeyboardShortcutHints})}function Fc(){H({showTimelineTools:!B().showTimelineTools})}function Uc(){H({showMessageTimeline:!(B().showMessageTimeline??!0)})}function Bc(){H({showUsageMetrics:!B().showUsageMetrics})}function Wc(){H({promptSubmitOnEnter:!B().promptSubmitOnEnter})}function jc(){H({showPromptVoiceInput:!B().showPromptVoiceInput})}function Vc(){const e=!B().autoCleanupBlankSessions;x.info("toggle auto cleanup",{value:e}),H({autoCleanupBlankSessions:e})}async function zc(e,t,n){!e||!t||!n.providerId||!n.modelId||(await qt(e),await so(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 Kc(e,t){return!e||!t?void 0:(await qt(e),(io(e).agentModelSelections??{})[t])}Jt().catch(e=>{x.error("Failed to initialize settings",e)});const bo=Ke(),Hc={isLoaded:mo,preferences:B,useTauriNativeEventTransport:po,setUseTauriNativeEventTransport:ac,updatePreferences:wo,themePreference:yo,setThemePreference:cc,serverSettings:ie,setListeningMode:lc,updateEnvironmentVariables:Pn,addEnvironmentVariable:uc,removeEnvironmentVariable:dc,isSecureEnvVar:fc,toggleSecureEnvVar:hc,updateLastUsedBinary:gc,updateLogLevel:mc,updateSpeechSettings:pc,recentFolders:ut,opencodeBinaries:dt,remoteServers:ze,uiState:ae,addRecentFolder:bc,removeRecentFolder:Cc,renameRecentFolderProject:Sc,addOpenCodeBinary:yc,removeOpenCodeBinary:wc,saveRemoteServerProfile:vc,markRemoteServerConnected:xc,removeRemoteServerProfile:Ec,recordWorkspaceLaunch:Oc,addRecentModelPreference:Ac,isFavoriteModelPreference:Tc,toggleFavoriteModelPreference:kc,getModelThinkingSelection:$c,setModelThinkingSelection:Ic,toggleShowThinkingBlocks:Rc,toggleKeyboardShortcutHints:_c,toggleShowMessageTimeline:Uc,toggleShowTimelineTools:Fc,toggleUsageMetrics:Bc,toggleAutoCleanupBlankSessions:Vc,togglePromptSubmitOnEnter:Wc,toggleShowPromptVoiceInput:jc,setDiffViewMode:Pc,setToolOutputExpansion:Mc,setDiagnosticsExpansion:Dc,setThinkingBlocksExpansion:Nc,setToolInputsVisibility:Lc,setAgentModelPreference:zc,getAgentModelPreference:Kc},fu=e=>(Ut(()=>{Jt().catch(o=>{x.error("Failed to initialize settings",o)});const t=ee.onConfigOwnerChanged("ui",o=>{Dt(o),nt(!0)}),n=ee.onConfigOwnerChanged("server",o=>{Lt(o),nt(!0),Ka(),za(!0)}),r=ee.onStateOwnerChanged("ui",o=>{Nt(o),nt(!0)});return()=>{t(),n(),r()}}),ge(bo.Provider,{value:Hc,get children(){return e.children}}));function Gc(){const e=at(bo);if(!e)throw new Error("useConfig must be used within ConfigProvider");return e}function qc(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 Jc=Symbol("solid-inspect"),Yc=Ke();function Xc(e){function t(n){var r;return(r=at(Yc))!=null&&r.enabled?{Component:t,props:n,$INSPECT:Jc}:e(n)}return Object.defineProperty(t,"name",{value:e.name}),t.toString=e.toString,t}function Co(){return function(e){function t(a){const c=!!e.slotClasses,u=()=>{if(!e.slotClasses)throw new Error("'slotClasses' option is not defined");if(!e.utilityClass)throw new Error("'utilityClass' option is not defined");return qc(e.slotClasses(a),e.utilityClass,a.classes??"")},l=ls({});return c&&Do(()=>{const d=u();ve(()=>{for(const f in d)l[f]=d[f]})}),l}function n(a){const[c,u]=Ft(a,e.selfPropNames);return{allProps:a,props:c,otherProps:u}}function r(a){return Zs({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=Xc(a),a.toString=()=>`.${e.name}-root`,c&&Gr(a,"base"),a}function i(a){const c=s(function(l){const{allProps:d,otherProps:f,props:m}=o(l),w=e.autoCallUseClasses??!0?t(d):{};return a({allProps:d,otherProps:f,props:m,classes:w})});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 Zc=Co()({name:"MuiGlobalStyles",selfPropNames:["styles"]}),Qc=Zc.component(function({props:t}){return Wr(()=>({"@global":t.styles||{}})),[]}),el=Co()({name:"MuiCssBaseline",selfPropNames:["children","enableColorScheme"],propDefaults:({set:e})=>e({enableColorScheme:!1})}),tl=(e,t)=>({WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",boxSizing:"border-box",WebkitTextSizeAdjust:"100%",...t&&{colorScheme:e.palette.mode}}),nl=e=>({color:e.palette.text.primary,...e.typography.body1,backgroundColor:e.palette.background.default,"@media print":{backgroundColor:e.palette.common.white}}),rl=(e,t=!1)=>({html:tl(e,t),"*, *::before, *::after":{boxSizing:"inherit"},"strong, b":{fontWeight:e.typography.fontWeightBold},body:{margin:0,...nl(e),"&::backdrop":{backgroundColor:e.palette.background.default}}}),ol=el.component(function({props:t}){const n=Mr();return ge(Qc,{get styles(){return rl(n,t.enableColorScheme)}})}),So=Ke();function lr(e){if(!(typeof document>"u")){if(e==="system"){document.documentElement.removeAttribute("data-theme");return}document.documentElement.setAttribute("data-theme",e)}}const sl={backgroundDefault:"#ffffff",backgroundPaper:"#f5f5f5",primary:"#0066ff",primaryContrast:"#ffffff",textPrimary:"#1a1a1a",textSecondary:"#666666",divider:"#e0e0e0"},il={backgroundDefault:"#1a1a1a",backgroundPaper:"#2a2a2a",primary:"#0080ff",primaryContrast:"#1a1a1a",textPrimary:"#cfd4dc",textSecondary:"#999999",divider:"#3a3a3a"},Ce=(e,t,n)=>{if(!n)return t;const r=n.getPropertyValue(e);return r&&r.trim()||t},al=e=>{const t=e?il:sl,n=typeof window<"u"?getComputedStyle(document.documentElement):null;return{backgroundDefault:Ce("--surface-base",t.backgroundDefault,n),backgroundPaper:Ce("--surface-secondary",t.backgroundPaper,n),primary:Ce("--accent-primary",t.primary,n),primaryContrast:Ce("--text-inverted",t.primaryContrast,n),textPrimary:Ce("--text-primary",t.textPrimary,n),textSecondary:Ce("--text-secondary",t.textSecondary,n),divider:Ce("--border-base",t.divider,n)}};function hu(e){const t=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,{themePreference:n,setThemePreference:r}=Gc(),[o,s]=$(!0),[i,a]=$(0),c=()=>n(),u=()=>{const w=c();return w==="dark"?!0:w==="light"?!1:(t==null?void 0:t.matches)??!1},l=()=>{const w=c(),g=u();lr(w==="system"?"system":w),s(g),typeof window<"u"?requestAnimationFrame(()=>a(b=>b+1)):a(b=>b+1)};z(()=>{l()}),Ut(()=>{if(!t)return;const w=()=>{l()};return t.addEventListener("change",w),()=>{t.removeEventListener("change",w)}});const d=w=>{r(w)},f=()=>{const w=c();d(w==="system"?"light":w==="light"?"dark":"system")},m=L(()=>{i();const w=al(o());return $r({palette:{mode:o()?"dark":"light",primary:{main:w.primary,contrastText:w.primaryContrast},secondary:{main:w.primary},background:{default:w.backgroundDefault,paper:w.backgroundPaper},text:{primary:w.textPrimary,secondary:w.textSecondary},divider:w.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 ge(So.Provider,{value:{isDark:o,themeMode:c,setThemeMode:d,cycleThemeMode:f},get children(){return ge(Qs,{get theme(){return m()},get children(){return[ge(ol,{}),zo(()=>e.children)]}})}})}function vo(){const e=at(So);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const cl=/(^|\n)@@/m,ll=/(^|\n)(diff --git |--- |\+\+\+)/,ul=/^\*\*\* (Begin|End) Patch/,dl=/^\*\*\* Update File: (.+)$/,fl=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;function hl(e){const t=e.trim();if(!t.startsWith("```"))return t;const n=t.split(`
16
16
  `);return n.length<2?"":n[n.length-1].startsWith("```")?n.slice(1,-1).join(`
17
17
  `):t}function gl(e){var s;if(!e)return"";const n=hl(e.replace(/\r\n/g,`
18
18
  `)).split(`
@@ -23,4 +23,4 @@ ${a}
23
23
  `),n=[],r=[];for(const o of t)o.startsWith("---")||o.startsWith("+++")||o.startsWith("diff --git")||fl.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
24
  `),after:r.join(`
25
25
  `)}}const pl="0.52.2",wn=`https://cdn.jsdelivr.net/npm/monaco-editor@${pl}/min/vs`,Q="/monaco/vs";let xt=null;function yl(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 wl(){if(typeof fetch>"u")return!1;try{const e=new AbortController,t=fetch(`${wn}/loader.js`,{method:"HEAD",signal:e.signal}),n=await yl(t,1200);return e.abort(),n.ok}catch{return!1}}function bl(){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=`${Q}/loader.js`,r.async=!0,r.onload=()=>t(),r.onerror=()=>n(new Error("Failed to load Monaco AMD loader")),document.head.appendChild(r)})}function Cl(){if(typeof document>"u"||document.querySelector('link[data-monaco-editor-css="true"]'))return;const t=document.createElement("link");t.rel="stylesheet",t.href=`${Q}/editor/editor.main.css`,t.dataset.monacoEditorCss="true",document.head.appendChild(t)}function Sl(){const e=globalThis,t=e.MonacoEnvironment??{},n="/monaco.worker.js";e.MonacoEnvironment={...t,getWorkerUrl(r,o){return n}}}function xo(){const e=globalThis.require;if(!e)throw new Error("Monaco AMD loader is not available");return e}function vl(){const t=xo().config;if(!t)throw new Error("require.config is not available");return t}function bn(e){const t=xo();return new Promise((n,r)=>{t(e,(...o)=>n(o),o=>r(o))})}function xl(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 ur=new Set,sn=new Map;async function Eo(e){const t=xl(e);if(!t||ur.has(t))return;const n=sn.get(t);if(n)return n;const r=(async()=>{let o=!1;try{await bn([t]),o=!0}catch{}finally{o&&ur.add(t),sn.delete(t)}})();return sn.set(t,r),r}async function Oo(){return xt||(xt=(async()=>{await bl(),Sl(),Cl();const e=await wl(),t=vl(),n={vs:Q};e&&(n["vs/basic-languages"]=`${wn}/basic-languages`,n["vs/language"]=`${wn}/language`,n["vs/basic-languages/python"]=`${Q}/basic-languages/python`,n["vs/basic-languages/markdown"]=`${Q}/basic-languages/markdown`,n["vs/basic-languages/cpp"]=`${Q}/basic-languages/cpp`,n["vs/basic-languages/kotlin"]=`${Q}/basic-languages/kotlin`,n["vs/language/typescript"]=`${Q}/language/typescript`,n["vs/language/html"]=`${Q}/language/html`,n["vs/language/json"]=`${Q}/language/json`,n["vs/language/css"]=`${Q}/language/css`),t({paths:n,ignoreDuplicateModules:["vs/editor/editor.main"]});const[r]=await bn(["vs/editor/editor.main"]);return await bn(["vs/basic-languages/monaco.contribution"]).catch(()=>[]),globalThis.monaco??r})(),xt)}const El=5,de=new Map;function Ol(e,t){de.delete(e),de.set(e,t)}function Al(){for(;de.size>El;){const e=de.keys().next().value;if(!e)return;const t=de.get(e);de.delete(e);try{t==null||t.model.dispose()}catch{}}}function Cn(e){const t=de.get(e.cacheKey);if(t)return Ol(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 de.set(e.cacheKey,o),Al(),r}let Et=null;function Tl(e){var o;if(Et)return Et;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 u of a)typeof u=="string"&&(t.has(u)||t.set(u,i));const c=Array.isArray(s==null?void 0:s.extensions)?s.extensions:[];for(const u of c)typeof u=="string"&&(n.has(u)||n.set(u,i))}return Et={fileNameToId:t,extToId:n},Et}function kl(e){return e===".gitignore"||e===".gitattributes"||e===".gitmodules"||e==="Makefile"||e.startsWith("Makefile.")?"shell":null}function Ao(e,t){const n=String(t||"").trim(),r=n.split("/").pop()||n,o=kl(r);if(o)return o;const s=Tl(e),i=s.fileNameToId.get(r);if(i)return i;const a=r.lastIndexOf(".");if(a>0){const c=r.slice(a),u=s.extToId.get(c);if(u)return u}return"plaintext"}var $l=Sn("<div class=monaco-viewer>");function Il(e){const{isDark:t}=vo();let n,r=null,o=null;const[s,i]=$(!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())},u=l=>{if(!e.compactGutter)return 5;const d=l.split(/\r\n|\r|\n/).length;return Math.max(3,String(d).length+1)};return Ut(()=>{let l=!1;(async()=>(o=await Oo(),!l&&(!n||!o||(o.editor.setTheme(t()?"vs-dark":"vs"),r=o.editor.create(n,{value:"",language:"plaintext",readOnly:!1,automaticLayout:!0,lineNumbers:"on",lineNumbersMinChars:u(e.content),glyphMargin:!1,folding:!e.compactGutter,lineDecorationsWidth:e.compactGutter?8:10,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)))))(),he(()=>{l=!0,i(!1),a()})}),z(()=>{!s()||!o||!r||o.editor.setTheme(t()?"vs-dark":"vs")}),z(()=>{!s()||!r||r.updateOptions({wordWrap:e.wordWrap==="on"?"on":"off"})}),z(()=>{!s()||!r||r.updateOptions({lineNumbersMinChars:u(e.content),folding:!e.compactGutter,lineDecorationsWidth:e.compactGutter?8:10})}),z(()=>{if(!s()||!o||!r)return;const l=Ao(o,e.path),d=`${e.scopeKey}:file:${e.path}`,f=Cn({monaco:o,cacheKey:d,value:e.content});r.setModel(f),Eo(l).then(()=>{try{o.editor.setModelLanguage(f,l)}catch{}})}),(()=>{var l=$l(),d=n;return typeof d=="function"?vn(d,l):n=l,l})()}const mu=Object.freeze(Object.defineProperty({__proto__:null,MonacoFileViewer:Il},Symbol.toStringTag,{value:"Module"}));var Pl=Sn("<div class=monaco-viewer><div class=git-change-context-overlay>"),Ml=Sn("<div class=git-change-context-widget-host><button type=button class=git-change-context-widget>+");function Rt(e){return e?e.split(`
26
- `).length:1}function _t(e){return String(Math.max(1,e)).length}function Dl(e){const t=Rt(e.before),n=Rt(e.after),r=_t(t),o=_t(n),s=Math.max(r,o),i=Math.max(0,s-2),a=Math.max(2,r),c=Math.max(2,o),u=Math.max(0,s-3);return{diffEditorLineNumbersMinChars:Math.max(a,c),originalLineNumbersMinChars:a,modifiedLineNumbersMinChars:c,lineDecorationsWidth:6+i*2+u*2}}function Ll(e){const t=Rt(e.before),n=Rt(e.after),r=_t(t),o=_t(n),s=Math.max(r,o),i=Math.max(0,s-2),a=Math.max(2,r),c=Math.max(2,o),u=Math.max(0,s-3);return{diffEditorLineNumbersMinChars:Math.max(a,c),originalLineNumbersMinChars:a,modifiedLineNumbersMinChars:c,lineDecorationsWidth:8+i*2+u}}function Nl(e){const{isDark:t}=vo();let n,r=null,o=null,s=null;const[i,a]=$(!1),[c,u]=$(null),[l,d]=$(null),[f,m]=$(!1),[y,g]=$(null),b=L(()=>e.patch!==void 0&&e.patch!==null?ml(e.patch):{before:e.before??"",after:e.after??""}),A=()=>{try{r==null||r.setModel(null)}catch{}try{r==null||r.dispose()}catch{}r=null},M=()=>{n&&(n.style.removeProperty("--split-original-line-number-width"),n.style.removeProperty("--split-original-delete-sign-left"),n.style.removeProperty("--split-original-gutter-width"))},N=p=>{if(n){if(s!==null&&typeof window<"u"&&(window.cancelAnimationFrame(s),s=null),p.viewMode!=="split"||typeof window>"u"){M();return}s=window.requestAnimationFrame(()=>{if(s=null,!n)return;const C=n.querySelector(".editor.original .line-numbers"),O=(C==null?void 0:C.getBoundingClientRect().width)??0,v=O>0?O:Math.max(12,p.originalLineNumbersMinChars*6);n.style.setProperty("--split-original-line-number-width",`${v}px`),n.style.setProperty("--split-original-delete-sign-left",`${v}px`),n.style.setProperty("--split-original-gutter-width",`${v+p.lineDecorationsWidth}px`)})}},X=()=>{var p;return((p=r==null?void 0:r.getModifiedEditor)==null?void 0:p.call(r))??null},ft=()=>{const p=l();if(p)return p;if(f()&&c())return{startLine:c(),endLine:c()};const C=c();return C?{startLine:C,endLine:C}:null},W=()=>{var v,E,k,S;const p=X(),C=n;if(!p||!C)return;const O=ft();if(!O){g(null);return}try{const P=(v=p.getDomNode)==null?void 0:v.call(p);if(!P){g(null);return}const F=P.querySelector(".margin"),Z=P.querySelector(".monaco-scrollable-element.editor-scrollable"),pe=((E=p.getTopForLineNumber)==null?void 0:E.call(p,O.startLine))??0,Te=((k=p.getScrollTop)==null?void 0:k.call(p))??0,ht=Number(((S=p.getOption)==null?void 0:S.call(p,o.editor.EditorOption.lineHeight))??18),Ge=P.getBoundingClientRect(),ye=C.getBoundingClientRect(),gt=Ge.left-ye.left+((F==null?void 0:F.offsetWidth)??(Z==null?void 0:Z.offsetLeft)??0),To=Ge.top-ye.top+(pe-Te)+ht/2;g({top:To,left:gt})}catch{g(null)}};return Ut(()=>{let p=!1;(async()=>(o=await Oo(),!p&&(!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),W()))))(),he(()=>{p=!0,s!==null&&typeof window<"u"&&(window.cancelAnimationFrame(s),s=null),M(),a(!1),A()})}),z(()=>{!i()||!o||!r||o.editor.setTheme(t()?"vs-dark":"vs")}),z(()=>{n&&(n.dataset.viewMode=e.viewMode==="split"?"split":"unified")}),z(()=>{var O;if(!i()||!o||!r)return;const p=(O=r.getModifiedEditor)==null?void 0:O.call(r);if(!(p!=null&&p.onDidChangeCursorSelection))return;const C=p.onDidChangeCursorSelection(v=>{var k;const E=v==null?void 0:v.selection;if(!E||(k=E.isEmpty)!=null&&k.call(E)){d(null),W();return}d({startLine:Math.min(E.startLineNumber,E.endLineNumber),endLine:Math.max(E.startLineNumber,E.endLineNumber)}),W()});he(()=>{var v;try{(v=C==null?void 0:C.dispose)==null||v.call(C)}catch{}})}),z(()=>{var E;if(!i()||!o||!r)return;const p=X();if(!(p!=null&&p.onMouseMove)||!(p!=null&&p.onMouseLeave)||!(p!=null&&p.onMouseDown))return;const C=p.onMouseMove(k=>{var P,F;const S=(F=(P=k==null?void 0:k.target)==null?void 0:P.position)==null?void 0:F.lineNumber;u(typeof S=="number"?S:null),W()}),O=p.onMouseLeave(()=>{f()||u(null),W()}),v=(E=p.onDidScrollChange)==null?void 0:E.call(p,()=>{W()});he(()=>{var k,S,P;try{(k=C==null?void 0:C.dispose)==null||k.call(C),(S=O==null?void 0:O.dispose)==null||S.call(O),(P=v==null?void 0:v.dispose)==null||P.call(v)}catch{}})}),z(()=>{if(!i()||!o||!r)return;ft()||g(null),W()}),z(()=>{var pe,Te,ht,Ge,ye,gt;if(!i()||!o||!r)return;const p=e.viewMode==="unified"?"unified":"split",C=e.contextMode==="collapsed"?"collapsed":"expanded",O=e.wordWrap==="on"?"on":"off",{before:v,after:E}=b(),k=p==="unified"?Dl({before:v,after:E}):Ll({before:v,after:E}),{diffEditorLineNumbersMinChars:S,originalLineNumbersMinChars:P,modifiedLineNumbersMinChars:F,lineDecorationsWidth:Z}=k;r.updateOptions({renderSideBySide:p==="split",renderSideBySideInlineBreakpoint:0,renderIndicators:!0,lineNumbersMinChars:S,lineDecorationsWidth:Z,hideUnchangedRegions:C==="collapsed"?{enabled:!0}:{enabled:!1},wordWrap:O});try{(ht=(Te=(pe=r.getOriginalEditor)==null?void 0:pe.call(r))==null?void 0:Te.updateOptions)==null||ht.call(Te,{wordWrap:O,lineNumbersMinChars:P,lineDecorationsWidth:Z})}catch{}try{(gt=(ye=(Ge=r.getModifiedEditor)==null?void 0:Ge.call(r))==null?void 0:ye.updateOptions)==null||gt.call(ye,{wordWrap:O,lineNumbersMinChars:F,lineDecorationsWidth:Z})}catch{}N({viewMode:p,originalLineNumbersMinChars:P,lineDecorationsWidth:Z})}),z(()=>{if(!i()||!o||!r)return;const p=Ao(o,e.path),{before:C,after:O}=b(),v=`${e.scopeKey}:diff:${e.path}:before`,E=`${e.scopeKey}:diff:${e.path}:after`,k=Cn({monaco:o,cacheKey:v,value:C}),S=Cn({monaco:o,cacheKey:E,value:O});r.setModel({original:k,modified:S}),Eo(p).then(()=>{try{o.editor.setModelLanguage(k,p),o.editor.setModelLanguage(S,p)}catch{}})}),(()=>{var p=Pl(),C=p.firstChild,O=n;return typeof O=="function"?vn(O,p):n=p,kt(C,ge(Lo,{get when(){return y()},children:v=>(()=>{var E=Ml(),k=E.firstChild;return E.addEventListener("mouseleave",()=>{m(!1),W()}),E.addEventListener("mouseenter",()=>{m(!0),W()}),k.$$click=S=>{var F;S.preventDefault(),S.stopPropagation();const P=ft();P&&((F=e.onRequestInsertContext)==null||F.call(e,P))},k.$$mousedown=S=>{S.preventDefault(),S.stopPropagation()},fe(S=>{var P=`${v().top}px`,F=`${v().left}px`,Z=e.insertContextLabel??"Add git change context to prompt",pe=e.insertContextLabel??"Add git change context to prompt";return P!==S.e&&Ln(E,"top",S.e=P),F!==S.t&&Ln(E,"left",S.t=F),Z!==S.a&&st(k,"aria-label",S.a=Z),pe!==S.o&&st(k,"title",S.o=pe),S},{e:void 0,t:void 0,a:void 0,o:void 0}),E})()})),p})()}mr(["mousedown","click"]);const pu=Object.freeze(Object.defineProperty({__proto__:null,MonacoDiffViewer:Nl},Symbol.toStringTag,{value:"Module"}));export{Yl as $,ae as A,Vl as B,tu as C,Wl as D,zc as E,B as F,za as G,ir as H,ie as I,Ac as J,$c as K,qt as L,Gc as M,Yo as N,eu as O,Bl as P,Kl as Q,Co as R,_i as S,Gl as T,Zl as U,Bi as V,Hr as W,Hl as X,Jl as Y,fi as Z,Vi as _,qo as a,ql as a0,Ql as a1,ls as a2,Xl as a3,gs as a4,hs as a5,vo as a6,gu as a7,io as a8,so as a9,Kt as aa,Ht as ab,nu as ac,kc as ad,Ic as ae,ru as af,iu as ag,lc as ah,uu as ai,du as aj,ee as ak,Ul as al,lu as am,hu as an,fu as ao,cu as ap,gl as aq,mu as ar,pu as as,pr as b,jl as c,st as d,Mr as e,mr as f,Ln as g,Jo as h,kt as i,re as j,ce as k,je as l,zo as m,ou as n,Sa as o,zl as p,va as q,au as r,Xo as s,Sn as t,vn as u,$e as v,Oa as w,su as x,Ot as y,Kc as z};
26
+ `).length:1}function _t(e){return String(Math.max(1,e)).length}function Dl(e){const t=Rt(e.before),n=Rt(e.after),r=_t(t),o=_t(n),s=Math.max(r,o),i=Math.max(0,s-2),a=Math.max(2,r),c=Math.max(2,o),u=Math.max(0,s-3);return{diffEditorLineNumbersMinChars:Math.max(a,c),originalLineNumbersMinChars:a,modifiedLineNumbersMinChars:c,lineDecorationsWidth:6+i*2+u*2}}function Ll(e){const t=Rt(e.before),n=Rt(e.after),r=_t(t),o=_t(n),s=Math.max(r,o),i=Math.max(0,s-2),a=Math.max(2,r),c=Math.max(2,o),u=Math.max(0,s-3);return{diffEditorLineNumbersMinChars:Math.max(a,c),originalLineNumbersMinChars:a,modifiedLineNumbersMinChars:c,lineDecorationsWidth:8+i*2+u}}function Nl(e){const{isDark:t}=vo();let n,r=null,o=null,s=null;const[i,a]=$(!1),[c,u]=$(null),[l,d]=$(null),[f,m]=$(!1),[w,g]=$(null),b=L(()=>e.patch!==void 0&&e.patch!==null?ml(e.patch):{before:e.before??"",after:e.after??""}),A=()=>{try{r==null||r.setModel(null)}catch{}try{r==null||r.dispose()}catch{}r=null},M=()=>{n&&(n.style.removeProperty("--split-original-line-number-width"),n.style.removeProperty("--split-original-delete-sign-left"),n.style.removeProperty("--split-original-gutter-width"))},N=p=>{if(n){if(s!==null&&typeof window<"u"&&(window.cancelAnimationFrame(s),s=null),p.viewMode!=="split"||typeof window>"u"){M();return}s=window.requestAnimationFrame(()=>{if(s=null,!n)return;const C=n.querySelector(".editor.original .line-numbers"),O=(C==null?void 0:C.getBoundingClientRect().width)??0,v=O>0?O:Math.max(12,p.originalLineNumbersMinChars*6);n.style.setProperty("--split-original-line-number-width",`${v}px`),n.style.setProperty("--split-original-delete-sign-left",`${v}px`),n.style.setProperty("--split-original-gutter-width",`${v+p.lineDecorationsWidth}px`)})}},X=()=>{var p;return((p=r==null?void 0:r.getModifiedEditor)==null?void 0:p.call(r))??null},ft=()=>{const p=l();if(p)return p;if(f()&&c())return{startLine:c(),endLine:c()};const C=c();return C?{startLine:C,endLine:C}:null},W=()=>{var v,E,k,S;const p=X(),C=n;if(!p||!C)return;const O=ft();if(!O){g(null);return}try{const P=(v=p.getDomNode)==null?void 0:v.call(p);if(!P){g(null);return}const F=P.querySelector(".margin"),Z=P.querySelector(".monaco-scrollable-element.editor-scrollable"),pe=((E=p.getTopForLineNumber)==null?void 0:E.call(p,O.startLine))??0,Te=((k=p.getScrollTop)==null?void 0:k.call(p))??0,ht=Number(((S=p.getOption)==null?void 0:S.call(p,o.editor.EditorOption.lineHeight))??18),Ge=P.getBoundingClientRect(),ye=C.getBoundingClientRect(),gt=Ge.left-ye.left+((F==null?void 0:F.offsetWidth)??(Z==null?void 0:Z.offsetLeft)??0),To=Ge.top-ye.top+(pe-Te)+ht/2;g({top:To,left:gt})}catch{g(null)}};return Ut(()=>{let p=!1;(async()=>(o=await Oo(),!p&&(!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),W()))))(),he(()=>{p=!0,s!==null&&typeof window<"u"&&(window.cancelAnimationFrame(s),s=null),M(),a(!1),A()})}),z(()=>{!i()||!o||!r||o.editor.setTheme(t()?"vs-dark":"vs")}),z(()=>{n&&(n.dataset.viewMode=e.viewMode==="split"?"split":"unified")}),z(()=>{var O;if(!i()||!o||!r)return;const p=(O=r.getModifiedEditor)==null?void 0:O.call(r);if(!(p!=null&&p.onDidChangeCursorSelection))return;const C=p.onDidChangeCursorSelection(v=>{var k;const E=v==null?void 0:v.selection;if(!E||(k=E.isEmpty)!=null&&k.call(E)){d(null),W();return}d({startLine:Math.min(E.startLineNumber,E.endLineNumber),endLine:Math.max(E.startLineNumber,E.endLineNumber)}),W()});he(()=>{var v;try{(v=C==null?void 0:C.dispose)==null||v.call(C)}catch{}})}),z(()=>{var E;if(!i()||!o||!r)return;const p=X();if(!(p!=null&&p.onMouseMove)||!(p!=null&&p.onMouseLeave)||!(p!=null&&p.onMouseDown))return;const C=p.onMouseMove(k=>{var P,F;const S=(F=(P=k==null?void 0:k.target)==null?void 0:P.position)==null?void 0:F.lineNumber;u(typeof S=="number"?S:null),W()}),O=p.onMouseLeave(()=>{f()||u(null),W()}),v=(E=p.onDidScrollChange)==null?void 0:E.call(p,()=>{W()});he(()=>{var k,S,P;try{(k=C==null?void 0:C.dispose)==null||k.call(C),(S=O==null?void 0:O.dispose)==null||S.call(O),(P=v==null?void 0:v.dispose)==null||P.call(v)}catch{}})}),z(()=>{if(!i()||!o||!r)return;ft()||g(null),W()}),z(()=>{var pe,Te,ht,Ge,ye,gt;if(!i()||!o||!r)return;const p=e.viewMode==="unified"?"unified":"split",C=e.contextMode==="collapsed"?"collapsed":"expanded",O=e.wordWrap==="on"?"on":"off",{before:v,after:E}=b(),k=p==="unified"?Dl({before:v,after:E}):Ll({before:v,after:E}),{diffEditorLineNumbersMinChars:S,originalLineNumbersMinChars:P,modifiedLineNumbersMinChars:F,lineDecorationsWidth:Z}=k;r.updateOptions({renderSideBySide:p==="split",renderSideBySideInlineBreakpoint:0,renderIndicators:!0,lineNumbersMinChars:S,lineDecorationsWidth:Z,hideUnchangedRegions:C==="collapsed"?{enabled:!0}:{enabled:!1},wordWrap:O});try{(ht=(Te=(pe=r.getOriginalEditor)==null?void 0:pe.call(r))==null?void 0:Te.updateOptions)==null||ht.call(Te,{wordWrap:O,lineNumbersMinChars:P,lineDecorationsWidth:Z})}catch{}try{(gt=(ye=(Ge=r.getModifiedEditor)==null?void 0:Ge.call(r))==null?void 0:ye.updateOptions)==null||gt.call(ye,{wordWrap:O,lineNumbersMinChars:F,lineDecorationsWidth:Z})}catch{}N({viewMode:p,originalLineNumbersMinChars:P,lineDecorationsWidth:Z})}),z(()=>{if(!i()||!o||!r)return;const p=Ao(o,e.path),{before:C,after:O}=b(),v=`${e.scopeKey}:diff:${e.path}:before`,E=`${e.scopeKey}:diff:${e.path}:after`,k=Cn({monaco:o,cacheKey:v,value:C}),S=Cn({monaco:o,cacheKey:E,value:O});r.setModel({original:k,modified:S}),Eo(p).then(()=>{try{o.editor.setModelLanguage(k,p),o.editor.setModelLanguage(S,p)}catch{}})}),(()=>{var p=Pl(),C=p.firstChild,O=n;return typeof O=="function"?vn(O,p):n=p,kt(C,ge(Lo,{get when(){return w()},children:v=>(()=>{var E=Ml(),k=E.firstChild;return E.addEventListener("mouseleave",()=>{m(!1),W()}),E.addEventListener("mouseenter",()=>{m(!0),W()}),k.$$click=S=>{var F;S.preventDefault(),S.stopPropagation();const P=ft();P&&((F=e.onRequestInsertContext)==null||F.call(e,P))},k.$$mousedown=S=>{S.preventDefault(),S.stopPropagation()},fe(S=>{var P=`${v().top}px`,F=`${v().left}px`,Z=e.insertContextLabel??"Add git change context to prompt",pe=e.insertContextLabel??"Add git change context to prompt";return P!==S.e&&Ln(E,"top",S.e=P),F!==S.t&&Ln(E,"left",S.t=F),Z!==S.a&&st(k,"aria-label",S.a=Z),pe!==S.o&&st(k,"title",S.o=pe),S},{e:void 0,t:void 0,a:void 0,o:void 0}),E})()})),p})()}mr(["mousedown","click"]);const pu=Object.freeze(Object.defineProperty({__proto__:null,MonacoDiffViewer:Nl},Symbol.toStringTag,{value:"Module"}));export{Yl as $,ae as A,Vl as B,tu as C,Wl as D,zc as E,B as F,za as G,ir as H,ie as I,Ac as J,$c as K,qt as L,Gc as M,Yo as N,eu as O,Bl as P,Kl as Q,Co as R,_i as S,Gl as T,Zl as U,Bi as V,Hr as W,Hl as X,Jl as Y,fi as Z,Vi as _,qo as a,ql as a0,Ql as a1,ls as a2,Xl as a3,gs as a4,hs as a5,vo as a6,gu as a7,io as a8,so as a9,Kt as aa,Ht as ab,nu as ac,kc as ad,Ic as ae,ru as af,iu as ag,lc as ah,uu as ai,du as aj,ee as ak,Ul as al,lu as am,hu as an,fu as ao,cu as ap,gl as aq,mu as ar,pu as as,pr as b,jl as c,st as d,Mr as e,mr as f,Ln as g,Jo as h,kt as i,re as j,ce as k,je as l,zo as m,ou as n,Sa as o,zl as p,va as q,au as r,Xo as s,Sn as t,vn as u,$e as v,Oa as w,su as x,Ot as y,Kc as z};