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

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 (21) hide show
  1. package/README.md +1 -1
  2. package/frontend/dist/assets/{AssistantMessageContent-DLBIfRoa.js → AssistantMessageContent-BXGoUnPl.js} +1 -1
  3. package/frontend/dist/assets/{GraphPreview-CAHAPSNV.js → GraphPreview-Ca22U4BP.js} +1 -1
  4. package/frontend/dist/assets/{MobilePage-j50EdDNc.js → MobilePage-CIUktKA8.js} +3 -3
  5. package/frontend/dist/assets/{OfficePreview-BFdVaUwH.js → OfficePreview-CLGxDBuB.js} +2 -2
  6. package/frontend/dist/assets/{PlanPanel-BZEXnj25.js → PlanPanel-TLlCo5cs.js} +1 -1
  7. package/frontend/dist/assets/{ProjectPage-C-KJDFbz.js → ProjectPage-Bpj8XUcg.js} +5 -5
  8. package/frontend/dist/assets/{SettingsPage-DzSCqUzP.js → SettingsPage-Cy00qya-.js} +2 -2
  9. package/frontend/dist/assets/{SkillHubPage-BWsT-k9U.js → SkillHubPage-BWkab_k8.js} +2 -2
  10. package/frontend/dist/assets/{chevron-down-HPq7YAwV.js → chevron-down-Bn3Wxb1A.js} +1 -1
  11. package/frontend/dist/assets/{chevron-up-BGtmxzk3.js → chevron-up-DjQ2Kt99.js} +1 -1
  12. package/frontend/dist/assets/{index-BjZ5yznR.js → index-BpQn0KbO.js} +1 -1
  13. package/frontend/dist/assets/{index-DvERL7tB.js → index-CYLf1vI2.js} +1 -1
  14. package/frontend/dist/assets/index-b8oVHVON.css +1 -0
  15. package/frontend/dist/assets/{index-A-o6g_qw.js → index-nuXK9Vzi.js} +3 -3
  16. package/frontend/dist/assets/{jszip.min-vX7H_FIl.js → jszip.min-k094Tbts.js} +1 -1
  17. package/frontend/dist/assets/{maximize-2-DxjkIxPt.js → maximize-2-C1mkwgJj.js} +1 -1
  18. package/frontend/dist/assets/{search-9lLW2Oo_.js → search-DlCQSCBu.js} +1 -1
  19. package/frontend/dist/index.html +2 -2
  20. package/package.json +1 -1
  21. package/frontend/dist/assets/index-D7xFwrL6.css +0 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A self-hosted web application (distributed as npm package) that provides a browser-based interface for [Claude Code](https://docs.anthropic.com/en/docs/claude-code) CLI sessions. Create projects, each with a persistent terminal running Claude Code, and interact with them through a real-time terminal UI.
4
4
 
5
- **Current version**: v2026.4.19-q | [GitHub](https://github.com/zbc0315/cc-web) | MIT License
5
+ **Current version**: v2026.4.19-r | [GitHub](https://github.com/zbc0315/cc-web) | MIT License
6
6
 
7
7
  ## Features
8
8
 
@@ -1,4 +1,4 @@
1
- import{c as e,bk as t,bl as n,j as r,R as a,r as i,al as o,d as s,bm as l,t as c}from"./index-A-o6g_qw.js";import{C as u}from"./chevron-down-HPq7YAwV.js";import{C as d}from"./chevron-up-BGtmxzk3.js";
1
+ import{c as e,bk as t,bl as n,j as r,R as a,r as i,al as o,d as s,bm as l,t as c}from"./index-nuXK9Vzi.js";import{C as u}from"./chevron-down-Bn3Wxb1A.js";import{C as d}from"./chevron-up-DjQ2Kt99.js";
2
2
  /**
3
3
  * @license lucide-react v0.309.0 - ISC
4
4
  *
@@ -1,2 +1,2 @@
1
- import{r as e,b as t,j as n,al as i,B as r,n as o}from"./index-A-o6g_qw.js";import{Z as a,a as s}from"./ProjectPage-C-KJDFbz.js";import{M as l}from"./maximize-2-DxjkIxPt.js";import"./purify.es-CgRAQgUo.js";import"./AssistantMessageContent-DLBIfRoa.js";import"./chevron-down-HPq7YAwV.js";import"./chevron-up-BGtmxzk3.js";import"./index-DvERL7tB.js";import"./search-9lLW2Oo_.js";
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
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,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/OfficePreview-BFdVaUwH.js","assets/index-A-o6g_qw.js","assets/index-D7xFwrL6.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,O as m,N 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-A-o6g_qw.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-DLBIfRoa.js";import{C as V}from"./chevron-up-BGtmxzk3.js";import{C as K}from"./chevron-down-HPq7YAwV.js";
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
3
  /**
4
4
  * @license lucide-react v0.309.0 - ISC
5
5
  *
@@ -11,4 +11,4 @@ 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
11
11
  *
12
12
  * This source code is licensed under the ISC license.
13
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-BFdVaUwH.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-A-o6g_qw.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};
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,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BjZ5yznR.js","assets/index-A-o6g_qw.js","assets/index-D7xFwrL6.css","assets/jszip.min-vX7H_FIl.js"])))=>i.map(i=>d[i]);
2
- import{j as e,r as t,_ as s,g as r,f as a}from"./index-A-o6g_qw.js";import{p as n}from"./purify.es-CgRAQgUo.js";async function l(e){let t=a(e);const s=r();s&&(t+=`${t.includes("?")?"&":"?"}token=${encodeURIComponent(s)}`);const n=await fetch(t);if(!n.ok)throw new Error(`Failed to fetch file: ${n.status}`);return n.arrayBuffer()}function o({filePath:r,zoom:a}){const[o,i]=t.useState(""),[d,c]=t.useState(null),[x,u]=t.useState(!0);return t.useEffect(()=>{let e=!1;return u(!0),c(null),(async()=>{try{const t=await s(()=>import("./index-BjZ5yznR.js").then(e=>e.i),__vite__mapDeps([0,1,2,3])),a=await l(r),n=await t.convertToHtml({arrayBuffer:a});e||i(n.value)}catch(t){e||c(t instanceof Error?t.message:"Failed to render docx")}finally{e||u(!1)}})(),()=>{e=!0}},[r]),x?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Word 文档中..."}):d?e.jsx("p",{className:"text-sm text-destructive p-4",children:d}):e.jsx("div",{className:"p-6 prose dark:prose-invert max-w-none",style:{fontSize:12*a/100+"px"},dangerouslySetInnerHTML:{__html:n.sanitize(o)}})}function i({filePath:r,zoom:a}){var o;const[i,d]=t.useState([]),[c,x]=t.useState(0),[u,p]=t.useState(null),[m,f]=t.useState(!0);return t.useEffect(()=>{let e=!1;return f(!0),p(null),(async()=>{try{const t=await s(()=>import("./xlsx-DfDjAMCE.js"),[]),a=await l(r),n=t.read(a,{type:"array"}),o=n.SheetNames.map(e=>({name:e,html:t.utils.sheet_to_html(n.Sheets[e],{editable:!1})}));e||(d(o),x(0))}catch(t){e||p(t instanceof Error?t.message:"Failed to render xlsx")}finally{e||f(!1)}})(),()=>{e=!0}},[r]),m?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Excel 文件中..."}):u?e.jsx("p",{className:"text-sm text-destructive p-4",children:u}):0===i.length?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):e.jsxs("div",{className:"flex flex-col h-full",children:[i.length>1&&e.jsx("div",{className:"flex gap-0.5 px-3 py-1.5 border-b border-border bg-muted/30 flex-shrink-0 overflow-x-auto",children:i.map((t,s)=>e.jsx("button",{onClick:()=>x(s),className:"px-3 py-1 text-xs rounded-t transition-colors whitespace-nowrap "+(s===c?"bg-background text-foreground border border-b-0 border-border":"text-muted-foreground hover:text-foreground"),children:t.name},s))}),e.jsx("div",{className:"flex-1 overflow-auto p-2 xlsx-preview",style:{fontSize:12*a/100+"px"},dangerouslySetInnerHTML:{__html:n.sanitize((null==(o=i[c])?void 0:o.html)??"")}}),e.jsx("style",{children:"\n .xlsx-preview table { border-collapse: collapse; width: auto; min-width: 100%; }\n .xlsx-preview td, .xlsx-preview th {\n border: 1px solid hsl(var(--border));\n padding: 4px 8px;\n text-align: left;\n white-space: nowrap;\n font-size: inherit;\n }\n .xlsx-preview th { background: hsl(var(--muted)); font-weight: 600; }\n .xlsx-preview tr:hover td { background: hsl(var(--accent) / 0.3); }\n "})]})}function d({filePath:r,zoom:a}){const[n,o]=t.useState([]),[i,d]=t.useState(null),[c,x]=t.useState(!0);return t.useEffect(()=>{let e=!1;return x(!0),d(null),(async()=>{try{const t=await l(r),a=await async function(e){const{default:t}=await s(async()=>{const{default:e}=await import("./jszip.min-vX7H_FIl.js").then(e=>e.j);return{default:e}},__vite__mapDeps([3,1,2])),r=await t.loadAsync(e),a=[],n=Object.keys(r.files).filter(e=>/^ppt\/slides\/slide\d+\.xml$/i.test(e)).sort((e,t)=>{var s,r;return parseInt((null==(s=e.match(/slide(\d+)/))?void 0:s[1])??"0")-parseInt((null==(r=t.match(/slide(\d+)/))?void 0:r[1])??"0")});for(let s=0;s<n.length;s++){const e=await r.file(n[s]).async("text"),t=[],l=/<a:t[^>]*>([\s\S]*?)<\/a:t>/g;let o;for(;null!==(o=l.exec(e));){const e=o[1].replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').trim();e&&t.push(e)}a.push({index:s+1,texts:t})}return a}(t);e||o(a)}catch(t){e||d(t instanceof Error?t.message:"Failed to render pptx")}finally{e||x(!1)}})(),()=>{e=!0}},[r]),c?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 PPT 文件中..."}):i?e.jsx("p",{className:"text-sm text-destructive p-4",children:i}):0===n.length?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):e.jsx("div",{className:"p-4 space-y-4",style:{fontSize:12*a/100+"px"},children:n.map(t=>e.jsxs("div",{className:"border border-border rounded-lg p-5 bg-muted/20",children:[e.jsxs("div",{className:"text-xs text-muted-foreground mb-2 font-medium",children:["Slide ",t.index]}),t.texts.length>0?e.jsx("div",{className:"space-y-1.5",children:t.texts.map((t,s)=>e.jsx("p",{className:"text-foreground leading-relaxed",style:{fontSize:"inherit"},children:t},s))}):e.jsx("p",{className:"text-muted-foreground text-sm italic",children:"(无文本内容)"})]},t.index))})}const c=new Set(["docx","xlsx","xls","pptx"]);function x({filePath:t,ext:s,zoom:r}){return"docx"===s?e.jsx(o,{filePath:t,zoom:r}):"xlsx"===s||"xls"===s?e.jsx(i,{filePath:t,zoom:r}):"pptx"===s?e.jsx(d,{filePath:t,zoom:r}):null}export{c as OFFICE_EXTS,x as OfficePreview};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BpQn0KbO.js","assets/index-nuXK9Vzi.js","assets/index-b8oVHVON.css","assets/jszip.min-k094Tbts.js"])))=>i.map(i=>d[i]);
2
+ import{j as e,r as t,_ as s,g as r,f as a}from"./index-nuXK9Vzi.js";import{p as n}from"./purify.es-CgRAQgUo.js";async function l(e){let t=a(e);const s=r();s&&(t+=`${t.includes("?")?"&":"?"}token=${encodeURIComponent(s)}`);const n=await fetch(t);if(!n.ok)throw new Error(`Failed to fetch file: ${n.status}`);return n.arrayBuffer()}function o({filePath:r,zoom:a}){const[o,i]=t.useState(""),[d,c]=t.useState(null),[x,u]=t.useState(!0);return t.useEffect(()=>{let e=!1;return u(!0),c(null),(async()=>{try{const t=await s(()=>import("./index-BpQn0KbO.js").then(e=>e.i),__vite__mapDeps([0,1,2,3])),a=await l(r),n=await t.convertToHtml({arrayBuffer:a});e||i(n.value)}catch(t){e||c(t instanceof Error?t.message:"Failed to render docx")}finally{e||u(!1)}})(),()=>{e=!0}},[r]),x?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Word 文档中..."}):d?e.jsx("p",{className:"text-sm text-destructive p-4",children:d}):e.jsx("div",{className:"p-6 prose dark:prose-invert max-w-none",style:{fontSize:12*a/100+"px"},dangerouslySetInnerHTML:{__html:n.sanitize(o)}})}function i({filePath:r,zoom:a}){var o;const[i,d]=t.useState([]),[c,x]=t.useState(0),[u,p]=t.useState(null),[m,f]=t.useState(!0);return t.useEffect(()=>{let e=!1;return f(!0),p(null),(async()=>{try{const t=await s(()=>import("./xlsx-DfDjAMCE.js"),[]),a=await l(r),n=t.read(a,{type:"array"}),o=n.SheetNames.map(e=>({name:e,html:t.utils.sheet_to_html(n.Sheets[e],{editable:!1})}));e||(d(o),x(0))}catch(t){e||p(t instanceof Error?t.message:"Failed to render xlsx")}finally{e||f(!1)}})(),()=>{e=!0}},[r]),m?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Excel 文件中..."}):u?e.jsx("p",{className:"text-sm text-destructive p-4",children:u}):0===i.length?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):e.jsxs("div",{className:"flex flex-col h-full",children:[i.length>1&&e.jsx("div",{className:"flex gap-0.5 px-3 py-1.5 border-b border-border bg-muted/30 flex-shrink-0 overflow-x-auto",children:i.map((t,s)=>e.jsx("button",{onClick:()=>x(s),className:"px-3 py-1 text-xs rounded-t transition-colors whitespace-nowrap "+(s===c?"bg-background text-foreground border border-b-0 border-border":"text-muted-foreground hover:text-foreground"),children:t.name},s))}),e.jsx("div",{className:"flex-1 overflow-auto p-2 xlsx-preview",style:{fontSize:12*a/100+"px"},dangerouslySetInnerHTML:{__html:n.sanitize((null==(o=i[c])?void 0:o.html)??"")}}),e.jsx("style",{children:"\n .xlsx-preview table { border-collapse: collapse; width: auto; min-width: 100%; }\n .xlsx-preview td, .xlsx-preview th {\n border: 1px solid hsl(var(--border));\n padding: 4px 8px;\n text-align: left;\n white-space: nowrap;\n font-size: inherit;\n }\n .xlsx-preview th { background: hsl(var(--muted)); font-weight: 600; }\n .xlsx-preview tr:hover td { background: hsl(var(--accent) / 0.3); }\n "})]})}function d({filePath:r,zoom:a}){const[n,o]=t.useState([]),[i,d]=t.useState(null),[c,x]=t.useState(!0);return t.useEffect(()=>{let e=!1;return x(!0),d(null),(async()=>{try{const t=await l(r),a=await async function(e){const{default:t}=await s(async()=>{const{default:e}=await import("./jszip.min-k094Tbts.js").then(e=>e.j);return{default:e}},__vite__mapDeps([3,1,2])),r=await t.loadAsync(e),a=[],n=Object.keys(r.files).filter(e=>/^ppt\/slides\/slide\d+\.xml$/i.test(e)).sort((e,t)=>{var s,r;return parseInt((null==(s=e.match(/slide(\d+)/))?void 0:s[1])??"0")-parseInt((null==(r=t.match(/slide(\d+)/))?void 0:r[1])??"0")});for(let s=0;s<n.length;s++){const e=await r.file(n[s]).async("text"),t=[],l=/<a:t[^>]*>([\s\S]*?)<\/a:t>/g;let o;for(;null!==(o=l.exec(e));){const e=o[1].replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').trim();e&&t.push(e)}a.push({index:s+1,texts:t})}return a}(t);e||o(a)}catch(t){e||d(t instanceof Error?t.message:"Failed to render pptx")}finally{e||x(!1)}})(),()=>{e=!0}},[r]),c?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 PPT 文件中..."}):i?e.jsx("p",{className:"text-sm text-destructive p-4",children:i}):0===n.length?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):e.jsx("div",{className:"p-4 space-y-4",style:{fontSize:12*a/100+"px"},children:n.map(t=>e.jsxs("div",{className:"border border-border rounded-lg p-5 bg-muted/20",children:[e.jsxs("div",{className:"text-xs text-muted-foreground mb-2 font-medium",children:["Slide ",t.index]}),t.texts.length>0?e.jsx("div",{className:"space-y-1.5",children:t.texts.map((t,s)=>e.jsx("p",{className:"text-foreground leading-relaxed",style:{fontSize:"inherit"},children:t},s))}):e.jsx("p",{className:"text-muted-foreground text-sm italic",children:"(无文本内容)"})]},t.index))})}const c=new Set(["docx","xlsx","xls","pptx"]);function x({filePath:t,ext:s,zoom:r}){return"docx"===s?e.jsx(o,{filePath:t,zoom:r}):"xlsx"===s||"xls"===s?e.jsx(i,{filePath:t,zoom:r}):"pptx"===s?e.jsx(d,{filePath:t,zoom:r}):null}export{c as OFFICE_EXTS,x as OfficePreview};
@@ -1,4 +1,4 @@
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-A-o6g_qw.js";import{Z as m,a as f,P as y}from"./ProjectPage-C-KJDFbz.js";import{M as g}from"./maximize-2-DxjkIxPt.js";import"./purify.es-CgRAQgUo.js";import"./AssistantMessageContent-DLBIfRoa.js";import"./chevron-down-HPq7YAwV.js";import"./chevron-up-BGtmxzk3.js";import"./index-DvERL7tB.js";import"./search-9lLW2Oo_.js";
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
2
  /**
3
3
  * @license lucide-react v0.309.0 - ISC
4
4
  *