@tom2012/cc-web 2026.4.19-r → 2026.4.19-t

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 (61) hide show
  1. package/README.md +1 -1
  2. package/backend/dist/adapters/claude-adapter.d.ts +1 -1
  3. package/backend/dist/adapters/claude-adapter.d.ts.map +1 -1
  4. package/backend/dist/adapters/claude-adapter.js +62 -10
  5. package/backend/dist/adapters/claude-adapter.js.map +1 -1
  6. package/backend/dist/adapters/types.d.ts +1 -1
  7. package/backend/dist/adapters/types.d.ts.map +1 -1
  8. package/backend/dist/index.d.ts.map +1 -1
  9. package/backend/dist/index.js +4 -22
  10. package/backend/dist/index.js.map +1 -1
  11. package/backend/dist/routes/claude.d.ts.map +1 -1
  12. package/backend/dist/routes/claude.js +23 -1
  13. package/backend/dist/routes/claude.js.map +1 -1
  14. package/backend/dist/routes/projects.d.ts.map +1 -1
  15. package/backend/dist/routes/projects.js +26 -6
  16. package/backend/dist/routes/projects.js.map +1 -1
  17. package/backend/dist/routes/sync.d.ts +3 -0
  18. package/backend/dist/routes/sync.d.ts.map +1 -0
  19. package/backend/dist/routes/sync.js +183 -0
  20. package/backend/dist/routes/sync.js.map +1 -0
  21. package/backend/dist/sync-config.d.ts +62 -0
  22. package/backend/dist/sync-config.d.ts.map +1 -0
  23. package/backend/dist/sync-config.js +207 -0
  24. package/backend/dist/sync-config.js.map +1 -0
  25. package/backend/dist/sync-scheduler.d.ts +7 -0
  26. package/backend/dist/sync-scheduler.d.ts.map +1 -0
  27. package/backend/dist/sync-scheduler.js +157 -0
  28. package/backend/dist/sync-scheduler.js.map +1 -0
  29. package/backend/dist/sync-service.d.ts +51 -0
  30. package/backend/dist/sync-service.d.ts.map +1 -0
  31. package/backend/dist/sync-service.js +344 -0
  32. package/backend/dist/sync-service.js.map +1 -0
  33. package/backend/dist/user-prefs.d.ts +3 -0
  34. package/backend/dist/user-prefs.d.ts.map +1 -0
  35. package/backend/dist/user-prefs.js +87 -0
  36. package/backend/dist/user-prefs.js.map +1 -0
  37. package/frontend/dist/assets/AssistantMessageContent-D1-3VpWE.js +13 -0
  38. package/frontend/dist/assets/GraphPreview-CeI4sbtV.js +8 -0
  39. package/frontend/dist/assets/MobilePage-BP7c3W3D.js +14 -0
  40. package/frontend/dist/assets/{OfficePreview-CLGxDBuB.js → OfficePreview-Dgs4aiYi.js} +2 -2
  41. package/frontend/dist/assets/{ProjectPage-Bpj8XUcg.js → ProjectPage-DPv57nD9.js} +5 -6
  42. package/frontend/dist/assets/SettingsPage-CFSmKovg.js +13 -0
  43. package/frontend/dist/assets/{SkillHubPage-BWkab_k8.js → SkillHubPage-4g29B-Hr.js} +2 -2
  44. package/frontend/dist/assets/{chevron-down-Bn3Wxb1A.js → chevron-down-CyDTNuVw.js} +1 -1
  45. package/frontend/dist/assets/{chevron-up-DjQ2Kt99.js → chevron-up-BURz786o.js} +1 -1
  46. package/frontend/dist/assets/{index-nuXK9Vzi.js → index-BFWZX3Hz.js} +6 -6
  47. package/frontend/dist/assets/index-D0NB3R9q.css +1 -0
  48. package/frontend/dist/assets/index-Uy-V98k3.js +13 -0
  49. package/frontend/dist/assets/{index-BpQn0KbO.js → index-z4qRGojt.js} +1 -1
  50. package/frontend/dist/assets/{jszip.min-k094Tbts.js → jszip.min-CPG_u-b-.js} +1 -1
  51. package/frontend/dist/assets/{search-DlCQSCBu.js → search-CZ83atP-.js} +1 -1
  52. package/frontend/dist/index.html +2 -2
  53. package/package.json +1 -1
  54. package/frontend/dist/assets/AssistantMessageContent-BXGoUnPl.js +0 -13
  55. package/frontend/dist/assets/GraphPreview-Ca22U4BP.js +0 -2
  56. package/frontend/dist/assets/MobilePage-CIUktKA8.js +0 -14
  57. package/frontend/dist/assets/PlanPanel-TLlCo5cs.js +0 -13
  58. package/frontend/dist/assets/SettingsPage-Cy00qya-.js +0 -13
  59. package/frontend/dist/assets/index-CYLf1vI2.js +0 -7
  60. package/frontend/dist/assets/index-b8oVHVON.css +0 -1
  61. package/frontend/dist/assets/maximize-2-C1mkwgJj.js +0 -7
