-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
436 lines (407 loc) · 25.4 KB
/
index.html
File metadata and controls
436 lines (407 loc) · 25.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="description" content="Simple unit converter - length, weight, temperature, volume">
<meta name="robots" content="noindex, nofollow">
<title>Unit Converter</title>
<link rel="manifest" href="/manifest.json">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<meta name="apple-mobile-web-app-title" content="Convert">
<link rel="apple-touch-icon" href="/icon-192.png">
<meta name="theme-color" content="#F5F0EB">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background: #FAFAF8; color: #2C2C2C; }
input, select, button { font-size: 16px; } /* prevents iOS zoom on focus */
</style>
</head>
<body>
<div id="root"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/18.3.1/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/18.3.1/umd/react-dom.production.min.js"></script>
<script>
"use strict";
const e = React.createElement;
const { useState, useEffect, useCallback, useRef } = React;
/* ── Storage — innocuous key name ── */
const SKEY = "uc_pref_v1";
function loadData() {
try { const d = localStorage.getItem(SKEY); return d ? JSON.parse(d) : []; }
catch(x) { return []; }
}
function saveData(arr) {
try { localStorage.setItem(SKEY, JSON.stringify(arr)); } catch(x) {}
}
/* ── Converter ── */
const CATS = {
Length: {
units: ["Inches","Feet","Yards","Miles","Centimeters","Meters","Kilometers"],
factors: {Inches:1,Feet:12,Yards:36,Miles:63360,Centimeters:0.393701,Meters:39.3701,Kilometers:39370.1}
},
Weight: {
units: ["Ounces","Pounds","Grams","Kilograms"],
factors: {Ounces:1,Pounds:16,Grams:0.035274,Kilograms:35.274}
},
Temperature: { units: ["Fahrenheit","Celsius"], factors: null },
Volume: {
units: ["Cups","Pints","Quarts","Gallons","Liters"],
factors: {Cups:1,Pints:2,Quarts:4,Gallons:16,Liters:4.22675}
}
};
function conv(val, cat, from, to) {
if (!val || isNaN(val)) return "";
var n = parseFloat(val);
if (cat === "Temperature") {
if (from === to) return n.toFixed(1);
if (from === "Fahrenheit") return ((n-32)*5/9).toFixed(1);
return ((n*9/5)+32).toFixed(1);
}
var f = CATS[cat].factors;
return ((n*f[from])/f[to]).toFixed(2).replace(/\.?0+$/,"");
}
function isCode(v) {
var digits = v.replace(/[^0-9]/g,"");
return ["911","991","919","199","119","191","999","111"].indexOf(digits) !== -1;
}
var EMPTY = {name:"",phone:"",message:""};
var HELP = [
{ label:"I need help right now", color:"#C44D3F", bg:"#FDF0EE", border:"#F0C4BF", content:[
{type:"phone",text:"Call 1-800-799-7233",sub:"Free. 24 hours. You don't have to give your name.",href:"tel:18007997233"},
{type:"phone",text:"Text START to 88788",sub:"If you can't talk out loud right now.",href:"sms:88788?body=START"},
{type:"phone",text:"Text HOME to 741741",sub:"For any crisis. Any age.",href:"sms:741741?body=HOME"},
{type:"phone",text:"Call 911",sub:"If you or your children are in danger right now.",href:"tel:911"},
{type:"note",text:"You can hang up anytime. They will not judge you. They are there for you."}
]},
{ label:"I'm a kid and I'm scared", color:"#2E7D6B", bg:"#EDF7F4", border:"#B8DDD3", content:[
{type:"phone",text:"Call 1-800-422-4453",sub:"This is a free phone line for kids. Grown-ups answer who want to help you. It's private.",href:"tel:18004224453"},
{type:"bigtext",text:"You are not in trouble."},
{type:"bigtext",text:"This is not your fault."},
{type:"note",text:"You can tell a teacher, a school counselor, a coach, or any grown-up you feel safe with. They will help."},
{type:"note",text:"If someone is hurting you right now, go to a neighbor's house or call 911."}
]},
{ label:"I need to make a plan to leave", color:"#5B6B3D", bg:"#F3F5ED", border:"#CDD5B8", content:[
{type:"step",num:"1",text:"Pick one person you trust. Tell them what is happening."},
{type:"step",num:"2",text:"Choose a code word with that person. It means \"call for help.\""},
{type:"step",num:"3",text:"If you can, put copies of your ID, your keys, and some cash somewhere safe outside your home."},
{type:"step",num:"4",text:"Know the exits in your home. Think about which rooms have locks or windows."},
{type:"step",num:"5",text:"You can leave with nothing. Shelters will give you what you need. They take children and pets too."},
{type:"phone",text:"Call 1-800-799-7233",sub:"They will help you make a plan. You don't have to do this alone.",href:"tel:18007997233"}
]},
{ label:"I think my phone is being watched", color:"#6B5B8D", bg:"#F2F0F7", border:"#CFC8DF", content:[
{type:"note",text:"If you can, use a different device \u2014 a library computer, a friend's phone, or a phone at work."},
{type:"note",text:"Use private browsing (incognito mode) for anything about help or safety."},
{type:"note",text:"Look for apps on your phone you don't recognize. Tracking apps sometimes look like battery or system tools."},
{type:"note",text:"Turn off location sharing in your phone settings."},
{type:"note",text:"Trackers like AirTags can be hidden in bags and cars. Check physically."},
{type:"note",text:"Only change your passwords from a safe device \u2014 never one they have touched."}
]},
{ label:"Can I get legal help?", color:"#7B6840", bg:"#F7F3EC", border:"#DDD2B8", content:[
{type:"bigtext",text:"Yes."},
{type:"note",text:"You can get a protection order (restraining order) for free. You do not need a lawyer."},
{type:"note",text:"Go to your local courthouse. There are people there whose job is to help you fill out the forms."},
{type:"note",text:"Save evidence: photos of injuries, screenshots of threatening messages, notes about what happened and when."},
{type:"note",text:"Your immigration status does not matter. You are protected by law."},
{type:"note",text:"For free legal help near you, visit lawhelp.org from a safe device."}
]},
{ label:"More numbers to call or text", color:"#5A7B9A", bg:"#EEF3F7", border:"#BCCFDD", content:[
{type:"phone",text:"DV Hotline: 1-800-799-7233",sub:"24/7. All languages.",href:"tel:18007997233"},
{type:"phone",text:"Childhelp: 1-800-422-4453",sub:"For kids or about kids.",href:"tel:18004224453"},
{type:"phone",text:"Love Is Respect: 1-866-331-9474",sub:"Ages 12\u201324. Text LOVEIS to 22522.",href:"tel:18663319474"},
{type:"phone",text:"Sexual Assault: 1-800-656-4673",sub:"24/7.",href:"tel:18006564673"},
{type:"phone",text:"Deaf/HoH: 1-855-812-1001",sub:"Video phone. Or email hotline@thehotline.org",href:"tel:18558121001"},
{type:"phone",text:"Emergency: 911",sub:"If anyone is in danger right now.",href:"tel:911"}
]}
];
var CC = {color:"#8B5E3C",bg:"#FBF5EE",border:"#E0C9AB",bg2:"#F5EBDF"};
function App() {
var _safe = useState(false), safe = _safe[0], setSafe = _safe[1];
var _cat = useState("Length"), cat = _cat[0], setCat = _cat[1];
var _from = useState("Inches"), from = _from[0], setFrom = _from[1];
var _to = useState("Centimeters"), to = _to[0], setTo = _to[1];
var _val = useState(""), val = _val[0], setVal = _val[1];
var _open = useState(null), open = _open[0], setOpen = _open[1];
var _contacts = useState([]), contacts = _contacts[0], setContacts = _contacts[1];
var _editing = useState(null), editing = _editing[0], setEditing = _editing[1];
var _draft = useState({name:"",phone:"",message:""}), draft = _draft[0], setDraft = _draft[1];
var _cOpen = useState(false), contactsOpen = _cOpen[0], setContactsOpen = _cOpen[1];
var _del = useState(null), deleteConfirm = _del[0], setDeleteConfirm = _del[1];
var inputRef = useRef(null);
var exit = useCallback(function() {
setSafe(false); setVal(""); setOpen(null); setEditing(null);
setContactsOpen(false); setDeleteConfirm(null);
setTimeout(function(){ inputRef.current && inputRef.current.focus(); }, 50);
}, []);
useEffect(function() {
function h(ev) { if (ev.key === "Escape") exit(); }
window.addEventListener("keydown", h);
return function() { window.removeEventListener("keydown", h); };
}, [exit]);
useEffect(function() {
if (safe) setContacts(loadData());
}, [safe]);
function handleInput(ev) {
var v = ev.target.value;
if (isCode(v)) { setSafe(true); setVal(""); return; }
setVal(v);
}
function switchCat(c) {
setCat(c); setFrom(CATS[c].units[0]); setTo(CATS[c].units[1]); setVal("");
}
function startAdd() { setDraft({name:"",phone:"",message:""}); setEditing("new"); setDeleteConfirm(null); }
function startEdit(i) { setDraft({name:contacts[i].name,phone:contacts[i].phone,message:contacts[i].message}); setEditing(i); setDeleteConfirm(null); }
function cancelEdit() { setEditing(null); setDraft({name:"",phone:"",message:""}); }
function saveDraft() {
var cn = draft.name.trim().slice(0,30);
var cp = draft.phone.replace(/[^0-9+\-() ]/g,"").trim().slice(0,20);
var cm = draft.message.trim().slice(0,100);
if (!cn && !cp) return;
var clean = {name:cn,phone:cp,message:cm};
var updated;
if (editing === "new") { updated = contacts.concat([clean]); }
else { updated = contacts.map(function(c,i){ return i===editing?clean:c; }); }
setContacts(updated); saveData(updated); setEditing(null); setDraft({name:"",phone:"",message:""});
}
function deleteContact(i) {
var updated = contacts.filter(function(_,idx){ return idx!==i; });
setContacts(updated); saveData(updated); setDeleteConfirm(null); setEditing(null);
}
function sendText(c) {
var ph = c.phone.replace(/[^0-9+]/g,"");
window.location.href = "sms:" + ph + "?body=" + encodeURIComponent(c.message||"");
}
function callContact(c) {
var ph = c.phone.replace(/[^0-9+]/g,"");
window.location.href = "tel:" + ph;
}
var result = conv(val, cat, from, to);
/* ── Helper to build content items ── */
function renderItem(item, j, section, total) {
if (item.type === "phone") return e("a", {key:j, href:item.href, style:{
display:"block",textDecoration:"none",background:section.bg,
border:"1px solid "+section.border,borderRadius:10,padding:"16px 18px",margin:"8px 0",cursor:"pointer"
}},
e("div",{style:{fontSize:19,fontWeight:700,color:section.color,fontFamily:"Georgia, serif",marginBottom:5}},item.text),
item.sub && e("div",{style:{fontSize:14,color:"#7A7470",lineHeight:1.55}},item.sub)
);
if (item.type === "bigtext") return e("div",{key:j,style:{
padding:"12px 14px",fontSize:19,fontWeight:700,color:section.color,fontFamily:"Georgia, serif",lineHeight:1.4
}},item.text);
if (item.type === "step") return e("div",{key:j,style:{
display:"flex",gap:14,alignItems:"flex-start",padding:"12px 10px",
borderBottom:(j<total-1 && section.content[j+1] && section.content[j+1].type==="step")?"1px solid #F0EBE6":"none"
}},
e("span",{style:{flexShrink:0,width:32,height:32,borderRadius:"50%",background:section.color,
color:"#FFF",fontSize:15,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",
fontFamily:"monospace",marginTop:2}},item.num),
e("span",{style:{fontSize:16,color:"#3D3530",lineHeight:1.6,paddingTop:5}},item.text)
);
return e("div",{key:j,style:{
padding:"11px 14px",fontSize:15,color:"#4A4440",lineHeight:1.65,
borderBottom:j<total-1?"1px solid #F0EBE6":"none"
}},item.text);
}
/* ── Contact form builder ── */
function contactForm(isNew) {
return e("div",{style:{background:CC.bg,border:"1px solid "+CC.border,borderRadius:10,padding:"14px 16px",margin:"8px 0"}},
e("label",{style:{display:"block",fontSize:12,color:"#8B7E74",fontWeight:600,marginBottom:6,fontFamily:"Georgia, serif"}},"Name"),
e("input",{type:"text",value:draft.name,placeholder:"Mom, Sarah, Uncle Mike...",maxLength:30,
onChange:function(ev){setDraft({name:ev.target.value,phone:draft.phone,message:draft.message});},
style:{width:"100%",padding:"12px 14px",fontSize:16,border:"1px solid #E0D8CF",borderRadius:8,
background:"#FFF",color:"#2C2C2C",outline:"none",boxSizing:"border-box",fontFamily:"Georgia, serif",marginBottom:10}}),
e("label",{style:{display:"block",fontSize:12,color:"#8B7E74",fontWeight:600,marginBottom:6,fontFamily:"Georgia, serif"}},"Phone number"),
e("input",{type:"tel",value:draft.phone,placeholder:"555-123-4567",maxLength:20,
onChange:function(ev){setDraft({name:draft.name,phone:ev.target.value,message:draft.message});},
style:{width:"100%",padding:"12px 14px",fontSize:16,border:"1px solid #E0D8CF",borderRadius:8,
background:"#FFF",color:"#2C2C2C",outline:"none",boxSizing:"border-box",fontFamily:"Georgia, serif",marginBottom:10}}),
e("label",{style:{display:"block",fontSize:12,color:"#8B7E74",fontWeight:600,marginBottom:6,fontFamily:"Georgia, serif"}},"Code word or distress message"),
e("input",{type:"text",value:draft.message,placeholder:"e.g. 'blue sky' or 'I need help, come now'",maxLength:100,
onChange:function(ev){setDraft({name:draft.name,phone:draft.phone,message:ev.target.value});},
style:{width:"100%",padding:"12px 14px",fontSize:16,border:"1px solid #E0D8CF",borderRadius:8,
background:"#FFF",color:"#2C2C2C",outline:"none",boxSizing:"border-box",fontFamily:"Georgia, serif",marginBottom:14}}),
e("div",{style:{display:"flex",gap:8}},
e("button",{onClick:saveDraft,style:{flex:1,padding:"12px",fontSize:15,fontWeight:700,
background:CC.color,color:"#FFF",border:"none",borderRadius:8,cursor:"pointer",fontFamily:"Georgia, serif"}},"Save"),
e("button",{onClick:cancelEdit,style:{flex:1,padding:"12px",fontSize:15,
background:"#F0EBE6",color:"#7A7470",border:"none",borderRadius:8,cursor:"pointer",fontFamily:"Georgia, serif"}},"Cancel")
),
!isNew && e("div",{style:{marginTop:10,textAlign:"center"}},
deleteConfirm === editing
? e("div",{style:{display:"flex",gap:8,justifyContent:"center",alignItems:"center"}},
e("span",{style:{fontSize:13,color:"#C44D3F"}},"Delete this contact?"),
e("button",{onClick:function(){deleteContact(editing);},style:{padding:"6px 14px",fontSize:13,fontWeight:700,
background:"#C44D3F",color:"#FFF",border:"none",borderRadius:6,cursor:"pointer"}},"Yes, delete"),
e("button",{onClick:function(){setDeleteConfirm(null);},style:{padding:"6px 14px",fontSize:13,
background:"#F0EBE6",color:"#7A7470",border:"none",borderRadius:6,cursor:"pointer"}},"No")
)
: e("button",{onClick:function(){setDeleteConfirm(editing);},style:{padding:"6px 14px",fontSize:12,color:"#C44D3F",
background:"none",border:"none",cursor:"pointer",textDecoration:"underline"}},"Delete this contact")
)
);
}
/* ── Contact display card ── */
function contactCard(c, i) {
return e("div",{key:i,style:{background:CC.bg,border:"1px solid "+CC.border,borderRadius:10,padding:"14px 16px",margin:"8px 0"}},
editing === i ? contactForm(false) :
e("div",null,
e("div",{style:{fontSize:18,fontWeight:700,color:CC.color,fontFamily:"Georgia, serif",marginBottom:2}},c.name||"No name"),
e("div",{style:{fontSize:14,color:"#7A7470",marginBottom:c.message?4:10}},c.phone),
c.message && e("div",{style:{fontSize:14,color:"#5B6B3D",fontStyle:"italic",marginBottom:10,lineHeight:1.5}},
"Message: \u201C"+c.message+"\u201D"),
e("div",{style:{display:"flex",gap:8}},
c.message && e("button",{onClick:function(){sendText(c);},style:{flex:1,padding:"12px",fontSize:15,fontWeight:700,
background:"#5B6B3D",color:"#FFF",border:"none",borderRadius:8,cursor:"pointer",fontFamily:"Georgia, serif"}},"Send text"),
e("button",{onClick:function(){callContact(c);},style:{flex:1,padding:"12px",fontSize:15,fontWeight:700,
background:CC.color,color:"#FFF",border:"none",borderRadius:8,cursor:"pointer",fontFamily:"Georgia, serif"}},"Call"),
e("button",{onClick:function(){startEdit(i);},style:{padding:"12px 16px",fontSize:14,
background:"#F0EBE6",color:"#7A7470",border:"none",borderRadius:8,cursor:"pointer"}},"Edit")
)
)
);
}
/* ════════ SAFE VIEW ════════ */
if (safe) return e("div",{style:{minHeight:"100vh",background:"#FAFAF8",margin:0,padding:0}},
/* Exit bar */
e("div",{onClick:exit,style:{position:"sticky",top:0,zIndex:100,background:"#F5F0EB",
borderBottom:"1px solid #E0D8CF",padding:"14px 20px",cursor:"pointer",
display:"flex",justifyContent:"space-between",alignItems:"center"}},
e("span",{style:{fontFamily:"monospace",fontSize:14,color:"#8B7E74",letterSpacing:1}},"UNIT CONVERTER"),
e("span",{style:{fontSize:13,color:"#C44D3F",fontWeight:700,fontFamily:"monospace",
background:"#FDF0EE",padding:"6px 14px",borderRadius:6,border:"1px solid #F0C4BF"}},"\u2715 EXIT")
),
e("div",{style:{maxWidth:540,margin:"0 auto",padding:"12px 16px 80px"}},
/* Header */
e("div",{style:{textAlign:"center",padding:"20px 12px 24px"}},
e("p",{style:{fontSize:22,color:"#3D3530",margin:"0 0 10px",fontWeight:700,lineHeight:1.3,
fontFamily:"Georgia, 'Times New Roman', serif"}},"You are not alone."),
e("p",{style:{fontSize:15,color:"#8B7E74",margin:0,lineHeight:1.5,fontFamily:"Georgia, serif"}},
"Pick what you need. Press ESC or tap EXIT anytime.")
),
/* My safe people */
e("div",{style:{marginBottom:10}},
e("button",{onClick:function(){setContactsOpen(!contactsOpen);setEditing(null);setDeleteConfirm(null);},
style:{width:"100%",textAlign:"left",cursor:"pointer",
background:contactsOpen?CC.bg:"#FFFFFF",
border:"2px solid "+(contactsOpen?CC.border:"#E8E3DE"),
borderRadius:contactsOpen?"10px 10px 0 0":"10px",
padding:"18px 20px",fontSize:17,fontFamily:"Georgia, serif",
color:CC.color,fontWeight:700,display:"flex",justifyContent:"space-between",
alignItems:"center",transition:"all 0.15s",lineHeight:1.3}},
e("span",null,"My safe people"+(contacts.length>0?" ("+contacts.length+")":"")),
e("span",{style:{fontSize:24,fontWeight:300,color:CC.color,
transform:contactsOpen?"rotate(45deg)":"none",transition:"transform 0.2s",
lineHeight:1,flexShrink:0,marginLeft:12}},"+")
),
contactsOpen && e("div",{style:{background:"#FFFFFF",border:"2px solid "+CC.border,
borderTop:"none",borderRadius:"0 0 10px 10px",padding:"10px 12px 16px"}},
e("div",{style:{fontSize:14,color:"#7A7470",lineHeight:1.6,padding:"8px 8px 14px",
borderBottom:"1px solid #F0EBE6",marginBottom:10}},
"Save numbers you can\u2019t keep in your regular contacts. Add a code word or message \u2014 one tap sends it."
+(contacts.length>0?"":" Tap the button below to add someone.")),
contacts.map(function(c,i){ return contactCard(c,i); }),
editing === "new" && contactForm(true),
editing === null && contacts.length < 5 && e("button",{onClick:startAdd,style:{
width:"100%",padding:"14px",margin:"8px 0",fontSize:16,fontWeight:600,
background:"#FFF",color:CC.color,border:"2px dashed "+CC.border,
borderRadius:10,cursor:"pointer",fontFamily:"Georgia, serif"}},
"+ Add a safe person"),
contacts.length >= 5 && editing === null && e("div",{style:{fontSize:13,color:"#8B7E74",
textAlign:"center",padding:8}},"5 contacts maximum. Edit or delete one to add another.")
)
),
/* Help sections */
HELP.map(function(section,i){
return e("div",{key:i,style:{marginBottom:10}},
e("button",{onClick:function(){setOpen(open===i?null:i);},
style:{width:"100%",textAlign:"left",cursor:"pointer",
background:open===i?section.bg:"#FFFFFF",
border:"2px solid "+(open===i?section.border:"#E8E3DE"),
borderRadius:open===i?"10px 10px 0 0":"10px",
padding:"18px 20px",fontSize:17,fontFamily:"Georgia, serif",
color:section.color,fontWeight:700,display:"flex",justifyContent:"space-between",
alignItems:"center",transition:"all 0.15s",lineHeight:1.3}},
e("span",null,section.label),
e("span",{style:{fontSize:24,fontWeight:300,color:section.color,
transform:open===i?"rotate(45deg)":"none",transition:"transform 0.2s",
lineHeight:1,flexShrink:0,marginLeft:12}},"+")
),
open===i && e("div",{style:{background:"#FFFFFF",border:"2px solid "+section.border,
borderTop:"none",borderRadius:"0 0 10px 10px",padding:"6px 10px 14px"}},
section.content.map(function(item,j){ return renderItem(item,j,section,section.content.length); })
)
);
}),
/* Bottom reminder */
e("div",{style:{marginTop:28,padding:"18px 20px",background:"#F5F2EE",borderRadius:10,
border:"1px solid #E0D8CF",fontSize:14,color:"#6B6360",lineHeight:1.8}},
e("strong",{style:{color:"#3D3530"}},"Before you close this page:"),e("br"),
"Clear your browser history for this visit, or use incognito mode next time.",e("br"),
"To return here, type ",
e("strong",{style:{color:"#3D3530",background:"#E8E2DB",padding:"2px 8px",borderRadius:4,fontFamily:"monospace"}},"911"),
" in the converter. Any order works. Any decimal works.",e("br"),
"Your saved contacts will still be here when you come back."
)
)
);
/* ════════ CONVERTER VIEW ════════ */
return e("div",{style:{minHeight:"100vh",background:"#FAFAF8",margin:0,padding:0}},
e("div",{style:{background:"#F5F0EB",borderBottom:"1px solid #E0D8CF",padding:"16px 20px"}},
e("span",{style:{fontFamily:"monospace",fontSize:14,color:"#8B7E74",letterSpacing:1}},"UNIT CONVERTER")
),
e("div",{style:{maxWidth:420,margin:"0 auto",padding:"28px 16px"}},
/* Category tabs */
e("div",{style:{display:"flex",gap:0,marginBottom:24,borderRadius:8,overflow:"hidden",border:"1px solid #E0D8CF"}},
Object.keys(CATS).map(function(c){
return e("button",{key:c,onClick:function(){switchCat(c);},style:{
flex:1,padding:"11px 4px",fontSize:12,fontFamily:"monospace",
background:cat===c?"#E8E2DB":"#FFFFFF",color:cat===c?"#3D3530":"#A09890",
border:"none",borderRight:"1px solid #E0D8CF",cursor:"pointer",fontWeight:cat===c?700:400}},c);
})
),
/* Input */
e("label",{style:{display:"block",fontSize:11,color:"#A09890",fontFamily:"monospace",marginBottom:6,letterSpacing:0.5}},"VALUE"),
e("input",{ref:inputRef,type:"text",inputMode:"decimal",value:val,onChange:handleInput,
placeholder:"0",maxLength:12,style:{width:"100%",padding:"14px 16px",fontSize:28,
fontFamily:"monospace",border:"1px solid #E0D8CF",borderRadius:8,background:"#FFF",
color:"#2C2C2C",outline:"none",boxSizing:"border-box",marginBottom:18}}),
/* From */
e("label",{style:{display:"block",fontSize:11,color:"#A09890",fontFamily:"monospace",marginBottom:6,letterSpacing:0.5}},"FROM"),
e("select",{value:from,onChange:function(ev){setFrom(ev.target.value);},style:{
width:"100%",padding:"12px 16px",fontSize:15,border:"1px solid #E0D8CF",borderRadius:8,
background:"#FFF",color:"#2C2C2C",outline:"none",appearance:"none",cursor:"pointer",
boxSizing:"border-box",marginBottom:8}},
CATS[cat].units.map(function(u){return e("option",{key:u,value:u},u);})
),
/* Swap */
e("div",{style:{textAlign:"center",margin:"2px 0"}},
e("button",{onClick:function(){var t=from;setFrom(to);setTo(t);},style:{
background:"none",border:"none",fontSize:20,color:"#B8ADA2",cursor:"pointer",padding:"4px 12px"}},"\u2195")
),
/* To */
e("label",{style:{display:"block",fontSize:11,color:"#A09890",fontFamily:"monospace",marginBottom:6,letterSpacing:0.5}},"TO"),
e("select",{value:to,onChange:function(ev){setTo(ev.target.value);},style:{
width:"100%",padding:"12px 16px",fontSize:15,border:"1px solid #E0D8CF",borderRadius:8,
background:"#FFF",color:"#2C2C2C",outline:"none",appearance:"none",cursor:"pointer",
boxSizing:"border-box",marginBottom:22}},
CATS[cat].units.map(function(u){return e("option",{key:u,value:u},u);})
),
/* Result */
e("div",{style:{background:"#F5F2EE",border:"1px solid #E0D8CF",borderRadius:8,padding:"20px",textAlign:"center"}},
e("div",{style:{fontSize:11,color:"#A09890",fontFamily:"monospace",marginBottom:8,letterSpacing:0.5}},"RESULT"),
e("div",{style:{fontSize:32,fontFamily:"monospace",color:"#3D3530",minHeight:42}},result||"\u2014"),
result && e("div",{style:{fontSize:13,color:"#A09890",marginTop:6}},to)
),
e("div",{style:{marginTop:48,textAlign:"center",fontSize:11,color:"#C8C0B8",fontFamily:"monospace"}},
"quick conversions \u2014 no ads, no tracking")
)
);
}
ReactDOM.createRoot(document.getElementById("root")).render(e(App));
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("/sw.js").catch(function(){});
}
</script>
</body>
</html>