@kaitranntt/ccs 8.9.0-dev.10 → 8.9.0-dev.11

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 (60) hide show
  1. package/dist/cliproxy/accounts/drain-order.d.ts +9 -1
  2. package/dist/cliproxy/accounts/drain-order.d.ts.map +1 -1
  3. package/dist/cliproxy/accounts/drain-order.js +15 -1
  4. package/dist/cliproxy/accounts/drain-order.js.map +1 -1
  5. package/dist/cliproxy/binary/platform-detector.d.ts.map +1 -1
  6. package/dist/cliproxy/binary/platform-detector.js +5 -4
  7. package/dist/cliproxy/binary/platform-detector.js.map +1 -1
  8. package/dist/cliproxy/binary/version-checker.d.ts +2 -0
  9. package/dist/cliproxy/binary/version-checker.d.ts.map +1 -1
  10. package/dist/cliproxy/binary/version-checker.js +5 -1
  11. package/dist/cliproxy/binary/version-checker.js.map +1 -1
  12. package/dist/cliproxy/routing/routing-strategy.d.ts +4 -5
  13. package/dist/cliproxy/routing/routing-strategy.d.ts.map +1 -1
  14. package/dist/cliproxy/routing/routing-strategy.js +18 -13
  15. package/dist/cliproxy/routing/routing-strategy.js.map +1 -1
  16. package/dist/commands/cliproxy/order-subcommand.d.ts.map +1 -1
  17. package/dist/commands/cliproxy/order-subcommand.js +21 -0
  18. package/dist/commands/cliproxy/order-subcommand.js.map +1 -1
  19. package/dist/shared/provider-preset-catalog.d.ts +1 -1
  20. package/dist/shared/provider-preset-catalog.d.ts.map +1 -1
  21. package/dist/shared/provider-preset-catalog.js +1 -1
  22. package/dist/shared/provider-preset-catalog.js.map +1 -1
  23. package/dist/ui/assets/{Trans-Dv0FgbfN.js → Trans-CFovxljl.js} +1 -1
  24. package/dist/ui/assets/{accounts-DD4gJm5G.js → accounts-dagN4ycI.js} +1 -1
  25. package/dist/ui/assets/{alert-dialog-CfsyUL5i.js → alert-dialog-DJkGvE-_.js} +1 -1
  26. package/dist/ui/assets/{api-Rml_6r1f.js → api-C3LysQ5X.js} +1 -1
  27. package/dist/ui/assets/{auth-section-ud23YOqo.js → auth-section-BEIcNixR.js} +1 -1
  28. package/dist/ui/assets/{backups-section-BvojIR_s.js → backups-section-CKhGhirR.js} +1 -1
  29. package/dist/ui/assets/{channels-C6JAnQ-P.js → channels-BiBwXY06.js} +1 -1
  30. package/dist/ui/assets/{checkbox-e4TE1vtU.js → checkbox-BAMGOBUT.js} +1 -1
  31. package/dist/ui/assets/{claude-extension-Crqbbisi.js → claude-extension-B1nt1ulT.js} +1 -1
  32. package/dist/ui/assets/{cliproxy-ai-providers-DRfGjeni.js → cliproxy-ai-providers-CGEN2_tw.js} +1 -1
  33. package/dist/ui/assets/{cliproxy-control-panel-C0TgmqD6.js → cliproxy-control-panel-BLkpXPri.js} +1 -1
  34. package/dist/ui/assets/{cliproxy-CTzg_fbJ.js → cliproxy-fvgNUwXr.js} +1 -1
  35. package/dist/ui/assets/{codex-CGFN2_Yz.js → codex-CQSjWlPZ.js} +1 -1
  36. package/dist/ui/assets/{confirm-dialog-CWYwcPu7.js → confirm-dialog-BZONByZ0.js} +1 -1
  37. package/dist/ui/assets/{copilot-CDo33AQ9.js → copilot-CWPqu-HF.js} +1 -1
  38. package/dist/ui/assets/{cursor-nVJdycFe.js → cursor-ULjTPFiL.js} +1 -1
  39. package/dist/ui/assets/{droid-C1mg2O8N.js → droid-CYomszN0.js} +1 -1
  40. package/dist/ui/assets/{globalenv-section-D0iUrk5Z.js → globalenv-section-CB5wPkY8.js} +1 -1
  41. package/dist/ui/assets/{health-CIcj1Jxy.js → health-DbBL3q3w.js} +1 -1
  42. package/dist/ui/assets/{index-W-L7VU-4.js → index-CoMpJo_n.js} +1 -1
  43. package/dist/ui/assets/{index-DvvpgsgL.js → index-CxUAdhtw.js} +1 -1
  44. package/dist/ui/assets/{index-BxcCMHzL.js → index-D0p405yf.js} +1 -1
  45. package/dist/ui/assets/{index-AosRBwPp.js → index-D4JDNw3s.js} +1 -1
  46. package/dist/ui/assets/{index-BCqgbLRB.js → index-DKwgHLt0.js} +1 -1
  47. package/dist/ui/assets/{index-DZbSKKhp.js → index-Vt-HZYJB.js} +1 -1
  48. package/dist/ui/assets/{index-DwlqXVPF.js → index-m5EMndrQ.js} +3 -3
  49. package/dist/ui/assets/{logs-CLIARnH2.js → logs-vWuOwwU1.js} +1 -1
  50. package/dist/ui/assets/{masked-input-BRcjJtU3.js → masked-input-CsDo2D0E.js} +1 -1
  51. package/dist/ui/assets/{proxy-status-widget-CBBs3HmJ.js → proxy-status-widget-y8f65qJb.js} +1 -1
  52. package/dist/ui/assets/{raw-json-settings-editor-panel-DhDm8jkK.js → raw-json-settings-editor-panel-BuXCUjIt.js} +1 -1
  53. package/dist/ui/assets/{searchable-select-DW5e6ct1.js → searchable-select-x2D3DEEJ.js} +1 -1
  54. package/dist/ui/assets/{separator-D-2blr1t.js → separator-Fw3KeL5O.js} +1 -1
  55. package/dist/ui/assets/{shared-BIRVeSaP.js → shared-BZjxvNAq.js} +1 -1
  56. package/dist/ui/assets/{table-CEyFyU_X.js → table-DmTBUO7C.js} +1 -1
  57. package/dist/ui/assets/{updates-Dcpm3clh.js → updates-DRQ9v7zh.js} +1 -1
  58. package/dist/ui/assets/{use-accounts-Cjb9-mnK.js → use-accounts-C2nUYcFE.js} +1 -1
  59. package/dist/ui/index.html +1 -1
  60. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-AosRBwPp.js","assets/radix-ui-nu4wz29m.js","assets/react-vendor-Bjx91N7w.js","assets/masked-input-BRcjJtU3.js","assets/icons-DSLG1YsC.js","assets/tanstack-bhJxV1h8.js","assets/notifications-B4_o8bcr.js","assets/utils-CzKF5WmX.js","assets/form-utils-CuHzLhJZ.js","assets/charts-eIPy2oG6.js","assets/index-BCqgbLRB.js","assets/proxy-C4-M_9kB.js","assets/index-BxcCMHzL.js","assets/channels-C6JAnQ-P.js","assets/globalenv-section-D0iUrk5Z.js","assets/index-DvvpgsgL.js","assets/index-DZbSKKhp.js","assets/default-ports-1QQSffYX.js","assets/proxy-status-widget-CBBs3HmJ.js","assets/alert-dialog-CfsyUL5i.js","assets/Trans-Dv0FgbfN.js","assets/antigravity-responsibility-constants-Bvh4Ybz0.js","assets/auth-section-ud23YOqo.js","assets/backups-section-BvojIR_s.js","assets/index-W-L7VU-4.js","assets/use-accounts-Cjb9-mnK.js","assets/api-Rml_6r1f.js","assets/confirm-dialog-CWYwcPu7.js","assets/cliproxy-CTzg_fbJ.js","assets/checkbox-e4TE1vtU.js","assets/separator-D-2blr1t.js","assets/searchable-select-DW5e6ct1.js","assets/cliproxy-ai-providers-DRfGjeni.js","assets/cliproxy-control-panel-C0TgmqD6.js","assets/copilot-CDo33AQ9.js","assets/cursor-nVJdycFe.js","assets/claude-extension-Crqbbisi.js","assets/codex-CGFN2_Yz.js","assets/table-CEyFyU_X.js","assets/raw-json-settings-editor-panel-DhDm8jkK.js","assets/droid-C1mg2O8N.js","assets/logs-CLIARnH2.js","assets/accounts-DD4gJm5G.js","assets/health-CIcj1Jxy.js","assets/shared-BIRVeSaP.js","assets/updates-Dcpm3clh.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D4JDNw3s.js","assets/radix-ui-nu4wz29m.js","assets/react-vendor-Bjx91N7w.js","assets/masked-input-CsDo2D0E.js","assets/icons-DSLG1YsC.js","assets/tanstack-bhJxV1h8.js","assets/notifications-B4_o8bcr.js","assets/utils-CzKF5WmX.js","assets/form-utils-CuHzLhJZ.js","assets/charts-eIPy2oG6.js","assets/index-DKwgHLt0.js","assets/proxy-C4-M_9kB.js","assets/index-D0p405yf.js","assets/channels-BiBwXY06.js","assets/globalenv-section-CB5wPkY8.js","assets/index-CxUAdhtw.js","assets/index-Vt-HZYJB.js","assets/default-ports-1QQSffYX.js","assets/proxy-status-widget-y8f65qJb.js","assets/alert-dialog-DJkGvE-_.js","assets/Trans-CFovxljl.js","assets/antigravity-responsibility-constants-Bvh4Ybz0.js","assets/auth-section-BEIcNixR.js","assets/backups-section-CKhGhirR.js","assets/index-CoMpJo_n.js","assets/use-accounts-C2nUYcFE.js","assets/api-C3LysQ5X.js","assets/confirm-dialog-BZONByZ0.js","assets/cliproxy-fvgNUwXr.js","assets/checkbox-BAMGOBUT.js","assets/separator-Fw3KeL5O.js","assets/searchable-select-x2D3DEEJ.js","assets/cliproxy-ai-providers-CGEN2_tw.js","assets/cliproxy-control-panel-BLkpXPri.js","assets/copilot-CWPqu-HF.js","assets/cursor-ULjTPFiL.js","assets/claude-extension-B1nt1ulT.js","assets/codex-CQSjWlPZ.js","assets/table-DmTBUO7C.js","assets/raw-json-settings-editor-panel-BuXCUjIt.js","assets/droid-CYomszN0.js","assets/logs-vWuOwwU1.js","assets/accounts-dagN4ycI.js","assets/health-DbBL3q3w.js","assets/shared-BZjxvNAq.js","assets/updates-DRQ9v7zh.js"])))=>i.map(i=>d[i]);
2
2
  import{j as p,S as Vh,R as BA,C as HA,a as UA,T as _A,D as zA,P as FA,O as qA,b as IN,c as jN,d as BN,e as HN,f as UN,A as _N,g as zN,h as FN,i as qN,k as GN,l as VN,m as KN,n as WN,I as QN,o as GA,p as YN,q as VA,r as KA,s as $N,t as WA,V as XN,L as QA,u as YA,v as JN,w as ZN,x as $A,y as eE,z as tE,B as XA,E as nE,F as iE,G as JA,H as oE,J as ZA,K as e1,M as t1,N as aE,Q as sE,U as rE,W as lE,X as cE,Y as n1,Z as dE,_ as uE,$ as hE}from"./radix-ui-nu4wz29m.js";import{b as i1,d as fE,r as w,u as Kh,O as ny,N as o1,e as vb,L as uh,R as pE,h as a1,E as ge,B as mE,i as gE,j as It}from"./react-vendor-Bjx91N7w.js";import{Q as yE,u as Lt,a as mt,b as rt,c as bE,d as vE}from"./tanstack-bhJxV1h8.js";import{t as fe,T as xE}from"./notifications-B4_o8bcr.js";import{L as hi,X as Vr,P as CE,C as Wh,H as SE,a as kE,K as iy,G as wE,Z as s1,F as r1,U as l1,b as PE,S as AE,c as c1,A as vc,d as d1,e as DE,f as u1,M as h1,E as Kc,g as Wc,B as OE,R as xc,W as TE,h as ME,i as RE,j as LE,k as NE,l as XS,m as JS,n as Er,o as xb,p as hh,q as f1,r as p1,s as EE,t as Qh,u as Cb,v as m1,w as Ir,T as wi,x as Cc,y as Qc,z as ZS,D as IE,I as g1,J as Sb,N as jE,O as Yh,Q as BE,V as HE,Y as UE,_ as _E,$ as $h,a0 as zE,a1 as FE,a2 as y1,a3 as qE,a4 as GE,a5 as VE,a6 as KE,a7 as WE,a8 as kb,a9 as b1,aa as ek,ab as QE,ac as YE,ad as $E,ae as XE,af as JE,ag as ZE,ah as tk,ai as eI,aj as Su,ak as nk,al as ik,am as tI}from"./icons-DSLG1YsC.js";import{t as nI,c as iI,a as Xh,e as zl,f as $l,b as oI,d as aI,g as sI,h as rI,i as lI,j as cI,k as dI,l as uI,m as hI,n as fI,o as pI,p as mI,q as gI,r as yI,s as bI,u as vI,v as xI,w as CI,x as SI,y as kI,z as wI,A as PI,B as AI,C as DI,D as OI,E as TI,F as MI,G as RI,H as LI,I as NI,J as EI}from"./utils-CzKF5WmX.js";import{o as ok,s as ak,p as II,a as jI,$ as BI,b as v1,c as ca,d as HI,_ as UI,u as _I,e as sk}from"./form-utils-CuHzLhJZ.js";import{_ as zI,a as FI}from"./charts-eIPy2oG6.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const r of s.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function t(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(o){if(o.ep)return;o.ep=!0;const s=t(o);fetch(o.href,s)}})();var Xm={exports:{}},Fl={},Jm={exports:{}},Zm={};var rk;function qI(){return rk||(rk=1,(function(n){function e(H,Z){var ae=H.length;H.push(Z);e:for(;0<ae;){var Y=ae-1>>>1,se=H[Y];if(0<o(se,Z))H[Y]=Z,H[ae]=se,ae=Y;else break e}}function t(H){return H.length===0?null:H[0]}function i(H){if(H.length===0)return null;var Z=H[0],ae=H.pop();if(ae!==Z){H[0]=ae;e:for(var Y=0,se=H.length,ue=se>>>1;Y<ue;){var be=2*(Y+1)-1,te=H[be],le=be+1,xe=H[le];if(0>o(te,ae))le<se&&0>o(xe,te)?(H[Y]=xe,H[le]=ae,Y=le):(H[Y]=te,H[be]=ae,Y=be);else if(le<se&&0>o(xe,ae))H[Y]=xe,H[le]=ae,Y=le;else break e}}return Z}function o(H,Z){var ae=H.sortIndex-Z.sortIndex;return ae!==0?ae:H.id-Z.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var r=Date,c=r.now();n.unstable_now=function(){return r.now()-c}}var u=[],f=[],m=1,g=null,v=3,x=!1,C=!1,k=!1,P=!1,D=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function M(H){for(var Z=t(f);Z!==null;){if(Z.callback===null)i(f);else if(Z.startTime<=H)i(f),Z.sortIndex=Z.expirationTime,e(u,Z);else break;Z=t(f)}}function L(H){if(k=!1,M(H),!C)if(t(u)!==null)C=!0,R||(R=!0,F());else{var Z=t(f);Z!==null&&oe(L,Z.startTime-H)}}var R=!1,I=-1,W=5,_=-1;function z(){return P?!0:!(n.unstable_now()-_<W)}function $(){if(P=!1,R){var H=n.unstable_now();_=H;var Z=!0;try{e:{C=!1,k&&(k=!1,O(I),I=-1),x=!0;var ae=v;try{t:{for(M(H),g=t(u);g!==null&&!(g.expirationTime>H&&z());){var Y=g.callback;if(typeof Y=="function"){g.callback=null,v=g.priorityLevel;var se=Y(g.expirationTime<=H);if(H=n.unstable_now(),typeof se=="function"){g.callback=se,M(H),Z=!0;break t}g===t(u)&&i(u),M(H)}else i(u);g=t(u)}if(g!==null)Z=!0;else{var ue=t(f);ue!==null&&oe(L,ue.startTime-H),Z=!1}}break e}finally{g=null,v=ae,x=!1}Z=void 0}}finally{Z?F():R=!1}}}var F;if(typeof T=="function")F=function(){T($)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,ie=B.port2;B.port1.onmessage=$,F=function(){ie.postMessage(null)}}else F=function(){D($,0)};function oe(H,Z){I=D(function(){H(n.unstable_now())},Z)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(H){H.callback=null},n.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):W=0<H?Math.floor(1e3/H):5},n.unstable_getCurrentPriorityLevel=function(){return v},n.unstable_next=function(H){switch(v){case 1:case 2:case 3:var Z=3;break;default:Z=v}var ae=v;v=Z;try{return H()}finally{v=ae}},n.unstable_requestPaint=function(){P=!0},n.unstable_runWithPriority=function(H,Z){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var ae=v;v=H;try{return Z()}finally{v=ae}},n.unstable_scheduleCallback=function(H,Z,ae){var Y=n.unstable_now();switch(typeof ae=="object"&&ae!==null?(ae=ae.delay,ae=typeof ae=="number"&&0<ae?Y+ae:Y):ae=Y,H){case 1:var se=-1;break;case 2:se=250;break;case 5:se=1073741823;break;case 4:se=1e4;break;default:se=5e3}return se=ae+se,H={id:m++,callback:Z,priorityLevel:H,startTime:ae,expirationTime:se,sortIndex:-1},ae>Y?(H.sortIndex=ae,e(f,H),t(u)===null&&H===t(f)&&(k?(O(I),I=-1):k=!0,oe(L,ae-Y))):(H.sortIndex=se,e(u,H),C||x||(C=!0,R||(R=!0,F()))),H},n.unstable_shouldYield=z,n.unstable_wrapCallback=function(H){var Z=v;return function(){var ae=v;v=Z;try{return H.apply(this,arguments)}finally{v=ae}}}})(Zm)),Zm}var lk;function GI(){return lk||(lk=1,Jm.exports=qI()),Jm.exports}var ck;function VI(){if(ck)return Fl;ck=1;var n=GI(),e=i1(),t=fE();function i(a){var l="https://react.dev/errors/"+a;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)l+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+a+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function s(a){var l=a,d=a;if(a.alternate)for(;l.return;)l=l.return;else{a=l;do l=a,(l.flags&4098)!==0&&(d=l.return),a=l.return;while(a)}return l.tag===3?d:null}function r(a){if(a.tag===13){var l=a.memoizedState;if(l===null&&(a=a.alternate,a!==null&&(l=a.memoizedState)),l!==null)return l.dehydrated}return null}function c(a){if(a.tag===31){var l=a.memoizedState;if(l===null&&(a=a.alternate,a!==null&&(l=a.memoizedState)),l!==null)return l.dehydrated}return null}function u(a){if(s(a)!==a)throw Error(i(188))}function f(a){var l=a.alternate;if(!l){if(l=s(a),l===null)throw Error(i(188));return l!==a?null:a}for(var d=a,h=l;;){var y=d.return;if(y===null)break;var b=y.alternate;if(b===null){if(h=y.return,h!==null){d=h;continue}break}if(y.child===b.child){for(b=y.child;b;){if(b===d)return u(y),a;if(b===h)return u(y),l;b=b.sibling}throw Error(i(188))}if(d.return!==h.return)d=y,h=b;else{for(var S=!1,A=y.child;A;){if(A===d){S=!0,d=y,h=b;break}if(A===h){S=!0,h=y,d=b;break}A=A.sibling}if(!S){for(A=b.child;A;){if(A===d){S=!0,d=b,h=y;break}if(A===h){S=!0,h=b,d=y;break}A=A.sibling}if(!S)throw Error(i(189))}}if(d.alternate!==h)throw Error(i(190))}if(d.tag!==3)throw Error(i(188));return d.stateNode.current===d?a:l}function m(a){var l=a.tag;if(l===5||l===26||l===27||l===6)return a;for(a=a.child;a!==null;){if(l=m(a),l!==null)return l;a=a.sibling}return null}var g=Object.assign,v=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),T=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function F(a){return a===null||typeof a!="object"?null:(a=$&&a[$]||a["@@iterator"],typeof a=="function"?a:null)}var B=Symbol.for("react.client.reference");function ie(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===B?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case k:return"Fragment";case D:return"Profiler";case P:return"StrictMode";case L:return"Suspense";case R:return"SuspenseList";case _:return"Activity"}if(typeof a=="object")switch(a.$$typeof){case C:return"Portal";case T:return a.displayName||"Context";case O:return(a._context.displayName||"Context")+".Consumer";case M:var l=a.render;return a=a.displayName,a||(a=l.displayName||l.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case I:return l=a.displayName||null,l!==null?l:ie(a.type)||"Memo";case W:l=a._payload,a=a._init;try{return ie(a(l))}catch{}}return null}var oe=Array.isArray,H=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},Y=[],se=-1;function ue(a){return{current:a}}function be(a){0>se||(a.current=Y[se],Y[se]=null,se--)}function te(a,l){se++,Y[se]=a.current,a.current=l}var le=ue(null),xe=ue(null),Se=ue(null),ye=ue(null);function Oe(a,l){switch(te(Se,l),te(xe,a),te(le,null),l.nodeType){case 9:case 11:a=(a=l.documentElement)&&(a=a.namespaceURI)?xS(a):0;break;default:if(a=l.tagName,l=l.namespaceURI)l=xS(l),a=CS(l,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}be(le),te(le,a)}function Be(){be(le),be(xe),be(Se)}function nt(a){a.memoizedState!==null&&te(ye,a);var l=le.current,d=CS(l,a.type);l!==d&&(te(xe,a),te(le,d))}function At(a){xe.current===a&&(be(le),be(xe)),ye.current===a&&(be(ye),Bl._currentValue=ae)}var Te,Ye;function it(a){if(Te===void 0)try{throw Error()}catch(d){var l=d.stack.trim().match(/\n( *(at )?)/);Te=l&&l[1]||"",Ye=-1<d.stack.indexOf(`
3
3
  at`)?" (<anonymous>)":-1<d.stack.indexOf("@")?"@unknown:0:0":""}return`
4
4
  `+Te+a+Ye}var ln=!1;function Sn(a,l){if(!a||ln)return"";ln=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(l){var ne=function(){throw Error()};if(Object.defineProperty(ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ne,[])}catch(Q){var K=Q}Reflect.construct(a,[],ne)}else{try{ne.call()}catch(Q){K=Q}a.call(ne.prototype)}}else{try{throw Error()}catch(Q){K=Q}(ne=a())&&typeof ne.catch=="function"&&ne.catch(function(){})}}catch(Q){if(Q&&K&&typeof Q.stack=="string")return[Q.stack,K.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var b=h.DetermineComponentFrameRoot(),S=b[0],A=b[1];if(S&&A){var N=S.split(`
@@ -14,7 +14,7 @@ Error generating stack: `+h.message+`
14
14
  `);for(const i of t){const[o,...s]=i.split(":"),r=s.join(":").trim();switch(o?.trim()?.toLowerCase()){case"version":e.version=r;break;case"url":e.url=r;break;case"method":e.method=r;break;case"timestamp":e.timestamp=r;break}}}function hU(n){const e={},t=n.split(`
15
15
  `);for(const i of t){const o=i.indexOf(":");if(o>0){const s=i.slice(0,o).trim(),r=i.slice(o+1).trim();s&&(e[s]=r)}}return e}function fU(n,e){const t=n.split(`
16
16
  `);let i=!1;const o=[];for(const s of t){if(s.startsWith("Status:")){const c=s.replace("Status:","").trim().split(/\s+/);e.statusCode=parseInt(c[0],10)||0,e.statusText=c.slice(1).join(" ")||yU(e.statusCode);continue}if(s.trim()===""&&!i){i=!0;continue}if(i)o.push(s);else{const r=s.indexOf(":");if(r>0){const c=s.slice(0,r).trim(),u=s.slice(r+1).trim();c&&(e.responseHeaders[c]=u)}}}e.responseBody=o.join(`
17
- `).trim()}function pU(n){const e=n.url.match(/\/api\/provider\/([^/]+)/);e&&(n.provider=e[1]);const t=n.url.match(/\/api\/provider\/[^/]+\/(.+?)(?:\?|$)/);t&&(n.endpoint=t[1]),n.isClientError=n.statusCode>=400&&n.statusCode<500,n.isServerError=n.statusCode>=500,n.statusCode===429?n.errorType="rate_limit":n.statusCode===401||n.statusCode===403?n.errorType="auth":n.statusCode===404?n.errorType="not_found":n.statusCode>=500?n.errorType="server":(n.statusCode===408||n.statusCode===504)&&(n.errorType="timeout"),mU(n),n.statusCode===429&&gU(n)}function mU(n){if(n.requestBody)try{const e=JSON.parse(n.requestBody);typeof e.model=="string"&&(n.model=e.model)}catch{}}function gU(n){if(n.responseBody)try{const e=JSON.parse(n.responseBody),t=py(e);t!==null&&(n.quotaResetDelay=t);const i=my(e);i&&(n.quotaResetTimestamp=i)}catch{}}function py(n){if(typeof n!="object"||n===null)return null;const e=n;if("quotaResetDelay"in e){const t=e.quotaResetDelay;if(typeof t=="number")return t;if(typeof t=="string"){const i=t.match(/^(\d+)s?$/);if(i)return parseInt(i[1],10)}}if("error"in e&&typeof e.error=="object"){const t=py(e.error);if(t!==null)return t}if("details"in e&&Array.isArray(e.details))for(const t of e.details){const i=py(t);if(i!==null)return i}return null}function my(n){if(typeof n!="object"||n===null)return null;const e=n;for(const t of["quotaResetTimeStamp","quotaResetTimestamp","resetTime","reset_time"])if(t in e&&typeof e[t]=="string")return e[t];if("error"in e&&typeof e.error=="object"){const t=my(e.error);if(t)return t}if("details"in e&&Array.isArray(e.details))for(const t of e.details){const i=my(t);if(i)return i}return null}function yU(n){return{400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",408:"Request Timeout",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout"}[n]||""}function bU(n,e){const t=wb(),i=Date.now(),o=n*1e3,s=i-o,r=Math.floor(s/1e3),c=Math.floor(r/60),u=Math.floor(c/60),f=Math.floor(u/24);if(r<60){const g=t==="zh-CN",v=t==="vi";return g?"刚刚":v?"vừa xong":"just now"}if(c<60){const g=t==="zh-CN",v=t==="vi";return g?`${c} 分钟前`:v?`${c} phút trước`:`${c}m ago`}if(u<24){const g=t==="zh-CN",v=t==="vi";return g?`${u} 小时前`:v?`${u} giờ trước`:`${u}h ago`}if(f<7){const g=t==="zh-CN",v=t==="vi";return g?`${f} 天前`:v?`${f} ngày trước`:`${f}d ago`}return new Date(o).toLocaleDateString(t,{month:"short",day:"numeric"})}function vU(n){return n>=500?"text-red-500":n===429?"text-orange-500":n>=400?"text-yellow-500":"text-gray-500"}function xU(n,e){const t=wb();return t==="zh-CN"?{rate_limit:"限流",auth:"认证错误",not_found:"未找到",server:"服务错误",timeout:"超时",unknown:"错误"}[n]||"错误":t==="vi"?{rate_limit:"Quá giới hạn",auth:"Lỗi xác thực",not_found:"Không tìm thấy",server:"Lỗi máy chủ",timeout:"Hết thời gian chờ",unknown:"Lỗi"}[n]||"Lỗi":{rate_limit:"Rate Limited",auth:"Auth Error",not_found:"Not Found",server:"Server Error",timeout:"Timeout",unknown:"Error"}[n]||"Error"}function CU(n){if(n===null||n<=0)return null;if(n<60)return`${n}s`;if(n<3600)return`${Math.floor(n/60)}m`;const e=Math.floor(n/3600),t=Math.floor(n%3600/60);return t>0?`${e}h ${t}m`:`${e}h`}function SU(n,e){if(!n)return null;const t=wb(),i=t==="zh-CN",o=t==="vi";try{const s=new Date(n),r=new Date,c=s.getTime()-r.getTime();if(c<=0)return i?"现在":o?"bây giờ":"now";const u=Math.floor(c/1e3);if(u<60)return i?`${u}秒`:o?`${u} giây`:`${u}s`;if(u<3600){const g=Math.floor(u/60);return i?`${g}分钟`:o?`${g} phút`:`${g}m`}const f=Math.floor(u/3600),m=Math.floor(u%3600/60);return i?m>0?`${f}小时 ${m}分钟`:`${f}小时`:o?m>0?`${f} giờ ${m} phút`:`${f} giờ`:m>0?`${f}h ${m}m`:`${f}h`}catch{return null}}function kU(n){return n?n===429?"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400":n>=500?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":n>=400?"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400":"bg-gray-100 text-gray-600":"bg-gray-100 text-gray-600"}function wU(n){return n||""}function PU({name:n,size:e,modified:t,isSelected:i,onClick:o,statusCode:s,model:r}){const c=w.useMemo(()=>cU(n),[n]),u=w.useMemo(()=>wU(r),[r]);return p.jsxs("button",{onClick:o,className:q("w-full px-2.5 py-2 flex items-center gap-2 text-left transition-colors","hover:bg-muted/40 border-l-[3px]",i?"bg-muted/50 border-l-red-500":"border-l-transparent"),children:[p.jsx("span",{className:q("shrink-0 text-[10px] font-bold px-1.5 py-0.5 rounded min-w-[32px] text-center",kU(s)),children:s||"???"}),p.jsx(Vb,{provider:c.provider,size:18,withBackground:!0,className:"shrink-0"}),p.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[p.jsx("span",{className:"text-[11px] font-medium text-foreground truncate",children:c.endpoint||"unknown"}),u&&p.jsx("span",{className:"text-[10px] text-muted-foreground truncate",title:u,children:u}),p.jsxs("div",{className:"flex items-center gap-1 text-[9px] text-muted-foreground/60",children:[p.jsx(Ir,{className:"w-2.5 h-2.5"}),p.jsx("span",{children:bU(t)})]})]})]})}function aw({value:n,className:e,variant:t="outline",size:i="icon",label:o="Copy to clipboard"}){const[s,r]=w.useState(!1),c=()=>{navigator.clipboard.writeText(n),r(!0),setTimeout(()=>r(!1),2e3)};return p.jsx(ms,{children:p.jsxs($i,{children:[p.jsx(Xi,{asChild:!0,children:p.jsxs(ft,{size:i,variant:t,className:q("relative z-10 text-muted-foreground hover:text-foreground",e),onClick:u=>{u.stopPropagation(),c()},children:[s?p.jsx(Er,{className:"h-3.5 w-3.5 text-green-500"}):p.jsx(hh,{className:"h-3.5 w-3.5"}),p.jsx("span",{className:"sr-only",children:o})]})}),p.jsx(Ji,{children:p.jsx("p",{children:s?"Copied!":o})})]})})}function Gl({active:n,onClick:e,children:t,icon:i}){return p.jsxs("button",{onClick:e,className:q("px-2.5 py-1.5 text-xs font-medium rounded transition-colors flex items-center gap-1.5",n?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[i&&p.jsx(i,{className:"w-3.5 h-3.5"}),t]})}function PD({code:n}){const e=vU(n);return p.jsx("span",{className:q("inline-flex items-center justify-center min-w-[36px] px-2 py-0.5 rounded text-xs font-bold","bg-current/10 border border-current/20",e),children:n})}function AU({parsed:n}){const{t:e}=ve(),t=CU(n.quotaResetDelay)||SU(n.quotaResetTimestamp),i=e("errorLogs.na");return p.jsx(Kr,{className:"h-full",children:p.jsxs("div",{className:"p-4 space-y-4",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(PD,{code:n.statusCode}),p.jsx("span",{className:"text-sm font-medium",children:n.statusText}),p.jsx("span",{className:"text-xs text-muted-foreground px-2 py-0.5 rounded bg-muted/50",children:xU(n.errorType)})]}),n.model&&p.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-violet-500/10 border border-violet-500/20",children:[p.jsx(_E,{className:"w-4 h-4 text-violet-500 shrink-0"}),p.jsxs("div",{className:"text-sm",children:[p.jsx("span",{className:"text-muted-foreground",children:e("errorLogs.modelLabel")}),p.jsx("span",{className:"font-semibold text-violet-600 dark:text-violet-400",children:n.model})]})]}),n.errorType==="rate_limit"&&t&&p.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[p.jsx(Ir,{className:"w-4 h-4 text-amber-500 shrink-0"}),p.jsxs("div",{className:"text-sm",children:[p.jsx("span",{className:"text-muted-foreground",children:e("errorLogs.quotaResetsIn")}),p.jsx("span",{className:"font-semibold text-amber-600 dark:text-amber-400",children:t})]})]}),p.jsxs("div",{className:"grid grid-cols-4 gap-3 text-xs",children:[p.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[p.jsx("div",{className:"text-muted-foreground mb-1",children:e("errorLogs.method")}),p.jsx("div",{className:"font-medium",children:n.method||i})]}),p.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[p.jsx("div",{className:"text-muted-foreground mb-1",children:e("errorLogs.provider")}),p.jsx("div",{className:"font-medium",children:n.provider||i})]}),p.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[p.jsx("div",{className:"text-muted-foreground mb-1",children:e("errorLogs.version")}),p.jsx("div",{className:"font-medium",children:n.version||i})]}),p.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[p.jsx("div",{className:"text-muted-foreground mb-1",children:e("errorLogs.endpoint")}),p.jsx("div",{className:"font-medium truncate",title:n.endpoint,children:n.endpoint||i})]})]}),p.jsxs("div",{className:"text-xs",children:[p.jsx("div",{className:"text-muted-foreground mb-1.5",children:e("errorLogs.url")}),p.jsx("div",{className:"font-mono p-2.5 rounded bg-muted/30 border border-border/50 break-all leading-relaxed",children:n.url||i})]}),p.jsxs("div",{className:"text-xs",children:[p.jsx("div",{className:"text-muted-foreground mb-1.5",children:e("errorLogs.timestamp")}),p.jsx("div",{className:"font-mono",children:n.timestamp||i})]}),n.errorType!=="unknown"&&p.jsxs("div",{className:q("flex items-start gap-3 p-3 rounded text-xs",n.errorType==="rate_limit"?"bg-amber-500/10 border border-amber-500/20":n.errorType==="auth"?"bg-red-500/10 border border-red-500/20":"bg-blue-500/10 border border-blue-500/20"),children:[n.errorType==="rate_limit"?p.jsx(wi,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}):n.errorType==="auth"?p.jsx(wi,{className:"w-4 h-4 mt-0.5 text-red-500 shrink-0"}):p.jsx($h,{className:"w-4 h-4 mt-0.5 text-blue-500 shrink-0"}),p.jsxs("div",{className:q("leading-relaxed",n.errorType==="rate_limit"?"text-amber-600 dark:text-amber-400":n.errorType==="auth"?"text-red-600 dark:text-red-400":"text-blue-600 dark:text-blue-400"),children:[n.errorType==="rate_limit"&&(n.model?e("errorLogs.rateLimitedMsg",{model:n.model}):e("errorLogs.rateLimitedMsgNoModel")),n.errorType==="auth"&&e("errorLogs.authFailedMsg"),n.errorType==="not_found"&&e("errorLogs.notFoundMsg"),n.errorType==="server"&&e("errorLogs.serverErrorMsg"),n.errorType==="timeout"&&e("errorLogs.timeoutMsg")]})]})]})})}function DU({headers:n}){const{t:e}=ve(),t=Object.entries(n);return t.length===0?p.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:e("errorLogs.noHeaders")}):p.jsx(Kr,{className:"h-full",children:p.jsx("div",{className:"p-4 space-y-1",children:t.map(([i,o])=>p.jsxs("div",{className:"flex gap-3 text-xs font-mono py-1.5 border-b border-border/30 last:border-0",children:[p.jsxs("span",{className:"text-muted-foreground shrink-0 min-w-[140px]",children:[i,":"]}),p.jsx("span",{className:"break-all",children:o})]},i))})})}function sw({content:n,label:e}){const{t}=ve();if(!n||n.trim()===""){const s=e==="Request"?"errorLogs.noRequestBody":"errorLogs.noResponseBody";return p.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:t(s)})}let i=n,o=!1;try{const s=JSON.parse(n);i=JSON.stringify(s,null,2),o=!0}catch{}return p.jsx(Kr,{className:"h-full",children:p.jsx("pre",{className:q("p-4 text-xs font-mono whitespace-pre-wrap break-all leading-relaxed",o?"text-emerald-700 dark:text-green-400":"text-zinc-700 dark:text-muted-foreground"),children:i})})}function OU({content:n}){return p.jsx(Kr,{className:"h-full",children:p.jsx("pre",{className:"p-4 text-xs font-mono text-zinc-700 dark:text-muted-foreground whitespace-pre-wrap break-all leading-relaxed",children:n})})}function TU({name:n,absolutePath:e}){const{t}=ve(),[i,o]=w.useState("overview"),{data:s,isLoading:r,error:c}=nH(n),u=w.useMemo(()=>s?dU(s):null,[s]);return n?r?p.jsxs("div",{className:"flex-1 p-6 space-y-3",children:[p.jsx(tt,{className:"h-5 w-full"}),p.jsx(tt,{className:"h-5 w-3/4"}),p.jsx(tt,{className:"h-5 w-5/6"}),p.jsx(tt,{className:"h-5 w-2/3"})]}):c||!s||!u?p.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:p.jsx("p",{className:"text-sm",children:t("errorLogs.failedLoadContent")})}):p.jsxs("div",{className:"flex-1 flex flex-col min-w-0 h-full",children:[p.jsxs("div",{className:"px-4 py-3 border-b border-border bg-muted/30 flex items-center justify-between gap-3 shrink-0",children:[p.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[p.jsx(PD,{code:u.statusCode}),p.jsxs("span",{className:"text-xs font-semibold truncate text-foreground",children:[u.provider,"/",u.endpoint||"unknown"]}),n&&p.jsx(aw,{value:e||n,label:t("errorLogs.copyAbsolutePath"),size:"icon-sm",className:"ml-1 text-muted-foreground hover:text-foreground opacity-50 hover:opacity-100 transition-opacity"})]}),p.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s&&p.jsx(aw,{value:s,label:t("errorLogs.copyRawContent"),variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground"}),p.jsx("span",{className:"text-[10px] text-muted-foreground font-mono bg-muted px-1.5 py-0.5 rounded border border-border/50",children:u.method})]})]}),p.jsxs("div",{className:"px-3 py-2 border-b border-border flex items-center gap-1 bg-muted/10 shrink-0 overflow-x-auto",children:[p.jsx(Gl,{active:i==="overview",onClick:()=>o("overview"),icon:$h,children:t("errorLogs.tabOverview")}),p.jsx(Gl,{active:i==="headers",onClick:()=>o("headers"),icon:FE,children:t("errorLogs.tabHeaders")}),p.jsx(Gl,{active:i==="request",onClick:()=>o("request"),icon:y1,children:t("errorLogs.tabRequest")}),p.jsx(Gl,{active:i==="response",onClick:()=>o("response"),icon:qE,children:t("errorLogs.tabResponse")}),p.jsx(Gl,{active:i==="raw",onClick:()=>o("raw"),icon:GE,children:t("errorLogs.tabRaw")})]}),p.jsxs("div",{className:"flex-1 overflow-hidden bg-card/30",children:[i==="overview"&&p.jsx(AU,{parsed:u}),i==="headers"&&p.jsx(DU,{headers:u.requestHeaders}),i==="request"&&p.jsx(sw,{content:u.requestBody,label:t("errorLogs.tabRequest")}),i==="response"&&p.jsx(sw,{content:u.responseBody,label:t("errorLogs.tabResponse")}),i==="raw"&&p.jsx(OU,{content:s})]})]}):p.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:p.jsxs("div",{className:"text-center space-y-3",children:[p.jsx(zE,{className:"w-10 h-10 mx-auto opacity-40"}),p.jsx("p",{className:"text-sm",children:t("errorLogs.selectLog")})]})})}function MU(){const{t:n}=ve(),{data:e,isLoading:t}=Q1(),{data:i,isLoading:o,error:s}=tH(e?.running??!1),[r,c]=w.useState(500),[u,f]=w.useState(!1),m=w.useRef(null),g=w.useRef(null),v=()=>{g.current&&(clearInterval(g.current),g.current=null)};w.useEffect(()=>{if(!u)return;const M=R=>{const I=m.current;if(!I)return;const _=I.getBoundingClientRect().top+window.scrollY,z=R.pageY-_;c(Math.max(300,z));const F=window.innerHeight-R.clientY,B=15;v(),F<50?g.current=setInterval(()=>{window.scrollBy(0,B)},16):R.clientY<50&&(g.current=setInterval(()=>{window.scrollBy(0,-B)},16))},L=()=>{f(!1),v(),document.body.style.cursor="default",document.body.style.userSelect="auto"};return document.addEventListener("mousemove",M),document.addEventListener("mouseup",L),document.body.style.cursor="row-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",L),document.body.style.cursor="default",document.body.style.userSelect="auto",v()}},[u]);const x=M=>{M.preventDefault(),f(!0)},C=w.useMemo(()=>i?.[0]?.name??null,[i]),[k,P]=w.useState(null),D=k??C,O=w.useMemo(()=>!D||!i?void 0:i.find(L=>L.name===D)?.absolutePath,[D,i]);if(t||!e?.running)return null;if(o)return p.jsxs("div",{className:"rounded-xl border border-border overflow-hidden font-mono text-sm bg-card/50 dark:bg-zinc-900/60 backdrop-blur-sm h-[500px]",children:[p.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[p.jsx(tt,{className:"h-4 w-32"}),p.jsx(tt,{className:"h-4 w-20"})]}),p.jsx("div",{className:"p-4 space-y-3",children:[1,2,3].map(M=>p.jsx(tt,{className:"h-12 w-full rounded-lg"},M))})]});if(!i||i.length===0)return null;const T=i.length;return p.jsxs("div",{ref:m,className:"rounded-xl border border-border overflow-hidden font-mono text-sm text-foreground bg-card/50 dark:bg-zinc-900/60 backdrop-blur-sm flex flex-col shadow-sm transition-[height] duration-0 ease-linear relative group/container",style:{height:r},children:[p.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-gradient-to-r from-amber-500/10 via-transparent to-transparent dark:from-amber-500/15 shrink-0",children:[p.jsxs("div",{className:"flex items-center gap-2.5",children:[p.jsx(wi,{className:"w-4 h-4 text-amber-500"}),p.jsx("span",{className:"text-sm font-semibold tracking-tight",children:n("errorLogs.title")}),p.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:n("errorLogs.failedRequests",{count:T})})]}),p.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[p.jsx(VE,{className:"w-3.5 h-3.5"}),p.jsx("span",{children:n("errorLogs.cliproxyDiagnostics")})]})]}),p.jsx("div",{className:"flex-1 min-h-0",children:p.jsxs(Yb,{direction:"horizontal",children:[p.jsx(kc,{defaultSize:30,minSize:20,maxSize:50,className:"flex flex-col min-w-0",children:p.jsxs(Kr,{className:"h-full",children:[p.jsx("div",{className:"divide-y divide-border/50",children:i.slice(0,50).map(M=>p.jsx(PU,{name:M.name,size:M.size,modified:M.modified,isSelected:D===M.name,onClick:()=>P(M.name),statusCode:M.statusCode,model:M.model},M.name))}),i.length>50&&p.jsx("div",{className:"px-3 py-3 text-center text-[10px] text-muted-foreground border-t border-border/50",children:n("errorLogs.showingCount",{total:i.length})})]})}),p.jsxs($b,{className:"w-[1px] bg-border hover:bg-primary/50 transition-colors flex items-center justify-center group relative z-10 w-2 -ml-1 flex items-center justify-center outline-none",children:[p.jsx("div",{className:"w-[1px] h-full bg-border group-hover:bg-primary/50 transition-colors"}),p.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-4 h-8 rounded-sm flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity bg-muted border border-border",children:p.jsx(Yh,{className:"h-4 w-4 text-muted-foreground"})})]}),p.jsx(kc,{className:"flex flex-col min-w-0 bg-background/50",children:p.jsx(TU,{name:D,absolutePath:O})})]})}),s?p.jsx("div",{className:"px-4 py-2 border-t border-border text-xs text-destructive bg-destructive/5 shrink-0",children:s.message}):p.jsx("div",{className:"h-2 bg-border/10 border-t border-border/30 hover:bg-primary/10 transition-colors cursor-row-resize flex items-center justify-center group/handle shrink-0",onMouseDown:x,children:p.jsx(KE,{className:"w-8 h-3 text-border group-hover:text-primary/50 transition-colors"})})]})}const RU=Xh("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",warning:"border-yellow-200 bg-yellow-50 text-yellow-900 dark:border-yellow-900/50 dark:bg-yellow-900/20 dark:text-yellow-200 [&>svg]:text-yellow-600 dark:[&>svg]:text-yellow-500",info:"border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-900/50 dark:bg-blue-900/20 dark:text-blue-200 [&>svg]:text-blue-600 dark:[&>svg]:text-blue-500",success:"border-green-200 bg-green-50 text-green-900 dark:border-green-900/50 dark:bg-green-900/20 dark:text-green-200 [&>svg]:text-green-600 dark:[&>svg]:text-green-500"}},defaultVariants:{variant:"default"}}),lc=w.forwardRef(({className:n,variant:e,...t},i)=>p.jsx("div",{ref:i,role:"alert",className:q(RU({variant:e}),n),...t}));lc.displayName="Alert";const bh=w.forwardRef(({className:n,...e},t)=>p.jsx("h5",{ref:t,className:q("mb-1 font-medium leading-none tracking-tight",n),...e}));bh.displayName="AlertTitle";const cc=w.forwardRef(({className:n,...e},t)=>p.jsx("div",{ref:t,className:q("text-sm [&_p]:leading-relaxed",n),...e}));cc.displayName="AlertDescription";function LU(){return Lt({queryKey:["overview"],queryFn:async()=>(await fetch("/api/overview")).json()})}function AD(n,e){return typeof n=="object"&&n!==null&&"error"in n&&typeof n.error=="string"?n.error:e}function DD(n){const e=n.trim();if(!e)return null;try{return JSON.parse(e)}catch{return null}}function NU(n){const e=n.trim().toLowerCase();return e.startsWith("<!doctype html")||e.startsWith("<html")}function EU(n){if(!n||typeof n!="object")return!1;const e=n;return!(typeof e.content!="string"||"contentPath"in e&&typeof e.contentPath!="string")}async function OD(n,e){const t=await n.text(),i=DD(t);if(!n.ok){const o=AD(i,e);throw new Error(o)}if(i===null)throw new Error(e);return i}function IU(){return Lt({queryKey:["shared","summary"],queryFn:async()=>{const n=await fetch("/api/shared/summary");return OD(n,"Failed to fetch shared summary")}})}function U9(n){return Lt({queryKey:["shared",n],enabled:n!=="settings",queryFn:async()=>{if(n==="settings")return{items:[]};const e=await fetch(`/api/shared/${n}`);return OD(e,`Failed to fetch shared ${n}`)}})}function _9(n,e){return Lt({queryKey:["shared",n,"content",e],enabled:typeof e=="string"&&e.length>0,queryFn:async()=>{if(!e)throw new Error("Missing shared item path");const t=new URLSearchParams({type:n,path:e}),i=await fetch(`/api/shared/content?${t.toString()}`),o=await i.text(),s=DD(o);if(!i.ok)throw new Error(AD(s,`Failed to fetch shared ${n} content`));if(EU(s))return{content:s.content,contentPath:typeof s.contentPath=="string"&&s.contentPath.length>0?s.contentPath:e};if(o.trim().length>0){if(NU(o))throw new Error("Shared content endpoint unavailable. Restart `ccs config` and try again.");return{content:o,contentPath:e}}throw new Error(`Failed to fetch shared ${n} content`)}})}const jU={ok:"success",warning:"warning",error:"error"},BU={default:{iconBg:"bg-muted",iconColor:"text-muted-foreground"},success:{iconBg:"bg-green-600/15",iconColor:"text-green-700 dark:text-green-500"},warning:{iconBg:"bg-amber-500/15",iconColor:"text-amber-700 dark:text-amber-400"},error:{iconBg:"bg-red-600/15",iconColor:"text-red-700 dark:text-red-500"},accent:{iconBg:"bg-accent/15",iconColor:"text-accent"}};function Du({title:n,value:e,icon:t,variant:i="default",onClick:o}){const s=BU[i];return p.jsxs("button",{onClick:o,className:q("flex items-center gap-3 px-4 py-2.5 rounded-lg border bg-card/50","transition-all hover:bg-card hover:shadow-sm hover:-translate-y-0.5","active:scale-[0.98]"),children:[p.jsx("div",{className:q("flex items-center justify-center w-9 h-9 rounded-md",s.iconBg),children:p.jsx(t,{className:q("w-4 h-4",s.iconColor)})}),p.jsxs("div",{className:"text-left",children:[p.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:n}),p.jsx("p",{className:q("text-lg font-bold font-mono leading-tight",s.iconColor),children:e})]})]})}function HU(){const{t:n}=ve(),e=vb(),{data:t,isLoading:i}=LU(),{data:o,isLoading:s}=IU();if(i||s)return p.jsxs("div",{className:"p-6 space-y-6",children:[p.jsxs("div",{className:"rounded-xl border p-6 flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsx(tt,{className:"h-12 w-12 rounded-lg"}),p.jsxs("div",{children:[p.jsx(tt,{className:"h-7 w-[180px] mb-2"}),p.jsx(tt,{className:"h-4 w-[220px]"})]})]}),p.jsx("div",{className:"flex items-center gap-3",children:[1,2,3,4].map(c=>p.jsx(tt,{className:"h-14 w-28 rounded-lg"},c))})]}),p.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[p.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center justify-between",children:[p.jsx(tt,{className:"h-4 w-32"}),p.jsx(tt,{className:"h-4 w-20"})]}),p.jsx("div",{className:"px-4 py-3 border-b",children:p.jsx(tt,{className:"h-2 w-full rounded-full"})}),[1,2,3].map(c=>p.jsxs("div",{className:"px-4 py-2.5 flex items-center gap-3 border-b last:border-b-0",children:[p.jsx(tt,{className:"w-2.5 h-2.5 rounded-full"}),p.jsx(tt,{className:"h-4 flex-1"}),p.jsx(tt,{className:"h-1.5 w-24 rounded-full"}),p.jsx(tt,{className:"h-4 w-16"})]},c))]})]});const r=t?.health?jU[t.health.status]:void 0;return p.jsxs("div",{className:"p-6 space-y-6",children:[p.jsxs("div",{className:"relative overflow-hidden rounded-xl border bg-gradient-to-br from-background via-background to-muted/30",children:[p.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",children:p.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"24px 24px"}})}),p.jsxs("div",{className:"relative p-6 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[p.jsx(g5,{version:t?.version}),p.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[p.jsx(Du,{title:n("home.profiles"),value:t?.profiles??0,icon:iy,variant:"accent",onClick:()=>e("/providers")}),p.jsx(Du,{title:n("home.cliproxy"),value:t?.cliproxy??0,icon:s1,variant:"accent",onClick:()=>e("/cliproxy")}),p.jsx(Du,{title:n("home.accounts"),value:t?.accounts??0,icon:l1,variant:"default",onClick:()=>e("/accounts")}),p.jsx(Du,{title:n("home.health"),value:t?.health?`${t.health.passed}/${t.health.total}`:"-",icon:vc,variant:r,onClick:()=>e("/health")})]})]})]}),o?.symlinkStatus&&!o.symlinkStatus.valid&&p.jsxs(lc,{variant:"warning",children:[p.jsx(wi,{className:"h-4 w-4"}),p.jsx(bh,{children:n("home.configurationRequired")}),p.jsx(cc,{children:o.symlinkStatus.message})]}),p.jsx(EH,{}),p.jsx("div",{className:"rounded-xl border bg-card/70 p-5",children:p.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("div",{className:"rounded-xl bg-muted p-2.5",children:p.jsx(d1,{className:"h-5 w-5 text-muted-foreground"})}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("h2",{className:"text-lg font-semibold",children:n("homePageV2.logsMoved")}),p.jsx("p",{className:"max-w-2xl text-sm text-muted-foreground",children:"Use the unified logs page for source-level filtering, structured entry inspection, and retention policy edits without crowding the home dashboard."})]})]}),p.jsxs(ft,{variant:"outline",className:"gap-2",onClick:()=>e("/logs"),children:["Open logs",p.jsx(WE,{className:"h-4 w-4"})]})]})}),p.jsx(MU,{})]})}const TD=aE,Xb=w.forwardRef(({className:n,...e},t)=>p.jsx(ZA,{ref:t,className:q("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",n),...e}));Xb.displayName=ZA.displayName;const vh=w.forwardRef(({className:n,...e},t)=>p.jsx(e1,{ref:t,className:q("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",n),...e}));vh.displayName=e1.displayName;const gy=w.forwardRef(({className:n,...e},t)=>p.jsx(t1,{ref:t,className:q("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",n),...e}));gy.displayName=t1.displayName;function yn({className:n,...e}){return p.jsx(sE,{"data-slot":"label",className:q("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",n),...e})}const Jb="ccs:openrouter-models",UU=1440*60*1e3,MD="1";function yy(n){const e=parseFloat(n);return isNaN(e)||e===0?0:e*1e6}function rw(n){const e=yy(n);return e===0?re.t("openrouterUtils.priceFree"):e<.01?re.t("openrouterUtils.priceLessThanCent"):e<1?`$${e.toFixed(2)}`:`$${e.toFixed(e<10?2:0)}`}function _U(n){const e=rw(n.prompt),t=rw(n.completion);return e===re.t("openrouterUtils.priceFree")&&t===re.t("openrouterUtils.priceFree")?re.t("openrouterUtils.priceFree"):`${e}/${t}`}function zU(n){const e=n.id.toLowerCase();return e.startsWith("anthropic/")?"anthropic":e.startsWith("openai/")?"openai":e.startsWith("google/")?"google":e.startsWith("meta-llama/")||e.startsWith("meta/")?"meta":e.startsWith("mistralai/")?"mistral":e.includes(":free")||e.includes("qwen")||e.includes("deepseek")?"opensource":"other"}function FU(n){return{...n,category:zU(n),pricePerMillionPrompt:yy(n.pricing.prompt),pricePerMillionCompletion:yy(n.pricing.completion),isFree:n.pricing.prompt==="0"&&n.pricing.completion==="0",isExacto:n.id.includes(":exacto")}}function qU(n,e,t){const i=e.toLowerCase().trim();return n.filter(o=>t?.category&&o.category!==t.category||t?.freeOnly&&!o.isFree||t?.minContext&&o.context_length<t.minContext?!1:i?o.id.toLowerCase().includes(i)||o.name.toLowerCase().includes(i)||o.description?.toLowerCase().includes(i):!0)}function z9(n){return[...n].sort((e,t)=>{if(e.isFree&&!t.isFree)return-1;if(!e.isFree&&t.isFree)return 1;if(!e.isFree&&!t.isFree){if(e.isExacto&&!t.isExacto)return-1;if(!e.isExacto&&t.isExacto)return 1}return e.name.localeCompare(t.name)})}function GU(){try{const n=localStorage.getItem(Jb);if(!n)return null;const e=JSON.parse(n);return e.version!==MD||Date.now()-e.fetchedAt>UU?null:e.models}catch{return null}}function VU(n){try{localStorage.setItem(Jb,JSON.stringify({models:n,fetchedAt:Date.now(),version:MD}))}catch{}}function KU(){localStorage.removeItem(Jb)}function F9(n,e){const[t]=n.split("/");if(!t)return{};const i=e.filter(r=>r.id.startsWith(`${t}/`));if(i.length===0)return{};const o=[...i].sort((r,c)=>c.pricePerMillionPrompt-r.pricePerMillionPrompt),s=Math.ceil(o.length/3);return{opus:o[0]?.id,sonnet:o[Math.min(s,o.length-1)]?.id,haiku:o[o.length-1]?.id}}function WU(n){return n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${Math.round(n/1e3)}K`:String(n)}const q9={anthropic:"Anthropic (Claude)",openai:"OpenAI (GPT)",google:"Google (Gemini)",meta:"Meta (Llama)",mistral:"Mistral",opensource:"Open Source",other:"Other"},QU={anthropic:["anthropic/"],openai:["openai/"],google:["google/"],meta:["meta-llama/","meta/"],mistral:["mistralai/"],opensource:["deepseek/","qwen/","cohere/"],other:[]};function YU(n,e=2){const t=[],i=["anthropic","openai","google","meta","mistral","opensource"];for(const o of i){const s=QU[o];if(s.length===0)continue;const c=[...n.filter(u=>s.some(f=>u.id.toLowerCase().startsWith(f)))].sort((u,f)=>(f.created??0)-(u.created??0));t.push(...c.slice(0,e))}return t.sort((o,s)=>(s.created??0)-(o.created??0))}function $U(n){const t=Date.now()/1e3-n;return t<86400?re.t("openrouterUtils.ageToday"):t<172800?re.t("openrouterUtils.ageYesterday"):t<604800?re.t("openrouterUtils.ageDaysAgo",{count:Math.floor(t/86400)}):t<2592e3?re.t("openrouterUtils.ageWeeksAgo",{count:Math.floor(t/604800)}):t<31536e3?re.t("openrouterUtils.ageMonthsAgo",{count:Math.floor(t/2592e3)}):re.t("openrouterUtils.ageYearsAgo",{count:Math.floor(t/31536e3)})}const XU="https://openrouter.ai/api/v1/models",RD=["openrouter-models"],lw=1440*60*1e3;async function JU(){const n=await fetch(XU);if(!n.ok)throw new Error(`Failed to fetch OpenRouter models: ${n.status}`);const t=(await n.json()).data;return VU(t),t}function LD(){return Lt({queryKey:RD,queryFn:JU,staleTime:lw,gcTime:lw,initialData:()=>GU()??void 0,refetchOnWindowFocus:!1})}function ZU(){const n=LD(),e=(n.data??[]).map(FU);return{...n,models:e}}function G9(){const n=mt();return()=>(KU(),n.invalidateQueries({queryKey:RD}))}function V9(){const{data:n,isLoading:e,isError:t}=LD();return{isReady:!!n&&n.length>0,isLoading:e,isError:t,modelCount:n?.length??0}}function Zb({profileEnv:n={}}){const{t:e}=ve(),[t,i]=w.useState(null),[o,s]=w.useState(!0),[r,c]=w.useState(!1);w.useEffect(()=>{u()},[]);const u=async()=>{try{s(!0);const x=await fetch("/api/global-env");if(!x.ok)throw new Error("Failed to load");const C=await x.json();i(C)}catch{i(null)}finally{s(!1)}};if(o||!t?.enabled)return null;const f=t.env||{},m=Object.keys(f);if(m.length===0)return null;const g=m.filter(x=>!(x in n)),v=m.filter(x=>x in n);return p.jsxs("div",{className:"border-t bg-muted/20",children:[p.jsxs("button",{onClick:()=>c(!r),className:"w-full px-4 py-2 flex items-center gap-2 hover:bg-muted/30 transition-colors",children:[p.jsx($h,{className:"w-4 h-4 text-blue-500"}),p.jsxs("span",{className:"text-xs text-muted-foreground flex-1 text-left",children:[e("globalEnvIndicator.injectedCount",{count:g.length}),v.length>0&&p.jsx("span",{className:"text-amber-600 dark:text-amber-400 ml-1",children:e("globalEnvIndicator.overriddenCount",{count:v.length})})]}),r?p.jsx(Cb,{className:"w-4 h-4 text-muted-foreground"}):p.jsx(Qh,{className:"w-4 h-4 text-muted-foreground"})]}),r&&p.jsxs("div",{className:"px-4 pb-3 space-y-2",children:[g.length>0&&p.jsx("div",{className:"space-y-1",children:g.map(x=>p.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono bg-green-500/10 text-green-700 dark:text-green-400 px-2 py-1 rounded",children:[p.jsx("span",{className:"text-green-500",children:"+"}),p.jsxs("span",{className:"truncate",children:[x,"=",f[x]]})]},x))}),v.length>0&&p.jsxs("div",{className:"space-y-1",children:[p.jsx("p",{className:"text-xs text-muted-foreground",children:e("globalEnvIndicator.skippedLabel")}),v.map(x=>p.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono bg-amber-500/10 text-amber-700 dark:text-amber-400 px-2 py-1 rounded",children:[p.jsx("span",{className:"text-amber-500",children:"~"}),p.jsx("span",{className:"truncate",children:x})]},x))]}),p.jsx("div",{className:"pt-2 border-t border-border/50",children:p.jsx(ft,{variant:"ghost",size:"sm",asChild:!0,className:"h-7 text-xs gap-1.5 -ml-2",children:p.jsxs(uh,{to:"/settings?tab=globalenv",children:[p.jsx(kb,{className:"w-3.5 h-3.5"}),e("globalEnvIndicator.configureInSettings"),p.jsx(f1,{className:"w-3 h-3 opacity-50"})]})})})]})]})}function e_({className:n,...e}){return p.jsx(rE,{"data-slot":"switch",className:q("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",n),...e,children:p.jsx(lE,{"data-slot":"switch-thumb",className:q("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}function t_(n,e,t){return n(t==="refreshing"?"imageAnalysisStatus.refreshingPreview":t==="invalid"?"imageAnalysisStatus.savedStatus":e==="editor"?"imageAnalysisStatus.livePreview":"imageAnalysisStatus.savedStatus")}function n_(n,e,t){return e.status==="disabled"?n("imageAnalysisStatus.disabledGlobally"):t!=="claude"?n("imageAnalysisStatus.targetBypassesHook",{target:n(`imageAnalysisStatus.targetLabel.${t}`)}):e.nativeReadPreference?n("imageAnalysisStatus.nativeImageReading"):e.status==="hook-missing"?n("imageAnalysisStatus.setupNeeded"):e.authReadiness==="missing"?n("imageAnalysisStatus.needsAuth"):e.proxyReadiness==="unavailable"?n("imageAnalysisStatus.needsProxy"):e.effectiveRuntimeMode==="native-read"?n("imageAnalysisStatus.nativeFallback"):n("imageAnalysisStatus.transformerReady")}function i_(n,e,t){return e.status==="disabled"?{label:n("imageAnalysisStatus.badgeDisabled"),className:"border-border/80 bg-background/85 text-muted-foreground"}:t!=="claude"?{label:n("imageAnalysisStatus.badgeBypassed"),className:"border-sky-500/25 bg-sky-500/10 text-sky-800 dark:text-sky-200"}:e.nativeReadPreference?{label:n("imageAnalysisStatus.badgeNative"),className:"border-emerald-500/25 bg-emerald-500/10 text-emerald-800 dark:text-emerald-200"}:e.status==="hook-missing"||e.authReadiness==="missing"?{label:e.status==="hook-missing"?n("imageAnalysisStatus.badgeSetup"):n("imageAnalysisStatus.badgeAuth"),className:"border-amber-500/25 bg-amber-500/10 text-amber-800 dark:text-amber-200"}:e.proxyReadiness==="unavailable"?{label:n("imageAnalysisStatus.badgeProxy"),className:"border-amber-500/25 bg-amber-500/10 text-amber-800 dark:text-amber-200"}:{label:n("imageAnalysisStatus.badgeReady"),className:"border-emerald-500/25 bg-emerald-500/10 text-emerald-800 dark:text-emerald-200"}}function o_(n,e,t){if(e.nativeReadPreference)return e.profileModel&&e.nativeImageCapable?n("imageAnalysisStatus.toggleSummaryNativeCapable",{model:e.profileModel}):e.profileModel?n("imageAnalysisStatus.toggleSummaryNativeModel",{model:e.profileModel}):n("imageAnalysisStatus.toggleSummaryNativeDefault");if(!e.backendDisplayName&&t==="claude")return n("imageAnalysisStatus.toggleSummaryNativeFileAccess");if(!e.backendDisplayName)return n("imageAnalysisStatus.toggleSummaryInactiveTarget",{target:n(`imageAnalysisStatus.targetLabel.${t}`)});const i=e.model?` · ${e.model}`:"";return n("imageAnalysisStatus.toggleSummaryTransformerRoute",{backend:e.backendDisplayName,modelSuffix:i})}function a_(n,e,t){return e.status==="disabled"?n("imageAnalysisStatus.noteDisabledGlobally"):t!=="claude"?n("imageAnalysisStatus.noteTargetBypassesHook",{target:n(`imageAnalysisStatus.targetLabel.${t}`)}):e.nativeReadPreference?e.nativeImageCapable===!0?null:e.nativeImageReason:e.status==="hook-missing"?n("imageAnalysisStatus.notePersistHook"):e.authReadiness==="missing"?e.authReason:e.proxyReadiness==="unavailable"?e.proxyReason:null}function s_({status:n,target:e="claude",source:t="saved",previewState:i="saved",nativeReadPreferenceOverride:o,onToggleNativeRead:s}){const{t:r}=ve();if(!n)return p.jsxs("div",{className:"rounded-2xl border bg-muted/20 px-4 py-3","aria-live":"polite",children:[p.jsx("div",{className:"h-4 w-24 animate-pulse rounded bg-muted"}),p.jsx("div",{className:"mt-2 h-3 w-52 animate-pulse rounded bg-muted"})]});const c=o??n.nativeReadPreference,u={...n,nativeReadPreference:c},f=i_(r,u,e),m=a_(r,u,e),g=n.nativeImageCapable?r("imageAnalysisStatus.capabilityVerified"):n.profileModel?r("imageAnalysisStatus.capabilityUnknown"):null;return p.jsxs("section",{className:"rounded-2xl border bg-background/95 px-4 py-3 shadow-sm",children:[p.jsxs("div",{className:"flex items-start justify-between gap-3",children:[p.jsx("div",{className:"min-w-0",children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:"inline-flex h-8 w-8 items-center justify-center rounded-xl border border-sky-500/20 bg-sky-500/10 text-sky-700 dark:text-sky-300",children:p.jsx(b1,{className:"h-4 w-4"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx("h3",{className:"text-sm font-semibold",children:r("imageAnalysisStatus.sectionTitle")}),p.jsx(Qt,{className:q("h-5 border px-1.5 text-[10px]",f.className),children:f.label})]}),p.jsxs("p",{className:"text-xs text-muted-foreground",children:[t_(r,t,i)," ·"," ",n_(r,u,e)]})]})]})}),p.jsx(ft,{size:"sm",variant:"outline",className:"h-8 shrink-0",asChild:!0,children:p.jsxs(uh,{to:"/settings?tab=image",children:[r("imageAnalysisStatus.openSettings"),p.jsx(y1,{className:"ml-1 h-3.5 w-3.5"})]})})]}),p.jsx("div",{className:"mt-3 rounded-xl border bg-muted/15 px-3 py-3",children:p.jsxs("div",{className:"flex items-start justify-between gap-3",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx("div",{className:"text-sm font-medium text-foreground",children:r("imageAnalysisStatus.useNativeImageReading")}),g&&p.jsx(Qt,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:g})]}),p.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:o_(r,u,e)})]}),p.jsx(e_,{checked:c,onCheckedChange:s,disabled:!s,"aria-label":r("imageAnalysisStatus.useNativeImageReading")})]})}),m&&p.jsx("div",{className:"mt-2 rounded-lg border border-border/70 bg-muted/20 px-3 py-2 text-xs leading-5 text-muted-foreground",children:m})]})}const r_=w.lazy(()=>lt(()=>Promise.resolve().then(()=>Lf),void 0).then(n=>({default:n.CodeEditor})));function K9({rawJsonContent:n,isRawJsonValid:e,rawJsonEdits:t,settings:i,profileTarget:o="claude",imageAnalysisStatus:s,imageAnalysisStatusSource:r="saved",imageAnalysisStatusPreviewState:c="saved",nativeReadPreferenceOverride:u,onToggleNativeRead:f,onChange:m,missingRequiredFields:g=[]}){const{t:v}=ve(),x=g.length>0;return p.jsx(w.Suspense,{fallback:p.jsxs("div",{className:"flex items-center justify-center h-full",children:[p.jsx(hi,{className:"w-6 h-6 animate-spin text-muted-foreground"}),p.jsx("span",{className:"ml-2 text-muted-foreground",children:v("profileEditorSections.loadingEditor")})]}),children:p.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!e&&t!==null&&p.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[p.jsx(Vr,{className:"w-4 h-4"}),v("profileEditor.invalidJson")]}),e&&x&&p.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[p.jsx(wi,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),p.jsxs("div",{children:[p.jsxs("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:[v("profileEditor.missingFields"),":"]})," ",p.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:g.join(", ")}),p.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:v("profileEditor.missingFieldsHint")})]})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:p.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:p.jsx(r_,{value:n,onChange:m,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),p.jsx("div",{className:"mx-6 mb-4",children:p.jsx(s_,{status:s,target:o,source:r,previewState:c,nativeReadPreferenceOverride:u,onToggleNativeRead:f})}),p.jsx("div",{className:"mx-6 mb-4",children:p.jsx("div",{className:"border rounded-md overflow-hidden",children:p.jsx(Zb,{profileEnv:i?.env})})})]})})}function cw(n,e){try{var t=n()}catch(i){return e(i)}return t&&t.then?t.then(void 0,e):t}function l_(n,e){for(var t={};n.length;){var i=n[0],o=i.code,s=i.message,r=i.path.join(".");if(!t[r])if("unionErrors"in i){var c=i.unionErrors[0].errors[0];t[r]={message:c.message,type:c.code}}else t[r]={message:s,type:o};if("unionErrors"in i&&i.unionErrors.forEach(function(m){return m.errors.forEach(function(g){return n.push(g)})}),e){var u=t[r].types,f=u&&u[i.code];t[r]=v1(r,e,t,o,f?[].concat(f,i.message):i.message)}n.shift()}return t}function c_(n,e){for(var t={};n.length;){var i=n[0],o=i.code,s=i.message,r=i.path.join(".");if(!t[r])if(i.code==="invalid_union"&&i.errors.length>0){var c=i.errors[0][0];t[r]={message:c.message,type:c.code}}else t[r]={message:s,type:o};if(i.code==="invalid_union"&&i.errors.forEach(function(m){return m.forEach(function(g){return n.push(g)})}),e){var u=t[r].types,f=u&&u[i.code];t[r]=v1(r,e,t,o,f?[].concat(f,i.message):i.message)}n.shift()}return t}function d_(n,e,t){if(t===void 0&&(t={}),(function(i){return"_def"in i&&typeof i._def=="object"&&"typeName"in i._def})(n))return function(i,o,s){try{return Promise.resolve(cw(function(){return Promise.resolve(n[t.mode==="sync"?"parse":"parseAsync"](i,e)).then(function(r){return s.shouldUseNativeValidation&&ok({},s),{errors:{},values:t.raw?Object.assign({},i):r}})},function(r){if((function(c){return Array.isArray(c?.issues)})(r))return{values:{},errors:ak(l_(r.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw r}))}catch(r){return Promise.reject(r)}};if((function(i){return"_zod"in i&&typeof i._zod=="object"})(n))return function(i,o,s){try{return Promise.resolve(cw(function(){return Promise.resolve((t.mode==="sync"?II:jI)(n,i,e)).then(function(r){return s.shouldUseNativeValidation&&ok({},s),{errors:{},values:t.raw?Object.assign({},i):r}})},function(r){if((function(c){return c instanceof BI})(r))return{values:{},errors:ak(c_(r.issues,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw r}))}catch(r){return Promise.reject(r)}};throw new Error("Invalid input: not a Zod schema")}const u_={sm:{container:"w-6 h-6",icon:"w-4 h-4",text:"text-xs"},md:{container:"w-8 h-8",icon:"w-5 h-5",text:"text-sm"},lg:{container:"w-12 h-12",icon:"w-8 h-8",text:"text-lg"}};function h_({provider:n,className:e,size:t="md"}){const i=zB(n),o=u_[t],s=F1(n),r=qB(n);return p.jsx("div",{className:q("flex items-center justify-center rounded-md",s&&!r&&(FB(n)?"bg-gray-900 p-1":"bg-white p-1"),o.container,e),children:s?p.jsx("img",{src:s,alt:`${n} logo`,className:q(r?o.container:o.icon,"object-contain")}):p.jsx("span",{className:q("font-semibold",i.textClass,o.text),children:i.letter})})}function W9(){return Lt({queryKey:["profiles"],queryFn:()=>je.profiles.list()})}function f_(){const n=mt(),{t:e}=ve();return rt({mutationFn:t=>je.profiles.create(t),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),fe.success(e("toasts.profileCreated"))},onError:t=>{fe.error(t.message)}})}function Q9(){const n=mt(),{t:e}=ve();return rt({mutationFn:t=>je.profiles.delete(t),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),fe.success(e("toasts.profileDeleted"))},onError:t=>{fe.error(t.message)}})}function Y9(){return rt({mutationFn:()=>je.profiles.discoverOrphans()})}function $9(){const n=mt(),{t:e}=ve();return rt({mutationFn:t=>je.profiles.registerOrphans(t),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),fe.success(e("toasts.orphanProfilesComplete"))}})}function X9(){const n=mt(),{t:e}=ve();return rt({mutationFn:({name:t,data:i})=>je.profiles.copy(t,i),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),fe.success(e("toasts.profileCopied"))}})}function J9(){return rt({mutationFn:({name:n,includeSecrets:e})=>je.profiles.export(n,e??!1)})}function Z9(){const n=mt(),{t:e}=ve();return rt({mutationFn:t=>je.profiles.import(t),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),fe.success(e("toasts.profileImported"))}})}const p_="https://openrouter.ai/api/v1",m_="https://api.orcarouter.ai/v1",ND=Object.freeze({glmt:"glm",kimi:"km",alibaba:"alibaba-coding-plan",acp:"alibaba-coding-plan",hf:"huggingface",te:"tuningengines",tuning:"tuningengines"}),ED=[{id:"openrouter",name:"OpenRouter",description:"349+ models from OpenAI, Anthropic, Google, Meta",baseUrl:p_,defaultProfileName:"openrouter",defaultModel:"anthropic/claude-opus-4.5",apiKeyPlaceholder:"sk-or-...",apiKeyHint:"Get your API key at openrouter.ai/keys",category:"recommended",requiresApiKey:!0,badge:"349+ models",featured:!0,icon:"/icons/openrouter.svg"},{id:"orcarouter",name:"OrcaRouter",description:"188+ models from OpenAI, Anthropic, Google, Meta via auto-routing gateway",baseUrl:m_,defaultProfileName:"orcarouter",defaultModel:"openai/gpt-5.5",apiKeyPlaceholder:"sk-orca-...",apiKeyHint:"Get your API key at orcarouter.ai/console",category:"recommended",requiresApiKey:!0,badge:"188+ models",featured:!0,icon:"/icons/orcarouter.svg"},{id:"alibaba-coding-plan",name:"Alibaba Coding Plan",description:"Alibaba Cloud Coding Plan via Anthropic-compatible endpoint",baseUrl:"https://coding-intl.dashscope.aliyuncs.com/apps/anthropic",defaultProfileName:"albb",defaultModel:"qwen3-coder-plus",apiKeyPlaceholder:"sk-sp-...",apiKeyHint:"Get your Coding Plan key from Alibaba Cloud Model Studio",category:"recommended",requiresApiKey:!0,badge:"Coding Plan",featured:!0,icon:"/assets/providers/alibabacloud-color.svg"},{id:"ollama",name:"Ollama (Local)",description:"Local open-source models via Ollama (32K+ context)",baseUrl:"http://localhost:11434",defaultProfileName:"ollama",defaultModel:"qwen3-coder",apiKeyPlaceholder:"ollama",apiKeyHint:"Install Ollama from ollama.com - no API key needed for local",category:"recommended",requiresApiKey:!1,badge:"Local",featured:!0,icon:"/icons/ollama.svg"},{id:"llamacpp",name:"llama.cpp (Local)",description:"Local inference via llama.cpp (LLaMA models)",baseUrl:"http://127.0.0.1:8080",defaultProfileName:"llamacpp",defaultModel:"llama3-8b",apiKeyPlaceholder:"llamacpp",apiKeyHint:"Run llama.cpp server: ./server --host 0.0.0.0 --port 8080 -m model.gguf",category:"recommended",requiresApiKey:!1,badge:"Local",featured:!0,icon:"/assets/providers/llama-cpp.svg"},{id:"anthropic",name:"Anthropic (Direct API)",description:"Use your own Anthropic API key (sk-ant-...)",baseUrl:"",defaultProfileName:"anthropic",defaultModel:"claude-sonnet-4-5-20250929",apiKeyPlaceholder:"sk-ant-api03-...",apiKeyHint:"Get key at console.anthropic.com/settings/keys",category:"recommended",requiresApiKey:!0,badge:"Direct",featured:!0,icon:"/assets/providers/claude.svg"},{id:"huggingface",name:"Hugging Face",description:"Inference Providers router via OpenAI-compatible chat completions",baseUrl:"https://router.huggingface.co/v1",defaultProfileName:"hf",defaultModel:"openai/gpt-oss-120b:fastest",apiKeyPlaceholder:"hf_...",apiKeyHint:"Create a User Access Token at hf.co/settings/tokens",category:"alternative",requiresApiKey:!0,defaultTarget:"droid",badge:"Router"},{id:"tuningengines",name:"Tuning Engines",description:"OpenAI-compatible chat completions gateway",baseUrl:"https://api.tuningengines.com/v1",defaultProfileName:"te",defaultModel:"gpt-4o",apiKeyPlaceholder:"sk-te-...",apiKeyHint:"Create an inference key at app.tuningengines.com/inference/keys",category:"alternative",requiresApiKey:!0,defaultTarget:"droid",badge:"Gateway"},{id:"glm",name:"GLM",description:"Direct Z.AI Anthropic-compatible API profile",baseUrl:"https://api.z.ai/api/anthropic",defaultProfileName:"glm",defaultModel:"glm-5.2",apiKeyPlaceholder:"ghp_...",apiKeyHint:"Get your API key from Z.AI",category:"alternative",requiresApiKey:!0,badge:"Z.AI",icon:"/icons/zai.svg"},{id:"km",name:"Kimi",description:"Kimi Code membership API with stable latest-coding model alias",baseUrl:"https://api.kimi.com/coding/",defaultProfileName:"km",defaultModel:"kimi-for-coding",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key from the Kimi Code Console",category:"alternative",requiresApiKey:!0,alwaysThinkingEnabled:!0,badge:"Kimi Code",icon:"/icons/kimi.svg"},{id:"foundry",name:"Azure Foundry",description:"Claude via Microsoft Azure AI Foundry",baseUrl:"https://<your-resource>.services.ai.azure.com/api/anthropic",defaultProfileName:"foundry",defaultModel:"claude-sonnet-4-5",apiKeyPlaceholder:"YOUR_AZURE_API_KEY",apiKeyHint:"Create resource at ai.azure.com, get API key from Keys tab",category:"alternative",requiresApiKey:!0,badge:"Azure",icon:"/icons/azure.svg"},{id:"mm",name:"Minimax",description:"M3 frontier multimodal coding model with 1M context",baseUrl:"https://api.minimax.io/anthropic",defaultProfileName:"mm",defaultModel:"MiniMax-M3",apiKeyPlaceholder:"YOUR_MINIMAX_API_KEY_HERE",apiKeyHint:"Get your API key at platform.minimax.io",category:"alternative",requiresApiKey:!0,badge:"1M context",icon:"/icons/minimax.svg"},{id:"deepseek",name:"DeepSeek",description:"V3.2 and R1 reasoning model (128K context)",baseUrl:"https://api.deepseek.com/anthropic",defaultProfileName:"deepseek",defaultModel:"deepseek-chat",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key at platform.deepseek.com",category:"alternative",requiresApiKey:!0,badge:"Reasoning",icon:"/icons/deepseek.svg"},{id:"qwen",name:"Qwen",description:"Alibaba Cloud - Qwen3 models (256K-1M context, thinking support)",baseUrl:"https://dashscope-intl.aliyuncs.com/apps/anthropic",defaultProfileName:"qwen-api",defaultModel:"qwen3-coder-plus",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key from Alibaba Cloud Model Studio",category:"alternative",requiresApiKey:!0,badge:"Alibaba",icon:"/assets/providers/qwen-color.svg"},{id:"ollama-cloud",name:"Ollama Cloud",description:"Ollama cloud models via direct API (glm-5:cloud, minimax-m2.1:cloud)",baseUrl:"https://ollama.com",defaultProfileName:"ollama-cloud",defaultModel:"glm-5:cloud",apiKeyPlaceholder:"YOUR_OLLAMA_CLOUD_API_KEY",apiKeyHint:"Get your API key at ollama.com",category:"alternative",requiresApiKey:!0,badge:"Cloud",icon:"/icons/ollama.svg"},{id:"novita",name:"Novita AI",description:"Anthropic-compatible API for Claude Code and CCS profiles",baseUrl:"https://api.novita.ai/anthropic",defaultProfileName:"novita",defaultModel:"deepseek/deepseek-v3.2",apiKeyPlaceholder:"YOUR_NOVITA_API_KEY",apiKeyHint:"Get your API key at novita.ai",category:"alternative",requiresApiKey:!0,badge:"Anthropic-compatible",icon:"/icons/novita.svg"},{id:"fireworks",name:"Fireworks AI",description:"Anthropic-compatible inference (Kimi, Qwen, Llama) via api.fireworks.ai",baseUrl:"https://api.fireworks.ai/inference",defaultProfileName:"fireworks",defaultModel:"accounts/fireworks/models/kimi-k2p5",apiKeyPlaceholder:"fw_...",apiKeyHint:"Get your API key at fireworks.ai/api-keys",category:"alternative",requiresApiKey:!0,badge:"Anthropic-compatible"},{id:"requesty",name:"Requesty",description:"OpenAI-compatible LLM gateway (provider/model naming, e.g. openai/gpt-4o-mini)",baseUrl:"https://router.requesty.ai/v1",defaultProfileName:"requesty",defaultModel:"openai/gpt-4o-mini",apiKeyPlaceholder:"rqsty-sk-...",apiKeyHint:"Create an API key at app.requesty.ai/api-keys",category:"alternative",requiresApiKey:!0,badge:"OpenAI-compatible"}];function ID(n){return{...n,extraEnv:n.extraEnv?{...n.extraEnv}:void 0}}function g_(n){const e=ID(n);return e.extraEnv&&Object.freeze(e.extraEnv),Object.freeze(e)}function y_(n,e){const t=new Set;for(const o of n){const s=o.id.trim().toLowerCase();if(o.id!==s)throw new Error(`Preset ID must be normalized: "${o.id}"`);if(t.has(o.id))throw new Error(`Duplicate preset ID detected: "${o.id}"`);t.add(o.id)}const i=new Set;for(const[o,s]of Object.entries(e)){const r=o.trim().toLowerCase();if(!r)throw new Error("Preset alias keys cannot be empty");if(o!==r)throw new Error(`Preset alias must be normalized: "${o}"`);if(i.has(r))throw new Error(`Duplicate normalized preset alias detected: "${o}"`);if(i.add(r),!t.has(s))throw new Error(`Preset alias "${o}" points to unknown target "${s}"`);if(t.has(r))throw new Error(`Preset alias "${o}" collides with canonical preset ID "${r}"`)}}y_(ED,ND);const b_=Object.freeze(ED.map(g_));function v_(){return b_.map(ID)}function x_(n){const e=n.trim().toLowerCase();return ND[e]||e}const C_=v_(),ev=Object.freeze(C_.map(n=>({...n})));function S_(n,e){return e||(n?.requiresApiKey===!1?n.apiKeyPlaceholder||n.id:"")}function k_(n){return ev.filter(e=>e.category===n)}function pg(n){const e=x_(n);return ev.find(t=>t.id===e)}const w_=ca().refine(n=>n.trim().length===0||ca().url().safeParse(n).success,{message:"Invalid URL format"}),P_=HI({name:ca().min(1,"Name is required").regex(/^[a-zA-Z][a-zA-Z0-9._-]*$/,"Must start with letter, only letters/numbers/.-_"),baseUrl:w_,apiKey:ca(),model:ca().optional(),opusModel:ca().optional(),sonnetModel:ca().optional(),haikuModel:ca().optional(),target:UI(["claude","droid","codex"])}),A_=["/chat/completions","/v1/messages","/messages","/completions"],Xa="custom",mg="openrouter",jD=new Set(["ollama","llamacpp"]),gg={name:"",baseUrl:"",apiKey:"",model:"",opusModel:"",sonnetModel:"",haikuModel:"",target:"claude"},BD=k_("recommended"),D_=BD.filter(n=>!jD.has(n.id)),O_=BD.filter(n=>jD.has(n.id)),T_=ev.filter(n=>n.category!=="recommended");function eQ({open:n,onOpenChange:e,onSuccess:t,initialMode:i="openrouter"}){const{t:o}=ve(),s=f_(),[r,c]=w.useState("basic"),[u,f]=w.useState(null),[m,g]=w.useState(!1),[v,x]=w.useState(mg),[C,k]=w.useState(""),{models:P}=ZU(),{register:D,handleSubmit:O,formState:{errors:T},control:M,reset:L,setValue:R}=_I({resolver:d_(P_),defaultValues:gg}),I=sk({control:M,name:"baseUrl"}),W=sk({control:M,name:"target"}),_=w.useCallback(Y=>{if(!Y){L(gg);return}L({...gg,name:Y.defaultProfileName,baseUrl:Y.baseUrl,model:Y.defaultModel,opusModel:Y.defaultModel,sonnetModel:Y.defaultModel,haikuModel:Y.defaultModel,target:Y.defaultTarget??"claude"})},[L]),z=w.useMemo(()=>v===Xa?null:pg(v)??null,[v]),$=w.useMemo(()=>C.trim()?[...qU(P,C)].sort((se,ue)=>(ue.created??0)-(se.created??0)).slice(0,20):YU(P,2),[P,C]);w.useEffect(()=>{if(n)if(c("basic"),f(null),g(!1),k(""),i==="normal")x(Xa),_(null);else{const se=pg(i==="openrouter"?mg:i);if(se){x(se.id),_(se);return}x(Xa),_(null)}},[n,i,_,L]);const F=Y=>{const se=pg(Y);if(se){x(se.id),_(se);return}x(Xa),_(null)},B=Y=>{R("model",Y.id),R("opusModel",Y.id),R("sonnetModel",Y.id),R("haikuModel",Y.id),k(Y.name),fe.success(o("profileCreateDialog.appliedModelToTiers",{model:Y.name}),{duration:2e3})};w.useEffect(()=>{if(I&&v===Xa){const se=I.toLowerCase();for(const ue of A_)if(se.endsWith(ue)){const be=I.replace(new RegExp(ue+"$","i"),"");f(`URL ends with "${ue}" - Claude appends this automatically. You likely want: ${be}`);return}}f(null)},[I,v]);const ie=async Y=>{if(z?.requiresApiKey!==!1&&!Y.apiKey){fe.error(re.t("commonToast.apiKeyRequired"));return}const se={...Y,apiKey:S_(z,Y.apiKey)};try{await s.mutateAsync(se),fe.success(o("profileCreateDialog.profileCreated",{name:se.name})),t(se.name),e(!1)}catch(ue){fe.error(ue.message||o("profileCreateDialog.failedCreate"))}},oe=!!T.name||!!T.baseUrl||!!T.apiKey,H=!!T.model||!!T.opusModel||!!T.sonnetModel||!!T.haikuModel,Z=s.isPending,ae=z?.id===mg;return p.jsx(Nb,{open:n,onOpenChange:e,children:p.jsxs(Eb,{"data-testid":"profile-create-dialog",className:"h-[calc(100dvh-2rem)] max-h-[900px] gap-0 overflow-hidden p-0 sm:max-w-[700px] !flex !flex-col",children:[p.jsxs(Ib,{className:"shrink-0 border-b p-6 pb-4",children:[p.jsxs(jb,{className:"flex items-center gap-2",children:[p.jsx(ek,{className:"w-5 h-5 text-primary"}),o("profileCreateDialog.createProfile")]}),p.jsx(Bb,{children:o("profileCreateDialog.chooseProviderHint")})]}),p.jsxs("form",{onSubmit:O(ie),className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[p.jsx("div",{"data-testid":"profile-create-provider-chooser",className:"max-h-[34dvh] shrink-0 space-y-3 overflow-y-auto overscroll-contain border-b bg-muted/10 px-6 py-3",children:p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"flex items-start justify-between gap-4",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx(yn,{className:"text-xs text-muted-foreground",children:o("profileEditor.provider")}),p.jsx("p",{className:"text-xs text-muted-foreground",children:o("profileEditor.providerChooserHint")})]}),p.jsx("span",{className:"pt-0.5 text-[11px] text-muted-foreground",children:o("profileEditor.scrollHint")})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:o("profileEditor.featuredProviders")}),p.jsx("div",{className:"-mx-1 overflow-x-auto pb-1",children:p.jsxs("div",{className:"flex min-w-max items-stretch gap-2 px-1",children:[D_.map(Y=>p.jsx(yg,{preset:Y,isSelected:v===Y.id,onClick:()=>F(Y.id),density:"featured"},Y.id)),p.jsx("div",{className:"mx-1 hidden w-px rounded-full bg-border/70 sm:block"}),p.jsx(M_,{isSelected:v===Xa,onClick:()=>F(Xa)})]})})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:o("profileEditor.morePresets")}),p.jsx("div",{className:"-mx-1 overflow-x-auto pb-1",children:p.jsx("div",{className:"flex min-w-max items-stretch gap-2 px-1",children:T_.map(Y=>p.jsx(yg,{preset:Y,isSelected:v===Y.id,onClick:()=>F(Y.id),density:"compact"},Y.id))})})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:o("openrouterQuickStart.localRuntimesTitle")}),p.jsx("div",{className:"flex flex-wrap gap-2",children:O_.map(Y=>p.jsx(yg,{preset:Y,isSelected:v===Y.id,onClick:()=>F(Y.id),density:"compact"},Y.id))})]})]})}),p.jsxs(TD,{value:r,onValueChange:c,className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[p.jsx("div",{className:"px-6 pt-4",children:p.jsxs(Xb,{className:"grid w-full grid-cols-2",children:[p.jsxs(vh,{value:"basic",className:"relative",children:[o("profileCreateDialog.basicInformation"),oe&&p.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]}),p.jsxs(vh,{value:"models",className:"relative",children:[o("profileCreateDialog.modelConfiguration"),H&&p.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]})]})}),p.jsxs("div",{"data-testid":"profile-create-tab-scroll",className:"flex-1 min-h-0 overflow-y-auto",children:[p.jsxs(gy,{value:"basic",className:"p-6 space-y-4 mt-0",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"name",children:[o("profileDialog.name")," ",p.jsx("span",{className:"text-destructive",children:"*"})]}),p.jsx(Hi,{id:"name",...D("name"),placeholder:o("profileDialog.namePlaceholder"),className:"font-mono"}),T.name?p.jsx("p",{className:"text-xs text-destructive",children:T.name.message}):p.jsxs("p",{className:"text-xs text-muted-foreground",children:[o("profileCreateDialog.usedInCli")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:'ccs my-api "prompt"'})]})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(yn,{htmlFor:"baseUrl",children:o("profileCreateDialog.apiBaseUrl")}),p.jsx(Hi,{id:"baseUrl",...D("baseUrl"),placeholder:o("profileCreateDialog.baseUrlPlaceholder")}),T.baseUrl?p.jsx("p",{className:"text-xs text-destructive",children:T.baseUrl.message}):u?p.jsxs("div",{className:"flex items-start gap-2 text-xs text-yellow-600 bg-yellow-50 dark:bg-yellow-900/20 p-2 rounded",children:[p.jsx(wi,{className:"w-4 h-4 shrink-0 mt-0.5"}),p.jsx("span",{children:u})]}):z?p.jsx("p",{className:"text-xs text-muted-foreground",children:z.baseUrl?o("profileCreateDialog.prefilledFromPreset",{name:z.name}):o("profileCreateDialog.optionalForPreset",{name:z.name})}):p.jsx("p",{className:"text-xs text-muted-foreground",children:o("profileCreateDialog.endpointHint")})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"apiKey",children:[o("profileDialog.apiKey")," ",z?.requiresApiKey!==!1&&p.jsx("span",{className:"text-destructive",children:"*"}),z?.requiresApiKey===!1&&p.jsx("span",{className:"text-muted-foreground text-xs font-normal",children:o("profileCreateDialog.optional")})]}),p.jsxs("div",{className:"relative",children:[p.jsx(Hi,{id:"apiKey",type:m?"text":"password",...D("apiKey"),placeholder:z?.requiresApiKey===!1?o("profileCreateDialog.apiKeyOptionalPlaceholder"):z?.apiKeyPlaceholder??o("profileCreateDialog.apiKeyPlaceholder"),className:"pr-10"}),p.jsx(ft,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-9 w-9 text-muted-foreground hover:text-foreground",onClick:()=>g(!m),tabIndex:-1,children:m?p.jsx(Kc,{className:"h-4 w-4"}):p.jsx(Wc,{className:"h-4 w-4"})})]}),T.apiKey?p.jsx("p",{className:"text-xs text-destructive",children:T.apiKey.message}):z?.requiresApiKey===!1?p.jsx("p",{className:"text-xs text-muted-foreground",children:o("profileCreateDialog.apiKeyOptionalHint")}):z?.apiKeyHint&&p.jsx("p",{className:"text-xs text-muted-foreground",children:z.apiKeyHint})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(yn,{htmlFor:"target",children:o("codex.defaultTargetCli")}),p.jsxs(q1,{value:W,onValueChange:Y=>R("target",Y),children:[p.jsx(zb,{id:"target",children:p.jsx(G1,{})}),p.jsxs(Fb,{children:[p.jsx(rc,{value:"claude",children:o("profileCard.claudeCodeDefault")}),p.jsx(rc,{value:"droid",children:o("profileCard.factoryDroid")}),p.jsx(rc,{value:"codex",children:o("profileCard.codexCli")})]})]}),p.jsxs("p",{className:"text-xs text-muted-foreground",children:[W==="droid"?p.jsxs(p.Fragment,{children:[o("profileEditor.targetHintPreferredAlias")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs-droid"}),"."]}):W==="codex"?p.jsxs(p.Fragment,{children:[o("profileEditor.targetHintPreferredAlias")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccsx"}),"."]}):p.jsxs(p.Fragment,{children:[o("profileEditor.targetHintClaudeDefault")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs"}),"."]}),W==="droid"?p.jsxs(p.Fragment,{children:[" ",o("profileEditor.targetHintLegacyAlias")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccsd"}),"."]}):W==="codex"?p.jsxs(p.Fragment,{children:[" ",o("profileEditor.targetHintLegacyAlias")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs-codex"}),"."]}):null," ",o("profileEditor.targetHintOverride")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"--target"}),"."]})]})]}),p.jsxs(gy,{value:"models",className:"p-6 mt-0 space-y-4",children:[p.jsxs("div",{className:"flex items-start gap-3 p-3 bg-blue-50 dark:bg-blue-950/20 text-blue-800 dark:text-blue-300 rounded-md text-sm border border-blue-100 dark:border-blue-900/30",children:[p.jsx($h,{className:"w-5 h-5 shrink-0 mt-0.5"}),p.jsxs("div",{children:[p.jsx("p",{className:"font-medium mb-1",children:o("profileCreateDialog.modelMapping")}),p.jsx("p",{className:"text-xs opacity-90",children:o("profileCreateDialog.modelMappingDesc")})]})]}),ae&&p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{children:o("openrouterModelPicker.searchModels")}),p.jsx(Hi,{value:C,onChange:Y=>k(Y.target.value),placeholder:o("profileCreateDialog.searchModelsPlaceholder"),onKeyDown:Y=>{Y.key==="Enter"&&$.length>0&&(Y.preventDefault(),B($[0]))}}),p.jsx("div",{className:"border rounded-md max-h-48 overflow-y-auto",children:$.length===0?p.jsx("p",{className:"text-sm text-muted-foreground p-3 text-center",children:C?o("profileCreateDialog.noModelsFound",{query:C}):o("profileCreateDialog.loadingModels")}):p.jsxs("div",{className:"p-1",children:[!C&&p.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground",children:[p.jsx(QE,{className:"w-3 h-3 text-accent"}),p.jsx("span",{children:o("openrouterModelPicker.newestModels")})]}),$.map(Y=>p.jsx(R_,{model:Y,onClick:()=>B(Y),showAge:!C},Y.id))]})})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"model",children:[o("profileCreateDialog.defaultModel"),p.jsx(Qt,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"ANTHROPIC_MODEL"})]}),p.jsx(Hi,{id:"model",...D("model"),placeholder:z?.defaultModel??"claude-sonnet-4",className:"font-mono text-sm"})]}),p.jsxs("div",{className:"grid gap-3 pt-2 border-t",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"sonnetModel",className:"text-sm",children:[o("profileCreateDialog.sonnetMapping"),p.jsx(Qt,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_SONNET"})]}),p.jsx(Hi,{id:"sonnetModel",...D("sonnetModel"),placeholder:o("profileCreateDialog.sonnetMappingPlaceholder"),className:"font-mono text-sm h-9"})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"opusModel",className:"text-sm",children:[o("profileCreateDialog.opusMapping"),p.jsx(Qt,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_OPUS"})]}),p.jsx(Hi,{id:"opusModel",...D("opusModel"),placeholder:o("profileCreateDialog.opusMappingPlaceholder"),className:"font-mono text-sm h-9"})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"haikuModel",className:"text-sm",children:[o("profileCreateDialog.haikuMapping"),p.jsx(Qt,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_HAIKU"})]}),p.jsx(Hi,{id:"haikuModel",...D("haikuModel"),placeholder:o("profileCreateDialog.haikuMappingPlaceholder"),className:"font-mono text-sm h-9"})]})]})]})]})]}),p.jsxs(kB,{"data-testid":"profile-create-footer",className:"shrink-0 border-t bg-muted/10 p-6 pt-4",children:[p.jsx(ft,{type:"button",variant:"outline",onClick:()=>e(!1),children:o("profileDialog.cancel")}),p.jsx(ft,{type:"submit",disabled:Z,className:q(Z&&"opacity-80"),children:Z?p.jsxs(p.Fragment,{children:[p.jsx(hi,{className:"w-4 h-4 mr-2 animate-spin"}),o("cliproxyDialog.creating")]}):p.jsxs(p.Fragment,{children:[p.jsx(ek,{className:"w-4 h-4 mr-2"}),o("profileCreateDialog.createProfile")]})})]})]})]})]})})}function yg({preset:n,isSelected:e,onClick:t,density:i="compact"}){const o=n.id==="anthropic",s=i==="featured";return p.jsxs("button",{type:"button",onClick:t,className:q("flex flex-none items-center gap-3 rounded-xl border px-3 py-2.5 text-left transition-all",s?"h-[68px] w-[236px]":"h-[64px] w-[168px]",e?"border-primary bg-primary/8 shadow-sm ring-1 ring-primary/10":"border-border/60 bg-background hover:border-primary/40 hover:bg-accent/20"),children:[p.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-background",children:o?p.jsx(h_,{provider:"claude",size:"md",className:"rounded-lg"}):n.icon?p.jsx("img",{src:n.icon,alt:"",className:"h-5 w-5 object-contain"}):p.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-muted/70 text-xs font-semibold text-foreground/70",children:n.name.charAt(0)})}),p.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("div",{className:"truncate text-[13px] font-semibold leading-tight tracking-[-0.01em]",children:n.name}),n.badge&&s&&p.jsx(Qt,{variant:"secondary",className:"inline-flex bg-muted px-1.5 py-0 text-[10px] text-muted-foreground",children:n.badge})]}),n.badge&&!s&&p.jsx(Qt,{variant:"secondary",className:"inline-flex w-fit bg-muted px-1.5 py-0 text-[10px] text-muted-foreground",children:n.badge})]})]})}function M_({isSelected:n,onClick:e}){const{t}=ve();return p.jsxs("button",{type:"button",onClick:e,className:q("flex h-[68px] w-[236px] flex-none items-center gap-3 rounded-xl border border-dashed px-3 py-2.5 text-left transition-all",n?"border-primary bg-primary/8 shadow-sm ring-1 ring-primary/10":"border-muted-foreground/30 bg-background hover:border-primary/40 hover:bg-accent/20"),children:[p.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-dashed border-current/30 bg-muted/70",children:p.jsx(kb,{className:"h-4 w-4 text-muted-foreground"})}),p.jsx("div",{className:"min-w-0 flex-1",children:p.jsx("div",{className:"text-sm font-semibold leading-tight",children:t("profileEditor.customEndpoint")})})]})}function R_({model:n,onClick:e,showAge:t}){const{t:i}=ve();return p.jsxs("button",{type:"button",onClick:e,className:"group flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",children:[p.jsx("span",{className:"flex-1 truncate",children:n.name}),p.jsxs("span",{className:"text-muted-foreground group-hover:text-accent-foreground/80 ml-2 flex items-center gap-2 text-xs",children:[t&&n.created&&p.jsx(Qt,{variant:"outline",className:"text-[10px] text-accent group-hover:text-accent-foreground/80 group-hover:border-accent-foreground/30",children:$U(n.created)}),n.isFree?p.jsx(Qt,{variant:"secondary",className:"text-xs group-hover:bg-accent-foreground/20 group-hover:text-accent-foreground",children:i("profileCreateDialog.free")}):p.jsx("span",{children:_U(n.pricing)}),p.jsx("span",{children:WU(n.context_length)})]})]})}function L_({className:n,...e}){return p.jsx("div",{"data-slot":"card",className:q("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",n),...e})}function N_({className:n,...e}){return p.jsx("div",{"data-slot":"card-header",className:q("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",n),...e})}function E_({className:n,...e}){return p.jsx("div",{"data-slot":"card-title",className:q("leading-none font-semibold",n),...e})}function I_({className:n,...e}){return p.jsx("div",{"data-slot":"card-description",className:q("text-muted-foreground text-sm",n),...e})}function j_({className:n,...e}){return p.jsx("div",{"data-slot":"card-content",className:q("px-6",n),...e})}const tv="[1m]",HD=["ANTHROPIC_MODEL","ANTHROPIC_DEFAULT_OPUS_MODEL","ANTHROPIC_DEFAULT_SONNET_MODEL","ANTHROPIC_DEFAULT_HAIKU_MODEL","ANTHROPIC_DEFAULT_FABLE_MODEL"],B_=["CLAUDE_CODE_SUBAGENT_MODEL","ANTHROPIC_DEFAULT_MODEL"],nv=[...HD,...B_];new Set(HD);const H_=new Set(nv);function tQ(n){return n.toLowerCase().startsWith("gemini-")}function iv(n){return n.toLowerCase().endsWith(tv.toLowerCase())}function U_(n){return!n||iv(n)?n:`${n}${tv}`}function UD(n){return n&&(iv(n)?n.slice(0,-tv.length):n)}function nQ(n){return H_.has(n)}function __(n){return UD(n.trim()).replace(/\([^)]+\)$/,"")}function iQ(n){return nv.some(e=>{const t=n[e];return typeof t=="string"&&iv(t)})}function oQ(n,e,t={}){const i={...n};for(const o of nv){const s=i[o];if(typeof s!="string"||s.trim().length===0)continue;const r=__(s),c=t.supportsExtendedContext?.(r,o)??!0;i[o]=e&&c?U_(s):UD(s)}return i}const z_=["agy","claude","gemini","codex","xai","cursor","gitlab","codebuddy","qwen","kimi","iflow","kilo","kiro","qoder"],aQ=z_.map(n=>({id:n,name:_b(n),description:VB(n)})),F_=["provider","auth","variant","success"];function sQ(n){return n==="account"?1:F_.indexOf(n)}const rQ=dE,lQ=hE,cQ=uE,q_=w.forwardRef(({className:n,align:e="center",sideOffset:t=4,...i},o)=>p.jsx(cE,{children:p.jsx(n1,{ref:o,align:e,sideOffset:t,className:q("z-50 w-80 max-w-[calc(100vw-2rem)] rounded-lg border border-border/70 bg-popover p-4 text-popover-foreground shadow-xl shadow-black/10 outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...i})}));q_.displayName=n1.displayName;const G_=w.lazy(()=>lt(()=>Promise.resolve().then(()=>Lf),void 0).then(n=>({default:n.CodeEditor})));function dQ({rawJsonContent:n,isRawJsonValid:e,rawJsonEdits:t,onRawJsonChange:i,profileEnv:o,missingRequiredFields:s=[]}){const{t:r}=ve(),c=s.length>0;return p.jsx(w.Suspense,{fallback:p.jsxs("div",{className:"flex items-center justify-center h-full",children:[p.jsx(hi,{className:"w-6 h-6 animate-spin text-muted-foreground"}),p.jsx("span",{className:"ml-2 text-muted-foreground",children:r("providerEditor.loadingEditor")})]}),children:p.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!e&&t!==null&&p.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[p.jsx(Vr,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),e&&c&&p.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[p.jsx(wi,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",p.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:s.join(", ")}),p.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Apply a preset from Model Config tab or add these fields manually. Without them, Claude Code will fail with 404 errors."})]})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:p.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:p.jsx(G_,{value:n,onChange:i,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),p.jsx("div",{className:"mx-6 mb-4",children:p.jsx("div",{className:"border rounded-md overflow-hidden",children:p.jsx(Zb,{profileEnv:o})})})]})})}let by=[],_D=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?_D:by).push(t=t+n[e])})();function V_(n){if(n<768)return!1;for(let e=0,t=by.length;;){let i=e+t>>1;if(n<by[i])t=i;else if(n>=_D[i])e=i+1;else return!0;if(e==t)return!1}}function dw(n){return n>=127462&&n<=127487}const uw=8205;function K_(n,e,t=!0,i=!0){return(t?zD:W_)(n,e,i)}function zD(n,e,t){if(e==n.length)return e;e&&FD(n.charCodeAt(e))&&qD(n.charCodeAt(e-1))&&e--;let i=bg(n,e);for(e+=hw(i);e<n.length;){let o=bg(n,e);if(i==uw||o==uw||t&&V_(o))e+=hw(o),i=o;else if(dw(o)){let s=0,r=e-2;for(;r>=0&&dw(bg(n,r));)s++,r-=2;if(s%2==0)break;e+=2}else break}return e}function W_(n,e,t){for(;e>0;){let i=zD(n,e-2,t);if(i<e)return i;e--}return 0}function bg(n,e){let t=n.charCodeAt(e);if(!qD(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return FD(i)?(t-55296<<10)+(i-56320)+65536:t}function FD(n){return n>=56320&&n<57344}function qD(n){return n>=55296&&n<56320}function hw(n){return n<65536?1:2}class Je{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=jr(this,e,t);let o=[];return this.decompose(0,e,o,2),i.length&&i.decompose(0,i.length,o,3),this.decompose(t,this.length,o,1),_i.from(o,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=jr(this,e,t);let i=[];return this.decompose(e,t,i,0),_i.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),o=new dc(this),s=new dc(e);for(let r=t,c=t;;){if(o.next(r),s.next(r),r=0,o.lineBreak!=s.lineBreak||o.done!=s.done||o.value!=s.value)return!1;if(c+=o.value.length,o.done||c>=i)return!0}}iter(e=1){return new dc(this,e)}iterRange(e,t=this.length){return new GD(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let o=this.line(e).from;i=this.iterRange(o,Math.max(o,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new VD(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Je.empty:e.length<=32?new jt(e):_i.from(jt.split(e,[]))}}class jt extends Je{constructor(e,t=Q_(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,o){for(let s=0;;s++){let r=this.text[s],c=o+r.length;if((t?i:c)>=e)return new Y_(o,c,i,r);o=c+1,i++}}decompose(e,t,i,o){let s=e<=0&&t>=this.length?this:new jt(fw(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(o&1){let r=i.pop(),c=nh(s.text,r.text.slice(),0,s.length);if(c.length<=32)i.push(new jt(c,r.length+s.length));else{let u=c.length>>1;i.push(new jt(c.slice(0,u)),new jt(c.slice(u)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof jt))return super.replace(e,t,i);[e,t]=jr(this,e,t);let o=nh(this.text,nh(i.text,fw(this.text,0,e)),t),s=this.length+i.length-(t-e);return o.length<=32?new jt(o,s):_i.from(jt.split(o,[]),s)}sliceString(e,t=this.length,i=`
17
+ `).trim()}function pU(n){const e=n.url.match(/\/api\/provider\/([^/]+)/);e&&(n.provider=e[1]);const t=n.url.match(/\/api\/provider\/[^/]+\/(.+?)(?:\?|$)/);t&&(n.endpoint=t[1]),n.isClientError=n.statusCode>=400&&n.statusCode<500,n.isServerError=n.statusCode>=500,n.statusCode===429?n.errorType="rate_limit":n.statusCode===401||n.statusCode===403?n.errorType="auth":n.statusCode===404?n.errorType="not_found":n.statusCode>=500?n.errorType="server":(n.statusCode===408||n.statusCode===504)&&(n.errorType="timeout"),mU(n),n.statusCode===429&&gU(n)}function mU(n){if(n.requestBody)try{const e=JSON.parse(n.requestBody);typeof e.model=="string"&&(n.model=e.model)}catch{}}function gU(n){if(n.responseBody)try{const e=JSON.parse(n.responseBody),t=py(e);t!==null&&(n.quotaResetDelay=t);const i=my(e);i&&(n.quotaResetTimestamp=i)}catch{}}function py(n){if(typeof n!="object"||n===null)return null;const e=n;if("quotaResetDelay"in e){const t=e.quotaResetDelay;if(typeof t=="number")return t;if(typeof t=="string"){const i=t.match(/^(\d+)s?$/);if(i)return parseInt(i[1],10)}}if("error"in e&&typeof e.error=="object"){const t=py(e.error);if(t!==null)return t}if("details"in e&&Array.isArray(e.details))for(const t of e.details){const i=py(t);if(i!==null)return i}return null}function my(n){if(typeof n!="object"||n===null)return null;const e=n;for(const t of["quotaResetTimeStamp","quotaResetTimestamp","resetTime","reset_time"])if(t in e&&typeof e[t]=="string")return e[t];if("error"in e&&typeof e.error=="object"){const t=my(e.error);if(t)return t}if("details"in e&&Array.isArray(e.details))for(const t of e.details){const i=my(t);if(i)return i}return null}function yU(n){return{400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",408:"Request Timeout",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout"}[n]||""}function bU(n,e){const t=wb(),i=Date.now(),o=n*1e3,s=i-o,r=Math.floor(s/1e3),c=Math.floor(r/60),u=Math.floor(c/60),f=Math.floor(u/24);if(r<60){const g=t==="zh-CN",v=t==="vi";return g?"刚刚":v?"vừa xong":"just now"}if(c<60){const g=t==="zh-CN",v=t==="vi";return g?`${c} 分钟前`:v?`${c} phút trước`:`${c}m ago`}if(u<24){const g=t==="zh-CN",v=t==="vi";return g?`${u} 小时前`:v?`${u} giờ trước`:`${u}h ago`}if(f<7){const g=t==="zh-CN",v=t==="vi";return g?`${f} 天前`:v?`${f} ngày trước`:`${f}d ago`}return new Date(o).toLocaleDateString(t,{month:"short",day:"numeric"})}function vU(n){return n>=500?"text-red-500":n===429?"text-orange-500":n>=400?"text-yellow-500":"text-gray-500"}function xU(n,e){const t=wb();return t==="zh-CN"?{rate_limit:"限流",auth:"认证错误",not_found:"未找到",server:"服务错误",timeout:"超时",unknown:"错误"}[n]||"错误":t==="vi"?{rate_limit:"Quá giới hạn",auth:"Lỗi xác thực",not_found:"Không tìm thấy",server:"Lỗi máy chủ",timeout:"Hết thời gian chờ",unknown:"Lỗi"}[n]||"Lỗi":{rate_limit:"Rate Limited",auth:"Auth Error",not_found:"Not Found",server:"Server Error",timeout:"Timeout",unknown:"Error"}[n]||"Error"}function CU(n){if(n===null||n<=0)return null;if(n<60)return`${n}s`;if(n<3600)return`${Math.floor(n/60)}m`;const e=Math.floor(n/3600),t=Math.floor(n%3600/60);return t>0?`${e}h ${t}m`:`${e}h`}function SU(n,e){if(!n)return null;const t=wb(),i=t==="zh-CN",o=t==="vi";try{const s=new Date(n),r=new Date,c=s.getTime()-r.getTime();if(c<=0)return i?"现在":o?"bây giờ":"now";const u=Math.floor(c/1e3);if(u<60)return i?`${u}秒`:o?`${u} giây`:`${u}s`;if(u<3600){const g=Math.floor(u/60);return i?`${g}分钟`:o?`${g} phút`:`${g}m`}const f=Math.floor(u/3600),m=Math.floor(u%3600/60);return i?m>0?`${f}小时 ${m}分钟`:`${f}小时`:o?m>0?`${f} giờ ${m} phút`:`${f} giờ`:m>0?`${f}h ${m}m`:`${f}h`}catch{return null}}function kU(n){return n?n===429?"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400":n>=500?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":n>=400?"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400":"bg-gray-100 text-gray-600":"bg-gray-100 text-gray-600"}function wU(n){return n||""}function PU({name:n,size:e,modified:t,isSelected:i,onClick:o,statusCode:s,model:r}){const c=w.useMemo(()=>cU(n),[n]),u=w.useMemo(()=>wU(r),[r]);return p.jsxs("button",{onClick:o,className:q("w-full px-2.5 py-2 flex items-center gap-2 text-left transition-colors","hover:bg-muted/40 border-l-[3px]",i?"bg-muted/50 border-l-red-500":"border-l-transparent"),children:[p.jsx("span",{className:q("shrink-0 text-[10px] font-bold px-1.5 py-0.5 rounded min-w-[32px] text-center",kU(s)),children:s||"???"}),p.jsx(Vb,{provider:c.provider,size:18,withBackground:!0,className:"shrink-0"}),p.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[p.jsx("span",{className:"text-[11px] font-medium text-foreground truncate",children:c.endpoint||"unknown"}),u&&p.jsx("span",{className:"text-[10px] text-muted-foreground truncate",title:u,children:u}),p.jsxs("div",{className:"flex items-center gap-1 text-[9px] text-muted-foreground/60",children:[p.jsx(Ir,{className:"w-2.5 h-2.5"}),p.jsx("span",{children:bU(t)})]})]})]})}function aw({value:n,className:e,variant:t="outline",size:i="icon",label:o="Copy to clipboard"}){const[s,r]=w.useState(!1),c=()=>{navigator.clipboard.writeText(n),r(!0),setTimeout(()=>r(!1),2e3)};return p.jsx(ms,{children:p.jsxs($i,{children:[p.jsx(Xi,{asChild:!0,children:p.jsxs(ft,{size:i,variant:t,className:q("relative z-10 text-muted-foreground hover:text-foreground",e),onClick:u=>{u.stopPropagation(),c()},children:[s?p.jsx(Er,{className:"h-3.5 w-3.5 text-green-500"}):p.jsx(hh,{className:"h-3.5 w-3.5"}),p.jsx("span",{className:"sr-only",children:o})]})}),p.jsx(Ji,{children:p.jsx("p",{children:s?"Copied!":o})})]})})}function Gl({active:n,onClick:e,children:t,icon:i}){return p.jsxs("button",{onClick:e,className:q("px-2.5 py-1.5 text-xs font-medium rounded transition-colors flex items-center gap-1.5",n?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[i&&p.jsx(i,{className:"w-3.5 h-3.5"}),t]})}function PD({code:n}){const e=vU(n);return p.jsx("span",{className:q("inline-flex items-center justify-center min-w-[36px] px-2 py-0.5 rounded text-xs font-bold","bg-current/10 border border-current/20",e),children:n})}function AU({parsed:n}){const{t:e}=ve(),t=CU(n.quotaResetDelay)||SU(n.quotaResetTimestamp),i=e("errorLogs.na");return p.jsx(Kr,{className:"h-full",children:p.jsxs("div",{className:"p-4 space-y-4",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(PD,{code:n.statusCode}),p.jsx("span",{className:"text-sm font-medium",children:n.statusText}),p.jsx("span",{className:"text-xs text-muted-foreground px-2 py-0.5 rounded bg-muted/50",children:xU(n.errorType)})]}),n.model&&p.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-violet-500/10 border border-violet-500/20",children:[p.jsx(_E,{className:"w-4 h-4 text-violet-500 shrink-0"}),p.jsxs("div",{className:"text-sm",children:[p.jsx("span",{className:"text-muted-foreground",children:e("errorLogs.modelLabel")}),p.jsx("span",{className:"font-semibold text-violet-600 dark:text-violet-400",children:n.model})]})]}),n.errorType==="rate_limit"&&t&&p.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[p.jsx(Ir,{className:"w-4 h-4 text-amber-500 shrink-0"}),p.jsxs("div",{className:"text-sm",children:[p.jsx("span",{className:"text-muted-foreground",children:e("errorLogs.quotaResetsIn")}),p.jsx("span",{className:"font-semibold text-amber-600 dark:text-amber-400",children:t})]})]}),p.jsxs("div",{className:"grid grid-cols-4 gap-3 text-xs",children:[p.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[p.jsx("div",{className:"text-muted-foreground mb-1",children:e("errorLogs.method")}),p.jsx("div",{className:"font-medium",children:n.method||i})]}),p.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[p.jsx("div",{className:"text-muted-foreground mb-1",children:e("errorLogs.provider")}),p.jsx("div",{className:"font-medium",children:n.provider||i})]}),p.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[p.jsx("div",{className:"text-muted-foreground mb-1",children:e("errorLogs.version")}),p.jsx("div",{className:"font-medium",children:n.version||i})]}),p.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[p.jsx("div",{className:"text-muted-foreground mb-1",children:e("errorLogs.endpoint")}),p.jsx("div",{className:"font-medium truncate",title:n.endpoint,children:n.endpoint||i})]})]}),p.jsxs("div",{className:"text-xs",children:[p.jsx("div",{className:"text-muted-foreground mb-1.5",children:e("errorLogs.url")}),p.jsx("div",{className:"font-mono p-2.5 rounded bg-muted/30 border border-border/50 break-all leading-relaxed",children:n.url||i})]}),p.jsxs("div",{className:"text-xs",children:[p.jsx("div",{className:"text-muted-foreground mb-1.5",children:e("errorLogs.timestamp")}),p.jsx("div",{className:"font-mono",children:n.timestamp||i})]}),n.errorType!=="unknown"&&p.jsxs("div",{className:q("flex items-start gap-3 p-3 rounded text-xs",n.errorType==="rate_limit"?"bg-amber-500/10 border border-amber-500/20":n.errorType==="auth"?"bg-red-500/10 border border-red-500/20":"bg-blue-500/10 border border-blue-500/20"),children:[n.errorType==="rate_limit"?p.jsx(wi,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}):n.errorType==="auth"?p.jsx(wi,{className:"w-4 h-4 mt-0.5 text-red-500 shrink-0"}):p.jsx($h,{className:"w-4 h-4 mt-0.5 text-blue-500 shrink-0"}),p.jsxs("div",{className:q("leading-relaxed",n.errorType==="rate_limit"?"text-amber-600 dark:text-amber-400":n.errorType==="auth"?"text-red-600 dark:text-red-400":"text-blue-600 dark:text-blue-400"),children:[n.errorType==="rate_limit"&&(n.model?e("errorLogs.rateLimitedMsg",{model:n.model}):e("errorLogs.rateLimitedMsgNoModel")),n.errorType==="auth"&&e("errorLogs.authFailedMsg"),n.errorType==="not_found"&&e("errorLogs.notFoundMsg"),n.errorType==="server"&&e("errorLogs.serverErrorMsg"),n.errorType==="timeout"&&e("errorLogs.timeoutMsg")]})]})]})})}function DU({headers:n}){const{t:e}=ve(),t=Object.entries(n);return t.length===0?p.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:e("errorLogs.noHeaders")}):p.jsx(Kr,{className:"h-full",children:p.jsx("div",{className:"p-4 space-y-1",children:t.map(([i,o])=>p.jsxs("div",{className:"flex gap-3 text-xs font-mono py-1.5 border-b border-border/30 last:border-0",children:[p.jsxs("span",{className:"text-muted-foreground shrink-0 min-w-[140px]",children:[i,":"]}),p.jsx("span",{className:"break-all",children:o})]},i))})})}function sw({content:n,label:e}){const{t}=ve();if(!n||n.trim()===""){const s=e==="Request"?"errorLogs.noRequestBody":"errorLogs.noResponseBody";return p.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:t(s)})}let i=n,o=!1;try{const s=JSON.parse(n);i=JSON.stringify(s,null,2),o=!0}catch{}return p.jsx(Kr,{className:"h-full",children:p.jsx("pre",{className:q("p-4 text-xs font-mono whitespace-pre-wrap break-all leading-relaxed",o?"text-emerald-700 dark:text-green-400":"text-zinc-700 dark:text-muted-foreground"),children:i})})}function OU({content:n}){return p.jsx(Kr,{className:"h-full",children:p.jsx("pre",{className:"p-4 text-xs font-mono text-zinc-700 dark:text-muted-foreground whitespace-pre-wrap break-all leading-relaxed",children:n})})}function TU({name:n,absolutePath:e}){const{t}=ve(),[i,o]=w.useState("overview"),{data:s,isLoading:r,error:c}=nH(n),u=w.useMemo(()=>s?dU(s):null,[s]);return n?r?p.jsxs("div",{className:"flex-1 p-6 space-y-3",children:[p.jsx(tt,{className:"h-5 w-full"}),p.jsx(tt,{className:"h-5 w-3/4"}),p.jsx(tt,{className:"h-5 w-5/6"}),p.jsx(tt,{className:"h-5 w-2/3"})]}):c||!s||!u?p.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:p.jsx("p",{className:"text-sm",children:t("errorLogs.failedLoadContent")})}):p.jsxs("div",{className:"flex-1 flex flex-col min-w-0 h-full",children:[p.jsxs("div",{className:"px-4 py-3 border-b border-border bg-muted/30 flex items-center justify-between gap-3 shrink-0",children:[p.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[p.jsx(PD,{code:u.statusCode}),p.jsxs("span",{className:"text-xs font-semibold truncate text-foreground",children:[u.provider,"/",u.endpoint||"unknown"]}),n&&p.jsx(aw,{value:e||n,label:t("errorLogs.copyAbsolutePath"),size:"icon-sm",className:"ml-1 text-muted-foreground hover:text-foreground opacity-50 hover:opacity-100 transition-opacity"})]}),p.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s&&p.jsx(aw,{value:s,label:t("errorLogs.copyRawContent"),variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground"}),p.jsx("span",{className:"text-[10px] text-muted-foreground font-mono bg-muted px-1.5 py-0.5 rounded border border-border/50",children:u.method})]})]}),p.jsxs("div",{className:"px-3 py-2 border-b border-border flex items-center gap-1 bg-muted/10 shrink-0 overflow-x-auto",children:[p.jsx(Gl,{active:i==="overview",onClick:()=>o("overview"),icon:$h,children:t("errorLogs.tabOverview")}),p.jsx(Gl,{active:i==="headers",onClick:()=>o("headers"),icon:FE,children:t("errorLogs.tabHeaders")}),p.jsx(Gl,{active:i==="request",onClick:()=>o("request"),icon:y1,children:t("errorLogs.tabRequest")}),p.jsx(Gl,{active:i==="response",onClick:()=>o("response"),icon:qE,children:t("errorLogs.tabResponse")}),p.jsx(Gl,{active:i==="raw",onClick:()=>o("raw"),icon:GE,children:t("errorLogs.tabRaw")})]}),p.jsxs("div",{className:"flex-1 overflow-hidden bg-card/30",children:[i==="overview"&&p.jsx(AU,{parsed:u}),i==="headers"&&p.jsx(DU,{headers:u.requestHeaders}),i==="request"&&p.jsx(sw,{content:u.requestBody,label:t("errorLogs.tabRequest")}),i==="response"&&p.jsx(sw,{content:u.responseBody,label:t("errorLogs.tabResponse")}),i==="raw"&&p.jsx(OU,{content:s})]})]}):p.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:p.jsxs("div",{className:"text-center space-y-3",children:[p.jsx(zE,{className:"w-10 h-10 mx-auto opacity-40"}),p.jsx("p",{className:"text-sm",children:t("errorLogs.selectLog")})]})})}function MU(){const{t:n}=ve(),{data:e,isLoading:t}=Q1(),{data:i,isLoading:o,error:s}=tH(e?.running??!1),[r,c]=w.useState(500),[u,f]=w.useState(!1),m=w.useRef(null),g=w.useRef(null),v=()=>{g.current&&(clearInterval(g.current),g.current=null)};w.useEffect(()=>{if(!u)return;const M=R=>{const I=m.current;if(!I)return;const _=I.getBoundingClientRect().top+window.scrollY,z=R.pageY-_;c(Math.max(300,z));const F=window.innerHeight-R.clientY,B=15;v(),F<50?g.current=setInterval(()=>{window.scrollBy(0,B)},16):R.clientY<50&&(g.current=setInterval(()=>{window.scrollBy(0,-B)},16))},L=()=>{f(!1),v(),document.body.style.cursor="default",document.body.style.userSelect="auto"};return document.addEventListener("mousemove",M),document.addEventListener("mouseup",L),document.body.style.cursor="row-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",L),document.body.style.cursor="default",document.body.style.userSelect="auto",v()}},[u]);const x=M=>{M.preventDefault(),f(!0)},C=w.useMemo(()=>i?.[0]?.name??null,[i]),[k,P]=w.useState(null),D=k??C,O=w.useMemo(()=>!D||!i?void 0:i.find(L=>L.name===D)?.absolutePath,[D,i]);if(t||!e?.running)return null;if(o)return p.jsxs("div",{className:"rounded-xl border border-border overflow-hidden font-mono text-sm bg-card/50 dark:bg-zinc-900/60 backdrop-blur-sm h-[500px]",children:[p.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[p.jsx(tt,{className:"h-4 w-32"}),p.jsx(tt,{className:"h-4 w-20"})]}),p.jsx("div",{className:"p-4 space-y-3",children:[1,2,3].map(M=>p.jsx(tt,{className:"h-12 w-full rounded-lg"},M))})]});if(!i||i.length===0)return null;const T=i.length;return p.jsxs("div",{ref:m,className:"rounded-xl border border-border overflow-hidden font-mono text-sm text-foreground bg-card/50 dark:bg-zinc-900/60 backdrop-blur-sm flex flex-col shadow-sm transition-[height] duration-0 ease-linear relative group/container",style:{height:r},children:[p.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-gradient-to-r from-amber-500/10 via-transparent to-transparent dark:from-amber-500/15 shrink-0",children:[p.jsxs("div",{className:"flex items-center gap-2.5",children:[p.jsx(wi,{className:"w-4 h-4 text-amber-500"}),p.jsx("span",{className:"text-sm font-semibold tracking-tight",children:n("errorLogs.title")}),p.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:n("errorLogs.failedRequests",{count:T})})]}),p.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[p.jsx(VE,{className:"w-3.5 h-3.5"}),p.jsx("span",{children:n("errorLogs.cliproxyDiagnostics")})]})]}),p.jsx("div",{className:"flex-1 min-h-0",children:p.jsxs(Yb,{direction:"horizontal",children:[p.jsx(kc,{defaultSize:30,minSize:20,maxSize:50,className:"flex flex-col min-w-0",children:p.jsxs(Kr,{className:"h-full",children:[p.jsx("div",{className:"divide-y divide-border/50",children:i.slice(0,50).map(M=>p.jsx(PU,{name:M.name,size:M.size,modified:M.modified,isSelected:D===M.name,onClick:()=>P(M.name),statusCode:M.statusCode,model:M.model},M.name))}),i.length>50&&p.jsx("div",{className:"px-3 py-3 text-center text-[10px] text-muted-foreground border-t border-border/50",children:n("errorLogs.showingCount",{total:i.length})})]})}),p.jsxs($b,{className:"w-[1px] bg-border hover:bg-primary/50 transition-colors flex items-center justify-center group relative z-10 w-2 -ml-1 flex items-center justify-center outline-none",children:[p.jsx("div",{className:"w-[1px] h-full bg-border group-hover:bg-primary/50 transition-colors"}),p.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-4 h-8 rounded-sm flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity bg-muted border border-border",children:p.jsx(Yh,{className:"h-4 w-4 text-muted-foreground"})})]}),p.jsx(kc,{className:"flex flex-col min-w-0 bg-background/50",children:p.jsx(TU,{name:D,absolutePath:O})})]})}),s?p.jsx("div",{className:"px-4 py-2 border-t border-border text-xs text-destructive bg-destructive/5 shrink-0",children:s.message}):p.jsx("div",{className:"h-2 bg-border/10 border-t border-border/30 hover:bg-primary/10 transition-colors cursor-row-resize flex items-center justify-center group/handle shrink-0",onMouseDown:x,children:p.jsx(KE,{className:"w-8 h-3 text-border group-hover:text-primary/50 transition-colors"})})]})}const RU=Xh("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",warning:"border-yellow-200 bg-yellow-50 text-yellow-900 dark:border-yellow-900/50 dark:bg-yellow-900/20 dark:text-yellow-200 [&>svg]:text-yellow-600 dark:[&>svg]:text-yellow-500",info:"border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-900/50 dark:bg-blue-900/20 dark:text-blue-200 [&>svg]:text-blue-600 dark:[&>svg]:text-blue-500",success:"border-green-200 bg-green-50 text-green-900 dark:border-green-900/50 dark:bg-green-900/20 dark:text-green-200 [&>svg]:text-green-600 dark:[&>svg]:text-green-500"}},defaultVariants:{variant:"default"}}),lc=w.forwardRef(({className:n,variant:e,...t},i)=>p.jsx("div",{ref:i,role:"alert",className:q(RU({variant:e}),n),...t}));lc.displayName="Alert";const bh=w.forwardRef(({className:n,...e},t)=>p.jsx("h5",{ref:t,className:q("mb-1 font-medium leading-none tracking-tight",n),...e}));bh.displayName="AlertTitle";const cc=w.forwardRef(({className:n,...e},t)=>p.jsx("div",{ref:t,className:q("text-sm [&_p]:leading-relaxed",n),...e}));cc.displayName="AlertDescription";function LU(){return Lt({queryKey:["overview"],queryFn:async()=>(await fetch("/api/overview")).json()})}function AD(n,e){return typeof n=="object"&&n!==null&&"error"in n&&typeof n.error=="string"?n.error:e}function DD(n){const e=n.trim();if(!e)return null;try{return JSON.parse(e)}catch{return null}}function NU(n){const e=n.trim().toLowerCase();return e.startsWith("<!doctype html")||e.startsWith("<html")}function EU(n){if(!n||typeof n!="object")return!1;const e=n;return!(typeof e.content!="string"||"contentPath"in e&&typeof e.contentPath!="string")}async function OD(n,e){const t=await n.text(),i=DD(t);if(!n.ok){const o=AD(i,e);throw new Error(o)}if(i===null)throw new Error(e);return i}function IU(){return Lt({queryKey:["shared","summary"],queryFn:async()=>{const n=await fetch("/api/shared/summary");return OD(n,"Failed to fetch shared summary")}})}function U9(n){return Lt({queryKey:["shared",n],enabled:n!=="settings",queryFn:async()=>{if(n==="settings")return{items:[]};const e=await fetch(`/api/shared/${n}`);return OD(e,`Failed to fetch shared ${n}`)}})}function _9(n,e){return Lt({queryKey:["shared",n,"content",e],enabled:typeof e=="string"&&e.length>0,queryFn:async()=>{if(!e)throw new Error("Missing shared item path");const t=new URLSearchParams({type:n,path:e}),i=await fetch(`/api/shared/content?${t.toString()}`),o=await i.text(),s=DD(o);if(!i.ok)throw new Error(AD(s,`Failed to fetch shared ${n} content`));if(EU(s))return{content:s.content,contentPath:typeof s.contentPath=="string"&&s.contentPath.length>0?s.contentPath:e};if(o.trim().length>0){if(NU(o))throw new Error("Shared content endpoint unavailable. Restart `ccs config` and try again.");return{content:o,contentPath:e}}throw new Error(`Failed to fetch shared ${n} content`)}})}const jU={ok:"success",warning:"warning",error:"error"},BU={default:{iconBg:"bg-muted",iconColor:"text-muted-foreground"},success:{iconBg:"bg-green-600/15",iconColor:"text-green-700 dark:text-green-500"},warning:{iconBg:"bg-amber-500/15",iconColor:"text-amber-700 dark:text-amber-400"},error:{iconBg:"bg-red-600/15",iconColor:"text-red-700 dark:text-red-500"},accent:{iconBg:"bg-accent/15",iconColor:"text-accent"}};function Du({title:n,value:e,icon:t,variant:i="default",onClick:o}){const s=BU[i];return p.jsxs("button",{onClick:o,className:q("flex items-center gap-3 px-4 py-2.5 rounded-lg border bg-card/50","transition-all hover:bg-card hover:shadow-sm hover:-translate-y-0.5","active:scale-[0.98]"),children:[p.jsx("div",{className:q("flex items-center justify-center w-9 h-9 rounded-md",s.iconBg),children:p.jsx(t,{className:q("w-4 h-4",s.iconColor)})}),p.jsxs("div",{className:"text-left",children:[p.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:n}),p.jsx("p",{className:q("text-lg font-bold font-mono leading-tight",s.iconColor),children:e})]})]})}function HU(){const{t:n}=ve(),e=vb(),{data:t,isLoading:i}=LU(),{data:o,isLoading:s}=IU();if(i||s)return p.jsxs("div",{className:"p-6 space-y-6",children:[p.jsxs("div",{className:"rounded-xl border p-6 flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsx(tt,{className:"h-12 w-12 rounded-lg"}),p.jsxs("div",{children:[p.jsx(tt,{className:"h-7 w-[180px] mb-2"}),p.jsx(tt,{className:"h-4 w-[220px]"})]})]}),p.jsx("div",{className:"flex items-center gap-3",children:[1,2,3,4].map(c=>p.jsx(tt,{className:"h-14 w-28 rounded-lg"},c))})]}),p.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[p.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center justify-between",children:[p.jsx(tt,{className:"h-4 w-32"}),p.jsx(tt,{className:"h-4 w-20"})]}),p.jsx("div",{className:"px-4 py-3 border-b",children:p.jsx(tt,{className:"h-2 w-full rounded-full"})}),[1,2,3].map(c=>p.jsxs("div",{className:"px-4 py-2.5 flex items-center gap-3 border-b last:border-b-0",children:[p.jsx(tt,{className:"w-2.5 h-2.5 rounded-full"}),p.jsx(tt,{className:"h-4 flex-1"}),p.jsx(tt,{className:"h-1.5 w-24 rounded-full"}),p.jsx(tt,{className:"h-4 w-16"})]},c))]})]});const r=t?.health?jU[t.health.status]:void 0;return p.jsxs("div",{className:"p-6 space-y-6",children:[p.jsxs("div",{className:"relative overflow-hidden rounded-xl border bg-gradient-to-br from-background via-background to-muted/30",children:[p.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",children:p.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"24px 24px"}})}),p.jsxs("div",{className:"relative p-6 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[p.jsx(g5,{version:t?.version}),p.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[p.jsx(Du,{title:n("home.profiles"),value:t?.profiles??0,icon:iy,variant:"accent",onClick:()=>e("/providers")}),p.jsx(Du,{title:n("home.cliproxy"),value:t?.cliproxy??0,icon:s1,variant:"accent",onClick:()=>e("/cliproxy")}),p.jsx(Du,{title:n("home.accounts"),value:t?.accounts??0,icon:l1,variant:"default",onClick:()=>e("/accounts")}),p.jsx(Du,{title:n("home.health"),value:t?.health?`${t.health.passed}/${t.health.total}`:"-",icon:vc,variant:r,onClick:()=>e("/health")})]})]})]}),o?.symlinkStatus&&!o.symlinkStatus.valid&&p.jsxs(lc,{variant:"warning",children:[p.jsx(wi,{className:"h-4 w-4"}),p.jsx(bh,{children:n("home.configurationRequired")}),p.jsx(cc,{children:o.symlinkStatus.message})]}),p.jsx(EH,{}),p.jsx("div",{className:"rounded-xl border bg-card/70 p-5",children:p.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("div",{className:"rounded-xl bg-muted p-2.5",children:p.jsx(d1,{className:"h-5 w-5 text-muted-foreground"})}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("h2",{className:"text-lg font-semibold",children:n("homePageV2.logsMoved")}),p.jsx("p",{className:"max-w-2xl text-sm text-muted-foreground",children:"Use the unified logs page for source-level filtering, structured entry inspection, and retention policy edits without crowding the home dashboard."})]})]}),p.jsxs(ft,{variant:"outline",className:"gap-2",onClick:()=>e("/logs"),children:["Open logs",p.jsx(WE,{className:"h-4 w-4"})]})]})}),p.jsx(MU,{})]})}const TD=aE,Xb=w.forwardRef(({className:n,...e},t)=>p.jsx(ZA,{ref:t,className:q("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",n),...e}));Xb.displayName=ZA.displayName;const vh=w.forwardRef(({className:n,...e},t)=>p.jsx(e1,{ref:t,className:q("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",n),...e}));vh.displayName=e1.displayName;const gy=w.forwardRef(({className:n,...e},t)=>p.jsx(t1,{ref:t,className:q("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",n),...e}));gy.displayName=t1.displayName;function yn({className:n,...e}){return p.jsx(sE,{"data-slot":"label",className:q("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",n),...e})}const Jb="ccs:openrouter-models",UU=1440*60*1e3,MD="1";function yy(n){const e=parseFloat(n);return isNaN(e)||e===0?0:e*1e6}function rw(n){const e=yy(n);return e===0?re.t("openrouterUtils.priceFree"):e<.01?re.t("openrouterUtils.priceLessThanCent"):e<1?`$${e.toFixed(2)}`:`$${e.toFixed(e<10?2:0)}`}function _U(n){const e=rw(n.prompt),t=rw(n.completion);return e===re.t("openrouterUtils.priceFree")&&t===re.t("openrouterUtils.priceFree")?re.t("openrouterUtils.priceFree"):`${e}/${t}`}function zU(n){const e=n.id.toLowerCase();return e.startsWith("anthropic/")?"anthropic":e.startsWith("openai/")?"openai":e.startsWith("google/")?"google":e.startsWith("meta-llama/")||e.startsWith("meta/")?"meta":e.startsWith("mistralai/")?"mistral":e.includes(":free")||e.includes("qwen")||e.includes("deepseek")?"opensource":"other"}function FU(n){return{...n,category:zU(n),pricePerMillionPrompt:yy(n.pricing.prompt),pricePerMillionCompletion:yy(n.pricing.completion),isFree:n.pricing.prompt==="0"&&n.pricing.completion==="0",isExacto:n.id.includes(":exacto")}}function qU(n,e,t){const i=e.toLowerCase().trim();return n.filter(o=>t?.category&&o.category!==t.category||t?.freeOnly&&!o.isFree||t?.minContext&&o.context_length<t.minContext?!1:i?o.id.toLowerCase().includes(i)||o.name.toLowerCase().includes(i)||o.description?.toLowerCase().includes(i):!0)}function z9(n){return[...n].sort((e,t)=>{if(e.isFree&&!t.isFree)return-1;if(!e.isFree&&t.isFree)return 1;if(!e.isFree&&!t.isFree){if(e.isExacto&&!t.isExacto)return-1;if(!e.isExacto&&t.isExacto)return 1}return e.name.localeCompare(t.name)})}function GU(){try{const n=localStorage.getItem(Jb);if(!n)return null;const e=JSON.parse(n);return e.version!==MD||Date.now()-e.fetchedAt>UU?null:e.models}catch{return null}}function VU(n){try{localStorage.setItem(Jb,JSON.stringify({models:n,fetchedAt:Date.now(),version:MD}))}catch{}}function KU(){localStorage.removeItem(Jb)}function F9(n,e){const[t]=n.split("/");if(!t)return{};const i=e.filter(r=>r.id.startsWith(`${t}/`));if(i.length===0)return{};const o=[...i].sort((r,c)=>c.pricePerMillionPrompt-r.pricePerMillionPrompt),s=Math.ceil(o.length/3);return{opus:o[0]?.id,sonnet:o[Math.min(s,o.length-1)]?.id,haiku:o[o.length-1]?.id}}function WU(n){return n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${Math.round(n/1e3)}K`:String(n)}const q9={anthropic:"Anthropic (Claude)",openai:"OpenAI (GPT)",google:"Google (Gemini)",meta:"Meta (Llama)",mistral:"Mistral",opensource:"Open Source",other:"Other"},QU={anthropic:["anthropic/"],openai:["openai/"],google:["google/"],meta:["meta-llama/","meta/"],mistral:["mistralai/"],opensource:["deepseek/","qwen/","cohere/"],other:[]};function YU(n,e=2){const t=[],i=["anthropic","openai","google","meta","mistral","opensource"];for(const o of i){const s=QU[o];if(s.length===0)continue;const c=[...n.filter(u=>s.some(f=>u.id.toLowerCase().startsWith(f)))].sort((u,f)=>(f.created??0)-(u.created??0));t.push(...c.slice(0,e))}return t.sort((o,s)=>(s.created??0)-(o.created??0))}function $U(n){const t=Date.now()/1e3-n;return t<86400?re.t("openrouterUtils.ageToday"):t<172800?re.t("openrouterUtils.ageYesterday"):t<604800?re.t("openrouterUtils.ageDaysAgo",{count:Math.floor(t/86400)}):t<2592e3?re.t("openrouterUtils.ageWeeksAgo",{count:Math.floor(t/604800)}):t<31536e3?re.t("openrouterUtils.ageMonthsAgo",{count:Math.floor(t/2592e3)}):re.t("openrouterUtils.ageYearsAgo",{count:Math.floor(t/31536e3)})}const XU="https://openrouter.ai/api/v1/models",RD=["openrouter-models"],lw=1440*60*1e3;async function JU(){const n=await fetch(XU);if(!n.ok)throw new Error(`Failed to fetch OpenRouter models: ${n.status}`);const t=(await n.json()).data;return VU(t),t}function LD(){return Lt({queryKey:RD,queryFn:JU,staleTime:lw,gcTime:lw,initialData:()=>GU()??void 0,refetchOnWindowFocus:!1})}function ZU(){const n=LD(),e=(n.data??[]).map(FU);return{...n,models:e}}function G9(){const n=mt();return()=>(KU(),n.invalidateQueries({queryKey:RD}))}function V9(){const{data:n,isLoading:e,isError:t}=LD();return{isReady:!!n&&n.length>0,isLoading:e,isError:t,modelCount:n?.length??0}}function Zb({profileEnv:n={}}){const{t:e}=ve(),[t,i]=w.useState(null),[o,s]=w.useState(!0),[r,c]=w.useState(!1);w.useEffect(()=>{u()},[]);const u=async()=>{try{s(!0);const x=await fetch("/api/global-env");if(!x.ok)throw new Error("Failed to load");const C=await x.json();i(C)}catch{i(null)}finally{s(!1)}};if(o||!t?.enabled)return null;const f=t.env||{},m=Object.keys(f);if(m.length===0)return null;const g=m.filter(x=>!(x in n)),v=m.filter(x=>x in n);return p.jsxs("div",{className:"border-t bg-muted/20",children:[p.jsxs("button",{onClick:()=>c(!r),className:"w-full px-4 py-2 flex items-center gap-2 hover:bg-muted/30 transition-colors",children:[p.jsx($h,{className:"w-4 h-4 text-blue-500"}),p.jsxs("span",{className:"text-xs text-muted-foreground flex-1 text-left",children:[e("globalEnvIndicator.injectedCount",{count:g.length}),v.length>0&&p.jsx("span",{className:"text-amber-600 dark:text-amber-400 ml-1",children:e("globalEnvIndicator.overriddenCount",{count:v.length})})]}),r?p.jsx(Cb,{className:"w-4 h-4 text-muted-foreground"}):p.jsx(Qh,{className:"w-4 h-4 text-muted-foreground"})]}),r&&p.jsxs("div",{className:"px-4 pb-3 space-y-2",children:[g.length>0&&p.jsx("div",{className:"space-y-1",children:g.map(x=>p.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono bg-green-500/10 text-green-700 dark:text-green-400 px-2 py-1 rounded",children:[p.jsx("span",{className:"text-green-500",children:"+"}),p.jsxs("span",{className:"truncate",children:[x,"=",f[x]]})]},x))}),v.length>0&&p.jsxs("div",{className:"space-y-1",children:[p.jsx("p",{className:"text-xs text-muted-foreground",children:e("globalEnvIndicator.skippedLabel")}),v.map(x=>p.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono bg-amber-500/10 text-amber-700 dark:text-amber-400 px-2 py-1 rounded",children:[p.jsx("span",{className:"text-amber-500",children:"~"}),p.jsx("span",{className:"truncate",children:x})]},x))]}),p.jsx("div",{className:"pt-2 border-t border-border/50",children:p.jsx(ft,{variant:"ghost",size:"sm",asChild:!0,className:"h-7 text-xs gap-1.5 -ml-2",children:p.jsxs(uh,{to:"/settings?tab=globalenv",children:[p.jsx(kb,{className:"w-3.5 h-3.5"}),e("globalEnvIndicator.configureInSettings"),p.jsx(f1,{className:"w-3 h-3 opacity-50"})]})})})]})]})}function e_({className:n,...e}){return p.jsx(rE,{"data-slot":"switch",className:q("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",n),...e,children:p.jsx(lE,{"data-slot":"switch-thumb",className:q("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}function t_(n,e,t){return n(t==="refreshing"?"imageAnalysisStatus.refreshingPreview":t==="invalid"?"imageAnalysisStatus.savedStatus":e==="editor"?"imageAnalysisStatus.livePreview":"imageAnalysisStatus.savedStatus")}function n_(n,e,t){return e.status==="disabled"?n("imageAnalysisStatus.disabledGlobally"):t!=="claude"?n("imageAnalysisStatus.targetBypassesHook",{target:n(`imageAnalysisStatus.targetLabel.${t}`)}):e.nativeReadPreference?n("imageAnalysisStatus.nativeImageReading"):e.status==="hook-missing"?n("imageAnalysisStatus.setupNeeded"):e.authReadiness==="missing"?n("imageAnalysisStatus.needsAuth"):e.proxyReadiness==="unavailable"?n("imageAnalysisStatus.needsProxy"):e.effectiveRuntimeMode==="native-read"?n("imageAnalysisStatus.nativeFallback"):n("imageAnalysisStatus.transformerReady")}function i_(n,e,t){return e.status==="disabled"?{label:n("imageAnalysisStatus.badgeDisabled"),className:"border-border/80 bg-background/85 text-muted-foreground"}:t!=="claude"?{label:n("imageAnalysisStatus.badgeBypassed"),className:"border-sky-500/25 bg-sky-500/10 text-sky-800 dark:text-sky-200"}:e.nativeReadPreference?{label:n("imageAnalysisStatus.badgeNative"),className:"border-emerald-500/25 bg-emerald-500/10 text-emerald-800 dark:text-emerald-200"}:e.status==="hook-missing"||e.authReadiness==="missing"?{label:e.status==="hook-missing"?n("imageAnalysisStatus.badgeSetup"):n("imageAnalysisStatus.badgeAuth"),className:"border-amber-500/25 bg-amber-500/10 text-amber-800 dark:text-amber-200"}:e.proxyReadiness==="unavailable"?{label:n("imageAnalysisStatus.badgeProxy"),className:"border-amber-500/25 bg-amber-500/10 text-amber-800 dark:text-amber-200"}:{label:n("imageAnalysisStatus.badgeReady"),className:"border-emerald-500/25 bg-emerald-500/10 text-emerald-800 dark:text-emerald-200"}}function o_(n,e,t){if(e.nativeReadPreference)return e.profileModel&&e.nativeImageCapable?n("imageAnalysisStatus.toggleSummaryNativeCapable",{model:e.profileModel}):e.profileModel?n("imageAnalysisStatus.toggleSummaryNativeModel",{model:e.profileModel}):n("imageAnalysisStatus.toggleSummaryNativeDefault");if(!e.backendDisplayName&&t==="claude")return n("imageAnalysisStatus.toggleSummaryNativeFileAccess");if(!e.backendDisplayName)return n("imageAnalysisStatus.toggleSummaryInactiveTarget",{target:n(`imageAnalysisStatus.targetLabel.${t}`)});const i=e.model?` · ${e.model}`:"";return n("imageAnalysisStatus.toggleSummaryTransformerRoute",{backend:e.backendDisplayName,modelSuffix:i})}function a_(n,e,t){return e.status==="disabled"?n("imageAnalysisStatus.noteDisabledGlobally"):t!=="claude"?n("imageAnalysisStatus.noteTargetBypassesHook",{target:n(`imageAnalysisStatus.targetLabel.${t}`)}):e.nativeReadPreference?e.nativeImageCapable===!0?null:e.nativeImageReason:e.status==="hook-missing"?n("imageAnalysisStatus.notePersistHook"):e.authReadiness==="missing"?e.authReason:e.proxyReadiness==="unavailable"?e.proxyReason:null}function s_({status:n,target:e="claude",source:t="saved",previewState:i="saved",nativeReadPreferenceOverride:o,onToggleNativeRead:s}){const{t:r}=ve();if(!n)return p.jsxs("div",{className:"rounded-2xl border bg-muted/20 px-4 py-3","aria-live":"polite",children:[p.jsx("div",{className:"h-4 w-24 animate-pulse rounded bg-muted"}),p.jsx("div",{className:"mt-2 h-3 w-52 animate-pulse rounded bg-muted"})]});const c=o??n.nativeReadPreference,u={...n,nativeReadPreference:c},f=i_(r,u,e),m=a_(r,u,e),g=n.nativeImageCapable?r("imageAnalysisStatus.capabilityVerified"):n.profileModel?r("imageAnalysisStatus.capabilityUnknown"):null;return p.jsxs("section",{className:"rounded-2xl border bg-background/95 px-4 py-3 shadow-sm",children:[p.jsxs("div",{className:"flex items-start justify-between gap-3",children:[p.jsx("div",{className:"min-w-0",children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:"inline-flex h-8 w-8 items-center justify-center rounded-xl border border-sky-500/20 bg-sky-500/10 text-sky-700 dark:text-sky-300",children:p.jsx(b1,{className:"h-4 w-4"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx("h3",{className:"text-sm font-semibold",children:r("imageAnalysisStatus.sectionTitle")}),p.jsx(Qt,{className:q("h-5 border px-1.5 text-[10px]",f.className),children:f.label})]}),p.jsxs("p",{className:"text-xs text-muted-foreground",children:[t_(r,t,i)," ·"," ",n_(r,u,e)]})]})]})}),p.jsx(ft,{size:"sm",variant:"outline",className:"h-8 shrink-0",asChild:!0,children:p.jsxs(uh,{to:"/settings?tab=image",children:[r("imageAnalysisStatus.openSettings"),p.jsx(y1,{className:"ml-1 h-3.5 w-3.5"})]})})]}),p.jsx("div",{className:"mt-3 rounded-xl border bg-muted/15 px-3 py-3",children:p.jsxs("div",{className:"flex items-start justify-between gap-3",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx("div",{className:"text-sm font-medium text-foreground",children:r("imageAnalysisStatus.useNativeImageReading")}),g&&p.jsx(Qt,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:g})]}),p.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:o_(r,u,e)})]}),p.jsx(e_,{checked:c,onCheckedChange:s,disabled:!s,"aria-label":r("imageAnalysisStatus.useNativeImageReading")})]})}),m&&p.jsx("div",{className:"mt-2 rounded-lg border border-border/70 bg-muted/20 px-3 py-2 text-xs leading-5 text-muted-foreground",children:m})]})}const r_=w.lazy(()=>lt(()=>Promise.resolve().then(()=>Lf),void 0).then(n=>({default:n.CodeEditor})));function K9({rawJsonContent:n,isRawJsonValid:e,rawJsonEdits:t,settings:i,profileTarget:o="claude",imageAnalysisStatus:s,imageAnalysisStatusSource:r="saved",imageAnalysisStatusPreviewState:c="saved",nativeReadPreferenceOverride:u,onToggleNativeRead:f,onChange:m,missingRequiredFields:g=[]}){const{t:v}=ve(),x=g.length>0;return p.jsx(w.Suspense,{fallback:p.jsxs("div",{className:"flex items-center justify-center h-full",children:[p.jsx(hi,{className:"w-6 h-6 animate-spin text-muted-foreground"}),p.jsx("span",{className:"ml-2 text-muted-foreground",children:v("profileEditorSections.loadingEditor")})]}),children:p.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!e&&t!==null&&p.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[p.jsx(Vr,{className:"w-4 h-4"}),v("profileEditor.invalidJson")]}),e&&x&&p.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[p.jsx(wi,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),p.jsxs("div",{children:[p.jsxs("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:[v("profileEditor.missingFields"),":"]})," ",p.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:g.join(", ")}),p.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:v("profileEditor.missingFieldsHint")})]})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:p.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:p.jsx(r_,{value:n,onChange:m,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),p.jsx("div",{className:"mx-6 mb-4",children:p.jsx(s_,{status:s,target:o,source:r,previewState:c,nativeReadPreferenceOverride:u,onToggleNativeRead:f})}),p.jsx("div",{className:"mx-6 mb-4",children:p.jsx("div",{className:"border rounded-md overflow-hidden",children:p.jsx(Zb,{profileEnv:i?.env})})})]})})}function cw(n,e){try{var t=n()}catch(i){return e(i)}return t&&t.then?t.then(void 0,e):t}function l_(n,e){for(var t={};n.length;){var i=n[0],o=i.code,s=i.message,r=i.path.join(".");if(!t[r])if("unionErrors"in i){var c=i.unionErrors[0].errors[0];t[r]={message:c.message,type:c.code}}else t[r]={message:s,type:o};if("unionErrors"in i&&i.unionErrors.forEach(function(m){return m.errors.forEach(function(g){return n.push(g)})}),e){var u=t[r].types,f=u&&u[i.code];t[r]=v1(r,e,t,o,f?[].concat(f,i.message):i.message)}n.shift()}return t}function c_(n,e){for(var t={};n.length;){var i=n[0],o=i.code,s=i.message,r=i.path.join(".");if(!t[r])if(i.code==="invalid_union"&&i.errors.length>0){var c=i.errors[0][0];t[r]={message:c.message,type:c.code}}else t[r]={message:s,type:o};if(i.code==="invalid_union"&&i.errors.forEach(function(m){return m.forEach(function(g){return n.push(g)})}),e){var u=t[r].types,f=u&&u[i.code];t[r]=v1(r,e,t,o,f?[].concat(f,i.message):i.message)}n.shift()}return t}function d_(n,e,t){if(t===void 0&&(t={}),(function(i){return"_def"in i&&typeof i._def=="object"&&"typeName"in i._def})(n))return function(i,o,s){try{return Promise.resolve(cw(function(){return Promise.resolve(n[t.mode==="sync"?"parse":"parseAsync"](i,e)).then(function(r){return s.shouldUseNativeValidation&&ok({},s),{errors:{},values:t.raw?Object.assign({},i):r}})},function(r){if((function(c){return Array.isArray(c?.issues)})(r))return{values:{},errors:ak(l_(r.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw r}))}catch(r){return Promise.reject(r)}};if((function(i){return"_zod"in i&&typeof i._zod=="object"})(n))return function(i,o,s){try{return Promise.resolve(cw(function(){return Promise.resolve((t.mode==="sync"?II:jI)(n,i,e)).then(function(r){return s.shouldUseNativeValidation&&ok({},s),{errors:{},values:t.raw?Object.assign({},i):r}})},function(r){if((function(c){return c instanceof BI})(r))return{values:{},errors:ak(c_(r.issues,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw r}))}catch(r){return Promise.reject(r)}};throw new Error("Invalid input: not a Zod schema")}const u_={sm:{container:"w-6 h-6",icon:"w-4 h-4",text:"text-xs"},md:{container:"w-8 h-8",icon:"w-5 h-5",text:"text-sm"},lg:{container:"w-12 h-12",icon:"w-8 h-8",text:"text-lg"}};function h_({provider:n,className:e,size:t="md"}){const i=zB(n),o=u_[t],s=F1(n),r=qB(n);return p.jsx("div",{className:q("flex items-center justify-center rounded-md",s&&!r&&(FB(n)?"bg-gray-900 p-1":"bg-white p-1"),o.container,e),children:s?p.jsx("img",{src:s,alt:`${n} logo`,className:q(r?o.container:o.icon,"object-contain")}):p.jsx("span",{className:q("font-semibold",i.textClass,o.text),children:i.letter})})}function W9(){return Lt({queryKey:["profiles"],queryFn:()=>je.profiles.list()})}function f_(){const n=mt(),{t:e}=ve();return rt({mutationFn:t=>je.profiles.create(t),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),fe.success(e("toasts.profileCreated"))},onError:t=>{fe.error(t.message)}})}function Q9(){const n=mt(),{t:e}=ve();return rt({mutationFn:t=>je.profiles.delete(t),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),fe.success(e("toasts.profileDeleted"))},onError:t=>{fe.error(t.message)}})}function Y9(){return rt({mutationFn:()=>je.profiles.discoverOrphans()})}function $9(){const n=mt(),{t:e}=ve();return rt({mutationFn:t=>je.profiles.registerOrphans(t),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),fe.success(e("toasts.orphanProfilesComplete"))}})}function X9(){const n=mt(),{t:e}=ve();return rt({mutationFn:({name:t,data:i})=>je.profiles.copy(t,i),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),fe.success(e("toasts.profileCopied"))}})}function J9(){return rt({mutationFn:({name:n,includeSecrets:e})=>je.profiles.export(n,e??!1)})}function Z9(){const n=mt(),{t:e}=ve();return rt({mutationFn:t=>je.profiles.import(t),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),fe.success(e("toasts.profileImported"))}})}const p_="https://openrouter.ai/api",m_="https://api.orcarouter.ai/v1",ND=Object.freeze({glmt:"glm",kimi:"km",alibaba:"alibaba-coding-plan",acp:"alibaba-coding-plan",hf:"huggingface",te:"tuningengines",tuning:"tuningengines"}),ED=[{id:"openrouter",name:"OpenRouter",description:"349+ models from OpenAI, Anthropic, Google, Meta",baseUrl:p_,defaultProfileName:"openrouter",defaultModel:"anthropic/claude-opus-4.5",apiKeyPlaceholder:"sk-or-...",apiKeyHint:"Get your API key at openrouter.ai/keys",category:"recommended",requiresApiKey:!0,badge:"349+ models",featured:!0,icon:"/icons/openrouter.svg"},{id:"orcarouter",name:"OrcaRouter",description:"188+ models from OpenAI, Anthropic, Google, Meta via auto-routing gateway",baseUrl:m_,defaultProfileName:"orcarouter",defaultModel:"openai/gpt-5.5",apiKeyPlaceholder:"sk-orca-...",apiKeyHint:"Get your API key at orcarouter.ai/console",category:"recommended",requiresApiKey:!0,badge:"188+ models",featured:!0,icon:"/icons/orcarouter.svg"},{id:"alibaba-coding-plan",name:"Alibaba Coding Plan",description:"Alibaba Cloud Coding Plan via Anthropic-compatible endpoint",baseUrl:"https://coding-intl.dashscope.aliyuncs.com/apps/anthropic",defaultProfileName:"albb",defaultModel:"qwen3-coder-plus",apiKeyPlaceholder:"sk-sp-...",apiKeyHint:"Get your Coding Plan key from Alibaba Cloud Model Studio",category:"recommended",requiresApiKey:!0,badge:"Coding Plan",featured:!0,icon:"/assets/providers/alibabacloud-color.svg"},{id:"ollama",name:"Ollama (Local)",description:"Local open-source models via Ollama (32K+ context)",baseUrl:"http://localhost:11434",defaultProfileName:"ollama",defaultModel:"qwen3-coder",apiKeyPlaceholder:"ollama",apiKeyHint:"Install Ollama from ollama.com - no API key needed for local",category:"recommended",requiresApiKey:!1,badge:"Local",featured:!0,icon:"/icons/ollama.svg"},{id:"llamacpp",name:"llama.cpp (Local)",description:"Local inference via llama.cpp (LLaMA models)",baseUrl:"http://127.0.0.1:8080",defaultProfileName:"llamacpp",defaultModel:"llama3-8b",apiKeyPlaceholder:"llamacpp",apiKeyHint:"Run llama.cpp server: ./server --host 0.0.0.0 --port 8080 -m model.gguf",category:"recommended",requiresApiKey:!1,badge:"Local",featured:!0,icon:"/assets/providers/llama-cpp.svg"},{id:"anthropic",name:"Anthropic (Direct API)",description:"Use your own Anthropic API key (sk-ant-...)",baseUrl:"",defaultProfileName:"anthropic",defaultModel:"claude-sonnet-4-5-20250929",apiKeyPlaceholder:"sk-ant-api03-...",apiKeyHint:"Get key at console.anthropic.com/settings/keys",category:"recommended",requiresApiKey:!0,badge:"Direct",featured:!0,icon:"/assets/providers/claude.svg"},{id:"huggingface",name:"Hugging Face",description:"Inference Providers router via OpenAI-compatible chat completions",baseUrl:"https://router.huggingface.co/v1",defaultProfileName:"hf",defaultModel:"openai/gpt-oss-120b:fastest",apiKeyPlaceholder:"hf_...",apiKeyHint:"Create a User Access Token at hf.co/settings/tokens",category:"alternative",requiresApiKey:!0,defaultTarget:"droid",badge:"Router"},{id:"tuningengines",name:"Tuning Engines",description:"OpenAI-compatible chat completions gateway",baseUrl:"https://api.tuningengines.com/v1",defaultProfileName:"te",defaultModel:"gpt-4o",apiKeyPlaceholder:"sk-te-...",apiKeyHint:"Create an inference key at app.tuningengines.com/inference/keys",category:"alternative",requiresApiKey:!0,defaultTarget:"droid",badge:"Gateway"},{id:"glm",name:"GLM",description:"Direct Z.AI Anthropic-compatible API profile",baseUrl:"https://api.z.ai/api/anthropic",defaultProfileName:"glm",defaultModel:"glm-5.2",apiKeyPlaceholder:"ghp_...",apiKeyHint:"Get your API key from Z.AI",category:"alternative",requiresApiKey:!0,badge:"Z.AI",icon:"/icons/zai.svg"},{id:"km",name:"Kimi",description:"Kimi Code membership API with stable latest-coding model alias",baseUrl:"https://api.kimi.com/coding/",defaultProfileName:"km",defaultModel:"kimi-for-coding",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key from the Kimi Code Console",category:"alternative",requiresApiKey:!0,alwaysThinkingEnabled:!0,badge:"Kimi Code",icon:"/icons/kimi.svg"},{id:"foundry",name:"Azure Foundry",description:"Claude via Microsoft Azure AI Foundry",baseUrl:"https://<your-resource>.services.ai.azure.com/api/anthropic",defaultProfileName:"foundry",defaultModel:"claude-sonnet-4-5",apiKeyPlaceholder:"YOUR_AZURE_API_KEY",apiKeyHint:"Create resource at ai.azure.com, get API key from Keys tab",category:"alternative",requiresApiKey:!0,badge:"Azure",icon:"/icons/azure.svg"},{id:"mm",name:"Minimax",description:"M3 frontier multimodal coding model with 1M context",baseUrl:"https://api.minimax.io/anthropic",defaultProfileName:"mm",defaultModel:"MiniMax-M3",apiKeyPlaceholder:"YOUR_MINIMAX_API_KEY_HERE",apiKeyHint:"Get your API key at platform.minimax.io",category:"alternative",requiresApiKey:!0,badge:"1M context",icon:"/icons/minimax.svg"},{id:"deepseek",name:"DeepSeek",description:"V3.2 and R1 reasoning model (128K context)",baseUrl:"https://api.deepseek.com/anthropic",defaultProfileName:"deepseek",defaultModel:"deepseek-chat",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key at platform.deepseek.com",category:"alternative",requiresApiKey:!0,badge:"Reasoning",icon:"/icons/deepseek.svg"},{id:"qwen",name:"Qwen",description:"Alibaba Cloud - Qwen3 models (256K-1M context, thinking support)",baseUrl:"https://dashscope-intl.aliyuncs.com/apps/anthropic",defaultProfileName:"qwen-api",defaultModel:"qwen3-coder-plus",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key from Alibaba Cloud Model Studio",category:"alternative",requiresApiKey:!0,badge:"Alibaba",icon:"/assets/providers/qwen-color.svg"},{id:"ollama-cloud",name:"Ollama Cloud",description:"Ollama cloud models via direct API (glm-5:cloud, minimax-m2.1:cloud)",baseUrl:"https://ollama.com",defaultProfileName:"ollama-cloud",defaultModel:"glm-5:cloud",apiKeyPlaceholder:"YOUR_OLLAMA_CLOUD_API_KEY",apiKeyHint:"Get your API key at ollama.com",category:"alternative",requiresApiKey:!0,badge:"Cloud",icon:"/icons/ollama.svg"},{id:"novita",name:"Novita AI",description:"Anthropic-compatible API for Claude Code and CCS profiles",baseUrl:"https://api.novita.ai/anthropic",defaultProfileName:"novita",defaultModel:"deepseek/deepseek-v3.2",apiKeyPlaceholder:"YOUR_NOVITA_API_KEY",apiKeyHint:"Get your API key at novita.ai",category:"alternative",requiresApiKey:!0,badge:"Anthropic-compatible",icon:"/icons/novita.svg"},{id:"fireworks",name:"Fireworks AI",description:"Anthropic-compatible inference (Kimi, Qwen, Llama) via api.fireworks.ai",baseUrl:"https://api.fireworks.ai/inference",defaultProfileName:"fireworks",defaultModel:"accounts/fireworks/models/kimi-k2p5",apiKeyPlaceholder:"fw_...",apiKeyHint:"Get your API key at fireworks.ai/api-keys",category:"alternative",requiresApiKey:!0,badge:"Anthropic-compatible"},{id:"requesty",name:"Requesty",description:"OpenAI-compatible LLM gateway (provider/model naming, e.g. openai/gpt-4o-mini)",baseUrl:"https://router.requesty.ai/v1",defaultProfileName:"requesty",defaultModel:"openai/gpt-4o-mini",apiKeyPlaceholder:"rqsty-sk-...",apiKeyHint:"Create an API key at app.requesty.ai/api-keys",category:"alternative",requiresApiKey:!0,badge:"OpenAI-compatible"}];function ID(n){return{...n,extraEnv:n.extraEnv?{...n.extraEnv}:void 0}}function g_(n){const e=ID(n);return e.extraEnv&&Object.freeze(e.extraEnv),Object.freeze(e)}function y_(n,e){const t=new Set;for(const o of n){const s=o.id.trim().toLowerCase();if(o.id!==s)throw new Error(`Preset ID must be normalized: "${o.id}"`);if(t.has(o.id))throw new Error(`Duplicate preset ID detected: "${o.id}"`);t.add(o.id)}const i=new Set;for(const[o,s]of Object.entries(e)){const r=o.trim().toLowerCase();if(!r)throw new Error("Preset alias keys cannot be empty");if(o!==r)throw new Error(`Preset alias must be normalized: "${o}"`);if(i.has(r))throw new Error(`Duplicate normalized preset alias detected: "${o}"`);if(i.add(r),!t.has(s))throw new Error(`Preset alias "${o}" points to unknown target "${s}"`);if(t.has(r))throw new Error(`Preset alias "${o}" collides with canonical preset ID "${r}"`)}}y_(ED,ND);const b_=Object.freeze(ED.map(g_));function v_(){return b_.map(ID)}function x_(n){const e=n.trim().toLowerCase();return ND[e]||e}const C_=v_(),ev=Object.freeze(C_.map(n=>({...n})));function S_(n,e){return e||(n?.requiresApiKey===!1?n.apiKeyPlaceholder||n.id:"")}function k_(n){return ev.filter(e=>e.category===n)}function pg(n){const e=x_(n);return ev.find(t=>t.id===e)}const w_=ca().refine(n=>n.trim().length===0||ca().url().safeParse(n).success,{message:"Invalid URL format"}),P_=HI({name:ca().min(1,"Name is required").regex(/^[a-zA-Z][a-zA-Z0-9._-]*$/,"Must start with letter, only letters/numbers/.-_"),baseUrl:w_,apiKey:ca(),model:ca().optional(),opusModel:ca().optional(),sonnetModel:ca().optional(),haikuModel:ca().optional(),target:UI(["claude","droid","codex"])}),A_=["/chat/completions","/v1/messages","/messages","/completions"],Xa="custom",mg="openrouter",jD=new Set(["ollama","llamacpp"]),gg={name:"",baseUrl:"",apiKey:"",model:"",opusModel:"",sonnetModel:"",haikuModel:"",target:"claude"},BD=k_("recommended"),D_=BD.filter(n=>!jD.has(n.id)),O_=BD.filter(n=>jD.has(n.id)),T_=ev.filter(n=>n.category!=="recommended");function eQ({open:n,onOpenChange:e,onSuccess:t,initialMode:i="openrouter"}){const{t:o}=ve(),s=f_(),[r,c]=w.useState("basic"),[u,f]=w.useState(null),[m,g]=w.useState(!1),[v,x]=w.useState(mg),[C,k]=w.useState(""),{models:P}=ZU(),{register:D,handleSubmit:O,formState:{errors:T},control:M,reset:L,setValue:R}=_I({resolver:d_(P_),defaultValues:gg}),I=sk({control:M,name:"baseUrl"}),W=sk({control:M,name:"target"}),_=w.useCallback(Y=>{if(!Y){L(gg);return}L({...gg,name:Y.defaultProfileName,baseUrl:Y.baseUrl,model:Y.defaultModel,opusModel:Y.defaultModel,sonnetModel:Y.defaultModel,haikuModel:Y.defaultModel,target:Y.defaultTarget??"claude"})},[L]),z=w.useMemo(()=>v===Xa?null:pg(v)??null,[v]),$=w.useMemo(()=>C.trim()?[...qU(P,C)].sort((se,ue)=>(ue.created??0)-(se.created??0)).slice(0,20):YU(P,2),[P,C]);w.useEffect(()=>{if(n)if(c("basic"),f(null),g(!1),k(""),i==="normal")x(Xa),_(null);else{const se=pg(i==="openrouter"?mg:i);if(se){x(se.id),_(se);return}x(Xa),_(null)}},[n,i,_,L]);const F=Y=>{const se=pg(Y);if(se){x(se.id),_(se);return}x(Xa),_(null)},B=Y=>{R("model",Y.id),R("opusModel",Y.id),R("sonnetModel",Y.id),R("haikuModel",Y.id),k(Y.name),fe.success(o("profileCreateDialog.appliedModelToTiers",{model:Y.name}),{duration:2e3})};w.useEffect(()=>{if(I&&v===Xa){const se=I.toLowerCase();for(const ue of A_)if(se.endsWith(ue)){const be=I.replace(new RegExp(ue+"$","i"),"");f(`URL ends with "${ue}" - Claude appends this automatically. You likely want: ${be}`);return}}f(null)},[I,v]);const ie=async Y=>{if(z?.requiresApiKey!==!1&&!Y.apiKey){fe.error(re.t("commonToast.apiKeyRequired"));return}const se={...Y,apiKey:S_(z,Y.apiKey)};try{await s.mutateAsync(se),fe.success(o("profileCreateDialog.profileCreated",{name:se.name})),t(se.name),e(!1)}catch(ue){fe.error(ue.message||o("profileCreateDialog.failedCreate"))}},oe=!!T.name||!!T.baseUrl||!!T.apiKey,H=!!T.model||!!T.opusModel||!!T.sonnetModel||!!T.haikuModel,Z=s.isPending,ae=z?.id===mg;return p.jsx(Nb,{open:n,onOpenChange:e,children:p.jsxs(Eb,{"data-testid":"profile-create-dialog",className:"h-[calc(100dvh-2rem)] max-h-[900px] gap-0 overflow-hidden p-0 sm:max-w-[700px] !flex !flex-col",children:[p.jsxs(Ib,{className:"shrink-0 border-b p-6 pb-4",children:[p.jsxs(jb,{className:"flex items-center gap-2",children:[p.jsx(ek,{className:"w-5 h-5 text-primary"}),o("profileCreateDialog.createProfile")]}),p.jsx(Bb,{children:o("profileCreateDialog.chooseProviderHint")})]}),p.jsxs("form",{onSubmit:O(ie),className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[p.jsx("div",{"data-testid":"profile-create-provider-chooser",className:"max-h-[34dvh] shrink-0 space-y-3 overflow-y-auto overscroll-contain border-b bg-muted/10 px-6 py-3",children:p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"flex items-start justify-between gap-4",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx(yn,{className:"text-xs text-muted-foreground",children:o("profileEditor.provider")}),p.jsx("p",{className:"text-xs text-muted-foreground",children:o("profileEditor.providerChooserHint")})]}),p.jsx("span",{className:"pt-0.5 text-[11px] text-muted-foreground",children:o("profileEditor.scrollHint")})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:o("profileEditor.featuredProviders")}),p.jsx("div",{className:"-mx-1 overflow-x-auto pb-1",children:p.jsxs("div",{className:"flex min-w-max items-stretch gap-2 px-1",children:[D_.map(Y=>p.jsx(yg,{preset:Y,isSelected:v===Y.id,onClick:()=>F(Y.id),density:"featured"},Y.id)),p.jsx("div",{className:"mx-1 hidden w-px rounded-full bg-border/70 sm:block"}),p.jsx(M_,{isSelected:v===Xa,onClick:()=>F(Xa)})]})})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:o("profileEditor.morePresets")}),p.jsx("div",{className:"-mx-1 overflow-x-auto pb-1",children:p.jsx("div",{className:"flex min-w-max items-stretch gap-2 px-1",children:T_.map(Y=>p.jsx(yg,{preset:Y,isSelected:v===Y.id,onClick:()=>F(Y.id),density:"compact"},Y.id))})})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:o("openrouterQuickStart.localRuntimesTitle")}),p.jsx("div",{className:"flex flex-wrap gap-2",children:O_.map(Y=>p.jsx(yg,{preset:Y,isSelected:v===Y.id,onClick:()=>F(Y.id),density:"compact"},Y.id))})]})]})}),p.jsxs(TD,{value:r,onValueChange:c,className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[p.jsx("div",{className:"px-6 pt-4",children:p.jsxs(Xb,{className:"grid w-full grid-cols-2",children:[p.jsxs(vh,{value:"basic",className:"relative",children:[o("profileCreateDialog.basicInformation"),oe&&p.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]}),p.jsxs(vh,{value:"models",className:"relative",children:[o("profileCreateDialog.modelConfiguration"),H&&p.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]})]})}),p.jsxs("div",{"data-testid":"profile-create-tab-scroll",className:"flex-1 min-h-0 overflow-y-auto",children:[p.jsxs(gy,{value:"basic",className:"p-6 space-y-4 mt-0",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"name",children:[o("profileDialog.name")," ",p.jsx("span",{className:"text-destructive",children:"*"})]}),p.jsx(Hi,{id:"name",...D("name"),placeholder:o("profileDialog.namePlaceholder"),className:"font-mono"}),T.name?p.jsx("p",{className:"text-xs text-destructive",children:T.name.message}):p.jsxs("p",{className:"text-xs text-muted-foreground",children:[o("profileCreateDialog.usedInCli")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:'ccs my-api "prompt"'})]})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(yn,{htmlFor:"baseUrl",children:o("profileCreateDialog.apiBaseUrl")}),p.jsx(Hi,{id:"baseUrl",...D("baseUrl"),placeholder:o("profileCreateDialog.baseUrlPlaceholder")}),T.baseUrl?p.jsx("p",{className:"text-xs text-destructive",children:T.baseUrl.message}):u?p.jsxs("div",{className:"flex items-start gap-2 text-xs text-yellow-600 bg-yellow-50 dark:bg-yellow-900/20 p-2 rounded",children:[p.jsx(wi,{className:"w-4 h-4 shrink-0 mt-0.5"}),p.jsx("span",{children:u})]}):z?p.jsx("p",{className:"text-xs text-muted-foreground",children:z.baseUrl?o("profileCreateDialog.prefilledFromPreset",{name:z.name}):o("profileCreateDialog.optionalForPreset",{name:z.name})}):p.jsx("p",{className:"text-xs text-muted-foreground",children:o("profileCreateDialog.endpointHint")})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"apiKey",children:[o("profileDialog.apiKey")," ",z?.requiresApiKey!==!1&&p.jsx("span",{className:"text-destructive",children:"*"}),z?.requiresApiKey===!1&&p.jsx("span",{className:"text-muted-foreground text-xs font-normal",children:o("profileCreateDialog.optional")})]}),p.jsxs("div",{className:"relative",children:[p.jsx(Hi,{id:"apiKey",type:m?"text":"password",...D("apiKey"),placeholder:z?.requiresApiKey===!1?o("profileCreateDialog.apiKeyOptionalPlaceholder"):z?.apiKeyPlaceholder??o("profileCreateDialog.apiKeyPlaceholder"),className:"pr-10"}),p.jsx(ft,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-9 w-9 text-muted-foreground hover:text-foreground",onClick:()=>g(!m),tabIndex:-1,children:m?p.jsx(Kc,{className:"h-4 w-4"}):p.jsx(Wc,{className:"h-4 w-4"})})]}),T.apiKey?p.jsx("p",{className:"text-xs text-destructive",children:T.apiKey.message}):z?.requiresApiKey===!1?p.jsx("p",{className:"text-xs text-muted-foreground",children:o("profileCreateDialog.apiKeyOptionalHint")}):z?.apiKeyHint&&p.jsx("p",{className:"text-xs text-muted-foreground",children:z.apiKeyHint})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(yn,{htmlFor:"target",children:o("codex.defaultTargetCli")}),p.jsxs(q1,{value:W,onValueChange:Y=>R("target",Y),children:[p.jsx(zb,{id:"target",children:p.jsx(G1,{})}),p.jsxs(Fb,{children:[p.jsx(rc,{value:"claude",children:o("profileCard.claudeCodeDefault")}),p.jsx(rc,{value:"droid",children:o("profileCard.factoryDroid")}),p.jsx(rc,{value:"codex",children:o("profileCard.codexCli")})]})]}),p.jsxs("p",{className:"text-xs text-muted-foreground",children:[W==="droid"?p.jsxs(p.Fragment,{children:[o("profileEditor.targetHintPreferredAlias")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs-droid"}),"."]}):W==="codex"?p.jsxs(p.Fragment,{children:[o("profileEditor.targetHintPreferredAlias")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccsx"}),"."]}):p.jsxs(p.Fragment,{children:[o("profileEditor.targetHintClaudeDefault")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs"}),"."]}),W==="droid"?p.jsxs(p.Fragment,{children:[" ",o("profileEditor.targetHintLegacyAlias")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccsd"}),"."]}):W==="codex"?p.jsxs(p.Fragment,{children:[" ",o("profileEditor.targetHintLegacyAlias")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs-codex"}),"."]}):null," ",o("profileEditor.targetHintOverride")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"--target"}),"."]})]})]}),p.jsxs(gy,{value:"models",className:"p-6 mt-0 space-y-4",children:[p.jsxs("div",{className:"flex items-start gap-3 p-3 bg-blue-50 dark:bg-blue-950/20 text-blue-800 dark:text-blue-300 rounded-md text-sm border border-blue-100 dark:border-blue-900/30",children:[p.jsx($h,{className:"w-5 h-5 shrink-0 mt-0.5"}),p.jsxs("div",{children:[p.jsx("p",{className:"font-medium mb-1",children:o("profileCreateDialog.modelMapping")}),p.jsx("p",{className:"text-xs opacity-90",children:o("profileCreateDialog.modelMappingDesc")})]})]}),ae&&p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{children:o("openrouterModelPicker.searchModels")}),p.jsx(Hi,{value:C,onChange:Y=>k(Y.target.value),placeholder:o("profileCreateDialog.searchModelsPlaceholder"),onKeyDown:Y=>{Y.key==="Enter"&&$.length>0&&(Y.preventDefault(),B($[0]))}}),p.jsx("div",{className:"border rounded-md max-h-48 overflow-y-auto",children:$.length===0?p.jsx("p",{className:"text-sm text-muted-foreground p-3 text-center",children:C?o("profileCreateDialog.noModelsFound",{query:C}):o("profileCreateDialog.loadingModels")}):p.jsxs("div",{className:"p-1",children:[!C&&p.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground",children:[p.jsx(QE,{className:"w-3 h-3 text-accent"}),p.jsx("span",{children:o("openrouterModelPicker.newestModels")})]}),$.map(Y=>p.jsx(R_,{model:Y,onClick:()=>B(Y),showAge:!C},Y.id))]})})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"model",children:[o("profileCreateDialog.defaultModel"),p.jsx(Qt,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"ANTHROPIC_MODEL"})]}),p.jsx(Hi,{id:"model",...D("model"),placeholder:z?.defaultModel??"claude-sonnet-4",className:"font-mono text-sm"})]}),p.jsxs("div",{className:"grid gap-3 pt-2 border-t",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"sonnetModel",className:"text-sm",children:[o("profileCreateDialog.sonnetMapping"),p.jsx(Qt,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_SONNET"})]}),p.jsx(Hi,{id:"sonnetModel",...D("sonnetModel"),placeholder:o("profileCreateDialog.sonnetMappingPlaceholder"),className:"font-mono text-sm h-9"})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"opusModel",className:"text-sm",children:[o("profileCreateDialog.opusMapping"),p.jsx(Qt,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_OPUS"})]}),p.jsx(Hi,{id:"opusModel",...D("opusModel"),placeholder:o("profileCreateDialog.opusMappingPlaceholder"),className:"font-mono text-sm h-9"})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"haikuModel",className:"text-sm",children:[o("profileCreateDialog.haikuMapping"),p.jsx(Qt,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_HAIKU"})]}),p.jsx(Hi,{id:"haikuModel",...D("haikuModel"),placeholder:o("profileCreateDialog.haikuMappingPlaceholder"),className:"font-mono text-sm h-9"})]})]})]})]})]}),p.jsxs(kB,{"data-testid":"profile-create-footer",className:"shrink-0 border-t bg-muted/10 p-6 pt-4",children:[p.jsx(ft,{type:"button",variant:"outline",onClick:()=>e(!1),children:o("profileDialog.cancel")}),p.jsx(ft,{type:"submit",disabled:Z,className:q(Z&&"opacity-80"),children:Z?p.jsxs(p.Fragment,{children:[p.jsx(hi,{className:"w-4 h-4 mr-2 animate-spin"}),o("cliproxyDialog.creating")]}):p.jsxs(p.Fragment,{children:[p.jsx(ek,{className:"w-4 h-4 mr-2"}),o("profileCreateDialog.createProfile")]})})]})]})]})]})})}function yg({preset:n,isSelected:e,onClick:t,density:i="compact"}){const o=n.id==="anthropic",s=i==="featured";return p.jsxs("button",{type:"button",onClick:t,className:q("flex flex-none items-center gap-3 rounded-xl border px-3 py-2.5 text-left transition-all",s?"h-[68px] w-[236px]":"h-[64px] w-[168px]",e?"border-primary bg-primary/8 shadow-sm ring-1 ring-primary/10":"border-border/60 bg-background hover:border-primary/40 hover:bg-accent/20"),children:[p.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-background",children:o?p.jsx(h_,{provider:"claude",size:"md",className:"rounded-lg"}):n.icon?p.jsx("img",{src:n.icon,alt:"",className:"h-5 w-5 object-contain"}):p.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-muted/70 text-xs font-semibold text-foreground/70",children:n.name.charAt(0)})}),p.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("div",{className:"truncate text-[13px] font-semibold leading-tight tracking-[-0.01em]",children:n.name}),n.badge&&s&&p.jsx(Qt,{variant:"secondary",className:"inline-flex bg-muted px-1.5 py-0 text-[10px] text-muted-foreground",children:n.badge})]}),n.badge&&!s&&p.jsx(Qt,{variant:"secondary",className:"inline-flex w-fit bg-muted px-1.5 py-0 text-[10px] text-muted-foreground",children:n.badge})]})]})}function M_({isSelected:n,onClick:e}){const{t}=ve();return p.jsxs("button",{type:"button",onClick:e,className:q("flex h-[68px] w-[236px] flex-none items-center gap-3 rounded-xl border border-dashed px-3 py-2.5 text-left transition-all",n?"border-primary bg-primary/8 shadow-sm ring-1 ring-primary/10":"border-muted-foreground/30 bg-background hover:border-primary/40 hover:bg-accent/20"),children:[p.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-dashed border-current/30 bg-muted/70",children:p.jsx(kb,{className:"h-4 w-4 text-muted-foreground"})}),p.jsx("div",{className:"min-w-0 flex-1",children:p.jsx("div",{className:"text-sm font-semibold leading-tight",children:t("profileEditor.customEndpoint")})})]})}function R_({model:n,onClick:e,showAge:t}){const{t:i}=ve();return p.jsxs("button",{type:"button",onClick:e,className:"group flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",children:[p.jsx("span",{className:"flex-1 truncate",children:n.name}),p.jsxs("span",{className:"text-muted-foreground group-hover:text-accent-foreground/80 ml-2 flex items-center gap-2 text-xs",children:[t&&n.created&&p.jsx(Qt,{variant:"outline",className:"text-[10px] text-accent group-hover:text-accent-foreground/80 group-hover:border-accent-foreground/30",children:$U(n.created)}),n.isFree?p.jsx(Qt,{variant:"secondary",className:"text-xs group-hover:bg-accent-foreground/20 group-hover:text-accent-foreground",children:i("profileCreateDialog.free")}):p.jsx("span",{children:_U(n.pricing)}),p.jsx("span",{children:WU(n.context_length)})]})]})}function L_({className:n,...e}){return p.jsx("div",{"data-slot":"card",className:q("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",n),...e})}function N_({className:n,...e}){return p.jsx("div",{"data-slot":"card-header",className:q("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",n),...e})}function E_({className:n,...e}){return p.jsx("div",{"data-slot":"card-title",className:q("leading-none font-semibold",n),...e})}function I_({className:n,...e}){return p.jsx("div",{"data-slot":"card-description",className:q("text-muted-foreground text-sm",n),...e})}function j_({className:n,...e}){return p.jsx("div",{"data-slot":"card-content",className:q("px-6",n),...e})}const tv="[1m]",HD=["ANTHROPIC_MODEL","ANTHROPIC_DEFAULT_OPUS_MODEL","ANTHROPIC_DEFAULT_SONNET_MODEL","ANTHROPIC_DEFAULT_HAIKU_MODEL","ANTHROPIC_DEFAULT_FABLE_MODEL"],B_=["CLAUDE_CODE_SUBAGENT_MODEL","ANTHROPIC_DEFAULT_MODEL"],nv=[...HD,...B_];new Set(HD);const H_=new Set(nv);function tQ(n){return n.toLowerCase().startsWith("gemini-")}function iv(n){return n.toLowerCase().endsWith(tv.toLowerCase())}function U_(n){return!n||iv(n)?n:`${n}${tv}`}function UD(n){return n&&(iv(n)?n.slice(0,-tv.length):n)}function nQ(n){return H_.has(n)}function __(n){return UD(n.trim()).replace(/\([^)]+\)$/,"")}function iQ(n){return nv.some(e=>{const t=n[e];return typeof t=="string"&&iv(t)})}function oQ(n,e,t={}){const i={...n};for(const o of nv){const s=i[o];if(typeof s!="string"||s.trim().length===0)continue;const r=__(s),c=t.supportsExtendedContext?.(r,o)??!0;i[o]=e&&c?U_(s):UD(s)}return i}const z_=["agy","claude","gemini","codex","xai","cursor","gitlab","codebuddy","qwen","kimi","iflow","kilo","kiro","qoder"],aQ=z_.map(n=>({id:n,name:_b(n),description:VB(n)})),F_=["provider","auth","variant","success"];function sQ(n){return n==="account"?1:F_.indexOf(n)}const rQ=dE,lQ=hE,cQ=uE,q_=w.forwardRef(({className:n,align:e="center",sideOffset:t=4,...i},o)=>p.jsx(cE,{children:p.jsx(n1,{ref:o,align:e,sideOffset:t,className:q("z-50 w-80 max-w-[calc(100vw-2rem)] rounded-lg border border-border/70 bg-popover p-4 text-popover-foreground shadow-xl shadow-black/10 outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...i})}));q_.displayName=n1.displayName;const G_=w.lazy(()=>lt(()=>Promise.resolve().then(()=>Lf),void 0).then(n=>({default:n.CodeEditor})));function dQ({rawJsonContent:n,isRawJsonValid:e,rawJsonEdits:t,onRawJsonChange:i,profileEnv:o,missingRequiredFields:s=[]}){const{t:r}=ve(),c=s.length>0;return p.jsx(w.Suspense,{fallback:p.jsxs("div",{className:"flex items-center justify-center h-full",children:[p.jsx(hi,{className:"w-6 h-6 animate-spin text-muted-foreground"}),p.jsx("span",{className:"ml-2 text-muted-foreground",children:r("providerEditor.loadingEditor")})]}),children:p.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!e&&t!==null&&p.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[p.jsx(Vr,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),e&&c&&p.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[p.jsx(wi,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",p.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:s.join(", ")}),p.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Apply a preset from Model Config tab or add these fields manually. Without them, Claude Code will fail with 404 errors."})]})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:p.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:p.jsx(G_,{value:n,onChange:i,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),p.jsx("div",{className:"mx-6 mb-4",children:p.jsx("div",{className:"border rounded-md overflow-hidden",children:p.jsx(Zb,{profileEnv:o})})})]})})}let by=[],_D=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?_D:by).push(t=t+n[e])})();function V_(n){if(n<768)return!1;for(let e=0,t=by.length;;){let i=e+t>>1;if(n<by[i])t=i;else if(n>=_D[i])e=i+1;else return!0;if(e==t)return!1}}function dw(n){return n>=127462&&n<=127487}const uw=8205;function K_(n,e,t=!0,i=!0){return(t?zD:W_)(n,e,i)}function zD(n,e,t){if(e==n.length)return e;e&&FD(n.charCodeAt(e))&&qD(n.charCodeAt(e-1))&&e--;let i=bg(n,e);for(e+=hw(i);e<n.length;){let o=bg(n,e);if(i==uw||o==uw||t&&V_(o))e+=hw(o),i=o;else if(dw(o)){let s=0,r=e-2;for(;r>=0&&dw(bg(n,r));)s++,r-=2;if(s%2==0)break;e+=2}else break}return e}function W_(n,e,t){for(;e>0;){let i=zD(n,e-2,t);if(i<e)return i;e--}return 0}function bg(n,e){let t=n.charCodeAt(e);if(!qD(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return FD(i)?(t-55296<<10)+(i-56320)+65536:t}function FD(n){return n>=56320&&n<57344}function qD(n){return n>=55296&&n<56320}function hw(n){return n<65536?1:2}class Je{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=jr(this,e,t);let o=[];return this.decompose(0,e,o,2),i.length&&i.decompose(0,i.length,o,3),this.decompose(t,this.length,o,1),_i.from(o,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=jr(this,e,t);let i=[];return this.decompose(e,t,i,0),_i.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),o=new dc(this),s=new dc(e);for(let r=t,c=t;;){if(o.next(r),s.next(r),r=0,o.lineBreak!=s.lineBreak||o.done!=s.done||o.value!=s.value)return!1;if(c+=o.value.length,o.done||c>=i)return!0}}iter(e=1){return new dc(this,e)}iterRange(e,t=this.length){return new GD(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let o=this.line(e).from;i=this.iterRange(o,Math.max(o,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new VD(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Je.empty:e.length<=32?new jt(e):_i.from(jt.split(e,[]))}}class jt extends Je{constructor(e,t=Q_(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,o){for(let s=0;;s++){let r=this.text[s],c=o+r.length;if((t?i:c)>=e)return new Y_(o,c,i,r);o=c+1,i++}}decompose(e,t,i,o){let s=e<=0&&t>=this.length?this:new jt(fw(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(o&1){let r=i.pop(),c=nh(s.text,r.text.slice(),0,s.length);if(c.length<=32)i.push(new jt(c,r.length+s.length));else{let u=c.length>>1;i.push(new jt(c.slice(0,u)),new jt(c.slice(u)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof jt))return super.replace(e,t,i);[e,t]=jr(this,e,t);let o=nh(this.text,nh(i.text,fw(this.text,0,e)),t),s=this.length+i.length-(t-e);return o.length<=32?new jt(o,s):_i.from(jt.split(o,[]),s)}sliceString(e,t=this.length,i=`
18
18
  `){[e,t]=jr(this,e,t);let o="";for(let s=0,r=0;s<=t&&r<this.text.length;r++){let c=this.text[r],u=s+c.length;s>e&&r&&(o+=i),e<u&&t>s&&(o+=c.slice(Math.max(0,e-s),t-s)),s=u+1}return o}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],o=-1;for(let s of e)i.push(s),o+=s.length+1,i.length==32&&(t.push(new jt(i,o)),i=[],o=-1);return o>-1&&t.push(new jt(i,o)),t}}class _i extends Je{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,o){for(let s=0;;s++){let r=this.children[s],c=o+r.length,u=i+r.lines-1;if((t?u:c)>=e)return r.lineInner(e,t,i,o);o=c+1,i=u+1}}decompose(e,t,i,o){for(let s=0,r=0;r<=t&&s<this.children.length;s++){let c=this.children[s],u=r+c.length;if(e<=u&&t>=r){let f=o&((r<=e?1:0)|(u>=t?2:0));r>=e&&u<=t&&!f?i.push(c):c.decompose(e-r,t-r,i,f)}r=u+1}}replace(e,t,i){if([e,t]=jr(this,e,t),i.lines<this.lines)for(let o=0,s=0;o<this.children.length;o++){let r=this.children[o],c=s+r.length;if(e>=s&&t<=c){let u=r.replace(e-s,t-s,i),f=this.lines-r.lines+u.lines;if(u.lines<f>>4&&u.lines>f>>6){let m=this.children.slice();return m[o]=u,new _i(m,this.length-(t-e)+i.length)}return super.replace(s,c,u)}s=c+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
19
19
  `){[e,t]=jr(this,e,t);let o="";for(let s=0,r=0;s<this.children.length&&r<=t;s++){let c=this.children[s],u=r+c.length;r>e&&s&&(o+=i),e<u&&t>r&&(o+=c.sliceString(e-r,t-r,i)),r=u+1}return o}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof _i))return 0;let i=0,[o,s,r,c]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;o+=t,s+=t){if(o==r||s==c)return i;let u=this.children[o],f=e.children[s];if(u!=f)return i+u.scanIdentical(f,t);i+=u.length+1}}static from(e,t=e.reduce((i,o)=>i+o.length+1,-1)){let i=0;for(let x of e)i+=x.lines;if(i<32){let x=[];for(let C of e)C.flatten(x);return new jt(x,t)}let o=Math.max(32,i>>5),s=o<<1,r=o>>1,c=[],u=0,f=-1,m=[];function g(x){let C;if(x.lines>s&&x instanceof _i)for(let k of x.children)g(k);else x.lines>r&&(u>r||!u)?(v(),c.push(x)):x instanceof jt&&u&&(C=m[m.length-1])instanceof jt&&x.lines+C.lines<=32?(u+=x.lines,f+=x.length+1,m[m.length-1]=new jt(C.text.concat(x.text),C.length+1+x.length)):(u+x.lines>o&&v(),u+=x.lines,f+=x.length+1,m.push(x))}function v(){u!=0&&(c.push(m.length==1?m[0]:_i.from(m,f)),f=-1,u=m.length=0)}for(let x of e)g(x);return v(),c.length==1?c[0]:new _i(c,t)}}Je.empty=new jt([""],0);function Q_(n){let e=-1;for(let t of n)e+=t.length+1;return e}function nh(n,e,t=0,i=1e9){for(let o=0,s=0,r=!0;s<n.length&&o<=i;s++){let c=n[s],u=o+c.length;u>=t&&(u>i&&(c=c.slice(0,i-o)),o<t&&(c=c.slice(t-o)),r?(e[e.length-1]+=c,r=!1):e.push(c)),o=u+1}return e}function fw(n,e,t){return nh(n,[""],e,t)}class dc{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof jt?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,o=this.nodes[i],s=this.offsets[i],r=s>>1,c=o instanceof jt?o.text.length:o.children.length;if(r==(t>0?c:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
20
20
  `,this;e--}else if(o instanceof jt){let u=o.text[r+(t<0?-1:0)];if(this.offsets[i]+=t,u.length>Math.max(0,e))return this.value=e==0?u:t>0?u.slice(e):u.slice(0,u.length-e),this;e-=u.length}else{let u=o.children[r+(t<0?-1:0)];e>u.length?(e-=u.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(u),this.offsets.push(t>0?1:(u instanceof jt?u.text.length:u.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class GD{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new dc(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:o}=this.cursor.next(e);return this.pos+=(o.length+e)*t,this.value=o.length<=i?o:t<0?o.slice(o.length-i):o.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class VD{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:o}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=o,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Je.prototype[Symbol.iterator]=function(){return this.iter()},dc.prototype[Symbol.iterator]=GD.prototype[Symbol.iterator]=VD.prototype[Symbol.iterator]=function(){return this});class Y_{constructor(e,t,i,o){this.from=e,this.to=t,this.number=i,this.text=o}get length(){return this.to-this.from}}function jr(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function $t(n,e,t=!0,i=!0){return K_(n,e,t,i)}function $_(n){return n>=56320&&n<57344}function X_(n){return n>=55296&&n<56320}function Mn(n,e){let t=n.charCodeAt(e);if(!X_(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return $_(i)?(t-55296<<10)+(i-56320)+65536:t}function ov(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function zi(n){return n<65536?1:2}const vy=/\r\n?|\n/;var vn=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(vn||(vn={}));class Yi{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,o=0;t<this.sections.length;){let s=this.sections[t++],r=this.sections[t++];r<0?(e(i,o,s),o+=s):o+=r,i+=s}}iterChangedRanges(e,t=!1){xy(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],o=this.sections[t++];o<0?e.push(i,o):e.push(o,i)}return new Yi(e)}composeDesc(e){return this.empty?e:e.empty?this:KD(this,e)}mapDesc(e,t=!1){return e.empty?this:Cy(this,e,t)}mapPos(e,t=-1,i=vn.Simple){let o=0,s=0;for(let r=0;r<this.sections.length;){let c=this.sections[r++],u=this.sections[r++],f=o+c;if(u<0){if(f>e)return s+(e-o);s+=c}else{if(i!=vn.Simple&&f>=e&&(i==vn.TrackDel&&o<e&&f>e||i==vn.TrackBefore&&o<e||i==vn.TrackAfter&&f>e))return null;if(f>e||f==e&&t<0&&!c)return e==o||t<0?s:s+u;s+=u}o=f}if(e>o)throw new RangeError(`Position ${e} is out of range for changeset of length ${o}`);return s}touchesRange(e,t=e){for(let i=0,o=0;i<this.sections.length&&o<=t;){let s=this.sections[i++],r=this.sections[i++],c=o+s;if(r>=0&&o<=t&&c>=e)return o<e&&c>t?"cover":!0;o=c}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],o=this.sections[t++];e+=(e?" ":"")+i+(o>=0?":"+o:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Yi(e)}static create(e){return new Yi(e)}}class qt extends Yi{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return xy(this,(t,i,o,s,r)=>e=e.replace(o,o+(i-t),r),!1),e}mapDesc(e,t=!1){return Cy(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let o=0,s=0;o<t.length;o+=2){let r=t[o],c=t[o+1];if(c>=0){t[o]=c,t[o+1]=r;let u=o>>1;for(;i.length<u;)i.push(Je.empty);i.push(r?e.slice(s,s+r):Je.empty)}s+=r}return new qt(t,i)}compose(e){return this.empty?e:e.empty?this:KD(this,e,!0)}map(e,t=!1){return e.empty?this:Cy(this,e,t,!0)}iterChanges(e,t=!1){xy(this,e,t)}get desc(){return Yi.create(this.sections)}filter(e){let t=[],i=[],o=[],s=new Ac(this);e:for(let r=0,c=0;;){let u=r==e.length?1e9:e[r++];for(;c<u||c==u&&s.len==0;){if(s.done)break e;let m=Math.min(s.len,u-c);dn(o,m,-1);let g=s.ins==-1?-1:s.off==0?s.ins:0;dn(t,m,g),g>0&&ma(i,t,s.text),s.forward(m),c+=m}let f=e[r++];for(;c<f;){if(s.done)break e;let m=Math.min(s.len,f-c);dn(t,m,-1),dn(o,m,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(m),c+=m}}return{changes:new qt(t,i),filtered:Yi.create(o)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],o=this.sections[t+1];o<0?e.push(i):o==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let o=[],s=[],r=0,c=null;function u(m=!1){if(!m&&!o.length)return;r<t&&dn(o,t-r,-1);let g=new qt(o,s);c=c?c.compose(g.map(c)):g,o=[],s=[],r=0}function f(m){if(Array.isArray(m))for(let g of m)f(g);else if(m instanceof qt){if(m.length!=t)throw new RangeError(`Mismatched change set length (got ${m.length}, expected ${t})`);u(),c=c?c.compose(m.map(c)):m}else{let{from:g,to:v=g,insert:x}=m;if(g>v||g<0||v>t)throw new RangeError(`Invalid change range ${g} to ${v} (in doc of length ${t})`);let C=x?typeof x=="string"?Je.of(x.split(i||vy)):x:Je.empty,k=C.length;if(g==v&&k==0)return;g<r&&u(),g>r&&dn(o,g-r,-1),dn(o,v-g,k),ma(s,o,C),r=v}}return f(e),u(!c),c}static empty(e){return new qt(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let o=0;o<e.length;o++){let s=e[o];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((r,c)=>c&&typeof r!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;i.length<o;)i.push(Je.empty);i[o]=Je.of(s.slice(1)),t.push(s[0],i[o].length)}}}return new qt(t,i)}static createSet(e,t){return new qt(e,t)}}function dn(n,e,t,i=!1){if(e==0&&t<=0)return;let o=n.length-2;o>=0&&t<=0&&t==n[o+1]?n[o]+=e:o>=0&&e==0&&n[o]==0?n[o+1]+=t:i?(n[o]+=e,n[o+1]+=t):n.push(e,t)}function ma(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push(Je.empty);n.push(t)}}function xy(n,e,t){let i=n.inserted;for(let o=0,s=0,r=0;r<n.sections.length;){let c=n.sections[r++],u=n.sections[r++];if(u<0)o+=c,s+=c;else{let f=o,m=s,g=Je.empty;for(;f+=c,m+=u,u&&i&&(g=g.append(i[r-2>>1])),!(t||r==n.sections.length||n.sections[r+1]<0);)c=n.sections[r++],u=n.sections[r++];e(o,f,s,m,g),o=f,s=m}}}function Cy(n,e,t,i=!1){let o=[],s=i?[]:null,r=new Ac(n),c=new Ac(e);for(let u=-1;;){if(r.done&&c.len||c.done&&r.len)throw new Error("Mismatched change set lengths");if(r.ins==-1&&c.ins==-1){let f=Math.min(r.len,c.len);dn(o,f,-1),r.forward(f),c.forward(f)}else if(c.ins>=0&&(r.ins<0||u==r.i||r.off==0&&(c.len<r.len||c.len==r.len&&!t))){let f=c.len;for(dn(o,c.ins,-1);f;){let m=Math.min(r.len,f);r.ins>=0&&u<r.i&&r.len<=m&&(dn(o,0,r.ins),s&&ma(s,o,r.text),u=r.i),r.forward(m),f-=m}c.next()}else if(r.ins>=0){let f=0,m=r.len;for(;m;)if(c.ins==-1){let g=Math.min(m,c.len);f+=g,m-=g,c.forward(g)}else if(c.ins==0&&c.len<m)m-=c.len,c.next();else break;dn(o,f,u<r.i?r.ins:0),s&&u<r.i&&ma(s,o,r.text),u=r.i,r.forward(r.len-m)}else{if(r.done&&c.done)return s?qt.createSet(o,s):Yi.create(o);throw new Error("Mismatched change set lengths")}}}function KD(n,e,t=!1){let i=[],o=t?[]:null,s=new Ac(n),r=new Ac(e);for(let c=!1;;){if(s.done&&r.done)return o?qt.createSet(i,o):Yi.create(i);if(s.ins==0)dn(i,s.len,0,c),s.next();else if(r.len==0&&!r.done)dn(i,0,r.ins,c),o&&ma(o,i,r.text),r.next();else{if(s.done||r.done)throw new Error("Mismatched change set lengths");{let u=Math.min(s.len2,r.len),f=i.length;if(s.ins==-1){let m=r.ins==-1?-1:r.off?0:r.ins;dn(i,u,m,c),o&&m&&ma(o,i,r.text)}else r.ins==-1?(dn(i,s.off?0:s.len,u,c),o&&ma(o,i,s.textBit(u))):(dn(i,s.off?0:s.len,r.off?0:r.ins,c),o&&!r.off&&ma(o,i,r.text));c=(s.ins>u||r.ins>=0&&r.len>u)&&(c||i.length>f),s.forward2(u),r.forward(u)}}}}class Ac{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?Je.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?Je.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class is{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,o;return this.empty?i=o=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),o=e.mapPos(this.to,-1)),i==this.from&&o==this.to?this:new is(i,o,this.flags)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return J.range(e,t,void 0,void 0,i);let o=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return J.range(this.anchor,o,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return J.range(e.anchor,e.head)}static create(e,t,i){return new is(e,t,i)}}class J{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:J.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new J([this.main],0)}addRange(e,t=!0){return J.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,J.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new J(e.ranges.map(t=>is.fromJSON(t)),e.main)}static single(e,t=e){return new J([J.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,o=0;o<e.length;o++){let s=e[o];if(s.empty?s.from<=i:s.from<i)return J.normalized(e.slice(),t);i=s.to}return new J(e,t)}static cursor(e,t=0,i,o){return is.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(o??16777215)<<6)}static range(e,t,i,o,s){let r=(i??16777215)<<6|(o==null?7:Math.min(6,o));return!s&&e!=t&&(s=t<e?1:-1),t<e?is.create(t,e,48|r):is.create(e,t,(s?s<0?8:16:0)|r)}static normalized(e,t=0){let i=e[t];e.sort((o,s)=>o.from-s.from),t=e.indexOf(i);for(let o=1;o<e.length;o++){let s=e[o],r=e[o-1];if(s.empty?s.from<=r.to:s.from<r.to){let c=r.from,u=Math.max(s.to,r.to);o<=t&&t--,e.splice(--o,2,s.anchor>s.head?J.range(u,c):J.range(c,u))}}return new J(e,t)}}function WD(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let av=0;class pe{constructor(e,t,i,o,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=o,this.id=av++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new pe(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:sv),!!e.static,e.enables)}of(e){return new ih([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new ih(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new ih(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function sv(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class ih{constructor(e,t,i,o){this.dependencies=e,this.facet=t,this.type=i,this.value=o,this.id=av++}dynamicSlot(e){var t;let i=this.value,o=this.facet.compareInput,s=this.id,r=e[s]>>1,c=this.type==2,u=!1,f=!1,m=[];for(let g of this.dependencies)g=="doc"?u=!0:g=="selection"?f=!0:(((t=e[g.id])!==null&&t!==void 0?t:1)&1)==0&&m.push(e[g.id]);return{create(g){return g.values[r]=i(g),1},update(g,v){if(u&&v.docChanged||f&&(v.docChanged||v.selection)||Sy(g,m)){let x=i(g);if(c?!pw(x,g.values[r],o):!o(x,g.values[r]))return g.values[r]=x,1}return 0},reconfigure:(g,v)=>{let x,C=v.config.address[s];if(C!=null){let k=Ch(v,C);if(this.dependencies.every(P=>P instanceof pe?v.facet(P)===g.facet(P):P instanceof hn?v.field(P,!1)==g.field(P,!1):!0)||(c?pw(x=i(g),k,o):o(x=i(g),k)))return g.values[r]=k,0}else x=i(g);return g.values[r]=x,1}}}}function pw(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function Sy(n,e){let t=!1;for(let i of e)uc(n,i)&1&&(t=!0);return t}function J_(n,e,t){let i=t.map(u=>n[u.id]),o=t.map(u=>u.type),s=i.filter(u=>!(u&1)),r=n[e.id]>>1;function c(u){let f=[];for(let m=0;m<i.length;m++){let g=Ch(u,i[m]);if(o[m]==2)for(let v of g)f.push(v);else f.push(g)}return e.combine(f)}return{create(u){for(let f of i)uc(u,f);return u.values[r]=c(u),1},update(u,f){if(!Sy(u,s))return 0;let m=c(u);return e.compare(m,u.values[r])?0:(u.values[r]=m,1)},reconfigure(u,f){let m=Sy(u,i),g=f.config.facets[e.id],v=f.facet(e);if(g&&!m&&sv(t,g))return u.values[r]=v,0;let x=c(u);return e.compare(x,v)?(u.values[r]=v,0):(u.values[r]=x,1)}}}const Ou=pe.define({static:!0});class hn{constructor(e,t,i,o,s){this.id=e,this.createF=t,this.updateF=i,this.compareF=o,this.spec=s,this.provides=void 0}static define(e){let t=new hn(av++,e.create,e.update,e.compare||((i,o)=>i===o),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Ou).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,o)=>{let s=i.values[t],r=this.updateF(s,o);return this.compareF(s,r)?0:(i.values[t]=r,1)},reconfigure:(i,o)=>{let s=i.facet(Ou),r=o.facet(Ou),c;return(c=s.find(u=>u.field==this))&&c!=r.find(u=>u.field==this)?(i.values[t]=c.create(i),1):o.config.address[this.id]!=null?(i.values[t]=o.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,Ou.of({field:this,create:e})]}get extension(){return this}}const es={lowest:4,low:3,default:2,high:1,highest:0};function Vl(n){return e=>new QD(e,n)}const ws={highest:Vl(es.highest),high:Vl(es.high),default:Vl(es.default),low:Vl(es.low),lowest:Vl(es.lowest)};class QD{constructor(e,t){this.inner=e,this.prec=t}}class hf{of(e){return new ky(this,e)}reconfigure(e){return hf.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class ky{constructor(e,t){this.compartment=e,this.inner=t}}class xh{constructor(e,t,i,o,s,r){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=o,this.staticValues=s,this.facets=r,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let o=[],s=Object.create(null),r=new Map;for(let v of Z_(e,t,r))v instanceof hn?o.push(v):(s[v.facet.id]||(s[v.facet.id]=[])).push(v);let c=Object.create(null),u=[],f=[];for(let v of o)c[v.id]=f.length<<1,f.push(x=>v.slot(x));let m=i?.config.facets;for(let v in s){let x=s[v],C=x[0].facet,k=m&&m[v]||[];if(x.every(P=>P.type==0))if(c[C.id]=u.length<<1|1,sv(k,x))u.push(i.facet(C));else{let P=C.combine(x.map(D=>D.value));u.push(i&&C.compare(P,i.facet(C))?i.facet(C):P)}else{for(let P of x)P.type==0?(c[P.id]=u.length<<1|1,u.push(P.value)):(c[P.id]=f.length<<1,f.push(D=>P.dynamicSlot(D)));c[C.id]=f.length<<1,f.push(P=>J_(P,C,x))}}let g=f.map(v=>v(c));return new xh(e,r,g,c,u,s)}}function Z_(n,e,t){let i=[[],[],[],[],[]],o=new Map;function s(r,c){let u=o.get(r);if(u!=null){if(u<=c)return;let f=i[u].indexOf(r);f>-1&&i[u].splice(f,1),r instanceof ky&&t.delete(r.compartment)}if(o.set(r,c),Array.isArray(r))for(let f of r)s(f,c);else if(r instanceof ky){if(t.has(r.compartment))throw new RangeError("Duplicate use of compartment in extensions");let f=e.get(r.compartment)||r.inner;t.set(r.compartment,f),s(f,c)}else if(r instanceof QD)s(r.inner,r.prec);else if(r instanceof hn)i[c].push(r),r.provides&&s(r.provides,c);else if(r instanceof ih)i[c].push(r),r.facet.extensions&&s(r.facet.extensions,es.default);else{let f=r.extension;if(!f)throw new Error(`Unrecognized extension value in extension set (${r}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(f,c)}}return s(n,es.default),i.reduce((r,c)=>r.concat(c))}function uc(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let o=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|o}function Ch(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const YD=pe.define(),wy=pe.define({combine:n=>n.some(e=>e),static:!0}),$D=pe.define({combine:n=>n.length?n[0]:void 0,static:!0}),XD=pe.define(),JD=pe.define(),ZD=pe.define(),eO=pe.define({combine:n=>n.length?n[0]:!1});class eo{constructor(e,t){this.type=e,this.value=t}static define(){return new e3}}class e3{of(e){return new eo(this,e)}}class t3{constructor(e){this.map=e}of(e){return new Le(this,e)}}class Le{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new Le(this.type,t)}is(e){return this.type==e}static define(e={}){return new t3(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let o of e){let s=o.map(t);s&&i.push(s)}return i}}Le.reconfigure=Le.define();Le.appendConfig=Le.define();class Gt{constructor(e,t,i,o,s,r){this.startState=e,this.changes=t,this.selection=i,this.effects=o,this.annotations=s,this.scrollIntoView=r,this._doc=null,this._state=null,i&&WD(i,t.newLength),s.some(c=>c.type==Gt.time)||(this.annotations=s.concat(Gt.time.of(Date.now())))}static create(e,t,i,o,s,r){return new Gt(e,t,i,o,s,r)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(Gt.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Gt.time=eo.define();Gt.userEvent=eo.define();Gt.addToHistory=eo.define();Gt.remote=eo.define();function n3(n,e){let t=[];for(let i=0,o=0;;){let s,r;if(i<n.length&&(o==e.length||e[o]>=n[i]))s=n[i++],r=n[i++];else if(o<e.length)s=e[o++],r=e[o++];else return t;!t.length||t[t.length-1]<s?t.push(s,r):t[t.length-1]<r&&(t[t.length-1]=r)}}function tO(n,e,t){var i;let o,s,r;return t?(o=e.changes,s=qt.empty(e.changes.length),r=n.changes.compose(e.changes)):(o=e.changes.map(n.changes),s=n.changes.mapDesc(e.changes,!0),r=n.changes.compose(o)),{changes:r,selection:e.selection?e.selection.map(s):(i=n.selection)===null||i===void 0?void 0:i.map(o),effects:Le.mapEffects(n.effects,o).concat(Le.mapEffects(e.effects,s)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function Py(n,e,t){let i=e.selection,o=Dr(e.annotations);return e.userEvent&&(o=o.concat(Gt.userEvent.of(e.userEvent))),{changes:e.changes instanceof qt?e.changes:qt.of(e.changes||[],t,n.facet($D)),selection:i&&(i instanceof J?i:J.single(i.anchor,i.head)),effects:Dr(e.effects),annotations:o,scrollIntoView:!!e.scrollIntoView}}function nO(n,e,t){let i=Py(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let r=!!e[s].sequential;i=tO(i,Py(n,e[s],r?i.changes.newLength:n.doc.length),r)}let o=Gt.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return o3(t?i3(o):o)}function i3(n){let e=n.startState,t=!0;for(let o of e.facet(XD)){let s=o(n);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:n3(t,s))}if(t!==!0){let o,s;if(t===!1)s=n.changes.invertedDesc,o=qt.empty(e.doc.length);else{let r=n.changes.filter(t);o=r.changes,s=r.filtered.mapDesc(r.changes).invertedDesc}n=Gt.create(e,o,n.selection&&n.selection.map(s),Le.mapEffects(n.effects,s),n.annotations,n.scrollIntoView)}let i=e.facet(JD);for(let o=i.length-1;o>=0;o--){let s=i[o](n);s instanceof Gt?n=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Gt?n=s[0]:n=nO(e,Dr(s),!1)}return n}function o3(n){let e=n.startState,t=e.facet(ZD),i=n;for(let o=t.length-1;o>=0;o--){let s=t[o](n);s&&Object.keys(s).length&&(i=tO(i,Py(e,s,n.changes.newLength),!0))}return i==n?n:Gt.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const a3=[];function Dr(n){return n==null?a3:Array.isArray(n)?n:[n]}var kt=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(kt||(kt={}));const s3=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Ay;try{Ay=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function r3(n){if(Ay)return Ay.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||s3.test(t)))return!0}return!1}function l3(n){return e=>{if(!/\S/.test(e))return kt.Space;if(r3(e))return kt.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return kt.Word;return kt.Other}}class Qe{constructor(e,t,i,o,s,r){this.config=e,this.doc=t,this.selection=i,this.values=o,this.status=e.statusTemplate.slice(),this.computeSlot=s,r&&(r._state=this);for(let c=0;c<this.config.dynamicSlots.length;c++)uc(this,c<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return uc(this,i),Ch(this,i)}update(...e){return nO(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:o}=t;for(let c of e.effects)c.is(hf.reconfigure)?(t&&(o=new Map,t.compartments.forEach((u,f)=>o.set(f,u)),t=null),o.set(c.value.compartment,c.value.extension)):c.is(Le.reconfigure)?(t=null,i=c.value):c.is(Le.appendConfig)&&(t=null,i=Dr(i).concat(c.value));let s;t?s=e.startState.values.slice():(t=xh.resolve(i,o,this),s=new Qe(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(u,f)=>f.reconfigure(u,this),null).values);let r=e.startState.facet(wy)?e.newSelection:e.newSelection.asSingle();new Qe(t,e.newDoc,r,s,(c,u)=>u.update(c,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:J.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),o=this.changes(i.changes),s=[i.range],r=Dr(i.effects);for(let c=1;c<t.ranges.length;c++){let u=e(t.ranges[c]),f=this.changes(u.changes),m=f.map(o);for(let v=0;v<c;v++)s[v]=s[v].map(m);let g=o.mapDesc(f,!0);s.push(u.range.map(g)),o=o.compose(m),r=Le.mapEffects(r,m).concat(Le.mapEffects(Dr(u.effects),g))}return{changes:o,selection:J.create(s,t.mainIndex),effects:r}}changes(e=[]){return e instanceof qt?e:qt.of(e,this.doc.length,this.facet(Qe.lineSeparator))}toText(e){return Je.of(e.split(this.facet(Qe.lineSeparator)||vy))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(uc(this,t),Ch(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let o=e[i];o instanceof hn&&this.config.address[o.id]!=null&&(t[i]=o.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let o=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(e,s)){let r=i[s],c=e[s];o.push(r.init(u=>r.spec.fromJSON(c,u)))}}return Qe.create({doc:e.doc,selection:J.fromJSON(e.selection),extensions:t.extensions?o.concat([t.extensions]):o})}static create(e={}){let t=xh.resolve(e.extensions||[],new Map),i=e.doc instanceof Je?e.doc:Je.of((e.doc||"").split(t.staticFacet(Qe.lineSeparator)||vy)),o=e.selection?e.selection instanceof J?e.selection:J.single(e.selection.anchor,e.selection.head):J.single(0);return WD(o,i.length),t.staticFacet(wy)||(o=o.asSingle()),new Qe(t,i,o,t.dynamicSlots.map(()=>null),(s,r)=>r.create(s),null)}get tabSize(){return this.facet(Qe.tabSize)}get lineBreak(){return this.facet(Qe.lineSeparator)||`
@@ -53,4 +53,4 @@ ${s}`,t),this.line=i,this.column=o,this.codeblock=s}}function dK(n,e){let t=0;fo
53
53
  `,u);u=m>=0?m+1:o;continue}if(f==="[")c++;else if(f==="]"&&(c--,c===0))return u+1;u++}return o}return n.lineAt(e).to}if(t==="yaml"){if(s[0]==="|"||s[0]===">"){let r=n.lineAt(e),c=r.to;for(;r.number<n.lines;){const u=n.line(r.number+1);if(u.text.replace(/\s+$/,"")===""){c=u.to,r=u;continue}if(u.text.search(/\S/)<=i)break;c=u.to,r=u}return c}return n.lineAt(e).to}if(s[0]==="["||s[0]==="{"){const r=s[0],c=r==="["?"]":"}",u=n.toString();let f=0,m=e;for(;m<o;){const g=u[m];if(g==='"'){m=$v(u,m,'"');continue}if(g===r)f++;else if(g===c&&(f--,f===0))return m+1;m++}return o}return n.lineAt(e).to}function TK(n){const e=[];let t=0,i=null;for(;t<n.length;){const o=n[t];if(o===" "||o===" "||o===`
54
54
  `||o==="\r"){t++;continue}if(o==='"'){const s=t,r=$v(n,t,'"');let c=r;for(;c<n.length&&(n[c]===" "||n[c]===" "||n[c]===`
55
55
  `||n[c]==="\r");)c++;if((i==="{"||i===","||i===null)&&n[c]===":"){const m=n.slice(s+1,r-1).replace(/\\(.)/g,"$1");let g=c+1;for(;g<n.length&&(n[g]===" "||n[g]===" "||n[g]===`
56
- `||n[g]==="\r");)g++;e.push({valueStart:g,key:m}),i='"',t=c+1;continue}i='"',t=r;continue}i=o,t++}return e}function yA(n,e){const t=new Zi,i=n.state.doc,o=i.toString();if(e==="json"){for(const{valueStart:c,key:u}of TK(o)){if(!mA(u)||c>=i.length)continue;const f=gA(i,c,"json",0),m=i.sliceString(c,f).replace(/\s+$/,"").length;m!==0&&t.add(c,c+m,Ae.mark({class:"cm-sensitive-mask"}))}return t.finish()}const s=new RegExp(AK[e].source,"gm");let r;for(;(r=s.exec(o))!==null;){const c=DK(r[2]),u=r[1].length;if(!mA(c))continue;const f=r.index+r[0].length;if(f>=i.length)continue;const m=gA(i,f,e,u),g=i.sliceString(f,m).replace(/\s+$/,"").length;g!==0&&t.add(f,f+g,Ae.mark({class:"cm-sensitive-mask"}))}return t.finish()}function MK(n){return Pt.fromClass(class{decorations;constructor(e){this.decorations=yA(e,n)}update(e){e.docChanged&&(this.decorations=yA(e.view,n))}},{decorations:e=>e.decorations})}const RK=$M({theme:"light",settings:{background:"transparent",foreground:"#393A34",caret:"#393A34",selection:"rgba(57, 58, 52, 0.18)",selectionMatch:"rgba(57, 58, 52, 0.12)",lineHighlight:"transparent",gutterBackground:"transparent",gutterForeground:"#999988"},styles:[{tag:[E.comment,E.lineComment,E.blockComment],color:"#999988",fontStyle:"italic"},{tag:[E.string,E.special(E.string),E.regexp],color:"#e3116c"},{tag:[E.number,E.bool,E.null,E.atom,E.variableName,E.propertyName,E.url],color:"#36acaa"},{tag:[E.keyword,E.attributeName,E.modifier,E.operatorKeyword],color:"#00a4db"},{tag:[E.function(E.variableName),E.labelName],color:"#6f42c1"},{tag:[E.tagName,E.heading],color:"#00009f",fontWeight:"bold"},{tag:[E.deleted,E.invalid],color:"#d73a49"},{tag:[E.punctuation,E.operator,E.bracket,E.brace,E.separator],color:"#393A34"}]}),LK=$M({theme:"dark",settings:{background:"transparent",foreground:"#d6deeb",caret:"#80a4c2",selection:"rgba(29, 59, 83, 0.99)",selectionMatch:"rgba(35, 77, 112, 0.6)",lineHighlight:"transparent",gutterBackground:"transparent",gutterForeground:"#4b6479"},styles:[{tag:[E.comment,E.lineComment,E.blockComment],color:"#637777",fontStyle:"italic"},{tag:[E.string,E.special(E.string),E.url],color:"rgb(173, 219, 103)"},{tag:E.number,color:"rgb(247, 140, 108)"},{tag:[E.bool,E.null,E.atom],color:"rgb(255, 88, 116)"},{tag:[E.keyword,E.modifier,E.operatorKeyword],color:"rgb(127, 219, 202)"},{tag:[E.propertyName,E.attributeName],color:"rgb(128, 203, 196)"},{tag:[E.variableName,E.labelName],color:"rgb(214, 222, 235)"},{tag:E.function(E.variableName),color:"rgb(130, 170, 255)"},{tag:[E.tagName,E.heading],color:"rgb(127, 219, 202)"},{tag:[E.bracket,E.punctuation,E.operator,E.brace,E.separator],color:"rgb(199, 146, 234)"},{tag:[E.className,E.special(E.string)],color:"rgb(255, 203, 139)"},{tag:[E.deleted,E.invalid],color:"rgba(239, 83, 80, 0.56)"}]}),NK=de.baseTheme({".cm-sensitive-mask":{filter:"blur(3px)",opacity:"0.7",transition:"filter 200ms ease, opacity 200ms ease"},".cm-sensitive-revealed .cm-sensitive-mask":{filter:"none",opacity:"1"}});function ZM({value:n,onChange:e,language:t="json",readonly:i=!1,exactText:o=!1,className:s,minHeight:r="300px",heightMode:c="content"}){const{isDark:u}=Lb(),{t:f}=ve(),[m,g]=w.useState(!1),[v,x]=w.useState(!0),C=c==="fill-parent",k=w.useMemo(()=>t==="json"?wK(n):t==="toml"?PK(n):{valid:!0},[n,t]),P=w.useMemo(()=>[t==="json"?MV():t==="yaml"?sK():Lv.define(rK),de.lineWrapping,NK,MK(t),de.theme({"&":{fontSize:"0.875rem",backgroundColor:"transparent"},"&.cm-focused":{outline:"none"},".cm-content":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",padding:"12px 0",caretColor:"currentColor"},".cm-line":{padding:"0 12px",lineHeight:"1.625"},".cm-scroller":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",lineHeight:"1.625"},".cm-gutters":{display:"none"}})],[t]);return p.jsxs("div",{className:q("flex min-h-0 flex-col",C&&"h-full",s),style:C?{height:r==="auto"?void 0:r}:void 0,"data-slot":"code-editor-root",children:[p.jsxs("div",{className:q("relative rounded-md border overflow-hidden bg-muted/30",C&&"flex min-h-0 flex-1 flex-col",m&&"ring-2 ring-ring ring-offset-2 ring-offset-background",i&&"opacity-70",!k.valid&&"border-destructive"),"data-slot":"code-editor-surface",children:[p.jsx("div",{className:q(C?"scrollbar-editor min-h-0 flex-1 overflow-hidden":void 0),"data-slot":C?"code-editor-viewport":void 0,children:p.jsx(FM,{value:n,onChange:i?void 0:e,readOnly:i,editable:!i,theme:u?LK:RK,extensions:P,height:C?"100%":void 0,minHeight:C?void 0:r,basicSetup:{lineNumbers:!1,foldGutter:!1,highlightActiveLine:!1,highlightActiveLineGutter:!1,autocompletion:!1,searchKeymap:!0},onFocus:()=>g(!0),onBlur:()=>g(!1),className:q("cm-editor-root",!v&&"cm-sensitive-revealed",C&&"h-full"),"data-slot":"code-editor-codemirror"})}),p.jsx("div",{className:"absolute top-2 right-2 z-20 opacity-50 hover:opacity-100 transition-opacity",children:p.jsx(ft,{variant:"ghost",size:"icon",className:"h-6 w-6 bg-background/50 hover:bg-background border shadow-sm rounded-full",onClick:()=>x(!v),title:f(v?"codeEditor.revealSensitive":"codeEditor.maskSensitive"),children:v?p.jsx(Wc,{className:"h-3 w-3"}):p.jsx(Kc,{className:"h-3 w-3"})})})]}),p.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs",children:[k.valid?p.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[p.jsx(Qc,{className:"w-3 h-3 text-green-500"}),f("codeEditor.valid",{language:t.toUpperCase()})]}):p.jsxs("span",{className:"flex items-center gap-1 text-destructive",children:[p.jsx(Cc,{className:"w-3 h-3"}),k.error,k.line&&` (line ${k.line})`]}),i&&p.jsx("span",{className:"ml-auto text-muted-foreground",children:f("codeEditor.readOnly")})]})]})}const Lf=Object.freeze(Object.defineProperty({__proto__:null,CodeEditor:ZM},Symbol.toStringTag,{value:"Module"})),EK={browserConfig:null,browserStatus:null,browserLoading:!0,browserStatusLoading:!0,browserSaving:!1,browserError:null,browserSuccess:!1,webSearchConfig:null,webSearchStatus:null,webSearchLoading:!0,webSearchStatusLoading:!0,webSearchSaving:!1,webSearchError:null,webSearchSuccess:!1,globalEnvConfig:null,globalEnvLoading:!0,globalEnvSaving:!1,globalEnvError:null,globalEnvSuccess:!1,proxyConfig:null,proxyLoading:!0,proxySaving:!1,proxyError:null,proxySuccess:!1,proxyTestResult:null,proxyTesting:!1,rawConfig:null,rawConfigLoading:!1};function IK(n,e){switch(e.type){case"SET_BROWSER_CONFIG":return{...n,browserConfig:e.payload};case"SET_BROWSER_STATUS":return{...n,browserStatus:e.payload};case"SET_BROWSER_LOADING":return{...n,browserLoading:e.payload};case"SET_BROWSER_STATUS_LOADING":return{...n,browserStatusLoading:e.payload};case"SET_BROWSER_SAVING":return{...n,browserSaving:e.payload};case"SET_BROWSER_ERROR":return{...n,browserError:e.payload};case"SET_BROWSER_SUCCESS":return{...n,browserSuccess:e.payload};case"SET_WEBSEARCH_CONFIG":return{...n,webSearchConfig:e.payload};case"SET_WEBSEARCH_STATUS":return{...n,webSearchStatus:e.payload};case"SET_WEBSEARCH_LOADING":return{...n,webSearchLoading:e.payload};case"SET_WEBSEARCH_STATUS_LOADING":return{...n,webSearchStatusLoading:e.payload};case"SET_WEBSEARCH_SAVING":return{...n,webSearchSaving:e.payload};case"SET_WEBSEARCH_ERROR":return{...n,webSearchError:e.payload};case"SET_WEBSEARCH_SUCCESS":return{...n,webSearchSuccess:e.payload};case"SET_GLOBALENV_CONFIG":return{...n,globalEnvConfig:e.payload};case"SET_GLOBALENV_LOADING":return{...n,globalEnvLoading:e.payload};case"SET_GLOBALENV_SAVING":return{...n,globalEnvSaving:e.payload};case"SET_GLOBALENV_ERROR":return{...n,globalEnvError:e.payload};case"SET_GLOBALENV_SUCCESS":return{...n,globalEnvSuccess:e.payload};case"SET_PROXY_CONFIG":return{...n,proxyConfig:e.payload};case"SET_PROXY_LOADING":return{...n,proxyLoading:e.payload};case"SET_PROXY_SAVING":return{...n,proxySaving:e.payload};case"SET_PROXY_ERROR":return{...n,proxyError:e.payload};case"SET_PROXY_SUCCESS":return{...n,proxySuccess:e.payload};case"SET_PROXY_TEST_RESULT":return{...n,proxyTestResult:e.payload};case"SET_PROXY_TESTING":return{...n,proxyTesting:e.payload};case"SET_RAW_CONFIG":return{...n,rawConfig:e.payload};case"SET_RAW_CONFIG_LOADING":return{...n,rawConfigLoading:e.payload};default:return n}}const eR=w.createContext(null);function jK({children:n}){const[e,t]=w.useReducer(IK,EK);return p.jsx(eR.Provider,{value:{state:e,dispatch:t},children:n})}function tR(){const n=w.useContext(eR);if(!n)throw new Error("useSettingsContext must be used within a SettingsProvider");return n}function BK(){const{dispatch:n}=tR(),e=w.useCallback(B=>n({type:"SET_BROWSER_CONFIG",payload:B}),[n]),t=w.useCallback(B=>n({type:"SET_BROWSER_STATUS",payload:B}),[n]),i=w.useCallback(B=>n({type:"SET_BROWSER_LOADING",payload:B}),[n]),o=w.useCallback(B=>n({type:"SET_BROWSER_STATUS_LOADING",payload:B}),[n]),s=w.useCallback(B=>n({type:"SET_BROWSER_SAVING",payload:B}),[n]),r=w.useCallback(B=>n({type:"SET_BROWSER_ERROR",payload:B}),[n]),c=w.useCallback(B=>n({type:"SET_BROWSER_SUCCESS",payload:B}),[n]),u=w.useCallback(B=>n({type:"SET_WEBSEARCH_CONFIG",payload:B}),[n]),f=w.useCallback(B=>n({type:"SET_WEBSEARCH_STATUS",payload:B}),[n]),m=w.useCallback(B=>n({type:"SET_WEBSEARCH_LOADING",payload:B}),[n]),g=w.useCallback(B=>n({type:"SET_WEBSEARCH_STATUS_LOADING",payload:B}),[n]),v=w.useCallback(B=>n({type:"SET_WEBSEARCH_SAVING",payload:B}),[n]),x=w.useCallback(B=>n({type:"SET_WEBSEARCH_ERROR",payload:B}),[n]),C=w.useCallback(B=>n({type:"SET_WEBSEARCH_SUCCESS",payload:B}),[n]),k=w.useCallback(B=>n({type:"SET_GLOBALENV_CONFIG",payload:B}),[n]),P=w.useCallback(B=>n({type:"SET_GLOBALENV_LOADING",payload:B}),[n]),D=w.useCallback(B=>n({type:"SET_GLOBALENV_SAVING",payload:B}),[n]),O=w.useCallback(B=>n({type:"SET_GLOBALENV_ERROR",payload:B}),[n]),T=w.useCallback(B=>n({type:"SET_GLOBALENV_SUCCESS",payload:B}),[n]),M=w.useCallback(B=>n({type:"SET_PROXY_CONFIG",payload:B}),[n]),L=w.useCallback(B=>n({type:"SET_PROXY_LOADING",payload:B}),[n]),R=w.useCallback(B=>n({type:"SET_PROXY_SAVING",payload:B}),[n]),I=w.useCallback(B=>n({type:"SET_PROXY_ERROR",payload:B}),[n]),W=w.useCallback(B=>n({type:"SET_PROXY_SUCCESS",payload:B}),[n]),_=w.useCallback(B=>n({type:"SET_PROXY_TEST_RESULT",payload:B}),[n]),z=w.useCallback(B=>n({type:"SET_PROXY_TESTING",payload:B}),[n]),$=w.useCallback(B=>n({type:"SET_RAW_CONFIG",payload:B}),[n]),F=w.useCallback(B=>n({type:"SET_RAW_CONFIG_LOADING",payload:B}),[n]);return w.useMemo(()=>({setBrowserConfig:e,setBrowserStatus:t,setBrowserLoading:i,setBrowserStatusLoading:o,setBrowserSaving:s,setBrowserError:r,setBrowserSuccess:c,setWebSearchConfig:u,setWebSearchStatus:f,setWebSearchLoading:m,setWebSearchStatusLoading:g,setWebSearchSaving:v,setWebSearchError:x,setWebSearchSuccess:C,setGlobalEnvConfig:k,setGlobalEnvLoading:P,setGlobalEnvSaving:D,setGlobalEnvError:O,setGlobalEnvSuccess:T,setProxyConfig:M,setProxyLoading:L,setProxySaving:R,setProxyError:I,setProxySuccess:W,setProxyTestResult:_,setProxyTesting:z,setRawConfig:$,setRawConfigLoading:F}),[e,t,i,o,s,r,c,u,f,m,g,v,x,C,k,P,D,O,T,M,L,R,I,W,_,z,$,F])}function HK(){const[n,e]=a1(),t=n.get("tab")?.toLowerCase(),i=t==="imageanalysis"||t==="image"?"image":t==="channels"?"channels":t==="globalenv"?"globalenv":t==="proxy"?"proxy":t==="auth"?"auth":t==="thinking"?"thinking":t==="backups"?"backups":"websearch",o=w.useCallback(s=>{e({tab:s},{replace:!0})},[e]);return{activeTab:i,setActiveTab:o}}function UK(){const{state:n}=tR(),e=BK(),[t,i]=w.useState(!1),o=w.useCallback(async()=>{try{e.setRawConfigLoading(!0);const r=await fetch("/api/config/raw");if(!r.ok){e.setRawConfig(null);return}const c=await r.text();e.setRawConfig(c)}catch{e.setRawConfig(null)}finally{e.setRawConfigLoading(!1)}},[e]),s=w.useCallback(async()=>{if(n.rawConfig)try{await navigator.clipboard.writeText(n.rawConfig),i(!0),setTimeout(()=>i(!1),2e3)}catch{}},[n.rawConfig]);return{rawConfig:n.rawConfig,loading:n.rawConfigLoading,copied:t,fetchRawConfig:o,copyToClipboard:s}}function bA({activeTab:n,onTabChange:e}){const{t}=ve(),i=[{value:"browser",label:t("settingsTabs.browser"),icon:YE},{value:"websearch",label:t("settingsTabs.web"),icon:m1},{value:"image",label:t("settingsTabs.image"),icon:b1},{value:"channels",label:t("settingsTabs.channels"),icon:$E},{value:"globalenv",label:t("settingsTabs.env"),icon:kb},{value:"thinking",label:t("settingsTabs.think"),icon:XE},{value:"proxy",label:t("settingsTabs.proxy"),icon:JE},{value:"auth",label:t("settingsTabs.auth"),icon:xb},{value:"backups",label:t("settingsTabs.backup"),icon:ZE}];return p.jsx(TD,{value:n,onValueChange:o=>e(o),children:p.jsx(Xb,{className:"grid w-full grid-cols-9",children:i.map(({value:o,label:s,icon:r})=>p.jsxs(vh,{value:o,className:"gap-1.5 px-2 text-xs",children:[p.jsx(r,{className:"h-3.5 w-3.5 shrink-0"}),p.jsx("span",{className:"truncate",children:s})]},o))})})}function vA(){return p.jsxs("div",{className:"flex-1 p-5 space-y-6",children:[p.jsx(tt,{className:"h-4 w-2/3"}),p.jsx("div",{className:"p-4 rounded-lg border",children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx(tt,{className:"h-5 w-32"}),p.jsx(tt,{className:"h-4 w-48"})]}),p.jsx(tt,{className:"h-6 w-10 rounded-full"})]})}),p.jsxs("div",{className:"space-y-3",children:[p.jsx(tt,{className:"h-5 w-24"}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(tt,{className:"h-20 w-full rounded-lg"}),p.jsx(tt,{className:"h-20 w-full rounded-lg"}),p.jsx(tt,{className:"h-20 w-full rounded-lg"})]})]})]})}function nR(n,e=3,t=1e3){return n().catch(i=>{if(e<=0)throw i;return new Promise(o=>setTimeout(o,t)).then(()=>nR(n,e-1,t*2))})}function Bo(n){return w.lazy(()=>nR(n))}const xA=Bo(()=>lt(()=>import("./index-AosRBwPp.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),CA=Bo(()=>lt(()=>import("./index-BCqgbLRB.js"),__vite__mapDeps([10,1,2,11,4,5,6,7,8,9]))),SA=Bo(()=>lt(()=>import("./index-BxcCMHzL.js"),__vite__mapDeps([12,1,2,4,5,6,7,8,9]))),kA=Bo(()=>lt(()=>import("./channels-C6JAnQ-P.js"),__vite__mapDeps([13,1,2,4,5,6,7,8,9]))),wA=Bo(()=>lt(()=>import("./globalenv-section-D0iUrk5Z.js"),__vite__mapDeps([14,1,2,4,5,6,7,8,9]))),PA=Bo(()=>lt(()=>import("./index-DvvpgsgL.js"),__vite__mapDeps([15,1,2,4,5,6,7,8,9]))),AA=Bo(()=>lt(()=>import("./index-DZbSKKhp.js"),__vite__mapDeps([16,1,2,17,4,18,19,5,6,20,21,7,8,9]))),DA=Bo(()=>lt(()=>import("./auth-section-ud23YOqo.js"),__vite__mapDeps([22,1,2,4,5,6,7,8,9]))),OA=Bo(()=>lt(()=>import("./backups-section-BvojIR_s.js"),__vite__mapDeps([23,1,2,19,4,5,6,7,8,9])));class TA extends w.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}render(){return this.state.hasError?p.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:p.jsxs("div",{className:"text-center p-6 max-w-md",children:[p.jsx(Cc,{className:"w-12 h-12 mx-auto mb-4 text-destructive"}),p.jsx("p",{className:"font-medium text-foreground mb-2",children:re.t("settings.sectionLoadFailed")}),p.jsx("p",{className:"text-sm mb-4",children:this.state.error?.message||re.t("settings.unknownError")}),p.jsxs(ft,{variant:"outline",onClick:()=>window.location.reload(),className:"inline-flex items-center gap-2",children:[p.jsx(xc,{className:"w-4 h-4"}),re.t("settings.reloadPage")]})]})}):this.props.children}}function _K(n){switch(n?.toLowerCase()){case"browser":return"browser";case"imageanalysis":case"image":return"image";case"channels":return"channels";case"globalenv":return"globalenv";case"proxy":return"proxy";case"auth":return"auth";case"thinking":return"thinking";case"backups":return"backups";default:return"websearch"}}function zK(){const{t:n}=ve(),{setActiveTab:e}=HK(),[t]=a1(),i=_K(t.get("tab")),{rawConfig:o,loading:s,copied:r,fetchRawConfig:c,copyToClipboard:u}=UK();w.useEffect(()=>{c()},[c]);const f=m=>{w.startTransition(()=>{e(m)})};return p.jsxs("div",{className:"h-full min-h-0",children:[p.jsxs("div",{className:"md:hidden h-full flex flex-col",children:[p.jsx("div",{className:"border-b bg-background p-4",children:p.jsx(bA,{activeTab:i,onTabChange:f})}),p.jsx(TA,{children:p.jsxs(w.Suspense,{fallback:p.jsx(vA,{}),children:[i==="browser"&&p.jsx(CA,{}),i==="websearch"&&p.jsx(xA,{}),i==="image"&&p.jsx(SA,{}),i==="channels"&&p.jsx(kA,{}),i==="globalenv"&&p.jsx(wA,{}),i==="thinking"&&p.jsx(PA,{}),i==="proxy"&&p.jsx(AA,{}),i==="auth"&&p.jsx(DA,{}),i==="backups"&&p.jsx(OA,{})]})})]}),p.jsxs(Yb,{direction:"horizontal",className:"h-full hidden md:flex",children:[p.jsx(kc,{defaultSize:46,minSize:36,maxSize:62,children:p.jsxs("div",{className:"h-full border-r flex flex-col bg-muted/30 relative",children:[p.jsx("div",{className:"p-5 border-b bg-background",children:p.jsx(bA,{activeTab:i,onTabChange:f})}),p.jsx(TA,{children:p.jsxs(w.Suspense,{fallback:p.jsx(vA,{}),children:[i==="browser"&&p.jsx(CA,{}),i==="websearch"&&p.jsx(xA,{}),i==="image"&&p.jsx(SA,{}),i==="channels"&&p.jsx(kA,{}),i==="globalenv"&&p.jsx(wA,{}),i==="thinking"&&p.jsx(PA,{}),i==="proxy"&&p.jsx(AA,{}),i==="auth"&&p.jsx(DA,{}),i==="backups"&&p.jsx(OA,{})]})})]})}),p.jsx($b,{className:"w-2 bg-border hover:bg-primary/20 transition-colors cursor-col-resize flex items-center justify-center group",children:p.jsx(Yh,{className:"w-3 h-3 text-muted-foreground group-hover:text-primary"})}),p.jsx(kc,{defaultSize:54,minSize:35,children:p.jsxs("div",{className:"h-full flex flex-col",children:[p.jsxs("div",{className:"p-4 border-b bg-background flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(tk,{className:"w-5 h-5 text-primary"}),p.jsxs("div",{children:[p.jsx("h2",{className:"font-semibold",children:"config.yaml"}),p.jsx("p",{className:"text-sm text-muted-foreground",children:"~/.ccs/config.yaml"})]})]}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx(ft,{variant:"outline",size:"sm",onClick:u,disabled:!o,children:r?p.jsxs(p.Fragment,{children:[p.jsx(Er,{className:"w-4 h-4 mr-1"}),n("settings.copied")]}):p.jsxs(p.Fragment,{children:[p.jsx(hh,{className:"w-4 h-4 mr-1"}),n("settings.copy")]})}),p.jsx(ft,{variant:"outline",size:"sm",onClick:c,disabled:s,children:p.jsx(xc,{className:`w-4 h-4 ${s?"animate-spin":""}`})})]})]}),p.jsx("div",{className:"flex-1 overflow-auto",children:o?p.jsx(ZM,{value:o,onChange:()=>{},language:"yaml",readonly:!0,minHeight:"auto",className:"min-h-full"}):s?p.jsxs("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:[p.jsx(xc,{className:"w-5 h-5 animate-spin mr-2"}),n("settings.loading")]}):p.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:p.jsxs("div",{className:"text-center",children:[p.jsx(tk,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),p.jsx("p",{children:n("settings.configFileNotFound")}),p.jsx("code",{className:"text-sm bg-muted px-2 py-1 rounded mt-2 inline-block",children:"ccs migrate"})]})})})]})})]})]})}function FK(){return p.jsx(jK,{children:p.jsx(zK,{})})}const qK=Object.freeze(Object.defineProperty({__proto__:null,SettingsPage:FK},Symbol.toStringTag,{value:"Module"}));function GK(n,e,t="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:n,timeZoneName:t}).format(e).split(/\s/g).slice(2).join(" ")}const VK={},oc={};function ls(n,e){try{const i=(VK[n]||=new Intl.DateTimeFormat("en-US",{timeZone:n,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return i in oc?oc[i]:MA(i,i.split(":"))}catch{if(n in oc)return oc[n];const t=n?.match(KK);return t?MA(n,t.slice(1)):NaN}}const KK=/([+-]\d\d):?(\d\d)?/;function MA(n,e){const t=+(e[0]||0),i=+(e[1]||0),o=+(e[2]||0)/60;return oc[n]=t*60+i>0?t*60+i+o:t*60-i-o}class Wi extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(ls(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),iR(this),bb(this)):this.setTime(Date.now())}static tz(e,...t){return t.length?new Wi(...t,e):new Wi(Date.now(),e)}withTimeZone(e){return new Wi(+this,e)}getTimezoneOffset(){const e=-ls(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),bb(this),+this}[Symbol.for("constructDateFrom")](e){return new Wi(+new Date(e),this.timeZone)}}const RA=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(n=>{if(!RA.test(n))return;const e=n.replace(RA,"$1UTC");Wi.prototype[e]&&(n.startsWith("get")?Wi.prototype[n]=function(){return this.internal[e]()}:(Wi.prototype[n]=function(){return Date.prototype[e].apply(this.internal,arguments),WK(this),+this},Wi.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),bb(this),+this}))});function bb(n){n.internal.setTime(+n),n.internal.setUTCSeconds(n.internal.getUTCSeconds()-Math.round(-ls(n.timeZone,n)*60))}function WK(n){Date.prototype.setFullYear.call(n,n.internal.getUTCFullYear(),n.internal.getUTCMonth(),n.internal.getUTCDate()),Date.prototype.setHours.call(n,n.internal.getUTCHours(),n.internal.getUTCMinutes(),n.internal.getUTCSeconds(),n.internal.getUTCMilliseconds()),iR(n)}function iR(n){const e=ls(n.timeZone,n),t=e>0?Math.floor(e):Math.ceil(e),i=new Date(+n);i.setUTCHours(i.getUTCHours()-1);const o=-new Date(+n).getTimezoneOffset(),s=-new Date(+i).getTimezoneOffset(),r=o-s,c=Date.prototype.getHours.apply(n)!==n.internal.getUTCHours();r&&c&&n.internal.setUTCMinutes(n.internal.getUTCMinutes()+r);const u=o-t;u&&Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+u);const f=new Date(+n);f.setUTCSeconds(0);const m=o>0?f.getSeconds():(f.getSeconds()-60)%60,g=Math.round(-(ls(n.timeZone,n)*60))%60;(g||m)&&(n.internal.setUTCSeconds(n.internal.getUTCSeconds()+g),Date.prototype.setUTCSeconds.call(n,Date.prototype.getUTCSeconds.call(n)+g+m));const v=ls(n.timeZone,n),x=v>0?Math.floor(v):Math.ceil(v),k=-new Date(+n).getTimezoneOffset()-x,P=x!==t,D=k-u;if(P&&D){Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+D);const O=ls(n.timeZone,n),T=O>0?Math.floor(O):Math.ceil(O),M=x-T;M&&(n.internal.setUTCMinutes(n.internal.getUTCMinutes()+M),Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+M))}}class Oo extends Wi{static tz(e,...t){return t.length?new Oo(...t,e):new Oo(Date.now(),e)}toISOString(){const[e,t,i]=this.tzComponents(),o=`${e}${t}:${i}`;return this.internal.toISOString().slice(0,-1)+o}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,t,i,o]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${i} ${t} ${o}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[t,i,o]=this.tzComponents();return`${e} GMT${t}${i}${o} (${GK(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),t=e>0?"-":"+",i=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),o=String(Math.abs(e)%60).padStart(2,"0");return[t,i,o]}withTimeZone(e){return new Oo(+this,e)}[Symbol.for("constructDateFrom")](e){return new Oo(+new Date(e),this.timeZone)}}const LA=5,QK=4;function YK(n,e){const t=e.startOfMonth(n),i=t.getDay()>0?t.getDay():7,o=e.addDays(n,-i+1),s=e.addDays(o,LA*7-1);return e.getMonth(n)===e.getMonth(s)?LA:QK}function oR(n,e){const t=e.startOfMonth(n),i=t.getDay();return i===1?t:i===0?e.addDays(t,-6):e.addDays(t,-1*(i-1))}function $K(n,e){const t=oR(n,e),i=YK(n,e);return e.addDays(t,i*7-1)}const aR={...zl,labels:{labelDayButton:(n,e,t,i)=>{let o;i&&typeof i.format=="function"?o=i.format.bind(i):o=(r,c)=>$l(r,c,{locale:zl,...t});let s=o(n,"PPPP");return e.today&&(s=`Today, ${s}`),e.selected&&(s=`${s}, selected`),s},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:n=>`Week ${n}`,labelYearDropdown:"Choose the Year",labelGrid:(n,e,t)=>{let i;return t&&typeof t.format=="function"?i=t.format.bind(t):i=(o,s)=>$l(o,s,{locale:zl,...e}),i(n,"LLLL yyyy")},labelGridcell:(n,e,t,i)=>{let o;i&&typeof i.format=="function"?o=i.format.bind(i):o=(r,c)=>$l(r,c,{locale:zl,...t});let s=o(n,"PPPP");return e?.today&&(s=`Today, ${s}`),s},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(n,e,t)=>{let i;return t&&typeof t.format=="function"?i=t.format.bind(t):i=(o,s)=>$l(o,s,{locale:zl,...e}),i(n,"cccc")}}};class $n{constructor(e,t){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Oo.tz(this.options.timeZone):new this.Date,this.newDate=(i,o,s)=>this.overrides?.newDate?this.overrides.newDate(i,o,s):this.options.timeZone?new Oo(i,o,s,this.options.timeZone):new Date(i,o,s),this.addDays=(i,o)=>this.overrides?.addDays?this.overrides.addDays(i,o):oI(i,o),this.addMonths=(i,o)=>this.overrides?.addMonths?this.overrides.addMonths(i,o):aI(i,o),this.addWeeks=(i,o)=>this.overrides?.addWeeks?this.overrides.addWeeks(i,o):sI(i,o),this.addYears=(i,o)=>this.overrides?.addYears?this.overrides.addYears(i,o):rI(i,o),this.differenceInCalendarDays=(i,o)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(i,o):lI(i,o),this.differenceInCalendarMonths=(i,o)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(i,o):cI(i,o),this.eachMonthOfInterval=i=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(i):dI(i),this.eachYearOfInterval=i=>{const o=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(i):uI(i),s=new Set(o.map(c=>this.getYear(c)));if(s.size===o.length)return o;const r=[];return s.forEach(c=>{r.push(new Date(c,0,1))}),r},this.endOfBroadcastWeek=i=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(i):$K(i,this),this.endOfISOWeek=i=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(i):hI(i),this.endOfMonth=i=>this.overrides?.endOfMonth?this.overrides.endOfMonth(i):fI(i),this.endOfWeek=(i,o)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(i,o):pI(i,this.options),this.endOfYear=i=>this.overrides?.endOfYear?this.overrides.endOfYear(i):mI(i),this.format=(i,o,s)=>{const r=this.overrides?.format?this.overrides.format(i,o,this.options):$l(i,o,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(r):r},this.getISOWeek=i=>this.overrides?.getISOWeek?this.overrides.getISOWeek(i):gI(i),this.getMonth=(i,o)=>this.overrides?.getMonth?this.overrides.getMonth(i,this.options):yI(i,this.options),this.getYear=(i,o)=>this.overrides?.getYear?this.overrides.getYear(i,this.options):bI(i,this.options),this.getWeek=(i,o)=>this.overrides?.getWeek?this.overrides.getWeek(i,this.options):vI(i,this.options),this.isAfter=(i,o)=>this.overrides?.isAfter?this.overrides.isAfter(i,o):xI(i,o),this.isBefore=(i,o)=>this.overrides?.isBefore?this.overrides.isBefore(i,o):CI(i,o),this.isDate=i=>this.overrides?.isDate?this.overrides.isDate(i):SI(i),this.isSameDay=(i,o)=>this.overrides?.isSameDay?this.overrides.isSameDay(i,o):kI(i,o),this.isSameMonth=(i,o)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(i,o):wI(i,o),this.isSameYear=(i,o)=>this.overrides?.isSameYear?this.overrides.isSameYear(i,o):PI(i,o),this.max=i=>this.overrides?.max?this.overrides.max(i):AI(i),this.min=i=>this.overrides?.min?this.overrides.min(i):DI(i),this.setMonth=(i,o)=>this.overrides?.setMonth?this.overrides.setMonth(i,o):OI(i,o),this.setYear=(i,o)=>this.overrides?.setYear?this.overrides.setYear(i,o):TI(i,o),this.startOfBroadcastWeek=(i,o)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(i,this):oR(i,this),this.startOfDay=i=>this.overrides?.startOfDay?this.overrides.startOfDay(i):MI(i),this.startOfISOWeek=i=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(i):RI(i),this.startOfMonth=i=>this.overrides?.startOfMonth?this.overrides.startOfMonth(i):LI(i),this.startOfWeek=(i,o)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(i,this.options):NI(i,this.options),this.startOfYear=i=>this.overrides?.startOfYear?this.overrides.startOfYear(i):EI(i),this.options={locale:aR,...e},this.overrides=t}getDigitMap(){const{numerals:e="latn"}=this.options,t=new Intl.NumberFormat("en-US",{numberingSystem:e}),i={};for(let o=0;o<10;o++)i[o.toString()]=t.format(o);return i}replaceDigits(e){const t=this.getDigitMap();return e.replace(/\d/g,i=>t[i]||i)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){const e=this.options.locale?.code;return e&&$n.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:t,timeZone:i,numerals:o}=this.options,s=t?.code;if(s&&$n.yearFirstLocales.has(s))try{return new Intl.DateTimeFormat(s,{month:"long",year:"numeric",timeZone:i,numberingSystem:o}).format(e)}catch{}const r=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,r)}}$n.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const io=new $n;class sR{constructor(e,t,i=io){this.date=e,this.displayMonth=t,this.outside=!!(t&&!i.isSameMonth(e,t)),this.dateLib=i,this.isoDate=i.format(e,"yyyy-MM-dd"),this.displayMonthId=i.format(t,"yyyy-MM"),this.dateMonthId=i.format(e,"yyyy-MM")}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class XK{constructor(e,t){this.date=e,this.weeks=t}}class JK{constructor(e,t){this.days=t,this.weekNumber=e}}function ZK(n){return ge.createElement("button",{...n})}function e8(n){return ge.createElement("span",{...n})}function t8(n){const{size:e=24,orientation:t="left",className:i}=n;return ge.createElement("svg",{className:i,width:e,height:e,viewBox:"0 0 24 24"},t==="up"&&ge.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),t==="down"&&ge.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),t==="left"&&ge.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),t==="right"&&ge.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function n8(n){const{day:e,modifiers:t,...i}=n;return ge.createElement("td",{...i})}function i8(n){const{day:e,modifiers:t,...i}=n,o=ge.useRef(null);return ge.useEffect(()=>{t.focused&&o.current?.focus()},[t.focused]),ge.createElement("button",{ref:o,...i})}var we;(function(n){n.Root="root",n.Chevron="chevron",n.Day="day",n.DayButton="day_button",n.CaptionLabel="caption_label",n.Dropdowns="dropdowns",n.Dropdown="dropdown",n.DropdownRoot="dropdown_root",n.Footer="footer",n.MonthGrid="month_grid",n.MonthCaption="month_caption",n.MonthsDropdown="months_dropdown",n.Month="month",n.Months="months",n.Nav="nav",n.NextMonthButton="button_next",n.PreviousMonthButton="button_previous",n.Week="week",n.Weeks="weeks",n.Weekday="weekday",n.Weekdays="weekdays",n.WeekNumber="week_number",n.WeekNumberHeader="week_number_header",n.YearsDropdown="years_dropdown"})(we||(we={}));var wt;(function(n){n.disabled="disabled",n.hidden="hidden",n.outside="outside",n.focused="focused",n.today="today"})(wt||(wt={}));var Si;(function(n){n.range_end="range_end",n.range_middle="range_middle",n.range_start="range_start",n.selected="selected"})(Si||(Si={}));var Qn;(function(n){n.weeks_before_enter="weeks_before_enter",n.weeks_before_exit="weeks_before_exit",n.weeks_after_enter="weeks_after_enter",n.weeks_after_exit="weeks_after_exit",n.caption_after_enter="caption_after_enter",n.caption_after_exit="caption_after_exit",n.caption_before_enter="caption_before_enter",n.caption_before_exit="caption_before_exit"})(Qn||(Qn={}));function o8(n){const{options:e,className:t,components:i,classNames:o,...s}=n,r=[o[we.Dropdown],t].join(" "),c=e?.find(({value:u})=>u===s.value);return ge.createElement("span",{"data-disabled":s.disabled,className:o[we.DropdownRoot]},ge.createElement(i.Select,{className:r,...s},e?.map(({value:u,label:f,disabled:m})=>ge.createElement(i.Option,{key:u,value:u,disabled:m},f))),ge.createElement("span",{className:o[we.CaptionLabel],"aria-hidden":!0},c?.label,ge.createElement(i.Chevron,{orientation:"down",size:18,className:o[we.Chevron]})))}function a8(n){return ge.createElement("div",{...n})}function s8(n){return ge.createElement("div",{...n})}function r8(n){const{calendarMonth:e,displayIndex:t,...i}=n;return ge.createElement("div",{...i},n.children)}function l8(n){const{calendarMonth:e,displayIndex:t,...i}=n;return ge.createElement("div",{...i})}function c8(n){return ge.createElement("table",{...n})}function d8(n){return ge.createElement("div",{...n})}const rR=w.createContext(void 0);function id(){const n=w.useContext(rR);if(n===void 0)throw new Error("useDayPicker() must be used within a custom component.");return n}function u8(n){const{components:e}=id();return ge.createElement(e.Dropdown,{...n})}function h8(n){const{onPreviousClick:e,onNextClick:t,previousMonth:i,nextMonth:o,...s}=n,{components:r,classNames:c,labels:{labelPrevious:u,labelNext:f}}=id(),m=w.useCallback(v=>{o&&t?.(v)},[o,t]),g=w.useCallback(v=>{i&&e?.(v)},[i,e]);return ge.createElement("nav",{...s},ge.createElement(r.PreviousMonthButton,{type:"button",className:c[we.PreviousMonthButton],tabIndex:i?void 0:-1,"aria-disabled":i?void 0:!0,"aria-label":u(i),onClick:g},ge.createElement(r.Chevron,{disabled:i?void 0:!0,className:c[we.Chevron],orientation:"left"})),ge.createElement(r.NextMonthButton,{type:"button",className:c[we.NextMonthButton],tabIndex:o?void 0:-1,"aria-disabled":o?void 0:!0,"aria-label":f(o),onClick:m},ge.createElement(r.Chevron,{disabled:o?void 0:!0,orientation:"right",className:c[we.Chevron]})))}function f8(n){const{components:e}=id();return ge.createElement(e.Button,{...n})}function p8(n){return ge.createElement("option",{...n})}function m8(n){const{components:e}=id();return ge.createElement(e.Button,{...n})}function g8(n){const{rootRef:e,...t}=n;return ge.createElement("div",{...t,ref:e})}function y8(n){return ge.createElement("select",{...n})}function b8(n){const{week:e,...t}=n;return ge.createElement("tr",{...t})}function v8(n){return ge.createElement("th",{...n})}function x8(n){return ge.createElement("thead",{"aria-hidden":!0},ge.createElement("tr",{...n}))}function C8(n){const{week:e,...t}=n;return ge.createElement("th",{...t})}function S8(n){return ge.createElement("th",{...n})}function k8(n){return ge.createElement("tbody",{...n})}function w8(n){const{components:e}=id();return ge.createElement(e.Dropdown,{...n})}const P8=Object.freeze(Object.defineProperty({__proto__:null,Button:ZK,CaptionLabel:e8,Chevron:t8,Day:n8,DayButton:i8,Dropdown:o8,DropdownNav:a8,Footer:s8,Month:r8,MonthCaption:l8,MonthGrid:c8,Months:d8,MonthsDropdown:u8,Nav:h8,NextMonthButton:f8,Option:p8,PreviousMonthButton:m8,Root:g8,Select:y8,Week:b8,WeekNumber:C8,WeekNumberHeader:S8,Weekday:v8,Weekdays:x8,Weeks:k8,YearsDropdown:w8},Symbol.toStringTag,{value:"Module"}));function To(n,e,t=!1,i=io){let{from:o,to:s}=n;const{differenceInCalendarDays:r,isSameDay:c}=i;return o&&s?(r(s,o)<0&&([o,s]=[s,o]),r(e,o)>=(t?1:0)&&r(s,e)>=(t?1:0)):!t&&s?c(s,e):!t&&o?c(o,e):!1}function Xv(n){return!!(n&&typeof n=="object"&&"before"in n&&"after"in n)}function Nf(n){return!!(n&&typeof n=="object"&&"from"in n)}function Jv(n){return!!(n&&typeof n=="object"&&"after"in n)}function Zv(n){return!!(n&&typeof n=="object"&&"before"in n)}function lR(n){return!!(n&&typeof n=="object"&&"dayOfWeek"in n)}function cR(n,e){return Array.isArray(n)&&n.every(e.isDate)}function Mo(n,e,t=io){const i=Array.isArray(e)?e:[e],{isSameDay:o,differenceInCalendarDays:s,isAfter:r}=t;return i.some(c=>{if(typeof c=="boolean")return c;if(t.isDate(c))return o(n,c);if(cR(c,t))return c.some(u=>o(n,u));if(Nf(c))return To(c,n,!1,t);if(lR(c))return Array.isArray(c.dayOfWeek)?c.dayOfWeek.includes(n.getDay()):c.dayOfWeek===n.getDay();if(Xv(c)){const u=s(c.before,n),f=s(c.after,n),m=u>0,g=f<0;return r(c.before,c.after)?g&&m:m||g}return Jv(c)?s(n,c.after)>0:Zv(c)?s(c.before,n)>0:typeof c=="function"?c(n):!1})}function A8(n,e,t,i,o){const{disabled:s,hidden:r,modifiers:c,showOutsideDays:u,broadcastCalendar:f,today:m=o.today()}=e,{isSameDay:g,isSameMonth:v,startOfMonth:x,isBefore:C,endOfMonth:k,isAfter:P}=o,D=t&&x(t),O=i&&k(i),T={[wt.focused]:[],[wt.outside]:[],[wt.disabled]:[],[wt.hidden]:[],[wt.today]:[]},M={};for(const L of n){const{date:R,displayMonth:I}=L,W=!!(I&&!v(R,I)),_=!!(D&&C(R,D)),z=!!(O&&P(R,O)),$=!!(s&&Mo(R,s,o)),F=!!(r&&Mo(R,r,o))||_||z||!f&&!u&&W||f&&u===!1&&W,B=g(R,m);W&&T.outside.push(L),$&&T.disabled.push(L),F&&T.hidden.push(L),B&&T.today.push(L),c&&Object.keys(c).forEach(ie=>{const oe=c?.[ie];oe&&Mo(R,oe,o)&&(M[ie]?M[ie].push(L):M[ie]=[L])})}return L=>{const R={[wt.focused]:!1,[wt.disabled]:!1,[wt.hidden]:!1,[wt.outside]:!1,[wt.today]:!1},I={};for(const W in T){const _=T[W];R[W]=_.some(z=>z===L)}for(const W in M)I[W]=M[W].some(_=>_===L);return{...R,...I}}}function D8(n,e,t={}){return Object.entries(n).filter(([,o])=>o===!0).reduce((o,[s])=>(t[s]?o.push(t[s]):e[wt[s]]?o.push(e[wt[s]]):e[Si[s]]&&o.push(e[Si[s]]),o),[e[we.Day]])}function O8(n){return{...P8,...n}}function T8(n){const e={"data-mode":n.mode??void 0,"data-required":"required"in n?n.required:void 0,"data-multiple-months":n.numberOfMonths&&n.numberOfMonths>1||void 0,"data-week-numbers":n.showWeekNumber||void 0,"data-broadcast-calendar":n.broadcastCalendar||void 0,"data-nav-layout":n.navLayout||void 0};return Object.entries(n).forEach(([t,i])=>{t.startsWith("data-")&&(e[t]=i)}),e}function M8(){const n={};for(const e in we)n[we[e]]=`rdp-${we[e]}`;for(const e in wt)n[wt[e]]=`rdp-${wt[e]}`;for(const e in Si)n[Si[e]]=`rdp-${Si[e]}`;for(const e in Qn)n[Qn[e]]=`rdp-${Qn[e]}`;return n}function dR(n,e,t){return(t??new $n(e)).formatMonthYear(n)}const R8=dR;function L8(n,e,t){return(t??new $n(e)).format(n,"d")}function N8(n,e=io){return e.format(n,"LLLL")}function E8(n,e,t){return(t??new $n(e)).format(n,"cccccc")}function I8(n,e=io){return n<10?e.formatNumber(`0${n.toLocaleString()}`):e.formatNumber(`${n.toLocaleString()}`)}function j8(){return""}function uR(n,e=io){return e.format(n,"yyyy")}const B8=uR,H8=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:dR,formatDay:L8,formatMonthCaption:R8,formatMonthDropdown:N8,formatWeekNumber:I8,formatWeekNumberHeader:j8,formatWeekdayName:E8,formatYearCaption:B8,formatYearDropdown:uR},Symbol.toStringTag,{value:"Module"}));function U8(n){return n?.formatMonthCaption&&!n.formatCaption&&(n.formatCaption=n.formatMonthCaption),n?.formatYearCaption&&!n.formatYearDropdown&&(n.formatYearDropdown=n.formatYearCaption),{...H8,...n}}function ex(n,e,t,i){let o=(i??new $n(t)).format(n,"PPPP");return e.today&&(o=`Today, ${o}`),e.selected&&(o=`${o}, selected`),o}const _8=ex;function tx(n,e,t){return(t??new $n(e)).formatMonthYear(n)}const z8=tx;function hR(n,e,t,i){let o=(i??new $n(t)).format(n,"PPPP");return e?.today&&(o=`Today, ${o}`),o}function fR(n){return"Choose the Month"}function pR(){return""}const F8="Go to the Next Month";function mR(n,e){return F8}function gR(n){return"Go to the Previous Month"}function yR(n,e,t){return(t??new $n(e)).format(n,"cccc")}function bR(n,e){return`Week ${n}`}function vR(n){return"Week Number"}function xR(n){return"Choose the Year"}const q8=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:z8,labelDay:_8,labelDayButton:ex,labelGrid:tx,labelGridcell:hR,labelMonthDropdown:fR,labelNav:pR,labelNext:mR,labelPrevious:gR,labelWeekNumber:bR,labelWeekNumberHeader:vR,labelWeekday:yR,labelYearDropdown:xR},Symbol.toStringTag,{value:"Module"})),vi=(n,e,t)=>e||(t?typeof t=="function"?t:(...i)=>t:n);function G8(n,e){const t=e.locale?.labels??{};return{...q8,...n??{},labelDayButton:vi(ex,n?.labelDayButton,t.labelDayButton),labelMonthDropdown:vi(fR,n?.labelMonthDropdown,t.labelMonthDropdown),labelNext:vi(mR,n?.labelNext,t.labelNext),labelPrevious:vi(gR,n?.labelPrevious,t.labelPrevious),labelWeekNumber:vi(bR,n?.labelWeekNumber,t.labelWeekNumber),labelYearDropdown:vi(xR,n?.labelYearDropdown,t.labelYearDropdown),labelGrid:vi(tx,n?.labelGrid,t.labelGrid),labelGridcell:vi(hR,n?.labelGridcell,t.labelGridcell),labelNav:vi(pR,n?.labelNav,t.labelNav),labelWeekNumberHeader:vi(vR,n?.labelWeekNumberHeader,t.labelWeekNumberHeader),labelWeekday:vi(yR,n?.labelWeekday,t.labelWeekday)}}function V8(n,e,t,i,o){const{startOfMonth:s,startOfYear:r,endOfYear:c,eachMonthOfInterval:u,getMonth:f}=o;return u({start:r(n),end:c(n)}).map(v=>{const x=i.formatMonthDropdown(v,o),C=f(v),k=e&&v<s(e)||t&&v>s(t)||!1;return{value:C,label:x,disabled:k}})}function K8(n,e={},t={}){let i={...e?.[we.Day]};return Object.entries(n).filter(([,o])=>o===!0).forEach(([o])=>{i={...i,...t?.[o]}}),i}function W8(n,e,t,i){const o=i??n.today(),s=t?n.startOfBroadcastWeek(o,n):e?n.startOfISOWeek(o):n.startOfWeek(o),r=[];for(let c=0;c<7;c++){const u=n.addDays(s,c);r.push(u)}return r}function Q8(n,e,t,i,o=!1){if(!n||!e)return;const{startOfYear:s,endOfYear:r,eachYearOfInterval:c,getYear:u}=i,f=s(n),m=r(e),g=c({start:f,end:m});return o&&g.reverse(),g.map(v=>{const x=t.formatYearDropdown(v,i);return{value:u(v),label:x,disabled:!1}})}const od=n=>n instanceof HTMLElement?n:null,Jg=n=>[...n.querySelectorAll("[data-animated-month]")??[]],Y8=n=>od(n.querySelector("[data-animated-month]")),Zg=n=>od(n.querySelector("[data-animated-caption]")),ey=n=>od(n.querySelector("[data-animated-weeks]")),$8=n=>od(n.querySelector("[data-animated-nav]")),X8=n=>od(n.querySelector("[data-animated-weekdays]"));function J8(n,e,{classNames:t,months:i,focused:o,dateLib:s}){const r=w.useRef(null),c=w.useRef(i),u=w.useRef(!1);w.useLayoutEffect(()=>{const f=c.current;if(c.current=i,!e||!n.current||!(n.current instanceof HTMLElement)||i.length===0||f.length===0||i.length!==f.length)return;const m=s.isSameMonth(i[0].date,f[0].date),g=s.isAfter(i[0].date,f[0].date),v=g?t[Qn.caption_after_enter]:t[Qn.caption_before_enter],x=g?t[Qn.weeks_after_enter]:t[Qn.weeks_before_enter],C=r.current,k=n.current.cloneNode(!0);if(k instanceof HTMLElement?(Jg(k).forEach(T=>{if(!(T instanceof HTMLElement))return;const M=Y8(T);M&&T.contains(M)&&T.removeChild(M);const L=Zg(T);L&&L.classList.remove(v);const R=ey(T);R&&R.classList.remove(x)}),r.current=k):r.current=null,u.current||m||o)return;const P=C instanceof HTMLElement?Jg(C):[],D=Jg(n.current);if(D?.every(O=>O instanceof HTMLElement)&&P&&P.every(O=>O instanceof HTMLElement)){u.current=!0,n.current.style.isolation="isolate";const O=$8(n.current);O&&(O.style.zIndex="1"),D.forEach((T,M)=>{const L=P[M];if(!L)return;T.style.position="relative",T.style.overflow="hidden";const R=Zg(T);R&&R.classList.add(v);const I=ey(T);I&&I.classList.add(x);const W=()=>{u.current=!1,n.current&&(n.current.style.isolation=""),O&&(O.style.zIndex=""),R&&R.classList.remove(v),I&&I.classList.remove(x),T.style.position="",T.style.overflow="",T.contains(L)&&T.removeChild(L)};L.style.pointerEvents="none",L.style.position="absolute",L.style.overflow="hidden",L.setAttribute("aria-hidden","true");const _=X8(L);_&&(_.style.opacity="0");const z=Zg(L);z&&(z.classList.add(g?t[Qn.caption_before_exit]:t[Qn.caption_after_exit]),z.addEventListener("animationend",W));const $=ey(L);$&&$.classList.add(g?t[Qn.weeks_before_exit]:t[Qn.weeks_after_exit]),T.insertBefore(L,T.firstChild)})}})}function Z8(n,e,t,i){const o=n[0],s=n[n.length-1],{ISOWeek:r,fixedWeeks:c,broadcastCalendar:u}=t??{},{addDays:f,differenceInCalendarDays:m,differenceInCalendarMonths:g,endOfBroadcastWeek:v,endOfISOWeek:x,endOfMonth:C,endOfWeek:k,isAfter:P,startOfBroadcastWeek:D,startOfISOWeek:O,startOfWeek:T}=i,M=u?D(o,i):r?O(o):T(o),L=u?v(s):r?x(C(s)):k(C(s)),R=e&&(u?v(e):r?x(e):k(e)),I=R&&P(L,R)?R:L,W=m(I,M),_=g(s,o)+1,z=[];for(let B=0;B<=W;B++){const ie=f(M,B);z.push(ie)}const F=(u?35:42)*_;if(c&&z.length<F){const B=F-z.length;for(let ie=0;ie<B;ie++){const oe=f(z[z.length-1],1);z.push(oe)}}return z}function eW(n){const e=[];return n.reduce((t,i)=>{const o=i.weeks.reduce((s,r)=>s.concat(r.days.slice()),e.slice());return t.concat(o.slice())},e.slice())}function tW(n,e,t,i){const{numberOfMonths:o=1}=t,s=[];for(let r=0;r<o;r++){const c=i.addMonths(n,r);if(e&&c>e)break;s.push(c)}return s}function NA(n,e,t,i){const{month:o,defaultMonth:s,today:r=i.today(),numberOfMonths:c=1}=n;let u=o||s||r;const{differenceInCalendarMonths:f,addMonths:m,startOfMonth:g}=i;if(t&&f(t,u)<c-1){const v=-1*(c-1);u=m(t,v)}return e&&f(u,e)<0&&(u=e),g(u)}function nW(n,e,t,i){const{addDays:o,endOfBroadcastWeek:s,endOfISOWeek:r,endOfMonth:c,endOfWeek:u,getISOWeek:f,getWeek:m,startOfBroadcastWeek:g,startOfISOWeek:v,startOfWeek:x}=i,C=n.reduce((k,P)=>{const D=t.broadcastCalendar?g(P,i):t.ISOWeek?v(P):x(P),O=t.broadcastCalendar?s(P):t.ISOWeek?r(c(P)):u(c(P)),T=e.filter(I=>I>=D&&I<=O),M=t.broadcastCalendar?35:42;if(t.fixedWeeks&&T.length<M){const I=e.filter(W=>{const _=M-T.length;return W>O&&W<=o(O,_)});T.push(...I)}const L=T.reduce((I,W)=>{const _=t.ISOWeek?f(W):m(W),z=I.find(F=>F.weekNumber===_),$=new sR(W,P,i);return z?z.days.push($):I.push(new JK(_,[$])),I},[]),R=new XK(P,L);return k.push(R),k},[]);return t.reverseMonths?C.reverse():C}function iW(n,e){let{startMonth:t,endMonth:i}=n;const{startOfYear:o,startOfDay:s,startOfMonth:r,endOfMonth:c,addYears:u,endOfYear:f,newDate:m,today:g}=e,{fromYear:v,toYear:x,fromMonth:C,toMonth:k}=n;!t&&C&&(t=C),!t&&v&&(t=e.newDate(v,0,1)),!i&&k&&(i=k),!i&&x&&(i=m(x,11,31));const P=n.captionLayout==="dropdown"||n.captionLayout==="dropdown-years";return t?t=r(t):v?t=m(v,0,1):!t&&P&&(t=o(u(n.today??g(),-100))),i?i=c(i):x?i=m(x,11,31):!i&&P&&(i=f(n.today??g())),[t&&s(t),i&&s(i)]}function oW(n,e,t,i){if(t.disableNavigation)return;const{pagedNavigation:o,numberOfMonths:s=1}=t,{startOfMonth:r,addMonths:c,differenceInCalendarMonths:u}=i,f=o?s:1,m=r(n);if(!e)return c(m,f);if(!(u(e,n)<s))return c(m,f)}function aW(n,e,t,i){if(t.disableNavigation)return;const{pagedNavigation:o,numberOfMonths:s}=t,{startOfMonth:r,addMonths:c,differenceInCalendarMonths:u}=i,f=o?s??1:1,m=r(n);if(!e)return c(m,-f);if(!(u(m,e)<=0))return c(m,-f)}function sW(n){const e=[];return n.reduce((t,i)=>t.concat(i.weeks.slice()),e.slice())}function Ef(n,e){const[t,i]=w.useState(n);return[e===void 0?t:e,i]}function rW(n,e){const[t,i]=iW(n,e),{startOfMonth:o,endOfMonth:s}=e,r=NA(n,t,i,e),[c,u]=Ef(r,n.month?r:void 0);w.useEffect(()=>{const M=NA(n,t,i,e);u(M)},[n.timeZone]);const{months:f,weeks:m,days:g,previousMonth:v,nextMonth:x}=w.useMemo(()=>{const M=tW(c,i,{numberOfMonths:n.numberOfMonths},e),L=Z8(M,n.endMonth?s(n.endMonth):void 0,{ISOWeek:n.ISOWeek,fixedWeeks:n.fixedWeeks,broadcastCalendar:n.broadcastCalendar},e),R=nW(M,L,{broadcastCalendar:n.broadcastCalendar,fixedWeeks:n.fixedWeeks,ISOWeek:n.ISOWeek,reverseMonths:n.reverseMonths},e),I=sW(R),W=eW(R),_=aW(c,t,n,e),z=oW(c,i,n,e);return{months:R,weeks:I,days:W,previousMonth:_,nextMonth:z}},[e,c.getTime(),i?.getTime(),t?.getTime(),n.disableNavigation,n.broadcastCalendar,n.endMonth?.getTime(),n.fixedWeeks,n.ISOWeek,n.numberOfMonths,n.pagedNavigation,n.reverseMonths]),{disableNavigation:C,onMonthChange:k}=n,P=M=>m.some(L=>L.days.some(R=>R.isEqualTo(M))),D=M=>{if(C)return;let L=o(M);t&&L<o(t)&&(L=o(t)),i&&L>o(i)&&(L=o(i)),u(L),k?.(L)};return{months:f,weeks:m,days:g,navStart:t,navEnd:i,previousMonth:v,nextMonth:x,goToMonth:D,goToDay:M=>{P(M)||D(M.date)}}}var Ui;(function(n){n[n.Today=0]="Today",n[n.Selected=1]="Selected",n[n.LastFocused=2]="LastFocused",n[n.FocusedModifier=3]="FocusedModifier"})(Ui||(Ui={}));function EA(n){return!n[wt.disabled]&&!n[wt.hidden]&&!n[wt.outside]}function lW(n,e,t,i){let o,s=-1;for(const r of n){const c=e(r);EA(c)&&(c[wt.focused]&&s<Ui.FocusedModifier?(o=r,s=Ui.FocusedModifier):i?.isEqualTo(r)&&s<Ui.LastFocused?(o=r,s=Ui.LastFocused):t(r.date)&&s<Ui.Selected?(o=r,s=Ui.Selected):c[wt.today]&&s<Ui.Today&&(o=r,s=Ui.Today))}return o||(o=n.find(r=>EA(e(r)))),o}function cW(n,e,t,i,o,s,r){const{ISOWeek:c,broadcastCalendar:u}=s,{addDays:f,addMonths:m,addWeeks:g,addYears:v,endOfBroadcastWeek:x,endOfISOWeek:C,endOfWeek:k,max:P,min:D,startOfBroadcastWeek:O,startOfISOWeek:T,startOfWeek:M}=r;let R={day:f,week:g,month:m,year:v,startOfWeek:I=>u?O(I,r):c?T(I):M(I),endOfWeek:I=>u?x(I):c?C(I):k(I)}[n](t,e==="after"?1:-1);return e==="before"&&i?R=P([i,R]):e==="after"&&o&&(R=D([o,R])),R}function CR(n,e,t,i,o,s,r,c=0){if(c>365)return;const u=cW(n,e,t.date,i,o,s,r),f=!!(s.disabled&&Mo(u,s.disabled,r)),m=!!(s.hidden&&Mo(u,s.hidden,r)),g=u,v=new sR(u,g,r);return!f&&!m?v:CR(n,e,v,i,o,s,r,c+1)}function dW(n,e,t,i,o){const{autoFocus:s}=n,[r,c]=w.useState(),u=lW(e.days,t,i||(()=>!1),r),[f,m]=w.useState(s?u:void 0);return{isFocusTarget:k=>!!u?.isEqualTo(k),setFocused:m,focused:f,blur:()=>{c(f),m(void 0)},moveFocus:(k,P)=>{if(!f)return;const D=CR(k,P,f,e.navStart,e.navEnd,n,o);D&&(n.disableNavigation&&!e.days.some(T=>T.isEqualTo(D))||(e.goToDay(D),m(D)))}}}function uW(n,e){const{selected:t,required:i,onSelect:o}=n,[s,r]=Ef(t,o?t:void 0),c=o?t:s,{isSameDay:u}=e,f=x=>c?.some(C=>u(C,x))??!1,{min:m,max:g}=n;return{selected:c,select:(x,C,k)=>{let P=[...c??[]];if(f(x)){if(c?.length===m||i&&c?.length===1)return;P=c?.filter(D=>!u(D,x))}else c?.length===g?P=[x]:P=[...P,x];return o||r(P),o?.(P,x,C,k),P},isSelected:f}}function hW(n,e,t=0,i=0,o=!1,s=io){const{from:r,to:c}=e||{},{isSameDay:u,isAfter:f,isBefore:m}=s;let g;if(!r&&!c)g={from:n,to:t>0?void 0:n};else if(r&&!c)u(r,n)?t===0?g={from:r,to:n}:o?g={from:r,to:void 0}:g=void 0:m(n,r)?g={from:n,to:r}:g={from:r,to:n};else if(r&&c)if(u(r,n)&&u(c,n))o?g={from:r,to:c}:g=void 0;else if(u(r,n))g={from:r,to:t>0?void 0:n};else if(u(c,n))g={from:n,to:t>0?void 0:n};else if(m(n,r))g={from:n,to:c};else if(f(n,r))g={from:r,to:n};else if(f(n,c))g={from:r,to:n};else throw new Error("Invalid range");if(g?.from&&g?.to){const v=s.differenceInCalendarDays(g.to,g.from);i>0&&v>i?g={from:n,to:void 0}:t>1&&v<t&&(g={from:n,to:void 0})}return g}function fW(n,e,t=io){const i=Array.isArray(e)?e:[e];let o=n.from;const s=t.differenceInCalendarDays(n.to,n.from),r=Math.min(s,6);for(let c=0;c<=r;c++){if(i.includes(o.getDay()))return!0;o=t.addDays(o,1)}return!1}function IA(n,e,t=io){return To(n,e.from,!1,t)||To(n,e.to,!1,t)||To(e,n.from,!1,t)||To(e,n.to,!1,t)}function pW(n,e,t=io){const i=Array.isArray(e)?e:[e];if(i.filter(c=>typeof c!="function").some(c=>typeof c=="boolean"?c:t.isDate(c)?To(n,c,!1,t):cR(c,t)?c.some(u=>To(n,u,!1,t)):Nf(c)?c.from&&c.to?IA(n,{from:c.from,to:c.to},t):!1:lR(c)?fW(n,c.dayOfWeek,t):Xv(c)?t.isAfter(c.before,c.after)?IA(n,{from:t.addDays(c.after,1),to:t.addDays(c.before,-1)},t):Mo(n.from,c,t)||Mo(n.to,c,t):Jv(c)||Zv(c)?Mo(n.from,c,t)||Mo(n.to,c,t):!1))return!0;const r=i.filter(c=>typeof c=="function");if(r.length){let c=n.from;const u=t.differenceInCalendarDays(n.to,n.from);for(let f=0;f<=u;f++){if(r.some(m=>m(c)))return!0;c=t.addDays(c,1)}}return!1}function mW(n,e){const{disabled:t,excludeDisabled:i,selected:o,required:s,onSelect:r}=n,[c,u]=Ef(o,r?o:void 0),f=r?o:c;return{selected:f,select:(v,x,C)=>{const{min:k,max:P}=n,D=v?hW(v,f,k,P,s,e):void 0;return i&&t&&D?.from&&D.to&&pW({from:D.from,to:D.to},t,e)&&(D.from=v,D.to=void 0),r||u(D),r?.(D,v,x,C),D},isSelected:v=>f&&To(f,v,!1,e)}}function gW(n,e){const{selected:t,required:i,onSelect:o}=n,[s,r]=Ef(t,o?t:void 0),c=o?t:s,{isSameDay:u}=e;return{selected:c,select:(g,v,x)=>{let C=g;return!i&&c&&c&&u(g,c)&&(C=void 0),o||r(C),o?.(C,g,v,x),C},isSelected:g=>c?u(c,g):!1}}function yW(n,e){const t=gW(n,e),i=uW(n,e),o=mW(n,e);switch(n.mode){case"single":return t;case"multiple":return i;case"range":return o;default:return}}function an(n,e){return n instanceof Oo&&n.timeZone===e?n:new Oo(n,e)}function jA(n,e){return typeof n=="boolean"||typeof n=="function"?n:n instanceof Date?an(n,e):Array.isArray(n)?n.map(t=>t instanceof Date?an(t,e):t):Nf(n)?{...n,from:n.from?an(n.from,e):n.from,to:n.to?an(n.to,e):n.to}:Xv(n)?{before:an(n.before,e),after:an(n.after,e)}:Jv(n)?{after:an(n.after,e)}:Zv(n)?{before:an(n.before,e)}:n}function ty(n,e){return n&&(Array.isArray(n)?n.map(t=>jA(t,e)):jA(n,e))}function bW(n){let e=n;const t=e.timeZone;if(t&&(e={...n,timeZone:t},e.today&&(e.today=an(e.today,t)),e.month&&(e.month=an(e.month,t)),e.defaultMonth&&(e.defaultMonth=an(e.defaultMonth,t)),e.startMonth&&(e.startMonth=an(e.startMonth,t)),e.endMonth&&(e.endMonth=an(e.endMonth,t)),e.mode==="single"&&e.selected?e.selected=an(e.selected,t):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(Ne=>an(Ne,t)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?an(e.selected.from,t):e.selected.from,to:e.selected.to?an(e.selected.to,t):e.selected.to}),e.disabled!==void 0&&(e.disabled=ty(e.disabled,t)),e.hidden!==void 0&&(e.hidden=ty(e.hidden,t)),e.modifiers)){const Ne={};Object.keys(e.modifiers).forEach(Ke=>{Ne[Ke]=ty(e.modifiers?.[Ke],t)}),e.modifiers=Ne}const{components:i,formatters:o,labels:s,dateLib:r,locale:c,classNames:u}=w.useMemo(()=>{const Ne={...aR,...e.locale},Ke=new $n({locale:Ne,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib);return{dateLib:Ke,components:O8(e.components),formatters:U8(e.formatters),labels:G8(e.labels,Ke.options),locale:Ne,classNames:{...M8(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.components,e.formatters,e.labels,e.classNames]);e.today||(e={...e,today:r.today()});const{captionLayout:f,mode:m,navLayout:g,numberOfMonths:v=1,onDayBlur:x,onDayClick:C,onDayFocus:k,onDayKeyDown:P,onDayMouseEnter:D,onDayMouseLeave:O,onNextClick:T,onPrevClick:M,showWeekNumber:L,styles:R}=e,{formatCaption:I,formatDay:W,formatMonthDropdown:_,formatWeekNumber:z,formatWeekNumberHeader:$,formatWeekdayName:F,formatYearDropdown:B}=o,ie=rW(e,r),{days:oe,months:H,navStart:Z,navEnd:ae,previousMonth:Y,nextMonth:se,goToMonth:ue}=ie,be=A8(oe,e,Z,ae,r),{isSelected:te,select:le,selected:xe}=yW(e,r)??{},{blur:Se,focused:ye,isFocusTarget:Oe,moveFocus:Be,setFocused:nt}=dW(e,ie,be,te??(()=>!1),r),{labelDayButton:At,labelGridcell:Te,labelGrid:Ye,labelMonthDropdown:it,labelNav:ln,labelPrevious:Sn,labelNext:Aa,labelWeekday:zt,labelWeekNumber:Ho,labelWeekNumberHeader:Da,labelYearDropdown:mi}=s,Ps=w.useMemo(()=>W8(r,e.ISOWeek,e.broadcastCalendar,e.today),[r,e.ISOWeek,e.broadcastCalendar,e.today]),As=m!==void 0||C!==void 0,Xt=w.useCallback(()=>{Y&&(ue(Y),M?.(Y))},[Y,ue,M]),Xr=w.useCallback(()=>{se&&(ue(se),T?.(se))},[ue,se,T]),ad=w.useCallback((Ne,Ke)=>Me=>{Me.preventDefault(),Me.stopPropagation(),nt(Ne),!Ke.disabled&&(le?.(Ne.date,Ke,Me),C?.(Ne.date,Ke,Me))},[le,C,nt]),sd=w.useCallback((Ne,Ke)=>Me=>{nt(Ne),k?.(Ne.date,Ke,Me)},[k,nt]),Ds=w.useCallback((Ne,Ke)=>Me=>{Se(),x?.(Ne.date,Ke,Me)},[Se,x]),If=w.useCallback((Ne,Ke)=>Me=>{const $e={ArrowLeft:[Me.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[Me.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[Me.shiftKey?"year":"week","after"],ArrowUp:[Me.shiftKey?"year":"week","before"],PageUp:[Me.shiftKey?"year":"month","before"],PageDown:[Me.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if($e[Me.key]){Me.preventDefault(),Me.stopPropagation();const[Vt,Ue]=$e[Me.key];Be(Vt,Ue)}P?.(Ne.date,Ke,Me)},[Be,P,e.dir]),rd=w.useCallback((Ne,Ke)=>Me=>{D?.(Ne.date,Ke,Me)},[D]),jf=w.useCallback((Ne,Ke)=>Me=>{O?.(Ne.date,Ke,Me)},[O]),Bf=w.useCallback(Ne=>Ke=>{const Me=Number(Ke.target.value),$e=r.setMonth(r.startOfMonth(Ne),Me);ue($e)},[r,ue]),Oa=w.useCallback(Ne=>Ke=>{const Me=Number(Ke.target.value),$e=r.setYear(r.startOfMonth(Ne),Me);ue($e)},[r,ue]),{className:pn,style:Oi}=w.useMemo(()=>({className:[u[we.Root],e.className].filter(Boolean).join(" "),style:{...R?.[we.Root],...e.style}}),[u,e.className,e.style,R]),mn=T8(e),ld=w.useRef(null);J8(ld,!!e.animate,{classNames:u,months:H,focused:ye,dateLib:r});const Hf={dayPickerProps:e,selected:xe,select:le,isSelected:te,months:H,nextMonth:se,previousMonth:Y,goToMonth:ue,getModifiers:be,components:i,classNames:u,styles:R,labels:s,formatters:o};return ge.createElement(rR.Provider,{value:Hf},ge.createElement(i.Root,{rootRef:e.animate?ld:void 0,className:pn,style:Oi,dir:e.dir,id:e.id,lang:e.lang,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"],...mn},ge.createElement(i.Months,{className:u[we.Months],style:R?.[we.Months]},!e.hideNavigation&&!g&&ge.createElement(i.Nav,{"data-animated-nav":e.animate?"true":void 0,className:u[we.Nav],style:R?.[we.Nav],"aria-label":ln(),onPreviousClick:Xt,onNextClick:Xr,previousMonth:Y,nextMonth:se}),H.map((Ne,Ke)=>ge.createElement(i.Month,{"data-animated-month":e.animate?"true":void 0,className:u[we.Month],style:R?.[we.Month],key:Ke,displayIndex:Ke,calendarMonth:Ne},g==="around"&&!e.hideNavigation&&Ke===0&&ge.createElement(i.PreviousMonthButton,{type:"button",className:u[we.PreviousMonthButton],tabIndex:Y?void 0:-1,"aria-disabled":Y?void 0:!0,"aria-label":Sn(Y),onClick:Xt,"data-animated-button":e.animate?"true":void 0},ge.createElement(i.Chevron,{disabled:Y?void 0:!0,className:u[we.Chevron],orientation:e.dir==="rtl"?"right":"left"})),ge.createElement(i.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:u[we.MonthCaption],style:R?.[we.MonthCaption],calendarMonth:Ne,displayIndex:Ke},f?.startsWith("dropdown")?ge.createElement(i.DropdownNav,{className:u[we.Dropdowns],style:R?.[we.Dropdowns]},(()=>{const Me=f==="dropdown"||f==="dropdown-months"?ge.createElement(i.MonthsDropdown,{key:"month",className:u[we.MonthsDropdown],"aria-label":it(),classNames:u,components:i,disabled:!!e.disableNavigation,onChange:Bf(Ne.date),options:V8(Ne.date,Z,ae,o,r),style:R?.[we.Dropdown],value:r.getMonth(Ne.date)}):ge.createElement("span",{key:"month"},_(Ne.date,r)),$e=f==="dropdown"||f==="dropdown-years"?ge.createElement(i.YearsDropdown,{key:"year",className:u[we.YearsDropdown],"aria-label":mi(r.options),classNames:u,components:i,disabled:!!e.disableNavigation,onChange:Oa(Ne.date),options:Q8(Z,ae,o,r,!!e.reverseYears),style:R?.[we.Dropdown],value:r.getYear(Ne.date)}):ge.createElement("span",{key:"year"},B(Ne.date,r));return r.getMonthYearOrder()==="year-first"?[$e,Me]:[Me,$e]})(),ge.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},I(Ne.date,r.options,r))):ge.createElement(i.CaptionLabel,{className:u[we.CaptionLabel],role:"status","aria-live":"polite"},I(Ne.date,r.options,r))),g==="around"&&!e.hideNavigation&&Ke===v-1&&ge.createElement(i.NextMonthButton,{type:"button",className:u[we.NextMonthButton],tabIndex:se?void 0:-1,"aria-disabled":se?void 0:!0,"aria-label":Aa(se),onClick:Xr,"data-animated-button":e.animate?"true":void 0},ge.createElement(i.Chevron,{disabled:se?void 0:!0,className:u[we.Chevron],orientation:e.dir==="rtl"?"left":"right"})),Ke===v-1&&g==="after"&&!e.hideNavigation&&ge.createElement(i.Nav,{"data-animated-nav":e.animate?"true":void 0,className:u[we.Nav],style:R?.[we.Nav],"aria-label":ln(),onPreviousClick:Xt,onNextClick:Xr,previousMonth:Y,nextMonth:se}),ge.createElement(i.MonthGrid,{role:"grid","aria-multiselectable":m==="multiple"||m==="range","aria-label":Ye(Ne.date,r.options,r)||void 0,className:u[we.MonthGrid],style:R?.[we.MonthGrid]},!e.hideWeekdays&&ge.createElement(i.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:u[we.Weekdays],style:R?.[we.Weekdays]},L&&ge.createElement(i.WeekNumberHeader,{"aria-label":Da(r.options),className:u[we.WeekNumberHeader],style:R?.[we.WeekNumberHeader],scope:"col"},$()),Ps.map(Me=>ge.createElement(i.Weekday,{"aria-label":zt(Me,r.options,r),className:u[we.Weekday],key:String(Me),style:R?.[we.Weekday],scope:"col"},F(Me,r.options,r)))),ge.createElement(i.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:u[we.Weeks],style:R?.[we.Weeks]},Ne.weeks.map(Me=>ge.createElement(i.Week,{className:u[we.Week],key:Me.weekNumber,style:R?.[we.Week],week:Me},L&&ge.createElement(i.WeekNumber,{week:Me,style:R?.[we.WeekNumber],"aria-label":Ho(Me.weekNumber,{locale:c}),className:u[we.WeekNumber],scope:"row",role:"rowheader"},z(Me.weekNumber,r)),Me.days.map($e=>{const{date:Vt}=$e,Ue=be($e);if(Ue[wt.focused]=!Ue.hidden&&!!ye?.isEqualTo($e),Ue[Si.selected]=te?.(Vt)||Ue.selected,Nf(xe)){const{from:Ma,to:oo}=xe;Ue[Si.range_start]=!!(Ma&&oo&&r.isSameDay(Vt,Ma)),Ue[Si.range_end]=!!(Ma&&oo&&r.isSameDay(Vt,oo)),Ue[Si.range_middle]=To(xe,Vt,!0,r)}const Ta=K8(Ue,R,e.modifiersStyles),Uf=D8(Ue,u,e.modifiersClassNames),cd=!As&&!Ue.hidden?Te(Vt,Ue,r.options,r):void 0;return ge.createElement(i.Day,{key:`${$e.isoDate}_${$e.displayMonthId}`,day:$e,modifiers:Ue,className:Uf.join(" "),style:Ta,role:"gridcell","aria-selected":Ue.selected||void 0,"aria-label":cd,"data-day":$e.isoDate,"data-month":$e.outside?$e.dateMonthId:void 0,"data-selected":Ue.selected||void 0,"data-disabled":Ue.disabled||void 0,"data-hidden":Ue.hidden||void 0,"data-outside":$e.outside||void 0,"data-focused":Ue.focused||void 0,"data-today":Ue.today||void 0},!Ue.hidden&&As?ge.createElement(i.DayButton,{className:u[we.DayButton],style:R?.[we.DayButton],type:"button",day:$e,modifiers:Ue,disabled:!Ue.focused&&Ue.disabled||void 0,"aria-disabled":Ue.focused&&Ue.disabled||void 0,tabIndex:Oe($e)?0:-1,"aria-label":At(Vt,Ue,r.options,r),onClick:ad($e,Ue),onBlur:Ds($e,Ue),onFocus:sd($e,Ue),onKeyDown:If($e,Ue),onMouseEnter:rd($e,Ue),onMouseLeave:jf($e,Ue)},W(Vt,r.options,r)):!Ue.hidden&&W($e.date,r.options,r))})))))))),e.footer&&ge.createElement(i.Footer,{className:u[we.Footer],style:R?.[we.Footer],role:"status","aria-live":"polite"},e.footer)))}function vW({className:n,classNames:e,showOutsideDays:t=!0,...i}){return p.jsx(bW,{showOutsideDays:t,className:q("p-2",n),classNames:{root:"relative",months:"flex flex-col sm:flex-row gap-2 sm:gap-4",month:"flex flex-col gap-2",month_caption:"flex justify-center pt-1 relative items-center h-8",caption_label:"text-sm font-medium",nav:"absolute inset-x-0 top-2 flex items-center justify-between px-1 z-10",button_previous:q(Ju({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),button_next:q(Ju({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),month_grid:"w-full border-collapse",weekdays:"flex w-full",weekday:"text-muted-foreground w-8 font-normal text-xs text-center",weeks:"flex flex-col",week:"flex w-full",day:q("relative h-8 w-8 p-0 text-center text-xs font-normal focus-within:relative focus-within:z-20","hover:bg-accent hover:text-accent-foreground rounded-full select-none"),day_button:q(Ju({variant:"ghost"}),"h-8 w-8 p-0 font-normal rounded-full text-xs","aria-selected:opacity-100"),range_start:q("aria-selected:bg-primary aria-selected:text-primary-foreground","aria-selected:rounded-l-full aria-selected:rounded-r-none","aria-selected:hover:bg-primary aria-selected:hover:text-primary-foreground"),range_end:q("aria-selected:bg-primary aria-selected:text-primary-foreground","aria-selected:rounded-r-full aria-selected:rounded-l-none","aria-selected:hover:bg-primary aria-selected:hover:text-primary-foreground"),range_middle:q("aria-selected:bg-accent aria-selected:text-accent-foreground","aria-selected:rounded-none"),selected:q("bg-primary text-primary-foreground rounded-full","hover:bg-primary hover:text-primary-foreground","focus:bg-primary focus:text-primary-foreground"),today:"bg-accent text-accent-foreground rounded-full",outside:"text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",disabled:"text-muted-foreground opacity-50",hidden:"invisible",...e},components:{Chevron:({orientation:o,className:s,...r})=>{const c=o==="left"?eI:o==="right"?Wh:o==="up"?Cb:Qh;return p.jsx(c,{className:q("h-4 w-4",s),...r})}},...i})}vW.displayName="Calendar";const xW=w.lazy(()=>lt(()=>Promise.resolve().then(()=>Lf),void 0).then(n=>({default:n.CodeEditor})));function mQ({rawJsonContent:n,isRawJsonValid:e,rawJsonEdits:t,rawSettingsEnv:i,onChange:o,missingRequiredFields:s=[]}){const{t:r}=ve(),c=s.length>0;return p.jsx(w.Suspense,{fallback:p.jsxs("div",{className:"flex items-center justify-center h-full",children:[p.jsx(hi,{className:"w-6 h-6 animate-spin text-muted-foreground"}),p.jsx("span",{className:"ml-2 text-muted-foreground",children:r("providerEditor.loadingEditor")})]}),children:p.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!e&&t!==null&&p.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[p.jsx(Vr,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),e&&c&&p.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[p.jsx(wi,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",p.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:s.join(", ")}),p.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"These fields will use default values at runtime."})]})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:p.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:p.jsx(xW,{value:n,onChange:o,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),p.jsx("div",{className:"mx-6 mb-4",children:p.jsx("div",{className:"border rounded-md overflow-hidden",children:p.jsx(Zb,{profileEnv:i})})})]})})}w.lazy(()=>lt(()=>Promise.resolve().then(()=>Lf),void 0).then(n=>({default:n.CodeEditor})));function CW(){const{t:n}=ve(),{isDark:e,setTheme:t}=Lb(),[i,o]=w.useState(""),[s,r]=w.useState(""),[c,u]=w.useState(!1),[f,m]=w.useState(null),[g,v]=w.useState(!1),{login:x,authRequired:C,isAuthenticated:k,loading:P,accessMode:D,authEnabled:O}=Zh(),T=vb(),M=Kh(),L=D==="setup",R=n(L?"auth.remoteGuardLabel":"auth.protectedAccessLabel"),I=n(L?O?"auth.incompleteSetupDescription":"auth.remoteSetupDescription":"auth.loginDescription"),W=M.state?.from?.pathname||"/";if(w.useEffect(()=>{P||(k||!C)&&T(W,{replace:!0})},[k,C,P,T,W]),P)return p.jsx("div",{className:"flex min-h-[100dvh] items-center justify-center bg-background px-4",children:p.jsxs("div",{className:"flex items-center gap-3 rounded-full border border-border/80 bg-card/90 px-5 py-3 text-sm text-muted-foreground shadow-sm",children:[p.jsx(hi,{className:"h-4 w-4 animate-spin"}),n("auth.loading")]})});if(k||!C)return null;const _=async z=>{z.preventDefault(),m(null),v(!0);try{await x(i,s),T(W,{replace:!0})}catch($){m($ instanceof Error?$.message:n("auth.loginFailed"))}finally{v(!1)}};return p.jsxs("div",{className:"relative min-h-[100dvh] overflow-hidden bg-background",children:[p.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_top_left,rgba(167,85,52,0.16),transparent_42%),radial-gradient(circle_at_bottom_right,rgba(39,39,42,0.12),transparent_48%)]"}),p.jsx("div",{className:"absolute inset-0 opacity-[0.18] [background-image:linear-gradient(rgba(127,117,107,0.14)_1px,transparent_1px),linear-gradient(90deg,rgba(127,117,107,0.14)_1px,transparent_1px)] [background-size:24px_24px]"}),p.jsx("div",{className:"relative mx-auto flex min-h-[100dvh] max-w-6xl items-center px-4 py-8 sm:px-6",children:p.jsxs("div",{className:"grid w-full items-stretch gap-6 lg:grid-cols-[minmax(0,1.05fr)_minmax(360px,430px)]",children:[p.jsxs("section",{className:"flex flex-col justify-between rounded-[28px] border border-border/70 bg-card/85 p-6 shadow-[0_24px_80px_-48px_rgba(68,48,34,0.55)] backdrop-blur sm:p-8",children:[p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[p.jsxs("span",{className:"inline-flex w-fit items-center gap-2 rounded-full border border-border/70 bg-background/75 px-3 py-1 text-xs font-semibold uppercase tracking-[0.24em] text-muted-foreground",children:[p.jsx(Su,{className:"h-3.5 w-3.5 text-accent"}),R]}),p.jsxs("div",{className:"inline-flex items-center gap-1 rounded-full border border-border/70 bg-background/75 p-1 shadow-sm backdrop-blur",children:[p.jsxs(ft,{type:"button",variant:"ghost",size:"sm",className:q("rounded-full px-3 text-xs font-semibold",!e&&"bg-card text-foreground shadow-sm"),"aria-pressed":!e,onClick:()=>t("light"),children:[p.jsx(u1,{className:"h-3.5 w-3.5"}),n("auth.lightMode")]}),p.jsxs(ft,{type:"button",variant:"ghost",size:"sm",className:q("rounded-full px-3 text-xs font-semibold",e&&"bg-card text-foreground shadow-sm"),"aria-pressed":e,onClick:()=>t("dark"),children:[p.jsx(h1,{className:"h-3.5 w-3.5"}),n("auth.darkMode")]})]})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsx("h1",{className:"max-w-xl text-4xl font-semibold tracking-[-0.04em] text-balance text-foreground sm:text-5xl",children:n(L?"auth.remoteSetupTitle":"auth.dashboardTitle")}),p.jsx("p",{className:"max-w-2xl text-base leading-7 text-muted-foreground sm:text-lg",children:I})]})]}),p.jsxs("div",{className:"mt-8 grid gap-3 text-sm text-muted-foreground sm:grid-cols-3",children:[p.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[p.jsx(nk,{className:"mb-3 h-4 w-4 text-accent"}),p.jsx("p",{children:n("auth.safetyNoteRemote")})]}),p.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[p.jsx(ik,{className:"mb-3 h-4 w-4 text-accent"}),p.jsx("p",{children:n("auth.safetyNoteLocal")})]}),p.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[p.jsx(Su,{className:"mb-3 h-4 w-4 text-accent"}),p.jsx("p",{children:n("auth.safetyNoteSession")})]})]})]}),p.jsxs(L_,{className:"justify-center rounded-[28px] border-border/70 bg-card/95 py-0 shadow-[0_24px_90px_-54px_rgba(34,24,16,0.62)]",children:[p.jsxs(N_,{className:"space-y-3 border-b border-border/70 px-6 py-6",children:[p.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-2xl border border-accent/20 bg-accent/10",children:L?p.jsx(nk,{className:"h-5 w-5 text-accent"}):p.jsx(ik,{className:"h-5 w-5 text-accent"})}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(E_,{className:"text-2xl tracking-[-0.03em]",children:n(L?"auth.remoteSetupTitle":"auth.dashboardTitle")}),p.jsx(I_,{className:"text-sm leading-6 text-muted-foreground",children:L?I:n("auth.credentialsHint")})]})]}),p.jsx(j_,{className:"space-y-5 px-6 py-6",children:L?p.jsxs(p.Fragment,{children:[p.jsxs(lc,{variant:"warning",className:"rounded-2xl border-yellow-300/70 bg-yellow-50/80",children:[p.jsx(Cc,{className:"h-4 w-4"}),p.jsx(bh,{children:n("auth.noDefaultCredentials")}),p.jsx(cc,{children:n("auth.credentialsHint")})]}),p.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[p.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/75 p-4",children:[p.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[p.jsx(tI,{className:"h-4 w-4 text-accent"}),n("auth.hostStepTitle")]}),p.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:n("auth.hostStepDescription")}),p.jsx("code",{className:"mt-4 block rounded-xl border border-border/70 bg-muted/60 px-3 py-2 font-mono text-[13px] text-foreground",children:"ccs config auth setup"}),p.jsx("p",{className:"mt-3 text-xs leading-5 text-muted-foreground",children:n("auth.dockerStepDescription")}),p.jsx("code",{className:"mt-2 block rounded-xl border border-border/70 bg-muted/60 px-3 py-2 font-mono text-[13px] text-foreground",children:"docker exec -it ccs-cliproxy ccs config auth setup"})]}),p.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/75 p-4",children:[p.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[p.jsx(Su,{className:"h-4 w-4 text-accent"}),n("auth.localStepTitle")]}),p.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:n("auth.localStepDescription")})]})]})]}):p.jsxs("form",{onSubmit:_,className:"space-y-4",children:[f&&p.jsxs(lc,{variant:"destructive",className:"rounded-2xl",children:[p.jsx(Cc,{className:"h-4 w-4"}),p.jsx(cc,{children:f})]}),p.jsxs(lc,{variant:"info",className:"rounded-2xl border-blue-200/80 bg-blue-50/80",children:[p.jsx(Su,{className:"h-4 w-4"}),p.jsx(bh,{children:n("auth.noDefaultCredentials")}),p.jsx(cc,{children:n("auth.credentialsHint")})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{htmlFor:"username",className:"text-sm font-semibold",children:n("auth.username")}),p.jsx(Hi,{id:"username",type:"text",value:i,onChange:z=>o(z.target.value),placeholder:n("auth.usernamePlaceholder"),autoComplete:"username",className:"h-12 rounded-2xl border-border/80 bg-background/85 px-4 text-base md:text-base",disabled:g,required:!0})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{htmlFor:"password",className:"text-sm font-semibold",children:n("auth.password")}),p.jsxs("div",{className:"relative",children:[p.jsx(Hi,{id:"password",type:c?"text":"password",value:s,onChange:z=>r(z.target.value),placeholder:n("auth.passwordPlaceholder"),autoComplete:"current-password",className:"h-12 rounded-2xl border-border/80 bg-background/85 px-4 pr-14 text-base md:text-base",disabled:g,required:!0}),p.jsx(ft,{type:"button",variant:"ghost",size:"sm",className:"absolute inset-y-1 right-1 h-auto rounded-xl px-3 text-muted-foreground hover:text-foreground","aria-label":n(c?"auth.hidePassword":"auth.showPassword"),"aria-pressed":c,onClick:()=>u(z=>!z),disabled:g,children:c?p.jsx(Kc,{className:"h-4 w-4"}):p.jsx(Wc,{className:"h-4 w-4"})})]})]}),p.jsx(ft,{type:"submit",className:"h-12 w-full rounded-2xl text-sm font-semibold",disabled:g,children:g?p.jsxs(p.Fragment,{children:[p.jsx(hi,{className:"mr-2 h-4 w-4 animate-spin"}),n("auth.signingIn")]}):n("auth.signIn")})]})})]})]})})]})}const SW=w.lazy(()=>lt(()=>import("./index-W-L7VU-4.js"),__vite__mapDeps([24,1,2,4,5,25,6,7,9,8])).then(n=>({default:n.AnalyticsPage}))),kW=w.lazy(()=>lt(()=>import("./api-Rml_6r1f.js"),__vite__mapDeps([26,1,2,5,27,19,6,4,3,7,8,9])).then(n=>({default:n.ApiPage}))),wW=w.lazy(()=>lt(()=>import("./cliproxy-CTzg_fbJ.js"),__vite__mapDeps([28,1,2,5,17,6,4,21,29,27,19,30,31,18,20,7,8,9])).then(n=>({default:n.CliproxyPage}))),PW=w.lazy(()=>lt(()=>import("./cliproxy-ai-providers-DRfGjeni.js"),__vite__mapDeps([32,1,2,18,19,5,6,4,20,27,7,8,9])).then(n=>({default:n.CliproxyAiProvidersPage}))),AW=w.lazy(()=>lt(()=>import("./cliproxy-control-panel-C0TgmqD6.js"),__vite__mapDeps([33,1,2,5,17,4,6,7,8,9])).then(n=>({default:n.CliproxyControlPanelPage}))),DW=w.lazy(()=>lt(()=>import("./copilot-CDo33AQ9.js"),__vite__mapDeps([34,1,2,5,27,19,4,30,31,6,7,8,9])).then(n=>({default:n.CopilotPage}))),OW=w.lazy(()=>lt(()=>import("./cursor-nVJdycFe.js"),__vite__mapDeps([35,1,2,6,5,17,30,31,4,7,8,9])).then(n=>({default:n.CursorPage}))),TW=w.lazy(()=>lt(()=>import("./claude-extension-Crqbbisi.js"),__vite__mapDeps([36,1,2,5,6,4,7,8,9])).then(n=>({default:n.ClaudeExtensionPage}))),MW=w.lazy(()=>lt(()=>import("./codex-CGFN2_Yz.js"),__vite__mapDeps([37,1,2,6,38,5,4,20,30,39,7,8,9])).then(n=>({default:n.CodexPage}))),RW=w.lazy(()=>lt(()=>import("./droid-C1mg2O8N.js"),__vite__mapDeps([40,1,2,6,5,39,4,30,7,8,9])).then(n=>({default:n.DroidPage}))),LW=w.lazy(()=>lt(()=>import("./logs-CLIARnH2.js"),__vite__mapDeps([41,1,2,4,5,6,7,8,9])).then(n=>({default:n.LogsPage}))),NW=w.lazy(()=>lt(()=>import("./accounts-DD4gJm5G.js"),__vite__mapDeps([42,1,2,5,38,19,25,6,4,29,7,8,9])).then(n=>({default:n.AccountsPage}))),EW=w.lazy(()=>lt(()=>Promise.resolve().then(()=>qK),void 0).then(n=>({default:n.SettingsPage}))),IW=w.lazy(()=>lt(()=>import("./health-CIcj1Jxy.js"),__vite__mapDeps([43,1,2,5,6,4,11,7,8,9])).then(n=>({default:n.HealthPage}))),jW=w.lazy(()=>lt(()=>import("./shared-BIRVeSaP.js"),__vite__mapDeps([44,1,2,25,5,6,4,7,8,9])).then(n=>({default:n.SharedPage}))),BW=w.lazy(()=>lt(()=>import("./updates-Dcpm3clh.js"),__vite__mapDeps([45,1,2,4,5,6,7,8,9])).then(n=>({default:n.UpdatesPage}))),HW=null;function cn(){return p.jsx("div",{className:"flex h-64 items-center justify-center",children:p.jsx(hi,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}function UW(){return p.jsx(vE,{client:$I,children:p.jsx(G2,{defaultTheme:"system",storageKey:"vite-ui-theme",children:p.jsx(V2,{children:p.jsx($2,{children:p.jsxs(mE,{children:[p.jsxs(gE,{children:[p.jsx(It,{path:"/login",element:p.jsx(CW,{})}),p.jsx(It,{element:p.jsx(X2,{}),children:p.jsxs(It,{element:p.jsx(p5,{}),children:[p.jsx(It,{path:"/",element:p.jsx(HU,{})}),p.jsx(It,{path:"/analytics",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(SW,{})})}),p.jsx(It,{path:"/updates",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(BW,{})})}),p.jsx(It,{path:"/providers",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(kW,{})})}),p.jsx(It,{path:"/cliproxy",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(wW,{})})}),p.jsx(It,{path:"/cliproxy/ai-providers",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(PW,{})})}),p.jsx(It,{path:"/cliproxy/control-panel",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(AW,{})})}),p.jsx(It,{path:"/copilot",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(DW,{})})}),p.jsx(It,{path:"/cursor",element:p.jsx(o1,{to:"/cliproxy?provider=cursor",replace:!0})}),p.jsx(It,{path:"/legacy/cursor",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(OW,{})})}),p.jsx(It,{path:"/claude-extension",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(TW,{})})}),p.jsx(It,{path:"/codex",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(MW,{})})}),p.jsx(It,{path:"/droid",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(RW,{})})}),p.jsx(It,{path:"/accounts",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(NW,{})})}),p.jsx(It,{path:"/settings",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(EW,{})})}),p.jsx(It,{path:"/health",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(IW,{})})}),p.jsx(It,{path:"/logs",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(LW,{})})}),p.jsx(It,{path:"/shared",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(jW,{})})}),HW]})})]}),p.jsx(xE,{position:"top-right"})]})})})})})}const SR=document.getElementById("root");if(!SR)throw new Error("Root element not found. Failed to mount React application.");WI.createRoot(SR).render(p.jsx(w.StrictMode,{children:p.jsx(UW,{})}));export{V9 as $,ZU as A,Qt as B,L_ as C,G9 as D,qU as E,YU as F,z9 as G,q9 as H,Hi as I,_U as J,WU as K,yn as L,$U as M,F9 as N,tB as O,ji as P,nB as Q,iB as R,tt as S,ms as T,TD as U,Xb as V,vh as W,gy as X,re as Y,K9 as Z,je as _,ve as a,c9 as a$,I_ as a0,Q9 as a1,Y9 as a2,$9 as a3,X9 as a4,J9 as a5,Z9 as a6,LD as a7,eQ as a8,__ as a9,B9 as aA,iQ as aB,oQ as aC,nQ as aD,e_ as aE,kB as aF,M9 as aG,Ek as aH,h_ as aI,tQ as aJ,UD as aK,cH as aL,PH as aM,e5 as aN,t5 as aO,n5 as aP,i5 as aQ,Y5 as aR,Y1 as aS,p9 as aT,m9 as aU,g9 as aV,y9 as aW,dQ as aX,JW as aY,eB as aZ,l9 as a_,qb as aa,Gb as ab,YW as ac,Yj as ad,ZW as ae,s9 as af,u9 as ag,h9 as ah,Nb as ai,Eb as aj,Ib as ak,jb as al,Bb as am,aQ as an,F_ as ao,sQ as ap,ks as aq,N9 as ar,Jl as as,E9 as at,dy as au,f9 as av,I9 as aw,j9 as ax,H9 as ay,Ik as az,j_ as b,$j as b0,Xj as b1,d9 as b2,Jj as b3,Zj as b4,r9 as b5,_b as b6,L9 as b7,P9 as b8,D9 as b9,UK as bA,C9 as bB,b9 as bC,EB as bD,IB as bE,R9 as bF,o9 as bG,a9 as bH,S9 as bI,e9 as bJ,t9 as bK,n9 as bL,i9 as bM,v9 as bN,x9 as bO,w9 as bP,k9 as bQ,w1 as bR,T2 as bS,D2 as bT,ay as bU,fs as bV,v2 as bW,C2 as bX,P2 as bY,R2 as bZ,Ju as b_,O9 as ba,A9 as bb,ZM as bc,Zb as bd,T9 as be,Xl as bf,$W as bg,XW as bh,lc as bi,bh as bj,cc as bk,mQ as bl,Yb as bm,kc as bn,$b as bo,MU as bp,bj as bq,Cj as br,Sj as bs,kj as bt,wj as bu,IU as bv,U9 as bw,_9 as bx,tR as by,BK as bz,q as c,W9 as d,ft as e,rQ as f,lQ as g,q_ as h,vW as i,q1 as j,zb as k,G1 as l,Fb as m,rc as n,$i as o,Xi as p,Ji as q,QW as r,N_ as s,E_ as t,Pb as u,Q1 as v,J5 as w,Kr as x,cQ as y,aw as z};
56
+ `||n[g]==="\r");)g++;e.push({valueStart:g,key:m}),i='"',t=c+1;continue}i='"',t=r;continue}i=o,t++}return e}function yA(n,e){const t=new Zi,i=n.state.doc,o=i.toString();if(e==="json"){for(const{valueStart:c,key:u}of TK(o)){if(!mA(u)||c>=i.length)continue;const f=gA(i,c,"json",0),m=i.sliceString(c,f).replace(/\s+$/,"").length;m!==0&&t.add(c,c+m,Ae.mark({class:"cm-sensitive-mask"}))}return t.finish()}const s=new RegExp(AK[e].source,"gm");let r;for(;(r=s.exec(o))!==null;){const c=DK(r[2]),u=r[1].length;if(!mA(c))continue;const f=r.index+r[0].length;if(f>=i.length)continue;const m=gA(i,f,e,u),g=i.sliceString(f,m).replace(/\s+$/,"").length;g!==0&&t.add(f,f+g,Ae.mark({class:"cm-sensitive-mask"}))}return t.finish()}function MK(n){return Pt.fromClass(class{decorations;constructor(e){this.decorations=yA(e,n)}update(e){e.docChanged&&(this.decorations=yA(e.view,n))}},{decorations:e=>e.decorations})}const RK=$M({theme:"light",settings:{background:"transparent",foreground:"#393A34",caret:"#393A34",selection:"rgba(57, 58, 52, 0.18)",selectionMatch:"rgba(57, 58, 52, 0.12)",lineHighlight:"transparent",gutterBackground:"transparent",gutterForeground:"#999988"},styles:[{tag:[E.comment,E.lineComment,E.blockComment],color:"#999988",fontStyle:"italic"},{tag:[E.string,E.special(E.string),E.regexp],color:"#e3116c"},{tag:[E.number,E.bool,E.null,E.atom,E.variableName,E.propertyName,E.url],color:"#36acaa"},{tag:[E.keyword,E.attributeName,E.modifier,E.operatorKeyword],color:"#00a4db"},{tag:[E.function(E.variableName),E.labelName],color:"#6f42c1"},{tag:[E.tagName,E.heading],color:"#00009f",fontWeight:"bold"},{tag:[E.deleted,E.invalid],color:"#d73a49"},{tag:[E.punctuation,E.operator,E.bracket,E.brace,E.separator],color:"#393A34"}]}),LK=$M({theme:"dark",settings:{background:"transparent",foreground:"#d6deeb",caret:"#80a4c2",selection:"rgba(29, 59, 83, 0.99)",selectionMatch:"rgba(35, 77, 112, 0.6)",lineHighlight:"transparent",gutterBackground:"transparent",gutterForeground:"#4b6479"},styles:[{tag:[E.comment,E.lineComment,E.blockComment],color:"#637777",fontStyle:"italic"},{tag:[E.string,E.special(E.string),E.url],color:"rgb(173, 219, 103)"},{tag:E.number,color:"rgb(247, 140, 108)"},{tag:[E.bool,E.null,E.atom],color:"rgb(255, 88, 116)"},{tag:[E.keyword,E.modifier,E.operatorKeyword],color:"rgb(127, 219, 202)"},{tag:[E.propertyName,E.attributeName],color:"rgb(128, 203, 196)"},{tag:[E.variableName,E.labelName],color:"rgb(214, 222, 235)"},{tag:E.function(E.variableName),color:"rgb(130, 170, 255)"},{tag:[E.tagName,E.heading],color:"rgb(127, 219, 202)"},{tag:[E.bracket,E.punctuation,E.operator,E.brace,E.separator],color:"rgb(199, 146, 234)"},{tag:[E.className,E.special(E.string)],color:"rgb(255, 203, 139)"},{tag:[E.deleted,E.invalid],color:"rgba(239, 83, 80, 0.56)"}]}),NK=de.baseTheme({".cm-sensitive-mask":{filter:"blur(3px)",opacity:"0.7",transition:"filter 200ms ease, opacity 200ms ease"},".cm-sensitive-revealed .cm-sensitive-mask":{filter:"none",opacity:"1"}});function ZM({value:n,onChange:e,language:t="json",readonly:i=!1,exactText:o=!1,className:s,minHeight:r="300px",heightMode:c="content"}){const{isDark:u}=Lb(),{t:f}=ve(),[m,g]=w.useState(!1),[v,x]=w.useState(!0),C=c==="fill-parent",k=w.useMemo(()=>t==="json"?wK(n):t==="toml"?PK(n):{valid:!0},[n,t]),P=w.useMemo(()=>[t==="json"?MV():t==="yaml"?sK():Lv.define(rK),de.lineWrapping,NK,MK(t),de.theme({"&":{fontSize:"0.875rem",backgroundColor:"transparent"},"&.cm-focused":{outline:"none"},".cm-content":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",padding:"12px 0",caretColor:"currentColor"},".cm-line":{padding:"0 12px",lineHeight:"1.625"},".cm-scroller":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",lineHeight:"1.625"},".cm-gutters":{display:"none"}})],[t]);return p.jsxs("div",{className:q("flex min-h-0 flex-col",C&&"h-full",s),style:C?{height:r==="auto"?void 0:r}:void 0,"data-slot":"code-editor-root",children:[p.jsxs("div",{className:q("relative rounded-md border overflow-hidden bg-muted/30",C&&"flex min-h-0 flex-1 flex-col",m&&"ring-2 ring-ring ring-offset-2 ring-offset-background",i&&"opacity-70",!k.valid&&"border-destructive"),"data-slot":"code-editor-surface",children:[p.jsx("div",{className:q(C?"scrollbar-editor min-h-0 flex-1 overflow-hidden":void 0),"data-slot":C?"code-editor-viewport":void 0,children:p.jsx(FM,{value:n,onChange:i?void 0:e,readOnly:i,editable:!i,theme:u?LK:RK,extensions:P,height:C?"100%":void 0,minHeight:C?void 0:r,basicSetup:{lineNumbers:!1,foldGutter:!1,highlightActiveLine:!1,highlightActiveLineGutter:!1,autocompletion:!1,searchKeymap:!0},onFocus:()=>g(!0),onBlur:()=>g(!1),className:q("cm-editor-root",!v&&"cm-sensitive-revealed",C&&"h-full"),"data-slot":"code-editor-codemirror"})}),p.jsx("div",{className:"absolute top-2 right-2 z-20 opacity-50 hover:opacity-100 transition-opacity",children:p.jsx(ft,{variant:"ghost",size:"icon",className:"h-6 w-6 bg-background/50 hover:bg-background border shadow-sm rounded-full",onClick:()=>x(!v),title:f(v?"codeEditor.revealSensitive":"codeEditor.maskSensitive"),children:v?p.jsx(Wc,{className:"h-3 w-3"}):p.jsx(Kc,{className:"h-3 w-3"})})})]}),p.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs",children:[k.valid?p.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[p.jsx(Qc,{className:"w-3 h-3 text-green-500"}),f("codeEditor.valid",{language:t.toUpperCase()})]}):p.jsxs("span",{className:"flex items-center gap-1 text-destructive",children:[p.jsx(Cc,{className:"w-3 h-3"}),k.error,k.line&&` (line ${k.line})`]}),i&&p.jsx("span",{className:"ml-auto text-muted-foreground",children:f("codeEditor.readOnly")})]})]})}const Lf=Object.freeze(Object.defineProperty({__proto__:null,CodeEditor:ZM},Symbol.toStringTag,{value:"Module"})),EK={browserConfig:null,browserStatus:null,browserLoading:!0,browserStatusLoading:!0,browserSaving:!1,browserError:null,browserSuccess:!1,webSearchConfig:null,webSearchStatus:null,webSearchLoading:!0,webSearchStatusLoading:!0,webSearchSaving:!1,webSearchError:null,webSearchSuccess:!1,globalEnvConfig:null,globalEnvLoading:!0,globalEnvSaving:!1,globalEnvError:null,globalEnvSuccess:!1,proxyConfig:null,proxyLoading:!0,proxySaving:!1,proxyError:null,proxySuccess:!1,proxyTestResult:null,proxyTesting:!1,rawConfig:null,rawConfigLoading:!1};function IK(n,e){switch(e.type){case"SET_BROWSER_CONFIG":return{...n,browserConfig:e.payload};case"SET_BROWSER_STATUS":return{...n,browserStatus:e.payload};case"SET_BROWSER_LOADING":return{...n,browserLoading:e.payload};case"SET_BROWSER_STATUS_LOADING":return{...n,browserStatusLoading:e.payload};case"SET_BROWSER_SAVING":return{...n,browserSaving:e.payload};case"SET_BROWSER_ERROR":return{...n,browserError:e.payload};case"SET_BROWSER_SUCCESS":return{...n,browserSuccess:e.payload};case"SET_WEBSEARCH_CONFIG":return{...n,webSearchConfig:e.payload};case"SET_WEBSEARCH_STATUS":return{...n,webSearchStatus:e.payload};case"SET_WEBSEARCH_LOADING":return{...n,webSearchLoading:e.payload};case"SET_WEBSEARCH_STATUS_LOADING":return{...n,webSearchStatusLoading:e.payload};case"SET_WEBSEARCH_SAVING":return{...n,webSearchSaving:e.payload};case"SET_WEBSEARCH_ERROR":return{...n,webSearchError:e.payload};case"SET_WEBSEARCH_SUCCESS":return{...n,webSearchSuccess:e.payload};case"SET_GLOBALENV_CONFIG":return{...n,globalEnvConfig:e.payload};case"SET_GLOBALENV_LOADING":return{...n,globalEnvLoading:e.payload};case"SET_GLOBALENV_SAVING":return{...n,globalEnvSaving:e.payload};case"SET_GLOBALENV_ERROR":return{...n,globalEnvError:e.payload};case"SET_GLOBALENV_SUCCESS":return{...n,globalEnvSuccess:e.payload};case"SET_PROXY_CONFIG":return{...n,proxyConfig:e.payload};case"SET_PROXY_LOADING":return{...n,proxyLoading:e.payload};case"SET_PROXY_SAVING":return{...n,proxySaving:e.payload};case"SET_PROXY_ERROR":return{...n,proxyError:e.payload};case"SET_PROXY_SUCCESS":return{...n,proxySuccess:e.payload};case"SET_PROXY_TEST_RESULT":return{...n,proxyTestResult:e.payload};case"SET_PROXY_TESTING":return{...n,proxyTesting:e.payload};case"SET_RAW_CONFIG":return{...n,rawConfig:e.payload};case"SET_RAW_CONFIG_LOADING":return{...n,rawConfigLoading:e.payload};default:return n}}const eR=w.createContext(null);function jK({children:n}){const[e,t]=w.useReducer(IK,EK);return p.jsx(eR.Provider,{value:{state:e,dispatch:t},children:n})}function tR(){const n=w.useContext(eR);if(!n)throw new Error("useSettingsContext must be used within a SettingsProvider");return n}function BK(){const{dispatch:n}=tR(),e=w.useCallback(B=>n({type:"SET_BROWSER_CONFIG",payload:B}),[n]),t=w.useCallback(B=>n({type:"SET_BROWSER_STATUS",payload:B}),[n]),i=w.useCallback(B=>n({type:"SET_BROWSER_LOADING",payload:B}),[n]),o=w.useCallback(B=>n({type:"SET_BROWSER_STATUS_LOADING",payload:B}),[n]),s=w.useCallback(B=>n({type:"SET_BROWSER_SAVING",payload:B}),[n]),r=w.useCallback(B=>n({type:"SET_BROWSER_ERROR",payload:B}),[n]),c=w.useCallback(B=>n({type:"SET_BROWSER_SUCCESS",payload:B}),[n]),u=w.useCallback(B=>n({type:"SET_WEBSEARCH_CONFIG",payload:B}),[n]),f=w.useCallback(B=>n({type:"SET_WEBSEARCH_STATUS",payload:B}),[n]),m=w.useCallback(B=>n({type:"SET_WEBSEARCH_LOADING",payload:B}),[n]),g=w.useCallback(B=>n({type:"SET_WEBSEARCH_STATUS_LOADING",payload:B}),[n]),v=w.useCallback(B=>n({type:"SET_WEBSEARCH_SAVING",payload:B}),[n]),x=w.useCallback(B=>n({type:"SET_WEBSEARCH_ERROR",payload:B}),[n]),C=w.useCallback(B=>n({type:"SET_WEBSEARCH_SUCCESS",payload:B}),[n]),k=w.useCallback(B=>n({type:"SET_GLOBALENV_CONFIG",payload:B}),[n]),P=w.useCallback(B=>n({type:"SET_GLOBALENV_LOADING",payload:B}),[n]),D=w.useCallback(B=>n({type:"SET_GLOBALENV_SAVING",payload:B}),[n]),O=w.useCallback(B=>n({type:"SET_GLOBALENV_ERROR",payload:B}),[n]),T=w.useCallback(B=>n({type:"SET_GLOBALENV_SUCCESS",payload:B}),[n]),M=w.useCallback(B=>n({type:"SET_PROXY_CONFIG",payload:B}),[n]),L=w.useCallback(B=>n({type:"SET_PROXY_LOADING",payload:B}),[n]),R=w.useCallback(B=>n({type:"SET_PROXY_SAVING",payload:B}),[n]),I=w.useCallback(B=>n({type:"SET_PROXY_ERROR",payload:B}),[n]),W=w.useCallback(B=>n({type:"SET_PROXY_SUCCESS",payload:B}),[n]),_=w.useCallback(B=>n({type:"SET_PROXY_TEST_RESULT",payload:B}),[n]),z=w.useCallback(B=>n({type:"SET_PROXY_TESTING",payload:B}),[n]),$=w.useCallback(B=>n({type:"SET_RAW_CONFIG",payload:B}),[n]),F=w.useCallback(B=>n({type:"SET_RAW_CONFIG_LOADING",payload:B}),[n]);return w.useMemo(()=>({setBrowserConfig:e,setBrowserStatus:t,setBrowserLoading:i,setBrowserStatusLoading:o,setBrowserSaving:s,setBrowserError:r,setBrowserSuccess:c,setWebSearchConfig:u,setWebSearchStatus:f,setWebSearchLoading:m,setWebSearchStatusLoading:g,setWebSearchSaving:v,setWebSearchError:x,setWebSearchSuccess:C,setGlobalEnvConfig:k,setGlobalEnvLoading:P,setGlobalEnvSaving:D,setGlobalEnvError:O,setGlobalEnvSuccess:T,setProxyConfig:M,setProxyLoading:L,setProxySaving:R,setProxyError:I,setProxySuccess:W,setProxyTestResult:_,setProxyTesting:z,setRawConfig:$,setRawConfigLoading:F}),[e,t,i,o,s,r,c,u,f,m,g,v,x,C,k,P,D,O,T,M,L,R,I,W,_,z,$,F])}function HK(){const[n,e]=a1(),t=n.get("tab")?.toLowerCase(),i=t==="imageanalysis"||t==="image"?"image":t==="channels"?"channels":t==="globalenv"?"globalenv":t==="proxy"?"proxy":t==="auth"?"auth":t==="thinking"?"thinking":t==="backups"?"backups":"websearch",o=w.useCallback(s=>{e({tab:s},{replace:!0})},[e]);return{activeTab:i,setActiveTab:o}}function UK(){const{state:n}=tR(),e=BK(),[t,i]=w.useState(!1),o=w.useCallback(async()=>{try{e.setRawConfigLoading(!0);const r=await fetch("/api/config/raw");if(!r.ok){e.setRawConfig(null);return}const c=await r.text();e.setRawConfig(c)}catch{e.setRawConfig(null)}finally{e.setRawConfigLoading(!1)}},[e]),s=w.useCallback(async()=>{if(n.rawConfig)try{await navigator.clipboard.writeText(n.rawConfig),i(!0),setTimeout(()=>i(!1),2e3)}catch{}},[n.rawConfig]);return{rawConfig:n.rawConfig,loading:n.rawConfigLoading,copied:t,fetchRawConfig:o,copyToClipboard:s}}function bA({activeTab:n,onTabChange:e}){const{t}=ve(),i=[{value:"browser",label:t("settingsTabs.browser"),icon:YE},{value:"websearch",label:t("settingsTabs.web"),icon:m1},{value:"image",label:t("settingsTabs.image"),icon:b1},{value:"channels",label:t("settingsTabs.channels"),icon:$E},{value:"globalenv",label:t("settingsTabs.env"),icon:kb},{value:"thinking",label:t("settingsTabs.think"),icon:XE},{value:"proxy",label:t("settingsTabs.proxy"),icon:JE},{value:"auth",label:t("settingsTabs.auth"),icon:xb},{value:"backups",label:t("settingsTabs.backup"),icon:ZE}];return p.jsx(TD,{value:n,onValueChange:o=>e(o),children:p.jsx(Xb,{className:"grid w-full grid-cols-9",children:i.map(({value:o,label:s,icon:r})=>p.jsxs(vh,{value:o,className:"gap-1.5 px-2 text-xs",children:[p.jsx(r,{className:"h-3.5 w-3.5 shrink-0"}),p.jsx("span",{className:"truncate",children:s})]},o))})})}function vA(){return p.jsxs("div",{className:"flex-1 p-5 space-y-6",children:[p.jsx(tt,{className:"h-4 w-2/3"}),p.jsx("div",{className:"p-4 rounded-lg border",children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx(tt,{className:"h-5 w-32"}),p.jsx(tt,{className:"h-4 w-48"})]}),p.jsx(tt,{className:"h-6 w-10 rounded-full"})]})}),p.jsxs("div",{className:"space-y-3",children:[p.jsx(tt,{className:"h-5 w-24"}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(tt,{className:"h-20 w-full rounded-lg"}),p.jsx(tt,{className:"h-20 w-full rounded-lg"}),p.jsx(tt,{className:"h-20 w-full rounded-lg"})]})]})]})}function nR(n,e=3,t=1e3){return n().catch(i=>{if(e<=0)throw i;return new Promise(o=>setTimeout(o,t)).then(()=>nR(n,e-1,t*2))})}function Bo(n){return w.lazy(()=>nR(n))}const xA=Bo(()=>lt(()=>import("./index-D4JDNw3s.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),CA=Bo(()=>lt(()=>import("./index-DKwgHLt0.js"),__vite__mapDeps([10,1,2,11,4,5,6,7,8,9]))),SA=Bo(()=>lt(()=>import("./index-D0p405yf.js"),__vite__mapDeps([12,1,2,4,5,6,7,8,9]))),kA=Bo(()=>lt(()=>import("./channels-BiBwXY06.js"),__vite__mapDeps([13,1,2,4,5,6,7,8,9]))),wA=Bo(()=>lt(()=>import("./globalenv-section-CB5wPkY8.js"),__vite__mapDeps([14,1,2,4,5,6,7,8,9]))),PA=Bo(()=>lt(()=>import("./index-CxUAdhtw.js"),__vite__mapDeps([15,1,2,4,5,6,7,8,9]))),AA=Bo(()=>lt(()=>import("./index-Vt-HZYJB.js"),__vite__mapDeps([16,1,2,17,4,18,19,5,6,20,21,7,8,9]))),DA=Bo(()=>lt(()=>import("./auth-section-BEIcNixR.js"),__vite__mapDeps([22,1,2,4,5,6,7,8,9]))),OA=Bo(()=>lt(()=>import("./backups-section-CKhGhirR.js"),__vite__mapDeps([23,1,2,19,4,5,6,7,8,9])));class TA extends w.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}render(){return this.state.hasError?p.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:p.jsxs("div",{className:"text-center p-6 max-w-md",children:[p.jsx(Cc,{className:"w-12 h-12 mx-auto mb-4 text-destructive"}),p.jsx("p",{className:"font-medium text-foreground mb-2",children:re.t("settings.sectionLoadFailed")}),p.jsx("p",{className:"text-sm mb-4",children:this.state.error?.message||re.t("settings.unknownError")}),p.jsxs(ft,{variant:"outline",onClick:()=>window.location.reload(),className:"inline-flex items-center gap-2",children:[p.jsx(xc,{className:"w-4 h-4"}),re.t("settings.reloadPage")]})]})}):this.props.children}}function _K(n){switch(n?.toLowerCase()){case"browser":return"browser";case"imageanalysis":case"image":return"image";case"channels":return"channels";case"globalenv":return"globalenv";case"proxy":return"proxy";case"auth":return"auth";case"thinking":return"thinking";case"backups":return"backups";default:return"websearch"}}function zK(){const{t:n}=ve(),{setActiveTab:e}=HK(),[t]=a1(),i=_K(t.get("tab")),{rawConfig:o,loading:s,copied:r,fetchRawConfig:c,copyToClipboard:u}=UK();w.useEffect(()=>{c()},[c]);const f=m=>{w.startTransition(()=>{e(m)})};return p.jsxs("div",{className:"h-full min-h-0",children:[p.jsxs("div",{className:"md:hidden h-full flex flex-col",children:[p.jsx("div",{className:"border-b bg-background p-4",children:p.jsx(bA,{activeTab:i,onTabChange:f})}),p.jsx(TA,{children:p.jsxs(w.Suspense,{fallback:p.jsx(vA,{}),children:[i==="browser"&&p.jsx(CA,{}),i==="websearch"&&p.jsx(xA,{}),i==="image"&&p.jsx(SA,{}),i==="channels"&&p.jsx(kA,{}),i==="globalenv"&&p.jsx(wA,{}),i==="thinking"&&p.jsx(PA,{}),i==="proxy"&&p.jsx(AA,{}),i==="auth"&&p.jsx(DA,{}),i==="backups"&&p.jsx(OA,{})]})})]}),p.jsxs(Yb,{direction:"horizontal",className:"h-full hidden md:flex",children:[p.jsx(kc,{defaultSize:46,minSize:36,maxSize:62,children:p.jsxs("div",{className:"h-full border-r flex flex-col bg-muted/30 relative",children:[p.jsx("div",{className:"p-5 border-b bg-background",children:p.jsx(bA,{activeTab:i,onTabChange:f})}),p.jsx(TA,{children:p.jsxs(w.Suspense,{fallback:p.jsx(vA,{}),children:[i==="browser"&&p.jsx(CA,{}),i==="websearch"&&p.jsx(xA,{}),i==="image"&&p.jsx(SA,{}),i==="channels"&&p.jsx(kA,{}),i==="globalenv"&&p.jsx(wA,{}),i==="thinking"&&p.jsx(PA,{}),i==="proxy"&&p.jsx(AA,{}),i==="auth"&&p.jsx(DA,{}),i==="backups"&&p.jsx(OA,{})]})})]})}),p.jsx($b,{className:"w-2 bg-border hover:bg-primary/20 transition-colors cursor-col-resize flex items-center justify-center group",children:p.jsx(Yh,{className:"w-3 h-3 text-muted-foreground group-hover:text-primary"})}),p.jsx(kc,{defaultSize:54,minSize:35,children:p.jsxs("div",{className:"h-full flex flex-col",children:[p.jsxs("div",{className:"p-4 border-b bg-background flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(tk,{className:"w-5 h-5 text-primary"}),p.jsxs("div",{children:[p.jsx("h2",{className:"font-semibold",children:"config.yaml"}),p.jsx("p",{className:"text-sm text-muted-foreground",children:"~/.ccs/config.yaml"})]})]}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx(ft,{variant:"outline",size:"sm",onClick:u,disabled:!o,children:r?p.jsxs(p.Fragment,{children:[p.jsx(Er,{className:"w-4 h-4 mr-1"}),n("settings.copied")]}):p.jsxs(p.Fragment,{children:[p.jsx(hh,{className:"w-4 h-4 mr-1"}),n("settings.copy")]})}),p.jsx(ft,{variant:"outline",size:"sm",onClick:c,disabled:s,children:p.jsx(xc,{className:`w-4 h-4 ${s?"animate-spin":""}`})})]})]}),p.jsx("div",{className:"flex-1 overflow-auto",children:o?p.jsx(ZM,{value:o,onChange:()=>{},language:"yaml",readonly:!0,minHeight:"auto",className:"min-h-full"}):s?p.jsxs("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:[p.jsx(xc,{className:"w-5 h-5 animate-spin mr-2"}),n("settings.loading")]}):p.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:p.jsxs("div",{className:"text-center",children:[p.jsx(tk,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),p.jsx("p",{children:n("settings.configFileNotFound")}),p.jsx("code",{className:"text-sm bg-muted px-2 py-1 rounded mt-2 inline-block",children:"ccs migrate"})]})})})]})})]})]})}function FK(){return p.jsx(jK,{children:p.jsx(zK,{})})}const qK=Object.freeze(Object.defineProperty({__proto__:null,SettingsPage:FK},Symbol.toStringTag,{value:"Module"}));function GK(n,e,t="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:n,timeZoneName:t}).format(e).split(/\s/g).slice(2).join(" ")}const VK={},oc={};function ls(n,e){try{const i=(VK[n]||=new Intl.DateTimeFormat("en-US",{timeZone:n,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return i in oc?oc[i]:MA(i,i.split(":"))}catch{if(n in oc)return oc[n];const t=n?.match(KK);return t?MA(n,t.slice(1)):NaN}}const KK=/([+-]\d\d):?(\d\d)?/;function MA(n,e){const t=+(e[0]||0),i=+(e[1]||0),o=+(e[2]||0)/60;return oc[n]=t*60+i>0?t*60+i+o:t*60-i-o}class Wi extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(ls(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),iR(this),bb(this)):this.setTime(Date.now())}static tz(e,...t){return t.length?new Wi(...t,e):new Wi(Date.now(),e)}withTimeZone(e){return new Wi(+this,e)}getTimezoneOffset(){const e=-ls(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),bb(this),+this}[Symbol.for("constructDateFrom")](e){return new Wi(+new Date(e),this.timeZone)}}const RA=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(n=>{if(!RA.test(n))return;const e=n.replace(RA,"$1UTC");Wi.prototype[e]&&(n.startsWith("get")?Wi.prototype[n]=function(){return this.internal[e]()}:(Wi.prototype[n]=function(){return Date.prototype[e].apply(this.internal,arguments),WK(this),+this},Wi.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),bb(this),+this}))});function bb(n){n.internal.setTime(+n),n.internal.setUTCSeconds(n.internal.getUTCSeconds()-Math.round(-ls(n.timeZone,n)*60))}function WK(n){Date.prototype.setFullYear.call(n,n.internal.getUTCFullYear(),n.internal.getUTCMonth(),n.internal.getUTCDate()),Date.prototype.setHours.call(n,n.internal.getUTCHours(),n.internal.getUTCMinutes(),n.internal.getUTCSeconds(),n.internal.getUTCMilliseconds()),iR(n)}function iR(n){const e=ls(n.timeZone,n),t=e>0?Math.floor(e):Math.ceil(e),i=new Date(+n);i.setUTCHours(i.getUTCHours()-1);const o=-new Date(+n).getTimezoneOffset(),s=-new Date(+i).getTimezoneOffset(),r=o-s,c=Date.prototype.getHours.apply(n)!==n.internal.getUTCHours();r&&c&&n.internal.setUTCMinutes(n.internal.getUTCMinutes()+r);const u=o-t;u&&Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+u);const f=new Date(+n);f.setUTCSeconds(0);const m=o>0?f.getSeconds():(f.getSeconds()-60)%60,g=Math.round(-(ls(n.timeZone,n)*60))%60;(g||m)&&(n.internal.setUTCSeconds(n.internal.getUTCSeconds()+g),Date.prototype.setUTCSeconds.call(n,Date.prototype.getUTCSeconds.call(n)+g+m));const v=ls(n.timeZone,n),x=v>0?Math.floor(v):Math.ceil(v),k=-new Date(+n).getTimezoneOffset()-x,P=x!==t,D=k-u;if(P&&D){Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+D);const O=ls(n.timeZone,n),T=O>0?Math.floor(O):Math.ceil(O),M=x-T;M&&(n.internal.setUTCMinutes(n.internal.getUTCMinutes()+M),Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+M))}}class Oo extends Wi{static tz(e,...t){return t.length?new Oo(...t,e):new Oo(Date.now(),e)}toISOString(){const[e,t,i]=this.tzComponents(),o=`${e}${t}:${i}`;return this.internal.toISOString().slice(0,-1)+o}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,t,i,o]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${i} ${t} ${o}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[t,i,o]=this.tzComponents();return`${e} GMT${t}${i}${o} (${GK(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),t=e>0?"-":"+",i=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),o=String(Math.abs(e)%60).padStart(2,"0");return[t,i,o]}withTimeZone(e){return new Oo(+this,e)}[Symbol.for("constructDateFrom")](e){return new Oo(+new Date(e),this.timeZone)}}const LA=5,QK=4;function YK(n,e){const t=e.startOfMonth(n),i=t.getDay()>0?t.getDay():7,o=e.addDays(n,-i+1),s=e.addDays(o,LA*7-1);return e.getMonth(n)===e.getMonth(s)?LA:QK}function oR(n,e){const t=e.startOfMonth(n),i=t.getDay();return i===1?t:i===0?e.addDays(t,-6):e.addDays(t,-1*(i-1))}function $K(n,e){const t=oR(n,e),i=YK(n,e);return e.addDays(t,i*7-1)}const aR={...zl,labels:{labelDayButton:(n,e,t,i)=>{let o;i&&typeof i.format=="function"?o=i.format.bind(i):o=(r,c)=>$l(r,c,{locale:zl,...t});let s=o(n,"PPPP");return e.today&&(s=`Today, ${s}`),e.selected&&(s=`${s}, selected`),s},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:n=>`Week ${n}`,labelYearDropdown:"Choose the Year",labelGrid:(n,e,t)=>{let i;return t&&typeof t.format=="function"?i=t.format.bind(t):i=(o,s)=>$l(o,s,{locale:zl,...e}),i(n,"LLLL yyyy")},labelGridcell:(n,e,t,i)=>{let o;i&&typeof i.format=="function"?o=i.format.bind(i):o=(r,c)=>$l(r,c,{locale:zl,...t});let s=o(n,"PPPP");return e?.today&&(s=`Today, ${s}`),s},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(n,e,t)=>{let i;return t&&typeof t.format=="function"?i=t.format.bind(t):i=(o,s)=>$l(o,s,{locale:zl,...e}),i(n,"cccc")}}};class $n{constructor(e,t){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Oo.tz(this.options.timeZone):new this.Date,this.newDate=(i,o,s)=>this.overrides?.newDate?this.overrides.newDate(i,o,s):this.options.timeZone?new Oo(i,o,s,this.options.timeZone):new Date(i,o,s),this.addDays=(i,o)=>this.overrides?.addDays?this.overrides.addDays(i,o):oI(i,o),this.addMonths=(i,o)=>this.overrides?.addMonths?this.overrides.addMonths(i,o):aI(i,o),this.addWeeks=(i,o)=>this.overrides?.addWeeks?this.overrides.addWeeks(i,o):sI(i,o),this.addYears=(i,o)=>this.overrides?.addYears?this.overrides.addYears(i,o):rI(i,o),this.differenceInCalendarDays=(i,o)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(i,o):lI(i,o),this.differenceInCalendarMonths=(i,o)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(i,o):cI(i,o),this.eachMonthOfInterval=i=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(i):dI(i),this.eachYearOfInterval=i=>{const o=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(i):uI(i),s=new Set(o.map(c=>this.getYear(c)));if(s.size===o.length)return o;const r=[];return s.forEach(c=>{r.push(new Date(c,0,1))}),r},this.endOfBroadcastWeek=i=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(i):$K(i,this),this.endOfISOWeek=i=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(i):hI(i),this.endOfMonth=i=>this.overrides?.endOfMonth?this.overrides.endOfMonth(i):fI(i),this.endOfWeek=(i,o)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(i,o):pI(i,this.options),this.endOfYear=i=>this.overrides?.endOfYear?this.overrides.endOfYear(i):mI(i),this.format=(i,o,s)=>{const r=this.overrides?.format?this.overrides.format(i,o,this.options):$l(i,o,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(r):r},this.getISOWeek=i=>this.overrides?.getISOWeek?this.overrides.getISOWeek(i):gI(i),this.getMonth=(i,o)=>this.overrides?.getMonth?this.overrides.getMonth(i,this.options):yI(i,this.options),this.getYear=(i,o)=>this.overrides?.getYear?this.overrides.getYear(i,this.options):bI(i,this.options),this.getWeek=(i,o)=>this.overrides?.getWeek?this.overrides.getWeek(i,this.options):vI(i,this.options),this.isAfter=(i,o)=>this.overrides?.isAfter?this.overrides.isAfter(i,o):xI(i,o),this.isBefore=(i,o)=>this.overrides?.isBefore?this.overrides.isBefore(i,o):CI(i,o),this.isDate=i=>this.overrides?.isDate?this.overrides.isDate(i):SI(i),this.isSameDay=(i,o)=>this.overrides?.isSameDay?this.overrides.isSameDay(i,o):kI(i,o),this.isSameMonth=(i,o)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(i,o):wI(i,o),this.isSameYear=(i,o)=>this.overrides?.isSameYear?this.overrides.isSameYear(i,o):PI(i,o),this.max=i=>this.overrides?.max?this.overrides.max(i):AI(i),this.min=i=>this.overrides?.min?this.overrides.min(i):DI(i),this.setMonth=(i,o)=>this.overrides?.setMonth?this.overrides.setMonth(i,o):OI(i,o),this.setYear=(i,o)=>this.overrides?.setYear?this.overrides.setYear(i,o):TI(i,o),this.startOfBroadcastWeek=(i,o)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(i,this):oR(i,this),this.startOfDay=i=>this.overrides?.startOfDay?this.overrides.startOfDay(i):MI(i),this.startOfISOWeek=i=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(i):RI(i),this.startOfMonth=i=>this.overrides?.startOfMonth?this.overrides.startOfMonth(i):LI(i),this.startOfWeek=(i,o)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(i,this.options):NI(i,this.options),this.startOfYear=i=>this.overrides?.startOfYear?this.overrides.startOfYear(i):EI(i),this.options={locale:aR,...e},this.overrides=t}getDigitMap(){const{numerals:e="latn"}=this.options,t=new Intl.NumberFormat("en-US",{numberingSystem:e}),i={};for(let o=0;o<10;o++)i[o.toString()]=t.format(o);return i}replaceDigits(e){const t=this.getDigitMap();return e.replace(/\d/g,i=>t[i]||i)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){const e=this.options.locale?.code;return e&&$n.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:t,timeZone:i,numerals:o}=this.options,s=t?.code;if(s&&$n.yearFirstLocales.has(s))try{return new Intl.DateTimeFormat(s,{month:"long",year:"numeric",timeZone:i,numberingSystem:o}).format(e)}catch{}const r=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,r)}}$n.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const io=new $n;class sR{constructor(e,t,i=io){this.date=e,this.displayMonth=t,this.outside=!!(t&&!i.isSameMonth(e,t)),this.dateLib=i,this.isoDate=i.format(e,"yyyy-MM-dd"),this.displayMonthId=i.format(t,"yyyy-MM"),this.dateMonthId=i.format(e,"yyyy-MM")}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class XK{constructor(e,t){this.date=e,this.weeks=t}}class JK{constructor(e,t){this.days=t,this.weekNumber=e}}function ZK(n){return ge.createElement("button",{...n})}function e8(n){return ge.createElement("span",{...n})}function t8(n){const{size:e=24,orientation:t="left",className:i}=n;return ge.createElement("svg",{className:i,width:e,height:e,viewBox:"0 0 24 24"},t==="up"&&ge.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),t==="down"&&ge.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),t==="left"&&ge.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),t==="right"&&ge.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function n8(n){const{day:e,modifiers:t,...i}=n;return ge.createElement("td",{...i})}function i8(n){const{day:e,modifiers:t,...i}=n,o=ge.useRef(null);return ge.useEffect(()=>{t.focused&&o.current?.focus()},[t.focused]),ge.createElement("button",{ref:o,...i})}var we;(function(n){n.Root="root",n.Chevron="chevron",n.Day="day",n.DayButton="day_button",n.CaptionLabel="caption_label",n.Dropdowns="dropdowns",n.Dropdown="dropdown",n.DropdownRoot="dropdown_root",n.Footer="footer",n.MonthGrid="month_grid",n.MonthCaption="month_caption",n.MonthsDropdown="months_dropdown",n.Month="month",n.Months="months",n.Nav="nav",n.NextMonthButton="button_next",n.PreviousMonthButton="button_previous",n.Week="week",n.Weeks="weeks",n.Weekday="weekday",n.Weekdays="weekdays",n.WeekNumber="week_number",n.WeekNumberHeader="week_number_header",n.YearsDropdown="years_dropdown"})(we||(we={}));var wt;(function(n){n.disabled="disabled",n.hidden="hidden",n.outside="outside",n.focused="focused",n.today="today"})(wt||(wt={}));var Si;(function(n){n.range_end="range_end",n.range_middle="range_middle",n.range_start="range_start",n.selected="selected"})(Si||(Si={}));var Qn;(function(n){n.weeks_before_enter="weeks_before_enter",n.weeks_before_exit="weeks_before_exit",n.weeks_after_enter="weeks_after_enter",n.weeks_after_exit="weeks_after_exit",n.caption_after_enter="caption_after_enter",n.caption_after_exit="caption_after_exit",n.caption_before_enter="caption_before_enter",n.caption_before_exit="caption_before_exit"})(Qn||(Qn={}));function o8(n){const{options:e,className:t,components:i,classNames:o,...s}=n,r=[o[we.Dropdown],t].join(" "),c=e?.find(({value:u})=>u===s.value);return ge.createElement("span",{"data-disabled":s.disabled,className:o[we.DropdownRoot]},ge.createElement(i.Select,{className:r,...s},e?.map(({value:u,label:f,disabled:m})=>ge.createElement(i.Option,{key:u,value:u,disabled:m},f))),ge.createElement("span",{className:o[we.CaptionLabel],"aria-hidden":!0},c?.label,ge.createElement(i.Chevron,{orientation:"down",size:18,className:o[we.Chevron]})))}function a8(n){return ge.createElement("div",{...n})}function s8(n){return ge.createElement("div",{...n})}function r8(n){const{calendarMonth:e,displayIndex:t,...i}=n;return ge.createElement("div",{...i},n.children)}function l8(n){const{calendarMonth:e,displayIndex:t,...i}=n;return ge.createElement("div",{...i})}function c8(n){return ge.createElement("table",{...n})}function d8(n){return ge.createElement("div",{...n})}const rR=w.createContext(void 0);function id(){const n=w.useContext(rR);if(n===void 0)throw new Error("useDayPicker() must be used within a custom component.");return n}function u8(n){const{components:e}=id();return ge.createElement(e.Dropdown,{...n})}function h8(n){const{onPreviousClick:e,onNextClick:t,previousMonth:i,nextMonth:o,...s}=n,{components:r,classNames:c,labels:{labelPrevious:u,labelNext:f}}=id(),m=w.useCallback(v=>{o&&t?.(v)},[o,t]),g=w.useCallback(v=>{i&&e?.(v)},[i,e]);return ge.createElement("nav",{...s},ge.createElement(r.PreviousMonthButton,{type:"button",className:c[we.PreviousMonthButton],tabIndex:i?void 0:-1,"aria-disabled":i?void 0:!0,"aria-label":u(i),onClick:g},ge.createElement(r.Chevron,{disabled:i?void 0:!0,className:c[we.Chevron],orientation:"left"})),ge.createElement(r.NextMonthButton,{type:"button",className:c[we.NextMonthButton],tabIndex:o?void 0:-1,"aria-disabled":o?void 0:!0,"aria-label":f(o),onClick:m},ge.createElement(r.Chevron,{disabled:o?void 0:!0,orientation:"right",className:c[we.Chevron]})))}function f8(n){const{components:e}=id();return ge.createElement(e.Button,{...n})}function p8(n){return ge.createElement("option",{...n})}function m8(n){const{components:e}=id();return ge.createElement(e.Button,{...n})}function g8(n){const{rootRef:e,...t}=n;return ge.createElement("div",{...t,ref:e})}function y8(n){return ge.createElement("select",{...n})}function b8(n){const{week:e,...t}=n;return ge.createElement("tr",{...t})}function v8(n){return ge.createElement("th",{...n})}function x8(n){return ge.createElement("thead",{"aria-hidden":!0},ge.createElement("tr",{...n}))}function C8(n){const{week:e,...t}=n;return ge.createElement("th",{...t})}function S8(n){return ge.createElement("th",{...n})}function k8(n){return ge.createElement("tbody",{...n})}function w8(n){const{components:e}=id();return ge.createElement(e.Dropdown,{...n})}const P8=Object.freeze(Object.defineProperty({__proto__:null,Button:ZK,CaptionLabel:e8,Chevron:t8,Day:n8,DayButton:i8,Dropdown:o8,DropdownNav:a8,Footer:s8,Month:r8,MonthCaption:l8,MonthGrid:c8,Months:d8,MonthsDropdown:u8,Nav:h8,NextMonthButton:f8,Option:p8,PreviousMonthButton:m8,Root:g8,Select:y8,Week:b8,WeekNumber:C8,WeekNumberHeader:S8,Weekday:v8,Weekdays:x8,Weeks:k8,YearsDropdown:w8},Symbol.toStringTag,{value:"Module"}));function To(n,e,t=!1,i=io){let{from:o,to:s}=n;const{differenceInCalendarDays:r,isSameDay:c}=i;return o&&s?(r(s,o)<0&&([o,s]=[s,o]),r(e,o)>=(t?1:0)&&r(s,e)>=(t?1:0)):!t&&s?c(s,e):!t&&o?c(o,e):!1}function Xv(n){return!!(n&&typeof n=="object"&&"before"in n&&"after"in n)}function Nf(n){return!!(n&&typeof n=="object"&&"from"in n)}function Jv(n){return!!(n&&typeof n=="object"&&"after"in n)}function Zv(n){return!!(n&&typeof n=="object"&&"before"in n)}function lR(n){return!!(n&&typeof n=="object"&&"dayOfWeek"in n)}function cR(n,e){return Array.isArray(n)&&n.every(e.isDate)}function Mo(n,e,t=io){const i=Array.isArray(e)?e:[e],{isSameDay:o,differenceInCalendarDays:s,isAfter:r}=t;return i.some(c=>{if(typeof c=="boolean")return c;if(t.isDate(c))return o(n,c);if(cR(c,t))return c.some(u=>o(n,u));if(Nf(c))return To(c,n,!1,t);if(lR(c))return Array.isArray(c.dayOfWeek)?c.dayOfWeek.includes(n.getDay()):c.dayOfWeek===n.getDay();if(Xv(c)){const u=s(c.before,n),f=s(c.after,n),m=u>0,g=f<0;return r(c.before,c.after)?g&&m:m||g}return Jv(c)?s(n,c.after)>0:Zv(c)?s(c.before,n)>0:typeof c=="function"?c(n):!1})}function A8(n,e,t,i,o){const{disabled:s,hidden:r,modifiers:c,showOutsideDays:u,broadcastCalendar:f,today:m=o.today()}=e,{isSameDay:g,isSameMonth:v,startOfMonth:x,isBefore:C,endOfMonth:k,isAfter:P}=o,D=t&&x(t),O=i&&k(i),T={[wt.focused]:[],[wt.outside]:[],[wt.disabled]:[],[wt.hidden]:[],[wt.today]:[]},M={};for(const L of n){const{date:R,displayMonth:I}=L,W=!!(I&&!v(R,I)),_=!!(D&&C(R,D)),z=!!(O&&P(R,O)),$=!!(s&&Mo(R,s,o)),F=!!(r&&Mo(R,r,o))||_||z||!f&&!u&&W||f&&u===!1&&W,B=g(R,m);W&&T.outside.push(L),$&&T.disabled.push(L),F&&T.hidden.push(L),B&&T.today.push(L),c&&Object.keys(c).forEach(ie=>{const oe=c?.[ie];oe&&Mo(R,oe,o)&&(M[ie]?M[ie].push(L):M[ie]=[L])})}return L=>{const R={[wt.focused]:!1,[wt.disabled]:!1,[wt.hidden]:!1,[wt.outside]:!1,[wt.today]:!1},I={};for(const W in T){const _=T[W];R[W]=_.some(z=>z===L)}for(const W in M)I[W]=M[W].some(_=>_===L);return{...R,...I}}}function D8(n,e,t={}){return Object.entries(n).filter(([,o])=>o===!0).reduce((o,[s])=>(t[s]?o.push(t[s]):e[wt[s]]?o.push(e[wt[s]]):e[Si[s]]&&o.push(e[Si[s]]),o),[e[we.Day]])}function O8(n){return{...P8,...n}}function T8(n){const e={"data-mode":n.mode??void 0,"data-required":"required"in n?n.required:void 0,"data-multiple-months":n.numberOfMonths&&n.numberOfMonths>1||void 0,"data-week-numbers":n.showWeekNumber||void 0,"data-broadcast-calendar":n.broadcastCalendar||void 0,"data-nav-layout":n.navLayout||void 0};return Object.entries(n).forEach(([t,i])=>{t.startsWith("data-")&&(e[t]=i)}),e}function M8(){const n={};for(const e in we)n[we[e]]=`rdp-${we[e]}`;for(const e in wt)n[wt[e]]=`rdp-${wt[e]}`;for(const e in Si)n[Si[e]]=`rdp-${Si[e]}`;for(const e in Qn)n[Qn[e]]=`rdp-${Qn[e]}`;return n}function dR(n,e,t){return(t??new $n(e)).formatMonthYear(n)}const R8=dR;function L8(n,e,t){return(t??new $n(e)).format(n,"d")}function N8(n,e=io){return e.format(n,"LLLL")}function E8(n,e,t){return(t??new $n(e)).format(n,"cccccc")}function I8(n,e=io){return n<10?e.formatNumber(`0${n.toLocaleString()}`):e.formatNumber(`${n.toLocaleString()}`)}function j8(){return""}function uR(n,e=io){return e.format(n,"yyyy")}const B8=uR,H8=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:dR,formatDay:L8,formatMonthCaption:R8,formatMonthDropdown:N8,formatWeekNumber:I8,formatWeekNumberHeader:j8,formatWeekdayName:E8,formatYearCaption:B8,formatYearDropdown:uR},Symbol.toStringTag,{value:"Module"}));function U8(n){return n?.formatMonthCaption&&!n.formatCaption&&(n.formatCaption=n.formatMonthCaption),n?.formatYearCaption&&!n.formatYearDropdown&&(n.formatYearDropdown=n.formatYearCaption),{...H8,...n}}function ex(n,e,t,i){let o=(i??new $n(t)).format(n,"PPPP");return e.today&&(o=`Today, ${o}`),e.selected&&(o=`${o}, selected`),o}const _8=ex;function tx(n,e,t){return(t??new $n(e)).formatMonthYear(n)}const z8=tx;function hR(n,e,t,i){let o=(i??new $n(t)).format(n,"PPPP");return e?.today&&(o=`Today, ${o}`),o}function fR(n){return"Choose the Month"}function pR(){return""}const F8="Go to the Next Month";function mR(n,e){return F8}function gR(n){return"Go to the Previous Month"}function yR(n,e,t){return(t??new $n(e)).format(n,"cccc")}function bR(n,e){return`Week ${n}`}function vR(n){return"Week Number"}function xR(n){return"Choose the Year"}const q8=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:z8,labelDay:_8,labelDayButton:ex,labelGrid:tx,labelGridcell:hR,labelMonthDropdown:fR,labelNav:pR,labelNext:mR,labelPrevious:gR,labelWeekNumber:bR,labelWeekNumberHeader:vR,labelWeekday:yR,labelYearDropdown:xR},Symbol.toStringTag,{value:"Module"})),vi=(n,e,t)=>e||(t?typeof t=="function"?t:(...i)=>t:n);function G8(n,e){const t=e.locale?.labels??{};return{...q8,...n??{},labelDayButton:vi(ex,n?.labelDayButton,t.labelDayButton),labelMonthDropdown:vi(fR,n?.labelMonthDropdown,t.labelMonthDropdown),labelNext:vi(mR,n?.labelNext,t.labelNext),labelPrevious:vi(gR,n?.labelPrevious,t.labelPrevious),labelWeekNumber:vi(bR,n?.labelWeekNumber,t.labelWeekNumber),labelYearDropdown:vi(xR,n?.labelYearDropdown,t.labelYearDropdown),labelGrid:vi(tx,n?.labelGrid,t.labelGrid),labelGridcell:vi(hR,n?.labelGridcell,t.labelGridcell),labelNav:vi(pR,n?.labelNav,t.labelNav),labelWeekNumberHeader:vi(vR,n?.labelWeekNumberHeader,t.labelWeekNumberHeader),labelWeekday:vi(yR,n?.labelWeekday,t.labelWeekday)}}function V8(n,e,t,i,o){const{startOfMonth:s,startOfYear:r,endOfYear:c,eachMonthOfInterval:u,getMonth:f}=o;return u({start:r(n),end:c(n)}).map(v=>{const x=i.formatMonthDropdown(v,o),C=f(v),k=e&&v<s(e)||t&&v>s(t)||!1;return{value:C,label:x,disabled:k}})}function K8(n,e={},t={}){let i={...e?.[we.Day]};return Object.entries(n).filter(([,o])=>o===!0).forEach(([o])=>{i={...i,...t?.[o]}}),i}function W8(n,e,t,i){const o=i??n.today(),s=t?n.startOfBroadcastWeek(o,n):e?n.startOfISOWeek(o):n.startOfWeek(o),r=[];for(let c=0;c<7;c++){const u=n.addDays(s,c);r.push(u)}return r}function Q8(n,e,t,i,o=!1){if(!n||!e)return;const{startOfYear:s,endOfYear:r,eachYearOfInterval:c,getYear:u}=i,f=s(n),m=r(e),g=c({start:f,end:m});return o&&g.reverse(),g.map(v=>{const x=t.formatYearDropdown(v,i);return{value:u(v),label:x,disabled:!1}})}const od=n=>n instanceof HTMLElement?n:null,Jg=n=>[...n.querySelectorAll("[data-animated-month]")??[]],Y8=n=>od(n.querySelector("[data-animated-month]")),Zg=n=>od(n.querySelector("[data-animated-caption]")),ey=n=>od(n.querySelector("[data-animated-weeks]")),$8=n=>od(n.querySelector("[data-animated-nav]")),X8=n=>od(n.querySelector("[data-animated-weekdays]"));function J8(n,e,{classNames:t,months:i,focused:o,dateLib:s}){const r=w.useRef(null),c=w.useRef(i),u=w.useRef(!1);w.useLayoutEffect(()=>{const f=c.current;if(c.current=i,!e||!n.current||!(n.current instanceof HTMLElement)||i.length===0||f.length===0||i.length!==f.length)return;const m=s.isSameMonth(i[0].date,f[0].date),g=s.isAfter(i[0].date,f[0].date),v=g?t[Qn.caption_after_enter]:t[Qn.caption_before_enter],x=g?t[Qn.weeks_after_enter]:t[Qn.weeks_before_enter],C=r.current,k=n.current.cloneNode(!0);if(k instanceof HTMLElement?(Jg(k).forEach(T=>{if(!(T instanceof HTMLElement))return;const M=Y8(T);M&&T.contains(M)&&T.removeChild(M);const L=Zg(T);L&&L.classList.remove(v);const R=ey(T);R&&R.classList.remove(x)}),r.current=k):r.current=null,u.current||m||o)return;const P=C instanceof HTMLElement?Jg(C):[],D=Jg(n.current);if(D?.every(O=>O instanceof HTMLElement)&&P&&P.every(O=>O instanceof HTMLElement)){u.current=!0,n.current.style.isolation="isolate";const O=$8(n.current);O&&(O.style.zIndex="1"),D.forEach((T,M)=>{const L=P[M];if(!L)return;T.style.position="relative",T.style.overflow="hidden";const R=Zg(T);R&&R.classList.add(v);const I=ey(T);I&&I.classList.add(x);const W=()=>{u.current=!1,n.current&&(n.current.style.isolation=""),O&&(O.style.zIndex=""),R&&R.classList.remove(v),I&&I.classList.remove(x),T.style.position="",T.style.overflow="",T.contains(L)&&T.removeChild(L)};L.style.pointerEvents="none",L.style.position="absolute",L.style.overflow="hidden",L.setAttribute("aria-hidden","true");const _=X8(L);_&&(_.style.opacity="0");const z=Zg(L);z&&(z.classList.add(g?t[Qn.caption_before_exit]:t[Qn.caption_after_exit]),z.addEventListener("animationend",W));const $=ey(L);$&&$.classList.add(g?t[Qn.weeks_before_exit]:t[Qn.weeks_after_exit]),T.insertBefore(L,T.firstChild)})}})}function Z8(n,e,t,i){const o=n[0],s=n[n.length-1],{ISOWeek:r,fixedWeeks:c,broadcastCalendar:u}=t??{},{addDays:f,differenceInCalendarDays:m,differenceInCalendarMonths:g,endOfBroadcastWeek:v,endOfISOWeek:x,endOfMonth:C,endOfWeek:k,isAfter:P,startOfBroadcastWeek:D,startOfISOWeek:O,startOfWeek:T}=i,M=u?D(o,i):r?O(o):T(o),L=u?v(s):r?x(C(s)):k(C(s)),R=e&&(u?v(e):r?x(e):k(e)),I=R&&P(L,R)?R:L,W=m(I,M),_=g(s,o)+1,z=[];for(let B=0;B<=W;B++){const ie=f(M,B);z.push(ie)}const F=(u?35:42)*_;if(c&&z.length<F){const B=F-z.length;for(let ie=0;ie<B;ie++){const oe=f(z[z.length-1],1);z.push(oe)}}return z}function eW(n){const e=[];return n.reduce((t,i)=>{const o=i.weeks.reduce((s,r)=>s.concat(r.days.slice()),e.slice());return t.concat(o.slice())},e.slice())}function tW(n,e,t,i){const{numberOfMonths:o=1}=t,s=[];for(let r=0;r<o;r++){const c=i.addMonths(n,r);if(e&&c>e)break;s.push(c)}return s}function NA(n,e,t,i){const{month:o,defaultMonth:s,today:r=i.today(),numberOfMonths:c=1}=n;let u=o||s||r;const{differenceInCalendarMonths:f,addMonths:m,startOfMonth:g}=i;if(t&&f(t,u)<c-1){const v=-1*(c-1);u=m(t,v)}return e&&f(u,e)<0&&(u=e),g(u)}function nW(n,e,t,i){const{addDays:o,endOfBroadcastWeek:s,endOfISOWeek:r,endOfMonth:c,endOfWeek:u,getISOWeek:f,getWeek:m,startOfBroadcastWeek:g,startOfISOWeek:v,startOfWeek:x}=i,C=n.reduce((k,P)=>{const D=t.broadcastCalendar?g(P,i):t.ISOWeek?v(P):x(P),O=t.broadcastCalendar?s(P):t.ISOWeek?r(c(P)):u(c(P)),T=e.filter(I=>I>=D&&I<=O),M=t.broadcastCalendar?35:42;if(t.fixedWeeks&&T.length<M){const I=e.filter(W=>{const _=M-T.length;return W>O&&W<=o(O,_)});T.push(...I)}const L=T.reduce((I,W)=>{const _=t.ISOWeek?f(W):m(W),z=I.find(F=>F.weekNumber===_),$=new sR(W,P,i);return z?z.days.push($):I.push(new JK(_,[$])),I},[]),R=new XK(P,L);return k.push(R),k},[]);return t.reverseMonths?C.reverse():C}function iW(n,e){let{startMonth:t,endMonth:i}=n;const{startOfYear:o,startOfDay:s,startOfMonth:r,endOfMonth:c,addYears:u,endOfYear:f,newDate:m,today:g}=e,{fromYear:v,toYear:x,fromMonth:C,toMonth:k}=n;!t&&C&&(t=C),!t&&v&&(t=e.newDate(v,0,1)),!i&&k&&(i=k),!i&&x&&(i=m(x,11,31));const P=n.captionLayout==="dropdown"||n.captionLayout==="dropdown-years";return t?t=r(t):v?t=m(v,0,1):!t&&P&&(t=o(u(n.today??g(),-100))),i?i=c(i):x?i=m(x,11,31):!i&&P&&(i=f(n.today??g())),[t&&s(t),i&&s(i)]}function oW(n,e,t,i){if(t.disableNavigation)return;const{pagedNavigation:o,numberOfMonths:s=1}=t,{startOfMonth:r,addMonths:c,differenceInCalendarMonths:u}=i,f=o?s:1,m=r(n);if(!e)return c(m,f);if(!(u(e,n)<s))return c(m,f)}function aW(n,e,t,i){if(t.disableNavigation)return;const{pagedNavigation:o,numberOfMonths:s}=t,{startOfMonth:r,addMonths:c,differenceInCalendarMonths:u}=i,f=o?s??1:1,m=r(n);if(!e)return c(m,-f);if(!(u(m,e)<=0))return c(m,-f)}function sW(n){const e=[];return n.reduce((t,i)=>t.concat(i.weeks.slice()),e.slice())}function Ef(n,e){const[t,i]=w.useState(n);return[e===void 0?t:e,i]}function rW(n,e){const[t,i]=iW(n,e),{startOfMonth:o,endOfMonth:s}=e,r=NA(n,t,i,e),[c,u]=Ef(r,n.month?r:void 0);w.useEffect(()=>{const M=NA(n,t,i,e);u(M)},[n.timeZone]);const{months:f,weeks:m,days:g,previousMonth:v,nextMonth:x}=w.useMemo(()=>{const M=tW(c,i,{numberOfMonths:n.numberOfMonths},e),L=Z8(M,n.endMonth?s(n.endMonth):void 0,{ISOWeek:n.ISOWeek,fixedWeeks:n.fixedWeeks,broadcastCalendar:n.broadcastCalendar},e),R=nW(M,L,{broadcastCalendar:n.broadcastCalendar,fixedWeeks:n.fixedWeeks,ISOWeek:n.ISOWeek,reverseMonths:n.reverseMonths},e),I=sW(R),W=eW(R),_=aW(c,t,n,e),z=oW(c,i,n,e);return{months:R,weeks:I,days:W,previousMonth:_,nextMonth:z}},[e,c.getTime(),i?.getTime(),t?.getTime(),n.disableNavigation,n.broadcastCalendar,n.endMonth?.getTime(),n.fixedWeeks,n.ISOWeek,n.numberOfMonths,n.pagedNavigation,n.reverseMonths]),{disableNavigation:C,onMonthChange:k}=n,P=M=>m.some(L=>L.days.some(R=>R.isEqualTo(M))),D=M=>{if(C)return;let L=o(M);t&&L<o(t)&&(L=o(t)),i&&L>o(i)&&(L=o(i)),u(L),k?.(L)};return{months:f,weeks:m,days:g,navStart:t,navEnd:i,previousMonth:v,nextMonth:x,goToMonth:D,goToDay:M=>{P(M)||D(M.date)}}}var Ui;(function(n){n[n.Today=0]="Today",n[n.Selected=1]="Selected",n[n.LastFocused=2]="LastFocused",n[n.FocusedModifier=3]="FocusedModifier"})(Ui||(Ui={}));function EA(n){return!n[wt.disabled]&&!n[wt.hidden]&&!n[wt.outside]}function lW(n,e,t,i){let o,s=-1;for(const r of n){const c=e(r);EA(c)&&(c[wt.focused]&&s<Ui.FocusedModifier?(o=r,s=Ui.FocusedModifier):i?.isEqualTo(r)&&s<Ui.LastFocused?(o=r,s=Ui.LastFocused):t(r.date)&&s<Ui.Selected?(o=r,s=Ui.Selected):c[wt.today]&&s<Ui.Today&&(o=r,s=Ui.Today))}return o||(o=n.find(r=>EA(e(r)))),o}function cW(n,e,t,i,o,s,r){const{ISOWeek:c,broadcastCalendar:u}=s,{addDays:f,addMonths:m,addWeeks:g,addYears:v,endOfBroadcastWeek:x,endOfISOWeek:C,endOfWeek:k,max:P,min:D,startOfBroadcastWeek:O,startOfISOWeek:T,startOfWeek:M}=r;let R={day:f,week:g,month:m,year:v,startOfWeek:I=>u?O(I,r):c?T(I):M(I),endOfWeek:I=>u?x(I):c?C(I):k(I)}[n](t,e==="after"?1:-1);return e==="before"&&i?R=P([i,R]):e==="after"&&o&&(R=D([o,R])),R}function CR(n,e,t,i,o,s,r,c=0){if(c>365)return;const u=cW(n,e,t.date,i,o,s,r),f=!!(s.disabled&&Mo(u,s.disabled,r)),m=!!(s.hidden&&Mo(u,s.hidden,r)),g=u,v=new sR(u,g,r);return!f&&!m?v:CR(n,e,v,i,o,s,r,c+1)}function dW(n,e,t,i,o){const{autoFocus:s}=n,[r,c]=w.useState(),u=lW(e.days,t,i||(()=>!1),r),[f,m]=w.useState(s?u:void 0);return{isFocusTarget:k=>!!u?.isEqualTo(k),setFocused:m,focused:f,blur:()=>{c(f),m(void 0)},moveFocus:(k,P)=>{if(!f)return;const D=CR(k,P,f,e.navStart,e.navEnd,n,o);D&&(n.disableNavigation&&!e.days.some(T=>T.isEqualTo(D))||(e.goToDay(D),m(D)))}}}function uW(n,e){const{selected:t,required:i,onSelect:o}=n,[s,r]=Ef(t,o?t:void 0),c=o?t:s,{isSameDay:u}=e,f=x=>c?.some(C=>u(C,x))??!1,{min:m,max:g}=n;return{selected:c,select:(x,C,k)=>{let P=[...c??[]];if(f(x)){if(c?.length===m||i&&c?.length===1)return;P=c?.filter(D=>!u(D,x))}else c?.length===g?P=[x]:P=[...P,x];return o||r(P),o?.(P,x,C,k),P},isSelected:f}}function hW(n,e,t=0,i=0,o=!1,s=io){const{from:r,to:c}=e||{},{isSameDay:u,isAfter:f,isBefore:m}=s;let g;if(!r&&!c)g={from:n,to:t>0?void 0:n};else if(r&&!c)u(r,n)?t===0?g={from:r,to:n}:o?g={from:r,to:void 0}:g=void 0:m(n,r)?g={from:n,to:r}:g={from:r,to:n};else if(r&&c)if(u(r,n)&&u(c,n))o?g={from:r,to:c}:g=void 0;else if(u(r,n))g={from:r,to:t>0?void 0:n};else if(u(c,n))g={from:n,to:t>0?void 0:n};else if(m(n,r))g={from:n,to:c};else if(f(n,r))g={from:r,to:n};else if(f(n,c))g={from:r,to:n};else throw new Error("Invalid range");if(g?.from&&g?.to){const v=s.differenceInCalendarDays(g.to,g.from);i>0&&v>i?g={from:n,to:void 0}:t>1&&v<t&&(g={from:n,to:void 0})}return g}function fW(n,e,t=io){const i=Array.isArray(e)?e:[e];let o=n.from;const s=t.differenceInCalendarDays(n.to,n.from),r=Math.min(s,6);for(let c=0;c<=r;c++){if(i.includes(o.getDay()))return!0;o=t.addDays(o,1)}return!1}function IA(n,e,t=io){return To(n,e.from,!1,t)||To(n,e.to,!1,t)||To(e,n.from,!1,t)||To(e,n.to,!1,t)}function pW(n,e,t=io){const i=Array.isArray(e)?e:[e];if(i.filter(c=>typeof c!="function").some(c=>typeof c=="boolean"?c:t.isDate(c)?To(n,c,!1,t):cR(c,t)?c.some(u=>To(n,u,!1,t)):Nf(c)?c.from&&c.to?IA(n,{from:c.from,to:c.to},t):!1:lR(c)?fW(n,c.dayOfWeek,t):Xv(c)?t.isAfter(c.before,c.after)?IA(n,{from:t.addDays(c.after,1),to:t.addDays(c.before,-1)},t):Mo(n.from,c,t)||Mo(n.to,c,t):Jv(c)||Zv(c)?Mo(n.from,c,t)||Mo(n.to,c,t):!1))return!0;const r=i.filter(c=>typeof c=="function");if(r.length){let c=n.from;const u=t.differenceInCalendarDays(n.to,n.from);for(let f=0;f<=u;f++){if(r.some(m=>m(c)))return!0;c=t.addDays(c,1)}}return!1}function mW(n,e){const{disabled:t,excludeDisabled:i,selected:o,required:s,onSelect:r}=n,[c,u]=Ef(o,r?o:void 0),f=r?o:c;return{selected:f,select:(v,x,C)=>{const{min:k,max:P}=n,D=v?hW(v,f,k,P,s,e):void 0;return i&&t&&D?.from&&D.to&&pW({from:D.from,to:D.to},t,e)&&(D.from=v,D.to=void 0),r||u(D),r?.(D,v,x,C),D},isSelected:v=>f&&To(f,v,!1,e)}}function gW(n,e){const{selected:t,required:i,onSelect:o}=n,[s,r]=Ef(t,o?t:void 0),c=o?t:s,{isSameDay:u}=e;return{selected:c,select:(g,v,x)=>{let C=g;return!i&&c&&c&&u(g,c)&&(C=void 0),o||r(C),o?.(C,g,v,x),C},isSelected:g=>c?u(c,g):!1}}function yW(n,e){const t=gW(n,e),i=uW(n,e),o=mW(n,e);switch(n.mode){case"single":return t;case"multiple":return i;case"range":return o;default:return}}function an(n,e){return n instanceof Oo&&n.timeZone===e?n:new Oo(n,e)}function jA(n,e){return typeof n=="boolean"||typeof n=="function"?n:n instanceof Date?an(n,e):Array.isArray(n)?n.map(t=>t instanceof Date?an(t,e):t):Nf(n)?{...n,from:n.from?an(n.from,e):n.from,to:n.to?an(n.to,e):n.to}:Xv(n)?{before:an(n.before,e),after:an(n.after,e)}:Jv(n)?{after:an(n.after,e)}:Zv(n)?{before:an(n.before,e)}:n}function ty(n,e){return n&&(Array.isArray(n)?n.map(t=>jA(t,e)):jA(n,e))}function bW(n){let e=n;const t=e.timeZone;if(t&&(e={...n,timeZone:t},e.today&&(e.today=an(e.today,t)),e.month&&(e.month=an(e.month,t)),e.defaultMonth&&(e.defaultMonth=an(e.defaultMonth,t)),e.startMonth&&(e.startMonth=an(e.startMonth,t)),e.endMonth&&(e.endMonth=an(e.endMonth,t)),e.mode==="single"&&e.selected?e.selected=an(e.selected,t):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(Ne=>an(Ne,t)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?an(e.selected.from,t):e.selected.from,to:e.selected.to?an(e.selected.to,t):e.selected.to}),e.disabled!==void 0&&(e.disabled=ty(e.disabled,t)),e.hidden!==void 0&&(e.hidden=ty(e.hidden,t)),e.modifiers)){const Ne={};Object.keys(e.modifiers).forEach(Ke=>{Ne[Ke]=ty(e.modifiers?.[Ke],t)}),e.modifiers=Ne}const{components:i,formatters:o,labels:s,dateLib:r,locale:c,classNames:u}=w.useMemo(()=>{const Ne={...aR,...e.locale},Ke=new $n({locale:Ne,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib);return{dateLib:Ke,components:O8(e.components),formatters:U8(e.formatters),labels:G8(e.labels,Ke.options),locale:Ne,classNames:{...M8(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.components,e.formatters,e.labels,e.classNames]);e.today||(e={...e,today:r.today()});const{captionLayout:f,mode:m,navLayout:g,numberOfMonths:v=1,onDayBlur:x,onDayClick:C,onDayFocus:k,onDayKeyDown:P,onDayMouseEnter:D,onDayMouseLeave:O,onNextClick:T,onPrevClick:M,showWeekNumber:L,styles:R}=e,{formatCaption:I,formatDay:W,formatMonthDropdown:_,formatWeekNumber:z,formatWeekNumberHeader:$,formatWeekdayName:F,formatYearDropdown:B}=o,ie=rW(e,r),{days:oe,months:H,navStart:Z,navEnd:ae,previousMonth:Y,nextMonth:se,goToMonth:ue}=ie,be=A8(oe,e,Z,ae,r),{isSelected:te,select:le,selected:xe}=yW(e,r)??{},{blur:Se,focused:ye,isFocusTarget:Oe,moveFocus:Be,setFocused:nt}=dW(e,ie,be,te??(()=>!1),r),{labelDayButton:At,labelGridcell:Te,labelGrid:Ye,labelMonthDropdown:it,labelNav:ln,labelPrevious:Sn,labelNext:Aa,labelWeekday:zt,labelWeekNumber:Ho,labelWeekNumberHeader:Da,labelYearDropdown:mi}=s,Ps=w.useMemo(()=>W8(r,e.ISOWeek,e.broadcastCalendar,e.today),[r,e.ISOWeek,e.broadcastCalendar,e.today]),As=m!==void 0||C!==void 0,Xt=w.useCallback(()=>{Y&&(ue(Y),M?.(Y))},[Y,ue,M]),Xr=w.useCallback(()=>{se&&(ue(se),T?.(se))},[ue,se,T]),ad=w.useCallback((Ne,Ke)=>Me=>{Me.preventDefault(),Me.stopPropagation(),nt(Ne),!Ke.disabled&&(le?.(Ne.date,Ke,Me),C?.(Ne.date,Ke,Me))},[le,C,nt]),sd=w.useCallback((Ne,Ke)=>Me=>{nt(Ne),k?.(Ne.date,Ke,Me)},[k,nt]),Ds=w.useCallback((Ne,Ke)=>Me=>{Se(),x?.(Ne.date,Ke,Me)},[Se,x]),If=w.useCallback((Ne,Ke)=>Me=>{const $e={ArrowLeft:[Me.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[Me.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[Me.shiftKey?"year":"week","after"],ArrowUp:[Me.shiftKey?"year":"week","before"],PageUp:[Me.shiftKey?"year":"month","before"],PageDown:[Me.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if($e[Me.key]){Me.preventDefault(),Me.stopPropagation();const[Vt,Ue]=$e[Me.key];Be(Vt,Ue)}P?.(Ne.date,Ke,Me)},[Be,P,e.dir]),rd=w.useCallback((Ne,Ke)=>Me=>{D?.(Ne.date,Ke,Me)},[D]),jf=w.useCallback((Ne,Ke)=>Me=>{O?.(Ne.date,Ke,Me)},[O]),Bf=w.useCallback(Ne=>Ke=>{const Me=Number(Ke.target.value),$e=r.setMonth(r.startOfMonth(Ne),Me);ue($e)},[r,ue]),Oa=w.useCallback(Ne=>Ke=>{const Me=Number(Ke.target.value),$e=r.setYear(r.startOfMonth(Ne),Me);ue($e)},[r,ue]),{className:pn,style:Oi}=w.useMemo(()=>({className:[u[we.Root],e.className].filter(Boolean).join(" "),style:{...R?.[we.Root],...e.style}}),[u,e.className,e.style,R]),mn=T8(e),ld=w.useRef(null);J8(ld,!!e.animate,{classNames:u,months:H,focused:ye,dateLib:r});const Hf={dayPickerProps:e,selected:xe,select:le,isSelected:te,months:H,nextMonth:se,previousMonth:Y,goToMonth:ue,getModifiers:be,components:i,classNames:u,styles:R,labels:s,formatters:o};return ge.createElement(rR.Provider,{value:Hf},ge.createElement(i.Root,{rootRef:e.animate?ld:void 0,className:pn,style:Oi,dir:e.dir,id:e.id,lang:e.lang,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"],...mn},ge.createElement(i.Months,{className:u[we.Months],style:R?.[we.Months]},!e.hideNavigation&&!g&&ge.createElement(i.Nav,{"data-animated-nav":e.animate?"true":void 0,className:u[we.Nav],style:R?.[we.Nav],"aria-label":ln(),onPreviousClick:Xt,onNextClick:Xr,previousMonth:Y,nextMonth:se}),H.map((Ne,Ke)=>ge.createElement(i.Month,{"data-animated-month":e.animate?"true":void 0,className:u[we.Month],style:R?.[we.Month],key:Ke,displayIndex:Ke,calendarMonth:Ne},g==="around"&&!e.hideNavigation&&Ke===0&&ge.createElement(i.PreviousMonthButton,{type:"button",className:u[we.PreviousMonthButton],tabIndex:Y?void 0:-1,"aria-disabled":Y?void 0:!0,"aria-label":Sn(Y),onClick:Xt,"data-animated-button":e.animate?"true":void 0},ge.createElement(i.Chevron,{disabled:Y?void 0:!0,className:u[we.Chevron],orientation:e.dir==="rtl"?"right":"left"})),ge.createElement(i.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:u[we.MonthCaption],style:R?.[we.MonthCaption],calendarMonth:Ne,displayIndex:Ke},f?.startsWith("dropdown")?ge.createElement(i.DropdownNav,{className:u[we.Dropdowns],style:R?.[we.Dropdowns]},(()=>{const Me=f==="dropdown"||f==="dropdown-months"?ge.createElement(i.MonthsDropdown,{key:"month",className:u[we.MonthsDropdown],"aria-label":it(),classNames:u,components:i,disabled:!!e.disableNavigation,onChange:Bf(Ne.date),options:V8(Ne.date,Z,ae,o,r),style:R?.[we.Dropdown],value:r.getMonth(Ne.date)}):ge.createElement("span",{key:"month"},_(Ne.date,r)),$e=f==="dropdown"||f==="dropdown-years"?ge.createElement(i.YearsDropdown,{key:"year",className:u[we.YearsDropdown],"aria-label":mi(r.options),classNames:u,components:i,disabled:!!e.disableNavigation,onChange:Oa(Ne.date),options:Q8(Z,ae,o,r,!!e.reverseYears),style:R?.[we.Dropdown],value:r.getYear(Ne.date)}):ge.createElement("span",{key:"year"},B(Ne.date,r));return r.getMonthYearOrder()==="year-first"?[$e,Me]:[Me,$e]})(),ge.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},I(Ne.date,r.options,r))):ge.createElement(i.CaptionLabel,{className:u[we.CaptionLabel],role:"status","aria-live":"polite"},I(Ne.date,r.options,r))),g==="around"&&!e.hideNavigation&&Ke===v-1&&ge.createElement(i.NextMonthButton,{type:"button",className:u[we.NextMonthButton],tabIndex:se?void 0:-1,"aria-disabled":se?void 0:!0,"aria-label":Aa(se),onClick:Xr,"data-animated-button":e.animate?"true":void 0},ge.createElement(i.Chevron,{disabled:se?void 0:!0,className:u[we.Chevron],orientation:e.dir==="rtl"?"left":"right"})),Ke===v-1&&g==="after"&&!e.hideNavigation&&ge.createElement(i.Nav,{"data-animated-nav":e.animate?"true":void 0,className:u[we.Nav],style:R?.[we.Nav],"aria-label":ln(),onPreviousClick:Xt,onNextClick:Xr,previousMonth:Y,nextMonth:se}),ge.createElement(i.MonthGrid,{role:"grid","aria-multiselectable":m==="multiple"||m==="range","aria-label":Ye(Ne.date,r.options,r)||void 0,className:u[we.MonthGrid],style:R?.[we.MonthGrid]},!e.hideWeekdays&&ge.createElement(i.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:u[we.Weekdays],style:R?.[we.Weekdays]},L&&ge.createElement(i.WeekNumberHeader,{"aria-label":Da(r.options),className:u[we.WeekNumberHeader],style:R?.[we.WeekNumberHeader],scope:"col"},$()),Ps.map(Me=>ge.createElement(i.Weekday,{"aria-label":zt(Me,r.options,r),className:u[we.Weekday],key:String(Me),style:R?.[we.Weekday],scope:"col"},F(Me,r.options,r)))),ge.createElement(i.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:u[we.Weeks],style:R?.[we.Weeks]},Ne.weeks.map(Me=>ge.createElement(i.Week,{className:u[we.Week],key:Me.weekNumber,style:R?.[we.Week],week:Me},L&&ge.createElement(i.WeekNumber,{week:Me,style:R?.[we.WeekNumber],"aria-label":Ho(Me.weekNumber,{locale:c}),className:u[we.WeekNumber],scope:"row",role:"rowheader"},z(Me.weekNumber,r)),Me.days.map($e=>{const{date:Vt}=$e,Ue=be($e);if(Ue[wt.focused]=!Ue.hidden&&!!ye?.isEqualTo($e),Ue[Si.selected]=te?.(Vt)||Ue.selected,Nf(xe)){const{from:Ma,to:oo}=xe;Ue[Si.range_start]=!!(Ma&&oo&&r.isSameDay(Vt,Ma)),Ue[Si.range_end]=!!(Ma&&oo&&r.isSameDay(Vt,oo)),Ue[Si.range_middle]=To(xe,Vt,!0,r)}const Ta=K8(Ue,R,e.modifiersStyles),Uf=D8(Ue,u,e.modifiersClassNames),cd=!As&&!Ue.hidden?Te(Vt,Ue,r.options,r):void 0;return ge.createElement(i.Day,{key:`${$e.isoDate}_${$e.displayMonthId}`,day:$e,modifiers:Ue,className:Uf.join(" "),style:Ta,role:"gridcell","aria-selected":Ue.selected||void 0,"aria-label":cd,"data-day":$e.isoDate,"data-month":$e.outside?$e.dateMonthId:void 0,"data-selected":Ue.selected||void 0,"data-disabled":Ue.disabled||void 0,"data-hidden":Ue.hidden||void 0,"data-outside":$e.outside||void 0,"data-focused":Ue.focused||void 0,"data-today":Ue.today||void 0},!Ue.hidden&&As?ge.createElement(i.DayButton,{className:u[we.DayButton],style:R?.[we.DayButton],type:"button",day:$e,modifiers:Ue,disabled:!Ue.focused&&Ue.disabled||void 0,"aria-disabled":Ue.focused&&Ue.disabled||void 0,tabIndex:Oe($e)?0:-1,"aria-label":At(Vt,Ue,r.options,r),onClick:ad($e,Ue),onBlur:Ds($e,Ue),onFocus:sd($e,Ue),onKeyDown:If($e,Ue),onMouseEnter:rd($e,Ue),onMouseLeave:jf($e,Ue)},W(Vt,r.options,r)):!Ue.hidden&&W($e.date,r.options,r))})))))))),e.footer&&ge.createElement(i.Footer,{className:u[we.Footer],style:R?.[we.Footer],role:"status","aria-live":"polite"},e.footer)))}function vW({className:n,classNames:e,showOutsideDays:t=!0,...i}){return p.jsx(bW,{showOutsideDays:t,className:q("p-2",n),classNames:{root:"relative",months:"flex flex-col sm:flex-row gap-2 sm:gap-4",month:"flex flex-col gap-2",month_caption:"flex justify-center pt-1 relative items-center h-8",caption_label:"text-sm font-medium",nav:"absolute inset-x-0 top-2 flex items-center justify-between px-1 z-10",button_previous:q(Ju({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),button_next:q(Ju({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),month_grid:"w-full border-collapse",weekdays:"flex w-full",weekday:"text-muted-foreground w-8 font-normal text-xs text-center",weeks:"flex flex-col",week:"flex w-full",day:q("relative h-8 w-8 p-0 text-center text-xs font-normal focus-within:relative focus-within:z-20","hover:bg-accent hover:text-accent-foreground rounded-full select-none"),day_button:q(Ju({variant:"ghost"}),"h-8 w-8 p-0 font-normal rounded-full text-xs","aria-selected:opacity-100"),range_start:q("aria-selected:bg-primary aria-selected:text-primary-foreground","aria-selected:rounded-l-full aria-selected:rounded-r-none","aria-selected:hover:bg-primary aria-selected:hover:text-primary-foreground"),range_end:q("aria-selected:bg-primary aria-selected:text-primary-foreground","aria-selected:rounded-r-full aria-selected:rounded-l-none","aria-selected:hover:bg-primary aria-selected:hover:text-primary-foreground"),range_middle:q("aria-selected:bg-accent aria-selected:text-accent-foreground","aria-selected:rounded-none"),selected:q("bg-primary text-primary-foreground rounded-full","hover:bg-primary hover:text-primary-foreground","focus:bg-primary focus:text-primary-foreground"),today:"bg-accent text-accent-foreground rounded-full",outside:"text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",disabled:"text-muted-foreground opacity-50",hidden:"invisible",...e},components:{Chevron:({orientation:o,className:s,...r})=>{const c=o==="left"?eI:o==="right"?Wh:o==="up"?Cb:Qh;return p.jsx(c,{className:q("h-4 w-4",s),...r})}},...i})}vW.displayName="Calendar";const xW=w.lazy(()=>lt(()=>Promise.resolve().then(()=>Lf),void 0).then(n=>({default:n.CodeEditor})));function mQ({rawJsonContent:n,isRawJsonValid:e,rawJsonEdits:t,rawSettingsEnv:i,onChange:o,missingRequiredFields:s=[]}){const{t:r}=ve(),c=s.length>0;return p.jsx(w.Suspense,{fallback:p.jsxs("div",{className:"flex items-center justify-center h-full",children:[p.jsx(hi,{className:"w-6 h-6 animate-spin text-muted-foreground"}),p.jsx("span",{className:"ml-2 text-muted-foreground",children:r("providerEditor.loadingEditor")})]}),children:p.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!e&&t!==null&&p.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[p.jsx(Vr,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),e&&c&&p.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[p.jsx(wi,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",p.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:s.join(", ")}),p.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"These fields will use default values at runtime."})]})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:p.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:p.jsx(xW,{value:n,onChange:o,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),p.jsx("div",{className:"mx-6 mb-4",children:p.jsx("div",{className:"border rounded-md overflow-hidden",children:p.jsx(Zb,{profileEnv:i})})})]})})}w.lazy(()=>lt(()=>Promise.resolve().then(()=>Lf),void 0).then(n=>({default:n.CodeEditor})));function CW(){const{t:n}=ve(),{isDark:e,setTheme:t}=Lb(),[i,o]=w.useState(""),[s,r]=w.useState(""),[c,u]=w.useState(!1),[f,m]=w.useState(null),[g,v]=w.useState(!1),{login:x,authRequired:C,isAuthenticated:k,loading:P,accessMode:D,authEnabled:O}=Zh(),T=vb(),M=Kh(),L=D==="setup",R=n(L?"auth.remoteGuardLabel":"auth.protectedAccessLabel"),I=n(L?O?"auth.incompleteSetupDescription":"auth.remoteSetupDescription":"auth.loginDescription"),W=M.state?.from?.pathname||"/";if(w.useEffect(()=>{P||(k||!C)&&T(W,{replace:!0})},[k,C,P,T,W]),P)return p.jsx("div",{className:"flex min-h-[100dvh] items-center justify-center bg-background px-4",children:p.jsxs("div",{className:"flex items-center gap-3 rounded-full border border-border/80 bg-card/90 px-5 py-3 text-sm text-muted-foreground shadow-sm",children:[p.jsx(hi,{className:"h-4 w-4 animate-spin"}),n("auth.loading")]})});if(k||!C)return null;const _=async z=>{z.preventDefault(),m(null),v(!0);try{await x(i,s),T(W,{replace:!0})}catch($){m($ instanceof Error?$.message:n("auth.loginFailed"))}finally{v(!1)}};return p.jsxs("div",{className:"relative min-h-[100dvh] overflow-hidden bg-background",children:[p.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_top_left,rgba(167,85,52,0.16),transparent_42%),radial-gradient(circle_at_bottom_right,rgba(39,39,42,0.12),transparent_48%)]"}),p.jsx("div",{className:"absolute inset-0 opacity-[0.18] [background-image:linear-gradient(rgba(127,117,107,0.14)_1px,transparent_1px),linear-gradient(90deg,rgba(127,117,107,0.14)_1px,transparent_1px)] [background-size:24px_24px]"}),p.jsx("div",{className:"relative mx-auto flex min-h-[100dvh] max-w-6xl items-center px-4 py-8 sm:px-6",children:p.jsxs("div",{className:"grid w-full items-stretch gap-6 lg:grid-cols-[minmax(0,1.05fr)_minmax(360px,430px)]",children:[p.jsxs("section",{className:"flex flex-col justify-between rounded-[28px] border border-border/70 bg-card/85 p-6 shadow-[0_24px_80px_-48px_rgba(68,48,34,0.55)] backdrop-blur sm:p-8",children:[p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[p.jsxs("span",{className:"inline-flex w-fit items-center gap-2 rounded-full border border-border/70 bg-background/75 px-3 py-1 text-xs font-semibold uppercase tracking-[0.24em] text-muted-foreground",children:[p.jsx(Su,{className:"h-3.5 w-3.5 text-accent"}),R]}),p.jsxs("div",{className:"inline-flex items-center gap-1 rounded-full border border-border/70 bg-background/75 p-1 shadow-sm backdrop-blur",children:[p.jsxs(ft,{type:"button",variant:"ghost",size:"sm",className:q("rounded-full px-3 text-xs font-semibold",!e&&"bg-card text-foreground shadow-sm"),"aria-pressed":!e,onClick:()=>t("light"),children:[p.jsx(u1,{className:"h-3.5 w-3.5"}),n("auth.lightMode")]}),p.jsxs(ft,{type:"button",variant:"ghost",size:"sm",className:q("rounded-full px-3 text-xs font-semibold",e&&"bg-card text-foreground shadow-sm"),"aria-pressed":e,onClick:()=>t("dark"),children:[p.jsx(h1,{className:"h-3.5 w-3.5"}),n("auth.darkMode")]})]})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsx("h1",{className:"max-w-xl text-4xl font-semibold tracking-[-0.04em] text-balance text-foreground sm:text-5xl",children:n(L?"auth.remoteSetupTitle":"auth.dashboardTitle")}),p.jsx("p",{className:"max-w-2xl text-base leading-7 text-muted-foreground sm:text-lg",children:I})]})]}),p.jsxs("div",{className:"mt-8 grid gap-3 text-sm text-muted-foreground sm:grid-cols-3",children:[p.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[p.jsx(nk,{className:"mb-3 h-4 w-4 text-accent"}),p.jsx("p",{children:n("auth.safetyNoteRemote")})]}),p.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[p.jsx(ik,{className:"mb-3 h-4 w-4 text-accent"}),p.jsx("p",{children:n("auth.safetyNoteLocal")})]}),p.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[p.jsx(Su,{className:"mb-3 h-4 w-4 text-accent"}),p.jsx("p",{children:n("auth.safetyNoteSession")})]})]})]}),p.jsxs(L_,{className:"justify-center rounded-[28px] border-border/70 bg-card/95 py-0 shadow-[0_24px_90px_-54px_rgba(34,24,16,0.62)]",children:[p.jsxs(N_,{className:"space-y-3 border-b border-border/70 px-6 py-6",children:[p.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-2xl border border-accent/20 bg-accent/10",children:L?p.jsx(nk,{className:"h-5 w-5 text-accent"}):p.jsx(ik,{className:"h-5 w-5 text-accent"})}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(E_,{className:"text-2xl tracking-[-0.03em]",children:n(L?"auth.remoteSetupTitle":"auth.dashboardTitle")}),p.jsx(I_,{className:"text-sm leading-6 text-muted-foreground",children:L?I:n("auth.credentialsHint")})]})]}),p.jsx(j_,{className:"space-y-5 px-6 py-6",children:L?p.jsxs(p.Fragment,{children:[p.jsxs(lc,{variant:"warning",className:"rounded-2xl border-yellow-300/70 bg-yellow-50/80",children:[p.jsx(Cc,{className:"h-4 w-4"}),p.jsx(bh,{children:n("auth.noDefaultCredentials")}),p.jsx(cc,{children:n("auth.credentialsHint")})]}),p.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[p.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/75 p-4",children:[p.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[p.jsx(tI,{className:"h-4 w-4 text-accent"}),n("auth.hostStepTitle")]}),p.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:n("auth.hostStepDescription")}),p.jsx("code",{className:"mt-4 block rounded-xl border border-border/70 bg-muted/60 px-3 py-2 font-mono text-[13px] text-foreground",children:"ccs config auth setup"}),p.jsx("p",{className:"mt-3 text-xs leading-5 text-muted-foreground",children:n("auth.dockerStepDescription")}),p.jsx("code",{className:"mt-2 block rounded-xl border border-border/70 bg-muted/60 px-3 py-2 font-mono text-[13px] text-foreground",children:"docker exec -it ccs-cliproxy ccs config auth setup"})]}),p.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/75 p-4",children:[p.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[p.jsx(Su,{className:"h-4 w-4 text-accent"}),n("auth.localStepTitle")]}),p.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:n("auth.localStepDescription")})]})]})]}):p.jsxs("form",{onSubmit:_,className:"space-y-4",children:[f&&p.jsxs(lc,{variant:"destructive",className:"rounded-2xl",children:[p.jsx(Cc,{className:"h-4 w-4"}),p.jsx(cc,{children:f})]}),p.jsxs(lc,{variant:"info",className:"rounded-2xl border-blue-200/80 bg-blue-50/80",children:[p.jsx(Su,{className:"h-4 w-4"}),p.jsx(bh,{children:n("auth.noDefaultCredentials")}),p.jsx(cc,{children:n("auth.credentialsHint")})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{htmlFor:"username",className:"text-sm font-semibold",children:n("auth.username")}),p.jsx(Hi,{id:"username",type:"text",value:i,onChange:z=>o(z.target.value),placeholder:n("auth.usernamePlaceholder"),autoComplete:"username",className:"h-12 rounded-2xl border-border/80 bg-background/85 px-4 text-base md:text-base",disabled:g,required:!0})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{htmlFor:"password",className:"text-sm font-semibold",children:n("auth.password")}),p.jsxs("div",{className:"relative",children:[p.jsx(Hi,{id:"password",type:c?"text":"password",value:s,onChange:z=>r(z.target.value),placeholder:n("auth.passwordPlaceholder"),autoComplete:"current-password",className:"h-12 rounded-2xl border-border/80 bg-background/85 px-4 pr-14 text-base md:text-base",disabled:g,required:!0}),p.jsx(ft,{type:"button",variant:"ghost",size:"sm",className:"absolute inset-y-1 right-1 h-auto rounded-xl px-3 text-muted-foreground hover:text-foreground","aria-label":n(c?"auth.hidePassword":"auth.showPassword"),"aria-pressed":c,onClick:()=>u(z=>!z),disabled:g,children:c?p.jsx(Kc,{className:"h-4 w-4"}):p.jsx(Wc,{className:"h-4 w-4"})})]})]}),p.jsx(ft,{type:"submit",className:"h-12 w-full rounded-2xl text-sm font-semibold",disabled:g,children:g?p.jsxs(p.Fragment,{children:[p.jsx(hi,{className:"mr-2 h-4 w-4 animate-spin"}),n("auth.signingIn")]}):n("auth.signIn")})]})})]})]})})]})}const SW=w.lazy(()=>lt(()=>import("./index-CoMpJo_n.js"),__vite__mapDeps([24,1,2,4,5,25,6,7,9,8])).then(n=>({default:n.AnalyticsPage}))),kW=w.lazy(()=>lt(()=>import("./api-C3LysQ5X.js"),__vite__mapDeps([26,1,2,5,27,19,6,4,3,7,8,9])).then(n=>({default:n.ApiPage}))),wW=w.lazy(()=>lt(()=>import("./cliproxy-fvgNUwXr.js"),__vite__mapDeps([28,1,2,5,17,6,4,21,29,27,19,30,31,18,20,7,8,9])).then(n=>({default:n.CliproxyPage}))),PW=w.lazy(()=>lt(()=>import("./cliproxy-ai-providers-CGEN2_tw.js"),__vite__mapDeps([32,1,2,18,19,5,6,4,20,27,7,8,9])).then(n=>({default:n.CliproxyAiProvidersPage}))),AW=w.lazy(()=>lt(()=>import("./cliproxy-control-panel-BLkpXPri.js"),__vite__mapDeps([33,1,2,5,17,4,6,7,8,9])).then(n=>({default:n.CliproxyControlPanelPage}))),DW=w.lazy(()=>lt(()=>import("./copilot-CWPqu-HF.js"),__vite__mapDeps([34,1,2,5,27,19,4,30,31,6,7,8,9])).then(n=>({default:n.CopilotPage}))),OW=w.lazy(()=>lt(()=>import("./cursor-ULjTPFiL.js"),__vite__mapDeps([35,1,2,6,5,17,30,31,4,7,8,9])).then(n=>({default:n.CursorPage}))),TW=w.lazy(()=>lt(()=>import("./claude-extension-B1nt1ulT.js"),__vite__mapDeps([36,1,2,5,6,4,7,8,9])).then(n=>({default:n.ClaudeExtensionPage}))),MW=w.lazy(()=>lt(()=>import("./codex-CQSjWlPZ.js"),__vite__mapDeps([37,1,2,6,38,5,4,20,30,39,7,8,9])).then(n=>({default:n.CodexPage}))),RW=w.lazy(()=>lt(()=>import("./droid-CYomszN0.js"),__vite__mapDeps([40,1,2,6,5,39,4,30,7,8,9])).then(n=>({default:n.DroidPage}))),LW=w.lazy(()=>lt(()=>import("./logs-vWuOwwU1.js"),__vite__mapDeps([41,1,2,4,5,6,7,8,9])).then(n=>({default:n.LogsPage}))),NW=w.lazy(()=>lt(()=>import("./accounts-dagN4ycI.js"),__vite__mapDeps([42,1,2,5,38,19,25,6,4,29,7,8,9])).then(n=>({default:n.AccountsPage}))),EW=w.lazy(()=>lt(()=>Promise.resolve().then(()=>qK),void 0).then(n=>({default:n.SettingsPage}))),IW=w.lazy(()=>lt(()=>import("./health-DbBL3q3w.js"),__vite__mapDeps([43,1,2,5,6,4,11,7,8,9])).then(n=>({default:n.HealthPage}))),jW=w.lazy(()=>lt(()=>import("./shared-BZjxvNAq.js"),__vite__mapDeps([44,1,2,25,5,6,4,7,8,9])).then(n=>({default:n.SharedPage}))),BW=w.lazy(()=>lt(()=>import("./updates-DRQ9v7zh.js"),__vite__mapDeps([45,1,2,4,5,6,7,8,9])).then(n=>({default:n.UpdatesPage}))),HW=null;function cn(){return p.jsx("div",{className:"flex h-64 items-center justify-center",children:p.jsx(hi,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}function UW(){return p.jsx(vE,{client:$I,children:p.jsx(G2,{defaultTheme:"system",storageKey:"vite-ui-theme",children:p.jsx(V2,{children:p.jsx($2,{children:p.jsxs(mE,{children:[p.jsxs(gE,{children:[p.jsx(It,{path:"/login",element:p.jsx(CW,{})}),p.jsx(It,{element:p.jsx(X2,{}),children:p.jsxs(It,{element:p.jsx(p5,{}),children:[p.jsx(It,{path:"/",element:p.jsx(HU,{})}),p.jsx(It,{path:"/analytics",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(SW,{})})}),p.jsx(It,{path:"/updates",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(BW,{})})}),p.jsx(It,{path:"/providers",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(kW,{})})}),p.jsx(It,{path:"/cliproxy",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(wW,{})})}),p.jsx(It,{path:"/cliproxy/ai-providers",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(PW,{})})}),p.jsx(It,{path:"/cliproxy/control-panel",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(AW,{})})}),p.jsx(It,{path:"/copilot",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(DW,{})})}),p.jsx(It,{path:"/cursor",element:p.jsx(o1,{to:"/cliproxy?provider=cursor",replace:!0})}),p.jsx(It,{path:"/legacy/cursor",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(OW,{})})}),p.jsx(It,{path:"/claude-extension",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(TW,{})})}),p.jsx(It,{path:"/codex",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(MW,{})})}),p.jsx(It,{path:"/droid",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(RW,{})})}),p.jsx(It,{path:"/accounts",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(NW,{})})}),p.jsx(It,{path:"/settings",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(EW,{})})}),p.jsx(It,{path:"/health",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(IW,{})})}),p.jsx(It,{path:"/logs",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(LW,{})})}),p.jsx(It,{path:"/shared",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(jW,{})})}),HW]})})]}),p.jsx(xE,{position:"top-right"})]})})})})})}const SR=document.getElementById("root");if(!SR)throw new Error("Root element not found. Failed to mount React application.");WI.createRoot(SR).render(p.jsx(w.StrictMode,{children:p.jsx(UW,{})}));export{V9 as $,ZU as A,Qt as B,L_ as C,G9 as D,qU as E,YU as F,z9 as G,q9 as H,Hi as I,_U as J,WU as K,yn as L,$U as M,F9 as N,tB as O,ji as P,nB as Q,iB as R,tt as S,ms as T,TD as U,Xb as V,vh as W,gy as X,re as Y,K9 as Z,je as _,ve as a,c9 as a$,I_ as a0,Q9 as a1,Y9 as a2,$9 as a3,X9 as a4,J9 as a5,Z9 as a6,LD as a7,eQ as a8,__ as a9,B9 as aA,iQ as aB,oQ as aC,nQ as aD,e_ as aE,kB as aF,M9 as aG,Ek as aH,h_ as aI,tQ as aJ,UD as aK,cH as aL,PH as aM,e5 as aN,t5 as aO,n5 as aP,i5 as aQ,Y5 as aR,Y1 as aS,p9 as aT,m9 as aU,g9 as aV,y9 as aW,dQ as aX,JW as aY,eB as aZ,l9 as a_,qb as aa,Gb as ab,YW as ac,Yj as ad,ZW as ae,s9 as af,u9 as ag,h9 as ah,Nb as ai,Eb as aj,Ib as ak,jb as al,Bb as am,aQ as an,F_ as ao,sQ as ap,ks as aq,N9 as ar,Jl as as,E9 as at,dy as au,f9 as av,I9 as aw,j9 as ax,H9 as ay,Ik as az,j_ as b,$j as b0,Xj as b1,d9 as b2,Jj as b3,Zj as b4,r9 as b5,_b as b6,L9 as b7,P9 as b8,D9 as b9,UK as bA,C9 as bB,b9 as bC,EB as bD,IB as bE,R9 as bF,o9 as bG,a9 as bH,S9 as bI,e9 as bJ,t9 as bK,n9 as bL,i9 as bM,v9 as bN,x9 as bO,w9 as bP,k9 as bQ,w1 as bR,T2 as bS,D2 as bT,ay as bU,fs as bV,v2 as bW,C2 as bX,P2 as bY,R2 as bZ,Ju as b_,O9 as ba,A9 as bb,ZM as bc,Zb as bd,T9 as be,Xl as bf,$W as bg,XW as bh,lc as bi,bh as bj,cc as bk,mQ as bl,Yb as bm,kc as bn,$b as bo,MU as bp,bj as bq,Cj as br,Sj as bs,kj as bt,wj as bu,IU as bv,U9 as bw,_9 as bx,tR as by,BK as bz,q as c,W9 as d,ft as e,rQ as f,lQ as g,q_ as h,vW as i,q1 as j,zb as k,G1 as l,Fb as m,rc as n,$i as o,Xi as p,Ji as q,QW as r,N_ as s,E_ as t,Pb as u,Q1 as v,J5 as w,Kr as x,cQ as y,aw as z};