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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
<link rel="icon" type="image/png" href="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRVz1Q0pW51uxiFKUFSiu-TNgXCoQUaP1A7Uojg39Bijg&s=10">
|
| 7 |
+
<title>Death β Compiler β by Muhammad Taqi</title>
|
| 8 |
+
<style>
|
| 9 |
+
:root{
|
| 10 |
+
--bg:#08080c; --panel:#0f0f16; --panel2:#15151f; --panel3:#1b1b27;
|
| 11 |
+
--border:#25253a; --text:#e8e8f4; --muted:#7a7a95;
|
| 12 |
+
--red:#ff2d55; --green:#00e5a0; --blue:#4d9fff;
|
| 13 |
+
--yellow:#ffcc00; --purple:#b06bff; --orange:#ff9f43;
|
| 14 |
+
--mono:'JetBrains Mono','Fira Code','SF Mono',Consolas,monospace;
|
| 15 |
+
}
|
| 16 |
+
*{box-sizing:border-box;margin:0;padding:0}
|
| 17 |
+
html,body{height:100%}
|
| 18 |
+
body{
|
| 19 |
+
background:var(--bg); color:var(--text); overflow:hidden;
|
| 20 |
+
font-family:system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
|
| 21 |
+
display:flex; flex-direction:column;
|
| 22 |
+
}
|
| 23 |
+
#app-ui{display:flex; flex-direction:column; height:100%; width:100%}
|
| 24 |
+
header{
|
| 25 |
+
display:flex; align-items:center; gap:14px;
|
| 26 |
+
padding:10px 16px; background:linear-gradient(180deg,#14141d,#0d0d14);
|
| 27 |
+
border-bottom:1px solid var(--border); flex-shrink:0;
|
| 28 |
+
}
|
| 29 |
+
.logo{display:flex; align-items:center; gap:9px; font-weight:800; font-size:17px; letter-spacing:.5px;}
|
| 30 |
+
.logo .skull{font-size:22px; filter:drop-shadow(0 0 8px var(--red)); animation:pulse 2.4s ease-in-out infinite;}
|
| 31 |
+
@keyframes pulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.65;transform:scale(1.12)}}
|
| 32 |
+
.logo .death{color:var(--red)}
|
| 33 |
+
.logo .comp{color:var(--text)}
|
| 34 |
+
.byline{font-size:11px; color:var(--muted); padding:3px 9px; border:1px solid var(--border); border-radius:20px; background:#0b0b12;}
|
| 35 |
+
.byline b{color:var(--green); font-weight:600}
|
| 36 |
+
.spacer{flex:1}
|
| 37 |
+
.toolbar{display:flex; gap:7px; flex-wrap:wrap}
|
| 38 |
+
button{
|
| 39 |
+
font-family:inherit; font-size:12.5px; font-weight:600;
|
| 40 |
+
padding:7px 13px; border-radius:8px; cursor:pointer;
|
| 41 |
+
border:1px solid var(--border); background:var(--panel2); color:var(--text);
|
| 42 |
+
transition:.15s; display:inline-flex; align-items:center; gap:6px;
|
| 43 |
+
}
|
| 44 |
+
button:hover{background:var(--panel3); border-color:#3a3a55; transform:translateY(-1px)}
|
| 45 |
+
button:active{transform:translateY(0)}
|
| 46 |
+
button.primary{background:linear-gradient(135deg,#ff2d55,#c9184a); border-color:#ff2d55; color:#fff; box-shadow:0 0 18px rgba(255,45,85,.35);}
|
| 47 |
+
button.primary:hover{box-shadow:0 0 26px rgba(255,45,85,.55)}
|
| 48 |
+
button.publish{
|
| 49 |
+
background:linear-gradient(135deg,#00e5a0,#00b37a);
|
| 50 |
+
border-color:#00e5a0; color:#04140e; font-weight:800;
|
| 51 |
+
box-shadow:0 0 18px rgba(0,229,160,.4);
|
| 52 |
+
}
|
| 53 |
+
button.publish:hover{box-shadow:0 0 28px rgba(0,229,160,.7)}
|
| 54 |
+
button.ghost{background:transparent}
|
| 55 |
+
main{flex:1; display:flex; min-height:0; gap:1px; background:var(--border)}
|
| 56 |
+
.pane{display:flex; flex-direction:column; min-width:0; background:var(--panel)}
|
| 57 |
+
.pane.editor-pane{flex:1.05}
|
| 58 |
+
.pane.output-pane{flex:1}
|
| 59 |
+
.tabs{
|
| 60 |
+
display:flex; align-items:center; gap:2px; padding:6px 8px 0;
|
| 61 |
+
background:#0b0b12; border-bottom:1px solid var(--border);
|
| 62 |
+
overflow-x:auto; flex-shrink:0; min-height:38px;
|
| 63 |
+
}
|
| 64 |
+
.tabs::-webkit-scrollbar{height:0}
|
| 65 |
+
.tab{
|
| 66 |
+
display:flex; align-items:center; gap:7px;
|
| 67 |
+
padding:6px 11px; font-size:12px; font-family:var(--mono);
|
| 68 |
+
border-radius:8px 8px 0 0; border:1px solid transparent; border-bottom:none;
|
| 69 |
+
background:transparent; color:var(--muted); cursor:pointer; white-space:nowrap;
|
| 70 |
+
transition:.12s; font-weight:500;
|
| 71 |
+
}
|
| 72 |
+
.tab:hover{color:var(--text); background:#141420}
|
| 73 |
+
.tab.active{background:var(--panel); color:var(--text); border-color:var(--border); border-bottom:1px solid var(--panel); margin-bottom:-1px; padding-bottom:7px;}
|
| 74 |
+
.tab.active::before{content:'';width:6px;height:6px;border-radius:50%;background:var(--red);box-shadow:0 0 8px var(--red)}
|
| 75 |
+
.tab-del{opacity:.4; font-size:14px; line-height:1; padding:0 2px; border-radius:4px;}
|
| 76 |
+
.tab-del:hover{opacity:1; color:var(--red); background:rgba(255,45,85,.15)}
|
| 77 |
+
.tab-add{padding:4px 11px; margin-left:4px; font-size:15px; border-radius:6px; background:transparent; color:var(--muted); border:1px dashed var(--border);}
|
| 78 |
+
.tab-add:hover{color:var(--green); border-color:var(--green)}
|
| 79 |
+
.editor-wrap{position:relative; flex:1; overflow:hidden; background:var(--panel)}
|
| 80 |
+
.editor-wrap textarea,
|
| 81 |
+
.editor-wrap pre{
|
| 82 |
+
position:absolute; inset:0; margin:0; padding:16px 20px;
|
| 83 |
+
font-family:var(--mono); font-size:13.5px; line-height:1.65;
|
| 84 |
+
white-space:pre; overflow:auto; border:0; outline:none; tab-size:2;
|
| 85 |
+
}
|
| 86 |
+
.editor-wrap textarea{background:transparent; color:transparent; caret-color:var(--red); resize:none; z-index:2; font-weight:500;}
|
| 87 |
+
.editor-wrap textarea::selection{background:rgba(255,45,85,.3)}
|
| 88 |
+
.editor-wrap pre{background:var(--panel); color:#c8c8dc; z-index:1; pointer-events:none; font-weight:500;}
|
| 89 |
+
.editor-wrap pre::-webkit-scrollbar,
|
| 90 |
+
.editor-wrap textarea::-webkit-scrollbar{width:10px;height:10px}
|
| 91 |
+
.editor-wrap pre::-webkit-scrollbar-thumb,
|
| 92 |
+
.editor-wrap textarea::-webkit-scrollbar-thumb{background:#2c2c40;border-radius:6px}
|
| 93 |
+
.editor-wrap pre::-webkit-scrollbar-track,
|
| 94 |
+
.editor-wrap textarea::-webkit-scrollbar-track{background:transparent}
|
| 95 |
+
.t-tag{color:var(--red); font-weight:700}
|
| 96 |
+
.t-num{color:var(--purple); font-weight:700}
|
| 97 |
+
.t-var{color:var(--blue); font-weight:600}
|
| 98 |
+
.output-body{flex:1; overflow:auto; padding:16px 18px; font-family:var(--mono); font-size:13px; line-height:1.7; background:var(--panel);}
|
| 99 |
+
.output-body::-webkit-scrollbar{width:10px}
|
| 100 |
+
.output-body::-webkit-scrollbar-thumb{background:#2c2c40;border-radius:6px}
|
| 101 |
+
.line{display:flex; gap:10px; margin-bottom:2px; animation:fadeIn .2s ease}
|
| 102 |
+
@keyframes fadeIn{from{opacity:0;transform:translateY(3px)}to{opacity:1;transform:none}}
|
| 103 |
+
.line .ln{color:#3d3d55; user-select:none; min-width:26px; text-align:right; font-size:11.5px; padding-top:2px}
|
| 104 |
+
.line .txt{white-space:pre-wrap; word-break:break-word; flex:1}
|
| 105 |
+
.line.out .txt{color:var(--green)}
|
| 106 |
+
.line.sys .txt{color:var(--muted)}
|
| 107 |
+
.line.err .txt{color:var(--red)}
|
| 108 |
+
.line.warn .txt{color:var(--yellow)}
|
| 109 |
+
.line.var .txt{color:var(--blue)}
|
| 110 |
+
.line.raw .txt{color:#c8c8dc}
|
| 111 |
+
.hero{color:var(--muted); font-size:12px; margin-bottom:14px; padding-bottom:12px; border-bottom:1px dashed var(--border);}
|
| 112 |
+
.hero b{color:var(--red)}
|
| 113 |
+
.hero .v{color:var(--green)}
|
| 114 |
+
.render{margin:14px 0; border:1px solid var(--border); border-radius:10px; overflow:hidden; background:#0b0b12; box-shadow:0 4px 20px rgba(0,0,0,.5); animation:fadeIn .25s ease;}
|
| 115 |
+
.render-head{display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding:8px 12px; background:linear-gradient(180deg,#16161f,#101018); border-bottom:1px solid var(--border); font-size:11px;}
|
| 116 |
+
.pill{background:var(--green); color:#04140e; font-weight:800; padding:2px 8px; border-radius:20px; font-size:9.5px; letter-spacing:.8px;}
|
| 117 |
+
.pill.html{background:var(--purple); color:#fff;}
|
| 118 |
+
.render-head .fname{color:var(--text); font-weight:700}
|
| 119 |
+
.render-head .url{color:var(--muted); font-size:10.5px; margin-left:auto; background:#08080c; padding:3px 8px; border-radius:5px; border:1px solid var(--border); max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
|
| 120 |
+
.render iframe{width:100%; height:340px; border:0; display:block; background:#fff;}
|
| 121 |
+
.modal{position:fixed; inset:0; background:rgba(0,0,0,.8); backdrop-filter:blur(4px); display:none; align-items:center; justify-content:center; z-index:100; padding:20px;}
|
| 122 |
+
.modal.show{display:flex}
|
| 123 |
+
.modal-box{background:var(--panel); border:1px solid var(--border); border-radius:14px; max-width:820px; width:100%; max-height:85vh; overflow:auto; padding:26px 30px; box-shadow:0 20px 60px rgba(0,0,0,.7);}
|
| 124 |
+
.modal-box h2{font-size:20px; margin-bottom:4px; color:var(--red); display:flex; align-items:center; gap:10px;}
|
| 125 |
+
.modal-box h3{font-size:13px; margin:20px 0 8px; color:var(--green); text-transform:uppercase; letter-spacing:1px;}
|
| 126 |
+
.modal-box p, .modal-box li{font-size:13.5px; line-height:1.75; color:#b8b8cc}
|
| 127 |
+
.modal-box ul{padding-left:20px; margin:6px 0}
|
| 128 |
+
.modal-box code{font-family:var(--mono); font-size:12.5px; background:#08080c; padding:2px 7px; border-radius:5px; color:var(--yellow); border:1px solid var(--border);}
|
| 129 |
+
.modal-box pre{font-family:var(--mono); font-size:12.5px; background:#08080c; padding:14px 16px; border-radius:10px; border:1px solid var(--border); overflow-x:auto; color:#c8c8dc; line-height:1.7; margin:8px 0;}
|
| 130 |
+
.close-btn{position:sticky;top:0;float:right}
|
| 131 |
+
.new{background:var(--purple);color:#fff;padding:1px 7px;border-radius:20px;font-size:9.5px;letter-spacing:.6px;vertical-align:middle;margin-left:6px}
|
| 132 |
+
|
| 133 |
+
/* publish modal styles */
|
| 134 |
+
.pub-hero{
|
| 135 |
+
display:flex; align-items:center; gap:12px; margin-bottom:6px;
|
| 136 |
+
}
|
| 137 |
+
.pub-hero .icon{
|
| 138 |
+
font-size:38px; filter:drop-shadow(0 0 14px var(--green));
|
| 139 |
+
}
|
| 140 |
+
.pub-hero h2{color:var(--green); margin:0;}
|
| 141 |
+
.pub-sub{color:var(--muted); font-size:12.5px; margin:6px 0 18px;}
|
| 142 |
+
.pub-url-row{
|
| 143 |
+
display:flex; gap:8px; margin:14px 0 6px;
|
| 144 |
+
}
|
| 145 |
+
.pub-url-row input{
|
| 146 |
+
flex:1; font-family:var(--mono); font-size:12px;
|
| 147 |
+
padding:11px 13px; border-radius:9px;
|
| 148 |
+
background:#08080c; color:var(--green);
|
| 149 |
+
border:1px solid var(--border); outline:none;
|
| 150 |
+
overflow:hidden; text-overflow:ellipsis;
|
| 151 |
+
}
|
| 152 |
+
.pub-url-row input:focus{border-color:var(--green); box-shadow:0 0 0 2px rgba(0,229,160,.2)}
|
| 153 |
+
.pub-url-row button{
|
| 154 |
+
white-space:nowrap; padding:11px 16px;
|
| 155 |
+
}
|
| 156 |
+
.pub-meta{
|
| 157 |
+
display:flex; gap:14px; flex-wrap:wrap; margin-top:14px;
|
| 158 |
+
font-size:11.5px; color:var(--muted);
|
| 159 |
+
}
|
| 160 |
+
.pub-meta b{color:var(--text)}
|
| 161 |
+
.pub-meta .k{color:var(--yellow)}
|
| 162 |
+
.pub-warn{
|
| 163 |
+
margin-top:14px; padding:10px 14px; border-radius:9px;
|
| 164 |
+
background:rgba(255,204,0,.08); border:1px solid rgba(255,204,0,.3);
|
| 165 |
+
color:var(--yellow); font-size:12px; line-height:1.6;
|
| 166 |
+
}
|
| 167 |
+
.pub-actions{display:flex; gap:8px; margin-top:20px; flex-wrap:wrap;}
|
| 168 |
+
.pub-actions button{padding:10px 18px; font-size:13px;}
|
| 169 |
+
|
| 170 |
+
/* published (viewer) mode */
|
| 171 |
+
#published-wrap{
|
| 172 |
+
display:none; position:fixed; inset:0; z-index:100000; background:#000;
|
| 173 |
+
}
|
| 174 |
+
#published-frame{
|
| 175 |
+
width:100%; height:100%; border:0; display:block; background:#fff;
|
| 176 |
+
}
|
| 177 |
+
</style>
|
| 178 |
+
</head>
|
| 179 |
+
<body>
|
| 180 |
+
|
| 181 |
+
<div id="app-ui">
|
| 182 |
+
<header>
|
| 183 |
+
<div class="logo">
|
| 184 |
+
<span class="skull">β </span>
|
| 185 |
+
<span><span class="death">Death</span> <span class="comp">Compiler</span></span>
|
| 186 |
+
</div>
|
| 187 |
+
<div class="byline">by <b>Muhammad Taqi</b> Β· v3.0.0</div>
|
| 188 |
+
<div class="spacer"></div>
|
| 189 |
+
<div class="toolbar">
|
| 190 |
+
<button class="primary" id="runBtn">βΆ Run</button>
|
| 191 |
+
<button class="publish" id="publishBtn">π Publish</button>
|
| 192 |
+
<button id="exampleBtn">π Example</button>
|
| 193 |
+
<button id="openBtn">π Open</button>
|
| 194 |
+
<button id="saveMtBtn">πΎ .mt</button>
|
| 195 |
+
<button id="saveDBtn">πΎ .d</button>
|
| 196 |
+
<button id="clearBtn" class="ghost">β Clear</button>
|
| 197 |
+
<button id="helpBtn" class="ghost">? Help</button>
|
| 198 |
+
</div>
|
| 199 |
+
<input type="file" id="fileInput" accept=".mt,.d,.txt" hidden>
|
| 200 |
+
</header>
|
| 201 |
+
|
| 202 |
+
<main>
|
| 203 |
+
<section class="pane editor-pane">
|
| 204 |
+
<div class="tabs" id="fileTabs"></div>
|
| 205 |
+
<div class="editor-wrap">
|
| 206 |
+
<pre id="highlight" aria-hidden="true"></pre>
|
| 207 |
+
<textarea id="editor" spellcheck="false" autocapitalize="off" autocomplete="off"></textarea>
|
| 208 |
+
</div>
|
| 209 |
+
</section>
|
| 210 |
+
|
| 211 |
+
<section class="pane output-pane">
|
| 212 |
+
<div class="tabs">
|
| 213 |
+
<div class="tab active" style="cursor:default">
|
| 214 |
+
<span style="color:var(--green)">β</span> Output Console
|
| 215 |
+
</div>
|
| 216 |
+
<div class="spacer" style="flex:1"></div>
|
| 217 |
+
<div class="tab" id="clearOut" style="cursor:pointer">clear</div>
|
| 218 |
+
</div>
|
| 219 |
+
<div class="output-body" id="output"></div>
|
| 220 |
+
</section>
|
| 221 |
+
</main>
|
| 222 |
+
</div>
|
| 223 |
+
|
| 224 |
+
<!-- HELP MODAL -->
|
| 225 |
+
<div class="modal" id="helpModal">
|
| 226 |
+
<div class="modal-box">
|
| 227 |
+
<button class="close-btn ghost" onclick="document.getElementById('helpModal').classList.remove('show')">β Close</button>
|
| 228 |
+
<h2>β Death Compiler v3 β Language Reference</h2>
|
| 229 |
+
<p style="color:var(--muted);font-size:12.5px">Created by <b style="color:var(--green)">Muhammad Taqi</b> Β· File extensions: <code>.mt</code> <code>.d</code></p>
|
| 230 |
+
|
| 231 |
+
<h3>1 Β· Letter Codes</h3>
|
| 232 |
+
<p>Har letter ek <code>!*n</code> code hai. <code>!</code> akela = A.</p>
|
| 233 |
+
<pre>A = ! B = !*2 C = !*3 D = !*4 E = !*5
|
| 234 |
+
F = !*6 G = !*7 H = !*8 I = !*9 J = !*10
|
| 235 |
+
K = !*11 L = !*12 M = !*13 N = !*14 O = !*15
|
| 236 |
+
P = !*16 Q = !*17 R = !*18 S = !*19 T = !*20
|
| 237 |
+
U = !*21 V = !*22 W = !*23 X = !*24 Y = !*25
|
| 238 |
+
Z = !*26</pre>
|
| 239 |
+
|
| 240 |
+
<h3>2 Β· Blocks</h3>
|
| 241 |
+
<p>Code <code><mt></code> ... <code><mt></code> ke darmiyan likha jata hai.</p>
|
| 242 |
+
<p>Section tags: <code><d></code> <code><D></code> <code><death></code> <code><Death></code> <code><DEATH></code></p>
|
| 243 |
+
|
| 244 |
+
<h3>3 Β· Attributes</h3>
|
| 245 |
+
<p>Ek block ko comma-separated quoted attributes mil sakte hain (multi-line bhi):</p>
|
| 246 |
+
<pre><mt"nh=hello world","np=print as index.html">
|
| 247 |
+
[(nh)]
|
| 248 |
+
{np}
|
| 249 |
+
<mt></pre>
|
| 250 |
+
|
| 251 |
+
<h3>4 Β· Print (text output)</h3>
|
| 252 |
+
<pre>[(nh)(!*8)(!*5)(!*12)(!*12)(!*15)()(!*23)(!*15)(!*18)(!*12)(!*4)]
|
| 253 |
+
β hello world HELLO WORLD</pre>
|
| 254 |
+
|
| 255 |
+
<h3>5 Β· Preview (HTML render)</h3>
|
| 256 |
+
<p><code>{ ... }</code> β HTML content ya file directive ko live preview (random blob URL) me render karta hai.</p>
|
| 257 |
+
|
| 258 |
+
<h3>6 Β· Publish <span class="new">NEW</span></h3>
|
| 259 |
+
<p><b>π Publish</b> button dabayein. Aapko ek live URL milega (base64 encoded in <code>#url=</code> hash).
|
| 260 |
+
Us URL ko kholne par sirf aapki bani hui web full screen show hogi β compiler UI nahi.</p>
|
| 261 |
+
<p>Priority: <code>index.html</code> β last rendered inline HTML β active file.</p>
|
| 262 |
+
|
| 263 |
+
<h3>7 Β· Shortcuts</h3>
|
| 264 |
+
<ul>
|
| 265 |
+
<li><code>Ctrl + Enter</code> β Run</li>
|
| 266 |
+
<li>File tabs ke <code>+</code> se nayi file banao</li>
|
| 267 |
+
</ul>
|
| 268 |
+
</div>
|
| 269 |
+
</div>
|
| 270 |
+
|
| 271 |
+
<!-- PUBLISH MODAL -->
|
| 272 |
+
<div class="modal" id="publishModal">
|
| 273 |
+
<div class="modal-box">
|
| 274 |
+
<button class="close-btn ghost" onclick="document.getElementById('publishModal').classList.remove('show')">β Close</button>
|
| 275 |
+
<div class="pub-hero">
|
| 276 |
+
<div class="icon">π</div>
|
| 277 |
+
<div>
|
| 278 |
+
<h2>Your site is live!</h2>
|
| 279 |
+
<div class="pub-sub">Share this URL β it opens only your webpage, full screen.</div>
|
| 280 |
+
</div>
|
| 281 |
+
</div>
|
| 282 |
+
|
| 283 |
+
<div class="pub-url-row">
|
| 284 |
+
<input id="pubUrl" readonly spellcheck="false">
|
| 285 |
+
<button id="copyUrlBtn" class="publish">π Copy</button>
|
| 286 |
+
</div>
|
| 287 |
+
|
| 288 |
+
<div class="pub-meta">
|
| 289 |
+
<span>Source: <b id="pubSource">β</b></span>
|
| 290 |
+
<span>Size: <b id="pubSize">β</b></span>
|
| 291 |
+
<span>URL length: <b id="pubUrlLen">β</b></span>
|
| 292 |
+
</div>
|
| 293 |
+
|
| 294 |
+
<div id="pubWarn" class="pub-warn" style="display:none">
|
| 295 |
+
β οΈ URL bahut lamba hai. Kuch purane browsers me kaam nahi kar sakta.
|
| 296 |
+
Agar issue ho, choti HTML file publish karein.
|
| 297 |
+
</div>
|
| 298 |
+
|
| 299 |
+
<div class="pub-actions">
|
| 300 |
+
<button id="openPublishedBtn" class="primary">π Open in new tab</button>
|
| 301 |
+
<button id="closePublishBtn" class="ghost">Close</button>
|
| 302 |
+
</div>
|
| 303 |
+
</div>
|
| 304 |
+
</div>
|
| 305 |
+
|
| 306 |
+
<!-- PUBLISHED (VIEWER) FULL-SCREEN WRAP -->
|
| 307 |
+
<div id="published-wrap">
|
| 308 |
+
<iframe id="published-frame" title="Published site"></iframe>
|
| 309 |
+
</div>
|
| 310 |
+
|
| 311 |
+
<script>
|
| 312 |
+
/* ============================================================
|
| 313 |
+
PUBLISHED-MODE CHECK (runs first, hides compiler if needed)
|
| 314 |
+
============================================================ */
|
| 315 |
+
(function deathPublishedCheck(){
|
| 316 |
+
if (!location.hash.startsWith('#url=')) return;
|
| 317 |
+
const encoded = location.hash.slice(5);
|
| 318 |
+
try {
|
| 319 |
+
// URL-safe base64 decode
|
| 320 |
+
let b64 = encoded.replace(/-/g, '+').replace(/_/g, '/');
|
| 321 |
+
while (b64.length % 4) b64 += '=';
|
| 322 |
+
const html = decodeURIComponent(escape(atob(b64)));
|
| 323 |
+
|
| 324 |
+
// Hide compiler UI, show full-screen iframe
|
| 325 |
+
document.getElementById('app-ui').style.display = 'none';
|
| 326 |
+
document.getElementById('published-wrap').style.display = 'block';
|
| 327 |
+
|
| 328 |
+
const frame = document.getElementById('published-frame');
|
| 329 |
+
const blob = new Blob([html], { type: 'text/html;charset=utf-8' });
|
| 330 |
+
frame.src = URL.createObjectURL(blob);
|
| 331 |
+
|
| 332 |
+
document.title = 'β Published Site';
|
| 333 |
+
window.__DEATH_PUBLISHED__ = true;
|
| 334 |
+
} catch (e) {
|
| 335 |
+
document.getElementById('app-ui').innerHTML =
|
| 336 |
+
'<pre style="padding:24px;color:#ff2d55;font-family:monospace;background:#08080c;min-height:100vh;margin:0">' +
|
| 337 |
+
'Invalid published URL:\n' + e.message + '</pre>';
|
| 338 |
+
window.__DEATH_PUBLISHED__ = true;
|
| 339 |
+
}
|
| 340 |
+
})();
|
| 341 |
+
|
| 342 |
+
|
| 343 |
+
/* ============================================================
|
| 344 |
+
DEATH β COMPILER β Core Engine (v3)
|
| 345 |
+
Author : Muhammad Taqi
|
| 346 |
+
============================================================ */
|
| 347 |
+
const DEATH = (() => {
|
| 348 |
+
'use strict';
|
| 349 |
+
|
| 350 |
+
const AUTHOR = 'Muhammad Taqi';
|
| 351 |
+
const VERSION = '3.0.0';
|
| 352 |
+
const LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
| 353 |
+
|
| 354 |
+
const numToLetter = n => (Number.isInteger(n) && n >= 1 && n <= 26) ? LETTERS[n - 1] : '?';
|
| 355 |
+
const isIdent = s => /^[A-Za-z_][A-Za-z0-9_]*$/.test(s);
|
| 356 |
+
const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
|
| 357 |
+
|
| 358 |
+
function isHtmlContent(s) {
|
| 359 |
+
if (typeof s !== 'string') return false;
|
| 360 |
+
const t = s.trim();
|
| 361 |
+
if (!t) return false;
|
| 362 |
+
if (/^<!DOCTYPE\s/i.test(t)) return true;
|
| 363 |
+
if (/^<html[\s>\/]/i.test(t)) return true;
|
| 364 |
+
if (/^<[a-zA-Z][a-zA-Z0-9]*[\s>\/]/.test(t)) return true;
|
| 365 |
+
return false;
|
| 366 |
+
}
|
| 367 |
+
|
| 368 |
+
function isValidCloseAfter(src, closeIdx) {
|
| 369 |
+
let k = closeIdx + 1;
|
| 370 |
+
while (k < src.length && (src[k] === ' ' || src[k] === '\t' || src[k] === '\r')) k++;
|
| 371 |
+
if (src[k] !== '>') return false;
|
| 372 |
+
|
| 373 |
+
let m = k + 1;
|
| 374 |
+
while (m < src.length && (src[m] === ' ' || src[m] === '\t' || src[m] === '\r')) m++;
|
| 375 |
+
|
| 376 |
+
if (m >= src.length) return true;
|
| 377 |
+
|
| 378 |
+
if (src[m] === '\n') {
|
| 379 |
+
let n = m;
|
| 380 |
+
while (n < src.length && /\s/.test(src[n])) n++;
|
| 381 |
+
if (n >= src.length) return true;
|
| 382 |
+
if (src.slice(n, n + 3).toLowerCase() === '<mt') return true;
|
| 383 |
+
if (src[n] === '[' || src[n] === '{') return true;
|
| 384 |
+
let p = n;
|
| 385 |
+
while (p < src.length && /[A-Za-z0-9_]/.test(src[p])) p++;
|
| 386 |
+
if (p > n && src[p] === '=') return true;
|
| 387 |
+
return false;
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
if (src[m] === '[' || src[m] === '{') return true;
|
| 391 |
+
if (src.slice(m, m + 3).toLowerCase() === '<mt') return true;
|
| 392 |
+
return false;
|
| 393 |
+
}
|
| 394 |
+
|
| 395 |
+
function readMtTag(src, start) {
|
| 396 |
+
let i = start;
|
| 397 |
+
while (i < src.length && /\s/.test(src[i])) i++;
|
| 398 |
+
|
| 399 |
+
if (src[i] !== '"') {
|
| 400 |
+
let j = i;
|
| 401 |
+
while (j < src.length && src[j] !== '>') j++;
|
| 402 |
+
return { attrs: null, contentStart: j + 1 };
|
| 403 |
+
}
|
| 404 |
+
|
| 405 |
+
const attrParts = [];
|
| 406 |
+
let pos = i;
|
| 407 |
+
|
| 408 |
+
while (pos < src.length && src[pos] === '"') {
|
| 409 |
+
pos++;
|
| 410 |
+
const valStart = pos;
|
| 411 |
+
let valEnd = -1;
|
| 412 |
+
|
| 413 |
+
while (pos < src.length) {
|
| 414 |
+
if (src[pos] === '"') {
|
| 415 |
+
let k = pos + 1;
|
| 416 |
+
while (k < src.length && (src[k] === ' ' || src[k] === '\t' || src[k] === '\r')) k++;
|
| 417 |
+
|
| 418 |
+
if (src[k] === '>' && isValidCloseAfter(src, pos)) {
|
| 419 |
+
valEnd = pos;
|
| 420 |
+
pos = k;
|
| 421 |
+
break;
|
| 422 |
+
}
|
| 423 |
+
if (src[k] === ',') {
|
| 424 |
+
let m = k + 1;
|
| 425 |
+
while (m < src.length && /\s/.test(src[m])) m++;
|
| 426 |
+
if (src[m] === '"') {
|
| 427 |
+
valEnd = pos;
|
| 428 |
+
pos = m;
|
| 429 |
+
break;
|
| 430 |
+
}
|
| 431 |
+
}
|
| 432 |
+
}
|
| 433 |
+
pos++;
|
| 434 |
+
}
|
| 435 |
+
|
| 436 |
+
if (valEnd === -1) break;
|
| 437 |
+
attrParts.push(src.slice(valStart, valEnd));
|
| 438 |
+
|
| 439 |
+
if (src[pos] === '>') {
|
| 440 |
+
pos++;
|
| 441 |
+
return { attrs: attrParts, contentStart: pos };
|
| 442 |
+
}
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
while (pos < src.length && src[pos] !== '>') pos++;
|
| 446 |
+
return { attrs: attrParts.length ? attrParts : null, contentStart: pos + 1 };
|
| 447 |
+
}
|
| 448 |
+
|
| 449 |
+
function extractBlocks(src) {
|
| 450 |
+
const positions = [];
|
| 451 |
+
let idx = 0;
|
| 452 |
+
while ((idx = src.indexOf('<mt', idx)) !== -1) {
|
| 453 |
+
positions.push(idx);
|
| 454 |
+
idx += 3;
|
| 455 |
+
}
|
| 456 |
+
|
| 457 |
+
const blocks = [];
|
| 458 |
+
for (let k = 0; k < positions.length; k++) {
|
| 459 |
+
const start = positions[k];
|
| 460 |
+
const { attrs, contentStart } = readMtTag(src, start + 3);
|
| 461 |
+
const end = (k + 1 < positions.length) ? positions[k + 1] : src.length;
|
| 462 |
+
blocks.push({ attrs, code: src.slice(contentStart, end) });
|
| 463 |
+
}
|
| 464 |
+
return blocks;
|
| 465 |
+
}
|
| 466 |
+
|
| 467 |
+
function applyAttrs(attrsArr, vars) {
|
| 468 |
+
if (!attrsArr) return;
|
| 469 |
+
const list = Array.isArray(attrsArr) ? attrsArr : [attrsArr];
|
| 470 |
+
list.forEach(part => {
|
| 471 |
+
const t = String(part).trim();
|
| 472 |
+
if (!t) return;
|
| 473 |
+
const eq = t.indexOf('=');
|
| 474 |
+
if (eq < 1) return;
|
| 475 |
+
const name = t.slice(0, eq).trim();
|
| 476 |
+
const val = t.slice(eq + 1).trim();
|
| 477 |
+
if (isIdent(name)) {
|
| 478 |
+
vars[name] = val;
|
| 479 |
+
if (isHtmlContent(val)) vars.__lasthtml__ = val;
|
| 480 |
+
}
|
| 481 |
+
});
|
| 482 |
+
}
|
| 483 |
+
|
| 484 |
+
function parseStatements(code) {
|
| 485 |
+
const stmts = [];
|
| 486 |
+
let i = 0, line = 1, buf = '', bufLine = 1;
|
| 487 |
+
|
| 488 |
+
function flush() {
|
| 489 |
+
if (!buf.trim()) { buf = ''; return; }
|
| 490 |
+
const parts = buf.split('\n');
|
| 491 |
+
for (let k = 0; k < parts.length; k++) {
|
| 492 |
+
const t = parts[k].trim();
|
| 493 |
+
if (!t) continue;
|
| 494 |
+
if (t.startsWith('#') || t.startsWith('//')) continue;
|
| 495 |
+
const eq = t.indexOf('=');
|
| 496 |
+
if (eq > 0) {
|
| 497 |
+
const name = t.slice(0, eq).trim();
|
| 498 |
+
const val = t.slice(eq + 1).trim();
|
| 499 |
+
if (isIdent(name)) {
|
| 500 |
+
stmts.push({ type: 'assign', name, value: val, line: bufLine + k });
|
| 501 |
+
}
|
| 502 |
+
}
|
| 503 |
+
}
|
| 504 |
+
buf = '';
|
| 505 |
+
}
|
| 506 |
+
|
| 507 |
+
while (i < code.length) {
|
| 508 |
+
const c = code[i];
|
| 509 |
+
|
| 510 |
+
if (c === '[') {
|
| 511 |
+
flush();
|
| 512 |
+
const stmtLine = line;
|
| 513 |
+
let depth = 1, j = i + 1, inner = '';
|
| 514 |
+
while (j < code.length) {
|
| 515 |
+
const d = code[j];
|
| 516 |
+
if (d === '\n') line++;
|
| 517 |
+
if (d === '[') { depth++; inner += d; j++; continue; }
|
| 518 |
+
if (d === ']') {
|
| 519 |
+
depth--;
|
| 520 |
+
if (depth === 0) { j++; break; }
|
| 521 |
+
inner += d; j++; continue;
|
| 522 |
+
}
|
| 523 |
+
inner += d; j++;
|
| 524 |
+
}
|
| 525 |
+
stmts.push({ type: 'print', inner, line: stmtLine });
|
| 526 |
+
i = j;
|
| 527 |
+
bufLine = line;
|
| 528 |
+
continue;
|
| 529 |
+
}
|
| 530 |
+
|
| 531 |
+
if (c === '{') {
|
| 532 |
+
flush();
|
| 533 |
+
const stmtLine = line;
|
| 534 |
+
let depth = 1, j = i + 1, inner = '';
|
| 535 |
+
while (j < code.length) {
|
| 536 |
+
const d = code[j];
|
| 537 |
+
if (d === '\n') line++;
|
| 538 |
+
if (d === '{') { depth++; inner += d; j++; continue; }
|
| 539 |
+
if (d === '}') {
|
| 540 |
+
depth--;
|
| 541 |
+
if (depth === 0) { j++; break; }
|
| 542 |
+
inner += d; j++; continue;
|
| 543 |
+
}
|
| 544 |
+
inner += d; j++;
|
| 545 |
+
}
|
| 546 |
+
stmts.push({ type: 'preview', inner, line: stmtLine });
|
| 547 |
+
i = j;
|
| 548 |
+
bufLine = line;
|
| 549 |
+
continue;
|
| 550 |
+
}
|
| 551 |
+
|
| 552 |
+
if (c === '\n') { line++; if (!buf.trim()) bufLine = line; }
|
| 553 |
+
buf += c;
|
| 554 |
+
i++;
|
| 555 |
+
}
|
| 556 |
+
flush();
|
| 557 |
+
return stmts;
|
| 558 |
+
}
|
| 559 |
+
|
| 560 |
+
function splitGroups(inner) {
|
| 561 |
+
const groups = [];
|
| 562 |
+
let i = 0, textBuf = '';
|
| 563 |
+
|
| 564 |
+
while (i < inner.length) {
|
| 565 |
+
const c = inner[i];
|
| 566 |
+
|
| 567 |
+
if (c === '(' || c === '{') {
|
| 568 |
+
const open = c;
|
| 569 |
+
const close = c === '(' ? ')' : '}';
|
| 570 |
+
const type = c === '(' ? 'text' : 'preview';
|
| 571 |
+
|
| 572 |
+
let depth = 1, j = i + 1, buf = '';
|
| 573 |
+
while (j < inner.length && depth > 0) {
|
| 574 |
+
const d = inner[j];
|
| 575 |
+
if (d === open) depth++;
|
| 576 |
+
else if (d === close) { depth--; if (depth === 0) break; }
|
| 577 |
+
if (depth > 0) buf += d;
|
| 578 |
+
j++;
|
| 579 |
+
}
|
| 580 |
+
|
| 581 |
+
if (textBuf) { groups.push({ type: 'text', content: textBuf }); textBuf = ''; }
|
| 582 |
+
groups.push({ type, content: buf });
|
| 583 |
+
i = j + 1;
|
| 584 |
+
} else {
|
| 585 |
+
textBuf += c;
|
| 586 |
+
i++;
|
| 587 |
+
}
|
| 588 |
+
}
|
| 589 |
+
if (textBuf.trim()) groups.push({ type: 'text', content: textBuf });
|
| 590 |
+
return groups;
|
| 591 |
+
}
|
| 592 |
+
|
| 593 |
+
function evalGroup(text, vars) {
|
| 594 |
+
if (text === '') return ' ';
|
| 595 |
+
|
| 596 |
+
if (/^\s*<!DOCTYPE/i.test(text) || /^\s*<[a-zA-Z!\/]/.test(text)) {
|
| 597 |
+
return text.replace(/[A-Za-z_][A-Za-z0-9_]*/g, m => has(vars, m) ? String(vars[m]) : m);
|
| 598 |
+
}
|
| 599 |
+
|
| 600 |
+
let out = '';
|
| 601 |
+
let i = 0;
|
| 602 |
+
|
| 603 |
+
while (i < text.length) {
|
| 604 |
+
const c = text[i];
|
| 605 |
+
|
| 606 |
+
if (c === '!') {
|
| 607 |
+
let j = i + 1;
|
| 608 |
+
if (text[j] === '*') {
|
| 609 |
+
j++;
|
| 610 |
+
let num = '';
|
| 611 |
+
while (j < text.length && text[j] >= '0' && text[j] <= '9') { num += text[j]; j++; }
|
| 612 |
+
if (num) { out += numToLetter(parseInt(num, 10)); i = j; continue; }
|
| 613 |
+
out += '!*'; i = j; continue;
|
| 614 |
+
}
|
| 615 |
+
out += numToLetter(1);
|
| 616 |
+
i++;
|
| 617 |
+
continue;
|
| 618 |
+
}
|
| 619 |
+
|
| 620 |
+
if (/[A-Za-z_]/.test(c)) {
|
| 621 |
+
let j = i, id = '';
|
| 622 |
+
while (j < text.length && /[A-Za-z0-9_]/.test(text[j])) { id += text[j]; j++; }
|
| 623 |
+
out += has(vars, id) ? String(vars[id]) : id;
|
| 624 |
+
i = j;
|
| 625 |
+
continue;
|
| 626 |
+
}
|
| 627 |
+
|
| 628 |
+
out += c;
|
| 629 |
+
i++;
|
| 630 |
+
}
|
| 631 |
+
return out;
|
| 632 |
+
}
|
| 633 |
+
|
| 634 |
+
const DIR_PAREN = /^\s*print\s*\(\s*([^)]+?)\s*\)\s*$/i;
|
| 635 |
+
const DIR_AS = /^\s*print\s+as\s+(\S+)\s*$/i;
|
| 636 |
+
|
| 637 |
+
function parseDirective(val) {
|
| 638 |
+
const v = String(val).trim();
|
| 639 |
+
let m = DIR_PAREN.exec(v);
|
| 640 |
+
if (m) return { kind: 'file', file: m[1] };
|
| 641 |
+
m = DIR_AS.exec(v);
|
| 642 |
+
if (m) {
|
| 643 |
+
const f = m[1];
|
| 644 |
+
if (/^html$/i.test(f)) return { kind: 'lasthtml' };
|
| 645 |
+
return { kind: 'file', file: f };
|
| 646 |
+
}
|
| 647 |
+
return null;
|
| 648 |
+
}
|
| 649 |
+
|
| 650 |
+
function compile(source, files) {
|
| 651 |
+
const t0 = performance.now();
|
| 652 |
+
const out = [];
|
| 653 |
+
const vars = Object.create(null);
|
| 654 |
+
const renders = [];
|
| 655 |
+
|
| 656 |
+
const blocks = extractBlocks(source);
|
| 657 |
+
out.push({ type: 'sys', text: `β Death Compiler v${VERSION} β by ${AUTHOR}` });
|
| 658 |
+
out.push({ type: 'sys', text: ` ${blocks.length} block(s) detected Β· target .mt/.d` });
|
| 659 |
+
|
| 660 |
+
blocks.forEach(block => {
|
| 661 |
+
applyAttrs(block.attrs, vars);
|
| 662 |
+
const stmts = parseStatements(block.code);
|
| 663 |
+
|
| 664 |
+
stmts.forEach(st => {
|
| 665 |
+
if (st.type === 'assign') {
|
| 666 |
+
vars[st.name] = st.value;
|
| 667 |
+
if (isHtmlContent(st.value)) vars.__lasthtml__ = st.value;
|
| 668 |
+
out.push({ type: 'var', text: ` $ ${st.name} = ${st.value}`, line: st.line });
|
| 669 |
+
return;
|
| 670 |
+
}
|
| 671 |
+
|
| 672 |
+
let groups;
|
| 673 |
+
if (st.type === 'preview') {
|
| 674 |
+
groups = [{ type: 'preview', content: st.inner }];
|
| 675 |
+
} else {
|
| 676 |
+
groups = splitGroups(st.inner);
|
| 677 |
+
}
|
| 678 |
+
|
| 679 |
+
let textBuffer = '';
|
| 680 |
+
const flushText = () => {
|
| 681 |
+
if (textBuffer) {
|
| 682 |
+
if (isHtmlContent(textBuffer)) {
|
| 683 |
+
out.push({ type: 'renderHtml', html: textBuffer, line: st.line });
|
| 684 |
+
} else {
|
| 685 |
+
out.push({ type: 'out', text: textBuffer, line: st.line });
|
| 686 |
+
}
|
| 687 |
+
textBuffer = '';
|
| 688 |
+
}
|
| 689 |
+
};
|
| 690 |
+
|
| 691 |
+
groups.forEach(g => {
|
| 692 |
+
const raw = evalGroup(g.content, vars);
|
| 693 |
+
const directive = parseDirective(raw);
|
| 694 |
+
|
| 695 |
+
if (directive) {
|
| 696 |
+
flushText();
|
| 697 |
+
if (directive.kind === 'lasthtml') {
|
| 698 |
+
if (has(vars, '__lasthtml__')) {
|
| 699 |
+
out.push({ type: 'renderHtml', html: vars.__lasthtml__, line: st.line });
|
| 700 |
+
} else {
|
| 701 |
+
out.push({ type: 'err', text: ` β no HTML content available`, line: st.line });
|
| 702 |
+
}
|
| 703 |
+
} else {
|
| 704 |
+
const fname = directive.file;
|
| 705 |
+
if (files && has(files, fname)) {
|
| 706 |
+
renders.push(fname);
|
| 707 |
+
out.push({ type: 'render', file: fname, line: st.line });
|
| 708 |
+
} else {
|
| 709 |
+
out.push({ type: 'err', text: ` β file not found: "${fname}"`, line: st.line });
|
| 710 |
+
}
|
| 711 |
+
}
|
| 712 |
+
return;
|
| 713 |
+
}
|
| 714 |
+
|
| 715 |
+
if (isHtmlContent(raw)) {
|
| 716 |
+
flushText();
|
| 717 |
+
out.push({ type: 'renderHtml', html: raw, line: st.line });
|
| 718 |
+
return;
|
| 719 |
+
}
|
| 720 |
+
|
| 721 |
+
if (g.type === 'preview') {
|
| 722 |
+
flushText();
|
| 723 |
+
out.push({ type: 'out', text: raw, line: st.line });
|
| 724 |
+
} else {
|
| 725 |
+
textBuffer += raw;
|
| 726 |
+
}
|
| 727 |
+
});
|
| 728 |
+
|
| 729 |
+
flushText();
|
| 730 |
+
});
|
| 731 |
+
});
|
| 732 |
+
|
| 733 |
+
const ms = (performance.now() - t0).toFixed(2);
|
| 734 |
+
out.push({ type: 'sys', text: `β finished in ${ms} ms` });
|
| 735 |
+
|
| 736 |
+
return { output: out, vars, renders, blocks: blocks.length, ms };
|
| 737 |
+
}
|
| 738 |
+
|
| 739 |
+
return {
|
| 740 |
+
compile, extractBlocks, parseStatements, splitGroups,
|
| 741 |
+
evalGroup, numToLetter, isHtmlContent, parseDirective,
|
| 742 |
+
AUTHOR, VERSION
|
| 743 |
+
};
|
| 744 |
+
})();
|
| 745 |
+
|
| 746 |
+
|
| 747 |
+
/* ============================================================
|
| 748 |
+
IDE β UI LAYER
|
| 749 |
+
============================================================ */
|
| 750 |
+
|
| 751 |
+
/* ---------- URL-SAFE BASE64 ---------- */
|
| 752 |
+
function b64encode(str) {
|
| 753 |
+
// UTF-8 safe
|
| 754 |
+
return btoa(unescape(encodeURIComponent(str)))
|
| 755 |
+
.replace(/\+/g, '-')
|
| 756 |
+
.replace(/\//g, '_')
|
| 757 |
+
.replace(/=+$/, '');
|
| 758 |
+
}
|
| 759 |
+
function b64decode(str) {
|
| 760 |
+
let s = str.replace(/-/g, '+').replace(/_/g, '/');
|
| 761 |
+
while (s.length % 4) s += '=';
|
| 762 |
+
return decodeURIComponent(escape(atob(s)));
|
| 763 |
+
}
|
| 764 |
+
|
| 765 |
+
const DEFAULT_MT = `<d>
|
| 766 |
+
<mt>
|
| 767 |
+
Like print hello world
|
| 768 |
+
<d>
|
| 769 |
+
|
| 770 |
+
<mt"nh=hello world","np=print as index.html">
|
| 771 |
+
[(nh)]
|
| 772 |
+
{np}
|
| 773 |
+
<mt>
|
| 774 |
+
|
| 775 |
+
<d>
|
| 776 |
+
<mt"np=<!DOCTYPE html>
|
| 777 |
<html>
|
| 778 |
+
<head>
|
| 779 |
+
<title>Inline HTML</title>
|
| 780 |
+
<style>
|
| 781 |
+
body{font-family:system-ui,sans-serif;background:#0f0f16;color:#e8e8f4;margin:0;padding:24px}
|
| 782 |
+
h1{color:#00e5a0;margin:0 0 8px}
|
| 783 |
+
p{color:#8a8aa0;margin:0}
|
| 784 |
+
.tag{display:inline-block;margin-top:14px;padding:4px 12px;border-radius:20px;
|
| 785 |
+
background:#ff2d55;color:#fff;font-size:11px;font-weight:700;letter-spacing:1px}
|
| 786 |
+
</style>
|
| 787 |
+
</head>
|
| 788 |
+
<body>
|
| 789 |
+
<h1>Hello from inline HTML β </h1>
|
| 790 |
+
<p>Rendered by Death Compiler through a random blob URL.</p>
|
| 791 |
+
<div class="tag">LIVE PREVIEW</div>
|
| 792 |
+
</body>
|
| 793 |
+
</html>">
|
| 794 |
+
{np}
|
| 795 |
+
<mt>
|
| 796 |
+
`;
|
| 797 |
+
|
| 798 |
+
const DEFAULT_HTML = `<!DOCTYPE html>
|
| 799 |
+
<html>
|
| 800 |
+
<head>
|
| 801 |
+
<meta charset="utf-8">
|
| 802 |
+
<title>My Site β Death β Compiler</title>
|
| 803 |
+
<style>
|
| 804 |
+
*{box-sizing:border-box}
|
| 805 |
+
body{
|
| 806 |
+
margin:0;min-height:100vh;display:flex;align-items:center;justify-content:center;
|
| 807 |
+
font-family:system-ui,-apple-system,sans-serif;
|
| 808 |
+
background:radial-gradient(circle at 30% 20%,#1b1b3a,#08080c 70%);
|
| 809 |
+
color:#e8e8f4;
|
| 810 |
+
}
|
| 811 |
+
.card{
|
| 812 |
+
text-align:center;padding:42px 58px;border-radius:22px;
|
| 813 |
+
background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.12);
|
| 814 |
+
backdrop-filter:blur(10px);
|
| 815 |
+
box-shadow:0 20px 60px rgba(0,0,0,.6);
|
| 816 |
+
max-width:520px;
|
| 817 |
+
}
|
| 818 |
+
h1{margin:0 0 10px;font-size:36px;letter-spacing:1px}
|
| 819 |
+
h1 span{color:#ff2d55}
|
| 820 |
+
p{margin:0 0 6px;color:#9a9ab0;font-size:14px;letter-spacing:.4px;line-height:1.6}
|
| 821 |
+
.b{display:inline-block;margin-top:20px;padding:8px 20px;border-radius:30px;
|
| 822 |
+
background:#00e5a0;color:#04140e;font-weight:800;font-size:11px;letter-spacing:1.4px}
|
| 823 |
+
.by{margin-top:20px;font-size:11px;color:#5a5a75;letter-spacing:1px}
|
| 824 |
+
</style>
|
| 825 |
+
</head>
|
| 826 |
+
<body>
|
| 827 |
+
<div class="card">
|
| 828 |
+
<h1>Death <span>β </span> Compiler</h1>
|
| 829 |
+
<p>Ye aapki published website hai.</p>
|
| 830 |
+
<p>URL share karein β yeh page full screen khulega.</p>
|
| 831 |
+
<div class="b">π PUBLISHED</div>
|
| 832 |
+
<div class="by">made with Death Compiler Β· by Muhammad Taqi</div>
|
| 833 |
+
</div>
|
| 834 |
+
</body>
|
| 835 |
+
</html>`;
|
| 836 |
+
|
| 837 |
+
const FILES = Object.create(null);
|
| 838 |
+
FILES['main.mt'] = DEFAULT_MT;
|
| 839 |
+
FILES['index.html'] = DEFAULT_HTML;
|
| 840 |
+
|
| 841 |
+
let activeFile = 'main.mt';
|
| 842 |
+
let liveUrls = [];
|
| 843 |
+
|
| 844 |
+
/* ---------- DOM refs ---------- */
|
| 845 |
+
const $editor = document.getElementById('editor');
|
| 846 |
+
const $hl = document.getElementById('highlight');
|
| 847 |
+
const $tabs = document.getElementById('fileTabs');
|
| 848 |
+
const $output = document.getElementById('output');
|
| 849 |
+
|
| 850 |
+
/* ---------- highlight ---------- */
|
| 851 |
+
function esc(s) {
|
| 852 |
+
return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
| 853 |
+
}
|
| 854 |
+
const HL_RE = /(<\/?(?:mt|d|death)(?:\s*"[^"]*")?\s*>)|(!\*\d+)|(\b[A-Za-z_][A-Za-z0-9_]*(?=\s*=))/gi;
|
| 855 |
+
|
| 856 |
+
function highlight(code) {
|
| 857 |
+
return esc(code).replace(HL_RE, (m, tag, num, vr) => {
|
| 858 |
+
if (tag) return `<span class="t-tag">${tag}</span>`;
|
| 859 |
+
if (num) return `<span class="t-num">${num}</span>`;
|
| 860 |
+
if (vr) return `<span class="t-var">${vr}</span>`;
|
| 861 |
+
return m;
|
| 862 |
+
}) + '\n';
|
| 863 |
+
}
|
| 864 |
+
function refreshHighlight() { $hl.innerHTML = highlight($editor.value); }
|
| 865 |
+
|
| 866 |
+
$editor.addEventListener('input', refreshHighlight);
|
| 867 |
+
$editor.addEventListener('scroll', () => {
|
| 868 |
+
$hl.scrollTop = $editor.scrollTop;
|
| 869 |
+
$hl.scrollLeft = $editor.scrollLeft;
|
| 870 |
+
});
|
| 871 |
+
$editor.addEventListener('keydown', e => {
|
| 872 |
+
if (e.key === 'Tab') {
|
| 873 |
+
e.preventDefault();
|
| 874 |
+
const s = $editor.selectionStart, en = $editor.selectionEnd;
|
| 875 |
+
$editor.value = $editor.value.slice(0, s) + ' ' + $editor.value.slice(en);
|
| 876 |
+
$editor.selectionStart = $editor.selectionEnd = s + 2;
|
| 877 |
+
refreshHighlight();
|
| 878 |
+
}
|
| 879 |
+
if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) { e.preventDefault(); run(); }
|
| 880 |
+
});
|
| 881 |
+
|
| 882 |
+
/* ---------- tabs ---------- */
|
| 883 |
+
function saveCurrent() { FILES[activeFile] = $editor.value; }
|
| 884 |
+
|
| 885 |
+
function renderTabs() {
|
| 886 |
+
$tabs.innerHTML = '';
|
| 887 |
+
Object.keys(FILES).forEach(name => {
|
| 888 |
+
const tab = document.createElement('div');
|
| 889 |
+
tab.className = 'tab' + (name === activeFile ? ' active' : '');
|
| 890 |
+
|
| 891 |
+
const label = document.createElement('span');
|
| 892 |
+
label.textContent = name;
|
| 893 |
+
tab.appendChild(label);
|
| 894 |
+
|
| 895 |
+
const del = document.createElement('span');
|
| 896 |
+
del.className = 'tab-del';
|
| 897 |
+
del.textContent = 'Γ';
|
| 898 |
+
del.title = 'Delete file';
|
| 899 |
+
del.onclick = ev => {
|
| 900 |
+
ev.stopPropagation();
|
| 901 |
+
if (Object.keys(FILES).length <= 1) return alert('At least one file is required.');
|
| 902 |
+
if (!confirm(`Delete "${name}"?`)) return;
|
| 903 |
+
delete FILES[name];
|
| 904 |
+
if (activeFile === name) activeFile = Object.keys(FILES)[0];
|
| 905 |
+
loadActive(); renderTabs();
|
| 906 |
+
};
|
| 907 |
+
tab.appendChild(del);
|
| 908 |
+
|
| 909 |
+
tab.onclick = () => { saveCurrent(); activeFile = name; loadActive(); renderTabs(); };
|
| 910 |
+
$tabs.appendChild(tab);
|
| 911 |
+
});
|
| 912 |
+
|
| 913 |
+
const add = document.createElement('button');
|
| 914 |
+
add.className = 'tab-add';
|
| 915 |
+
add.textContent = '+';
|
| 916 |
+
add.title = 'New file';
|
| 917 |
+
add.onclick = () => {
|
| 918 |
+
const n = prompt('New file name (e.g. style.css, index.html, test.mt):');
|
| 919 |
+
if (!n) return;
|
| 920 |
+
const name = n.trim();
|
| 921 |
+
if (!name) return;
|
| 922 |
+
if (FILES[name] !== undefined) return alert('File already exists.');
|
| 923 |
+
saveCurrent();
|
| 924 |
+
FILES[name] = '';
|
| 925 |
+
activeFile = name;
|
| 926 |
+
loadActive(); renderTabs();
|
| 927 |
+
};
|
| 928 |
+
$tabs.appendChild(add);
|
| 929 |
+
}
|
| 930 |
+
|
| 931 |
+
function loadActive() {
|
| 932 |
+
$editor.value = FILES[activeFile] || '';
|
| 933 |
+
refreshHighlight();
|
| 934 |
+
$editor.scrollTop = 0; $hl.scrollTop = 0;
|
| 935 |
+
}
|
| 936 |
+
|
| 937 |
+
/* ---------- output ---------- */
|
| 938 |
+
function clearOutput() {
|
| 939 |
+
liveUrls.forEach(u => URL.revokeObjectURL(u));
|
| 940 |
+
liveUrls = [];
|
| 941 |
+
$output.innerHTML = '';
|
| 942 |
+
}
|
| 943 |
+
|
| 944 |
+
function addLine(type, text, lineNo) {
|
| 945 |
+
const row = document.createElement('div');
|
| 946 |
+
row.className = 'line ' + type;
|
| 947 |
+
if (lineNo !== undefined) {
|
| 948 |
+
const ln = document.createElement('span');
|
| 949 |
+
ln.className = 'ln';
|
| 950 |
+
ln.textContent = lineNo;
|
| 951 |
+
row.appendChild(ln);
|
| 952 |
+
}
|
| 953 |
+
const tx = document.createElement('span');
|
| 954 |
+
tx.className = 'txt';
|
| 955 |
+
tx.textContent = text;
|
| 956 |
+
row.appendChild(tx);
|
| 957 |
+
$output.appendChild(row);
|
| 958 |
+
return row;
|
| 959 |
+
}
|
| 960 |
+
|
| 961 |
+
function makePreviewBox(label, sublabel, blobUrl, badgeClass) {
|
| 962 |
+
const box = document.createElement('div');
|
| 963 |
+
box.className = 'render';
|
| 964 |
+
|
| 965 |
+
const head = document.createElement('div');
|
| 966 |
+
head.className = 'render-head';
|
| 967 |
+
head.innerHTML = `
|
| 968 |
+
<span class="pill ${badgeClass || ''}">${label}</span>
|
| 969 |
+
<span class="fname">${esc(sublabel)}</span>
|
| 970 |
+
<span class="url">${esc(blobUrl)}</span>`;
|
| 971 |
+
box.appendChild(head);
|
| 972 |
+
|
| 973 |
+
const frame = document.createElement('iframe');
|
| 974 |
+
frame.src = blobUrl;
|
| 975 |
+
frame.setAttribute('loading', 'lazy');
|
| 976 |
+
box.appendChild(frame);
|
| 977 |
+
|
| 978 |
+
return box;
|
| 979 |
+
}
|
| 980 |
+
|
| 981 |
+
function addRenderFile(fileName) {
|
| 982 |
+
const content = FILES[fileName];
|
| 983 |
+
const ext = (fileName.split('.').pop() || '').toLowerCase();
|
| 984 |
+
const mime =
|
| 985 |
+
(ext === 'html' || ext === 'htm') ? 'text/html' :
|
| 986 |
+
ext === 'css' ? 'text/css' :
|
| 987 |
+
ext === 'js' ? 'text/javascript' :
|
| 988 |
+
ext === 'svg' ? 'image/svg+xml' :
|
| 989 |
+
'text/plain';
|
| 990 |
+
|
| 991 |
+
const blob = new Blob([content], { type: mime });
|
| 992 |
+
const url = URL.createObjectURL(blob);
|
| 993 |
+
liveUrls.push(url);
|
| 994 |
+
$output.appendChild(makePreviewBox('PREVIEW', fileName, url, ''));
|
| 995 |
+
}
|
| 996 |
+
|
| 997 |
+
function addRenderHtml(html) {
|
| 998 |
+
const blob = new Blob([html], { type: 'text/html;charset=utf-8' });
|
| 999 |
+
const url = URL.createObjectURL(blob);
|
| 1000 |
+
liveUrls.push(url);
|
| 1001 |
+
$output.appendChild(makePreviewBox('INLINE HTML', 'inline html', url, 'html'));
|
| 1002 |
+
}
|
| 1003 |
+
|
| 1004 |
+
/* ---------- RUN ---------- */
|
| 1005 |
+
function run() {
|
| 1006 |
+
saveCurrent();
|
| 1007 |
+
clearOutput();
|
| 1008 |
+
|
| 1009 |
+
const hero = document.createElement('div');
|
| 1010 |
+
hero.className = 'hero';
|
| 1011 |
+
hero.innerHTML = `β <b>Death Compiler</b> v<span class="v">${DEATH.VERSION}</span> Β· by <b>${DEATH.AUTHOR}</b>`;
|
| 1012 |
+
$output.appendChild(hero);
|
| 1013 |
+
|
| 1014 |
+
const srcFile =
|
| 1015 |
+
/\.(mt|d)$/i.test(activeFile) ? activeFile :
|
| 1016 |
+
(Object.keys(FILES).find(f => /\.(mt|d)$/i.test(f)) || activeFile);
|
| 1017 |
+
|
| 1018 |
+
const src = FILES[srcFile] || '';
|
| 1019 |
+
addLine('sys', `βΆ compiling ${srcFile} β¦`);
|
| 1020 |
+
|
| 1021 |
+
let result;
|
| 1022 |
+
try {
|
| 1023 |
+
result = DEATH.compile(src, FILES);
|
| 1024 |
+
} catch (err) {
|
| 1025 |
+
addLine('err', 'β Compiler crash: ' + err.message);
|
| 1026 |
+
return;
|
| 1027 |
+
}
|
| 1028 |
+
|
| 1029 |
+
result.output.forEach(item => {
|
| 1030 |
+
if (item.type === 'render') {
|
| 1031 |
+
addRenderFile(item.file);
|
| 1032 |
+
} else if (item.type === 'renderHtml') {
|
| 1033 |
+
addRenderHtml(item.html);
|
| 1034 |
+
} else {
|
| 1035 |
+
addLine(item.type, item.text, item.line);
|
| 1036 |
+
}
|
| 1037 |
+
});
|
| 1038 |
+
|
| 1039 |
+
const vars = Object.keys(result.vars).filter(v => !v.startsWith('__'));
|
| 1040 |
+
if (vars.length) {
|
| 1041 |
+
addLine('sys', '');
|
| 1042 |
+
addLine('sys', ` variables: ${vars.map(v => {
|
| 1043 |
+
const val = String(result.vars[v]);
|
| 1044 |
+
return v + '=' + (val.length > 40 ? val.slice(0, 40) + 'β¦' : val);
|
| 1045 |
+
}).join(', ')}`);
|
| 1046 |
+
}
|
| 1047 |
+
|
| 1048 |
+
$output.scrollTop = $output.scrollHeight;
|
| 1049 |
+
}
|
| 1050 |
+
|
| 1051 |
+
/* ---------- PUBLISH ---------- */
|
| 1052 |
+
function getPublishContent() {
|
| 1053 |
+
// 1. Prefer index.html
|
| 1054 |
+
if (FILES['index.html'] && FILES['index.html'].trim()) {
|
| 1055 |
+
return { html: FILES['index.html'], name: 'index.html' };
|
| 1056 |
+
}
|
| 1057 |
+
|
| 1058 |
+
// 2. Try compiling to find latest rendered HTML
|
| 1059 |
+
const srcFile =
|
| 1060 |
+
/\.(mt|d)$/i.test(activeFile) ? activeFile :
|
| 1061 |
+
(Object.keys(FILES).find(f => /\.(mt|d)$/i.test(f)) || activeFile);
|
| 1062 |
+
const src = FILES[srcFile] || '';
|
| 1063 |
+
|
| 1064 |
+
if (src) {
|
| 1065 |
+
try {
|
| 1066 |
+
const result = DEATH.compile(src, FILES);
|
| 1067 |
+
for (let i = result.output.length - 1; i >= 0; i--) {
|
| 1068 |
+
const item = result.output[i];
|
| 1069 |
+
if (item.type === 'renderHtml') return { html: item.html, name: 'inline html' };
|
| 1070 |
+
if (item.type === 'render') return { html: FILES[item.file] || '', name: item.file };
|
| 1071 |
+
}
|
| 1072 |
+
} catch (e) { /* ignore */ }
|
| 1073 |
+
}
|
| 1074 |
+
|
| 1075 |
+
// 3. Fallback β active file
|
| 1076 |
+
const active = FILES[activeFile] || '';
|
| 1077 |
+
if (active.trim()) return { html: active, name: activeFile };
|
| 1078 |
+
|
| 1079 |
+
// 4. Give up
|
| 1080 |
+
return { html: '', name: 'β' };
|
| 1081 |
+
}
|
| 1082 |
+
|
| 1083 |
+
function publish() {
|
| 1084 |
+
saveCurrent();
|
| 1085 |
+
const { html, name } = getPublishContent();
|
| 1086 |
+
|
| 1087 |
+
if (!html || !html.trim()) {
|
| 1088 |
+
alert('Kuch publish karne ke liye nahi hai. Pehle index.html banayein ya HTML render karein.');
|
| 1089 |
+
return;
|
| 1090 |
+
}
|
| 1091 |
+
|
| 1092 |
+
const encoded = b64encode(html);
|
| 1093 |
+
const base = location.origin + location.pathname;
|
| 1094 |
+
const url = base + '#url=' + encoded;
|
| 1095 |
+
|
| 1096 |
+
document.getElementById('pubUrl').value = url;
|
| 1097 |
+
document.getElementById('pubSource').textContent = name;
|
| 1098 |
+
document.getElementById('pubSize').textContent =
|
| 1099 |
+
(new Blob([html]).size / 1024).toFixed(2) + ' KB';
|
| 1100 |
+
document.getElementById('pubUrlLen').textContent = url.length + ' chars';
|
| 1101 |
+
|
| 1102 |
+
const warnEl = document.getElementById('pubWarn');
|
| 1103 |
+
warnEl.style.display = (url.length > 32000) ? 'block' : 'none';
|
| 1104 |
+
|
| 1105 |
+
document.getElementById('publishModal').classList.add('show');
|
| 1106 |
+
}
|
| 1107 |
+
|
| 1108 |
+
document.getElementById('publishBtn').onclick = publish;
|
| 1109 |
+
document.getElementById('openPublishedBtn').onclick = () => {
|
| 1110 |
+
const url = document.getElementById('pubUrl').value;
|
| 1111 |
+
window.open(url, '_blank');
|
| 1112 |
+
};
|
| 1113 |
+
document.getElementById('closePublishBtn').onclick = () =>
|
| 1114 |
+
document.getElementById('publishModal').classList.remove('show');
|
| 1115 |
+
|
| 1116 |
+
document.getElementById('copyUrlBtn').onclick = async () => {
|
| 1117 |
+
const url = document.getElementById('pubUrl').value;
|
| 1118 |
+
const btn = document.getElementById('copyUrlBtn');
|
| 1119 |
+
const original = btn.textContent;
|
| 1120 |
+
try {
|
| 1121 |
+
await navigator.clipboard.writeText(url);
|
| 1122 |
+
btn.textContent = 'β Copied!';
|
| 1123 |
+
} catch (e) {
|
| 1124 |
+
const input = document.getElementById('pubUrl');
|
| 1125 |
+
input.select();
|
| 1126 |
+
document.execCommand('copy');
|
| 1127 |
+
btn.textContent = 'β Copied!';
|
| 1128 |
+
}
|
| 1129 |
+
setTimeout(() => { btn.textContent = original; }, 1600);
|
| 1130 |
+
};
|
| 1131 |
+
|
| 1132 |
+
/* ---------- other buttons ---------- */
|
| 1133 |
+
document.getElementById('runBtn').onclick = run;
|
| 1134 |
+
|
| 1135 |
+
document.getElementById('clearBtn').onclick = () => {
|
| 1136 |
+
if (!confirm('Clear editor?')) return;
|
| 1137 |
+
$editor.value = '';
|
| 1138 |
+
FILES[activeFile] = '';
|
| 1139 |
+
refreshHighlight();
|
| 1140 |
+
};
|
| 1141 |
+
|
| 1142 |
+
document.getElementById('clearOut').onclick = clearOutput;
|
| 1143 |
+
|
| 1144 |
+
document.getElementById('exampleBtn').onclick = () => {
|
| 1145 |
+
if (!confirm('Load example? Current files will be replaced.')) return;
|
| 1146 |
+
Object.keys(FILES).forEach(k => delete FILES[k]);
|
| 1147 |
+
FILES['main.mt'] = DEFAULT_MT;
|
| 1148 |
+
FILES['index.html'] = DEFAULT_HTML;
|
| 1149 |
+
activeFile = 'main.mt';
|
| 1150 |
+
loadActive(); renderTabs();
|
| 1151 |
+
run();
|
| 1152 |
+
};
|
| 1153 |
+
|
| 1154 |
+
function download(name, text) {
|
| 1155 |
+
const blob = new Blob([text], { type: 'text/plain;charset=utf-8' });
|
| 1156 |
+
const a = document.createElement('a');
|
| 1157 |
+
a.href = URL.createObjectURL(blob);
|
| 1158 |
+
a.download = name;
|
| 1159 |
+
document.body.appendChild(a);
|
| 1160 |
+
a.click();
|
| 1161 |
+
a.remove();
|
| 1162 |
+
setTimeout(() => URL.revokeObjectURL(a.href), 5000);
|
| 1163 |
+
}
|
| 1164 |
+
|
| 1165 |
+
document.getElementById('saveMtBtn').onclick = () => {
|
| 1166 |
+
saveCurrent();
|
| 1167 |
+
const base = activeFile.replace(/\.[^.]+$/, '') || 'script';
|
| 1168 |
+
download(base + '.mt', FILES[activeFile] || '');
|
| 1169 |
+
};
|
| 1170 |
+
|
| 1171 |
+
document.getElementById('saveDBtn').onclick = () => {
|
| 1172 |
+
saveCurrent();
|
| 1173 |
+
const base = activeFile.replace(/\.[^.]+$/, '') || 'script';
|
| 1174 |
+
download(base + '.d', FILES[activeFile] || '');
|
| 1175 |
+
};
|
| 1176 |
+
|
| 1177 |
+
document.getElementById('openBtn').onclick = () => document.getElementById('fileInput').click();
|
| 1178 |
+
|
| 1179 |
+
document.getElementById('fileInput').onchange = e => {
|
| 1180 |
+
const f = e.target.files[0];
|
| 1181 |
+
if (!f) return;
|
| 1182 |
+
const reader = new FileReader();
|
| 1183 |
+
reader.onload = () => {
|
| 1184 |
+
saveCurrent();
|
| 1185 |
+
FILES[f.name] = reader.result;
|
| 1186 |
+
activeFile = f.name;
|
| 1187 |
+
loadActive(); renderTabs();
|
| 1188 |
+
addLine('sys', `π loaded ${f.name}`);
|
| 1189 |
+
};
|
| 1190 |
+
reader.readAsText(f);
|
| 1191 |
+
e.target.value = '';
|
| 1192 |
+
};
|
| 1193 |
+
|
| 1194 |
+
document.getElementById('helpBtn').onclick = () =>
|
| 1195 |
+
document.getElementById('helpModal').classList.add('show');
|
| 1196 |
+
|
| 1197 |
+
document.getElementById('helpModal').onclick = e => {
|
| 1198 |
+
if (e.target.id === 'helpModal') e.target.classList.remove('show');
|
| 1199 |
+
};
|
| 1200 |
+
|
| 1201 |
+
document.getElementById('publishModal').onclick = e => {
|
| 1202 |
+
if (e.target.id === 'publishModal') e.target.classList.remove('show');
|
| 1203 |
+
};
|
| 1204 |
+
|
| 1205 |
+
/* ---------- boot (skip if published mode) ---------- */
|
| 1206 |
+
if (!window.__DEATH_PUBLISHED__) {
|
| 1207 |
+
renderTabs();
|
| 1208 |
+
loadActive();
|
| 1209 |
+
run();
|
| 1210 |
+
}
|
| 1211 |
+
</script>
|
| 1212 |
+
<script type="module" src="https://static.cloudflareinsights.com/beacon.min.js/v4bc70e2c01a94c73b74392e4234840661791215815920" integrity="sha512-L0ha0OXavK/8okipN9F8BtP84dg9DUhPERbBXzwI6dgTA55d2+yweo3pn5CSFYs45/r8md2+xvUPtTdvTNRfjA==" data-cf-beacon='{"version":"2024.11.0","token":"e3c1c9af36de41759418005494a48906","r":1,"spa":2}' crossorigin="anonymous"></script>
|
| 1213 |
+
</body>
|
| 1214 |
+
</html>
|