@@ -1,2 +0,0 @@
1
- import{r as e,b as t,j as n,al as i,B as r,n as o}from"./index-nuXK9Vzi.js";import{Z as a,a as s}from"./ProjectPage-Bpj8XUcg.js";import{M as l}from"./maximize-2-C1mkwgJj.js";import"./purify.es-CgRAQgUo.js";import"./AssistantMessageContent-BXGoUnPl.js";import"./chevron-down-Bn3Wxb1A.js";import"./chevron-up-DjQ2Kt99.js";import"./index-CYLf1vI2.js";import"./search-DlCQSCBu.js";
2
- /*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function c(e){return null==e}var u={isNothing:c,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:c(e)?[]:[e]},repeat:function(e,t){var n,i="";for(n=0;n<t;n+=1)i+=e;return i},isNegativeZero:function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},extend:function(e,t){var n,i,r,o;if(t)for(n=0,i=(o=Object.keys(t)).length;n<i;n+=1)e[r=o[n]]=t[r];return e}};function p(e,t){var n="",i=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+="\n\n"+e.mark.snippet),i+" "+n):i}function f(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=p(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,f.prototype.toString=function(e){return this.name+": "+p(this,e)};var d=f;function h(e,t,n,i,r){var o="",a="",s=Math.floor(r/2)-1;return i-t>s&&(t=i-s+(o=" ... ").length),n-i>s&&(n=i+s-(a=" ...").length),{str:o+e.slice(t,n).replace(/\t/g,"→")+a,pos:i-t+o.length}}function m(e,t){return u.repeat(" ",t-e.length)+e}var g=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,i=/\r?\n|\r|\0/g,r=[0],o=[],a=-1;n=i.exec(e.buffer);)o.push(n.index),r.push(n.index+n[0].length),e.position<=n.index&&a<0&&(a=r.length-2);a<0&&(a=r.length-1);var s,l,c="",p=Math.min(e.line+t.linesAfter,o.length).toString().length,f=t.maxLength-(t.indent+p+3);for(s=1;s<=t.linesBefore&&!(a-s<0);s++)l=h(e.buffer,r[a-s],o[a-s],e.position-(r[a]-r[a-s]),f),c=u.repeat(" ",t.indent)+m((e.line-s+1).toString(),p)+" | "+l.str+"\n"+c;for(l=h(e.buffer,r[a],o[a],e.position,f),c+=u.repeat(" ",t.indent)+m((e.line+1).toString(),p)+" | "+l.str+"\n",c+=u.repeat("-",t.indent+p+3+l.pos)+"^\n",s=1;s<=t.linesAfter&&!(a+s>=o.length);s++)l=h(e.buffer,r[a+s],o[a+s],e.position-(r[a]-r[a+s]),f),c+=u.repeat(" ",t.indent)+m((e.line+s+1).toString(),p)+" | "+l.str+"\n";return c.replace(/\n$/,"")},b=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],y=["scalar","sequence","mapping"];var x=function(e,t){var n,i;if(t=t||{},Object.keys(t).forEach(function(t){if(-1===b.indexOf(t))throw new d('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=(n=t.styleAliases||null,i={},null!==n&&Object.keys(n).forEach(function(e){n[e].forEach(function(t){i[String(t)]=e})}),i),-1===y.indexOf(this.kind))throw new d('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function A(e,t){var n=[];return e[t].forEach(function(e){var t=n.length;n.forEach(function(n,i){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=i)}),n[t]=e}),n}function v(e){return this.extend(e)}v.prototype.extend=function(e){var t=[],n=[];if(e instanceof x)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new d("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach(function(e){if(!(e instanceof x))throw new d("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new d("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new d("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(e){if(!(e instanceof x))throw new d("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(v.prototype);return i.implicit=(this.implicit||[]).concat(t),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=A(i,"implicit"),i.compiledExplicit=A(i,"explicit"),i.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function i(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(i);return n}(i.compiledImplicit,i.compiledExplicit),i};var k=new v({explicit:[new x("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}}),new x("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}}),new x("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})]});var w=new x("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});var C=new x("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function j(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function I(e){return 48<=e&&e<=55}function N(e){return 48<=e&&e<=57}var S=new x("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n=e.length,i=0,r=!1;if(!n)return!1;if("-"!==(t=e[i])&&"+"!==t||(t=e[++i]),"0"===t){if(i+1===n)return!0;if("b"===(t=e[++i])){for(i++;i<n;i++)if("_"!==(t=e[i])){if("0"!==t&&"1"!==t)return!1;r=!0}return r&&"_"!==t}if("x"===t){for(i++;i<n;i++)if("_"!==(t=e[i])){if(!j(e.charCodeAt(i)))return!1;r=!0}return r&&"_"!==t}if("o"===t){for(i++;i<n;i++)if("_"!==(t=e[i])){if(!I(e.charCodeAt(i)))return!1;r=!0}return r&&"_"!==t}}if("_"===t)return!1;for(;i<n;i++)if("_"!==(t=e[i])){if(!N(e.charCodeAt(i)))return!1;r=!0}return!(!r||"_"===t)},construct:function(e){var t,n=e,i=1;if(-1!==n.indexOf("_")&&(n=n.replace(/_/g,"")),"-"!==(t=n[0])&&"+"!==t||("-"===t&&(i=-1),t=(n=n.slice(1))[0]),"0"===n)return 0;if("0"===t){if("b"===n[1])return i*parseInt(n.slice(2),2);if("x"===n[1])return i*parseInt(n.slice(2),16);if("o"===n[1])return i*parseInt(n.slice(2),8)}return i*parseInt(n,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e%1==0&&!u.isNegativeZero(e)},represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),M=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var O=/^[-+]?[0-9]+e/;var T=new x("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!M.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||u.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(u.isNegativeZero(e))return"-0.0";return n=e.toString(10),O.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),E=k.extend({implicit:[w,C,S,T]}),L=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),F=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var _=new x("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==L.exec(e)||null!==F.exec(e))},construct:function(e){var t,n,i,r,o,a,s,l,c=0,u=null;if(null===(t=L.exec(e))&&(t=F.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],i=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,i,r));if(o=+t[4],a=+t[5],s=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+="0";c=+c}return t[9]&&(u=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(u=-u)),l=new Date(Date.UTC(n,i,r,o,a,s,c)),u&&l.setTime(l.getTime()-u),l},instanceOf:Date,represent:function(e){return e.toISOString()}});var $=new x("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),Y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var D=new x("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i=0,r=e.length,o=Y;for(n=0;n<r;n++)if(!((t=o.indexOf(e.charAt(n)))>64)){if(t<0)return!1;i+=6}return i%8==0},construct:function(e){var t,n,i=e.replace(/[\r\n=]/g,""),r=i.length,o=Y,a=0,s=[];for(t=0;t<r;t++)t%4==0&&t&&(s.push(a>>16&255),s.push(a>>8&255),s.push(255&a)),a=a<<6|o.indexOf(i.charAt(t));return 0===(n=r%4*6)?(s.push(a>>16&255),s.push(a>>8&255),s.push(255&a)):18===n?(s.push(a>>10&255),s.push(a>>2&255)):12===n&&s.push(a>>4&255),new Uint8Array(s)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,i="",r=0,o=e.length,a=Y;for(t=0;t<o;t++)t%3==0&&t&&(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]),r=(r<<8)+e[t];return 0===(n=o%3)?(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]):2===n?(i+=a[r>>10&63],i+=a[r>>4&63],i+=a[r<<2&63],i+=a[64]):1===n&&(i+=a[r>>2&63],i+=a[r<<4&63],i+=a[64],i+=a[64]),i}}),U=Object.prototype.hasOwnProperty,q=Object.prototype.toString;var B=new x("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,i,r,o,a=[],s=e;for(t=0,n=s.length;t<n;t+=1){if(i=s[t],o=!1,"[object Object]"!==q.call(i))return!1;for(r in i)if(U.call(i,r)){if(o)return!1;o=!0}if(!o)return!1;if(-1!==a.indexOf(r))return!1;a.push(r)}return!0},construct:function(e){return null!==e?e:[]}}),R=Object.prototype.toString;var z=new x("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,i,r,o,a=e;for(o=new Array(a.length),t=0,n=a.length;t<n;t+=1){if(i=a[t],"[object Object]"!==R.call(i))return!1;if(1!==(r=Object.keys(i)).length)return!1;o[t]=[r[0],i[r[0]]]}return!0},construct:function(e){if(null===e)return[];var t,n,i,r,o,a=e;for(o=new Array(a.length),t=0,n=a.length;t<n;t+=1)i=a[t],r=Object.keys(i),o[t]=[r[0],i[r[0]]];return o}}),W=Object.prototype.hasOwnProperty;var P=new x("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var t,n=e;for(t in n)if(W.call(n,t)&&null!==n[t])return!1;return!0},construct:function(e){return null!==e?e:{}}}),G=E.extend({implicit:[_,$],explicit:[D,B,z,P]}),Z=Object.prototype.hasOwnProperty,V=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,X=/[\x85\u2028\u2029]/,H=/[,\[\]\{\}]/,K=/^(?:!|!!|![a-z\-]+!)$/i,J=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Q(e){return Object.prototype.toString.call(e)}function ee(e){return 10===e||13===e}function te(e){return 9===e||32===e}function ne(e){return 9===e||32===e||10===e||13===e}function ie(e){return 44===e||91===e||93===e||123===e||125===e}function re(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function oe(e){return 120===e?2:117===e?4:85===e?8:0}function ae(e){return 48<=e&&e<=57?e-48:-1}function se(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"…":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function le(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}function ce(e,t,n){"__proto__"===t?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}for(var ue=new Array(256),pe=new Array(256),fe=0;fe<256;fe++)ue[fe]=se(fe)?1:0,pe[fe]=se(fe);function de(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||G,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function he(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=g(n),new d(t,n)}function me(e,t){throw he(e,t)}function ge(e,t){e.onWarning&&e.onWarning.call(null,he(e,t))}var be={YAML:function(e,t,n){var i,r,o;null!==e.version&&me(e,"duplication of %YAML directive"),1!==n.length&&me(e,"YAML directive accepts exactly one argument"),null===(i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&me(e,"ill-formed argument of the YAML directive"),r=parseInt(i[1],10),o=parseInt(i[2],10),1!==r&&me(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,1!==o&&2!==o&&ge(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var i,r;2!==n.length&&me(e,"TAG directive accepts exactly two arguments"),i=n[0],r=n[1],K.test(i)||me(e,"ill-formed tag handle (first argument) of the TAG directive"),Z.call(e.tagMap,i)&&me(e,'there is a previously declared suffix for "'+i+'" tag handle'),J.test(r)||me(e,"ill-formed tag prefix (second argument) of the TAG directive");try{r=decodeURIComponent(r)}catch(o){me(e,"tag prefix is malformed: "+r)}e.tagMap[i]=r}};function ye(e,t,n,i){var r,o,a,s;if(t<n){if(s=e.input.slice(t,n),i)for(r=0,o=s.length;r<o;r+=1)9===(a=s.charCodeAt(r))||32<=a&&a<=1114111||me(e,"expected valid JSON character");else V.test(s)&&me(e,"the stream contains non-printable characters");e.result+=s}}function xe(e,t,n,i){var r,o,a,s;for(u.isObject(n)||me(e,"cannot merge mappings; the provided source object is unacceptable"),a=0,s=(r=Object.keys(n)).length;a<s;a+=1)o=r[a],Z.call(t,o)||(ce(t,o,n[o]),i[o]=!0)}function Ae(e,t,n,i,r,o,a,s,l){var c,u;if(Array.isArray(r))for(c=0,u=(r=Array.prototype.slice.call(r)).length;c<u;c+=1)Array.isArray(r[c])&&me(e,"nested arrays are not supported inside keys"),"object"==typeof r&&"[object Object]"===Q(r[c])&&(r[c]="[object Object]");if("object"==typeof r&&"[object Object]"===Q(r)&&(r="[object Object]"),r=String(r),null===t&&(t={}),"tag:yaml.org,2002:merge"===i)if(Array.isArray(o))for(c=0,u=o.length;c<u;c+=1)xe(e,t,o[c],n);else xe(e,t,o,n);else e.json||Z.call(n,r)||!Z.call(t,r)||(e.line=a||e.line,e.lineStart=s||e.lineStart,e.position=l||e.position,me(e,"duplicated mapping key")),ce(t,r,o),delete n[r];return t}function ve(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):me(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function ke(e,t,n){for(var i=0,r=e.input.charCodeAt(e.position);0!==r;){for(;te(r);)9===r&&-1===e.firstTabInLine&&(e.firstTabInLine=e.position),r=e.input.charCodeAt(++e.position);if(t&&35===r)do{r=e.input.charCodeAt(++e.position)}while(10!==r&&13!==r&&0!==r);if(!ee(r))break;for(ve(e),r=e.input.charCodeAt(e.position),i++,e.lineIndent=0;32===r;)e.lineIndent++,r=e.input.charCodeAt(++e.position)}return-1!==n&&0!==i&&e.lineIndent<n&&ge(e,"deficient indentation"),i}function we(e){var t,n=e.position;return!(45!==(t=e.input.charCodeAt(n))&&46!==t||t!==e.input.charCodeAt(n+1)||t!==e.input.charCodeAt(n+2)||(n+=3,0!==(t=e.input.charCodeAt(n))&&!ne(t)))}function Ce(e,t){1===t?e.result+=" ":t>1&&(e.result+=u.repeat("\n",t-1))}function je(e,t){var n,i,r=e.tag,o=e.anchor,a=[],s=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),i=e.input.charCodeAt(e.position);0!==i&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,me(e,"tab characters must not be used in indentation")),45===i)&&ne(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,ke(e,!0,-1)&&e.lineIndent<=t)a.push(null),i=e.input.charCodeAt(e.position);else if(n=e.line,Se(e,t,3,!1,!0),a.push(e.result),ke(e,!0,-1),i=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==i)me(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!s&&(e.tag=r,e.anchor=o,e.kind="sequence",e.result=a,!0)}function Ie(e){var t,n,i,r,o=!1,a=!1;if(33!==(r=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&me(e,"duplication of a tag property"),60===(r=e.input.charCodeAt(++e.position))?(o=!0,r=e.input.charCodeAt(++e.position)):33===r?(a=!0,n="!!",r=e.input.charCodeAt(++e.position)):n="!",t=e.position,o){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&62!==r);e.position<e.length?(i=e.input.slice(t,e.position),r=e.input.charCodeAt(++e.position)):me(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==r&&!ne(r);)33===r&&(a?me(e,"tag suffix cannot contain exclamation marks"):(n=e.input.slice(t-1,e.position+1),K.test(n)||me(e,"named tag handle cannot contain such characters"),a=!0,t=e.position+1)),r=e.input.charCodeAt(++e.position);i=e.input.slice(t,e.position),H.test(i)&&me(e,"tag suffix cannot contain flow indicator characters")}i&&!J.test(i)&&me(e,"tag name cannot contain such characters: "+i);try{i=decodeURIComponent(i)}catch(s){me(e,"tag name is malformed: "+i)}return o?e.tag=i:Z.call(e.tagMap,n)?e.tag=e.tagMap[n]+i:"!"===n?e.tag="!"+i:"!!"===n?e.tag="tag:yaml.org,2002:"+i:me(e,'undeclared tag handle "'+n+'"'),!0}function Ne(e){var t,n;if(38!==(n=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&me(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!ne(n)&&!ie(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&me(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function Se(e,t,n,i,r){var o,a,s,l,c,p,f,d,h,m=1,g=!1,b=!1;if(null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,o=a=s=4===n||3===n,i&&ke(e,!0,-1)&&(g=!0,e.lineIndent>t?m=1:e.lineIndent===t?m=0:e.lineIndent<t&&(m=-1)),1===m)for(;Ie(e)||Ne(e);)ke(e,!0,-1)?(g=!0,s=o,e.lineIndent>t?m=1:e.lineIndent===t?m=0:e.lineIndent<t&&(m=-1)):s=!1;if(s&&(s=g||r),1!==m&&4!==n||(d=1===n||2===n?t:t+1,h=e.position-e.lineStart,1===m?s&&(je(e,h)||function(e,t,n){var i,r,o,a,s,l,c,u=e.tag,p=e.anchor,f={},d=Object.create(null),h=null,m=null,g=null,b=!1,y=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=f),c=e.input.charCodeAt(e.position);0!==c;){if(b||-1===e.firstTabInLine||(e.position=e.firstTabInLine,me(e,"tab characters must not be used in indentation")),i=e.input.charCodeAt(e.position+1),o=e.line,63!==c&&58!==c||!ne(i)){if(a=e.line,s=e.lineStart,l=e.position,!Se(e,n,2,!1,!0))break;if(e.line===o){for(c=e.input.charCodeAt(e.position);te(c);)c=e.input.charCodeAt(++e.position);if(58===c)ne(c=e.input.charCodeAt(++e.position))||me(e,"a whitespace character is expected after the key-value separator within a block mapping"),b&&(Ae(e,f,d,h,m,null,a,s,l),h=m=g=null),y=!0,b=!1,r=!1,h=e.tag,m=e.result;else{if(!y)return e.tag=u,e.anchor=p,!0;me(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!y)return e.tag=u,e.anchor=p,!0;me(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===c?(b&&(Ae(e,f,d,h,m,null,a,s,l),h=m=g=null),y=!0,b=!0,r=!0):b?(b=!1,r=!0):me(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,c=i;if((e.line===o||e.lineIndent>t)&&(b&&(a=e.line,s=e.lineStart,l=e.position),Se(e,t,4,!0,r)&&(b?m=e.result:g=e.result),b||(Ae(e,f,d,h,m,g,a,s,l),h=m=g=null),ke(e,!0,-1),c=e.input.charCodeAt(e.position)),(e.line===o||e.lineIndent>t)&&0!==c)me(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return b&&Ae(e,f,d,h,m,null,a,s,l),y&&(e.tag=u,e.anchor=p,e.kind="mapping",e.result=f),y}(e,h,d))||function(e,t){var n,i,r,o,a,s,l,c,u,p,f,d,h=!0,m=e.tag,g=e.anchor,b=Object.create(null);if(91===(d=e.input.charCodeAt(e.position)))a=93,c=!1,o=[];else{if(123!==d)return!1;a=125,c=!0,o={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),d=e.input.charCodeAt(++e.position);0!==d;){if(ke(e,!0,t),(d=e.input.charCodeAt(e.position))===a)return e.position++,e.tag=m,e.anchor=g,e.kind=c?"mapping":"sequence",e.result=o,!0;h?44===d&&me(e,"expected the node content, but found ','"):me(e,"missed comma between flow collection entries"),f=null,s=l=!1,63===d&&ne(e.input.charCodeAt(e.position+1))&&(s=l=!0,e.position++,ke(e,!0,t)),n=e.line,i=e.lineStart,r=e.position,Se(e,t,1,!1,!0),p=e.tag,u=e.result,ke(e,!0,t),d=e.input.charCodeAt(e.position),!l&&e.line!==n||58!==d||(s=!0,d=e.input.charCodeAt(++e.position),ke(e,!0,t),Se(e,t,1,!1,!0),f=e.result),c?Ae(e,o,b,p,u,f,n,i,r):s?o.push(Ae(e,null,b,p,u,f,n,i,r)):o.push(u),ke(e,!0,t),44===(d=e.input.charCodeAt(e.position))?(h=!0,d=e.input.charCodeAt(++e.position)):h=!1}me(e,"unexpected end of the stream within a flow collection")}(e,d)?b=!0:(a&&function(e,t){var n,i,r,o,a=1,s=!1,l=!1,c=t,p=0,f=!1;if(124===(o=e.input.charCodeAt(e.position)))i=!1;else{if(62!==o)return!1;i=!0}for(e.kind="scalar",e.result="";0!==o;)if(43===(o=e.input.charCodeAt(++e.position))||45===o)1===a?a=43===o?3:2:me(e,"repeat of a chomping mode identifier");else{if(!((r=ae(o))>=0))break;0===r?me(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):l?me(e,"repeat of an indentation width identifier"):(c=t+r-1,l=!0)}if(te(o)){do{o=e.input.charCodeAt(++e.position)}while(te(o));if(35===o)do{o=e.input.charCodeAt(++e.position)}while(!ee(o)&&0!==o)}for(;0!==o;){for(ve(e),e.lineIndent=0,o=e.input.charCodeAt(e.position);(!l||e.lineIndent<c)&&32===o;)e.lineIndent++,o=e.input.charCodeAt(++e.position);if(!l&&e.lineIndent>c&&(c=e.lineIndent),ee(o))p++;else{if(e.lineIndent<c){3===a?e.result+=u.repeat("\n",s?1+p:p):1===a&&s&&(e.result+="\n");break}for(i?te(o)?(f=!0,e.result+=u.repeat("\n",s?1+p:p)):f?(f=!1,e.result+=u.repeat("\n",p+1)):0===p?s&&(e.result+=" "):e.result+=u.repeat("\n",p):e.result+=u.repeat("\n",s?1+p:p),s=!0,l=!0,p=0,n=e.position;!ee(o)&&0!==o;)o=e.input.charCodeAt(++e.position);ye(e,n,e.position,!1)}}return!0}(e,d)||function(e,t){var n,i,r;if(39!==(n=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,i=r=e.position;0!==(n=e.input.charCodeAt(e.position));)if(39===n){if(ye(e,i,e.position,!0),39!==(n=e.input.charCodeAt(++e.position)))return!0;i=e.position,e.position++,r=e.position}else ee(n)?(ye(e,i,r,!0),Ce(e,ke(e,!1,t)),i=r=e.position):e.position===e.lineStart&&we(e)?me(e,"unexpected end of the document within a single quoted scalar"):(e.position++,r=e.position);me(e,"unexpected end of the stream within a single quoted scalar")}(e,d)||function(e,t){var n,i,r,o,a,s;if(34!==(s=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,n=i=e.position;0!==(s=e.input.charCodeAt(e.position));){if(34===s)return ye(e,n,e.position,!0),e.position++,!0;if(92===s){if(ye(e,n,e.position,!0),ee(s=e.input.charCodeAt(++e.position)))ke(e,!1,t);else if(s<256&&ue[s])e.result+=pe[s],e.position++;else if((a=oe(s))>0){for(r=a,o=0;r>0;r--)(a=re(s=e.input.charCodeAt(++e.position)))>=0?o=(o<<4)+a:me(e,"expected hexadecimal character");e.result+=le(o),e.position++}else me(e,"unknown escape sequence");n=i=e.position}else ee(s)?(ye(e,n,i,!0),Ce(e,ke(e,!1,t)),n=i=e.position):e.position===e.lineStart&&we(e)?me(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}me(e,"unexpected end of the stream within a double quoted scalar")}(e,d)?b=!0:!function(e){var t,n,i;if(42!==(i=e.input.charCodeAt(e.position)))return!1;for(i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!ne(i)&&!ie(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&me(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),Z.call(e.anchorMap,n)||me(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],ke(e,!0,-1),!0}(e)?function(e,t,n){var i,r,o,a,s,l,c,u,p=e.kind,f=e.result;if(ne(u=e.input.charCodeAt(e.position))||ie(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&(ne(i=e.input.charCodeAt(e.position+1))||n&&ie(i)))return!1;for(e.kind="scalar",e.result="",r=o=e.position,a=!1;0!==u;){if(58===u){if(ne(i=e.input.charCodeAt(e.position+1))||n&&ie(i))break}else if(35===u){if(ne(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&we(e)||n&&ie(u))break;if(ee(u)){if(s=e.line,l=e.lineStart,c=e.lineIndent,ke(e,!1,-1),e.lineIndent>=t){a=!0,u=e.input.charCodeAt(e.position);continue}e.position=o,e.line=s,e.lineStart=l,e.lineIndent=c;break}}a&&(ye(e,r,o,!1),Ce(e,e.line-s),r=o=e.position,a=!1),te(u)||(o=e.position+1),u=e.input.charCodeAt(++e.position)}return ye(e,r,o,!1),!!e.result||(e.kind=p,e.result=f,!1)}(e,d,1===n)&&(b=!0,null===e.tag&&(e.tag="?")):(b=!0,null===e.tag&&null===e.anchor||me(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(b=s&&je(e,h))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&me(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),l=0,c=e.implicitTypes.length;l<c;l+=1)if((f=e.implicitTypes[l]).resolve(e.result)){e.result=f.construct(e.result),e.tag=f.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);break}}else if("!"!==e.tag){if(Z.call(e.typeMap[e.kind||"fallback"],e.tag))f=e.typeMap[e.kind||"fallback"][e.tag];else for(f=null,l=0,c=(p=e.typeMap.multi[e.kind||"fallback"]).length;l<c;l+=1)if(e.tag.slice(0,p[l].tag.length)===p[l].tag){f=p[l];break}f||me(e,"unknown tag !<"+e.tag+">"),null!==e.result&&f.kind!==e.kind&&me(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+f.kind+'", not "'+e.kind+'"'),f.resolve(e.result,e.tag)?(e.result=f.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):me(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||b}function Me(e){var t,n,i,r,o=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(r=e.input.charCodeAt(e.position))&&(ke(e,!0,-1),r=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==r));){for(a=!0,r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!ne(r);)r=e.input.charCodeAt(++e.position);for(i=[],(n=e.input.slice(t,e.position)).length<1&&me(e,"directive name must not be less than one character in length");0!==r;){for(;te(r);)r=e.input.charCodeAt(++e.position);if(35===r){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&!ee(r));break}if(ee(r))break;for(t=e.position;0!==r&&!ne(r);)r=e.input.charCodeAt(++e.position);i.push(e.input.slice(t,e.position))}0!==r&&ve(e),Z.call(be,n)?be[n](e,n,i):ge(e,'unknown document directive "'+n+'"')}ke(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,ke(e,!0,-1)):a&&me(e,"directives end mark is expected"),Se(e,e.lineIndent-1,4,!1,!0),ke(e,!0,-1),e.checkLineBreaks&&X.test(e.input.slice(o,e.position))&&ge(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&we(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,ke(e,!0,-1)):e.position<e.length-1&&me(e,"end of the stream or a document separator is expected")}var Oe={load:function(e,t){var n=function(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var n=new de(e,t),i=e.indexOf("\0");for(-1!==i&&(n.position=i,me(n,"null byte is not allowed in input")),n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)Me(n);return n.documents}(e,t);if(0!==n.length){if(1===n.length)return n[0];throw new d("expected a single document in the stream, but found more")}}}.load;function Te(e){var t;const n=e.pages||[],i=e.relations||[];if(0===n.length)return{nodes:[],edges:[]};const r=new Map,o=new Map;for(const d of n)r.set(d.id,[]),o.set(d.id,0);for(const d of i)null==(t=r.get(d.from))||t.push(d.to),o.set(d.to,(o.get(d.to)||0)+1);const a=new Map,s=[];for(const d of n)0===(o.get(d.id)||0)&&(s.push(d.id),a.set(d.id,0));let l=0;for(;s.length>0;){const e=s.shift(),t=a.get(e)||0;for(const n of r.get(e)||[]){const e=t+1;e>(a.get(n)||0)&&(a.set(n,e),e>l&&(l=e));const i=(o.get(n)||1)-1;o.set(n,i),i<=0&&s.push(n)}}for(const d of n)a.has(d.id)||a.set(d.id,l+1);const c=new Map;for(const d of n){const e=a.get(d.id)||0;c.has(e)||c.set(e,[]),c.get(e).push(d.id)}const u=[],p=new Map(n.map(e=>[e.id,e]));for(const[d,h]of c){const e=-(160*h.length+60*(h.length-1))/2;h.forEach((t,n)=>{const i=p.get(t);u.push({id:t,title:(null==i?void 0:i.title)||t,x:e+220*n+80,y:130*d,layer:d})})}const f=i.map(e=>({from:e.from,to:e.to,label:e.label}));return{nodes:u,edges:f}}const Ee=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#06b6d4","#f97316","#6366f1"];function Le({folderPath:c}){const[u,p]=e.useState(null),[f,d]=e.useState(!0),[h,m]=e.useState(null),[g,b]=e.useState(1),[y,x]=e.useState({x:0,y:0}),A=e.useRef(!1),v=e.useRef({x:0,y:0}),[,k]=e.useState(0),w=e.useRef(null),C=e.useRef(null),j=`${c}/.notebook/graph.yaml`,I=e.useCallback(async()=>{d(!0),m(null);try{const e=await t(j);if(!e.content)return m("graph.yaml is empty"),void p(null);const n=Oe(e.content);p(n),b(1),x({x:0,y:0})}catch{m("Cannot read .notebook/graph.yaml"),p(null)}finally{d(!1)}},[j]);e.useEffect(()=>{I()},[I]);const N=e.useCallback(e=>{e.preventDefault();const t=e.deltaY>0?-.1:.1;b(e=>Math.max(.2,Math.min(3,e+t)))},[]),S=e.useCallback(e=>{0===e.button&&(A.current=!0,k(e=>e+1),x(t=>(v.current={x:e.clientX-t.x,y:e.clientY-t.y},t)))},[]),M=e.useCallback(e=>{A.current&&x({x:e.clientX-v.current.x,y:e.clientY-v.current.y})},[]),O=e.useCallback(()=>{A.current=!1,k(e=>e+1)},[]),T=e.useCallback(()=>{if(!u||!C.current)return;const{nodes:e}=Te(u);if(0===e.length)return;const t=Math.min(...e.map(e=>e.x))-100,n=Math.max(...e.map(e=>e.x))+100,i=Math.min(...e.map(e=>e.y))-40,r=Math.max(...e.map(e=>e.y))+60,o=n-t,a=r-i,s=C.current.clientWidth,l=C.current.clientHeight,c=.9*Math.min(s/o,l/a,1.5);b(c),x({x:s/2-(t+n)/2*c,y:l/2-(i+r)/2*c})},[u]),{nodes:E,edges:L}=e.useMemo(()=>u?Te(u):{nodes:[],edges:[]},[u]),F=e.useMemo(()=>new Map(E.map(e=>[e.id,e])),[E]);return e.useEffect(()=>{if(u&&!f){const e=setTimeout(T,50);return()=>clearTimeout(e)}},[u,f,T]),f?n.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:n.jsx(i,{className:"h-5 w-5 animate-spin"})}):h||!u?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-muted-foreground text-sm px-4 text-center",children:[n.jsx("p",{children:h||"No graph data"}),n.jsxs(r,{variant:"ghost",size:"sm",onClick:()=>{I()},children:[n.jsx(o,{className:"h-3 w-3 mr-1"})," Retry"]})]}):n.jsxs("div",{className:"flex flex-col h-full",children:[n.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 border-b shrink-0",children:[n.jsxs("span",{className:"text-xs text-muted-foreground mr-auto",children:[E.length," pages, ",L.length," relations"]}),n.jsx(r,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>b(e=>Math.min(3,e+.2)),children:n.jsx(a,{className:"h-3 w-3"})}),n.jsx(r,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>b(e=>Math.max(.2,e-.2)),children:n.jsx(s,{className:"h-3 w-3"})}),n.jsx(r,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:T,children:n.jsx(l,{className:"h-3 w-3"})}),n.jsx(r,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>{I()},children:n.jsx(o,{className:"h-3 w-3"})})]}),n.jsx("div",{ref:C,className:"flex-1 overflow-hidden cursor-grab active:cursor-grabbing bg-muted/30",onWheel:N,onMouseDown:S,onMouseMove:M,onMouseUp:O,onMouseLeave:O,children:n.jsxs("svg",{ref:w,width:"100%",height:"100%",style:{userSelect:"none"},children:[n.jsx("defs",{children:n.jsx("marker",{id:"arrowhead",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"8",markerHeight:"6",orient:"auto",children:n.jsx("polygon",{points:"0 0, 10 3.5, 0 7",className:"fill-muted-foreground/60"})})}),n.jsxs("g",{transform:`translate(${y.x}, ${y.y}) scale(${g})`,children:[L.map((e,t)=>{const i=F.get(e.from),r=F.get(e.to);if(!i||!r)return null;const o=i.y+20,a=r.y-20,s=(o+a)/2;return n.jsxs("g",{children:[n.jsx("path",{d:`M ${i.x} ${o} C ${i.x} ${s}, ${r.x} ${s}, ${r.x} ${a}`,fill:"none",className:"stroke-muted-foreground/40",strokeWidth:1.5,markerEnd:"url(#arrowhead)"}),e.label&&n.jsx("text",{x:(i.x+r.x)/2,y:s-4,textAnchor:"middle",className:"fill-muted-foreground/60",fontSize:9,children:e.label})]},`edge-${t}`)}),E.map(e=>{const t=Ee[e.layer%Ee.length];return n.jsxs("g",{transform:`translate(${e.x-70}, ${e.y-18})`,children:[n.jsx("rect",{width:140,height:36,rx:8,fill:t,fillOpacity:.15,stroke:t,strokeWidth:1.5}),n.jsx("text",{x:70,y:19,textAnchor:"middle",dominantBaseline:"middle",className:"fill-foreground",fontSize:11,fontWeight:500,children:e.title.length>14?e.title.slice(0,13)+"…":e.title})]},e.id)})]})]})})]})}export{Le as GraphPreview};
@@ -1,14 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/OfficePreview-CLGxDBuB.js","assets/index-nuXK9Vzi.js","assets/index-b8oVHVON.css","assets/purify.es-CgRAQgUo.js"])))=>i.map(i=>d[i]);
2
- import{c as e,ag as t,aF as s,r as a,bd as n,j as r,be as l,n as o,d as c,bf as i,bg as d,ax as x,ay as u,Q as m,O as h,bh as p,ah as f,a as g,b as j,g as b,D as v,al as y,f as N,R as w,_ as k,m as C,X as S,v as I,bi as M,bj as z,C as P,A as U,x as T}from"./index-nuXK9Vzi.js";import{A as $,d as A,G as D,S as E,M as L,r as R,a as H,b as O,h as F,o as _,c as q,I as B,F as W}from"./AssistantMessageContent-BXGoUnPl.js";import{C as V}from"./chevron-up-DjQ2Kt99.js";import{C as K}from"./chevron-down-Bn3Wxb1A.js";
3
- /**
4
- * @license lucide-react v0.309.0 - ISC
5
- *
6
- * This source code is licensed under the ISC license.
7
- * See the LICENSE file in the root directory of this source tree.
8
- */const G=e("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]),J=e("FileCode",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["path",{d:"m10 13-2 2 2 2",key:"17smn8"}],["path",{d:"m14 17 2-2-2-2",key:"14mezr"}]]),Q=e("FileJson",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]),X=e("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]),Y=window.matchMedia("(pointer: coarse)").matches&&window.innerWidth<768;
9
- /**
10
- * @license lucide-react v0.309.0 - ISC
11
- *
12
- * This source code is licensed under the ISC license.
13
- * See the LICENSE file in the root directory of this source tree.
14
- */function Z({onSelectProject:e}){const d=t(),{projects:x,fetchProjects:u,hasFetched:m,loading:h}=s(),[p,f]=a.useState(new Map),[g,j]=a.useState(new Set),[b,v]=a.useState(!1);a.useEffect(()=>{u()},[u]);const y=a.useCallback(e=>{e.status&&f(t=>{const s=new Map(t);return s.set(e.projectId,e.status),s}),void 0!==e.active&&j(t=>{const s=new Set(t);return e.active?s.add(e.projectId):s.delete(e.projectId),s})},[]);n({onActivityUpdate:y});const N=x.filter(e=>!e.archived);return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:"flex items-center gap-3 px-4 h-12 border-b border-border shrink-0",children:[r.jsx("span",{className:"font-semibold text-base flex-1",children:"CC Web"}),r.jsx(l,{}),r.jsx("button",{onClick:()=>{(async()=>{v(!0);try{await u()}finally{v(!1)}})()},className:"text-muted-foreground active:text-foreground",disabled:b,children:r.jsx(o,{className:c("h-4 w-4",b&&"animate-spin")})}),!Y&&r.jsx("button",{onClick:()=>d("/"),className:"text-muted-foreground active:text-foreground",title:"桌面模式",children:r.jsx(i,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3",children:[h&&!m&&r.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"加载中..."}),m&&0===N.length&&r.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"暂无项目"}),r.jsx("div",{className:"grid grid-cols-2 gap-2",children:N.map(t=>{var s;const a="running"===(s=t,p.get(s.id)??s.status??"stopped"),n=g.has(t.id),l=r.jsxs("button",{onClick:()=>e(t.id),className:c("w-full text-left rounded-lg border bg-card p-2.5 active:bg-accent transition-colors",n?"border-transparent":"border-border"),children:[r.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[r.jsx("span",{className:c("w-2 h-2 rounded-full shrink-0",a?"bg-green-500":"bg-zinc-400")}),r.jsx("span",{className:"font-medium text-sm truncate flex-1",children:t.name})]}),r.jsx("div",{className:"text-[10px] text-muted-foreground font-mono truncate",children:t.cliTool??"claude"})]});return r.jsx("div",{className:n?"card-active-glow rounded-lg":void 0,children:l},t.id)})})]})]})}function ee({project:e,onBack:t,onOpenPanel:s,onContextUpdate:n}){const[l,o]=a.useState(""),i=a.useRef(null),g=a.useRef(null),[j,b]=a.useState([]),v=a.useCallback(e=>{b(t=>{const s=[...t,e];return s.length>200?s.slice(-200):s})},[]),y=a.useRef(null),N=a.useCallback(e=>{var t;"stopped"===e&&(null==(t=y.current)||t.call(y,"stopped"))},[]),[w,k]=a.useState([]),C=a.useRef(new Set),S=a.useCallback(e=>{C.current.has(e.toolUseId)||k(t=>t.some(t=>t.toolUseId===e.toolUseId)?t:[...t,{projectId:e.projectId,toolUseId:e.toolUseId,toolName:e.toolName,toolInput:e.toolInput,sessionId:e.sessionId,createdAt:e.createdAt}])},[]),I=a.useCallback(e=>{C.current.add(e.toolUseId),k(t=>t.filter(t=>t.toolUseId!==e.toolUseId))},[]),M=a.useCallback(e=>{C.current.add(e),k(t=>t.filter(t=>t.toolUseId!==e))},[]),{sendInput:z,connected:P}=d({projectId:e.id,enabled:!0,onChatMessage:v,onStatusChange:N,onContextUpdate:n,onApprovalRequest:S,onApprovalResolved:I});a.useEffect(()=>{if(!P)return;if("claude"!==e.cliTool)return;let t=!1;return x(e.id).then(e=>{if(t)return;const s=e.pending.filter(e=>!C.current.has(e.toolUseId));k(e=>{const t=new Map;for(const a of s)t.set(a.toolUseId,a);for(const s of e)t.has(s.toolUseId)||C.current.has(s.toolUseId)||t.set(s.toolUseId,s);return[...t.values()]})}).catch(()=>{}),()=>{t=!0}},[e.id,e.cliTool,P]);const{state:U,setState:T,messages:L,hasMoreHistory:R,loadMoreHistory:H,sendMessage:O,isWaking:F}=u({project:e,liveMessages:j,ws:{send:z,connected:P},historyLimit:20});y.current=T;const _=a.useRef(P);a.useEffect(()=>{!_.current&&P&&b([]),_.current=P},[P]);const q=(()=>{for(let e=L.length-1;e>=0;e--)if("assistant"===L[e].role)return e;return-1})(),[B,W]=a.useState([]),[J,Q]=a.useState([]),[Y,Z]=a.useState(null);a.useEffect(()=>{m().then(W).catch(()=>{}),h(e.id).then(Q).catch(()=>{})},[e.id]);const ee=a.useCallback(async()=>{const e=i.current,t=(null==e?void 0:e.scrollHeight)??0;await H(),requestAnimationFrame(()=>{e&&(e.scrollTop+=e.scrollHeight-t)})},[H]),te=a.useRef(0);a.useEffect(()=>{const e=i.current;if(!e)return;const t=L.length>te.current,s=0===te.current&&L.length>0;te.current=L.length,s?e.scrollTo({top:e.scrollHeight}):t&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},[L,w.length]);const se=a.useCallback(()=>{const e=l.trim();e&&(o(""),g.current&&(g.current.style.height="auto"),O(e))},[l,O]),ae=p(se,"shift"),ne=a.useCallback(e=>{Z(null),O(e)},[O]),re="live"===U;return r.jsxs("div",{className:"flex flex-col h-full bg-background",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[r.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:r.jsx(f,{className:"h-5 w-5"})}),r.jsxs("div",{className:"flex items-center gap-1.5 flex-1 min-w-0",children:[r.jsx("span",{className:"font-medium text-sm truncate",children:e.name}),r.jsx("span",{className:c("w-2 h-2 rounded-full shrink-0",re?"bg-green-500":F?"bg-yellow-400 animate-pulse":"bg-zinc-400")})]}),r.jsx("button",{onClick:s,className:"text-muted-foreground active:text-foreground p-1",children:r.jsx(X,{className:"h-5 w-5"})})]}),r.jsxs("div",{ref:i,className:"flex-1 overflow-y-auto px-3 py-3 space-y-3 min-h-0",children:[R&&r.jsx("div",{className:"flex justify-center pb-1",children:r.jsxs("button",{onClick:()=>{ee()},className:"flex items-center gap-1 px-3 py-1.5 rounded-full text-xs text-muted-foreground border border-border active:bg-accent transition-colors",children:[r.jsx(V,{className:"h-3 w-3"}),"加载更早消息"]})}),L.map((e,t)=>{const s="user"===e.role;return r.jsx("div",{className:c("flex",s?"justify-end":"justify-start"),children:r.jsx("div",{className:c("max-w-[85%] rounded-xl px-3 py-2 break-words text-sm leading-relaxed",s?"bg-blue-500/15 text-foreground border border-blue-500/20 rounded-br-sm whitespace-pre-wrap":"bg-secondary text-secondary-foreground border border-border rounded-bl-sm"),children:s?e.content:r.jsx($,{content:e.content,isLatest:t===q})})},e.id)}),w.map(e=>r.jsx(A,{approval:e,onResolved:M},e.toolUseId)),0===L.length&&0===w.length&&"stopped"===U&&r.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground/40 text-sm",children:"暂无对话记录"}),F&&r.jsx("div",{className:"flex items-center justify-center py-4 text-yellow-400 text-sm animate-pulse",children:"启动中..."})]}),Y&&r.jsx("div",{className:"border-t border-border max-h-48 overflow-y-auto shrink-0",children:r.jsxs("div",{className:"px-3 py-2 space-y-1",children:[("global"===Y?B:J).map(e=>r.jsxs("button",{onClick:()=>ne(e.command),disabled:F,className:c("w-full text-left rounded-md px-2.5 py-2 text-sm active:bg-accent transition-colors border border-border/50",F&&"opacity-50 cursor-not-allowed"),children:[r.jsx("div",{className:"font-medium text-xs",children:e.label}),r.jsx("div",{className:"text-[11px] text-muted-foreground font-mono truncate",children:e.command})]},e.id)),0===("global"===Y?B:J).length&&r.jsx("div",{className:"text-center text-muted-foreground text-xs py-3",children:"暂无快捷命令"})]})}),(B.length>0||J.length>0)&&r.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-t border-border shrink-0",children:[r.jsxs("button",{onClick:()=>Z(e=>"global"===e?null:"global"),className:c("flex items-center gap-1 px-2 py-1 rounded-md text-xs transition-colors","global"===Y?"bg-blue-500/15 text-blue-500":"text-muted-foreground active:bg-accent"),children:[r.jsx(D,{className:"h-3 w-3"}),"全局","global"===Y&&r.jsx(K,{className:"h-3 w-3"})]}),r.jsxs("button",{onClick:()=>Z(e=>"project"===e?null:"project"),className:c("flex items-center gap-1 px-2 py-1 rounded-md text-xs transition-colors","project"===Y?"bg-blue-500/15 text-blue-500":"text-muted-foreground active:bg-accent"),children:[r.jsx(G,{className:"h-3 w-3"}),"项目","project"===Y&&r.jsx(K,{className:"h-3 w-3"})]})]}),r.jsx("div",{className:"border-t border-border px-3 py-2 shrink-0",style:{paddingBottom:"max(0.5rem, env(safe-area-inset-bottom))"},children:r.jsxs("div",{className:"flex items-end gap-2",children:[r.jsx("textarea",{ref:g,value:l,onChange:e=>o(e.target.value),onKeyDown:ae,disabled:F,placeholder:F?"启动中...":"stopped"===U?"输入消息(自动启动)...":"输入消息...",rows:1,className:c("flex-1 resize-none rounded-lg border border-input bg-transparent px-3 py-2 text-sm outline-none","focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50","max-h-32 overflow-y-auto",F&&"opacity-50 cursor-not-allowed"),style:{minHeight:"2.5rem"},onInput:e=>{const t=e.currentTarget;t.style.height="auto",t.style.height=Math.min(t.scrollHeight,128)+"px"}}),r.jsx("button",{onClick:se,disabled:F||!l.trim(),className:c("shrink-0 p-2 rounded-lg transition-colors",l.trim()?"text-blue-500 active:bg-blue-500/10":"text-muted-foreground/30"),children:r.jsx(E,{className:"h-5 w-5"})})]})})]})}const te=w.lazy(()=>k(()=>import("./OfficePreview-CLGxDBuB.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.OfficePreview}))),se=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),ae=new Set(["docx","xlsx","xls","pptx"]),ne={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",cpp:"cpp",h:"c",cs:"csharp",php:"php",sh:"bash",bash:"bash",zsh:"bash",yaml:"yaml",yml:"yaml",json:"json",toml:"toml",html:"html",htm:"html",xml:"xml",svg:"xml",css:"css",scss:"scss",less:"less",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"docker",makefile:"makefile",r:"r",lua:"lua",dart:"dart",zig:"zig"};function re(e){return e.split("/").pop()??e}function le({filePath:e,onBack:t}){const[s,n]=a.useState(null),[l,o]=a.useState(!0),[c,i]=a.useState(null),{resolved:d}=g(),x=function(e){const t=e.split("/").pop()??"",s=t.toLowerCase();if("dockerfile"===s)return"dockerfile";if("makefile"===s)return"makefile";const a=t.lastIndexOf(".");return a>=0?t.slice(a+1).toLowerCase():""}(e),u=se.has(x),m=ae.has(x),h=ne[x],p="dark"===d;a.useEffect(()=>{u||m?o(!1):(o(!0),i(null),j(e).then(n).catch(e=>i(e instanceof Error?e.message:"Failed to load")).finally(()=>o(!1)))},[e,u,m]);const w=N(e),k=a.useMemo(()=>{const e=b();return e?`${w}&token=${encodeURIComponent(e)}`:w},[w]),C=a.useMemo(()=>u?`${k}&t=${Date.now()}`:"",[k,u]);return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[r.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:r.jsx(f,{className:"h-5 w-5"})}),r.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:re(e)}),r.jsx("a",{href:k,download:!0,className:"text-muted-foreground active:text-foreground p-1",onClick:e=>e.stopPropagation(),children:r.jsx(v,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex-1 overflow-auto min-h-0",children:[l&&r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(y,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),c&&r.jsx("div",{className:"text-center text-destructive text-sm py-12 px-4",children:c}),u&&r.jsx("div",{className:"flex items-center justify-center p-4 h-full",children:r.jsx("img",{src:C,alt:re(e),className:"max-w-full max-h-full object-contain rounded",style:{touchAction:"pinch-zoom"}})}),m&&r.jsx(a.Suspense,{fallback:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(y,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),children:r.jsx(te,{filePath:e,ext:x,zoom:100})}),s&&(s.binary||s.tooLarge)&&r.jsxs("div",{className:"text-center py-12 px-4 space-y-3",children:[r.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.binary?"二进制文件":"文件过大",s.size>0&&` (${S=s.size,S<1024?`${S} B`:S<1048576?`${(S/1024).toFixed(1)} KB`:`${(S/1048576).toFixed(1)} MB`})`]}),r.jsxs("a",{href:k,download:!0,className:"inline-flex items-center gap-1.5 text-sm text-blue-500 active:text-blue-400",children:[r.jsx(v,{className:"h-4 w-4"}),"下载文件"]})]}),s&&!s.binary&&!s.tooLarge&&null!=s.content&&r.jsxs(r.Fragment,{children:["md"===x&&r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none px-4 py-3",children:r.jsx(L,{remarkPlugins:[H,O],rehypePlugins:[R],children:s.content})}),"md"!==x&&h&&r.jsx(F,{language:h,style:p?_:q,customStyle:{margin:0,fontSize:"12px",borderRadius:0},showLineNumbers:!0,children:s.content}),"md"!==x&&!h&&r.jsx("pre",{className:"p-4 text-xs font-mono whitespace-pre-wrap break-words",children:s.content})]})]})]});var S}const oe=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),ce=new Set(["js","jsx","ts","tsx","py","rb","go","rs","java","c","cpp","h","swift","kt","cs","php","sh","bash","zsh","r","lua","dart","zig","css","scss","less","html","htm","xml","sql"]),ie=new Set(["json","yaml","yml","toml","csv","tsv"]);function de({entry:e}){if("dir"===e.type)return r.jsx(I,{className:"h-8 w-8 text-blue-400"});const t=function(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t+1).toLowerCase():""}(e.name);return oe.has(t)?r.jsx(B,{className:"h-8 w-8 text-emerald-400"}):ce.has(t)?r.jsx(J,{className:"h-8 w-8 text-orange-400"}):ie.has(t)?r.jsx(Q,{className:"h-8 w-8 text-yellow-400"}):"md"===t?r.jsx(W,{className:"h-8 w-8 text-sky-400"}):r.jsx(M,{className:"h-8 w-8 text-muted-foreground"})}function xe({rootPath:e,onClose:t}){const[s,n]=a.useState(e),[l,o]=a.useState([]),[c,i]=a.useState(!0),[d,x]=a.useState(null),u=a.useCallback(async e=>{i(!0);try{const t=[...(await C(e)).entries].sort((e,t)=>e.type!==t.type?"dir"===e.type?-1:1:e.name.localeCompare(t.name));o(t),n(e)}catch{o([])}finally{i(!1)}},[]);a.useEffect(()=>{u(e)},[e,u]);const m=s!==e,h=s.startsWith(e)?s.slice(e.length)||"/":s;return d?r.jsx(le,{filePath:d,onBack:()=>x(null)}):r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[r.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:r.jsx(S,{className:"h-5 w-5"})}),r.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-0 text-sm",children:[m&&r.jsx("button",{onClick:()=>{if(s===e)return;const t=s.replace(/\/[^/]+$/,"")||"/";t.startsWith(e)&&u(t)},className:"text-muted-foreground active:text-foreground p-0.5 shrink-0",children:r.jsx(f,{className:"h-4 w-4"})}),r.jsx("span",{className:"truncate text-muted-foreground font-mono text-xs",children:h})]})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3",children:[c&&r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(y,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!c&&0===l.length&&r.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"空目录"}),!c&&r.jsx("div",{className:"grid grid-cols-3 gap-1",children:l.map(e=>r.jsxs("button",{onClick:()=>(e=>{"dir"===e.type?u(e.path):x(e.path)})(e),className:"flex flex-col items-center gap-1 p-2 rounded-lg active:bg-accent transition-colors",children:[r.jsx(de,{entry:e}),r.jsx("span",{className:"text-[11px] text-center leading-tight w-full line-clamp-2 break-all",children:e.name})]},e.path))})]})]})}function ue(e){return e<50?"text-green-400":e<80?"text-yellow-400":"text-red-400"}function me(e){return e<50?"bg-green-500":e<80?"bg-yellow-500":"bg-red-500"}function he({projectName:e,cliTool:t,folderPath:s,contextData:n,onClose:l}){const[i,d]=a.useState(new Set(["context","usage","files"])),[x,u]=a.useState(null),[m,h]=a.useState(!1),p=e=>{d(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})};a.useEffect(()=>{h(!0),z(t).then(u).catch(()=>u(null)).finally(()=>h(!1))},[t]);const f=n?Math.round(n.usedPercentage):null;return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[r.jsx("button",{onClick:l,className:"text-muted-foreground active:text-foreground p-1",children:r.jsx(S,{className:"h-5 w-5"})}),r.jsx("span",{className:"flex-1 font-medium text-sm truncate",children:e})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto",children:[r.jsxs("button",{onClick:()=>p("context"),className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 active:bg-accent",children:[i.has("context")?r.jsx(K,{className:"h-3.5 w-3.5 text-muted-foreground"}):r.jsx(P,{className:"h-3.5 w-3.5 text-muted-foreground"}),r.jsx("span",{className:"text-sm font-medium",children:"上下文"}),null!==f&&r.jsxs("span",{className:c("text-xs font-mono ml-auto",ue(f)),children:[f,"%"]})]}),i.has("context")&&r.jsx("div",{className:"px-4 py-3 border-b border-border/50",children:null!==f&&n?r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"flex-1 h-2 bg-secondary rounded-full overflow-hidden",children:r.jsx("div",{className:c("h-full rounded-full transition-all",me(f)),style:{width:`${Math.min(f,100)}%`}})}),r.jsxs("span",{className:c("text-xs font-mono w-10 text-right",ue(f)),children:[f,"%"]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-[11px] text-muted-foreground",children:[r.jsx("span",{children:"窗口大小"}),r.jsx("span",{className:"text-right font-mono",children:n.contextWindowSize>=1e6?`${(n.contextWindowSize/1e6).toFixed(1)}M`:`${Math.round(n.contextWindowSize/1e3)}K`}),r.jsx("span",{children:"输入 tokens"}),r.jsx("span",{className:"text-right font-mono",children:n.inputTokens.toLocaleString()}),r.jsx("span",{children:"输出 tokens"}),r.jsx("span",{className:"text-right font-mono",children:n.outputTokens.toLocaleString()})]})]}):r.jsx("div",{className:"text-xs text-muted-foreground/50 text-center py-2",children:"暂无数据"})}),r.jsxs("div",{className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 cursor-pointer",role:"button",tabIndex:0,onClick:()=>p("usage"),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||p("usage")},children:[i.has("usage")?r.jsx(K,{className:"h-3.5 w-3.5 text-muted-foreground"}):r.jsx(P,{className:"h-3.5 w-3.5 text-muted-foreground"}),r.jsx("span",{className:"text-sm font-medium",children:"用量"}),r.jsx("button",{onClick:e=>{e.stopPropagation(),(async()=>{h(!0);try{const{refreshUsage:e}=await k(async()=>{const{refreshUsage:e}=await import("./index-nuXK9Vzi.js").then(e=>e.bw);return{refreshUsage:e}},__vite__mapDeps([1,2]));u(await e(t))}catch{}finally{h(!1)}})()},className:"ml-auto text-muted-foreground active:text-foreground",children:r.jsx(o,{className:c("h-3 w-3",m&&"animate-spin")})})]}),i.has("usage")&&r.jsx("div",{className:"px-4 py-3 border-b border-border/50",children:x?r.jsxs("div",{className:"space-y-2",children:[x.planName&&r.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Plan: ",r.jsx("span",{className:"font-medium text-foreground",children:x.planName})]}),r.jsx(pe,{label:"5h",bucket:x.fiveHour}),r.jsx(pe,{label:"7d",bucket:x.sevenDay}),x.sevenDaySonnet&&r.jsx(pe,{label:"7d Sonnet",bucket:x.sevenDaySonnet}),x.sevenDayOpus&&r.jsx(pe,{label:"7d Opus",bucket:x.sevenDayOpus}),!x.fiveHour&&!x.sevenDay&&r.jsx("div",{className:"text-xs text-muted-foreground/50 text-center",children:"暂无数据"})]}):r.jsx("div",{className:"text-xs text-muted-foreground/50 text-center py-2",children:m?"加载中...":"暂无数据"})}),r.jsxs("button",{onClick:()=>p("files"),className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 active:bg-accent",children:[i.has("files")?r.jsx(K,{className:"h-3.5 w-3.5 text-muted-foreground"}):r.jsx(P,{className:"h-3.5 w-3.5 text-muted-foreground"}),r.jsx("span",{className:"text-sm font-medium",children:"文件"})]}),i.has("files")&&r.jsx("div",{className:"h-[60vh]",children:r.jsx(xe,{rootPath:s,onClose:()=>p("files")})})]})]})}function pe({label:e,bucket:t}){if(!t||void 0===t.utilization)return null;const s=t.utilization,a=function(e){if(!e)return"";const t=new Date(e).getTime()-Date.now();if(t<=0)return"即将重置";const s=Math.floor(t/36e5),a=Math.floor(t%36e5/6e4);return s>0?`${s}h${a}m`:`${a}m`}(t.resetAt);return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-xs text-muted-foreground w-16",children:e}),r.jsx("div",{className:"flex-1 h-1.5 bg-secondary rounded-full overflow-hidden",children:r.jsx("div",{className:c("h-full rounded-full",me(s)),style:{width:`${Math.min(s,100)}%`}})}),r.jsxs("span",{className:c("text-xs font-mono w-8 text-right",ue(s)),children:[s,"%"]}),a&&r.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:a})]})}function fe(){a.useEffect(()=>{const e=document.querySelector('meta[name="viewport"]');if(!e)return;const t=e.getAttribute("content")??"";return e.setAttribute("content","width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"),()=>{e.setAttribute("content",t)}},[]);const[e,t]=a.useState({screen:"list"}),[n,l]=a.useState(null),o=s(e=>e.projects),c=a.useCallback(e=>{t({screen:"chat",projectId:e}),l(null)},[]),i=a.useCallback(e=>{t({screen:"panel",projectId:e})},[]),d=a.useCallback(()=>{t(e=>"panel"===e.screen?{screen:"chat",projectId:e.projectId}:{screen:"list"})},[]),x="list"!==e.screen?o.find(t=>t.id===e.projectId):void 0;return r.jsxs("div",{className:"fixed inset-0 bg-background overflow-hidden",children:[r.jsxs(U,{mode:"wait",children:["list"===e.screen&&r.jsx(T.div,{className:"absolute inset-0",initial:{opacity:0},animate:{opacity:1},exit:{x:"-30%",opacity:0},transition:{duration:.2},style:{paddingTop:"env(safe-area-inset-top)"},children:r.jsx(Z,{onSelectProject:c})},"list"),"chat"===e.screen&&x&&r.jsx(T.div,{className:"absolute inset-0",initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"tween",duration:.25},style:{paddingTop:"env(safe-area-inset-top)"},children:r.jsx(ee,{project:x,onBack:d,onOpenPanel:()=>i(e.projectId),onContextUpdate:l})},`chat-${e.projectId}`)]}),r.jsx(U,{children:"panel"===e.screen&&x&&r.jsx(T.div,{className:"absolute inset-0 z-50 bg-background",initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"tween",duration:.25},style:{paddingTop:"env(safe-area-inset-top)"},children:r.jsx(he,{projectName:x.name,cliTool:x.cliTool??"claude",folderPath:x.folderPath,contextData:n,onClose:d})},"panel")})]})}export{fe as MobilePage};
@@ -1,13 +0,0 @@
1
- import{c as e,r as s,j as t,bn as a,bo as n,bp as r,t as l,bq as i,br as c,bs as o,bt as d,bu as u,B as h,al as x}from"./index-nuXK9Vzi.js";import{Z as m,a as f,P as y}from"./ProjectPage-Bpj8XUcg.js";import{M as g}from"./maximize-2-C1mkwgJj.js";import"./purify.es-CgRAQgUo.js";import"./AssistantMessageContent-BXGoUnPl.js";import"./chevron-down-Bn3Wxb1A.js";import"./chevron-up-DjQ2Kt99.js";import"./index-CYLf1vI2.js";import"./search-DlCQSCBu.js";
2
- /**
3
- * @license lucide-react v0.309.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */const p=e("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),b=e("CheckCircle",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),j=e("Pause",[["rect",{width:"4",height:"16",x:"6",y:"4",key:"iffhe4"}],["rect",{width:"4",height:"16",x:"14",y:"4",key:"sjin7j"}]]),k=e("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),v=e("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),w=140,N=36,C={pending:{fill:"#71717a20",stroke:"#71717a"},running:{fill:"#3b82f633",stroke:"#3b82f6"},success:{fill:"#22c55e26",stroke:"#22c55e"},failed:{fill:"#ef444426",stroke:"#ef4444"},blocked:{fill:"#eab30826",stroke:"#eab308"},skipped:{fill:"#71717a14",stroke:"#71717a"}},M={fill:"#71717a15",stroke:"#52525b"};
8
- /**
9
- * @license lucide-react v0.309.0 - ISC
10
- *
11
- * This source code is licensed under the ISC license.
12
- * See the LICENSE file in the root directory of this source tree.
13
- */function _({tree:e,currentLine:a}){const n=s.useRef(null),[r,l]=s.useState(1),[i,c]=s.useState({x:0,y:0}),o=s.useRef(!1),d=s.useRef({x:0,y:0}),[,u]=s.useState(0),[h,x]=s.useState(null),{layoutNodes:y,edges:p,bounds:b}=s.useMemo(()=>{const s=[],t=[];const a=function e(a,n,r,l){const i=[];let c=r;for(const o of a){const a=40+160*l,n={id:o.id,x:a,y:c,w:w,h:N,type:o.type,label:o.label,status:o.status,node_id:o.node_id,line:o.line,children:[]};if(o.children.length>0){const s=e(o.children,a,c+N+16,l+1);n.children=s.nodes,c=Math.max(c+N+16,c+N+16+s.height);for(const e of s.nodes)t.push({x1:n.x+70,y1:n.y+N,x2:e.x+70,y2:e.y,dashed:"call"===o.type})}else c+=52;i.push(n),s.push(n)}return{nodes:i,height:c-r}}(e,0,20,0);for(let e=1;e<a.nodes.length;e++){const s=a.nodes[e-1],n=a.nodes[e];if(s.x===n.x){const e=z(s);t.push({x1:s.x+70,y1:e,x2:n.x+70,y2:n.y})}}let n=1/0,r=1/0,l=-1/0,i=-1/0;for(const e of s)n=Math.min(n,e.x),r=Math.min(r,e.y),l=Math.max(l,e.x+e.w),i=Math.max(i,e.y+e.h);return{layoutNodes:s,edges:t,bounds:{minX:n,minY:r,maxX:l+40,maxY:i+20}}},[e]),j=s.useCallback(()=>{if(!n.current||0===y.length)return;const e=n.current.getBoundingClientRect(),s=b.maxX-b.minX,t=b.maxY-b.minY;if(0===s||0===t)return;const a=.9*Math.min(e.width/s,e.height/t,2);l(a),c({x:(e.width-s*a)/2-b.minX*a,y:(e.height-t*a)/2-b.minY*a})},[y,b]);s.useEffect(()=>{j()},[e,j]),s.useEffect(()=>{if(null===a)return;const e=y.find(e=>e.line===a);if(!e||!n.current)return;const s=n.current.getBoundingClientRect(),t=e.x+70,l=e.y+18;c({x:s.width/2-t*r,y:s.height/2-l*r})},[a,y,r]);const k=s.useCallback(e=>{e.preventDefault(),l(s=>Math.max(.2,Math.min(3,s+(e.deltaY>0?-.1:.1))))},[]),v=s.useCallback(e=>{0===e.button&&(o.current=!0,u(e=>e+1),c(s=>(d.current={x:e.clientX-s.x,y:e.clientY-s.y},s)))},[]),_=s.useCallback(e=>{o.current&&c({x:e.clientX-d.current.x,y:e.clientY-d.current.y})},[]),S=s.useCallback(()=>{o.current=!1,u(e=>e+1)},[]);return t.jsxs("div",{className:"relative w-full h-full",children:[t.jsxs("div",{className:"absolute top-1 right-1 z-10 flex gap-0.5",children:[t.jsx("button",{className:"p-1 rounded bg-muted/50 hover:bg-muted",onClick:()=>l(e=>Math.min(3,e+.2)),children:t.jsx(m,{className:"h-3 w-3"})}),t.jsx("button",{className:"p-1 rounded bg-muted/50 hover:bg-muted",onClick:()=>l(e=>Math.max(.2,e-.2)),children:t.jsx(f,{className:"h-3 w-3"})}),t.jsx("button",{className:"p-1 rounded bg-muted/50 hover:bg-muted",onClick:j,children:t.jsx(g,{className:"h-3 w-3"})})]}),t.jsxs("svg",{ref:n,className:"w-full h-full",onWheel:k,onMouseDown:v,onMouseMove:_,onMouseUp:S,onMouseLeave:S,style:{cursor:o.current?"grabbing":"grab"},children:[t.jsx("defs",{children:t.jsx("marker",{id:"arrow",viewBox:"0 0 10 10",refX:"10",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:t.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",className:"fill-muted-foreground"})})}),t.jsxs("g",{transform:`translate(${i.x},${i.y}) scale(${r})`,children:[p.map((e,s)=>t.jsx("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,className:"stroke-muted-foreground",strokeWidth:1,strokeDasharray:e.dashed?"4,2":void 0,markerEnd:"url(#arrow)"},`e${s}`)),y.map(e=>{const s=C[e.status??""]??M,n=a===e.line;return t.jsxs("g",{onClick:()=>x(e),style:{cursor:"pointer"},children:[t.jsx("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:6,fill:s.fill,stroke:n?"#60a5fa":s.stroke,strokeWidth:n?2:1,strokeDasharray:"skipped"===e.status?"4,2":void 0}),"running"===e.status&&t.jsx("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:6,fill:"none",stroke:"#3b82f6",strokeWidth:2,opacity:.5,children:t.jsx("animate",{attributeName:"opacity",values:"0.5;0;0.5",dur:"2s",repeatCount:"indefinite"})}),t.jsx("text",{x:e.x+6,y:e.y+13,fontSize:9,className:"fill-muted-foreground",fontFamily:"monospace",children:e.type}),t.jsx("text",{x:e.x+6,y:e.y+26,fontSize:10,className:"fill-foreground",clipPath:"inset(0 0 0 0)",children:e.label.length>16?e.label.slice(0,16)+"…":e.label}),e.node_id&&t.jsxs("text",{x:e.x+e.w-4,y:e.y+10,fontSize:7,className:"fill-muted-foreground",textAnchor:"end",children:["#",e.node_id]})]},e.id)})]})]}),h&&t.jsxs("div",{className:"absolute bottom-2 left-2 right-2 bg-background/95 border border-border rounded-lg p-3 text-xs shadow-lg z-20",onClick:e=>e.stopPropagation(),children:[t.jsxs("div",{className:"flex justify-between items-start mb-1",children:[t.jsxs("span",{className:"font-mono text-muted-foreground",children:[h.type," L",h.line]}),t.jsx("button",{className:"text-muted-foreground hover:text-foreground",onClick:()=>x(null),children:"✕"})]}),t.jsx("div",{className:"text-foreground mb-1",children:h.label}),h.status&&t.jsxs("div",{className:"text-muted-foreground",children:["状态: ",h.status]}),h.node_id&&t.jsxs("div",{className:"text-muted-foreground",children:["节点 ID: #",h.node_id]})]})]})}function z(e){return 0===e.children.length?e.y+e.h:Math.max(e.y+e.h,...e.children.map(z))}function S({projectId:e,planStatus:m,planNodeUpdate:f,planReplan:g}){const[w,N]=s.useState(null),[C,M]=s.useState(null),[z,S]=s.useState(null),[Y,L]=s.useState(!1);s.useEffect(()=>{let s=!1;return(async()=>{try{const t=await a(e);if(s||N(t),t.hasMainPc){const t=await n(e);s||S(t.tree)}}catch{}})(),()=>{s=!0}},[e]),s.useEffect(()=>{f&&S(e=>e?P(e,f.node_id,f.status):e)},[f]),s.useEffect(()=>{m&&N(e=>e?{...e,state:e.state?{...e.state,...m}:{status:m.status,current_line:m.current_line,executed_tasks:m.executed_tasks,estimated_tasks:m.estimated_tasks}}:e)},[m]),s.useEffect(()=>{0!==g&&n(e).then(e=>S(e.tree)).catch(()=>{})},[g,e]);const X=s.useCallback(async()=>{L(!0);try{await r(e);const s=await a(e);N(s),l.success("Plan Control 已初始化")}catch(s){l.error(s.message)}finally{L(!1)}},[e]),E=s.useCallback(async()=>{L(!0);try{const s=await i(e);if(M(s),s.valid){l.success("语法检查通过");const s=await n(e);S(s.tree)}else l.error(`${s.errors.length} 个语法错误`)}catch(s){l.error(s.message)}finally{L(!1)}},[e]),R=s.useCallback(async()=>{try{await c(e);const s=await a(e);N(s)}catch(s){l.error(s.message)}},[e]),q=s.useCallback(async()=>{try{await o(e)}catch(s){l.error(s.message)}},[e]),D=s.useCallback(async()=>{try{await d(e);const s=await a(e);N(s)}catch(s){l.error(s.message)}},[e]),W=s.useCallback(async()=>{try{await u(e)}catch(s){l.error(s.message)}},[e]),$=null==w?void 0:w.state,A=(null==$?void 0:$.status)??((null==w?void 0:w.hasMainPc)?"ready":(null==w?void 0:w.initialized)?"editing":"none");return t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsxs("div",{className:"flex-none h-8 flex items-center gap-1 px-2 border-b border-border text-xs",children:["none"===A&&t.jsxs(h,{size:"sm",variant:"ghost",className:"h-6 text-xs",onClick:X,disabled:Y,children:[Y?t.jsx(x,{className:"h-3 w-3 animate-spin mr-1"}):null,"初始化"]}),("editing"===A||"ready"===A)&&t.jsxs(t.Fragment,{children:[t.jsxs(h,{size:"sm",variant:"ghost",className:"h-6 text-xs",onClick:E,disabled:Y,children:[Y?t.jsx(x,{className:"h-3 w-3 animate-spin mr-1"}):t.jsx(b,{className:"h-3 w-3 mr-1"}),"检查"]}),(null==C?void 0:C.valid)&&t.jsxs(h,{size:"sm",variant:"ghost",className:"h-6 text-xs",onClick:R,children:[t.jsx(y,{className:"h-3 w-3 mr-1"}),"启动"]})]}),("running"===A||"waiting"===A)&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"text-muted-foreground",children:["已完成 ",(null==$?void 0:$.executed_tasks)??0,"(≥",(null==$?void 0:$.estimated_tasks)??0,")"]}),t.jsx("div",{className:"flex-1"}),t.jsx(h,{size:"sm",variant:"ghost",className:"h-6 text-xs",onClick:q,children:t.jsx(j,{className:"h-3 w-3"})}),t.jsx(h,{size:"sm",variant:"ghost",className:"h-6 text-xs",onClick:W,children:t.jsx(v,{className:"h-3 w-3"})})]}),("paused"===A||"stopped"===A)&&t.jsxs(h,{size:"sm",variant:"ghost",className:"h-6 text-xs",onClick:D,children:[t.jsx(k,{className:"h-3 w-3 mr-1"}),"继续"]}),"completed"===A&&t.jsxs("span",{className:"text-green-500 flex items-center gap-1",children:[t.jsx(b,{className:"h-3 w-3"})," 已完成"]})]}),C&&!C.valid&&t.jsx("div",{className:"flex-none max-h-24 overflow-y-auto px-2 py-1 border-b border-border bg-red-500/5",children:C.errors.map((e,s)=>t.jsxs("div",{className:"text-[10px] text-red-400 flex gap-1",children:[t.jsx(p,{className:"h-3 w-3 flex-shrink-0 mt-0.5"}),t.jsxs("span",{children:["第",e.line,"行: ",e.message]})]},s))}),t.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:z?t.jsx(_,{tree:z,currentLine:(null==$?void 0:$.current_line)??null}):t.jsx("div",{className:"flex items-center justify-center h-full text-xs text-muted-foreground",children:(null==w?void 0:w.initialized)?(null==w?void 0:w.hasMainPc)?'点击"检查"查看任务树':"等待 AI 编写计划...":'点击"初始化"开始'})})]})}function P(e,s,t){return e.map(e=>e.node_id===s?{...e,status:t}:e.children.length>0?{...e,children:P(e.children,s,t)}:e)}export{S as PlanPanel};
@@ -1,13 +0,0 @@
1
- import{c as e,r as t,aw as n,aq as r,aH as o,j as s,ar as a,au as i,at as l,d as c,aI as d,av as u,aJ as f,aK as p,aL as h,aM as m,aN as x,aO as g,aP as y,aQ as v,G as w,aR as b,W as j,Y as N,$ as S,a0 as C,a1 as k,B as R,a2 as P,I as A,a3 as D,aS as T,aT as E,aU as O,aV as _,aW as L,ai as I,aX as M,n as H,T as W,ag as z,aY as B,k as V,S as F,aZ as $,ah as K,a_ as q,H as U,A as X,x as Y,X as G,s as Z,t as Q,a$ as J,b0 as ee,b1 as te,b2 as ne,b3 as re,b4 as oe,b5 as se,b6 as ae}from"./index-nuXK9Vzi.js";import{u as ie,e as le,d as ce,T as de,a as ue,b as fe,c as pe,S as he}from"./index-CYLf1vI2.js";import{C as me}from"./chevron-down-Bn3Wxb1A.js";import{C as xe}from"./chevron-up-DjQ2Kt99.js";
2
- /**
3
- * @license lucide-react v0.309.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */const ge=e("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]),ye=e("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),ve=e("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]),we=e("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),be=e("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]),je=e("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]),Ne=e("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]),Se=e("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]),Ce=e("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);
8
- /**
9
- * @license lucide-react v0.309.0 - ISC
10
- *
11
- * This source code is licensed under the ISC license.
12
- * See the LICENSE file in the root directory of this source tree.
13
- */function ke(e){const n=t.useRef({value:e,previous:e});return t.useMemo(()=>(n.current.value!==e&&(n.current.previous=n.current.value,n.current.value=e),n.current.previous),[e])}function Re(e){const[r,o]=t.useState(void 0);return n(()=>{if(e){o({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const n=t[0];let r,s;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;r=t.inlineSize,s=t.blockSize}else r=e.offsetWidth,s=e.offsetHeight;o({width:r,height:s})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}o(void 0)},[e]),r}var Pe="Switch",[Ae]=l(Pe),[De,Te]=Ae(Pe),Ee=t.forwardRef((e,n)=>{const{__scopeSwitch:l,name:c,checked:d,defaultChecked:u,required:f,disabled:p,value:h="on",onCheckedChange:m,form:x,...g}=e,[y,v]=t.useState(null),w=r(n,e=>v(e)),b=t.useRef(!1),j=!y||(x||!!y.closest("form")),[N,S]=o({prop:d,defaultProp:u??!1,onChange:m,caller:Pe});return s.jsxs(De,{scope:l,checked:N,disabled:p,children:[s.jsx(a.button,{type:"button",role:"switch","aria-checked":N,"aria-required":f,"data-state":Ie(N),"data-disabled":p?"":void 0,disabled:p,value:h,...g,ref:w,onClick:i(e.onClick,e=>{S(e=>!e),j&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})}),j&&s.jsx(Le,{control:y,bubbles:!b.current,name:c,value:h,checked:N,required:f,disabled:p,form:x,style:{transform:"translateX(-100%)"}})]})});Ee.displayName=Pe;var Oe="SwitchThumb",_e=t.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=Te(Oe,n);return s.jsx(a.span,{"data-state":Ie(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});_e.displayName=Oe;var Le=t.forwardRef(({__scopeSwitch:e,control:n,checked:o,bubbles:a=!0,...i},l)=>{const c=t.useRef(null),d=r(c,l),u=ke(o),f=Re(n);return t.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(u!==o&&n){const t=new Event("click",{bubbles:a});n.call(e,o),e.dispatchEvent(t)}},[u,o,a]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o,...i,tabIndex:-1,ref:d,style:{...i.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function Ie(e){return e?"checked":"unchecked"}Le.displayName="SwitchBubbleInput";var Me=Ee,He=_e;const We=t.forwardRef(({className:e,...t},n)=>s.jsx(Me,{className:c("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:s.jsx(He,{className:c("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));We.displayName=Me.displayName;const ze=["top","right","bottom","left"],Be=Math.min,Ve=Math.max,Fe=Math.round,$e=Math.floor,Ke=e=>({x:e,y:e}),qe={left:"right",right:"left",bottom:"top",top:"bottom"};function Ue(e,t,n){return Ve(e,Be(t,n))}function Xe(e,t){return"function"==typeof e?e(t):e}function Ye(e){return e.split("-")[0]}function Ge(e){return e.split("-")[1]}function Ze(e){return"x"===e?"y":"x"}function Qe(e){return"y"===e?"height":"width"}function Je(e){const t=e[0];return"t"===t||"b"===t?"y":"x"}function et(e){return Ze(Je(e))}function tt(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const nt=["left","right"],rt=["right","left"],ot=["top","bottom"],st=["bottom","top"];function at(e,t,n,r){const o=Ge(e);let s=function(e,t,n){switch(e){case"top":case"bottom":return n?t?rt:nt:t?nt:rt;case"left":case"right":return t?ot:st;default:return[]}}(Ye(e),"start"===n,r);return o&&(s=s.map(e=>e+"-"+o),t&&(s=s.concat(s.map(tt)))),s}function it(e){const t=Ye(e);return qe[t]+e.slice(t.length)}function lt(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function ct(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function dt(e,t,n){let{reference:r,floating:o}=e;const s=Je(t),a=et(t),i=Qe(a),l=Ye(t),c="y"===s,d=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,f=r[i]/2-o[i]/2;let p;switch(l){case"top":p={x:d,y:r.y-o.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-o.width,y:u};break;default:p={x:r.x,y:r.y}}switch(Ge(t)){case"start":p[a]-=f*(n&&c?-1:1);break;case"end":p[a]+=f*(n&&c?-1:1)}return p}async function ut(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:s,rects:a,elements:i,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=Xe(t,e),h=lt(p),m=i[f?"floating"===u?"reference":"floating":u],x=ct(await s.getClippingRect({element:null==(n=await(null==s.isElement?void 0:s.isElement(m)))||n?m:m.contextElement||await(null==s.getDocumentElement?void 0:s.getDocumentElement(i.floating)),boundary:c,rootBoundary:d,strategy:l})),g="floating"===u?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,y=await(null==s.getOffsetParent?void 0:s.getOffsetParent(i.floating)),v=await(null==s.isElement?void 0:s.isElement(y))&&await(null==s.getScale?void 0:s.getScale(y))||{x:1,y:1},w=ct(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:g,offsetParent:y,strategy:l}):g);return{top:(x.top-w.top+h.top)/v.y,bottom:(w.bottom-x.bottom+h.bottom)/v.y,left:(x.left-w.left+h.left)/v.x,right:(w.right-x.right+h.right)/v.x}}function ft(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function pt(e){return ze.some(t=>e[t]>=0)}const ht=new Set(["left","top"]);function mt(){return"undefined"!=typeof window}function xt(e){return vt(e)?(e.nodeName||"").toLowerCase():"#document"}function gt(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function yt(e){var t;return null==(t=(vt(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function vt(e){return!!mt()&&(e instanceof Node||e instanceof gt(e).Node)}function wt(e){return!!mt()&&(e instanceof Element||e instanceof gt(e).Element)}function bt(e){return!!mt()&&(e instanceof HTMLElement||e instanceof gt(e).HTMLElement)}function jt(e){return!(!mt()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof gt(e).ShadowRoot)}function Nt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ot(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&"inline"!==o&&"contents"!==o}function St(e){return/^(table|td|th)$/.test(xt(e))}function Ct(e){try{if(e.matches(":popover-open"))return!0}catch(t){}try{return e.matches(":modal")}catch(t){return!1}}const kt=/transform|translate|scale|rotate|perspective|filter/,Rt=/paint|layout|strict|content/,Pt=e=>!!e&&"none"!==e;let At;function Dt(e){const t=wt(e)?Ot(e):e;return Pt(t.transform)||Pt(t.translate)||Pt(t.scale)||Pt(t.rotate)||Pt(t.perspective)||!Tt()&&(Pt(t.backdropFilter)||Pt(t.filter))||kt.test(t.willChange||"")||Rt.test(t.contain||"")}function Tt(){return null==At&&(At="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),At}function Et(e){return/^(html|body|#document)$/.test(xt(e))}function Ot(e){return gt(e).getComputedStyle(e)}function _t(e){return wt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Lt(e){if("html"===xt(e))return e;const t=e.assignedSlot||e.parentNode||jt(e)&&e.host||yt(e);return jt(t)?t.host:t}function It(e){const t=Lt(e);return Et(t)?e.ownerDocument?e.ownerDocument.body:e.body:bt(t)&&Nt(t)?t:It(t)}function Mt(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=It(e),s=o===(null==(r=e.ownerDocument)?void 0:r.body),a=gt(o);if(s){const e=Ht(a);return t.concat(a,a.visualViewport||[],Nt(o)?o:[],e&&n?Mt(e):[])}return t.concat(o,Mt(o,[],n))}function Ht(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Wt(e){const t=Ot(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=bt(e),s=o?e.offsetWidth:n,a=o?e.offsetHeight:r,i=Fe(n)!==s||Fe(r)!==a;return i&&(n=s,r=a),{width:n,height:r,$:i}}function zt(e){return wt(e)?e:e.contextElement}function Bt(e){const t=zt(e);if(!bt(t))return Ke(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Wt(t);let a=(s?Fe(n.width):n.width)/r,i=(s?Fe(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),i&&Number.isFinite(i)||(i=1),{x:a,y:i}}const Vt=Ke(0);function Ft(e){const t=gt(e);return Tt()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Vt}function $t(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),s=zt(e);let a=Ke(1);t&&(r?wt(r)&&(a=Bt(r)):a=Bt(e));const i=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==gt(e))&&t}(s,n,r)?Ft(s):Ke(0);let l=(o.left+i.x)/a.x,c=(o.top+i.y)/a.y,d=o.width/a.x,u=o.height/a.y;if(s){const e=gt(s),t=r&&wt(r)?gt(r):r;let n=e,o=Ht(n);for(;o&&r&&t!==n;){const e=Bt(o),t=o.getBoundingClientRect(),r=Ot(o),s=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,d*=e.x,u*=e.y,l+=s,c+=a,n=gt(o),o=Ht(n)}}return ct({width:d,height:u,x:l,y:c})}function Kt(e,t){const n=_t(e).scrollLeft;return t?t.left+n:$t(yt(e)).left+n}function qt(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Kt(e,n),y:n.top+t.scrollTop}}function Ut(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=gt(e),r=yt(e),o=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,i=0,l=0;if(o){s=o.width,a=o.height;const e=Tt();(!e||e&&"fixed"===t)&&(i=o.offsetLeft,l=o.offsetTop)}const c=Kt(r);if(c<=0){const e=r.ownerDocument,t=e.body,n=getComputedStyle(t),o="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,a=Math.abs(r.clientWidth-t.clientWidth-o);a<=25&&(s-=a)}else c<=25&&(s+=c);return{width:s,height:a,x:i,y:l}}(e,n);else if("document"===t)r=function(e){const t=yt(e),n=_t(e),r=e.ownerDocument.body,o=Ve(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ve(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Kt(e);const i=-n.scrollTop;return"rtl"===Ot(r).direction&&(a+=Ve(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:a,y:i}}(yt(e));else if(wt(t))r=function(e,t){const n=$t(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=bt(e)?Bt(e):Ke(1);return{width:e.clientWidth*s.x,height:e.clientHeight*s.y,x:o*s.x,y:r*s.y}}(t,n);else{const n=Ft(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ct(r)}function Xt(e,t){const n=Lt(e);return!(n===t||!wt(n)||Et(n))&&("fixed"===Ot(n).position||Xt(n,t))}function Yt(e,t,n){const r=bt(t),o=yt(t),s="fixed"===n,a=$t(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const l=Ke(0);function c(){l.x=Kt(o)}if(r||!r&&!s)if(("body"!==xt(t)||Nt(o))&&(i=_t(t)),r){const e=$t(t,!0,s,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&c();s&&!r&&o&&c();const d=!o||r||s?Ke(0):qt(o,i);return{x:a.left+i.scrollLeft-l.x-d.x,y:a.top+i.scrollTop-l.y-d.y,width:a.width,height:a.height}}function Gt(e){return"static"===Ot(e).position}function Zt(e,t){if(!bt(e)||"fixed"===Ot(e).position)return null;if(t)return t(e);let n=e.offsetParent;return yt(e)===n&&(n=n.ownerDocument.body),n}function Qt(e,t){const n=gt(e);if(Ct(e))return n;if(!bt(e)){let t=Lt(e);for(;t&&!Et(t);){if(wt(t)&&!Gt(t))return t;t=Lt(t)}return n}let r=Zt(e,t);for(;r&&St(r)&&Gt(r);)r=Zt(r,t);return r&&Et(r)&&Gt(r)&&!Dt(r)?n:r||function(e){let t=Lt(e);for(;bt(t)&&!Et(t);){if(Dt(t))return t;if(Ct(t))return null;t=Lt(t)}return null}(e)||n}const Jt={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s="fixed"===o,a=yt(r),i=!!t&&Ct(t.floating);if(r===a||i&&s)return n;let l={scrollLeft:0,scrollTop:0},c=Ke(1);const d=Ke(0),u=bt(r);if((u||!u&&!s)&&(("body"!==xt(r)||Nt(a))&&(l=_t(r)),u)){const e=$t(r);c=Bt(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}const f=!a||u||s?Ke(0):qt(a,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+f.x,y:n.y*c.y-l.scrollTop*c.y+d.y+f.y}},getDocumentElement:yt,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[..."clippingAncestors"===n?Ct(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=Mt(e,[],!1).filter(e=>wt(e)&&"body"!==xt(e)),o=null;const s="fixed"===Ot(e).position;let a=s?Lt(e):e;for(;wt(a)&&!Et(a);){const t=Ot(a),n=Dt(a);n||"fixed"!==t.position||(o=null),(s?!n&&!o:!n&&"static"===t.position&&o&&("absolute"===o.position||"fixed"===o.position)||Nt(a)&&!n&&Xt(e,a))?r=r.filter(e=>e!==a):o=t,a=Lt(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=Ut(t,s[0],o);let i=a.top,l=a.right,c=a.bottom,d=a.left;for(let u=1;u<s.length;u++){const e=Ut(t,s[u],o);i=Ve(e.top,i),l=Be(e.right,l),c=Be(e.bottom,c),d=Ve(e.left,d)}return{width:l-d,height:c-i,x:d,y:i}},getOffsetParent:Qt,getElementRects:async function(e){const t=this.getOffsetParent||Qt,n=this.getDimensions,r=await n(e.floating);return{reference:Yt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=Wt(e);return{width:t,height:n}},getScale:Bt,isElement:wt,isRTL:function(e){return"rtl"===Ot(e).direction}};function en(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function tn(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:i="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=zt(e),d=o||s?[...c?Mt(c):[],...t?Mt(t):[]]:[];d.forEach(e=>{o&&e.addEventListener("scroll",n,{passive:!0}),s&&e.addEventListener("resize",n)});const u=c&&i?function(e,t){let n,r=null;const o=yt(e);function s(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(i,l){void 0===i&&(i=!1),void 0===l&&(l=1),s();const c=e.getBoundingClientRect(),{left:d,top:u,width:f,height:p}=c;if(i||t(),!f||!p)return;const h={rootMargin:-$e(u)+"px "+-$e(o.clientWidth-(d+f))+"px "+-$e(o.clientHeight-(u+p))+"px "+-$e(d)+"px",threshold:Ve(0,Be(1,l))||1};let m=!0;function x(t){const r=t[0].intersectionRatio;if(r!==l){if(!m)return a();r?a(!1,r):n=setTimeout(()=>{a(!1,1e-7)},1e3)}1!==r||en(c,e.getBoundingClientRect())||a(),m=!1}try{r=new IntersectionObserver(x,{...h,root:o.ownerDocument})}catch(g){r=new IntersectionObserver(x,h)}r.observe(e)}(!0),s}(c,n):null;let f,p=-1,h=null;a&&(h=new ResizeObserver(e=>{let[r]=e;r&&r.target===c&&h&&t&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=h)||e.observe(t)})),n()}),c&&!l&&h.observe(c),t&&h.observe(t));let m=l?$t(e):null;return l&&function t(){const r=$t(e);m&&!en(m,r)&&n();m=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;d.forEach(e=>{o&&e.removeEventListener("scroll",n),s&&e.removeEventListener("resize",n)}),null==u||u(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(f)}}const nn=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:a,middlewareData:i}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,s=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=Ye(n),i=Ge(n),l="y"===Je(n),c=ht.has(a)?-1:1,d=s&&l?-1:1,u=Xe(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:h}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return i&&"number"==typeof h&&(p="end"===i?-1*h:h),l?{x:p*d,y:f*c}:{x:f*c,y:p*d}}(t,e);return a===(null==(n=i.offset)?void 0:n.placement)&&null!=(r=i.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:s+l.y,data:{...l,placement:a}}}}},rn=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=Xe(e,t),d={x:n,y:r},u=await s.detectOverflow(t,c),f=Je(Ye(o)),p=Ze(f);let h=d[p],m=d[f];if(a){const e="y"===p?"bottom":"right";h=Ue(h+u["y"===p?"top":"left"],h,h-u[e])}if(i){const e="y"===f?"bottom":"right";m=Ue(m+u["y"===f?"top":"left"],m,m-u[e])}const x=l.fn({...t,[p]:h,[f]:m});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[p]:a,[f]:i}}}}}},on=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:a,initialPlacement:i,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...x}=Xe(e,t);if(null!=(n=s.arrow)&&n.alignmentOffset)return{};const g=Ye(o),y=Je(i),v=Ye(i)===i,w=await(null==l.isRTL?void 0:l.isRTL(c.floating)),b=f||(v||!m?[it(i)]:function(e){const t=it(e);return[tt(e),t,tt(t)]}(i)),j="none"!==h;!f&&j&&b.push(...at(i,m,h,w));const N=[i,...b],S=await l.detectOverflow(t,x),C=[];let k=(null==(r=s.flip)?void 0:r.overflows)||[];if(d&&C.push(S[g]),u){const e=function(e,t,n){void 0===n&&(n=!1);const r=Ge(e),o=et(e),s=Qe(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=it(a)),[a,it(a)]}(o,a,w);C.push(S[e[0]],S[e[1]])}if(k=[...k,{placement:o,overflows:C}],!C.every(e=>e<=0)){var R,P;const e=((null==(R=s.flip)?void 0:R.index)||0)+1,t=N[e];if(t){if(!("alignment"===u&&y!==Je(t))||k.every(e=>Je(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:k},reset:{placement:t}}}let n=null==(P=k.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:P.placement;if(!n)switch(p){case"bestFit":{var A;const e=null==(A=k.filter(e=>{if(j){const t=Je(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:A[0];e&&(n=e);break}case"initialPlacement":n=i}if(o!==n)return{reset:{placement:n}}}return{}}}},sn=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:a,elements:i}=t,{apply:l=()=>{},...c}=Xe(e,t),d=await a.detectOverflow(t,c),u=Ye(o),f=Ge(o),p="y"===Je(o),{width:h,height:m}=s.floating;let x,g;"top"===u||"bottom"===u?(x=u,g=f===(await(null==a.isRTL?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(g=u,x="end"===f?"top":"bottom");const y=m-d.top-d.bottom,v=h-d.left-d.right,w=Be(m-d[x],y),b=Be(h-d[g],v),j=!t.middlewareData.shift;let N=w,S=b;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(S=v),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(N=y),j&&!f){const e=Ve(d.left,0),t=Ve(d.right,0),n=Ve(d.top,0),r=Ve(d.bottom,0);p?S=h-2*(0!==e||0!==t?e+t:Ve(d.left,d.right)):N=m-2*(0!==n||0!==r?n+r:Ve(d.top,d.bottom))}await l({...t,availableWidth:S,availableHeight:N});const C=await a.getDimensions(i.floating);return h!==C.width||m!==C.height?{reset:{rects:!0}}:{}}}},an=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=Xe(e,t);switch(o){case"referenceHidden":{const e=ft(await r.detectOverflow(t,{...s,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:pt(e)}}}case"escaped":{const e=ft(await r.detectOverflow(t,{...s,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:pt(e)}}}default:return{}}}}},ln=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:a,elements:i,middlewareData:l}=t,{element:c,padding:d=0}=Xe(e,t)||{};if(null==c)return{};const u=lt(d),f={x:n,y:r},p=et(o),h=Qe(p),m=await a.getDimensions(c),x="y"===p,g=x?"top":"left",y=x?"bottom":"right",v=x?"clientHeight":"clientWidth",w=s.reference[h]+s.reference[p]-f[p]-s.floating[h],b=f[p]-s.reference[p],j=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let N=j?j[v]:0;N&&await(null==a.isElement?void 0:a.isElement(j))||(N=i.floating[v]||s.floating[h]);const S=w/2-b/2,C=N/2-m[h]/2-1,k=Be(u[g],C),R=Be(u[y],C),P=k,A=N-m[h]-R,D=N/2-m[h]/2+S,T=Ue(P,D,A),E=!l.arrow&&null!=Ge(o)&&D!==T&&s.reference[h]/2-(D<P?k:R)-m[h]/2<0,O=E?D<P?D-P:D-A:0;return{[p]:f[p]+O,data:{[p]:T,centerOffset:D-T-O,...E&&{alignmentOffset:O}},reset:E}}}),cn=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:a}=t,{offset:i=0,mainAxis:l=!0,crossAxis:c=!0}=Xe(e,t),d={x:n,y:r},u=Je(o),f=Ze(u);let p=d[f],h=d[u];const m=Xe(i,t),x="number"==typeof m?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const e="y"===f?"height":"width",t=s.reference[f]-s.floating[e]+x.mainAxis,n=s.reference[f]+s.reference[e]-x.mainAxis;p<t?p=t:p>n&&(p=n)}if(c){var g,y;const e="y"===f?"width":"height",t=ht.has(Ye(o)),n=s.reference[u]-s.floating[e]+(t&&(null==(g=a.offset)?void 0:g[u])||0)+(t?0:x.crossAxis),r=s.reference[u]+s.reference[e]+(t?0:(null==(y=a.offset)?void 0:y[u])||0)-(t?x.crossAxis:0);h<n?h=n:h>r&&(h=r)}return{[f]:p,[u]:h}}}},dn=(e,t,n)=>{const r=new Map,o={platform:Jt,...n},s={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:a}=n,i=a.detectOverflow?a:{...a,detectOverflow:ut},l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:u}=dt(c,r,l),f=r,p=0;const h={};for(let m=0;m<s.length;m++){const n=s[m];if(!n)continue;const{name:x,fn:g}=n,{x:y,y:v,data:w,reset:b}=await g({x:d,y:u,initialPlacement:r,placement:f,strategy:o,middlewareData:h,rects:c,platform:i,elements:{reference:e,floating:t}});d=null!=y?y:d,u=null!=v?v:u,h[x]={...h[x],...w},b&&p<50&&(p++,"object"==typeof b&&(b.placement&&(f=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:d,y:u}=dt(c,f,l))),m=-1)}return{x:d,y:u,placement:f,strategy:o,middlewareData:h}})(e,t,{...o,platform:s})};var un="undefined"!=typeof document?t.useLayoutEffect:function(){};function fn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!fn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!==r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!fn(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function pn(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function hn(e,t){const n=pn(e);return Math.round(t*n)/n}function mn(e){const n=t.useRef(e);return un(()=>{n.current=e}),n}const xn=(e,t)=>{const n=nn(e);return{name:n.name,fn:n.fn,options:[e,t]}},gn=(e,t)=>{const n=rn(e);return{name:n.name,fn:n.fn,options:[e,t]}},yn=(e,t)=>{const n=on(e);return{name:n.name,fn:n.fn,options:[e,t]}},vn=(e,t)=>{const n=sn(e);return{name:n.name,fn:n.fn,options:[e,t]}},wn=(e,t)=>{const n=an(e);return{name:n.name,fn:n.fn,options:[e,t]}},bn=(e,t)=>{const n=(e=>({name:"arrow",options:e,fn(t){const{element:n,padding:r}="function"==typeof e?e(t):e;return n&&(o=n,{}.hasOwnProperty.call(o,"current"))?null!=n.current?ln({element:n.current,padding:r}).fn(t):{}:n?ln({element:n,padding:r}).fn(t):{};var o}}))(e);return{name:n.name,fn:n.fn,options:[e,t]}};var jn=t.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return s.jsx(a.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});jn.displayName="Arrow";var Nn=jn,Sn="Popper",[Cn,kn]=l(Sn),[Rn,Pn]=Cn(Sn),An=e=>{const{__scopePopper:n,children:r}=e,[o,a]=t.useState(null);return s.jsx(Rn,{scope:n,anchor:o,onAnchorChange:a,children:r})};An.displayName=Sn;var Dn="PopperAnchor",Tn=t.forwardRef((e,n)=>{const{__scopePopper:o,virtualRef:i,...l}=e,c=Pn(Dn,o),d=t.useRef(null),u=r(n,d),f=t.useRef(null);return t.useEffect(()=>{const e=f.current;f.current=(null==i?void 0:i.current)||d.current,e!==f.current&&c.onAnchorChange(f.current)}),i?null:s.jsx(a.div,{...l,ref:u})});Tn.displayName=Dn;var En="PopperContent",[On,_n]=Cn(En),Ln=t.forwardRef((e,o)=>{var i,l,c,f,p,h;const{__scopePopper:m,side:x="bottom",sideOffset:g=0,align:y="center",alignOffset:v=0,arrowPadding:w=0,avoidCollisions:b=!0,collisionBoundary:j=[],collisionPadding:N=0,sticky:S="partial",hideWhenDetached:C=!1,updatePositionStrategy:k="optimized",onPlaced:R,...P}=e,A=Pn(En,m),[D,T]=t.useState(null),E=r(o,e=>T(e)),[O,_]=t.useState(null),L=Re(O),I=(null==L?void 0:L.width)??0,M=(null==L?void 0:L.height)??0,H=x+("center"!==y?"-"+y:""),W="number"==typeof N?N:{top:0,right:0,bottom:0,left:0,...N},z=Array.isArray(j)?j:[j],B=z.length>0,V={padding:W,boundary:z.filter(Wn),altBoundary:B},{refs:F,floatingStyles:$,placement:K,isPositioned:q,middlewareData:U}=function(e){void 0===e&&(e={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:s,elements:{reference:a,floating:i}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[f,p]=t.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[h,m]=t.useState(o);fn(h,o)||m(o);const[x,g]=t.useState(null),[y,v]=t.useState(null),w=t.useCallback(e=>{e!==S.current&&(S.current=e,g(e))},[]),b=t.useCallback(e=>{e!==C.current&&(C.current=e,v(e))},[]),j=a||x,N=i||y,S=t.useRef(null),C=t.useRef(null),k=t.useRef(f),R=null!=c,P=mn(c),A=mn(s),D=mn(u),T=t.useCallback(()=>{if(!S.current||!C.current)return;const e={placement:n,strategy:r,middleware:h};A.current&&(e.platform=A.current),dn(S.current,C.current,e).then(e=>{const t={...e,isPositioned:!1!==D.current};E.current&&!fn(k.current,t)&&(k.current=t,d.flushSync(()=>{p(t)}))})},[h,n,r,A,D]);un(()=>{!1===u&&k.current.isPositioned&&(k.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[u]);const E=t.useRef(!1);un(()=>(E.current=!0,()=>{E.current=!1}),[]),un(()=>{if(j&&(S.current=j),N&&(C.current=N),j&&N){if(P.current)return P.current(j,N,T);T()}},[j,N,T,P,R]);const O=t.useMemo(()=>({reference:S,floating:C,setReference:w,setFloating:b}),[w,b]),_=t.useMemo(()=>({reference:j,floating:N}),[j,N]),L=t.useMemo(()=>{const e={position:r,left:0,top:0};if(!_.floating)return e;const t=hn(_.floating,f.x),n=hn(_.floating,f.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...pn(_.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,_.floating,f.x,f.y]);return t.useMemo(()=>({...f,update:T,refs:O,elements:_,floatingStyles:L}),[f,T,O,_,L])}({strategy:"fixed",placement:H,whileElementsMounted:(...e)=>tn(...e,{animationFrame:"always"===k}),elements:{reference:A.anchor},middleware:[xn({mainAxis:g+M,alignmentAxis:v}),b&&gn({mainAxis:!0,crossAxis:!1,limiter:"partial"===S?{fn:cn(X).fn,options:[X,Y]}:void 0,...V}),b&&yn({...V}),vn({...V,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:o,height:s}=t.reference,a=e.floating.style;a.setProperty("--radix-popper-available-width",`${n}px`),a.setProperty("--radix-popper-available-height",`${r}px`),a.setProperty("--radix-popper-anchor-width",`${o}px`),a.setProperty("--radix-popper-anchor-height",`${s}px`)}}),O&&bn({element:O,padding:w}),zn({arrowWidth:I,arrowHeight:M}),C&&wn({strategy:"referenceHidden",...V})]});var X,Y;const[G,Z]=Bn(K),Q=u(R);n(()=>{q&&(null==Q||Q())},[q,Q]);const J=null==(i=U.arrow)?void 0:i.x,ee=null==(l=U.arrow)?void 0:l.y,te=0!==(null==(c=U.arrow)?void 0:c.centerOffset),[ne,re]=t.useState();return n(()=>{D&&re(window.getComputedStyle(D).zIndex)},[D]),s.jsx("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:q?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ne,"--radix-popper-transform-origin":[null==(f=U.transformOrigin)?void 0:f.x,null==(p=U.transformOrigin)?void 0:p.y].join(" "),...(null==(h=U.hide)?void 0:h.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(On,{scope:m,placedSide:G,onArrowChange:_,arrowX:J,arrowY:ee,shouldHideArrow:te,children:s.jsx(a.div,{"data-side":G,"data-align":Z,...P,ref:E,style:{...P.style,animation:q?void 0:"none"}})})})});Ln.displayName=En;var In="PopperArrow",Mn={top:"bottom",right:"left",bottom:"top",left:"right"},Hn=t.forwardRef(function(e,t){const{__scopePopper:n,...r}=e,o=_n(In,n),a=Mn[o.placedSide];return s.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:s.jsx(Nn,{...r,ref:t,style:{...r.style,display:"block"}})})});function Wn(e){return null!==e}Hn.displayName=In;var zn=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o;const{placement:s,rects:a,middlewareData:i}=t,l=0!==(null==(n=i.arrow)?void 0:n.centerOffset),c=l?0:e.arrowWidth,d=l?0:e.arrowHeight,[u,f]=Bn(s),p={start:"0%",center:"50%",end:"100%"}[f],h=((null==(r=i.arrow)?void 0:r.x)??0)+c/2,m=((null==(o=i.arrow)?void 0:o.y)??0)+d/2;let x="",g="";return"bottom"===u?(x=l?p:`${h}px`,g=-d+"px"):"top"===u?(x=l?p:`${h}px`,g=`${a.floating.height+d}px`):"right"===u?(x=-d+"px",g=l?p:`${m}px`):"left"===u&&(x=`${a.floating.width+d}px`,g=l?p:`${m}px`),{data:{x:x,y:g}}}});function Bn(e){const[t,n="center"]=e.split("-");return[t,n]}var Vn=An,Fn=Tn,$n=Ln,Kn=Hn;function qn(e){const n=Un(e),r=t.forwardRef((e,r)=>{const{children:o,...a}=e,i=t.Children.toArray(o),l=i.find(Yn);if(l){const e=l.props.children,o=i.map(n=>n===l?t.Children.count(e)>1?t.Children.only(null):t.isValidElement(e)?e.props.children:null:n);return s.jsx(n,{...a,ref:r,children:t.isValidElement(e)?t.cloneElement(e,void 0,o):null})}return s.jsx(n,{...a,ref:r,children:o})});return r.displayName=`${e}.Slot`,r}function Un(e){const n=t.forwardRef((e,n)=>{const{children:r,...o}=e;if(t.isValidElement(r)){const e=function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...e)=>{const t=s(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...s}:"className"===r&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}(o,r.props);return r.type!==t.Fragment&&(s.ref=n?f(n,e):e),t.cloneElement(r,s)}return t.Children.count(r)>1?t.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}var Xn=Symbol("radix.slottable");function Yn(e){return t.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Xn}var Gn=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});t.forwardRef((e,t)=>s.jsx(a.span,{...e,ref:t,style:{...Gn,...e.style}})).displayName="VisuallyHidden";var Zn=[" ","Enter","ArrowUp","ArrowDown"],Qn=[" ","Enter"],Jn="Select",[er,tr,nr]=le(Jn),[rr]=l(Jn,[nr,kn]),or=kn(),[sr,ar]=rr(Jn),[ir,lr]=rr(Jn),cr=e=>{const{__scopeSelect:n,children:r,open:a,defaultOpen:i,onOpenChange:l,value:c,defaultValue:d,onValueChange:u,dir:f,name:h,autoComplete:m,disabled:x,required:g,form:y}=e,v=or(n),[w,b]=t.useState(null),[j,N]=t.useState(null),[S,C]=t.useState(!1),k=ie(f),[R,P]=o({prop:a,defaultProp:i??!1,onChange:l,caller:Jn}),[A,D]=o({prop:c,defaultProp:d,onChange:u,caller:Jn}),T=t.useRef(null),E=!w||(y||!!w.closest("form")),[O,_]=t.useState(new Set),L=Array.from(O).map(e=>e.props.value).join(";");return s.jsx(Vn,{...v,children:s.jsxs(sr,{required:g,scope:n,trigger:w,onTriggerChange:b,valueNode:j,onValueNodeChange:N,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:p(),value:A,onValueChange:D,open:R,onOpenChange:P,dir:k,triggerPointerDownPosRef:T,disabled:x,children:[s.jsx(er.Provider,{scope:n,children:s.jsx(ir,{scope:e.__scopeSelect,onNativeOptionAdd:t.useCallback(e=>{_(t=>new Set(t).add(e))},[]),onNativeOptionRemove:t.useCallback(e=>{_(t=>{const n=new Set(t);return n.delete(e),n})},[]),children:r})}),E?s.jsxs(Yr,{"aria-hidden":!0,required:g,tabIndex:-1,name:h,autoComplete:m,value:A,onChange:e=>D(e.target.value),disabled:x,form:y,children:[void 0===A?s.jsx("option",{value:""}):null,Array.from(O)]},L):null]})})};cr.displayName=Jn;var dr="SelectTrigger",ur=t.forwardRef((e,n)=>{const{__scopeSelect:o,disabled:l=!1,...c}=e,d=or(o),u=ar(dr,o),f=u.disabled||l,p=r(n,u.onTriggerChange),h=tr(o),m=t.useRef("touch"),[x,g,y]=Zr(e=>{const t=h().filter(e=>!e.disabled),n=t.find(e=>e.value===u.value),r=Qr(t,e,n);void 0!==r&&u.onValueChange(r.value)}),v=e=>{f||(u.onOpenChange(!0),y()),e&&(u.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return s.jsx(Fn,{asChild:!0,...d,children:s.jsx(a.button,{type:"button",role:"combobox","aria-controls":u.contentId,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:f,"data-disabled":f?"":void 0,"data-placeholder":Gr(u.value)?"":void 0,...c,ref:p,onClick:i(c.onClick,e=>{e.currentTarget.focus(),"mouse"!==m.current&&v(e)}),onPointerDown:i(c.onPointerDown,e=>{m.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(v(e),e.preventDefault())}),onKeyDown:i(c.onKeyDown,e=>{const t=""!==x.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||g(e.key),t&&" "===e.key||Zn.includes(e.key)&&(v(),e.preventDefault())})})})});ur.displayName=dr;var fr="SelectValue",pr=t.forwardRef((e,t)=>{const{__scopeSelect:o,className:i,style:l,children:c,placeholder:d="",...u}=e,f=ar(fr,o),{onValueNodeHasChildrenChange:p}=f,h=void 0!==c,m=r(t,f.onValueNodeChange);return n(()=>{p(h)},[p,h]),s.jsx(a.span,{...u,ref:m,style:{pointerEvents:"none"},children:Gr(f.value)?s.jsx(s.Fragment,{children:d}):c})});pr.displayName=fr;var hr=t.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return s.jsx(a.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});hr.displayName="SelectIcon";var mr=e=>s.jsx(h,{asChild:!0,...e});mr.displayName="SelectPortal";var xr="SelectContent",gr=t.forwardRef((e,r)=>{const o=ar(xr,e.__scopeSelect),[a,i]=t.useState();if(n(()=>{i(new DocumentFragment)},[]),!o.open){const t=a;return t?d.createPortal(s.jsx(vr,{scope:e.__scopeSelect,children:s.jsx(er.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),t):null}return s.jsx(jr,{...e,ref:r})});gr.displayName=xr;var yr=10,[vr,wr]=rr(xr),br=qn("SelectContent.RemoveScroll"),jr=t.forwardRef((e,n)=>{const{__scopeSelect:o,position:a="item-aligned",onCloseAutoFocus:l,onEscapeKeyDown:c,onPointerDownOutside:d,side:u,sideOffset:f,align:p,alignOffset:h,arrowPadding:w,collisionBoundary:b,collisionPadding:j,sticky:N,hideWhenDetached:S,avoidCollisions:C,...k}=e,R=ar(xr,o),[P,A]=t.useState(null),[D,T]=t.useState(null),E=r(n,e=>A(e)),[O,_]=t.useState(null),[L,I]=t.useState(null),M=tr(o),[H,W]=t.useState(!1),z=t.useRef(!1);t.useEffect(()=>{if(P)return m(P)},[P]),x();const B=t.useCallback(e=>{const[t,...n]=M().map(e=>e.ref.current),[r]=n.slice(-1),o=document.activeElement;for(const s of e){if(s===o)return;if(null==s||s.scrollIntoView({block:"nearest"}),s===t&&D&&(D.scrollTop=0),s===r&&D&&(D.scrollTop=D.scrollHeight),null==s||s.focus(),document.activeElement!==o)return}},[M,D]),V=t.useCallback(()=>B([O,P]),[B,O,P]);t.useEffect(()=>{H&&V()},[H,V]);const{onOpenChange:F,triggerPointerDownPosRef:$}=R;t.useEffect(()=>{if(P){let e={x:0,y:0};const t=t=>{var n,r;e={x:Math.abs(Math.round(t.pageX)-((null==(n=$.current)?void 0:n.x)??0)),y:Math.abs(Math.round(t.pageY)-((null==(r=$.current)?void 0:r.y)??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():P.contains(n.target)||F(!1),document.removeEventListener("pointermove",t),$.current=null};return null!==$.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}},[P,F,$]),t.useEffect(()=>{const e=()=>F(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[F]);const[K,q]=Zr(e=>{const t=M().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),r=Qr(t,e,n);r&&setTimeout(()=>r.ref.current.focus())}),U=t.useCallback((e,t,n)=>{const r=!z.current&&!n;(void 0!==R.value&&R.value===t||r)&&(_(e),r&&(z.current=!0))},[R.value]),X=t.useCallback(()=>null==P?void 0:P.focus(),[P]),Y=t.useCallback((e,t,n)=>{const r=!z.current&&!n;(void 0!==R.value&&R.value===t||r)&&I(e)},[R.value]),G="popper"===a?Sr:Nr,Z=G===Sr?{side:u,sideOffset:f,align:p,alignOffset:h,arrowPadding:w,collisionBoundary:b,collisionPadding:j,sticky:N,hideWhenDetached:S,avoidCollisions:C}:{};return s.jsx(vr,{scope:o,content:P,viewport:D,onViewportChange:T,itemRefCallback:U,selectedItem:O,onItemLeave:X,itemTextRefCallback:Y,focusSelectedItem:V,selectedItemText:L,position:a,isPositioned:H,searchRef:K,children:s.jsx(g,{as:br,allowPinchZoom:!0,children:s.jsx(y,{asChild:!0,trapped:R.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:i(l,e=>{var t;null==(t=R.trigger)||t.focus({preventScroll:!0}),e.preventDefault()}),children:s.jsx(v,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>R.onOpenChange(!1),children:s.jsx(G,{role:"listbox",id:R.contentId,"data-state":R.open?"open":"closed",dir:R.dir,onContextMenu:e=>e.preventDefault(),...k,...Z,onPlaced:()=>W(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:i(k.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||q(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=M().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>B(t)),e.preventDefault()}})})})})})})});jr.displayName="SelectContentImpl";var Nr=t.forwardRef((e,o)=>{const{__scopeSelect:i,onPlaced:l,...c}=e,d=ar(xr,i),u=wr(xr,i),[f,p]=t.useState(null),[h,m]=t.useState(null),x=r(o,e=>m(e)),g=tr(i),y=t.useRef(!1),v=t.useRef(!0),{viewport:w,selectedItem:b,selectedItemText:j,focusSelectedItem:N}=u,S=t.useCallback(()=>{if(d.trigger&&d.valueNode&&f&&h&&w&&b&&j){const e=d.trigger.getBoundingClientRect(),t=h.getBoundingClientRect(),n=d.valueNode.getBoundingClientRect(),r=j.getBoundingClientRect();if("rtl"!==d.dir){const o=r.left-t.left,s=n.left-o,a=e.left-s,i=e.width+a,l=Math.max(i,t.width),c=window.innerWidth-yr,d=ce(s,[yr,Math.max(yr,c-l)]);f.style.minWidth=i+"px",f.style.left=d+"px"}else{const o=t.right-r.right,s=window.innerWidth-n.right-o,a=window.innerWidth-e.right-s,i=e.width+a,l=Math.max(i,t.width),c=window.innerWidth-yr,d=ce(s,[yr,Math.max(yr,c-l)]);f.style.minWidth=i+"px",f.style.right=d+"px"}const o=g(),s=window.innerHeight-2*yr,a=w.scrollHeight,i=window.getComputedStyle(h),c=parseInt(i.borderTopWidth,10),u=parseInt(i.paddingTop,10),p=parseInt(i.borderBottomWidth,10),m=c+u+a+parseInt(i.paddingBottom,10)+p,x=Math.min(5*b.offsetHeight,m),v=window.getComputedStyle(w),N=parseInt(v.paddingTop,10),S=parseInt(v.paddingBottom,10),C=e.top+e.height/2-yr,k=s-C,R=b.offsetHeight/2,P=c+u+(b.offsetTop+R),A=m-P;if(P<=C){const e=o.length>0&&b===o[o.length-1].ref.current;f.style.bottom="0px";const t=h.clientHeight-w.offsetTop-w.offsetHeight,n=P+Math.max(k,R+(e?S:0)+t+p);f.style.height=n+"px"}else{const e=o.length>0&&b===o[0].ref.current;f.style.top="0px";const t=Math.max(C,c+w.offsetTop+(e?N:0)+R)+A;f.style.height=t+"px",w.scrollTop=P-C+w.offsetTop}f.style.margin=`${yr}px 0`,f.style.minHeight=x+"px",f.style.maxHeight=s+"px",null==l||l(),requestAnimationFrame(()=>y.current=!0)}},[g,d.trigger,d.valueNode,f,h,w,b,j,d.dir,l]);n(()=>S(),[S]);const[C,k]=t.useState();n(()=>{h&&k(window.getComputedStyle(h).zIndex)},[h]);const R=t.useCallback(e=>{e&&!0===v.current&&(S(),null==N||N(),v.current=!1)},[S,N]);return s.jsx(Cr,{scope:i,contentWrapper:f,shouldExpandOnScrollRef:y,onScrollButtonChange:R,children:s.jsx("div",{ref:p,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:s.jsx(a.div,{...c,ref:x,style:{boxSizing:"border-box",maxHeight:"100%",...c.style}})})})});Nr.displayName="SelectItemAlignedPosition";var Sr=t.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=yr,...a}=e,i=or(n);return s.jsx($n,{...i,...a,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Sr.displayName="SelectPopperPosition";var[Cr,kr]=rr(xr,{}),Rr="SelectViewport",Pr=t.forwardRef((e,n)=>{const{__scopeSelect:o,nonce:l,...c}=e,d=wr(Rr,o),u=kr(Rr,o),f=r(n,d.onViewportChange),p=t.useRef(0);return s.jsxs(s.Fragment,{children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:l}),s.jsx(er.Slot,{scope:o,children:s.jsx(a.div,{"data-radix-select-viewport":"",role:"presentation",...c,ref:f,style:{position:"relative",flex:1,overflow:"hidden auto",...c.style},onScroll:i(c.onScroll,e=>{const t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=u;if((null==r?void 0:r.current)&&n){const e=Math.abs(p.current-t.scrollTop);if(e>0){const r=window.innerHeight-2*yr,o=parseFloat(n.style.minHeight),s=parseFloat(n.style.height),a=Math.max(o,s);if(a<r){const o=a+e,s=Math.min(r,o),i=o-s;n.style.height=s+"px","0px"===n.style.bottom&&(t.scrollTop=i>0?i:0,n.style.justifyContent="flex-end")}}}p.current=t.scrollTop})})})]})});Pr.displayName=Rr;var Ar="SelectGroup",[Dr,Tr]=rr(Ar);t.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=p();return s.jsx(Dr,{scope:n,id:o,children:s.jsx(a.div,{role:"group","aria-labelledby":o,...r,ref:t})})}).displayName=Ar;var Er="SelectLabel",Or=t.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Tr(Er,n);return s.jsx(a.div,{id:o.id,...r,ref:t})});Or.displayName=Er;var _r="SelectItem",[Lr,Ir]=rr(_r),Mr=t.forwardRef((e,n)=>{const{__scopeSelect:o,value:l,disabled:c=!1,textValue:d,...u}=e,f=ar(_r,o),h=wr(_r,o),m=f.value===l,[x,g]=t.useState(d??""),[y,v]=t.useState(!1),w=r(n,e=>{var t;return null==(t=h.itemRefCallback)?void 0:t.call(h,e,l,c)}),b=p(),j=t.useRef("touch"),N=()=>{c||(f.onValueChange(l),f.onOpenChange(!1))};if(""===l)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return s.jsx(Lr,{scope:o,value:l,disabled:c,textId:b,isSelected:m,onItemTextChange:t.useCallback(e=>{g(t=>t||((null==e?void 0:e.textContent)??"").trim())},[]),children:s.jsx(er.ItemSlot,{scope:o,value:l,disabled:c,textValue:x,children:s.jsx(a.div,{role:"option","aria-labelledby":b,"data-highlighted":y?"":void 0,"aria-selected":m&&y,"data-state":m?"checked":"unchecked","aria-disabled":c||void 0,"data-disabled":c?"":void 0,tabIndex:c?void 0:-1,...u,ref:w,onFocus:i(u.onFocus,()=>v(!0)),onBlur:i(u.onBlur,()=>v(!1)),onClick:i(u.onClick,()=>{"mouse"!==j.current&&N()}),onPointerUp:i(u.onPointerUp,()=>{"mouse"===j.current&&N()}),onPointerDown:i(u.onPointerDown,e=>{j.current=e.pointerType}),onPointerMove:i(u.onPointerMove,e=>{var t;j.current=e.pointerType,c?null==(t=h.onItemLeave)||t.call(h):"mouse"===j.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:i(u.onPointerLeave,e=>{var t;e.currentTarget===document.activeElement&&(null==(t=h.onItemLeave)||t.call(h))}),onKeyDown:i(u.onKeyDown,e=>{var t;""!==(null==(t=h.searchRef)?void 0:t.current)&&" "===e.key||(Qn.includes(e.key)&&N()," "===e.key&&e.preventDefault())})})})})});Mr.displayName=_r;var Hr="SelectItemText",Wr=t.forwardRef((e,o)=>{const{__scopeSelect:i,className:l,style:c,...u}=e,f=ar(Hr,i),p=wr(Hr,i),h=Ir(Hr,i),m=lr(Hr,i),[x,g]=t.useState(null),y=r(o,e=>g(e),h.onItemTextChange,e=>{var t;return null==(t=p.itemTextRefCallback)?void 0:t.call(p,e,h.value,h.disabled)}),v=null==x?void 0:x.textContent,w=t.useMemo(()=>s.jsx("option",{value:h.value,disabled:h.disabled,children:v},h.value),[h.disabled,h.value,v]),{onNativeOptionAdd:b,onNativeOptionRemove:j}=m;return n(()=>(b(w),()=>j(w)),[b,j,w]),s.jsxs(s.Fragment,{children:[s.jsx(a.span,{id:h.textId,...u,ref:y}),h.isSelected&&f.valueNode&&!f.valueNodeHasChildren?d.createPortal(u.children,f.valueNode):null]})});Wr.displayName=Hr;var zr="SelectItemIndicator",Br=t.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Ir(zr,n).isSelected?s.jsx(a.span,{"aria-hidden":!0,...r,ref:t}):null});Br.displayName=zr;var Vr="SelectScrollUpButton",Fr=t.forwardRef((e,o)=>{const a=wr(Vr,e.__scopeSelect),i=kr(Vr,e.__scopeSelect),[l,c]=t.useState(!1),d=r(o,i.onScrollButtonChange);return n(()=>{if(a.viewport&&a.isPositioned){let e=function(){const e=t.scrollTop>0;c(e)};const t=a.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[a.viewport,a.isPositioned]),l?s.jsx(qr,{...e,ref:d,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=a;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});Fr.displayName=Vr;var $r="SelectScrollDownButton",Kr=t.forwardRef((e,o)=>{const a=wr($r,e.__scopeSelect),i=kr($r,e.__scopeSelect),[l,c]=t.useState(!1),d=r(o,i.onScrollButtonChange);return n(()=>{if(a.viewport&&a.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;c(n)};const t=a.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[a.viewport,a.isPositioned]),l?s.jsx(qr,{...e,ref:d,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=a;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});Kr.displayName=$r;var qr=t.forwardRef((e,r)=>{const{__scopeSelect:o,onAutoScroll:l,...c}=e,d=wr("SelectScrollButton",o),u=t.useRef(null),f=tr(o),p=t.useCallback(()=>{null!==u.current&&(window.clearInterval(u.current),u.current=null)},[]);return t.useEffect(()=>()=>p(),[p]),n(()=>{var e;const t=f().find(e=>e.ref.current===document.activeElement);null==(e=null==t?void 0:t.ref.current)||e.scrollIntoView({block:"nearest"})},[f]),s.jsx(a.div,{"aria-hidden":!0,...c,ref:r,style:{flexShrink:0,...c.style},onPointerDown:i(c.onPointerDown,()=>{null===u.current&&(u.current=window.setInterval(l,50))}),onPointerMove:i(c.onPointerMove,()=>{var e;null==(e=d.onItemLeave)||e.call(d),null===u.current&&(u.current=window.setInterval(l,50))}),onPointerLeave:i(c.onPointerLeave,()=>{p()})})}),Ur=t.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return s.jsx(a.div,{"aria-hidden":!0,...r,ref:t})});Ur.displayName="SelectSeparator";var Xr="SelectArrow";t.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=or(n),a=ar(Xr,n),i=wr(Xr,n);return a.open&&"popper"===i.position?s.jsx(Kn,{...o,...r,ref:t}):null}).displayName=Xr;var Yr=t.forwardRef(({__scopeSelect:e,value:n,...o},i)=>{const l=t.useRef(null),c=r(i,l),d=ke(n);return t.useEffect(()=>{const e=l.current;if(!e)return;const t=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(t,"value").set;if(d!==n&&r){const t=new Event("change",{bubbles:!0});r.call(e,n),e.dispatchEvent(t)}},[d,n]),s.jsx(a.select,{...o,style:{...Gn,...o.style},ref:c,defaultValue:n})});function Gr(e){return""===e||void 0===e}function Zr(e){const n=u(e),r=t.useRef(""),o=t.useRef(0),s=t.useCallback(e=>{const t=r.current+e;n(t),function e(t){r.current=t,window.clearTimeout(o.current),""!==t&&(o.current=window.setTimeout(()=>e(""),1e3))}(t)},[n]),a=t.useCallback(()=>{r.current="",window.clearTimeout(o.current)},[]);return t.useEffect(()=>()=>window.clearTimeout(o.current),[]),[r,s,a]}function Qr(e,t,n){const r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let s=(a=e,i=Math.max(o,0),a.map((e,t)=>a[(i+t)%a.length]));var a,i;1===r.length&&(s=s.filter(e=>e!==n));const l=s.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}Yr.displayName="SelectBubbleInput";var Jr=ur,eo=hr,to=mr,no=gr,ro=Pr,oo=Or,so=Mr,ao=Wr,io=Br,lo=Fr,co=Kr,uo=Ur;const fo=cr,po=pr,ho=t.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(Jr,{ref:r,className:c("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,s.jsx(eo,{asChild:!0,children:s.jsx(me,{className:"h-4 w-4 opacity-50"})})]}));ho.displayName=Jr.displayName;const mo=t.forwardRef(({className:e,...t},n)=>s.jsx(lo,{ref:n,className:c("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(xe,{className:"h-4 w-4"})}));mo.displayName=lo.displayName;const xo=t.forwardRef(({className:e,...t},n)=>s.jsx(co,{ref:n,className:c("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(me,{className:"h-4 w-4"})}));xo.displayName=co.displayName;const go=t.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>s.jsx(to,{children:s.jsxs(no,{ref:o,className:c("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[s.jsx(mo,{}),s.jsx(ro,{className:c("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(xo,{})]})}));go.displayName=no.displayName;t.forwardRef(({className:e,...t},n)=>s.jsx(oo,{ref:n,className:c("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t})).displayName=oo.displayName;const yo=t.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(so,{ref:r,className:c("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(io,{children:s.jsx(w,{className:"h-4 w-4"})})}),s.jsx(ao,{children:t})]}));yo.displayName=so.displayName;t.forwardRef(({className:e,...t},n)=>s.jsx(uo,{ref:n,className:c("-mx-1 my-1 h-px bg-muted",e),...t})).displayName=uo.displayName;const vo={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function wo({open:e,onOpenChange:n,onAdded:r}){const[o,a]=t.useState([]),[i,l]=t.useState(!1),[c,d]=t.useState(null),[u,f]=t.useState(""),[p,h]=t.useState(""),[m,x]=t.useState(""),[g,y]=t.useState(""),[v,w]=t.useState(!1),[O,_]=t.useState(null);t.useEffect(()=>{e&&b().then(e=>a(e.available)).catch(()=>a([]))},[e]);const L=()=>{l(!1),d(null),f(""),h(""),x(""),y(""),w(!1),_(null)},I=o.length>0;return s.jsx(j,{open:e,onOpenChange:e=>{n(e),e||L()},children:s.jsxs(N,{className:"sm:max-w-md",children:[s.jsxs(S,{children:[s.jsxs(C,{className:"flex items-center gap-2",children:[s.jsx(je,{className:"h-5 w-5"}),"添加云盘账号"]}),s.jsx(k,{children:i?"手动填写 OAuth 凭据连接云盘":"选择云盘类型,点击后跳转登录授权"})]}),i?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(P,{children:"云盘类型"}),s.jsxs(fo,{value:u,onValueChange:f,children:[s.jsx(ho,{children:s.jsx(po,{placeholder:"选择云盘类型"})}),s.jsxs(go,{children:[s.jsx(yo,{value:"google-drive",children:"Google Drive"}),s.jsx(yo,{value:"onedrive",children:"OneDrive"}),s.jsx(yo,{value:"dropbox",children:"Dropbox"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(P,{children:"显示名称"}),s.jsx(A,{placeholder:"例如:我的 Google Drive",value:p,onChange:e=>h(e.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(P,{children:"Client ID"}),s.jsx(A,{placeholder:"OAuth Client ID",value:m,onChange:e=>x(e.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(P,{children:"Client Secret"}),s.jsx(A,{type:"password",placeholder:"OAuth Client Secret",value:g,onChange:e=>y(e.target.value)})]}),O&&s.jsx("p",{className:"text-sm text-destructive",children:O})]}),s.jsxs(D,{children:[s.jsx(R,{variant:"outline",onClick:()=>{l(!1),_(null)},children:"返回"}),s.jsx(R,{onClick:async()=>{if(u&&p&&m&&g){w(!0),_(null);try{const{id:e}=await T({type:u,label:p,clientId:m,clientSecret:g}),{url:t}=await E(e);window.open(t,"_blank"),L(),n(!1),r()}catch(e){_(e instanceof Error?e.message:"添加失败")}finally{w(!1)}}else _("请填写所有字段")},disabled:v,children:v?"添加中...":"添加并授权"})]})]}):s.jsxs("div",{className:"space-y-3 py-2",children:[I?s.jsx(s.Fragment,{children:o.map(e=>s.jsx(R,{variant:"outline",className:"w-full justify-start gap-3 h-12 text-base",onClick:()=>{(async e=>{d(e),_(null);try{const{id:t}=await T({type:e,label:vo[e]||e}),{url:o}=await E(t);window.open(o,"_blank"),L(),n(!1),r()}catch(t){_(t instanceof Error?t.message:"添加失败"),d(null)}})(e)},disabled:null!==c,children:c===e?"连接中...":`连接 ${vo[e]||e}`},e))}):s.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"暂无内置 OAuth 凭据,请使用手动模式添加"}),O&&s.jsx("p",{className:"text-sm text-destructive",children:O}),s.jsx("div",{className:"pt-2 border-t border-border",children:s.jsxs("button",{onClick:()=>{l(!0),_(null)},className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx(Se,{className:"h-3.5 w-3.5"}),"手动填写 OAuth 凭据"]})})]})]})})}const bo={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function jo({type:e}){switch(e){case"google-drive":return s.jsx(Ne,{className:"h-5 w-5 text-blue-500"});case"onedrive":return s.jsx(je,{className:"h-5 w-5 text-sky-500"});case"dropbox":return s.jsx(Ne,{className:"h-5 w-5 text-indigo-500"});default:return s.jsx(je,{className:"h-5 w-5"})}}function No({provider:e,onDelete:n,onReauth:r}){var o;const[a,i]=t.useState(!1),l=t.useRef(null);t.useEffect(()=>()=>{l.current&&clearTimeout(l.current)},[]);return s.jsxs(O,{children:[s.jsx(_,{className:"pb-3",children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(jo,{type:e.type}),s.jsxs("div",{children:[s.jsx(L,{className:"text-base",children:e.label}),s.jsx("p",{className:"text-sm text-muted-foreground",children:bo[e.type]||e.type})]})]}),s.jsx(I,{variant:e.authorized?"default":"destructive",className:e.authorized?"bg-green-600 hover:bg-green-700":"",children:e.authorized?"已授权":"未授权"})]})}),s.jsxs(M,{children:[e.authorized&&(null==(o=e.tokens)?void 0:o.expiry)&&s.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:["授权到期:",new Date(e.tokens.expiry).toLocaleDateString("zh-CN")]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(R,{variant:"outline",size:"sm",onClick:()=>r(e.id),children:[s.jsx(H,{className:"h-3.5 w-3.5 mr-1"}),"重新授权"]}),s.jsxs(R,{variant:a?"destructive":"outline",size:"sm",onClick:()=>{a?(n(e.id),i(!1)):(i(!0),l.current=setTimeout(()=>i(!1),3e3))},children:[s.jsx(W,{className:"h-3.5 w-3.5 mr-1"}),a?"确认删除?":"删除"]})]})]})]})}const So={success:{label:"成功",icon:we,className:"bg-green-600 hover:bg-green-700"},failed:{label:"失败",icon:Ce,className:"bg-red-600 hover:bg-red-700"},partial:{label:"部分完成",icon:ye,className:"bg-yellow-600 hover:bg-yellow-700"}};function Co(e,t){const n=new Date(t).getTime()-new Date(e).getTime();if(n<1e3)return`${n}ms`;const r=Math.floor(n/1e3);if(r<60)return`${r}秒`;return`${Math.floor(r/60)}分${r%60}秒`}function ko({history:e}){const t=e.slice(0,20);return 0===t.length?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[s.jsx(be,{className:"h-10 w-10 mb-3 opacity-50"}),s.jsx("p",{className:"text-sm",children:"暂无备份记录"})]}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b",children:[s.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"时间"}),s.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"项目"}),s.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"云盘"}),s.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"状态"}),s.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"文件数"}),s.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"耗时"})]})}),s.jsx("tbody",{children:t.map(e=>{const t=So[e.status],n=t.icon;return s.jsxs("tr",{className:"border-b last:border-0 hover:bg-muted/50",children:[s.jsx("td",{className:"py-2.5 px-2 whitespace-nowrap",children:(r=e.startTime,new Date(r).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}))}),s.jsx("td",{className:"py-2.5 px-2",children:e.projectName}),s.jsx("td",{className:"py-2.5 px-2",children:e.providerLabel}),s.jsxs("td",{className:"py-2.5 px-2",children:[s.jsxs(I,{className:t.className,children:[s.jsx(n,{className:"h-3 w-3 mr-1"}),t.label]}),e.error&&s.jsx("p",{className:"text-xs text-destructive mt-1",children:e.error})]}),s.jsxs("td",{className:"py-2.5 px-2 whitespace-nowrap",children:[e.filesUploaded,"/",e.filesTotal]}),s.jsx("td",{className:"py-2.5 px-2 whitespace-nowrap",children:Co(e.startTime,e.endTime)})]},e.id);var r})})]})})}const Ro=["node_modules",".git","dist","build","*.log",".DS_Store","*.tmp",".venv","__pycache__",".env"],Po=[{value:"30",label:"30分钟"},{value:"60",label:"1小时"},{value:"360",label:"6小时"},{value:"720",label:"12小时"},{value:"1440",label:"24小时"}];function Ao(){const e=z(),[n,r]=t.useState([]),[o,a]=t.useState(!0),[i,l]=t.useState(!1),[c,d]=t.useState({enabled:!1,intervalMinutes:60}),[u,f]=t.useState(!0),[p,h]=t.useState([]),[m,x]=t.useState(!0),[g,y]=t.useState(""),[v,w]=t.useState(!1),[b,j]=t.useState(!1),[N,S]=t.useState([]),[C,k]=t.useState(!0),[D,T]=t.useState(()=>B()),[O,_]=t.useState(!1),[L,I]=t.useState({webhookEnabled:!1}),[M,W]=t.useState(""),[ie,le]=t.useState(!1),[ce,me]=t.useState(()=>V(F.usageMonitorTool,"claude")),xe=async()=>{try{const e=await J();r(e)}catch{}finally{a(!1)}},ye=async()=>{try{const e=await ne();S(e)}catch{}finally{k(!1)}};t.useEffect(()=>{xe(),(async()=>{try{const e=await ee();d(e)}catch{}finally{f(!1)}})(),(async()=>{try{const e=await te();h(e.length>0?e:Ro)}catch{h(Ro)}finally{x(!1)}})(),ye(),$().then(e=>{I(e),W(e.webhookUrl??"")}).catch(()=>{})},[]);const we=(e,t)=>{const n=parseInt(t,10);isNaN(n)||n<1||(T(t=>({...t,[e]:n})),_(!0))},be=async e=>{try{await re(e),r(t=>t.filter(t=>t.id!==e))}catch{}},je=async e=>{try{const{url:t}=await E(e);window.open(t,"_blank")}catch{}},Ne=()=>{const e=g.trim();e&&!p.includes(e)&&(h(t=>[...t,e]),y(""),w(!0))};return s.jsx("div",{className:"min-h-screen bg-background",children:s.jsxs("div",{className:"max-w-4xl mx-auto p-6",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[s.jsxs(R,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[s.jsx(K,{className:"h-4 w-4 mr-1"}),"返回"]}),s.jsx("h1",{className:"text-2xl font-bold",children:"设置"})]}),s.jsxs(de,{defaultValue:"providers",children:[s.jsxs(ue,{className:"mb-4",children:[s.jsx(fe,{value:"providers",children:"云盘账号"}),s.jsx(fe,{value:"strategy",children:"备份策略"}),s.jsx(fe,{value:"history",children:"备份记录"}),s.jsxs(fe,{value:"notifications",children:[s.jsx(ve,{className:"h-3.5 w-3.5 mr-1.5"}),"通知"]}),s.jsxs(fe,{value:"pomodoro",children:[s.jsx(q,{className:"h-3.5 w-3.5 mr-1.5"}),"番茄钟"]}),s.jsxs(fe,{value:"usage",children:[s.jsx(ge,{className:"h-3.5 w-3.5 mr-1.5"}),"用量监控"]})]}),s.jsxs(pe,{value:"providers",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex justify-end",children:s.jsxs(R,{onClick:()=>l(!0),children:[s.jsx(U,{className:"h-4 w-4 mr-1"}),"添加云盘"]})}),o?s.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):0===n.length?s.jsx("p",{className:"text-sm text-muted-foreground text-center py-12",children:"暂无云盘账号,点击上方按钮添加"}):s.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:n.map(e=>s.jsx(No,{provider:e,onDelete:be,onReauth:je},e.id))})]}),s.jsx(wo,{open:i,onOpenChange:l,onAdded:()=>{xe()}})]}),s.jsx(pe,{value:"strategy",children:s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-lg font-medium",children:"排除规则"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"匹配这些模式的文件和目录将不会被备份"}),m?s.jsx("p",{className:"text-sm text-muted-foreground",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-wrap gap-2",children:s.jsx(X,{children:p.map(e=>s.jsxs(Y.span,{layout:!0,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.2},className:"inline-flex items-center gap-1 rounded-md bg-muted px-2.5 py-1 text-sm",children:[e,s.jsx("button",{onClick:()=>(e=>{h(t=>t.filter(t=>t!==e)),w(!0)})(e),className:"ml-0.5 rounded-sm hover:bg-muted-foreground/20 p-0.5",children:s.jsx(G,{className:"h-3 w-3"})})]},e))})}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(A,{placeholder:"输入排除模式,例如 *.log",value:g,onChange:e=>y(e.target.value),onKeyDown:e=>{"Enter"===e.key&&Ne()},className:"max-w-xs"}),s.jsx(R,{variant:"outline",size:"sm",onClick:Ne,children:"添加"})]}),v&&s.jsxs(R,{onClick:async()=>{j(!0);try{await oe(p),w(!1)}catch{}finally{j(!1)}},disabled:b,children:[s.jsx(he,{className:"h-4 w-4 mr-1"}),b?"保存中...":"保存"]})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-lg font-medium",children:"定时备份"}),u?s.jsx("p",{className:"text-sm text-muted-foreground",children:"加载中..."}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(We,{checked:c.enabled,onCheckedChange:async e=>{const t=c;d({...c,enabled:e});try{await se({enabled:e})}catch{d(t)}}}),s.jsx(P,{children:c.enabled?"已开启":"已关闭"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(P,{children:"备份间隔"}),s.jsxs(fo,{value:String(c.intervalMinutes),onValueChange:async e=>{const t=parseInt(e,10),n=c;d({...c,intervalMinutes:t});try{await se({intervalMinutes:t})}catch{d(n)}},children:[s.jsx(ho,{className:"w-48",children:s.jsx(po,{})}),s.jsx(go,{children:Po.map(e=>s.jsx(yo,{value:e.value,children:e.label},e.value))})]})]})]})]})]})}),s.jsx(pe,{value:"history",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex justify-end",children:s.jsxs(R,{variant:"outline",size:"sm",onClick:()=>{k(!0),ye()},children:[s.jsx(H,{className:"h-4 w-4 mr-1"}),"刷新"]})}),C?s.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):s.jsx(ko,{history:N})]})}),s.jsx(pe,{value:"notifications",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[s.jsx("h3",{className:"text-sm font-medium",children:"浏览器通知"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"当 Claude 完成任务时,浏览器将自动弹出通知。首次打开 Dashboard 时会请求通知权限。"})]}),s.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-3",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-medium",children:"Webhook 通知"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Claude 完成任务时向指定 URL 发送 POST 请求(JSON: event, projectId, projectName, timestamp)"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(P,{className:"text-xs",children:"Webhook URL"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(A,{placeholder:"https://hooks.slack.com/...",value:M,onChange:e=>W(e.target.value),className:"font-mono text-xs"}),s.jsx(R,{size:"sm",onClick:()=>{(async()=>{le(!0);try{const e=await ae({webhookEnabled:M.trim().length>0,webhookUrl:M.trim()||void 0});I(e),Q.success("Webhook 配置已保存")}catch{Q.error("保存失败")}finally{le(!1)}})()},disabled:ie,children:ie?"保存中…":"保存"})]}),L.webhookEnabled&&L.webhookUrl&&s.jsxs("p",{className:"text-xs text-green-500",children:["已启用 → ",L.webhookUrl]})]})]})]})}),s.jsx(pe,{value:"pomodoro",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-4",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-medium",children:"番茄钟时间设置"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"修改后重新启动番茄钟生效"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-6 max-w-xs",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(P,{className:"text-xs",children:"工作时长(分钟)"}),s.jsx(A,{type:"number",min:1,max:120,value:D.workMinutes,onChange:e=>we("workMinutes",e.target.value),className:"w-full"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(P,{className:"text-xs",children:"休息时长(分钟)"}),s.jsx(A,{type:"number",min:1,max:60,value:D.breakMinutes,onChange:e=>we("breakMinutes",e.target.value),className:"w-full"})]})]}),O&&s.jsxs(R,{size:"sm",onClick:()=>{Z(F.pomodoroConfig,D,!0),_(!1),Q.success("番茄钟设置已保存")},children:[s.jsx(he,{className:"h-3.5 w-3.5 mr-1.5"}),"保存"]})]}),s.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[s.jsx("h3",{className:"text-sm font-medium",children:"使用说明"}),s.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[s.jsxs("li",{children:["在项目页面 Header 点击 ",s.jsx(q,{className:"h-3 w-3 inline-block mx-0.5"})," 图标启动番茄钟"]}),s.jsx("li",{children:"倒计时以大字体悬浮在屏幕上,不影响操作"}),s.jsx("li",{children:"工作阶段结束后自动切换为休息,并弹出通知"}),s.jsx("li",{children:"休息结束后自动切换回工作阶段"}),s.jsx("li",{children:"再次点击图标可停止并重置"})]})]})]})}),s.jsx(pe,{value:"usage",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-4",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-medium",children:"监控工具"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"选择要监控用量的 CLI 工具,首页和项目页会显示对应的实时用量"})]}),s.jsx("div",{className:"grid gap-3 max-w-md",children:[{key:"claude",label:"Claude Code",desc:"Anthropic API — 5h/7d 用量窗口"},{key:"codex",label:"Codex",desc:"OpenAI — 用量查询暂未实现"},{key:"opencode",label:"OpenCode",desc:"OpenCode — 用量查询暂未实现"},{key:"qwen",label:"Qwen Code",desc:"Qwen — 用量查询暂未实现"},{key:"gemini",label:"Gemini CLI",desc:"Google — 用量查询暂未实现"}].map(e=>s.jsxs("label",{className:"flex items-start gap-3 rounded-lg border p-3 cursor-pointer transition-colors "+(ce===e.key?"border-blue-500/50 bg-blue-500/5":"border-border hover:bg-muted/30"),children:[s.jsx("input",{type:"radio",name:"usageTool",value:e.key,checked:ce===e.key,onChange:()=>{me(e.key),Z(F.usageMonitorTool,e.key),window.dispatchEvent(new Event("ccweb:usage-tool-change")),Q.success(`用量监控已切换为 ${e.label}`)},className:"mt-0.5"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium",children:e.label}),s.jsx("div",{className:"text-xs text-muted-foreground",children:e.desc})]})]},e.key))})]}),s.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[s.jsx("h3",{className:"text-sm font-medium",children:"说明"}),s.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[s.jsx("li",{children:"用量数据显示在首页 Header 和项目页底部状态栏"}),s.jsx("li",{children:"Claude Code 通过 OAuth API 实时查询,每 5 分钟自动刷新"}),s.jsx("li",{children:"其他工具的用量查询将在后续版本中支持"}),s.jsx("li",{children:"切换后无需刷新页面,用量会自动更新"})]})]})]})})]})]})})}export{Ao as SettingsPage};
@@ -1,7 +0,0 @@
1
- import{c as e,r as t,j as n,aJ as r,at as o,R as a,aq as i,aK as s,ar as l,au as c,aH as u,av as d,as as f,d as p}from"./index-nuXK9Vzi.js";
2
- /**
3
- * @license lucide-react v0.309.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */const m=e("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]);function v(e){const r=b(e),o=t.forwardRef((e,o)=>{const{children:a,...i}=e,s=t.Children.toArray(a),l=s.find(h);if(l){const e=l.props.children,a=s.map(n=>n===l?t.Children.count(e)>1?t.Children.only(null):t.isValidElement(e)?e.props.children:null:n);return n.jsx(r,{...i,ref:o,children:t.isValidElement(e)?t.cloneElement(e,void 0,a):null})}return n.jsx(r,{...i,ref:o,children:a})});return o.displayName=`${e}.Slot`,o}function b(e){const n=t.forwardRef((e,n)=>{const{children:o,...a}=e;if(t.isValidElement(o)){const e=function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(o),i=function(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...e)=>{const t=a(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...a}:"className"===r&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}(a,o.props);return o.type!==t.Fragment&&(i.ref=n?r(n,e):e),t.cloneElement(o,i)}return t.Children.count(o)>1?t.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}var y=Symbol("radix.slottable");function h(e){return t.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===y}function g(e){const t=e+"CollectionProvider",[r,s]=o(t),[l,c]=r(t,{collectionRef:{current:null},itemMap:new Map}),u=e=>{const{scope:t,children:r}=e,o=a.useRef(null),i=a.useRef(new Map).current;return n.jsx(l,{scope:t,itemMap:i,collectionRef:o,children:r})};u.displayName=t;const d=e+"CollectionSlot",f=v(d),p=a.forwardRef((e,t)=>{const{scope:r,children:o}=e,a=c(d,r),s=i(t,a.collectionRef);return n.jsx(f,{ref:s,children:o})});p.displayName=d;const m=e+"CollectionItemSlot",b="data-radix-collection-item",y=v(m),h=a.forwardRef((e,t)=>{const{scope:r,children:o,...s}=e,l=a.useRef(null),u=i(t,l),d=c(m,r);return a.useEffect(()=>(d.itemMap.set(l,{ref:l,...s}),()=>{d.itemMap.delete(l)})),n.jsx(y,{[b]:"",ref:u,children:o})});return h.displayName=m,[{Provider:u,Slot:p,ItemSlot:h},function(t){const n=c(e+"CollectionConsumer",t);return a.useCallback(()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${b}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])},s]}var w=t.createContext(void 0);function x(e){const n=t.useContext(w);return e||n||"ltr"}var R="rovingFocusGroup.onEntryFocus",C={bubbles:!1,cancelable:!0},j="RovingFocusGroup",[I,S,F]=g(j),[T,N]=o(j,[F]),[A,E]=T(j),M=t.forwardRef((e,t)=>n.jsx(I.Provider,{scope:e.__scopeRovingFocusGroup,children:n.jsx(I.Slot,{scope:e.__scopeRovingFocusGroup,children:n.jsx(_,{...e,ref:t})})}));M.displayName=j;var _=t.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:o,orientation:a,loop:s=!1,dir:f,currentTabStopId:p,defaultCurrentTabStopId:m,onCurrentTabStopIdChange:v,onEntryFocus:b,preventScrollOnEntryFocus:y=!1,...h}=e,g=t.useRef(null),w=i(r,g),I=x(f),[F,T]=u({prop:p,defaultProp:m??null,onChange:v,caller:j}),[N,E]=t.useState(!1),M=d(b),_=S(o),D=t.useRef(!1),[k,K]=t.useState(0);return t.useEffect(()=>{const e=g.current;if(e)return e.addEventListener(R,M),()=>e.removeEventListener(R,M)},[M]),n.jsx(A,{scope:o,orientation:a,dir:I,loop:s,currentTabStopId:F,onItemFocus:t.useCallback(e=>T(e),[T]),onItemShiftTab:t.useCallback(()=>E(!0),[]),onFocusableItemAdd:t.useCallback(()=>K(e=>e+1),[]),onFocusableItemRemove:t.useCallback(()=>K(e=>e-1),[]),children:n.jsx(l.div,{tabIndex:N||0===k?-1:0,"data-orientation":a,...h,ref:w,style:{outline:"none",...e.style},onMouseDown:c(e.onMouseDown,()=>{D.current=!0}),onFocus:c(e.onFocus,e=>{const t=!D.current;if(e.target===e.currentTarget&&t&&!N){const t=new CustomEvent(R,C);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=_().filter(e=>e.focusable);V([e.find(e=>e.active),e.find(e=>e.id===F),...e].filter(Boolean).map(e=>e.ref.current),y)}}D.current=!1}),onBlur:c(e.onBlur,()=>E(!1))})})}),D="RovingFocusGroupItem",k=t.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:o,focusable:a=!0,active:i=!1,tabStopId:u,children:d,...f}=e,p=s(),m=u||p,v=E(D,o),b=v.currentTabStopId===m,y=S(o),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:w}=v;return t.useEffect(()=>{if(a)return h(),()=>g()},[a,h,g]),n.jsx(I.ItemSlot,{scope:o,id:m,focusable:a,active:i,children:n.jsx(l.span,{tabIndex:b?0:-1,"data-orientation":v.orientation,...f,ref:r,onMouseDown:c(e.onMouseDown,e=>{a?v.onItemFocus(m):e.preventDefault()}),onFocus:c(e.onFocus,()=>v.onItemFocus(m)),onKeyDown:c(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void v.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,n){const r=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,n);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(r)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(r)?void 0:K[r]}(e,v.orientation,v.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let o=y().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)o.reverse();else if("prev"===t||"next"===t){"prev"===t&&o.reverse();const a=o.indexOf(e.currentTarget);o=v.loop?(r=a+1,(n=o).map((e,t)=>n[(r+t)%n.length])):o.slice(a+1)}setTimeout(()=>V(o))}var n,r}),children:"function"==typeof d?d({isCurrentTabStop:b,hasTabStop:null!=w}):d})})});k.displayName=D;var K={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function V(e,t=!1){const n=document.activeElement;for(const r of e){if(r===n)return;if(r.focus({preventScroll:t}),document.activeElement!==n)return}}var P=M,O=k,G="Tabs",[L]=o(G,[N]),$=N(),[q,z]=L(G),B=t.forwardRef((e,t)=>{const{__scopeTabs:r,value:o,onValueChange:a,defaultValue:i,orientation:c="horizontal",dir:d,activationMode:f="automatic",...p}=e,m=x(d),[v,b]=u({prop:o,onChange:a,defaultProp:i??"",caller:G});return n.jsx(q,{scope:r,baseId:s(),value:v,onValueChange:b,orientation:c,dir:m,activationMode:f,children:n.jsx(l.div,{dir:m,"data-orientation":c,...p,ref:t})})});B.displayName=G;var W="TabsList",H=t.forwardRef((e,t)=>{const{__scopeTabs:r,loop:o=!0,...a}=e,i=z(W,r),s=$(r);return n.jsx(P,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:o,children:n.jsx(l.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:t})})});H.displayName=W;var U="TabsTrigger",J=t.forwardRef((e,t)=>{const{__scopeTabs:r,value:o,disabled:a=!1,...i}=e,s=z(U,r),u=$(r),d=X(s.baseId,o),f=Y(s.baseId,o),p=o===s.value;return n.jsx(O,{asChild:!0,...u,focusable:!a,active:p,children:n.jsx(l.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":f,"data-state":p?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:d,...i,ref:t,onMouseDown:c(e.onMouseDown,e=>{a||0!==e.button||!1!==e.ctrlKey?e.preventDefault():s.onValueChange(o)}),onKeyDown:c(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&s.onValueChange(o)}),onFocus:c(e.onFocus,()=>{const e="manual"!==s.activationMode;p||a||!e||s.onValueChange(o)})})})});J.displayName=U;var Z="TabsContent",Q=t.forwardRef((e,r)=>{const{__scopeTabs:o,value:a,forceMount:i,children:s,...c}=e,u=z(Z,o),d=X(u.baseId,a),p=Y(u.baseId,a),m=a===u.value,v=t.useRef(m);return t.useEffect(()=>{const e=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(e)},[]),n.jsx(f,{present:i||m,children:({present:t})=>n.jsx(l.div,{"data-state":m?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":d,hidden:!t,id:p,tabIndex:0,...c,ref:r,style:{...e.style,animationDuration:v.current?"0s":void 0},children:t&&s})})});function X(e,t){return`${e}-trigger-${t}`}function Y(e,t){return`${e}-content-${t}`}Q.displayName=Z;var ee=H,te=J,ne=Q;const re=B,oe=t.forwardRef(({className:e,...t},r)=>n.jsx(ee,{ref:r,className:p("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));oe.displayName=ee.displayName;const ae=t.forwardRef(({className:e,...t},r)=>n.jsx(te,{ref:r,className:p("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",e),...t}));ae.displayName=te.displayName;const ie=t.forwardRef(({className:e,...t},r)=>n.jsx(ne,{ref:r,className:p("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));function se(e,[t,n]){return Math.min(n,Math.max(t,e))}ie.displayName=ne.displayName;export{m as S,re as T,oe as a,ae as b,ie as c,se as d,g as e,x as u};