% layout("/sk/history/layout", { title: `história` }) %>
<%~ include("/sk/partials/topbar") %>
<% const backIcon = `
` %>
<% if (it?.dateMap?.years) { %>
<% } %>
<% const time = [] %>
<% const data = [] %>
<% for (const item of it.data) { %>
<% time.push(item.timeMark) %>
<% if (it.property === "outdoorConnected") {%>
<% data.push(item.value) %>
<% continue %>
<% } %>
<% data.push(item.value / 100) %>
<% } %>
<% function serializeToCode(obj) { %>
<% // Handle null/primitive types %>
<% if (obj === null) return 'null'; %>
<% if (typeof obj === 'string') return `'${obj.replace(/'/g, "\\'")}'`; %>
<% if (typeof obj !== 'object') return obj.toString(); %>
<% // Handle Arrays %>
<% if (Array.isArray(obj)) { %>
<% return `[${obj.map(item => serializeToCode(item)).join(',')}]`; %>
<% } %>
<% // Handle Objects %>
<% const entries = Object.entries(obj).map(([key, value]) => { %>
<% // Ensure keys are safe (quoted if they contain special characters) %>
<% const safeKey = /^[a-z$_][a-z0-9$_]*$/i.test(key) ? key : `'${key}'`; %>
<% return `${safeKey}: ${serializeToCode(value)}`; %>
<% }); %>
<% return `{${entries.join(',')}}`; %>
<% } %>