| 1 |
<!DOCTYPE html> |
| 2 |
<html lang="en"> |
| 3 |
<head> |
| 4 |
<meta charset="UTF-8"> |
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 6 |
<title>MinLZ Block Visualizer</title> |
| 7 |
<style> |
| 8 |
* { box-sizing: border-box; margin: 0; padding: 0; } |
| 9 |
html, body { height: 100%; overflow: hidden; } |
| 10 |
|
| 11 |
:root { |
| 12 |
--bg-dark: #1a1a2e; |
| 13 |
--bg-panel: #16213e; |
| 14 |
--bg-input: #0f3460; |
| 15 |
--accent: #e94560; |
| 16 |
--accent-blue: #4a9eff; |
| 17 |
--accent-green: #4ade80; |
| 18 |
--accent-yellow: #facc15; |
| 19 |
--accent-red: #f87171; |
| 20 |
--text: #e8e8e8; |
| 21 |
--text-dim: #a0a0a0; |
| 22 |
--border: #2a2a4a; |
| 23 |
} |
| 24 |
|
| 25 |
body { |
| 26 |
font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; |
| 27 |
background: var(--bg-dark); |
| 28 |
color: var(--text); |
| 29 |
height: 100%; |
| 30 |
display: flex; |
| 31 |
flex-direction: column; |
| 32 |
overflow: hidden; |
| 33 |
} |
| 34 |
|
| 35 |
header { |
| 36 |
background: var(--bg-panel); |
| 37 |
padding: 12px 24px; |
| 38 |
border-bottom: 1px solid var(--border); |
| 39 |
display: flex; |
| 40 |
align-items: center; |
| 41 |
gap: 24px; |
| 42 |
} |
| 43 |
|
| 44 |
header h1 { |
| 45 |
font-size: 1.4rem; |
| 46 |
font-weight: 600; |
| 47 |
color: var(--accent); |
| 48 |
} |
| 49 |
|
| 50 |
.stats { |
| 51 |
display: flex; |
| 52 |
gap: 20px; |
| 53 |
font-size: 0.85rem; |
| 54 |
} |
| 55 |
|
| 56 |
.stat { color: var(--text-dim); } |
| 57 |
.stat span { color: var(--text); font-weight: 500; } |
| 58 |
|
| 59 |
.controls { |
| 60 |
display: flex; |
| 61 |
gap: 8px; |
| 62 |
margin-left: auto; |
| 63 |
} |
| 64 |
|
| 65 |
button { |
| 66 |
background: var(--bg-input); |
| 67 |
border: 1px solid var(--border); |
| 68 |
color: var(--text); |
| 69 |
padding: 6px 14px; |
| 70 |
border-radius: 4px; |
| 71 |
cursor: pointer; |
| 72 |
font-size: 0.85rem; |
| 73 |
transition: all 0.15s; |
| 74 |
} |
| 75 |
|
| 76 |
button:hover { background: var(--accent); border-color: var(--accent); } |
| 77 |
button:disabled { opacity: 0.5; cursor: not-allowed; } |
| 78 |
button.active { background: var(--accent); border-color: var(--accent); } |
| 79 |
|
| 80 |
main { |
| 81 |
display: flex; |
| 82 |
flex: 1; |
| 83 |
min-height: 0; |
| 84 |
overflow: hidden; |
| 85 |
} |
| 86 |
|
| 87 |
.panel { |
| 88 |
background: var(--bg-panel); |
| 89 |
border-right: 1px solid var(--border); |
| 90 |
display: flex; |
| 91 |
flex-direction: column; |
| 92 |
width: 672px; |
| 93 |
min-width: 480px; |
| 94 |
max-width: 900px; |
| 95 |
min-height: 0; |
| 96 |
resize: horizontal; |
| 97 |
overflow: hidden; |
| 98 |
} |
| 99 |
|
| 100 |
.panel-header { |
| 101 |
padding: 10px 16px; |
| 102 |
border-bottom: 1px solid var(--border); |
| 103 |
font-weight: 500; |
| 104 |
font-size: 0.9rem; |
| 105 |
display: flex; |
| 106 |
align-items: center; |
| 107 |
gap: 12px; |
| 108 |
} |
| 109 |
|
| 110 |
.panel-header .filter { |
| 111 |
margin-left: auto; |
| 112 |
display: flex; |
| 113 |
gap: 4px; |
| 114 |
} |
| 115 |
|
| 116 |
.filter-wrap { |
| 117 |
position: relative; |
| 118 |
display: inline-block; |
| 119 |
} |
| 120 |
|
| 121 |
.filter-btn { |
| 122 |
padding: 3px 8px; |
| 123 |
font-size: 0.75rem; |
| 124 |
border-radius: 3px; |
| 125 |
} |
| 126 |
|
| 127 |
.filter-btn.lit { background: #4a4a5a; } |
| 128 |
.filter-btn.rep { background: #3a3a6a; } |
| 129 |
.filter-btn.c1 { background: #3a5a3a; } |
| 130 |
.filter-btn.c2 { background: #5a5a3a; } |
| 131 |
.filter-btn.c3 { background: #5a3a3a; } |
| 132 |
|
| 133 |
.filter-wrap .legend-stats { |
| 134 |
top: 100%; |
| 135 |
bottom: auto; |
| 136 |
left: auto; |
| 137 |
right: 0; |
| 138 |
margin-top: 8px; |
| 139 |
margin-bottom: 0; |
| 140 |
} |
| 141 |
|
| 142 |
.filter-wrap:hover .legend-stats { display: block; } |
| 143 |
|
| 144 |
.table-container { |
| 145 |
flex: 1; |
| 146 |
min-height: 0; |
| 147 |
overflow: auto; |
| 148 |
} |
| 149 |
|
| 150 |
table { |
| 151 |
width: 100%; |
| 152 |
border-collapse: collapse; |
| 153 |
font-size: 0.8rem; |
| 154 |
font-family: 'Consolas', 'Monaco', monospace; |
| 155 |
} |
| 156 |
|
| 157 |
th { |
| 158 |
position: sticky; |
| 159 |
top: 0; |
| 160 |
background: var(--bg-input); |
| 161 |
padding: 8px 10px; |
| 162 |
text-align: left; |
| 163 |
font-weight: 500; |
| 164 |
border-bottom: 1px solid var(--border); |
| 165 |
white-space: nowrap; |
| 166 |
} |
| 167 |
|
| 168 |
td { |
| 169 |
padding: 5px 10px; |
| 170 |
border-bottom: 1px solid var(--border); |
| 171 |
white-space: nowrap; |
| 172 |
} |
| 173 |
|
| 174 |
/* Column widths */ |
| 175 |
th:nth-child(1), td:nth-child(1) { width: 40px; } |
| 176 |
th:nth-child(2), td:nth-child(2) { width: 60px; } |
| 177 |
th:nth-child(3), td:nth-child(3) { width: 100px; } |
| 178 |
th:nth-child(4), td:nth-child(4) { min-width: 270px; white-space: normal; word-break: break-word; } |
| 179 |
th:nth-child(5), td:nth-child(5) { width: 90px; } |
| 180 |
|
| 181 |
tr:hover { background: rgba(255,255,255,0.03); } |
| 182 |
tr.selected { background: rgba(74, 158, 255, 0.15); } |
| 183 |
tr.selected:hover { background: rgba(74, 158, 255, 0.2); } |
| 184 |
|
| 185 |
.type-badge { |
| 186 |
display: inline-block; |
| 187 |
padding: 2px 6px; |
| 188 |
border-radius: 3px; |
| 189 |
font-size: 0.7rem; |
| 190 |
font-weight: 500; |
| 191 |
text-transform: uppercase; |
| 192 |
} |
| 193 |
|
| 194 |
.type-literal { background: #4a4a5a; color: #c8c8c8; } |
| 195 |
.type-repeat { background: #3a3a7a; color: #9090ff; } |
| 196 |
.type-copy1 { background: #3a6a3a; color: #80d080; } |
| 197 |
.type-copy2 { background: #6a6a3a; color: #d0d080; } |
| 198 |
.type-copy3 { background: #6a3a3a; color: #d08080; } |
| 199 |
|
| 200 |
.hex { color: var(--text-dim); } |
| 201 |
.offset-val { color: var(--accent-blue); } |
| 202 |
.length-val { color: var(--accent-green); } |
| 203 |
|
| 204 |
.canvas-container { |
| 205 |
flex: 1; |
| 206 |
min-height: 0; |
| 207 |
position: relative; |
| 208 |
overflow: hidden; |
| 209 |
display: flex; |
| 210 |
flex-direction: column; |
| 211 |
} |
| 212 |
|
| 213 |
.canvas-toolbar { |
| 214 |
padding: 8px 16px; |
| 215 |
background: var(--bg-panel); |
| 216 |
border-bottom: 1px solid var(--border); |
| 217 |
display: flex; |
| 218 |
align-items: center; |
| 219 |
gap: 12px; |
| 220 |
font-size: 0.85rem; |
| 221 |
} |
| 222 |
|
| 223 |
.zoom-controls { |
| 224 |
display: flex; |
| 225 |
align-items: center; |
| 226 |
gap: 6px; |
| 227 |
} |
| 228 |
|
| 229 |
.zoom-level { |
| 230 |
min-width: 50px; |
| 231 |
text-align: center; |
| 232 |
color: var(--text-dim); |
| 233 |
} |
| 234 |
|
| 235 |
.canvas-info { |
| 236 |
margin-left: auto; |
| 237 |
color: var(--text-dim); |
| 238 |
font-family: monospace; |
| 239 |
} |
| 240 |
|
| 241 |
.canvas-wrapper { |
| 242 |
flex: 1; |
| 243 |
position: relative; |
| 244 |
overflow: hidden; |
| 245 |
cursor: grab; |
| 246 |
} |
| 247 |
|
| 248 |
.canvas-wrapper:active { cursor: grabbing; } |
| 249 |
|
| 250 |
#canvas { |
| 251 |
position: absolute; |
| 252 |
image-rendering: pixelated; |
| 253 |
image-rendering: crisp-edges; |
| 254 |
} |
| 255 |
|
| 256 |
.tooltip { |
| 257 |
position: fixed; |
| 258 |
background: var(--bg-input); |
| 259 |
border: 1px solid var(--border); |
| 260 |
padding: 8px 12px; |
| 261 |
border-radius: 4px; |
| 262 |
font-size: 0.8rem; |
| 263 |
font-family: monospace; |
| 264 |
pointer-events: none; |
| 265 |
z-index: 1000; |
| 266 |
box-shadow: 0 4px 12px rgba(0,0,0,0.3); |
| 267 |
display: none; |
| 268 |
} |
| 269 |
|
| 270 |
.tooltip.visible { display: block; } |
| 271 |
|
| 272 |
.tooltip-row { display: flex; gap: 12px; } |
| 273 |
.tooltip-label { color: var(--text-dim); } |
| 274 |
.tooltip-value { color: var(--text); } |
| 275 |
|
| 276 |
.drop-zone { |
| 277 |
position: fixed; |
| 278 |
inset: 0; |
| 279 |
background: rgba(26, 26, 46, 0.95); |
| 280 |
display: flex; |
| 281 |
align-items: center; |
| 282 |
justify-content: center; |
| 283 |
z-index: 100; |
| 284 |
opacity: 0; |
| 285 |
pointer-events: none; |
| 286 |
transition: opacity 0.2s; |
| 287 |
} |
| 288 |
|
| 289 |
.drop-zone.active { |
| 290 |
opacity: 1; |
| 291 |
pointer-events: auto; |
| 292 |
} |
| 293 |
|
| 294 |
.drop-zone-inner { |
| 295 |
border: 3px dashed var(--accent); |
| 296 |
border-radius: 16px; |
| 297 |
padding: 60px 100px; |
| 298 |
text-align: center; |
| 299 |
} |
| 300 |
|
| 301 |
.drop-zone h2 { |
| 302 |
font-size: 1.5rem; |
| 303 |
margin-bottom: 8px; |
| 304 |
} |
| 305 |
|
| 306 |
.drop-zone p { color: var(--text-dim); } |
| 307 |
|
| 308 |
.empty-state { |
| 309 |
flex: 1; |
| 310 |
display: flex; |
| 311 |
flex-direction: column; |
| 312 |
align-items: center; |
| 313 |
justify-content: center; |
| 314 |
color: var(--text-dim); |
| 315 |
text-align: center; |
| 316 |
padding: 40px; |
| 317 |
} |
| 318 |
|
| 319 |
.empty-state h2 { |
| 320 |
font-size: 1.3rem; |
| 321 |
margin-bottom: 12px; |
| 322 |
color: var(--text); |
| 323 |
} |
| 324 |
|
| 325 |
.empty-state p { margin-bottom: 20px; } |
| 326 |
|
| 327 |
.legend { |
| 328 |
display: flex; |
| 329 |
gap: 16px; |
| 330 |
padding: 8px 16px; |
| 331 |
background: var(--bg-panel); |
| 332 |
border-top: 1px solid var(--border); |
| 333 |
font-size: 0.75rem; |
| 334 |
} |
| 335 |
|
| 336 |
.legend-item { |
| 337 |
display: flex; |
| 338 |
align-items: center; |
| 339 |
gap: 6px; |
| 340 |
cursor: pointer; |
| 341 |
position: relative; |
| 342 |
} |
| 343 |
|
| 344 |
.legend-color { |
| 345 |
width: 14px; |
| 346 |
height: 14px; |
| 347 |
border-radius: 2px; |
| 348 |
} |
| 349 |
|
| 350 |
.legend-stats { |
| 351 |
display: none; |
| 352 |
position: absolute; |
| 353 |
bottom: 100%; |
| 354 |
left: 0; |
| 355 |
background: var(--bg-input); |
| 356 |
border: 1px solid var(--border); |
| 357 |
padding: 10px 14px; |
| 358 |
border-radius: 6px; |
| 359 |
z-index: 100; |
| 360 |
min-width: 240px; |
| 361 |
font-size: 0.75rem; |
| 362 |
line-height: 1.7; |
| 363 |
white-space: nowrap; |
| 364 |
box-shadow: 0 4px 16px rgba(0,0,0,0.4); |
| 365 |
margin-bottom: 8px; |
| 366 |
} |
| 367 |
|
| 368 |
.legend-item:hover .legend-stats { display: block; } |
| 369 |
|
| 370 |
.legend-stats table { width: 100%; } |
| 371 |
.legend-stats td { padding: 1px 0; border: none; } |
| 372 |
.legend-stats td:first-child { color: var(--text-dim); } |
| 373 |
.legend-stats td:last-child { text-align: right; color: var(--text); font-family: monospace; } |
| 374 |
|
| 375 |
.color-literal { background: #808080; } |
| 376 |
.color-repeat { background: #6464b4; } |
| 377 |
.color-copy1 { background: #64a064; } |
| 378 |
.color-copy2 { background: #a0a064; } |
| 379 |
.color-copy3 { background: #a06464; } |
| 380 |
|
| 381 |
.highlight-info { |
| 382 |
margin-left: auto; |
| 383 |
display: flex; |
| 384 |
gap: 16px; |
| 385 |
} |
| 386 |
|
| 387 |
.highlight-item { |
| 388 |
display: flex; |
| 389 |
align-items: center; |
| 390 |
gap: 6px; |
| 391 |
} |
| 392 |
|
| 393 |
.highlight-box { |
| 394 |
width: 14px; |
| 395 |
height: 14px; |
| 396 |
border: 2px solid; |
| 397 |
border-radius: 2px; |
| 398 |
} |
| 399 |
|
| 400 |
.highlight-dest { border-color: #ffffff; } |
| 401 |
.highlight-src { border-color: #ff0000; } |
| 402 |
|
| 403 |
.loading-overlay { |
| 404 |
position: absolute; |
| 405 |
inset: 0; |
| 406 |
background: rgba(26, 26, 46, 0.9); |
| 407 |
display: none; |
| 408 |
flex-direction: column; |
| 409 |
align-items: center; |
| 410 |
justify-content: center; |
| 411 |
z-index: 50; |
| 412 |
} |
| 413 |
|
| 414 |
.loading-overlay.active { display: flex; } |
| 415 |
|
| 416 |
.spinner { |
| 417 |
width: 48px; |
| 418 |
height: 48px; |
| 419 |
border: 4px solid var(--border); |
| 420 |
border-top-color: var(--accent); |
| 421 |
border-radius: 50%; |
| 422 |
animation: spin 0.8s linear infinite; |
| 423 |
} |
| 424 |
|
| 425 |
@keyframes spin { |
| 426 |
to { transform: rotate(360deg); } |
| 427 |
} |
| 428 |
|
| 429 |
.loading-text { |
| 430 |
margin-top: 16px; |
| 431 |
color: var(--text-dim); |
| 432 |
font-size: 0.9rem; |
| 433 |
} |
| 434 |
</style> |
| 435 |
</head> |
| 436 |
<body> |
| 437 |
<header> |
| 438 |
<h1>MinLZ Block Visualizer</h1> |
| 439 |
<div class="stats" id="stats"> |
| 440 |
<div class="stat">Compressed: <span id="stat-compressed">-</span></div> |
| 441 |
<div class="stat">Decompressed: <span id="stat-decompressed">-</span></div> |
| 442 |
<div class="stat">Ratio: <span id="stat-ratio">-</span></div> |
| 443 |
<div class="stat">Operations: <span id="stat-ops">-</span></div> |
| 444 |
</div> |
| 445 |
<div class="controls"> |
| 446 |
<button id="btn-load">Load File</button> |
| 447 |
<button id="btn-sample">Load Sample</button> |
| 448 |
<button id="btn-download" disabled>Download Decoded</button> |
| 449 |
</div> |
| 450 |
</header> |
| 451 |
|
| 452 |
<main> |
| 453 |
<div class="panel" id="panel"> |
| 454 |
<div class="panel-header"> |
| 455 |
Operations |
| 456 |
<div class="filter"> |
| 457 |
<span class="filter-wrap"><button class="filter-btn lit active" data-type="literal" title="Literals">L</button><span class="legend-stats" id="stats-top-literal"></span></span> |
| 458 |
<span class="filter-wrap"><button class="filter-btn rep active" data-type="repeat" title="Repeat">R</button><span class="legend-stats" id="stats-top-repeat"></span></span> |
| 459 |
<span class="filter-wrap"><button class="filter-btn c1 active" data-type="copy1" title="Copy1">1</button><span class="legend-stats" id="stats-top-copy1"></span></span> |
| 460 |
<span class="filter-wrap"><button class="filter-btn c2 active" data-type="copy2" title="Copy2">2</button><span class="legend-stats" id="stats-top-copy2"></span></span> |
| 461 |
<span class="filter-wrap"><button class="filter-btn c3 active" data-type="copy3" title="Copy3">3</button><span class="legend-stats" id="stats-top-copy3"></span></span> |
| 462 |
</div> |
| 463 |
</div> |
| 464 |
<div class="table-container" id="table-container"> |
| 465 |
<table id="op-table"> |
| 466 |
<thead> |
| 467 |
<tr> |
| 468 |
<th>#</th> |
| 469 |
<th>Type</th> |
| 470 |
<th>Hex</th> |
| 471 |
<th>Details</th> |
| 472 |
<th>Dst</th> |
| 473 |
</tr> |
| 474 |
</thead> |
| 475 |
<tbody id="op-tbody"></tbody> |
| 476 |
</table> |
| 477 |
</div> |
| 478 |
</div> |
| 479 |
|
| 480 |
<div class="canvas-container" id="canvas-container"> |
| 481 |
<div class="empty-state" id="empty-state"> |
| 482 |
<h2>Drop a .mzb file here</h2> |
| 483 |
<p>Or click "Load File" to browse, or "Load Sample" to see an example</p> |
| 484 |
<p style="font-size: 0.8rem; margin-top: 20px;"> |
| 485 |
Raw MinLZ block files (.mzb) only - not .mz streams |
| 486 |
</p> |
| 487 |
</div> |
| 488 |
|
| 489 |
<div class="loading-overlay" id="loading-overlay"> |
| 490 |
<div class="spinner"></div> |
| 491 |
<div class="loading-text">Decoding...</div> |
| 492 |
</div> |
| 493 |
|
| 494 |
<div class="canvas-toolbar" id="canvas-toolbar" style="display: none;"> |
| 495 |
<div class="zoom-controls"> |
| 496 |
<button id="zoom-out">-</button> |
| 497 |
<span class="zoom-level" id="zoom-level">1x</span> |
| 498 |
<button id="zoom-in">+</button> |
| 499 |
<button id="zoom-fit">Fit</button> |
| 500 |
</div> |
| 501 |
<span style="color: var(--text-dim)">|</span> |
| 502 |
<span style="color: var(--text-dim); font-size: 0.8rem;"> |
| 503 |
Scroll to zoom, drag to pan, click canvas or table row to select |
| 504 |
</span> |
| 505 |
<div class="canvas-info" id="canvas-info"></div> |
| 506 |
</div> |
| 507 |
|
| 508 |
<div class="canvas-wrapper" id="canvas-wrapper" style="display: none;"> |
| 509 |
<canvas id="canvas"></canvas> |
| 510 |
</div> |
| 511 |
|
| 512 |
<div class="legend" id="legend" style="display: none;"> |
| 513 |
<div class="legend-item" data-type="literal"><div class="legend-color color-literal"></div> Literal<div class="legend-stats" id="stats-literal"></div></div> |
| 514 |
<div class="legend-item" data-type="repeat"><div class="legend-color color-repeat"></div> Repeat<div class="legend-stats" id="stats-repeat"></div></div> |
| 515 |
<div class="legend-item" data-type="copy1"><div class="legend-color color-copy1"></div> Copy1<div class="legend-stats" id="stats-copy1"></div></div> |
| 516 |
<div class="legend-item" data-type="copy2"><div class="legend-color color-copy2"></div> Copy2<div class="legend-stats" id="stats-copy2"></div></div> |
| 517 |
<div class="legend-item" data-type="copy3"><div class="legend-color color-copy3"></div> Copy3<div class="legend-stats" id="stats-copy3"></div></div> |
| 518 |
<div class="highlight-info"> |
| 519 |
<div class="highlight-item"><div class="highlight-box highlight-dest"></div> Destination</div> |
| 520 |
<div class="highlight-item"><div class="highlight-box highlight-src"></div> Source</div> |
| 521 |
</div> |
| 522 |
</div> |
| 523 |
</div> |
| 524 |
</main> |
| 525 |
|
| 526 |
<div class="drop-zone" id="drop-zone"> |
| 527 |
<div class="drop-zone-inner"> |
| 528 |
<h2>Drop .mzb file</h2> |
| 529 |
<p>Release to decode and visualize</p> |
| 530 |
</div> |
| 531 |
</div> |
| 532 |
|
| 533 |
<div class="tooltip" id="tooltip"> |
| 534 |
<div class="tooltip-row"><span class="tooltip-label">Op:</span> <span class="tooltip-value" id="tip-pos">-</span></div> |
| 535 |
<div class="tooltip-row"><span class="tooltip-label">Details:</span> <span class="tooltip-value" id="tip-val">-</span></div> |
| 536 |
<div class="tooltip-row"><span class="tooltip-label">Output:</span> <span class="tooltip-value" id="tip-op">-</span></div> |
| 537 |
</div> |
| 538 |
|
| 539 |
<input type="file" id="file-input" accept=".mzb,.bin" style="display: none;"> |
| 540 |
|
| 541 |
<script src="vis.js"></script> |
| 542 |
</body> |
| 543 |
</html> |