vibe-roast 0.98.0 → 0.98.2

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.
package/README.md CHANGED
@@ -18,11 +18,13 @@
18
18
  <img src="https://img.shields.io/npm/v/vibe-roast?color=25b985&label=npm" alt="npm version" />
19
19
  </a>
20
20
  <a href="https://www.npmjs.com/package/vibe-roast">
21
- <img src="https://img.shields.io/npm/dm/vibe-roast?color=557fd8" alt="npm downloads" />
21
+ <img src="https://img.shields.io/npm/dm/vibe-roast?color=557fd8&label=npm%20downloads%2Fmonth" alt="npm Registry downloads in the last month" />
22
22
  </a>
23
23
  <img src="https://img.shields.io/badge/Node.js-%E2%89%A520-171717" alt="Node.js 20 or newer" />
24
24
  <img src="https://img.shields.io/badge/types-16-9a70cf" alt="16 coding personality types" />
25
- <img src="https://img.shields.io/badge/raw_prompts-local_only-ef5b45" alt="Raw prompts stay local" />
25
+ <a href="#privacy">
26
+ <img src="https://img.shields.io/badge/prompt_text-stays_local-ef5b45" alt="Your prompt text stays local" />
27
+ </a>
26
28
  </p>
27
29
 
28
30
  <p>
@@ -67,8 +69,12 @@ Vibe Roaster scans the supported local stores it can find, starts the local dash
67
69
  http://localhost:7681
68
70
  ```
69
71
 
72
+ Interactive terminals get a short branded launch sequence with rotating English humour. Piped output, CI, and `NO_COLOR` environments automatically use stable plain text.
73
+
70
74
  Missing agents are ignored safely. You do not need to configure every source, create an account, or provide an API key to see the local result.
71
75
 
76
+ The download badge reports npm Registry package fetches during the last month. A first-time `npx vibe-roast` fetch contributes to that number; a later run served from the local npm cache may not. It is a download count, not a unique-user or execution counter.
77
+
72
78
  ### Choose how the roast is written
73
79
 
74
80
  On first launch, choose one of three paths:
@@ -91,7 +97,7 @@ GitHub login is identity only; it does not use GitHub Models or your GitHub mode
91
97
  </td>
92
98
  <td width="50%">
93
99
  <strong>Evidence-grounded roast</strong><br />
94
- The type stays deterministic. Optional AI writing turns aggregate signals and contradictions into bilingual comedy without receiving raw prompts.
100
+ The type stays deterministic. Optional AI writing turns aggregate signals and contradictions into bilingual comedy without receiving the exact requests you typed.
95
101
  </td>
96
102
  </tr>
97
103
  <tr>
@@ -101,13 +107,13 @@ GitHub login is identity only; it does not use GitHub Models or your GitHub mode
101
107
  </td>
102
108
  <td width="50%">
103
109
  <strong>Recurring themes</strong><br />
104
- A time- and Agent-filtered cloud promotes repeated coding concepts and project-domain entities such as HIT, ONNX, or 前庭.
110
+ A time- and Agent-filtered cloud promotes repeated coding concepts, project nouns, frameworks, subsystems, and meaningful acronyms.
105
111
  </td>
106
112
  </tr>
107
113
  <tr>
108
114
  <td width="50%">
109
115
  <strong>Semantic Hashtags</strong><br />
110
- AI reads coherent concept clusters and creates shareable character labels—<code>preflop + folds + river</code> can become <code>#HoldemPlayer</code>, not <code>#preflop</code>.
116
+ AI reads coherent concept clusters and turns them into shareable character labels instead of copying the highest-frequency token.
111
117
  </td>
112
118
  <td width="50%">
113
119
  <strong>Shareable by design</strong><br />
@@ -208,7 +214,7 @@ The same Day / Week / Month / Total / Custom and Agent filters apply to the clou
208
214
 
209
215
  ### AI roast and bilingual Hashtags
210
216
 
211
- Only a compact `roast_evidence` object is eligible to leave the machine. It contains aggregate type, axis, category, dimension, concept, and activity signals—never raw prompt text.
217
+ Only a compact `roast_evidence` object is eligible to leave the machine. It contains aggregate type, axis, category, dimension, concept, and activity signals—never the text you typed into an Agent.
212
218
 
213
219
  The writer cannot change the deterministic type. In one model call it produces:
214
220
 
@@ -216,7 +222,7 @@ The writer cannot change the deterministic type. In one model call it produces:
216
222
  - bilingual TL;DR punchlines;
217
223
  - 4–5 paired Hashtags with `en`, `zh`, semantic `kind`, and a short shared `meaning`.
218
224
 
219
- Hashtags are interpretations rather than frequency labels. Chinese is localized from the intended joke, not translated from the English surface form: `CodeCult` should become `代码教团` or `代码邪教`, never `代码文化`. Proper names and meaningful acronyms such as GitHub, HIT, and ONNX may remain unchanged.
225
+ Hashtags are interpretations rather than frequency labels. Chinese is localized from the intended joke instead of translated word for word. Proper names, framework names, and meaningful acronyms may remain unchanged when translation would lose their identity.
220
226
 
221
227
  ## Privacy
222
228
 
@@ -224,7 +230,7 @@ Vibe Roaster is local-first, but “local-first” does not mean every optional
224
230
 
225
231
  | Data | Local profile | Optional AI roast | Hosted profile cache |
226
232
  | --- | --- | --- | --- |
227
- | Raw user prompts | Used locally | Never sent | Never stored |
233
+ | Prompt text you typed | Used locally | Never sent | Never stored |
228
234
  | Local paths and configuration | Local only | Never sent | Never stored |
229
235
  | Aggregate categories and scores | Computed locally | Sent when explicitly enabled | Stored as a compact snapshot |
230
236
  | Generated roast and Hashtags | Local result | Returned by selected model | Stored for stable signed-in profiles |
@@ -232,7 +238,7 @@ Vibe Roaster is local-first, but “local-first” does not mean every optional
232
238
 
233
239
  The UI opens through localhost, but the Node server is a local development service rather than a hardened public endpoint. Do not expose port `7681` to an untrusted network.
234
240
 
235
- Hosted GitHub sessions are stored outside the project under `~/.vibe-wrapper/` with owner-only permissions. A cached roast is reused until the profile changes materially, avoiding repeated model calls and unstable results.
241
+ Hosted GitHub sessions are stored outside the project under `~/.vibe-roast/` with owner-only permissions. A cached roast is reused until the profile changes materially, avoiding repeated model calls and unstable results.
236
242
 
237
243
  ## Supported sources
238
244
 
@@ -253,7 +259,7 @@ Vibe Roaster inspects the sources it can find and treats missing roots as empty.
253
259
  | Amazon Q | `amazonq` | `~/.aws/amazonq/history` |
254
260
  | Antigravity | `antigravity` | `~/.gemini/antigravity(-ide)/conversations` |
255
261
  | TokenTracker | activity only | `~/.tokentracker/tracker/queue.jsonl` |
256
- | Vibe tracker | `vibe-tracker` | `~/.vibe-wrapper/sessions.jsonl` |
262
+ | Vibe tracker | `vibe-tracker` | `~/.vibe-roast/sessions.jsonl` |
257
263
 
258
264
  Cursor is best-effort and requires the local `sqlite3` command. Encrypted or binary histories are skipped rather than guessed.
259
265
 
@@ -322,8 +328,9 @@ Most users need no environment variables.
322
328
  | Variable | Purpose |
323
329
  | --- | --- |
324
330
  | `PORT` | Change the local server port from `7681` |
325
- | `VIBE_WRAPPER_NO_OPEN=1` | Start without opening the browser |
326
- | `VIBE_WRAPPER_AUTH_BROKER_URL` | Override the hosted OAuth/AI broker for development or self-hosting |
331
+ | `VIBE_ROAST_NO_OPEN=1` | Start without opening the browser |
332
+ | `VIBE_ROAST_PLAIN_OUTPUT=1` | Disable terminal color and launch animation |
333
+ | `VIBE_ROAST_AUTH_BROKER_URL` | Override the hosted OAuth/AI broker for development or self-hosting |
327
334
  | `DEEPSEEK_BASE_URL` | Override the default DeepSeek-compatible endpoint |
328
335
  | `DEEPSEEK_MODEL` | Override the default DeepSeek model |
329
336
 
@@ -347,7 +354,7 @@ npm run serve
347
354
 
348
355
  ```bash
349
356
  # terminal 1: API and local assets
350
- VIBE_WRAPPER_NO_OPEN=1 npm run serve
357
+ VIBE_ROAST_NO_OPEN=1 npm run serve
351
358
 
352
359
  # terminal 2: Vite HMR
353
360
  npm run dev
package/assests/README.md CHANGED
@@ -10,7 +10,6 @@ Figures, badges, and banners for the **Roast Result** product UI at the repo roo
10
10
  - **8 badges** — symbolic icons (64×64 SVG, not mascot crops)
11
11
  - Old SBTI diamond rasters archived as `*.sbti-archive.svg`
12
12
  - **`scripts/score-engine.js`** — four-axis type and six-dimension reference helpers (Node mirrors this in `src/lib/agent-score.js`)
13
- - **`live-report.html`** — optional static export of a live inspect snapshot (not the primary UI)
14
13
 
15
14
  ## Style
16
15
 
@@ -30,11 +29,8 @@ assests/
30
29
  │ └── *.sbti-archive.svg # old SBTI diamond cards
31
30
  ├── badges/01-builder … 08-yolo-shipper/
32
31
  ├── banners/ home-hero.* share-strip.* result-header.*
33
- ├── live-report.html # optional static roast export
34
- ├── notes/live-inspect-summary.json # redacted snapshot for live-report
35
32
  ├── scripts/score-engine.js # type and behavior-dimension reference helpers
36
33
  ├── scripts/vibe-types.json # 16-type figure manifest
37
- ├── scripts/roast-extras.js # word cloud / heatmap / share poster helpers
38
34
  ├── source/design-system.md
39
35
  ├── source/vibe-types-visual-brief.md
40
36
  └── source/references/ # legacy SBTI boards + badge board
@@ -43,7 +43,7 @@ Primary style: classic 16Personalities geometric faceted flat vector (Piotr Antk
43
43
 
44
44
  - Roast Result places the figure **on a soft abstract stage blob** — not inside a bordered card.
45
45
  - Figure PNGs use `mix-blend-mode: multiply` so light scene canvases dissolve into the page (no rectangular card chrome).
46
- - Score / tier / signals sit beside/below the figure in the React Roast Result UI (and optional `live-report.html` export).
46
+ - Score / tier / signals sit beside/below the figure in the React Roast Result UI.
47
47
 
48
48
  ## Preview
49
49
 
package/bin/hook.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- /* Vibe Wrapper SessionEnd hook — receives hook data from stdin,
2
+ /* Vibe Roaster SessionEnd hook — receives hook data from stdin,
3
3
  reads the transcript to extract token usage, appends to local store. */
4
4
 
5
5
  const fs = require("node:fs");
@@ -7,7 +7,7 @@ const path = require("node:path");
7
7
  const os = require("node:os");
8
8
  const { createInterface } = require("node:readline");
9
9
 
10
- const STORE_DIR = path.join(os.homedir(), ".vibe-wrapper");
10
+ const STORE_DIR = path.join(os.homedir(), ".vibe-roast");
11
11
  const STORE_FILE = path.join(STORE_DIR, "sessions.jsonl");
12
12
 
13
13
  async function main() {
@@ -62,8 +62,10 @@ async function main() {
62
62
  };
63
63
 
64
64
  // Append to store
65
- fs.mkdirSync(STORE_DIR, { recursive: true });
66
- fs.appendFileSync(STORE_FILE, JSON.stringify(record) + "\n");
65
+ fs.mkdirSync(STORE_DIR, { recursive: true, mode: 0o700 });
66
+ fs.chmodSync(STORE_DIR, 0o700);
67
+ fs.appendFileSync(STORE_FILE, JSON.stringify(record) + "\n", { mode: 0o600 });
68
+ fs.chmodSync(STORE_FILE, 0o600);
67
69
 
68
70
  // Return success (non-blocking)
69
71
  process.stdout.write(JSON.stringify({ continue: true }) + "\n");
@@ -165,4 +165,4 @@ Error generating stack: `+l.message+`
165
165
  * Released under the MIT license
166
166
  */var Pp=jl.exports,wc;function zp(){return wc||(wc=1,(function(a){window.setImmediate||(window.setImmediate=(function(){return window.msSetImmediate||window.webkitSetImmediate||window.mozSetImmediate||window.oSetImmediate||(function(){if(!window.postMessage||!window.addEventListener)return null;var d=[void 0],f="zero-timeout-message",v=function(g){var p=d.length;return d.push(g),window.postMessage(f+p.toString(36),"*"),p};return window.addEventListener("message",function(g){if(!(typeof g.data!="string"||g.data.substr(0,f.length)!==f)){g.stopImmediatePropagation();var p=parseInt(g.data.substr(f.length),36);d[p]&&(d[p](),d[p]=void 0)}},!0),window.clearImmediate=function(g){d[g]&&(d[g]=void 0)},v})()||function(d){window.setTimeout(d,0)}})()),window.clearImmediate||(window.clearImmediate=(function(){return window.msClearImmediate||window.webkitClearImmediate||window.mozClearImmediate||window.oClearImmediate||function(d){window.clearTimeout(d)}})()),(function(c){var u=(function(){var y=document.createElement("canvas");if(!y||!y.getContext)return!1;var C=y.getContext("2d");return!(!C||!C.getImageData||!C.fillText||!Array.prototype.some||!Array.prototype.push)})(),d=(function(){if(u){for(var y=document.createElement("canvas").getContext("2d"),C=20,E,w;C;){if(y.font=C.toString(10)+"px sans-serif",y.measureText("W").width===E&&y.measureText("m").width===w)return C+1;E=y.measureText("W").width,w=y.measureText("m").width,C--}return 0}})(),f=function(p){if(Array.isArray(p)){var y=p.slice();return y.splice(0,2),y}else return[]},v=function(y){for(var C,E,w=y.length;w;)C=Math.floor(Math.random()*w),E=y[--w],y[w]=y[C],y[C]=E;return y},m={},g=function(y,C){if(!u)return;var E=Math.floor(Math.random()*Date.now());Array.isArray(y)||(y=[y]),y.forEach(function(_e,A){if(typeof _e=="string"){if(y[A]=document.getElementById(_e),!y[A])throw new Error("The element id specified is not found.")}else if(!_e.tagName&&!_e.appendChild)throw new Error("You must pass valid HTML elements, or ID of the element.")});var w={list:[],fontFamily:'"Trebuchet MS", "Heiti TC", "微軟正黑體", "Arial Unicode MS", "Droid Fallback Sans", sans-serif',fontWeight:"normal",color:"random-dark",minSize:0,weightFactor:1,clearCanvas:!0,backgroundColor:"#fff",gridSize:8,drawOutOfBound:!1,shrinkToFit:!1,origin:null,drawMask:!1,maskColor:"rgba(255,0,0,0.3)",maskGapWidth:.3,wait:0,abortThreshold:0,abort:function(){},minRotation:-Math.PI/2,maxRotation:Math.PI/2,rotationSteps:0,shuffle:!0,rotateRatio:.1,shape:"circle",ellipticity:.65,classes:null,hover:null,click:null};if(C)for(var G in C)G in w&&(w[G]=C[G]);if(typeof w.weightFactor!="function"){var O=w.weightFactor;w.weightFactor=function(A){return A*O}}if(typeof w.shape!="function")switch(w.shape){case"circle":default:w.shape="circle";break;case"cardioid":w.shape=function(A){return 1-Math.sin(A)};break;case"diamond":w.shape=function(A){var Z=A%(2*Math.PI/4);return 1/(Math.cos(Z)+Math.sin(Z))};break;case"square":w.shape=function(A){return Math.min(1/Math.abs(Math.cos(A)),1/Math.abs(Math.sin(A)))};break;case"triangle-forward":w.shape=function(A){var Z=A%(2*Math.PI/3);return 1/(Math.cos(Z)+Math.sqrt(3)*Math.sin(Z))};break;case"triangle":case"triangle-upright":w.shape=function(A){var Z=(A+Math.PI*3/2)%(2*Math.PI/3);return 1/(Math.cos(Z)+Math.sqrt(3)*Math.sin(Z))};break;case"pentagon":w.shape=function(A){var Z=(A+.955)%(2*Math.PI/5);return 1/(Math.cos(Z)+.726543*Math.sin(Z))};break;case"star":w.shape=function(A){var Z=(A+.955)%(2*Math.PI/10);return(A+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-Z)+3.07768*Math.sin(2*Math.PI/10-Z)):1/(Math.cos(Z)+3.07768*Math.sin(Z))};break}w.gridSize=Math.max(Math.floor(w.gridSize),4);var T=w.gridSize,P=T-w.maskGapWidth,ie=Math.abs(w.maxRotation-w.minRotation),ue=Math.abs(Math.floor(w.rotationSteps)),F=Math.min(w.maxRotation,w.minRotation),Q,U,I,he,Se,ce,Me;function Fe(_e,A){return"hsl("+(Math.random()*360).toFixed()+","+(Math.random()*30+70).toFixed()+"%,"+(Math.random()*(A-_e)+_e).toFixed()+"%)"}switch(w.color){case"random-dark":Me=function(){return Fe(10,50)};break;case"random-light":Me=function(){return Fe(50,90)};break;default:typeof w.color=="function"&&(Me=w.color);break}var ee;typeof w.fontWeight=="function"&&(ee=w.fontWeight);var je=null;typeof w.classes=="function"&&(je=w.classes);var te=!1,ye=[],Pe,Ne=function(A){var Z=A.currentTarget,J=Z.getBoundingClientRect(),ke,pe;A.touches?(ke=A.touches[0].clientX,pe=A.touches[0].clientY):(ke=A.clientX,pe=A.clientY);var Te=ke-J.left,Ae=Te<0?0:Te,Le=pe-J.top,be=Math.floor(Ae*(Z.width/J.width||1)/T),Ye=Math.floor(Le*(Z.height/J.height||1)/T);return ye[be]?ye[be][Ye]:null},H=function(A){var Z=Ne(A);if(Pe!==Z){if(Pe=Z,!Z){w.hover(void 0,void 0,A);return}w.hover(Z.item,Z.dimension,A)}},oe=function(A){var Z=Ne(A);Z&&(w.click(Z.item,Z.dimension,A),A.preventDefault())},K=[],S=function(A){if(K[A])return K[A];var Z=A*8,J=Z,ke=[];for(A===0&&ke.push([he[0],he[1],0]);J--;){var pe=1;w.shape!=="circle"&&(pe=w.shape(J/Z*2*Math.PI)),ke.push([he[0]+A*pe*Math.cos(-J/Z*2*Math.PI),he[1]+A*pe*Math.sin(-J/Z*2*Math.PI)*w.ellipticity,J/Z*2*Math.PI])}return K[A]=ke,ke},_=function(){return w.abortThreshold>0&&new Date().getTime()-ce>w.abortThreshold},z=function(){return w.rotateRatio===0||Math.random()>w.rotateRatio?0:ie===0?F:ue>0?F+Math.floor(Math.random()*ue)*ie/(ue-1):F+Math.random()*ie},W=function(A,Z,J,ke){var pe=w.weightFactor(Z);if(pe<=w.minSize)return!1;var Te=1;pe<d&&(Te=(function(){for(var Rt=2;Rt*pe<d;)Rt+=2;return Rt})());var Ae;ee?Ae=ee(A,Z,pe,ke):Ae=w.fontWeight;var Le=document.createElement("canvas"),be=Le.getContext("2d",{willReadFrequently:!0});be.font=Ae+" "+(pe*Te).toString(10)+"px "+w.fontFamily;var Ye=be.measureText(A).width/Te,Re=Math.max(pe*Te,be.measureText("m").width,be.measureText("W").width)/Te,Ue=Ye+Re*2,D=Re*3,V=Math.ceil(Ue/T),ae=Math.ceil(D/T);Ue=V*T,D=ae*T;var Y=-Ye/2,de=-Re*.4,ve=Math.ceil((Ue*Math.abs(Math.sin(J))+D*Math.abs(Math.cos(J)))/T),De=Math.ceil((Ue*Math.abs(Math.cos(J))+D*Math.abs(Math.sin(J)))/T),Ke=De*T,He=ve*T;Le.setAttribute("width",Ke),Le.setAttribute("height",He),be.scale(1/Te,1/Te),be.translate(Ke*Te/2,He*Te/2),be.rotate(-J),be.font=Ae+" "+(pe*Te).toString(10)+"px "+w.fontFamily,be.fillStyle="#000",be.textBaseline="middle",be.fillText(A,Y*Te,(de+pe*.5)*Te);var qe=be.getImageData(0,0,Ke,He).data;if(_())return!1;for(var We=[],pt=De,rt,At,Lt,yt=[ve/2,De/2,ve/2,De/2];pt--;)for(rt=ve;rt--;){Lt=T;e:for(;Lt--;)for(At=T;At--;)if(qe[((rt*T+Lt)*Ke+(pt*T+At))*4+3]){We.push([pt,rt]),pt<yt[3]&&(yt[3]=pt),pt>yt[1]&&(yt[1]=pt),rt<yt[0]&&(yt[0]=rt),rt>yt[2]&&(yt[2]=rt);break e}}return{mu:Te,occupied:We,bounds:yt,gw:De,gh:ve,fillTextOffsetX:Y,fillTextOffsetY:de,fillTextWidth:Ye,fillTextHeight:Re,fontSize:pe}},me=function(A,Z,J,ke,pe){for(var Te=pe.length;Te--;){var Ae=A+pe[Te][0],Le=Z+pe[Te][1];if(Ae>=U||Le>=I||Ae<0||Le<0){if(!w.drawOutOfBound)return!1;continue}if(!Q[Ae][Le])return!1}return!0},X=function(A,Z,J,ke,pe,Te,Ae,Le,be,Ye){var Re=J.fontSize,Ue;Me?Ue=Me(ke,pe,Re,Te,Ae,Ye):Ue=w.color;var D;ee?D=ee(ke,pe,Re,Ye):D=w.fontWeight;var V;je?V=je(ke,pe,Re,Ye):V=w.classes,y.forEach(function(ae){if(ae.getContext){var Y=ae.getContext("2d"),de=J.mu;Y.save(),Y.scale(1/de,1/de),Y.font=D+" "+(Re*de).toString(10)+"px "+w.fontFamily,Y.fillStyle=Ue,Y.translate((A+J.gw/2)*T*de,(Z+J.gh/2)*T*de),Le!==0&&Y.rotate(-Le),Y.textBaseline="middle",Y.fillText(ke,J.fillTextOffsetX*de,(J.fillTextOffsetY+Re*.5)*de),Y.restore()}else{var ve=document.createElement("span"),De="";De="rotate("+-Le/Math.PI*180+"deg) ",J.mu!==1&&(De+="translateX(-"+J.fillTextWidth/4+"px) scale("+1/J.mu+")");var Ke={position:"absolute",display:"block",font:D+" "+Re*J.mu+"px "+w.fontFamily,left:(A+J.gw/2)*T+J.fillTextOffsetX+"px",top:(Z+J.gh/2)*T+J.fillTextOffsetY+"px",width:J.fillTextWidth+"px",height:J.fillTextHeight+"px",lineHeight:Re+"px",whiteSpace:"nowrap",transform:De,webkitTransform:De,msTransform:De,transformOrigin:"50% 40%",webkitTransformOrigin:"50% 40%",msTransformOrigin:"50% 40%"};Ue&&(Ke.color=Ue),ve.textContent=ke;for(var He in Ke)ve.style[He]=Ke[He];if(be)for(var qe in be)ve.setAttribute(qe,be[qe]);V&&(ve.className+=V),ae.appendChild(ve)}})},Ce=function(A,Z,J,ke,pe){if(!(A>=U||Z>=I||A<0||Z<0)){if(Q[A][Z]=!1,J){var Te=y[0].getContext("2d");Te.fillRect(A*T,Z*T,P,P)}te&&(ye[A][Z]={item:pe,dimension:ke})}},fe=function(A,Z,J,ke,pe,Te){var Ae=pe.occupied,Le=w.drawMask,be;Le&&(be=y[0].getContext("2d"),be.save(),be.fillStyle=w.maskColor);var Ye;if(te){var Re=pe.bounds;Ye={x:(A+Re[3])*T,y:(Z+Re[0])*T,w:(Re[1]-Re[3]+1)*T,h:(Re[2]-Re[0]+1)*T}}for(var Ue=Ae.length;Ue--;){var D=A+Ae[Ue][0],V=Z+Ae[Ue][1];D>=U||V>=I||D<0||V<0||Ce(D,V,Le,Ye,Te)}Le&&be.restore()},Ee=function _e(A){var Z,J,ke;Array.isArray(A)?(Z=A[0],J=A[1]):(Z=A.word,J=A.weight,ke=A.attributes);var pe=z(),Te=f(A),Ae=W(Z,J,pe,Te);if(!Ae||_())return!1;if(!w.drawOutOfBound&&!w.shrinkToFit){var Le=Ae.bounds;if(Le[1]-Le[3]+1>U||Le[2]-Le[0]+1>I)return!1}for(var be=Se+1,Ye=function(D){var V=Math.floor(D[0]-Ae.gw/2),ae=Math.floor(D[1]-Ae.gh/2),Y=Ae.gw,de=Ae.gh;return me(V,ae,Y,de,Ae.occupied)?(X(V,ae,Ae,Z,J,Se-be,D[2],pe,ke,Te),fe(V,ae,Y,de,Ae,A),!0):!1};be--;){var Re=S(Se-be);w.shuffle&&(Re=[].concat(Re),v(Re));var Ue=Re.some(Ye);if(Ue)return!0}return w.shrinkToFit?(Array.isArray(A)?A[1]=A[1]*3/4:A.weight=A.weight*3/4,_e(A)):!1},nt=function(A,Z,J){if(Z)return!y.some(function(ke){var pe=new CustomEvent(A,{detail:J||{}});return!ke.dispatchEvent(pe)},this);y.forEach(function(ke){var pe=new CustomEvent(A,{detail:J||{}});ke.dispatchEvent(pe)},this)},nn=function(){var A=y[0];if(A.getContext)U=Math.ceil(A.width/T),I=Math.ceil(A.height/T);else{var Z=A.getBoundingClientRect();U=Math.ceil(Z.width/T),I=Math.ceil(Z.height/T)}if(nt("wordcloudstart",!0)){he=w.origin?[w.origin[0]/T,w.origin[1]/T]:[U/2,I/2],Se=Math.floor(Math.sqrt(U*U+I*I)),Q=[];var J,ke,pe;if(!A.getContext||w.clearCanvas)for(y.forEach(function(Y){if(Y.getContext){var de=Y.getContext("2d");de.fillStyle=w.backgroundColor,de.clearRect(0,0,U*(T+1),I*(T+1)),de.fillRect(0,0,U*(T+1),I*(T+1))}else Y.textContent="",Y.style.backgroundColor=w.backgroundColor,Y.style.position="relative"}),J=U;J--;)for(Q[J]=[],ke=I;ke--;)Q[J][ke]=!0;else{var Te=document.createElement("canvas").getContext("2d");Te.fillStyle=w.backgroundColor,Te.fillRect(0,0,1,1);var Ae=Te.getImageData(0,0,1,1).data,Le=A.getContext("2d").getImageData(0,0,U*T,I*T).data;J=U;for(var be,Ye;J--;)for(Q[J]=[],ke=I;ke--;){Ye=T;e:for(;Ye--;)for(be=T;be--;)for(pe=4;pe--;)if(Le[((ke*T+Ye)*U*T+(J*T+be))*4+pe]!==Ae[pe]){Q[J][ke]=!1;break e}Q[J][ke]!==!1&&(Q[J][ke]=!0)}Le=Te=Ae=void 0}if(w.hover||w.click){for(te=!0,J=U+1;J--;)ye[J]=[];w.hover&&A.addEventListener("mousemove",H),w.click&&(A.addEventListener("click",oe),A.style.webkitTapHighlightColor="rgba(0, 0, 0, 0)"),A.addEventListener("wordcloudstart",function Y(){A.removeEventListener("wordcloudstart",Y),A.removeEventListener("mousemove",H),A.removeEventListener("click",oe),Pe=void 0})}pe=0;var Re,Ue;w.wait!==0?(Re=window.setTimeout,Ue=window.clearTimeout):(Re=window.setImmediate,Ue=window.clearImmediate);var D=function(de,ve){y.forEach(function(De){De.addEventListener(de,ve)},this)},V=function(de,ve){y.forEach(function(De){De.removeEventListener(de,ve)},this)},ae=function Y(){V("wordcloudstart",Y),Ue(m[E])};D("wordcloudstart",ae),m[E]=Re(function Y(){if(pe>=w.list.length){Ue(m[E]),nt("wordcloudstop",!1),V("wordcloudstart",ae),delete m[E];return}ce=new Date().getTime();var de=Ee(w.list[pe]),ve=!nt("wordclouddrawn",!0,{item:w.list[pe],drawn:de});if(_()||ve){Ue(m[E]),w.abort(),nt("wordcloudabort",!1),nt("wordcloudstop",!1),V("wordcloudstart",ae),delete m[E];return}pe++,m[E]=Re(Y,w.wait)},w.wait)}};nn()};g.isSupported=u,g.minFontSize=d,g.stop=function(){if(m)for(var y in m)window.clearImmediate(m[y])},a.exports?a.exports=g:c.WordCloud=g})(Pp)})(jl)),jl.exports}var Ap=zp();const wl=ws(Ap),Lp=["#c45c26","#d97706","#b45309","#8b5a2b","#6b6560","#5b8cff","#23d6a5","#e07a3a","#f0c14a","#ff5a1f"];function Rp(a,c){let u=0;for(const d of String(a||""))u=(u<<5)-u+d.codePointAt(0)|0;return c[Math.abs(u)%c.length]}function Op({words:a,width:c=600,height:u=400,className:d="",gridSize:f=null,weightDivisor:v=5.5,rotateRatio:m=.18,minRotation:g=-.35,maxRotation:p=.35,shape:y="circle",ellipticity:C=.72,minSize:E=9,colors:w=null,fontFamily:G="Outfit, system-ui, sans-serif",fillContainer:O=!0}){const T=M.useRef(null),P=M.useRef(null),[ie,ue]=M.useState({width:c,height:u});return M.useEffect(()=>{if(!O){ue({width:c,height:u});return}const F=T.current;if(!F)return;const Q=()=>{const I=F.getBoundingClientRect(),he=Math.max(180,Math.floor(I.width)||c),Se=Math.max(120,Math.floor(I.height)||u);ue(ce=>ce.width===he&&ce.height===Se?ce:{width:he,height:Se})};Q();const U=typeof ResizeObserver<"u"?new ResizeObserver(Q):null;return U==null||U.observe(F),window.addEventListener("resize",Q),()=>{U==null||U.disconnect(),window.removeEventListener("resize",Q)}},[c,u,O]),M.useEffect(()=>{const F=P.current,Q=(wl==null?void 0:wl.default)||wl||window.WordCloud;if(!F||!(a!=null&&a.length)||typeof Q!="function")return;const{width:U,height:I}=ie;if(U<2||I<2)return;const he=a.map(({term:te,weight:ye,count:Pe})=>[String(te||"").trim(),Math.max(1,Number(ye??Pe)||1)]).filter(([te])=>te.length>0);if(!he.length)return;const Se=Math.max(...he.map(([,te])=>te),1),ce=Math.min(window.devicePixelRatio||1,2.5);F.width=Math.floor(U*ce),F.height=Math.floor(I*ce),F.style.width=`${U}px`,F.style.height=`${I}px`;const Me=w!=null&&w.length?w:Lp,Fe=f??Math.max(5,Math.round(Math.min(U,I)/48)),ee=Math.min(U,I),je=te=>{const ye=te/Se;return(10+Math.pow(ye,.62)*(ee/v))*ce};return Q(F,{list:he,gridSize:Math.max(3,Math.round(Fe*ce)),weightFactor:je,fontFamily:G,fontWeight:"700",color:te=>Rp(te,Me),rotateRatio:m,minRotation:g,maxRotation:p,rotationSteps:2,backgroundColor:"transparent",shuffle:!1,shape:y,ellipticity:C,minSize:Math.max(1,E*ce),drawOutOfBound:!1,shrinkToFit:!1,clearCanvas:!0}),()=>{typeof Q.stop=="function"&&Q.stop()}},[a,ie,f,v,m,g,p,y,C,E,w,G]),!a||a.length===0?s.jsx("p",{className:"text-body-sm text-oai-gray-500",children:"No terms to display"}):s.jsxs("div",{ref:T,className:`relative flex h-full w-full min-h-[120px] items-center justify-center overflow-hidden ${d}`,children:[s.jsx("canvas",{ref:P,className:"block max-w-full","aria-hidden":"true"}),s.jsx("ul",{className:"sr-only",children:a.map(({term:F,prompt_count:Q,count:U})=>s.jsxs("li",{children:[F,": ",Q??U]},F))})]})}function zt(a){const c=Number(a||0);return Number.isFinite(c)&&c>0?c:0}function Gc(a){return zt((a==null?void 0:a.billable_total_tokens)??(a==null?void 0:a.total_tokens)??(a==null?void 0:a.value))}function Ip(a=[],c="total",u={}){const d=(a||[]).filter(p=>/^\d{4}-\d{2}-\d{2}$/.test(String((p==null?void 0:p.day)||""))).slice().sort((p,y)=>p.day.localeCompare(y.day));if(d.length===0||c==="total")return d;if(c==="custom")return d.filter(p=>(!u.from||p.day>=u.from)&&(!u.to||p.day<=u.to));const f=d[d.length-1].day;if(c==="day")return d.filter(p=>p.day===f);if(c==="month")return d.filter(p=>p.day.slice(0,7)===f.slice(0,7));const v=new Date(`${f}T00:00:00Z`),m=new Date(v);m.setUTCDate(m.getUTCDate()-6);const g=m.toISOString().slice(0,10);return d.filter(p=>p.day>=g&&p.day<=f)}function gs(a=[]){const c=new Map,u=new Map,d=new Set;let f=0;for(const m of a||[]){f+=Gc(m);for(const[g,p]of Object.entries((m==null?void 0:m.sources)||{})){const y=zt(p);y>0&&c.set(g,(c.get(g)||0)+y)}for(const g of Object.keys((m==null?void 0:m.models)||{})){d.add(g);const[p="unknown"]=String(g).split("/");u.has(p)||u.set(p,new Set),u.get(p).add(g)}}const v=[...c.entries()].map(([m,g])=>{var p;return{source:m,tokens:g,percent:f>0?g/f*100:0,modelCount:((p=u.get(m))==null?void 0:p.size)||0}}).sort((m,g)=>g.tokens-m.tokens);return{totalTokens:f,modelCount:d.size,sources:v}}function Dp(a=[]){const c=(a||[]).slice().sort((g,p)=>String(g.day).localeCompare(String(p.day)));if(c.length===0)return[];const u=new Date(`${c[0].day}T00:00:00Z`),d=new Date(`${c[c.length-1].day}T00:00:00Z`),v=Math.round((d-u)/864e5)+1>45,m=new Map;for(const g of c){const p=v?g.day.slice(0,7):g.day,y=m.get(p)||{key:p,total:0,sources:{}};y.total+=Gc(g);for(const[C,E]of Object.entries((g==null?void 0:g.sources)||{}))y.sources[C]=(y.sources[C]||0)+zt(E);m.set(p,y)}return[...m.values()]}function $p(a=[],c="all"){return c==="all"?a:a.map(u=>{var v,m;const d=zt((v=u==null?void 0:u.sources)==null?void 0:v[c]),f=Object.fromEntries(Object.entries((u==null?void 0:u.models)||{}).filter(([g])=>String(g).split("/")[0]===c));return{...u,value:d,total_tokens:d,billable_total_tokens:d,sources:d>0?{[c]:d}:{},models:f,context_breakdown:(m=u==null?void 0:u.context_breakdown)!=null&&m[c]?{[c]:u.context_breakdown[c]}:{}}})}function Fp(a=[],{estimatedCostUsd:c=0}={}){const u=new Map;let d=0;for(const v of a||[])for(const[m,g]of Object.entries((v==null?void 0:v.models)||{})){const p=zt(g);if(p===0)continue;const[y="unknown",...C]=String(m).split("/"),E=C.join("/")||y,w=E.toLowerCase(),G=u.get(w)||{model:E,tokens:0,sources:{}};G.tokens+=p,G.sources[y]=(G.sources[y]||0)+p,u.set(w,G),d+=p}const f=zt(c);return{totalTokens:d,models:[...u.values()].map(v=>{var p;const m=((p=Object.entries(v.sources).sort((y,C)=>C[1]-y[1])[0])==null?void 0:p[0])||"unknown",g=d>0?v.tokens/d*100:0;return{...v,dominantSource:m,percent:g,estimatedCostUsd:f>0?f*(v.tokens/d):0}}).sort((v,m)=>m.tokens-v.tokens||v.model.localeCompare(m.model))}}function Up(a=[]){var u,d;const c=new Map;for(const f of a||[])for(const[v,m]of Object.entries((f==null?void 0:f.context_breakdown)||{})){const g=c.get(v)||{source:v,categories:{messages:0,tool_calls:0,reasoning:0,system_prompt:0,custom_agents:0},rawTotalTokens:0,referenceTokens:0,inputTokens:0,cachedInputTokens:0,toolCallCount:0,eventCount:0,methods:new Set};for(const p of Object.keys(g.categories))g.categories[p]+=zt((u=m==null?void 0:m.categories)==null?void 0:u[p]);g.rawTotalTokens+=zt(m==null?void 0:m.total_tokens),g.referenceTokens+=zt((d=f==null?void 0:f.sources)==null?void 0:d[v]),g.inputTokens+=zt(m==null?void 0:m.input_tokens),g.cachedInputTokens+=zt(m==null?void 0:m.cached_input_tokens),g.toolCallCount+=zt(m==null?void 0:m.tool_call_count),g.eventCount+=zt(m==null?void 0:m.event_count),m!=null&&m.method&&g.methods.add(m.method),c.set(v,g)}return[...c.values()].filter(f=>f.rawTotalTokens>0&&f.referenceTokens>0).map(f=>{const v=f.rawTotalTokens>0?f.referenceTokens/f.rawTotalTokens:1,m=Object.entries(f.categories).map(([g,p])=>({key:g,tokens:p*v,percent:f.referenceTokens>0?p*v/f.referenceTokens*100:0})).filter(g=>g.tokens>0).sort((g,p)=>p.tokens-g.tokens);return{...f,methods:[...f.methods],totalTokens:f.referenceTokens,cacheHitRate:f.inputTokens>0?f.cachedInputTokens/f.inputTokens*100:0,categories:m}}).sort((f,v)=>v.totalTokens-f.totalTokens)}const Hp={planning:{en:"Planning",zh:"方案设计"},debugging:{en:"Debugging",zh:"调试修复"},implementation:{en:"Building",zh:"功能实现"},refactor:{en:"Refactoring",zh:"代码重构"},testing:{en:"Testing",zh:"测试验证"},packaging:{en:"Shipping",zh:"构建发布"},explanation:{en:"Explaining",zh:"原理解释"},research:{en:"Research",zh:"技术调研"},ui_design:{en:"UI Design",zh:"UI 设计"},workflow:{en:"Agent Workflow",zh:"Agent 工作流"}},Bp=new Map([["concept:testing","category:testing"],["concept:refactor","category:refactor"],["concept:debugging","category:debugging"],["concept:design","category:ui_design"],["concept:workflow","category:workflow"]]);function Yc(a){var c;return((c=[...a.entries()].sort((u,d)=>d[1].promptCount-u[1].promptCount||d[1].count-u[1].count||u[0].length-d[0].length||u[0].localeCompare(d[0]))[0])==null?void 0:c[0])||""}function Wp(a=[],c=[],u="total",d={},f="all"){var g,p;let v="",m="";if(u==="custom")v=d.from||"",m=d.to||"";else if(u!=="total"&&(v=((g=c[0])==null?void 0:g.day)||"",m=((p=c[c.length-1])==null?void 0:p.day)||"",!v||!m))return[];return a.filter(y=>{if(f!=="all"&&y.source!==f)return!1;if(u==="total"&&!v&&!m)return!0;const C=String(y.timestamp||"").slice(0,10);return/^\d{4}-\d{2}-\d{2}$/.test(C)?(!v||C>=v)&&(!m||C<=m):!1})}function Sc(a=[],{locale:c="en",limit:u=36,domainWeights:d={}}={}){const f=new Map,v=new Set(a.map(m=>String(m.timestamp||"").slice(0,7)).filter(m=>/^\d{4}-\d{2}$/.test(m))).size;for(const m of a){const g=String(m.timestamp||"").slice(0,7);for(const p of m.concepts||[]){const y=f.get(p.key)||{key:p.key,kind:p.kind||"term",vibe:!!p.vibe,acronym:!!p.acronym,count:0,promptCount:0,months:new Map,variants:new Map};y.vibe=y.vibe||!!p.vibe,y.acronym=y.acronym||!!p.acronym;let C=0;for(const[E,w]of Object.entries(p.variants||{})){const G=Math.max(0,Number(w)||0);if(G===0)continue;const O=y.variants.get(E)||{count:0,promptCount:0};O.count+=G,O.promptCount+=1,y.variants.set(E,O),C+=G}C!==0&&(y.count+=C,y.promptCount+=1,/^\d{4}-\d{2}$/.test(g)&&y.months.set(g,(y.months.get(g)||0)+1),f.set(p.key,y))}}return[...f.values()].filter(m=>{const g=Bp.get(m.key);return g&&f.has(g)?!1:Vp(m,a.length,v,Number(d[m.key]||0))}).map(m=>{var P;const g=m.key.startsWith("category:")?m.key.slice(9):"",p=m.kind!=="category"&&!m.vibe,y=g?((P=Hp[g])==null?void 0:P[c==="zh"?"zh":"en"])||g:Yc(m.variants),C=Math.max(0,m.count-m.promptCount),E=m.kind==="category"?1.12:1,w=(m.promptCount+Math.log2(1+C)*.35)*E,G=m.count/Math.max(1,m.promptCount),O=Math.log2(1+m.promptCount)*Math.pow(Math.min(3,G),2)*10*(m.acronym?1.2:1),T=Number(d[m.key]||0)*.85;return{key:m.key,kind:p?"domain":m.kind,term:y,count:m.count,prompt_count:m.promptCount,weight:Number((p?Math.max(O,T):w).toFixed(3))}}).filter(m=>m.term).sort((m,g)=>g.weight-m.weight||g.prompt_count-m.prompt_count||g.count-m.count||m.term.localeCompare(g.term)).slice(0,u)}function Vp(a,c,u,d=0){if(a.kind==="category"||a.vibe||d>0)return!0;const f=Math.min(12,Math.max(3,Math.ceil(c*.006)));if(a.promptCount<f)return!1;if(a.acronym)return!0;const v=Yc(a.variants);if(!(/^[\p{Script=Han}]{2,}$/u.test(v)||/^[a-z][a-z0-9-]{3,}$/i.test(v))||a.months.size===0)return!1;if(u<=3)return!0;const p=Math.max(0,...a.months.values())/a.promptCount;return a.months.size<=2||p>=.45}const Gp=["day","week","month","total","custom"],Yp={cursor:"#18b981",codex:"#3b82f6",claude:"#df7854",opencode:"#8b5cf6",gemini:"#22d3ee",copilot:"#facc15"},Cc=["#f59e0b","#ec4899","#14b8a6","#6366f1"],Kp=["#ff5a1f","#f0c14a","#e07a3a","#c45c26","#8b5a2b","#23d6a5","#5b8cff","#6b6560","#d97706","#b45309"];function bl(a,c=0){return Yp[js(a)]||Cc[c%Cc.length]}function Ns(a){const c=Number(a)||0;return c<1e3?c.toLocaleString():c<1e6?`${(c/1e3).toFixed(c>=1e4?0:1)}K`:c<1e9?`${(c/1e6).toFixed(c>=1e8?0:1)}M`:`${(c/1e9).toFixed(c>=1e10?1:2)}B`}function Qp(a,c){return(c?{day:"日",week:"周",month:"月",total:"全部",custom:"自定义"}:{day:"Day",week:"Week",month:"Month",total:"Total",custom:"Custom"})[a]}function Xp({value:a}){const[c,u]=M.useState(0);return M.useEffect(()=>{var p;if((p=window.matchMedia)==null?void 0:p.call(window,"(prefers-reduced-motion: reduce)").matches){u(a);return}u(0);let f;const v=performance.now(),m=850,g=y=>{const C=Math.min(1,(y-v)/m),E=1-Math.pow(1-C,4);u(a*E),C<1&&(f=requestAnimationFrame(g))};return f=requestAnimationFrame(g),()=>cancelAnimationFrame(f)},[a]),Ns(c)}function Zp({activity:a,wordCloudRecords:c=[]}){const{locale:u,t:d}=Xn(),f=u==="zh",[v,m]=M.useState("total"),[g,p]=M.useState("all"),[y,C]=M.useState({from:"",to:""}),[E,w]=M.useState(!1),G=(a==null?void 0:a.daily_rows)||[],O=M.useMemo(()=>Ip(G,v,y),[G,v,y]),T=M.useMemo(()=>gs(O),[O]),P=M.useMemo(()=>gs(G),[G]),ie=M.useMemo(()=>$p(O,g),[O,g]),ue=M.useMemo(()=>gs(ie),[ie]),F=M.useMemo(()=>Dp(ie),[ie]),Q=M.useMemo(()=>Wp(c,O,v,y,g),[c,O,v,y,g]),U=M.useMemo(()=>Object.fromEntries(Sc(c,{locale:u,limit:500}).filter(ee=>ee.kind==="domain").map(ee=>[ee.key,ee.weight])),[c,u]),I=M.useMemo(()=>Sc(Q,{locale:u,limit:36,domainWeights:U}),[Q,u,U]),he=Number((a==null?void 0:a.estimated_cost_usd)||0)*(P.totalTokens>0?ue.totalTokens/P.totalTokens:0),Se=M.useMemo(()=>Fp(ie,{estimatedCostUsd:he}),[ie,he]),ce=M.useMemo(()=>Up(ie),[ie]),Me=g==="codex"||g==="claude"?ce.find(ee=>ee.source===g):null,Fe=T.sources;return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("section",{className:"motion-reveal motion-surface rounded-[18px] border border-black/[0.06] bg-[#fffcf7] p-5 shadow-[0_10px_30px_rgba(40,28,12,0.06)] dark:border-white/[0.08]",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsx("div",{className:"flex flex-wrap items-center gap-1",role:"tablist","aria-label":d("usage.period"),children:Gp.map(ee=>s.jsx("button",{type:"button",role:"tab","aria-selected":v===ee,onClick:()=>m(ee),className:`motion-button rounded-lg px-3 py-2 text-xs font-medium transition-colors ${v===ee?"bg-black/[0.07] text-[#1a1a1a] dark:bg-white/[0.09] dark:text-white":"text-[#6b6560] hover:bg-black/[0.04] dark:text-[#b0b0b0] dark:hover:bg-white/[0.05]"}`,children:Qp(ee,f)},ee))}),s.jsxs("select",{value:g,onChange:ee=>p(ee.target.value),className:"h-9 rounded-lg border border-black/[0.1] bg-transparent px-3 text-xs font-medium text-[#1a1a1a] outline-none dark:border-white/[0.12] dark:text-white","aria-label":d("usage.agentFilter"),children:[s.jsx("option",{value:"all",children:d("usage.allAgents")}),Fe.map(ee=>s.jsx("option",{value:ee.source,children:Nl(ee.source)},ee.source))]})]}),v==="custom"&&s.jsxs("div",{className:"mt-3 flex flex-wrap justify-end gap-2",children:[s.jsx("input",{type:"date",value:y.from,onChange:ee=>C(je=>({...je,from:ee.target.value})),className:"rounded-lg border border-black/[0.1] bg-transparent px-2 py-1.5 text-xs dark:border-white/[0.12]","aria-label":d("usage.from")}),s.jsx("span",{className:"self-center text-xs text-[#8b8680] dark:text-[#8f8f8f]",children:"→"}),s.jsx("input",{type:"date",value:y.to,onChange:ee=>C(je=>({...je,to:ee.target.value})),className:"rounded-lg border border-black/[0.1] bg-transparent px-2 py-1.5 text-xs dark:border-white/[0.12]","aria-label":d("usage.to")})]}),s.jsxs("div",{className:"py-7 text-center",children:[s.jsx("div",{className:"text-xs font-medium uppercase tracking-[0.08em] text-[#6b6560] dark:text-[#b0b0b0]",children:(a==null?void 0:a.metric)==="tokens"?d("profile.stat.totalTokens"):d("profile.stat.totalPrompts")}),s.jsx("div",{className:"mt-2 font-[JetBrains_Mono,ui-monospace,monospace] text-[58px] font-bold leading-none tracking-[-0.05em]",children:s.jsx(Xp,{value:ue.totalTokens})}),he>0&&s.jsxs("div",{className:"mt-5 flex items-baseline justify-center gap-2",children:[s.jsx("span",{className:"text-[10px] font-bold uppercase tracking-[0.12em] text-[#8b8680] dark:text-[#8f8f8f]",children:d("profile.stat.estCost")}),s.jsxs("span",{className:"text-xl font-bold text-emerald-500",children:["$",he.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]})]})]}),s.jsx("div",{className:"mb-5 flex h-1.5 overflow-hidden rounded-full bg-black/[0.06] dark:bg-white/[0.06]",children:(g==="all"?ue.sources:ue.sources.slice(0,1)).map((ee,je)=>s.jsx("span",{className:"usage-segment",style:{width:g==="all"?`${ee.percent}%`:"100%",background:bl(ee.source,je),"--motion-delay":`${je*70}ms`}},ee.source))}),s.jsxs("div",{className:"grid grid-cols-2 gap-2.5 sm:grid-cols-3 xl:grid-cols-5",children:[s.jsx(bc,{source:"all",selected:g==="all",percent:T.totalTokens>0?100:0,modelCount:T.modelCount,onClick:()=>p("all"),t:d}),Fe.map((ee,je)=>s.jsx(bc,{...ee,selected:g===ee.source,color:bl(ee.source,je),onClick:()=>p(ee.source),t:d},ee.source))]}),s.jsxs("div",{className:"mt-5 border-t border-black/[0.07] pt-4 dark:border-white/[0.08]",children:[s.jsxs("div",{className:"mb-2 flex flex-wrap items-end justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] font-bold uppercase tracking-[0.18em] text-[#8b8680] dark:text-[#8f8f8f]",children:d("usage.cloudKicker")}),s.jsx("h2",{className:"m-0 mt-0.5 text-sm font-semibold uppercase tracking-[0.03em] text-[#393633] dark:text-[#d4d4d4]",children:d("usage.cloud")})]}),s.jsx("span",{className:"text-[11px] text-[#8b8680] dark:text-[#8f8f8f]",children:d("usage.cloudPromptCount",{count:Q.length})})]}),s.jsx("div",{className:"h-[170px] w-full overflow-hidden rounded-xl bg-[#f7f4ef] dark:bg-black/20",children:I.length>0?s.jsx(Op,{words:I,width:860,height:170,gridSize:3,weightDivisor:4.2,rotateRatio:.06,minRotation:-.16,maxRotation:.16,ellipticity:.92,minSize:7,colors:Kp,fontFamily:"Outfit, system-ui, sans-serif"}):s.jsx("div",{className:"flex h-full items-center justify-center px-4 text-center text-sm text-[#8b8680] dark:text-[#8f8f8f]",children:d("usage.cloudEmpty")})})]}),s.jsx(Jp,{breakdown:Me,source:g,t:d}),s.jsx(qp,{usage:Se,showAll:E,onToggle:()=>w(ee=>!ee),zh:f,t:d})]}),s.jsx(tm,{trend:F,sources:Fe,zh:f,t:d})]})}function qp({usage:a,showAll:c,onToggle:u,zh:d,t:f}){const v=(a==null?void 0:a.models)||[];if(v.length===0)return null;const m=c?v:v.slice(0,6),g=v.length>m.length||c,p=m.some(y=>y.estimatedCostUsd>0);return s.jsxs("div",{className:"mt-4 border-t border-black/[0.07] pt-3 dark:border-white/[0.08]",children:[s.jsxs("div",{className:"mb-0.5 flex items-end justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] font-bold uppercase tracking-[0.18em] text-[#8b8680] dark:text-[#8f8f8f]",children:f("usage.modelKicker")}),s.jsx("h2",{className:"m-0 mt-0.5 text-sm font-semibold uppercase tracking-[0.03em] text-[#393633] dark:text-[#d4d4d4]",children:f("usage.models")})]}),s.jsx("span",{className:"text-[11px] text-[#8b8680] dark:text-[#8f8f8f]",children:f("profile.stat.modelCount",{count:v.length})})]}),s.jsx("div",{children:m.map(y=>s.jsxs("div",{className:"border-b border-black/[0.055] py-1.5 last:border-b-0 dark:border-white/[0.065]",children:[s.jsxs("div",{className:`grid items-baseline gap-x-3 text-xs ${p?"grid-cols-[minmax(0,1fr)_auto_auto_auto]":"grid-cols-[minmax(0,1fr)_auto_auto]"}`,children:[s.jsx("span",{className:"truncate font-medium text-[#393633] dark:text-[#d4d4d4]",title:y.model,children:em(y.model,d)}),s.jsx("span",{className:"font-[JetBrains_Mono,ui-monospace,monospace] tabular-nums text-[#6b6560] dark:text-[#b0b0b0]",children:Ns(y.tokens)}),p&&s.jsx("span",{className:"min-w-[56px] text-right tabular-nums text-[#8b8680] dark:text-[#8f8f8f]",children:y.estimatedCostUsd>0?`$${y.estimatedCostUsd.toLocaleString(void 0,{maximumFractionDigits:2})}`:"—"}),s.jsxs("span",{className:"w-[46px] text-right font-[JetBrains_Mono,ui-monospace,monospace] tabular-nums text-[#393633] dark:text-[#d4d4d4]",children:[y.percent<.1&&y.percent>0?"<0.1":y.percent.toFixed(1),"%"]})]}),s.jsx("div",{className:"mt-1 h-[2px] overflow-hidden rounded-full bg-black/[0.06] dark:bg-white/[0.07]",children:s.jsx("span",{className:"block h-full origin-left rounded-full",style:{width:`${Math.max(.5,y.percent)}%`,background:bl(y.dominantSource)}})})]},y.model))}),g&&s.jsxs("button",{type:"button",onClick:u,className:"motion-button mt-2 inline-flex items-center gap-1 rounded-lg px-2 py-1.5 text-xs font-medium text-[#6b6560] hover:bg-black/[0.04] dark:text-[#b0b0b0] dark:hover:bg-white/[0.05]",children:[c?s.jsx(ip,{size:13}):s.jsx(Hc,{size:13}),c?f("usage.showLessModels"):f("usage.showAllModels",{count:v.length})]})]})}const jc={messages:"#2997dc",tool_calls:"#3f8bc5",reasoning:"#78a9cf",system_prompt:"#8a9cab",custom_agents:"#5f7890"};function Jp({breakdown:a,source:c,t:u}){return a?s.jsxs("div",{className:"mt-4 border-t border-black/[0.07] pt-3 dark:border-white/[0.08]",children:[s.jsx("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] font-bold uppercase tracking-[0.18em] text-[#8b8680] dark:text-[#8f8f8f]",children:u("usage.contextKicker")}),s.jsxs("h2",{className:"m-0 mt-0.5 flex items-center gap-1.5 text-sm font-semibold text-[#393633] dark:text-[#d4d4d4]",children:[s.jsx(bs,{agent:c,size:16}),u("usage.contextTitle",{agent:Nl(c)})]})]})}),s.jsxs("div",{className:"mb-2 flex flex-wrap gap-x-3 gap-y-1 text-[10px] text-[#8b8680] dark:text-[#8f8f8f]",children:[a.cacheHitRate>0&&s.jsx("span",{children:u("usage.cacheHit",{percent:Math.round(a.cacheHitRate)})}),s.jsx("span",{children:u("usage.contextEvents",{count:a.eventCount})}),a.toolCallCount>0&&s.jsx("span",{children:u("usage.toolCallCount",{count:a.toolCallCount})})]}),s.jsx("div",{className:"space-y-0.5",children:a.categories.map(d=>s.jsxs("div",{className:"relative grid min-h-6 grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-3 overflow-hidden rounded px-1.5 text-[11px]",children:[s.jsx("span",{className:"absolute inset-y-0 left-0 opacity-[0.14]",style:{width:`${Math.max(1,d.percent)}%`,background:jc[d.key]}}),s.jsxs("span",{className:"relative flex items-center gap-1.5 text-[#4b4743] dark:text-[#c8c8c8]",children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full",style:{background:jc[d.key]}}),u(`usage.context.${d.key}`)]}),s.jsx("span",{className:"relative font-[JetBrains_Mono,ui-monospace,monospace] tabular-nums text-[#6b6560] dark:text-[#b0b0b0]",children:Ns(d.tokens)}),s.jsxs("span",{className:"relative w-[44px] text-right tabular-nums text-[#8b8680] dark:text-[#8f8f8f]",children:[d.percent<.1?"<0.1":d.percent.toFixed(1),"%"]})]},d.key))}),s.jsxs("details",{className:"mt-2 text-[10px] text-[#99938d] dark:text-[#777]",children:[s.jsx("summary",{className:"w-fit cursor-pointer select-none font-medium underline-offset-2 hover:underline",children:u("usage.methodology")}),s.jsx("p",{className:"mb-0 mt-1.5 max-w-2xl leading-relaxed",children:u(c==="codex"?"usage.contextCodexNote":"usage.contextClaudeNote")})]})]}):null}function em(a,c){return a==="auto"?c?"自动路由":"Auto routing":a==="unknown"?c?"未知模型":"Unknown model":a}function bc({source:a,percent:c,modelCount:u,selected:d,color:f,onClick:v,t:m}){const g=a==="all";return s.jsxs("button",{type:"button",onClick:v,className:`motion-button motion-source-card min-w-0 rounded-xl border p-3 text-left transition-colors ${d?"border-emerald-500/45 bg-emerald-500/[0.05]":"border-black/[0.12] hover:border-black/[0.22] dark:border-white/[0.14] dark:hover:border-white/[0.24]"}`,children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold uppercase",children:[g?s.jsx("span",{className:"inline-flex h-[18px] w-[18px] items-center justify-center",children:"◈"}):s.jsx(bs,{agent:a,size:18}),s.jsx("span",{className:"truncate",children:g?m("usage.all"):Nl(a)})]}),s.jsxs("div",{className:"mt-2 text-xl font-bold tabular-nums",style:g?void 0:{color:f},children:[c<.01&&c>0?"<0.01":c.toFixed(2),"%"]}),s.jsx("div",{className:"mt-1 text-[11px] text-[#8b8680] dark:text-[#8f8f8f]",children:m("profile.stat.modelCount",{count:u})})]})}function tm({trend:a,sources:c,zh:u,t:d}){var p,y;const f=Math.max(1,...a.map(C=>C.total)),v=c.map(C=>C.source),m=((p=a[0])==null?void 0:p.key)||"—",g=((y=a[a.length-1])==null?void 0:y.key)||"—";return s.jsxs("section",{className:"motion-reveal motion-surface rounded-[18px] border border-black/[0.06] bg-[#fffcf7] p-5 shadow-[0_10px_30px_rgba(40,28,12,0.06)] dark:border-white/[0.08]",children:[s.jsx("div",{className:"mb-4 flex items-center justify-between",children:s.jsx("h2",{className:"m-0 text-sm font-semibold uppercase tracking-[0.03em] text-[#393633] dark:text-[#d4d4d4]",children:d("usage.trend")})}),s.jsxs("div",{className:"relative h-[175px] border-y border-black/[0.07] dark:border-white/[0.08]",children:[[.25,.5,.75].map(C=>s.jsx("span",{className:"pointer-events-none absolute inset-x-0 border-t border-black/[0.06] dark:border-white/[0.07]",style:{top:`${C*100}%`}},C)),s.jsx("div",{className:"absolute inset-0 flex items-end gap-[2px] pt-2",children:a.map((C,E)=>s.jsx("div",{className:"flex h-full min-w-0 flex-1 flex-col justify-end",title:`${C.key}: ${C.total.toLocaleString()}`,children:s.jsx("div",{className:"usage-trend-bar flex w-full flex-col-reverse",style:{height:`${Math.max(2,C.total/f*100)}%`,"--motion-delay":`${Math.min(360,E*32)}ms`},children:v.map((w,G)=>{const O=Number(C.sources[w]||0);return O<=0?null:s.jsx("span",{style:{height:`${O/C.total*100}%`,background:bl(w,G)}},w)})})},`${C.key}-${C.total}`))})]}),s.jsxs("div",{className:"mt-2 flex justify-between text-xs text-[#6b6560] dark:text-[#b0b0b0]",children:[s.jsx("span",{children:Nc(m,u)}),s.jsx("span",{children:Nc(g,u)})]})]})}function Nc(a,c){if(!/^\d{4}-\d{2}(-\d{2})?$/.test(a))return a;const u=new Date(`${a}${a.length===7?"-01":""}T00:00:00Z`);return new Intl.DateTimeFormat(c?"zh-CN":"en-US",{year:"numeric",month:"short",...a.length===10?{day:"numeric"}:{},timeZone:"UTC"}).format(u)}const Ec={"01-builder":{en:"Builder",zh:"构建侠"},"02-debugger":{en:"Debugger",zh:"调试猎手"},"03-architect":{en:"Architect",zh:"架构师"},"04-codex-believer":{en:"CodexBeliever",zh:"Codex信徒"},"05-prompt-priest":{en:"PromptPriest",zh:"提示祭司"},"06-tab-hoarder":{en:"TabHoarder",zh:"标签囤积癖"},"07-context-maxxer":{en:"ContextMaxxer",zh:"上下文极限党"},"08-yolo-shipper":{en:"YoloShipper",zh:"YOLO上线狂"}},Tc={SHIP:{en:"ShipIt",zh:"直接上线"},HUNT:{en:"BugHunt",zh:"猎虫"},DRAW:{en:"Blueprint",zh:"蓝图先行"},FAITH:{en:"CodexFaith",zh:"Codex信仰"},SPELL:{en:"SpellCraft",zh:"法术工艺"},TABS:{en:"TabHoard",zh:"标签囤积"},METER:{en:"CtxMeter",zh:"上下文表"},YOLO:{en:"YoloShip",zh:"YOLO发车"}},_c={planning:{en:"Planning",zh:"规划"},debugging:{en:"Debugging",zh:"调试"},implementation:{en:"Implementation",zh:"实现"},refactor:{en:"Refactor",zh:"重构"},testing:{en:"Testing",zh:"测试"},packaging:{en:"Packaging",zh:"打包"},explanation:{en:"Explanation",zh:"讲解"},research:{en:"Research",zh:"调研"},ui_design:{en:"UIDesign",zh:"UI设计"},workflow:{en:"Workflow",zh:"工作流"}},Mc={GOD:{en:"GOD",zh:"神级"},ELITE:{en:"ELITE",zh:"精英"},SOLID:{en:"SOLID",zh:"扎实"},NPC:{en:"NPC",zh:"路人甲"},TRASH:{en:"TRASH",zh:"垃分"}};function Sl(a,c){return a?typeof a=="string"?a:c?a.zh||a.en:a.en||a.zh:""}function xs(a){return String(a||"").replace(/[_-]+/g," ").replace(/\s+/g," ").trim().split(" ").filter(Boolean).map(c=>c.charAt(0).toUpperCase()+c.slice(1).toLowerCase()).join("")}function nm(a,c){const u=a==null?void 0:a[c];if(u==null)return 0;if(typeof u=="number")return Number.isFinite(u)?u:0;const d=Number(u.count);return Number.isFinite(d)?d:0}function rm(a,c={},u={}){var G;const d=u.limit??8,f=u.locale==="zh",v=[],m=new Set;function g(O){const T=String(O||"").replace(/^#+/,"").replace(/[^A-Za-z0-9\u4e00-\u9fff]/g,"");if(!T)return;const P=`#${T}`,ie=P.toLowerCase();m.has(ie)||(m.add(ie),v.push(P))}const p=(a==null?void 0:a.archetype)||{},y=p.id||"";Ec[y]?g(Sl(Ec[y],f)):p.title&&g(f?p.title:xs(p.title)),p.code&&Tc[p.code]?g(Sl(Tc[p.code],f)):p.code&&g(/^[MA][OP][VS][FX]$/.test(p.code)?p.code:xs(p.code));const C=(G=a==null?void 0:a.tier)==null?void 0:G.id;!(a!=null&&a.type_code)&&C&&Mc[C]?g(Sl(Mc[C],f)):!(a!=null&&a.type_code)&&C&&g(C);const E=Object.keys(_c).map(O=>[O,nm(c,O)]).filter(([,O])=>O>0).sort((O,T)=>T[1]-O[1]);for(const[O]of E)if(g(Sl(_c[O],f)),v.length>=d)break;const w=f&&p.hookZh||p.hook;if(w){const O=String(w).split(/[\s·•\-–—,/,、]+/)[0];O&&O.length>1&&g(f?O:xs(O))}return v.slice(0,d)}function om(a=[],c=8){const u=[],d=new Set;for(const f of a||[]){const v=String(f||"").replace(/^#+/,"").replace(/[^A-Za-z0-9\u4e00-\u9fff]/g,"");if(!v)continue;const m=v.toLowerCase();d.has(m)||(d.add(m),u.push(`#${v}`))}return u.slice(0,c)}const Qn="#171717",Kc="#f4f0e8",Qc="#706a63";function Pc(a){return new Promise((c,u)=>{const d=new Image;d.crossOrigin="anonymous",d.onload=()=>c(d),d.onerror=()=>u(new Error(`Failed to load image: ${a}`)),d.src=a})}function ys(a,c){const u=String(a||"").replace("#","");if(/^[0-9a-f]{6}$/i.test(u)){const d=Number.parseInt(u,16);return`rgba(${d>>16&255}, ${d>>8&255}, ${d&255}, ${c})`}return a}function lm(a,c=.8){const u=String(a).replace("#","");if(!/^[0-9a-f]{6}$/i.test(u))return Kc;const d=Number.parseInt(u,16),f=[d>>16&255,d>>8&255,d&255],v=[244,240,232],m=f.map((g,p)=>Math.round(g*(1-c)+v[p]*c));return`rgb(${m[0]}, ${m[1]}, ${m[2]})`}function am(a,c,u){const d=String(c||"").trim();if(!d)return[];const f=(d.match(/[\u3400-\u9fff]/g)||[]).length>d.length*.2,v=f?[...d]:d.split(/\s+/),m=f?"":" ",g=[];let p="";for(const y of v){const C=p?`${p}${m}${y}`:y;a.measureText(C).width<=u||!p?p=C:(g.push(p),p=y)}return p&&g.push(p),g}function ks(a,c,u,d,f,v,m){const g=am(a,c,f),p=g.slice(0,m);if(g.length>m&&p.length){let y=p[p.length-1];for(;y&&a.measureText(`${y}…`).width>f;)y=y.slice(0,-1);p[p.length-1]=`${y}…`}return p.forEach((y,C)=>a.fillText(y,u,d+C*v)),p.length}function sm(a,c,{maxWidth:u,start:d,min:f,family:v,weight:m=800}){let g=d;do{if(a.font=`${m} ${g}px ${v}`,a.measureText(c).width<=u)return g;g-=2}while(g>f);return f}function im(a={}){var c,u;return a.letter===((c=a.left)==null?void 0:c.code)?a.left:a.letter===((u=a.right)==null?void 0:u.code)?a.right:{code:a.letter||"?",label:a.label,labelZh:a.labelZh,percent:50}}function um(a,c){const u=c?(a==null?void 0:a.roastZh)||(a==null?void 0:a.roast):(a==null?void 0:a.roast)||(a==null?void 0:a.roastZh),d=c?(a==null?void 0:a.tldrZh)||(a==null?void 0:a.tldr):(a==null?void 0:a.tldr)||(a==null?void 0:a.tldrZh);return(String(u||d||"").replace(/^🔥\s*/,"").replace(/\s+/g," ").trim().match(/[^。!?.!?]+[。!?.!?]+|[^。!?.!?]+$/g)||[]).slice(0,2).join(c?"":" ").trim()||d||""}function cm(a,c,u,d){const f=(c||[]).slice(0,4);if(!f.length)return;const v=62,m=1214,g=18,p=(1080-v*2-g*3)/4;a.strokeStyle="rgba(23,23,23,0.18)",a.lineWidth=2,a.beginPath(),a.moveTo(v,m-26),a.lineTo(1080-v,m-26),a.stroke(),f.forEach((y,C)=>{const E=im(y),w=v+C*(p+g),G=(d?E.labelZh:E.label)||E.label||"";C>0&&(a.strokeStyle="rgba(23,23,23,0.14)",a.beginPath(),a.moveTo(w-g/2,m),a.lineTo(w-g/2,m+82),a.stroke()),a.textAlign="left",a.fillStyle=u,a.font="900 34px 'JetBrains Mono', ui-monospace, monospace",a.fillText(E.code||y.letter||"?",w,m+34),a.textAlign="right",a.fillStyle=Qc,a.font="700 14px Outfit, system-ui, sans-serif",a.fillText(`${Number(E.percent||0)}%`,w+p,m+30),a.textAlign="left",a.fillStyle=Qn,a.font="700 16px Outfit, system-ui, sans-serif",ks(a,G,w,m+64,p,18,2)})}function zc(a,c,u,d){a.font=`800 ${u}px Outfit, system-ui, sans-serif`;const f=u+18,v=[];let m=58,g=370;for(const p of c){const y=Math.ceil(a.measureText(p).width)+28;m>58&&m+y>58+d&&(m=58,g+=f+8),v.push({tag:p,x:m,y:g,width:y,height:f}),m+=y+8}return{items:v,bottom:v.length?g+f:370}}function dm(a,c,u){const d=(c||[]).filter(Boolean);if(!d.length)return;let f=18,v=zc(a,d,f,442);for(;v.bottom>596&&f>13;)f-=1,v=zc(a,d,f,442);v.items.forEach((m,g)=>{a.fillStyle=g===0?u:ys(u,.09),a.strokeStyle=g===0?u:ys(u,.3),a.lineWidth=1.5,a.beginPath(),a.roundRect(m.x,m.y,m.width,m.height,m.height/2),a.fill(),a.stroke(),a.textAlign="left",a.fillStyle=g===0?"#ffffff":Qn,a.font=`800 ${f}px Outfit, system-ui, sans-serif`,a.fillText(m.tag,m.x+14,m.y+f+7)})}function fm(a,c){a.fillStyle=Qn,a.fillRect(0,1334,1080,106),a.textAlign="left",a.fillStyle="rgba(255,255,255,0.58)",a.font="800 12px Outfit, system-ui, sans-serif",a.fillText(c?"测测你的编码人格":"ROAST YOUR CODING VIBE",58,1367),a.fillStyle="#ffffff",a.font="800 20px Outfit, system-ui, sans-serif",a.fillText("github.com/PinkR1ver/vibe-roast",58,1402),a.textAlign="right",a.fillStyle="rgba(255,255,255,0.58)",a.font="800 12px Outfit, system-ui, sans-serif",a.fillText(c?"本地运行 · 开源":"RUN LOCAL · OPEN SOURCE",1022,1367),a.fillStyle="#ffffff",a.font="800 20px 'JetBrains Mono', ui-monospace, monospace",a.fillText("npx vibe-roast",1022,1402)}async function pm({vibe:a,hashtags:c=[],locale:u="en",width:d=1080}={}){var O,T,P,ie,ue,F,Q;const f=u==="zh",v=Math.round(d*4/3),m=d/1080,g=document.createElement("canvas");g.width=d,g.height=v;const p=g.getContext("2d");p.scale(m,m),(O=document.fonts)!=null&&O.ready&&await document.fonts.ready;const y=((T=a==null?void 0:a.archetype)==null?void 0:T.accent)||"#ff5a1f",C=(a==null?void 0:a.type_code)||((P=a==null?void 0:a.archetype)==null?void 0:P.code)||"????",E=(f?(ie=a==null?void 0:a.archetype)==null?void 0:ie.titleZh:(ue=a==null?void 0:a.archetype)==null?void 0:ue.title)||"Vibe Coder",w=(f?(F=a==null?void 0:a.archetype)==null?void 0:F.hookZh:(Q=a==null?void 0:a.archetype)==null?void 0:Q.hook)||"",G=um(a,f)||w;p.fillStyle=Kc,p.fillRect(0,0,1080,1440),p.fillStyle=Qn,p.fillRect(0,0,1080,96),p.textAlign="left",p.fillStyle="#ffffff",p.font="900 24px Outfit, system-ui, sans-serif",p.fillText("VIBE ROASTER",58,59),p.textAlign="right",p.fillStyle="rgba(255,255,255,0.62)",p.font="700 15px Outfit, system-ui, sans-serif",p.fillText(f?"编码人格档案":"CODING PERSONALITY FILE",1022,57),p.fillStyle=lm(y,.78),p.fillRect(0,96,1080,704),p.fillStyle=ys(y,.18),p.beginPath(),p.arc(900,270,270,0,Math.PI*2),p.fill(),p.save(),p.globalAlpha=.1,p.textAlign="left",p.fillStyle=y,p.font="900 190px 'JetBrains Mono', ui-monospace, monospace",p.fillText(C,36,412),p.restore(),p.textAlign="left",p.fillStyle=y,p.font="800 15px Outfit, system-ui, sans-serif",p.fillText(f?"你的类型":"YOUR TYPE",58,158),sm(p,E,{maxWidth:470,start:f?68:76,min:48,family:"Outfit, system-ui, sans-serif",weight:900}),p.fillStyle=Qn,p.fillText(E,58,226),p.fillStyle=Qc,p.font=`700 ${f?24:22}px Outfit, system-ui, sans-serif`,ks(p,w,58,274,430,31,3),dm(p,c,y);try{let U;try{U=await Pc(a.figure)}catch(je){if(!a.figure_fallback)throw je;U=await Pc(a.figure_fallback)}const I=620,he=660,Se=Math.min(I/U.width,he/U.height),ce=U.width*Se,Me=U.height*Se,Fe=1080-ce-36,ee=118+(he-Me);p.save(),p.shadowColor="rgba(35,25,18,0.14)",p.shadowBlur=24,p.shadowOffsetY=16,p.drawImage(U,Fe,ee,ce,Me),p.restore()}catch{}return p.textAlign="left",p.fillStyle=Qn,p.font="900 120px 'JetBrains Mono', ui-monospace, monospace",p.fillText(C,52,752),p.fillStyle=y,p.fillRect(58,842,7,302),p.textAlign="left",p.fillStyle=y,p.font="900 15px Outfit, system-ui, sans-serif",p.fillText(f?"ROAST 摘要":"THE ROAST",88,874),p.fillStyle=Qn,p.font=`800 ${f?42:39}px Outfit, system-ui, sans-serif`,ks(p,G,88,932,910,f?57:53,5),cm(p,(a==null?void 0:a.type_axes)||[],y,f),fm(p,f),g}function mm(a,c="vibe-roast-card.png"){const u=a.toDataURL("image/png"),d=document.createElement("a");d.href=u,d.download=c,d.click()}function hm(a,c="vibe-roast-card.png"){return new Promise((u,d)=>{a.toBlob(f=>{if(!f){d(new Error("Could not create the share image."));return}u(new File([f],c,{type:"image/png"}))},"image/png")})}function gm(a,c){return!(a!=null&&a.from)&&!(a!=null&&a.to)?c?"全部时间":"ALL TIME":`${(a==null?void 0:a.from)||"…"} → ${(a==null?void 0:a.to)||"…"}`}function xm({size:a=18}){return s.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[s.jsx("path",{d:"M15 8a3 3 0 1 0-2.83-4H12a3 3 0 0 0 3 4Zm-6 12a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm10 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z",stroke:"currentColor",strokeWidth:"1.8"}),s.jsx("path",{d:"M8.6 11.4 15 8.6M8.6 12.6 15.4 15.4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]})}function Ac({accent:a,onShare:c,posterBusy:u,t:d}){const{toggleLocale:f}=Xn(),{theme:v,setTheme:m}=Ic(),g=[{key:"light",Icon:vp},{key:"dark",Icon:hp},{key:"system",Icon:mp}];return s.jsxs("div",{className:"motion-chrome mb-7 flex flex-wrap items-end justify-between gap-4",children:[s.jsx("h1",{className:"roast-brand m-0 text-[44px] sm:text-[52px] leading-[0.95] text-[#1a1a1a] dark:text-[#fafafa]",children:d("app.brand")}),s.jsxs("div",{className:"flex items-center gap-1 pb-1",children:[s.jsx("div",{className:"mr-1 inline-flex items-center rounded-xl border border-black/[0.06] bg-white/45 p-1 dark:border-white/[0.08] dark:bg-white/[0.04]",role:"group","aria-label":d("theme.system"),children:g.map(({key:p,Icon:y})=>s.jsx("button",{type:"button",onClick:()=>m(p),className:`motion-button inline-flex h-8 w-8 items-center justify-center rounded-lg transition-colors ${v===p?"bg-white text-[#1a1a1a] shadow-sm dark:bg-[#2a2a2a] dark:text-white":"text-[#8b8680] hover:text-[#1a1a1a] dark:text-[#8f8f8f] dark:hover:text-white"}`,title:d(`theme.${p}`),"aria-label":d(`theme.${p}`),"aria-pressed":v===p,children:s.jsx(y,{size:14})},p))}),s.jsx("button",{type:"button",onClick:f,className:"motion-button h-10 min-w-[2.5rem] px-2.5 rounded-xl text-[11px] font-semibold text-[#6b6560] hover:text-[#1a1a1a] hover:bg-black/[0.04] transition-colors dark:text-[#a3a3a3] dark:hover:bg-white/[0.06] dark:hover:text-white",title:d("app.languageTitle"),"aria-label":d("app.languageTitle"),children:d("app.language")}),s.jsx("a",{href:"https://github.com/PinkR1ver/vibe-roast",target:"_blank",rel:"noopener noreferrer",className:"motion-button inline-flex h-10 w-10 items-center justify-center rounded-xl text-[#6b6560] hover:text-[#1a1a1a] hover:bg-black/[0.04] transition-colors dark:text-[#a3a3a3] dark:hover:bg-white/[0.06] dark:hover:text-white","aria-label":d("app.github"),title:d("app.github"),children:s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 15 15",fill:"currentColor",children:s.jsx("path",{d:"M7.5.5a7 7 0 0 0-2.21 13.64c.35.06.48-.15.48-.33v-1.16c-1.97.42-2.38-.94-2.38-.94-.33-.82-.8-1.04-.8-1.04-.64-.44.05-.43.05-.43.71.05 1.09.72 1.09.72.64 1.08 1.67.77 2.07.59.06-.46.25-.77.45-.95-1.58-.18-3.24-.78-3.24-3.5 0-.77.28-1.4.73-1.9-.07-.18-.32-.9.07-1.87 0 0 .6-.19 1.95.73A6.8 6.8 0 0 1 7.5 3.9a6.8 6.8 0 0 1 1.78.24c1.35-.92 1.95-.73 1.95-.73.39.97.14 1.69.07 1.87.45.5.73 1.13.73 1.9 0 2.73-1.66 3.32-3.25 3.5.26.22.48.65.48 1.3v1.93c0 .18.13.4.49.33A7 7 0 0 0 7.5.5Z"})})}),c&&s.jsx("button",{type:"button",onClick:c,disabled:u,className:"motion-button motion-share ml-1 inline-flex h-11 w-11 items-center justify-center rounded-xl text-white shadow-[0_10px_20px_rgba(255,90,31,0.25)] disabled:opacity-60",style:{background:a},"aria-label":d(u?"profile.posterBusy":"profile.posterShare"),title:d(u?"profile.posterBusy":"profile.posterShare"),children:u?s.jsx("span",{className:"text-[10px] font-bold tracking-wide",children:"…"}):s.jsx(xm,{})})]})]})}function vm({data:a}){var oe,K,S,_;const{locale:c,t:u}=Xn(),d=c==="zh",f=a==null?void 0:a.vibe_profile,v=(a==null?void 0:a.summary)||{},m=(a==null?void 0:a.activity)||null,[g,p]=M.useState(!1),[y,C]=M.useState(""),[E,w]=M.useState(!1),[G,O]=M.useState(""),[T,P]=M.useState(null),[ie,ue]=M.useState(""),F=M.useRef(null),Q=((K=(oe=a==null?void 0:a.profile_signals)==null?void 0:oe.prompt_analysis)==null?void 0:K.categories)||{},U=M.useMemo(()=>{const z=d?f==null?void 0:f.hashtagsZh:f==null?void 0:f.hashtags;return Array.isArray(z)&&z.length>=3?om(z):rm(f,Q,{locale:d?"zh":"en"})},[f,Q,d]),I=((S=f==null?void 0:f.archetype)==null?void 0:S.accent)||"#ff5a1f",he=M.useMemo(()=>{if(!T||typeof navigator>"u"||typeof File>"u"||!navigator.share||!navigator.canShare)return!1;try{const z=new File([""],"vibe-roast-card.png",{type:"image/png"});return navigator.canShare({files:[z]})}catch{return!1}},[T]);if(M.useEffect(()=>{var Ce;const z=F.current;if(!z)return;const W=[...z.querySelectorAll(".motion-reveal")];if(((Ce=window.matchMedia)==null?void 0:Ce.call(window,"(prefers-reduced-motion: reduce)").matches)||typeof IntersectionObserver>"u"){W.forEach(fe=>fe.classList.add("is-visible"));return}const X=new IntersectionObserver(fe=>{for(const Ee of fe)Ee.isIntersecting&&(Ee.target.classList.add("is-visible"),X.unobserve(Ee.target))},{threshold:.12,rootMargin:"0px 0px -7% 0px"});return W.forEach(fe=>X.observe(fe)),()=>X.disconnect()},[f==null?void 0:f.type_code]),!f)return s.jsx("div",{className:"min-h-screen bg-[#f3f1ec] text-[#1a1a1a] px-4 py-8 dark:bg-[#0a0a0a] dark:text-[#fafafa]",children:s.jsxs("div",{className:"mx-auto w-full max-w-[1120px]",children:[s.jsx(Ac,{accent:I,t:u}),s.jsx("p",{className:"text-[#6b6560]",children:u("profile.empty")})]})});const Se=d?f.roastZh:f.roast,ce=d?f.tldrZh:f.tldr,Me=d?f.tier.blurbZh:f.tier.blurb,Fe=d?f.archetype.hookZh:f.archetype.hook,ee=d&&f.archetype.titleZh||f.archetype.title;async function je(){p(!0),C(""),w(!0),O(""),P(null),ue("");try{const z=await pm({vibe:f,hashtags:U,locale:c});P(z),O(z.toDataURL("image/png"))}catch(z){C((z==null?void 0:z.message)||String(z)),w(!1)}finally{p(!1)}}function te(){var W;if(!T)return;const z=(((W=f.archetype)==null?void 0:W.code)||"vibe").toLowerCase();mm(T,`vibe-roast-${z}-card.png`),ue(u("profile.posterSaved"))}function ye(){w(!1)}function Pe(){var Ce,fe,Ee;const z=f.type_code||((Ce=f.archetype)==null?void 0:Ce.code)||"",W=d?(fe=f.archetype)==null?void 0:fe.titleZh:(Ee=f.archetype)==null?void 0:Ee.title,me=d?f.tldrZh||f.tldr:f.tldr||f.tldrZh,X=d?"测测你的编码人格":"Roast your coding vibe";return[`${W||"Vibe Coder"} · ${z}`,me,U.slice(0,4).join(" "),`${X}: https://github.com/PinkR1ver/vibe-roast`].filter(Boolean).join(`
167
167
 
168
- `)}async function Ne(){var W;if(!T||!navigator.share)return;const z=(((W=f.archetype)==null?void 0:W.code)||"vibe").toLowerCase();try{const me=await hm(T,`vibe-roast-${z}-card.png`);await navigator.share({title:u("profile.posterTitle"),text:Pe(),files:[me]}),ue(u("profile.posterShared"))}catch(me){(me==null?void 0:me.name)!=="AbortError"&&ue((me==null?void 0:me.message)||u("profile.posterShareFailed"))}}async function H(){const z=Pe();try{await navigator.clipboard.writeText(z),ue(u("profile.posterCaptionCopied"))}catch{const W=document.createElement("textarea");W.value=z,W.style.position="fixed",W.style.opacity="0",document.body.appendChild(W),W.select(),document.execCommand("copy"),W.remove(),ue(u("profile.posterCaptionCopied"))}}return s.jsxs("div",{ref:F,className:"roast-page min-h-screen bg-[radial-gradient(1200px_600px_at_10%_-10%,#ffe7d6_0%,transparent_55%),radial-gradient(900px_500px_at_100%_0%,#d9fff3_0%,transparent_50%),linear-gradient(180deg,#f3f1ec_0%,#e8e4db_100%)] text-[#1a1a1a] transition-colors dark:text-[#fafafa]",style:{"--roast-accent":I},children:[s.jsxs("div",{className:"mx-auto w-full max-w-[1120px] px-4 pt-7 pb-20",children:[s.jsx(Ac,{accent:I,onShare:je,posterBusy:g,t:u}),y&&s.jsx("p",{className:"mb-4 text-sm text-[#e24b4b]",children:y}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[minmax(260px,300px)_minmax(0,1fr)] gap-5 items-start min-w-0",children:[s.jsxs("aside",{className:"motion-hero min-w-0 text-center",children:[s.jsxs("div",{className:"relative mx-auto mb-2 overflow-hidden px-2 pt-3 isolate",children:[s.jsx("div",{className:"pointer-events-none absolute left-1/2 top-[8%] z-0 h-[78%] w-full -translate-x-1/2 rounded-[46%_54%_42%_58%/48%_44%_56%_52%]",style:{background:`radial-gradient(circle at 35% 30%, color-mix(in srgb, ${I} 28%, var(--roast-card)), transparent 58%), radial-gradient(circle at 70% 65%, color-mix(in srgb, ${I} 16%, var(--roast-page)), transparent 62%)`}}),s.jsx("img",{src:f.figure,alt:ee,onError:z=>{f.figure_fallback&&z.currentTarget.src!==new URL(f.figure_fallback,window.location.href).href&&(z.currentTarget.src=f.figure_fallback)},width:384,height:512,className:"motion-character relative z-[1] mx-auto h-auto w-[88%] max-w-[280px] object-contain drop-shadow-[0_18px_28px_rgba(40,28,12,0.12)]"})]}),s.jsxs("p",{className:"m-0 text-[13px] font-bold tracking-wide text-[#6b6560]",children:["@",f.archetype.code.toLowerCase()]}),s.jsx("h1",{className:"mt-1 mb-1 text-[28px] font-extrabold tracking-tight",style:{color:I},children:ee}),s.jsx("p",{className:"m-0 text-sm font-semibold text-[#6b6560]",children:Fe}),s.jsx("div",{className:"mt-4 flex flex-wrap justify-center gap-1.5",children:U.map(z=>s.jsx("span",{className:"motion-chip rounded-full px-2.5 py-1 text-[12px] font-bold",style:{background:`color-mix(in srgb, ${I} 14%, var(--roast-card))`,color:`color-mix(in srgb, ${I} 72%, var(--roast-text))`},children:z},z))})]}),s.jsxs("section",{className:"space-y-4",children:[s.jsxs("div",{className:"motion-reveal motion-surface rounded-[18px] border border-black/[0.04] bg-[#fffcf7] p-5 shadow-[0_10px_30px_rgba(40,28,12,0.06)]",children:[s.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("div",{className:"font-[JetBrains_Mono,ui-monospace,monospace] text-[42px] font-bold leading-none tracking-[0.08em]",children:f.type_code||f.archetype.code}),s.jsxs("div",{className:"mt-2 flex items-baseline gap-1.5 font-bold",style:{color:f.tier.color},children:[s.jsx("span",{className:"text-[12px]","aria-hidden":"true",children:f.tier.emoji}),s.jsxs("span",{className:"text-[17px] tabular-nums",children:[f.confidence,"%"]}),s.jsx("span",{className:"text-[11px] uppercase tracking-[0.06em]",children:d?"类型置信度":"TYPE CONFIDENCE"})]}),s.jsx("p",{className:"mt-1 mb-0 text-[13px] text-[#6b6560]",children:Me})]}),s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 xl:grid-cols-5 gap-2 text-center",children:f.signals.map((z,W)=>s.jsxs("div",{className:"motion-stat min-w-0 rounded-xl bg-[#f3f1ec] px-2.5 py-2",style:{"--motion-delay":`${120+W*55}ms`},children:[s.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-[#6b6560]",children:d?z.labelZh:z.label}),s.jsx("div",{className:"mt-1 break-words text-sm font-bold leading-tight tabular-nums",title:z.value,children:z.value})]},z.label))})]}),s.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-x-2 gap-y-1.5 text-xs font-semibold uppercase tracking-[0.08em] text-[#6b6560]",children:[s.jsxs("span",{children:[gm(a==null?void 0:a.range,d)," · ",u("profile.agentsFound",{count:v.active_source_count??((_=v.active_sources)==null?void 0:_.length)??0})]}),(v.active_sources||[]).length>0&&s.jsx("span",{className:"inline-flex items-center gap-1","aria-label":u("profile.detectedAgents"),children:v.active_sources.map(z=>s.jsx(bs,{agent:z,size:22,className:"ring-2 ring-[#fffcf7]"},z))})]})]}),s.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-[minmax(0,1.1fr)_minmax(0,0.9fr)] gap-4 min-w-0",children:[s.jsxs("div",{className:"motion-reveal motion-surface min-w-0 rounded-[18px] border border-black/[0.04] bg-[#fffcf7] p-4 shadow-[0_10px_30px_rgba(40,28,12,0.06)]",children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[s.jsx("h2",{className:"m-0 text-sm font-extrabold tracking-wide uppercase text-[#6b6560]",children:u("profile.radar")}),s.jsx("span",{className:"text-[10px] font-bold uppercase tracking-[0.16em] text-[#8b8680]",children:u("profile.sixAxis")})]}),s.jsx(ym,{dimensions:f.dimensions,accent:I,zh:d,ariaLabel:u("profile.radarAria")})]}),s.jsxs("div",{className:"motion-reveal motion-surface min-w-0 rounded-[18px] border border-black/[0.04] bg-[#fffcf7] p-4 shadow-[0_10px_30px_rgba(40,28,12,0.06)]",style:{"--motion-delay":"70ms"},children:[s.jsx("h2",{className:"m-0 mb-3 text-sm font-extrabold tracking-wide uppercase text-[#6b6560]",children:u("profile.axes")}),s.jsx("div",{className:"space-y-2.5",children:(f.type_axes||[]).map((z,W)=>s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"mb-1 flex justify-between gap-2 text-xs font-bold",children:[s.jsxs("span",{style:{color:z.letter===z.left.code?I:void 0},children:[z.left.code," · ",d?z.left.labelZh:z.left.label," ",z.left.percent,"%"]}),s.jsxs("span",{style:{color:z.letter===z.right.code?I:void 0},children:[z.right.percent,"% ",z.right.code," · ",d?z.right.labelZh:z.right.label]})]}),s.jsxs("div",{className:"flex h-2 overflow-hidden rounded-full bg-[#e8e4db]",children:[s.jsx("div",{className:"motion-progress",style:{width:`${z.left.percent}%`,background:I,"--motion-delay":`${100+W*75}ms`}}),s.jsx("div",{className:"motion-progress bg-[#d6d0c6]",style:{width:`${z.right.percent}%`,"--motion-delay":`${140+W*75}ms`}})]})]},z.key))})]})]}),s.jsxs("div",{className:"motion-reveal motion-surface rounded-[18px] border border-black/[0.04] bg-[#fffcf7] p-5 shadow-[0_10px_30px_rgba(40,28,12,0.06)]",children:[s.jsx("h2",{className:"m-0 mb-3 text-sm font-extrabold tracking-wide uppercase text-[#6b6560]",children:u("profile.roast")}),s.jsx("p",{className:"m-0 text-[15px] leading-relaxed whitespace-pre-wrap",children:Se}),s.jsxs("p",{className:"mt-4 mb-0 rounded-xl bg-[#fff0e8] px-3 py-2 text-sm",children:[s.jsx("b",{children:u("profile.tldr")})," · ",ce]})]}),s.jsx("div",{className:"motion-reveal motion-surface rounded-[18px] border border-black/[0.06] bg-[#fffcf7] p-5 shadow-[0_10px_30px_rgba(40,28,12,0.06)] dark:border-white/[0.08]",children:s.jsx("div",{children:s.jsx(Tp,{prompts:(a==null?void 0:a.prompts)||[],activity:m,weeks:52,defaultPalette:"emerald",roastStyle:!0,showViewToggle:!0,defaultViewMode:"2d"})})}),s.jsx(Zp,{activity:m,wordCloudRecords:(a==null?void 0:a.word_cloud_records)||[]})]})]})]}),s.jsx(Mp,{open:E,previewUrl:G,accent:I,busy:g,nativeShareSupported:he,notice:ie,onClose:ye,onDownload:te,onNativeShare:Ne,onCopyCaption:H,t:u})]})}function ym({dimensions:a,accent:c,zh:u,ariaLabel:d}){const p=[.33,.66,1],y=a.map((E,w)=>{const G=-Math.PI/2+w*Math.PI*2/a.length,T=20+Math.min(1,Number(E.score||0))*72,P=122;return{...E,x:150+Math.cos(G)*T,y:150+Math.sin(G)*T,labelX:150+Math.cos(G)*P,labelY:150+Math.sin(G)*P,axisX:150+Math.cos(G)*92,axisY:150+Math.sin(G)*92}}),C=y.map(E=>`${E.x},${E.y}`).join(" ");return s.jsx("div",{className:"flex min-w-0 items-center justify-center overflow-visible py-2",children:s.jsxs("svg",{viewBox:"-28 -28 356 356",className:"h-auto w-full max-w-[340px] overflow-visible",role:"img","aria-label":d,children:[p.map(E=>{const w=a.map((G,O)=>{const T=-Math.PI/2+O*Math.PI*2/a.length;return`${150+Math.cos(T)*92*E},${150+Math.sin(T)*92*E}`}).join(" ");return s.jsx("polygon",{className:"radar-grid",points:w,fill:"none",stroke:"var(--radar-grid)",strokeWidth:"1"},E)}),y.map(E=>s.jsx("line",{className:"radar-grid",x1:150,y1:150,x2:E.axisX,y2:E.axisY,stroke:"var(--radar-grid)",strokeWidth:"1"},E.key)),s.jsx("polygon",{className:"radar-shape",points:C,fill:`${c}33`,stroke:c,strokeWidth:"2.5"}),y.map(E=>s.jsx("circle",{className:"radar-dot",cx:E.x,cy:E.y,r:"3.5",fill:c,stroke:"var(--roast-card)",strokeWidth:"1.5"},`${E.key}-dot`)),y.map(E=>{const w=E.labelX<144?"end":E.labelX>156?"start":"middle";return s.jsx("text",{x:E.labelX,y:E.labelY,textAnchor:w,dominantBaseline:"middle",fill:"var(--roast-muted)",fontSize:"10",fontWeight:"700",children:u?E.labelZh:E.label},`${E.key}-label`)})]})})}const oo=[{id:"deepseek",name:"DeepSeek",mark:"D",color:"#4d6bfe",model:"deepseek-v4-flash",baseUrl:"https://api.deepseek.com"},{id:"openai",name:"OpenAI",mark:"O",color:"#10a37f",model:"gpt-4.1-mini",baseUrl:"https://api.openai.com/v1"},{id:"anthropic",name:"Anthropic",mark:"A",color:"#d97757",model:"claude-haiku-4-5-20251001",baseUrl:"https://api.anthropic.com/v1"},{id:"gemini",name:"Gemini",mark:"G",color:"#4285f4",model:"gemini-2.5-flash",baseUrl:"https://generativelanguage.googleapis.com/v1beta"},{id:"groq",name:"Groq",mark:"Q",color:"#f55036",model:"llama-3.3-70b-versatile",baseUrl:"https://api.groq.com/openai/v1"},{id:"openrouter",name:"OpenRouter",mark:"R",color:"#7c3aed",model:"openai/gpt-4.1-mini",baseUrl:"https://openrouter.ai/api/v1"}];function km({provider:a,size:c="md"}){const u=c==="sm"?"h-7 w-7 text-[10px]":"h-9 w-9 text-xs";return s.jsx("span",{className:`${u} inline-flex shrink-0 items-center justify-center rounded-xl font-black text-white shadow-sm`,style:{background:a.color},"aria-hidden":"true",children:a.mark})}function Lc({icon:a,eyebrow:c,title:u,description:d,onClick:f,accent:v="#171717"}){return s.jsxs("button",{type:"button",onClick:f,className:"roast-access-choice motion-button group relative min-h-[148px] overflow-hidden rounded-[16px] border border-black/[0.07] bg-[#f7f4ef] p-4 text-left hover:border-black/[0.16] dark:border-white/[0.08] dark:bg-white/[0.035] dark:hover:border-white/[0.18]",children:[s.jsx("span",{className:"mb-5 inline-flex h-9 w-9 items-center justify-center rounded-[11px] text-white",style:{background:v},children:a}),s.jsx("span",{className:"block text-[10px] font-bold uppercase tracking-[0.14em] text-[#8b8680] dark:text-[#8f8f8f]",children:c}),s.jsxs("span",{className:"mt-1 flex items-center justify-between gap-4 text-[16px] font-extrabold text-[#1a1a1a] dark:text-white",children:[u,s.jsx(Fc,{size:16,className:"opacity-35 transition-transform group-hover:translate-x-1 group-hover:opacity-80"})]}),s.jsx("span",{className:"mt-1.5 block max-w-[310px] text-[13px] leading-5 text-[#716b65] dark:text-[#aaa49e]",children:d})]})}function wm({open:a,onGenerate:c,onLocal:u}){const{t:d}=Xn(),[f,v]=M.useState("choose"),[m,g]=M.useState("deepseek"),[p,y]=M.useState(""),[C,E]=M.useState(oo[0].model),[w,G]=M.useState(oo[0].baseUrl),[O,T]=M.useState(!1),[P,ie]=M.useState(!1),[ue,F]=M.useState(""),[Q,U]=M.useState(!1),[I,he]=M.useState(null),Se=M.useMemo(()=>oo.find(te=>te.id===m)||oo[0],[m]);if(M.useEffect(()=>{if(!a)return;Promise.all([fetch("/api/ai/providers").then(ye=>ye.json()),fetch("/api/auth/github/session").then(ye=>ye.json())]).then(([ye,Pe])=>{var Ne;U(!!((Ne=ye==null?void 0:ye.github)!=null&&Ne.configured)),(Pe==null?void 0:Pe.status)==="connected"&&he(Pe.user)}).catch(()=>U(!1));const te=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=te}},[a]),M.useEffect(()=>{if(!a)return;async function te(ye){var Pe;if(!(ye.origin!==window.location.origin||((Pe=ye.data)==null?void 0:Pe.type)!=="vibe-wrapper:github-auth")){if(ye.data.status!=="connected"){F(ye.data.error||d("roastAccess.githubFailed")),ie(!1);return}try{const Ne=await fetch("/api/auth/github/session"),H=await Ne.json();if(!Ne.ok||H.status!=="connected")throw new Error(H.error||d("roastAccess.githubFailed"));he(H.user||{login:"GitHub"}),F("")}catch(Ne){F(Ne.message)}finally{ie(!1)}}}return window.addEventListener("message",te),()=>window.removeEventListener("message",te)},[a,d]),!a)return null;function ce(te){g(te.id),E(te.model),G(te.baseUrl),F("")}async function Me(te){if(te.preventDefault(),!p.trim()){F(d("roastAccess.keyRequired"));return}ie(!0),F("");try{await c({provider:Se.id,apiKey:p.trim(),model:C.trim(),baseUrl:w.trim()})}catch(ye){F(ye.message)}finally{ie(!1)}}function Fe(){if(v("github"),F(""),I)return;if(!window.open("/api/auth/github/start","vibe-wrapper-github-auth","popup,width=720,height=760")){F(d("roastAccess.popupBlocked"));return}ie(!0)}async function ee(){await fetch("/api/auth/github/session",{method:"DELETE"}),he(null),F("")}async function je(){ie(!0),F("");try{await c({mode:"hosted",provider:"cloudflare"})}catch(te){F(te.message)}finally{ie(!1)}}return s.jsx("div",{className:"fixed inset-0 z-[100] flex items-end justify-center bg-[#201b17]/30 p-0 sm:items-center sm:p-5 dark:bg-black/55",children:s.jsx("section",{role:"dialog","aria-modal":"true","aria-labelledby":"roast-access-title",className:"roast-access-modal animate-tt-modal relative max-h-[96vh] w-full max-w-[720px] overflow-x-hidden overflow-y-auto rounded-t-[22px] border border-black/[0.07] bg-[#fffcf7] text-[#1a1a1a] shadow-[0_24px_70px_rgba(45,30,18,0.22)] dark:border-white/[0.08] dark:bg-[#171717] dark:text-white sm:max-h-[92vh] sm:rounded-[22px]",children:s.jsxs("div",{className:"relative px-5 pb-5 pt-6 sm:px-7 sm:pb-7 sm:pt-7",children:[f!=="choose"&&s.jsxs("button",{type:"button",onClick:()=>{v("choose"),F(""),ie(!1)},className:"motion-button mb-5 inline-flex items-center gap-1.5 rounded-lg px-2 py-1 text-[11px] font-bold text-[#77716b] hover:bg-black/[0.05] dark:text-[#aaa49e] dark:hover:bg-white/[0.06]",children:[s.jsx(sp,{size:13}),d("roastAccess.back")]}),s.jsxs("header",{className:f==="choose"?"mb-6":"mb-5",children:[s.jsxs("div",{className:"mb-2.5 flex items-center gap-2 text-[10px] font-bold uppercase tracking-[0.16em] text-[#ff5a1f]",children:[s.jsx(gc,{size:13}),d("roastAccess.kicker")]}),s.jsxs("h2",{id:"roast-access-title",className:"max-w-[590px] text-[27px] font-extrabold leading-[1.08] tracking-[-0.025em] sm:text-[32px]",children:[f==="choose"&&d("roastAccess.title"),f==="api"&&d("roastAccess.apiTitle"),f==="github"&&d("roastAccess.githubTitle")]}),s.jsxs("p",{className:"mt-2.5 max-w-[590px] text-[13px] leading-5 text-[#716b65] dark:text-[#aaa49e]",children:[f==="choose"&&d("roastAccess.subtitle"),f==="api"&&d("roastAccess.apiSubtitle"),f==="github"&&d("roastAccess.githubSubtitle")]})]}),f==="choose"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[s.jsx(Lc,{icon:s.jsx(dp,{size:18}),eyebrow:d("roastAccess.ownKey"),title:d("roastAccess.apiChoice"),description:d("roastAccess.apiDescription"),accent:"#ff5a1f",onClick:()=>v("api")}),s.jsx(Lc,{icon:s.jsx(xl,{size:19}),eyebrow:d("roastAccess.freeTier"),title:I?`@${I.login}`:d("roastAccess.githubChoice"),description:d(I?"roastAccess.githubSignedInDescription":"roastAccess.githubDescription"),accent:"#171717",onClick:()=>{v("github"),F("")}})]}),s.jsxs("div",{className:"mt-5 flex flex-col items-center justify-between gap-3 border-t border-black/[0.07] pt-5 sm:flex-row dark:border-white/[0.08]",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-[#807a74] dark:text-[#99938d]",children:[s.jsx(hc,{size:14,className:"text-[#0ba875]"}),d("roastAccess.privacy")]}),s.jsx("button",{type:"button",onClick:u,className:"motion-button rounded-lg px-3 py-2 text-[11px] font-bold text-[#77716b] hover:bg-black/[0.05] dark:text-[#aaa49e] dark:hover:bg-white/[0.06]",children:d("roastAccess.local")})]})]}),f==="api"&&s.jsxs("form",{onSubmit:Me,children:[s.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:oo.map(te=>{const ye=te.id===Se.id;return s.jsxs("button",{type:"button",onClick:()=>ce(te),className:`motion-button flex min-w-0 items-center gap-2 rounded-[15px] border p-2.5 text-left ${ye?"border-black/[0.16] bg-white shadow-sm dark:border-white/[0.2] dark:bg-white/[0.08]":"border-black/[0.06] bg-white/40 hover:bg-white dark:border-white/[0.07] dark:bg-white/[0.025] dark:hover:bg-white/[0.05]"}`,children:[s.jsx(km,{provider:te,size:"sm"}),s.jsx("span",{className:"min-w-0 truncate text-[11px] font-black",children:te.name}),ye&&s.jsx(Uc,{size:12,className:"ml-auto shrink-0 text-[#0ba875]"})]},te.id)})}),s.jsxs("label",{className:"mt-5 block",children:[s.jsxs("span",{className:"mb-2 flex items-center justify-between text-[10px] font-black uppercase tracking-[0.14em] text-[#77716b] dark:text-[#aaa49e]",children:["API Key",s.jsx("span",{className:"normal-case tracking-normal text-[#aaa49e]",children:d("roastAccess.sessionOnly")})]}),s.jsxs("div",{className:"flex items-center rounded-[15px] border border-black/[0.09] bg-white px-3 dark:border-white/[0.1] dark:bg-black/20",children:[s.jsx(fp,{size:14,className:"shrink-0 text-[#aaa49e]"}),s.jsx("input",{type:"password",value:p,onChange:te=>y(te.target.value),placeholder:d("roastAccess.keyPlaceholder",{provider:Se.name}),autoComplete:"off",spellCheck:"false",className:"h-12 min-w-0 flex-1 bg-transparent px-3 text-sm font-medium outline-none placeholder:text-[#bbb5ae] dark:placeholder:text-[#686868]"})]})]}),s.jsxs("label",{className:"mt-3 block",children:[s.jsx("span",{className:"mb-2 block text-[10px] font-black uppercase tracking-[0.14em] text-[#77716b] dark:text-[#aaa49e]",children:d("roastAccess.model")}),s.jsx("input",{type:"text",value:C,onChange:te=>E(te.target.value),className:"h-12 w-full rounded-[15px] border border-black/[0.09] bg-white px-4 text-sm font-semibold outline-none focus:border-black/[0.22] dark:border-white/[0.1] dark:bg-black/20 dark:focus:border-white/[0.25]"})]}),s.jsxs("button",{type:"button",onClick:()=>T(te=>!te),className:"mt-3 inline-flex items-center gap-1.5 text-[11px] font-bold text-[#817b75] dark:text-[#99938d]",children:[s.jsx(Hc,{size:13,className:`transition-transform ${O?"rotate-180":""}`}),d("roastAccess.advanced")]}),O&&s.jsxs("label",{className:"mt-2 block",children:[s.jsx("span",{className:"mb-2 block text-[10px] font-black uppercase tracking-[0.14em] text-[#77716b] dark:text-[#aaa49e]",children:"Base URL"}),s.jsx("input",{type:"url",value:w,onChange:te=>G(te.target.value),className:"h-11 w-full rounded-[14px] border border-black/[0.09] bg-white px-4 text-xs outline-none dark:border-white/[0.1] dark:bg-black/20"})]}),ue&&s.jsx("p",{className:"mt-3 rounded-xl bg-red-500/[0.08] px-3 py-2 text-xs font-semibold text-red-600 dark:text-red-400",children:ue}),s.jsxs("button",{type:"submit",disabled:P,className:"motion-button mt-5 inline-flex h-12 w-full items-center justify-center gap-2 rounded-[15px] bg-[#ff5a1f] text-sm font-black text-white shadow-[0_12px_25px_rgba(255,90,31,0.22)] disabled:opacity-55",children:[d(P?"roastAccess.generating":"roastAccess.generate"),!P&&s.jsx(Fc,{size:15})]})]}),f==="github"&&s.jsxs("div",{children:[s.jsx("div",{className:"rounded-[20px] border border-black/[0.07] bg-white/70 p-5 dark:border-white/[0.08] dark:bg-white/[0.035]",children:I?s.jsxs("div",{className:"flex flex-col items-center text-center",children:[I.avatarUrl?s.jsx("img",{src:I.avatarUrl,alt:"",className:"h-12 w-12 rounded-full"}):s.jsx("span",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-[#171717] text-white",children:s.jsx(xl,{size:20})}),s.jsxs("p",{className:"mt-3 text-sm font-black",children:["@",I.login]}),s.jsx("p",{className:"mt-1 text-xs text-[#817b75] dark:text-[#99938d]",children:d("roastAccess.githubConnected")}),ue&&s.jsx("p",{className:"mt-3 w-full rounded-xl bg-red-500/[0.08] px-3 py-2 text-left text-xs font-semibold leading-5 text-red-600 dark:text-red-400",children:ue}),s.jsxs("button",{type:"button",onClick:je,disabled:P,className:"motion-button mt-5 inline-flex h-12 w-full items-center justify-center gap-2 rounded-[15px] bg-[#171717] text-sm font-black text-white disabled:opacity-55 dark:bg-white dark:text-[#171717]",children:[d(P?"roastAccess.generating":"roastAccess.generateFree"),!P&&s.jsx(gc,{size:15})]}),s.jsx("button",{type:"button",onClick:()=>v("api"),disabled:P,className:"mt-3 text-[11px] font-bold text-[#817b75] underline-offset-4 hover:underline disabled:opacity-50 dark:text-[#99938d]",children:d("roastAccess.chooseProvider")}),s.jsx("button",{type:"button",onClick:ee,className:"mt-3 text-[11px] font-bold text-[#817b75] underline-offset-4 hover:underline dark:text-[#99938d]",children:d("roastAccess.signOut")})]}):s.jsxs("div",{className:"flex min-h-[130px] flex-col items-center justify-center text-center",children:[s.jsx(xl,{size:28,className:"mb-3"}),s.jsx("p",{className:"max-w-sm text-sm font-bold",children:d(Q?"roastAccess.githubOneClick":"roastAccess.githubUnavailable")}),ue&&s.jsx("p",{className:"mt-2 max-w-md text-xs leading-5 text-red-600 dark:text-red-400",children:ue}),!P&&s.jsxs("button",{type:"button",onClick:Fe,className:"motion-button mt-4 inline-flex h-12 min-w-[230px] items-center justify-center gap-2 rounded-[14px] bg-[#171717] px-5 text-sm font-black text-white shadow-[0_12px_25px_rgba(0,0,0,0.14)] dark:bg-white dark:text-[#171717]",children:[s.jsx(xl,{size:17}),d("roastAccess.continueGithub")]}),P&&s.jsx("p",{className:"mt-4 text-xs text-[#817b75] dark:text-[#99938d]",children:d("roastAccess.waiting")})]})}),s.jsxs("div",{className:"mt-4 flex items-start gap-2 text-[11px] leading-5 text-[#817b75] dark:text-[#99938d]",children:[s.jsx(hc,{size:14,className:"mt-0.5 shrink-0 text-[#0ba875]"}),d("roastAccess.githubPrivacy")]})]})]})})})}function Sm(a={}){const[c,u]=M.useState(null),[d,f]=M.useState(!0),[v,m]=M.useState(null);return M.useEffect(()=>{let g=!1;async function p(){f(!0),m(null);try{const y=new URLSearchParams;a.from&&y.set("from",a.from),a.to&&y.set("to",a.to);const C=y.toString(),E=await fetch(`/api/inspect${C?`?${C}`:""}`);if(!E.ok)throw new Error(`HTTP ${E.status}`);const w=await E.json();g||u(w)}catch(y){g||m(y.message)}finally{g||f(!1)}}return p(),()=>{g=!0}},[a.from,a.to]),{data:c,loading:d,error:v}}function Cm(a,c={},u=new Date){return{label:"All time"}}function jm(){const{t:a}=Xn(),[c,u]=M.useState(null),[d,f]=M.useState(!0),v=M.useRef(!1),m=Cm("total",{}),{data:g,loading:p,error:y}=Sm(m);M.useEffect(()=>{g&&u(g)},[g]);async function C(E){const w=new AbortController,G=window.setTimeout(()=>w.abort(),45e3);try{const O=await fetch("/api/roast",{method:"POST",headers:{"Content-Type":"application/json"},signal:w.signal,body:JSON.stringify({...E,evidence:c==null?void 0:c.roast_evidence})}),T=await O.json().catch(()=>({}));if(!O.ok){const P=(T==null?void 0:T.error)||`HTTP ${O.status}`;throw new Error(P)}if(!(T!=null&&T.generated))throw new Error("The roast writer returned no result.");u(P=>({...P,vibe_profile:{...P==null?void 0:P.vibe_profile,...T.generated,roast_source:"ai"}})),f(!1)}catch(O){throw(O==null?void 0:O.name)==="AbortError"?new Error("Roast generation timed out. Try again or use the local roast."):O}finally{window.clearTimeout(G)}}return M.useEffect(()=>{if(!(c!=null&&c.roast_evidence)||v.current)return;v.current=!0;let E=!0;return fetch("/api/auth/github/session").then(w=>w.json()).then(w=>E&&(w==null?void 0:w.status)==="connected"?C({mode:"hosted",provider:"cloudflare"}):null).catch(()=>{}),()=>{E=!1}},[c==null?void 0:c.roast_evidence]),s.jsx("div",{className:"min-h-screen bg-[#f3f1ec] text-[#171717] transition-colors dark:bg-[#0a0a0a] dark:text-[#fafafa]",children:s.jsx("main",{children:p&&!c?s.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-3 px-6",children:[s.jsx("p",{className:"roast-brand text-[44px] leading-none text-[#1a1a1a] dark:text-[#fafafa]",children:a("app.brand")}),s.jsx("p",{className:"text-[#6b6560] text-sm font-medium dark:text-[#a3a3a3]",children:a("app.loading")})]}):y&&!c?s.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-3 px-6 text-center",children:[s.jsx("p",{className:"roast-brand text-[44px] leading-none text-[#1a1a1a] dark:text-[#fafafa]",children:a("app.brand")}),s.jsx("p",{className:"text-[#e24b4b] text-sm font-medium max-w-md",children:y})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:d?"pointer-events-none select-none blur-[3px]":"","aria-hidden":d,children:s.jsx(vm,{data:c})}),s.jsx(wm,{open:d,onGenerate:C,onLocal:()=>f(!1)})]})})})}function bm(){return s.jsx(ep,{children:s.jsx(rp,{children:s.jsx(jm,{})})})}Jf.createRoot(document.getElementById("root")).render(s.jsx(Yf.StrictMode,{children:s.jsx(bm,{})}));
168
+ `)}async function Ne(){var W;if(!T||!navigator.share)return;const z=(((W=f.archetype)==null?void 0:W.code)||"vibe").toLowerCase();try{const me=await hm(T,`vibe-roast-${z}-card.png`);await navigator.share({title:u("profile.posterTitle"),text:Pe(),files:[me]}),ue(u("profile.posterShared"))}catch(me){(me==null?void 0:me.name)!=="AbortError"&&ue((me==null?void 0:me.message)||u("profile.posterShareFailed"))}}async function H(){const z=Pe();try{await navigator.clipboard.writeText(z),ue(u("profile.posterCaptionCopied"))}catch{const W=document.createElement("textarea");W.value=z,W.style.position="fixed",W.style.opacity="0",document.body.appendChild(W),W.select(),document.execCommand("copy"),W.remove(),ue(u("profile.posterCaptionCopied"))}}return s.jsxs("div",{ref:F,className:"roast-page min-h-screen bg-[radial-gradient(1200px_600px_at_10%_-10%,#ffe7d6_0%,transparent_55%),radial-gradient(900px_500px_at_100%_0%,#d9fff3_0%,transparent_50%),linear-gradient(180deg,#f3f1ec_0%,#e8e4db_100%)] text-[#1a1a1a] transition-colors dark:text-[#fafafa]",style:{"--roast-accent":I},children:[s.jsxs("div",{className:"mx-auto w-full max-w-[1120px] px-4 pt-7 pb-20",children:[s.jsx(Ac,{accent:I,onShare:je,posterBusy:g,t:u}),y&&s.jsx("p",{className:"mb-4 text-sm text-[#e24b4b]",children:y}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[minmax(260px,300px)_minmax(0,1fr)] gap-5 items-start min-w-0",children:[s.jsxs("aside",{className:"motion-hero min-w-0 text-center",children:[s.jsxs("div",{className:"relative mx-auto mb-2 overflow-hidden px-2 pt-3 isolate",children:[s.jsx("div",{className:"pointer-events-none absolute left-1/2 top-[8%] z-0 h-[78%] w-full -translate-x-1/2 rounded-[46%_54%_42%_58%/48%_44%_56%_52%]",style:{background:`radial-gradient(circle at 35% 30%, color-mix(in srgb, ${I} 28%, var(--roast-card)), transparent 58%), radial-gradient(circle at 70% 65%, color-mix(in srgb, ${I} 16%, var(--roast-page)), transparent 62%)`}}),s.jsx("img",{src:f.figure,alt:ee,onError:z=>{f.figure_fallback&&z.currentTarget.src!==new URL(f.figure_fallback,window.location.href).href&&(z.currentTarget.src=f.figure_fallback)},width:384,height:512,className:"motion-character relative z-[1] mx-auto h-auto w-[88%] max-w-[280px] object-contain drop-shadow-[0_18px_28px_rgba(40,28,12,0.12)]"})]}),s.jsxs("p",{className:"m-0 text-[13px] font-bold tracking-wide text-[#6b6560]",children:["@",f.archetype.code.toLowerCase()]}),s.jsx("h1",{className:"mt-1 mb-1 text-[28px] font-extrabold tracking-tight",style:{color:I},children:ee}),s.jsx("p",{className:"m-0 text-sm font-semibold text-[#6b6560]",children:Fe}),s.jsx("div",{className:"mt-4 flex flex-wrap justify-center gap-1.5",children:U.map(z=>s.jsx("span",{className:"motion-chip rounded-full px-2.5 py-1 text-[12px] font-bold",style:{background:`color-mix(in srgb, ${I} 14%, var(--roast-card))`,color:`color-mix(in srgb, ${I} 72%, var(--roast-text))`},children:z},z))})]}),s.jsxs("section",{className:"space-y-4",children:[s.jsxs("div",{className:"motion-reveal motion-surface rounded-[18px] border border-black/[0.04] bg-[#fffcf7] p-5 shadow-[0_10px_30px_rgba(40,28,12,0.06)]",children:[s.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("div",{className:"font-[JetBrains_Mono,ui-monospace,monospace] text-[42px] font-bold leading-none tracking-[0.08em]",children:f.type_code||f.archetype.code}),s.jsxs("div",{className:"mt-2 flex items-baseline gap-1.5 font-bold",style:{color:f.tier.color},children:[s.jsx("span",{className:"text-[12px]","aria-hidden":"true",children:f.tier.emoji}),s.jsxs("span",{className:"text-[17px] tabular-nums",children:[f.confidence,"%"]}),s.jsx("span",{className:"text-[11px] uppercase tracking-[0.06em]",children:d?"类型置信度":"TYPE CONFIDENCE"})]}),s.jsx("p",{className:"mt-1 mb-0 text-[13px] text-[#6b6560]",children:Me})]}),s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 xl:grid-cols-5 gap-2 text-center",children:f.signals.map((z,W)=>s.jsxs("div",{className:"motion-stat min-w-0 rounded-xl bg-[#f3f1ec] px-2.5 py-2",style:{"--motion-delay":`${120+W*55}ms`},children:[s.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-[#6b6560]",children:d?z.labelZh:z.label}),s.jsx("div",{className:"mt-1 break-words text-sm font-bold leading-tight tabular-nums",title:z.value,children:z.value})]},z.label))})]}),s.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-x-2 gap-y-1.5 text-xs font-semibold uppercase tracking-[0.08em] text-[#6b6560]",children:[s.jsxs("span",{children:[gm(a==null?void 0:a.range,d)," · ",u("profile.agentsFound",{count:v.active_source_count??((_=v.active_sources)==null?void 0:_.length)??0})]}),(v.active_sources||[]).length>0&&s.jsx("span",{className:"inline-flex items-center gap-1","aria-label":u("profile.detectedAgents"),children:v.active_sources.map(z=>s.jsx(bs,{agent:z,size:22,className:"ring-2 ring-[#fffcf7]"},z))})]})]}),s.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-[minmax(0,1.1fr)_minmax(0,0.9fr)] gap-4 min-w-0",children:[s.jsxs("div",{className:"motion-reveal motion-surface min-w-0 rounded-[18px] border border-black/[0.04] bg-[#fffcf7] p-4 shadow-[0_10px_30px_rgba(40,28,12,0.06)]",children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[s.jsx("h2",{className:"m-0 text-sm font-extrabold tracking-wide uppercase text-[#6b6560]",children:u("profile.radar")}),s.jsx("span",{className:"text-[10px] font-bold uppercase tracking-[0.16em] text-[#8b8680]",children:u("profile.sixAxis")})]}),s.jsx(ym,{dimensions:f.dimensions,accent:I,zh:d,ariaLabel:u("profile.radarAria")})]}),s.jsxs("div",{className:"motion-reveal motion-surface min-w-0 rounded-[18px] border border-black/[0.04] bg-[#fffcf7] p-4 shadow-[0_10px_30px_rgba(40,28,12,0.06)]",style:{"--motion-delay":"70ms"},children:[s.jsx("h2",{className:"m-0 mb-3 text-sm font-extrabold tracking-wide uppercase text-[#6b6560]",children:u("profile.axes")}),s.jsx("div",{className:"space-y-2.5",children:(f.type_axes||[]).map((z,W)=>s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"mb-1 flex justify-between gap-2 text-xs font-bold",children:[s.jsxs("span",{style:{color:z.letter===z.left.code?I:void 0},children:[z.left.code," · ",d?z.left.labelZh:z.left.label," ",z.left.percent,"%"]}),s.jsxs("span",{style:{color:z.letter===z.right.code?I:void 0},children:[z.right.percent,"% ",z.right.code," · ",d?z.right.labelZh:z.right.label]})]}),s.jsxs("div",{className:"flex h-2 overflow-hidden rounded-full bg-[#e8e4db]",children:[s.jsx("div",{className:"motion-progress",style:{width:`${z.left.percent}%`,background:I,"--motion-delay":`${100+W*75}ms`}}),s.jsx("div",{className:"motion-progress bg-[#d6d0c6]",style:{width:`${z.right.percent}%`,"--motion-delay":`${140+W*75}ms`}})]})]},z.key))})]})]}),s.jsxs("div",{className:"motion-reveal motion-surface rounded-[18px] border border-black/[0.04] bg-[#fffcf7] p-5 shadow-[0_10px_30px_rgba(40,28,12,0.06)]",children:[s.jsx("h2",{className:"m-0 mb-3 text-sm font-extrabold tracking-wide uppercase text-[#6b6560]",children:u("profile.roast")}),s.jsx("p",{className:"m-0 text-[15px] leading-relaxed whitespace-pre-wrap",children:Se}),s.jsxs("p",{className:"mt-4 mb-0 rounded-xl bg-[#fff0e8] px-3 py-2 text-sm",children:[s.jsx("b",{children:u("profile.tldr")})," · ",ce]})]}),s.jsx("div",{className:"motion-reveal motion-surface rounded-[18px] border border-black/[0.06] bg-[#fffcf7] p-5 shadow-[0_10px_30px_rgba(40,28,12,0.06)] dark:border-white/[0.08]",children:s.jsx("div",{children:s.jsx(Tp,{prompts:(a==null?void 0:a.prompts)||[],activity:m,weeks:52,defaultPalette:"emerald",roastStyle:!0,showViewToggle:!0,defaultViewMode:"2d"})})}),s.jsx(Zp,{activity:m,wordCloudRecords:(a==null?void 0:a.word_cloud_records)||[]})]})]})]}),s.jsx(Mp,{open:E,previewUrl:G,accent:I,busy:g,nativeShareSupported:he,notice:ie,onClose:ye,onDownload:te,onNativeShare:Ne,onCopyCaption:H,t:u})]})}function ym({dimensions:a,accent:c,zh:u,ariaLabel:d}){const p=[.33,.66,1],y=a.map((E,w)=>{const G=-Math.PI/2+w*Math.PI*2/a.length,T=20+Math.min(1,Number(E.score||0))*72,P=122;return{...E,x:150+Math.cos(G)*T,y:150+Math.sin(G)*T,labelX:150+Math.cos(G)*P,labelY:150+Math.sin(G)*P,axisX:150+Math.cos(G)*92,axisY:150+Math.sin(G)*92}}),C=y.map(E=>`${E.x},${E.y}`).join(" ");return s.jsx("div",{className:"flex min-w-0 items-center justify-center overflow-visible py-2",children:s.jsxs("svg",{viewBox:"-28 -28 356 356",className:"h-auto w-full max-w-[340px] overflow-visible",role:"img","aria-label":d,children:[p.map(E=>{const w=a.map((G,O)=>{const T=-Math.PI/2+O*Math.PI*2/a.length;return`${150+Math.cos(T)*92*E},${150+Math.sin(T)*92*E}`}).join(" ");return s.jsx("polygon",{className:"radar-grid",points:w,fill:"none",stroke:"var(--radar-grid)",strokeWidth:"1"},E)}),y.map(E=>s.jsx("line",{className:"radar-grid",x1:150,y1:150,x2:E.axisX,y2:E.axisY,stroke:"var(--radar-grid)",strokeWidth:"1"},E.key)),s.jsx("polygon",{className:"radar-shape",points:C,fill:`${c}33`,stroke:c,strokeWidth:"2.5"}),y.map(E=>s.jsx("circle",{className:"radar-dot",cx:E.x,cy:E.y,r:"3.5",fill:c,stroke:"var(--roast-card)",strokeWidth:"1.5"},`${E.key}-dot`)),y.map(E=>{const w=E.labelX<144?"end":E.labelX>156?"start":"middle";return s.jsx("text",{x:E.labelX,y:E.labelY,textAnchor:w,dominantBaseline:"middle",fill:"var(--roast-muted)",fontSize:"10",fontWeight:"700",children:u?E.labelZh:E.label},`${E.key}-label`)})]})})}const oo=[{id:"deepseek",name:"DeepSeek",mark:"D",color:"#4d6bfe",model:"deepseek-v4-flash",baseUrl:"https://api.deepseek.com"},{id:"openai",name:"OpenAI",mark:"O",color:"#10a37f",model:"gpt-4.1-mini",baseUrl:"https://api.openai.com/v1"},{id:"anthropic",name:"Anthropic",mark:"A",color:"#d97757",model:"claude-haiku-4-5-20251001",baseUrl:"https://api.anthropic.com/v1"},{id:"gemini",name:"Gemini",mark:"G",color:"#4285f4",model:"gemini-2.5-flash",baseUrl:"https://generativelanguage.googleapis.com/v1beta"},{id:"groq",name:"Groq",mark:"Q",color:"#f55036",model:"llama-3.3-70b-versatile",baseUrl:"https://api.groq.com/openai/v1"},{id:"openrouter",name:"OpenRouter",mark:"R",color:"#7c3aed",model:"openai/gpt-4.1-mini",baseUrl:"https://openrouter.ai/api/v1"}];function km({provider:a,size:c="md"}){const u=c==="sm"?"h-7 w-7 text-[10px]":"h-9 w-9 text-xs";return s.jsx("span",{className:`${u} inline-flex shrink-0 items-center justify-center rounded-xl font-black text-white shadow-sm`,style:{background:a.color},"aria-hidden":"true",children:a.mark})}function Lc({icon:a,eyebrow:c,title:u,description:d,onClick:f,accent:v="#171717"}){return s.jsxs("button",{type:"button",onClick:f,className:"roast-access-choice motion-button group relative min-h-[148px] overflow-hidden rounded-[16px] border border-black/[0.07] bg-[#f7f4ef] p-4 text-left hover:border-black/[0.16] dark:border-white/[0.08] dark:bg-white/[0.035] dark:hover:border-white/[0.18]",children:[s.jsx("span",{className:"mb-5 inline-flex h-9 w-9 items-center justify-center rounded-[11px] text-white",style:{background:v},children:a}),s.jsx("span",{className:"block text-[10px] font-bold uppercase tracking-[0.14em] text-[#8b8680] dark:text-[#8f8f8f]",children:c}),s.jsxs("span",{className:"mt-1 flex items-center justify-between gap-4 text-[16px] font-extrabold text-[#1a1a1a] dark:text-white",children:[u,s.jsx(Fc,{size:16,className:"opacity-35 transition-transform group-hover:translate-x-1 group-hover:opacity-80"})]}),s.jsx("span",{className:"mt-1.5 block max-w-[310px] text-[13px] leading-5 text-[#716b65] dark:text-[#aaa49e]",children:d})]})}function wm({open:a,onGenerate:c,onLocal:u}){const{t:d}=Xn(),[f,v]=M.useState("choose"),[m,g]=M.useState("deepseek"),[p,y]=M.useState(""),[C,E]=M.useState(oo[0].model),[w,G]=M.useState(oo[0].baseUrl),[O,T]=M.useState(!1),[P,ie]=M.useState(!1),[ue,F]=M.useState(""),[Q,U]=M.useState(!1),[I,he]=M.useState(null),Se=M.useMemo(()=>oo.find(te=>te.id===m)||oo[0],[m]);if(M.useEffect(()=>{if(!a)return;Promise.all([fetch("/api/ai/providers").then(ye=>ye.json()),fetch("/api/auth/github/session").then(ye=>ye.json())]).then(([ye,Pe])=>{var Ne;U(!!((Ne=ye==null?void 0:ye.github)!=null&&Ne.configured)),(Pe==null?void 0:Pe.status)==="connected"&&he(Pe.user)}).catch(()=>U(!1));const te=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=te}},[a]),M.useEffect(()=>{if(!a)return;async function te(ye){var Pe;if(!(ye.origin!==window.location.origin||((Pe=ye.data)==null?void 0:Pe.type)!=="vibe-roast:github-auth")){if(ye.data.status!=="connected"){F(ye.data.error||d("roastAccess.githubFailed")),ie(!1);return}try{const Ne=await fetch("/api/auth/github/session"),H=await Ne.json();if(!Ne.ok||H.status!=="connected")throw new Error(H.error||d("roastAccess.githubFailed"));he(H.user||{login:"GitHub"}),F("")}catch(Ne){F(Ne.message)}finally{ie(!1)}}}return window.addEventListener("message",te),()=>window.removeEventListener("message",te)},[a,d]),!a)return null;function ce(te){g(te.id),E(te.model),G(te.baseUrl),F("")}async function Me(te){if(te.preventDefault(),!p.trim()){F(d("roastAccess.keyRequired"));return}ie(!0),F("");try{await c({provider:Se.id,apiKey:p.trim(),model:C.trim(),baseUrl:w.trim()})}catch(ye){F(ye.message)}finally{ie(!1)}}function Fe(){if(v("github"),F(""),I)return;if(!window.open("/api/auth/github/start","vibe-roast-github-auth","popup,width=720,height=760")){F(d("roastAccess.popupBlocked"));return}ie(!0)}async function ee(){await fetch("/api/auth/github/session",{method:"DELETE"}),he(null),F("")}async function je(){ie(!0),F("");try{await c({mode:"hosted",provider:"cloudflare"})}catch(te){F(te.message)}finally{ie(!1)}}return s.jsx("div",{className:"fixed inset-0 z-[100] flex items-end justify-center bg-[#201b17]/30 p-0 sm:items-center sm:p-5 dark:bg-black/55",children:s.jsx("section",{role:"dialog","aria-modal":"true","aria-labelledby":"roast-access-title",className:"roast-access-modal animate-tt-modal relative max-h-[96vh] w-full max-w-[720px] overflow-x-hidden overflow-y-auto rounded-t-[22px] border border-black/[0.07] bg-[#fffcf7] text-[#1a1a1a] shadow-[0_24px_70px_rgba(45,30,18,0.22)] dark:border-white/[0.08] dark:bg-[#171717] dark:text-white sm:max-h-[92vh] sm:rounded-[22px]",children:s.jsxs("div",{className:"relative px-5 pb-5 pt-6 sm:px-7 sm:pb-7 sm:pt-7",children:[f!=="choose"&&s.jsxs("button",{type:"button",onClick:()=>{v("choose"),F(""),ie(!1)},className:"motion-button mb-5 inline-flex items-center gap-1.5 rounded-lg px-2 py-1 text-[11px] font-bold text-[#77716b] hover:bg-black/[0.05] dark:text-[#aaa49e] dark:hover:bg-white/[0.06]",children:[s.jsx(sp,{size:13}),d("roastAccess.back")]}),s.jsxs("header",{className:f==="choose"?"mb-6":"mb-5",children:[s.jsxs("div",{className:"mb-2.5 flex items-center gap-2 text-[10px] font-bold uppercase tracking-[0.16em] text-[#ff5a1f]",children:[s.jsx(gc,{size:13}),d("roastAccess.kicker")]}),s.jsxs("h2",{id:"roast-access-title",className:"max-w-[590px] text-[27px] font-extrabold leading-[1.08] tracking-[-0.025em] sm:text-[32px]",children:[f==="choose"&&d("roastAccess.title"),f==="api"&&d("roastAccess.apiTitle"),f==="github"&&d("roastAccess.githubTitle")]}),s.jsxs("p",{className:"mt-2.5 max-w-[590px] text-[13px] leading-5 text-[#716b65] dark:text-[#aaa49e]",children:[f==="choose"&&d("roastAccess.subtitle"),f==="api"&&d("roastAccess.apiSubtitle"),f==="github"&&d("roastAccess.githubSubtitle")]})]}),f==="choose"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[s.jsx(Lc,{icon:s.jsx(dp,{size:18}),eyebrow:d("roastAccess.ownKey"),title:d("roastAccess.apiChoice"),description:d("roastAccess.apiDescription"),accent:"#ff5a1f",onClick:()=>v("api")}),s.jsx(Lc,{icon:s.jsx(xl,{size:19}),eyebrow:d("roastAccess.freeTier"),title:I?`@${I.login}`:d("roastAccess.githubChoice"),description:d(I?"roastAccess.githubSignedInDescription":"roastAccess.githubDescription"),accent:"#171717",onClick:()=>{v("github"),F("")}})]}),s.jsxs("div",{className:"mt-5 flex flex-col items-center justify-between gap-3 border-t border-black/[0.07] pt-5 sm:flex-row dark:border-white/[0.08]",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-[#807a74] dark:text-[#99938d]",children:[s.jsx(hc,{size:14,className:"text-[#0ba875]"}),d("roastAccess.privacy")]}),s.jsx("button",{type:"button",onClick:u,className:"motion-button rounded-lg px-3 py-2 text-[11px] font-bold text-[#77716b] hover:bg-black/[0.05] dark:text-[#aaa49e] dark:hover:bg-white/[0.06]",children:d("roastAccess.local")})]})]}),f==="api"&&s.jsxs("form",{onSubmit:Me,children:[s.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:oo.map(te=>{const ye=te.id===Se.id;return s.jsxs("button",{type:"button",onClick:()=>ce(te),className:`motion-button flex min-w-0 items-center gap-2 rounded-[15px] border p-2.5 text-left ${ye?"border-black/[0.16] bg-white shadow-sm dark:border-white/[0.2] dark:bg-white/[0.08]":"border-black/[0.06] bg-white/40 hover:bg-white dark:border-white/[0.07] dark:bg-white/[0.025] dark:hover:bg-white/[0.05]"}`,children:[s.jsx(km,{provider:te,size:"sm"}),s.jsx("span",{className:"min-w-0 truncate text-[11px] font-black",children:te.name}),ye&&s.jsx(Uc,{size:12,className:"ml-auto shrink-0 text-[#0ba875]"})]},te.id)})}),s.jsxs("label",{className:"mt-5 block",children:[s.jsxs("span",{className:"mb-2 flex items-center justify-between text-[10px] font-black uppercase tracking-[0.14em] text-[#77716b] dark:text-[#aaa49e]",children:["API Key",s.jsx("span",{className:"normal-case tracking-normal text-[#aaa49e]",children:d("roastAccess.sessionOnly")})]}),s.jsxs("div",{className:"flex items-center rounded-[15px] border border-black/[0.09] bg-white px-3 dark:border-white/[0.1] dark:bg-black/20",children:[s.jsx(fp,{size:14,className:"shrink-0 text-[#aaa49e]"}),s.jsx("input",{type:"password",value:p,onChange:te=>y(te.target.value),placeholder:d("roastAccess.keyPlaceholder",{provider:Se.name}),autoComplete:"off",spellCheck:"false",className:"h-12 min-w-0 flex-1 bg-transparent px-3 text-sm font-medium outline-none placeholder:text-[#bbb5ae] dark:placeholder:text-[#686868]"})]})]}),s.jsxs("label",{className:"mt-3 block",children:[s.jsx("span",{className:"mb-2 block text-[10px] font-black uppercase tracking-[0.14em] text-[#77716b] dark:text-[#aaa49e]",children:d("roastAccess.model")}),s.jsx("input",{type:"text",value:C,onChange:te=>E(te.target.value),className:"h-12 w-full rounded-[15px] border border-black/[0.09] bg-white px-4 text-sm font-semibold outline-none focus:border-black/[0.22] dark:border-white/[0.1] dark:bg-black/20 dark:focus:border-white/[0.25]"})]}),s.jsxs("button",{type:"button",onClick:()=>T(te=>!te),className:"mt-3 inline-flex items-center gap-1.5 text-[11px] font-bold text-[#817b75] dark:text-[#99938d]",children:[s.jsx(Hc,{size:13,className:`transition-transform ${O?"rotate-180":""}`}),d("roastAccess.advanced")]}),O&&s.jsxs("label",{className:"mt-2 block",children:[s.jsx("span",{className:"mb-2 block text-[10px] font-black uppercase tracking-[0.14em] text-[#77716b] dark:text-[#aaa49e]",children:"Base URL"}),s.jsx("input",{type:"url",value:w,onChange:te=>G(te.target.value),className:"h-11 w-full rounded-[14px] border border-black/[0.09] bg-white px-4 text-xs outline-none dark:border-white/[0.1] dark:bg-black/20"})]}),ue&&s.jsx("p",{className:"mt-3 rounded-xl bg-red-500/[0.08] px-3 py-2 text-xs font-semibold text-red-600 dark:text-red-400",children:ue}),s.jsxs("button",{type:"submit",disabled:P,className:"motion-button mt-5 inline-flex h-12 w-full items-center justify-center gap-2 rounded-[15px] bg-[#ff5a1f] text-sm font-black text-white shadow-[0_12px_25px_rgba(255,90,31,0.22)] disabled:opacity-55",children:[d(P?"roastAccess.generating":"roastAccess.generate"),!P&&s.jsx(Fc,{size:15})]})]}),f==="github"&&s.jsxs("div",{children:[s.jsx("div",{className:"rounded-[20px] border border-black/[0.07] bg-white/70 p-5 dark:border-white/[0.08] dark:bg-white/[0.035]",children:I?s.jsxs("div",{className:"flex flex-col items-center text-center",children:[I.avatarUrl?s.jsx("img",{src:I.avatarUrl,alt:"",className:"h-12 w-12 rounded-full"}):s.jsx("span",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-[#171717] text-white",children:s.jsx(xl,{size:20})}),s.jsxs("p",{className:"mt-3 text-sm font-black",children:["@",I.login]}),s.jsx("p",{className:"mt-1 text-xs text-[#817b75] dark:text-[#99938d]",children:d("roastAccess.githubConnected")}),ue&&s.jsx("p",{className:"mt-3 w-full rounded-xl bg-red-500/[0.08] px-3 py-2 text-left text-xs font-semibold leading-5 text-red-600 dark:text-red-400",children:ue}),s.jsxs("button",{type:"button",onClick:je,disabled:P,className:"motion-button mt-5 inline-flex h-12 w-full items-center justify-center gap-2 rounded-[15px] bg-[#171717] text-sm font-black text-white disabled:opacity-55 dark:bg-white dark:text-[#171717]",children:[d(P?"roastAccess.generating":"roastAccess.generateFree"),!P&&s.jsx(gc,{size:15})]}),s.jsx("button",{type:"button",onClick:()=>v("api"),disabled:P,className:"mt-3 text-[11px] font-bold text-[#817b75] underline-offset-4 hover:underline disabled:opacity-50 dark:text-[#99938d]",children:d("roastAccess.chooseProvider")}),s.jsx("button",{type:"button",onClick:ee,className:"mt-3 text-[11px] font-bold text-[#817b75] underline-offset-4 hover:underline dark:text-[#99938d]",children:d("roastAccess.signOut")})]}):s.jsxs("div",{className:"flex min-h-[130px] flex-col items-center justify-center text-center",children:[s.jsx(xl,{size:28,className:"mb-3"}),s.jsx("p",{className:"max-w-sm text-sm font-bold",children:d(Q?"roastAccess.githubOneClick":"roastAccess.githubUnavailable")}),ue&&s.jsx("p",{className:"mt-2 max-w-md text-xs leading-5 text-red-600 dark:text-red-400",children:ue}),!P&&s.jsxs("button",{type:"button",onClick:Fe,className:"motion-button mt-4 inline-flex h-12 min-w-[230px] items-center justify-center gap-2 rounded-[14px] bg-[#171717] px-5 text-sm font-black text-white shadow-[0_12px_25px_rgba(0,0,0,0.14)] dark:bg-white dark:text-[#171717]",children:[s.jsx(xl,{size:17}),d("roastAccess.continueGithub")]}),P&&s.jsx("p",{className:"mt-4 text-xs text-[#817b75] dark:text-[#99938d]",children:d("roastAccess.waiting")})]})}),s.jsxs("div",{className:"mt-4 flex items-start gap-2 text-[11px] leading-5 text-[#817b75] dark:text-[#99938d]",children:[s.jsx(hc,{size:14,className:"mt-0.5 shrink-0 text-[#0ba875]"}),d("roastAccess.githubPrivacy")]})]})]})})})}function Sm(a={}){const[c,u]=M.useState(null),[d,f]=M.useState(!0),[v,m]=M.useState(null);return M.useEffect(()=>{let g=!1;async function p(){f(!0),m(null);try{const y=new URLSearchParams;a.from&&y.set("from",a.from),a.to&&y.set("to",a.to);const C=y.toString(),E=await fetch(`/api/inspect${C?`?${C}`:""}`);if(!E.ok)throw new Error(`HTTP ${E.status}`);const w=await E.json();g||u(w)}catch(y){g||m(y.message)}finally{g||f(!1)}}return p(),()=>{g=!0}},[a.from,a.to]),{data:c,loading:d,error:v}}function Cm(a,c={},u=new Date){return{label:"All time"}}function jm(){const{t:a}=Xn(),[c,u]=M.useState(null),[d,f]=M.useState(!0),v=M.useRef(!1),m=Cm("total",{}),{data:g,loading:p,error:y}=Sm(m);M.useEffect(()=>{g&&u(g)},[g]);async function C(E){const w=new AbortController,G=window.setTimeout(()=>w.abort(),45e3);try{const O=await fetch("/api/roast",{method:"POST",headers:{"Content-Type":"application/json"},signal:w.signal,body:JSON.stringify({...E,evidence:c==null?void 0:c.roast_evidence})}),T=await O.json().catch(()=>({}));if(!O.ok){const P=(T==null?void 0:T.error)||`HTTP ${O.status}`;throw new Error(P)}if(!(T!=null&&T.generated))throw new Error("The roast writer returned no result.");u(P=>({...P,vibe_profile:{...P==null?void 0:P.vibe_profile,...T.generated,roast_source:"ai"}})),f(!1)}catch(O){throw(O==null?void 0:O.name)==="AbortError"?new Error("Roast generation timed out. Try again or use the local roast."):O}finally{window.clearTimeout(G)}}return M.useEffect(()=>{if(!(c!=null&&c.roast_evidence)||v.current)return;v.current=!0;let E=!0;return fetch("/api/auth/github/session").then(w=>w.json()).then(w=>E&&(w==null?void 0:w.status)==="connected"?C({mode:"hosted",provider:"cloudflare"}):null).catch(()=>{}),()=>{E=!1}},[c==null?void 0:c.roast_evidence]),s.jsx("div",{className:"min-h-screen bg-[#f3f1ec] text-[#171717] transition-colors dark:bg-[#0a0a0a] dark:text-[#fafafa]",children:s.jsx("main",{children:p&&!c?s.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-3 px-6",children:[s.jsx("p",{className:"roast-brand text-[44px] leading-none text-[#1a1a1a] dark:text-[#fafafa]",children:a("app.brand")}),s.jsx("p",{className:"text-[#6b6560] text-sm font-medium dark:text-[#a3a3a3]",children:a("app.loading")})]}):y&&!c?s.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-3 px-6 text-center",children:[s.jsx("p",{className:"roast-brand text-[44px] leading-none text-[#1a1a1a] dark:text-[#fafafa]",children:a("app.brand")}),s.jsx("p",{className:"text-[#e24b4b] text-sm font-medium max-w-md",children:y})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:d?"pointer-events-none select-none blur-[3px]":"","aria-hidden":d,children:s.jsx(vm,{data:c})}),s.jsx(wm,{open:d,onGenerate:C,onLocal:()=>f(!1)})]})})})}function bm(){return s.jsx(ep,{children:s.jsx(rp,{children:s.jsx(jm,{})})})}Jf.createRoot(document.getElementById("root")).render(s.jsx(Yf.StrictMode,{children:s.jsx(bm,{})}));
@@ -23,7 +23,7 @@
23
23
  html { background: #f3f1ec; }
24
24
  html.dark { background: #0a0a0a; }
25
25
  </style>
26
- <script type="module" crossorigin src="/assets/index-t8m64Hm9.js"></script>
26
+ <script type="module" crossorigin src="/assets/index-BPhMyUU4.js"></script>
27
27
  <link rel="stylesheet" crossorigin href="/assets/index-DlBycTcO.css">
28
28
  </head>
29
29
  <body>
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "vibe-roast",
3
- "version": "0.98.0",
3
+ "version": "0.98.2",
4
4
  "description": "Local-first AI coding personality profiler, usage dashboard, and evidence-grounded roast.",
5
5
  "type": "commonjs",
6
6
  "bin": {
7
- "vibe-roast": "bin/vibe-roast.js",
8
- "vibe-wrapper": "bin/vibe-wrapper.js"
7
+ "vibe-roast": "bin/vibe-roast.js"
9
8
  },
10
9
  "repository": {
11
10
  "type": "git",
@@ -119,7 +119,7 @@ async function removeClaudeHook(settingsPath) {
119
119
  /* ── Codex ─────────────────────────────────────────────── */
120
120
 
121
121
  const CODEX_HOOK_TOML = `
122
- # Vibe Wrapper — token tracking hook
122
+ # Vibe Roaster — token tracking hook
123
123
  [[notify.hooks]]
124
124
  event = "session_end"
125
125
  command = "node ${HOOK_SCRIPT}"
@@ -153,7 +153,7 @@ async function removeCodexHook(configPath) {
153
153
  }
154
154
 
155
155
  const lines = existing.split("\n").filter((line) => !line.includes(HOOK_SCRIPT));
156
- // Also remove the Vibe Wrapper comment and empty [[notify.hooks]] blocks
156
+ // Also remove the Vibe Roaster comment and empty [[notify.hooks]] blocks
157
157
  const cleaned = cleanCodexConfig(lines);
158
158
 
159
159
  await fs.writeFile(configPath, cleaned);
@@ -168,8 +168,8 @@ function cleanCodexConfig(lines) {
168
168
  let skip = false;
169
169
  for (let i = 0; i < lines.length; i++) {
170
170
  const line = lines[i];
171
- // Skip Vibe Wrapper comment and associated hook entries
172
- if (line.includes("# Vibe Wrapper")) {
171
+ // Skip the Vibe Roaster comment and associated hook entries.
172
+ if (line.includes("# Vibe Roaster")) {
173
173
  skip = true;
174
174
  continue;
175
175
  }