PageSourceSearch

https://hintermoos.at/assets/CostsHeatingApartments-CXQ3dy2i.js

js hintermoos.at collected 2026-10-09 22:02:16 UTC 49,914 bytes, 21 lines download raw bytes

1import{c as le,j as e,w as V,K as F,N as K,x as W,T as re,O as me,u as Ae,a as Ie,r as w,s as Qe,m as es,B as J,X as ss,$ as Se,G as _e,H as Ce,J as qe,l as ts}from"./index-MoAbC8_9.js";import{O as rs}from"./OwnersLayout-Cd0M3dw8.js";import{u as as}from"./usePersistedYear-CMpOJqHk.js";import{T as ns,a as ls,b as Pe,c as D,d as is,e as M}from"./table-BNHSYido.js";import{B as Z}from"./badge-BHbYeRgi.js";import{S as He,a as Te,b as ze,c as Ve,d as Fe}from"./select-ChAxOmxm.js";import{A as Ke,a as We}from"./alert-B1M6s1_G.js";import{T as os}from"./table-pagination-DgaWMZqT.js";import{g as De,p as X}from"./meterTypeUtils-B8NQp94j.js";import{I as R}from"./info-CZr0REZX.js";import{H as oe}from"./house-DjS1WMqx.js";import{T as cs}from"./thermometer-CsW4-4zi.js";import{T as ce}from"./trending-up-Cg9WFJWB.js";import{C as Me}from"./chart-column-Bo5i9GGE.js";import{R as de,C as xe,X as pe,Y as he,T as ue,L as je,B as I}from"./generateCategoricalChart-C2b_mvpD.js";import{C as ge}from"./ComposedChart-DcPErJ04.js";import{L as fe}from"./Line-DFydwSLz.js";import{G as ms}from"./gauge-CDjYpgNp.js";import{C as ds}from"./chevron-left-BrISfdwW.js";import{C as xs}from"./Header-CnJGZ8vQ.js";import{C as ps}from"./circle-help-BFmb_2uk.js";import{T as hs}from"./table-BYzMA2MF.js";import{C as us}from"./calendar-CnsXUgOr.js";import{F as js}from"./flame-wMx8KIS8.js";import{S as gs}from"./snowflake-DxjZHYUy.js";import{T as fs}from"./trending-down-EHPUNHPt.js";import{M as Ns}from"./minus-Dry52jGc.js";import{E as ys}from"./external-link-Bd1Ktkpe.js";import"./separator-CQ84aZ0V.js";import"./collapsible-BIxz44zB.js";import"./skeleton-ClxqB572.js";import"./breadcrumb-CmKLwRya.js";import"./switch-BHj3-8MN.js";import"./index-D9-GACGG.js";import"./receipt-DnGXta2k.js";import"./building-crte1H4H.js";import"./file-text-Bif0RP8Y.js";import"./user-Cvsz7Lm_.js";import"./upload-BH1HltYO.js";import"./piggy-bank-DP-A2O0m.js";import"./landmark-C0TkBs1l.js";import"./users-xui-UtA1.js";import"./euro-Cc6O9qjZ.js";import"./eye-DKrvAixa.js";import"./dialog-DrI7Oddz.js";import"./tabs-5EVsfllK.js";import"./textarea-4z16PwID.js";import"./mountain-BHfTfCFy.js";import"./index-BdQq_4o_.js";import"./chevron-down-BDe4YKQW.js";import"./chevron-up-JyGCcpt9.js";import"./index-Dh4i1-J3.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const vs=le("ChartPie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const bs=le("GitCompareArrows",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const $e=le("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
17 * @license lucide-react v0.462.0 - ISC
18 *
19 * This source code is licensed under the ISC license.
20 * See the LICENSE file in the root directory of this source tree.
21 */const ws=le("ThermometerSun",[["path",{d:"M12 9a4 4 0 0 0-2 7.5",key:"1jvsq6"}],["path",{d:"M12 3v2",key:"1w22ol"}],["path",{d:"m6.6 18.4-1.4 1.4",key:"w2yidj"}],["path",{d:"M20 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"iof6y5"}],["path",{d:"M4 13H2",key:"118le4"}],["path",{d:"M6.34 7.34 4.93 5.93",key:"1brd51"}]]),ks=({language:i,selectedApartment:r,comparisonMode:d,secondApartment:o})=>e.jsxs("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-2 px-3 py-2.5 bg-muted/30 rounded-lg text-xs border",children:[e.jsx("span",{className:"text-muted-foreground font-semibold",children:i==="de"?"Legend
21a grafů:":"Chart legend:"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"text-muted-foreground",children:i==="de"?"Náklady:":"Costs:"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-3 h-3 rounded",style:{backgroundColor:"hsl(var(--primary))"}}),e.jsx("span",{children:r})]}),d&&o&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-3 h-3 rounded",style:{backgroundColor:"hsl(270, 70%, 55%)"}}),e.jsx("span",{children:o})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"text-muted-foreground",children:i==="de"?"Spotřeba:":"Consumption:"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-3 h-3 rounded",style:{backgroundColor:"hsl(220, 45%, 35%)"}}),e.jsx("span",{children:r})]}),d&&o&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-3 h-3 rounded",style:{backgroundColor:"hsl(270, 70%, 55%)"}}),e.jsx("span",{children:o})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"text-muted-foreground",children:i==="de"?"Podíl:":"Share:"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-3 h-3 rounded",style:{backgroundColor:"hsl(150, 60%, 45%)"}}),e.jsx("span",{children:r})]}),d&&o&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-3 h-3 rounded",style:{backgroundColor:"hsl(270, 70%, 55%)"}}),e.jsx("span",{children:o})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 border-l pl-4",children:[e.jsx("span",{className:"w-4 h-0.5 rounded",style:{backgroundColor:"hsl(45, 85%, 55%)"}}),e.jsx("span",{children:i==="de"?"Ø průměr domu":"Ø building average"})]})]}),Ss=({language:i,currentInfo:r,heatMeterInfo:d,totalPaidGross:o,totalPaidNet:k,apartmentHistory:g,ownerChanges:S,formatCurrency:h})=>{var p,j;return e.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[e.jsxs(V,{className:"border-l-4 border-l-primary",children:[e.jsxs(F,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(K,{className:"text-sm font-medium",children:i==="de"?"Wohnfläche":"Living Area"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("div",{className:"group relative",children:[e.jsx(R,{className:"h-3 w-3 text-muted-foreground cursor-help"}),e.jsx("div",{className:"absolute right-0 top-5 z-50 w-48 p-2 bg-popover border rounded-lg shadow-lg text-xs opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all",children:i==="de"?"Plocha bytu používaná pro výpočet nákladů na vytápění.":"Apartment area used for heating cost calculations."})]}),e.jsx(oe,{className:"h-4 w-4 text-primary"})]})]}),e.jsxs(W,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[((p=r.area_sqm)==null?void 0:p.toFixed(1))||"—"," m²"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i==="de"?"Heizfläche":"heating area"})]})]}),e.jsxs(V,{className:`border-l-4 ${(d==null?void 0:d.currentType)==="WMZ"?"border-l-purple-500":(d==null?void 0:d.currentType)==="HKV"?"border-l-blue-500":"border-l-orange-500"}`,children:[e.jsxs(F,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(K,{className:"text-sm font-medium",children:i==="de"?"Wärmemessung":"Heat Meters"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("div",{className:"group relative",children:[e.jsx(R,{className:"h-3 w-3 text-muted-foreground cursor-help"}),e.jsx("div",{className:"absolute right-0 top-5 z-50 w-56 p-2 bg-popover border rounded-lg shadow-lg text-xs opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all",children:i==="de"?"HKV = Heizkostenverteiler (měří relativní jednotky). WMZ = Wärmemengenzähler (měří kWh). Různé typy nelze přímo porovnat.":"HKV = Heat Cost Allocator (measures relative units). WMZ = Heat Meter (measures kWh). Different types cannot be directly compared."})]}),e.jsx(cs,{className:`h-4 w-4 ${(d==null?void 0:d.currentType)==="WMZ"?"text-purple-500":(d==null?void 0:d.currentType)==="HKV"?"text-blue-500":"text-orange-500"}`})]})]}),e.jsx(W,{children:d?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{className:De(d.currentType),children:d.currentLabel||(d.currentType==="unknown"?"—":d.currentType)}),d.hasMultipleTypes&&e.jsx(Z,{variant:"outline",className:"text-amber-600 border-amber-400",children:i==="de"?"gemischt":"mixed"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:d.currentType==="WMZ"?i==="de"?"Wärmemengenzähler (kWh)":"Heat Meter (kWh)":d.currentType==="HKV"?i==="de"?"Heizkostenverteiler (Einh.)":"Heat Cost Allocator (units)":i==="de"?"Unbekannter Typ":"Unknown type"})]}):e.jsx("div",{className:"text-lg font-bold",children:"—"})})]}),e.jsxs(V,{className:"border-l-4 border-l-green-600",children:[e.jsxs(F,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(K,{className:"text-sm font-medium",children:i==="de"?"Gesamt gezahlt":"Total Paid"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("div",{className:"group relative",children:[e.jsx(R,{className:"h-3 w-3 text-muted-foreground cursor-help"}),e.jsx("div",{className:"absolute right-0 top-5 z-50 w-48 p-2 bg-popover border rounded-lg shadow-lg text-xs opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all",children:i==="de"?"Celková částka zaplacená za vytápění a teplou vodu za celé sledované období.":"Total amount paid for heating and hot water over the entire tracked period."})]}),e.jsx(ce,{className:"h-4 w-4 text-green-600"})]})]}),e.jsxs(W,{children:[e.jsx("div",{className:"text-2xl font-bold",children:h(o)}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[i==="de"?"inkl. MwSt":"incl. VAT"," · ",h(k)," ",i==="de"?"netto":"net"]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[(j=g[0])==null?void 0:j.year,"–",r.year]})]})]}),e.jsxs(V,{className:"border-l-4 border-l-blue-500",children:[e.jsxs(F,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(K,{className:"text-sm font-medium",children:i==="de"?"Eigentümerwechsel":"Owner Changes"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("div",{className:"group relative",children:[e.jsx(R,{className:"h-3 w-3 text-muted-foreground cursor-help"}),e.jsx("div",{className:"absolute right-0 top-5 z-50 w-48 p-2 bg-popover border rounded-lg shadow-lg text-xs opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all",children:i==="de"?"Počet změn vlastníka bytu v daném období. Změna je detekována, když jsou v jednom roce dva záznamy s různými majiteli.":"Number of owner changes in the peri
21od. Change is detected when there are two records with different owners in one year."})]}),e.jsx(re,{className:"h-4 w-4 text-blue-500"})]})]}),e.jsxs(W,{children:[e.jsx("div",{className:"text-2xl font-bold",children:S.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i==="de"?"im Zeitraum":"in period"})]})]})]})},_s=({language:i,selectedApartment:r,comparisonMode:d,secondApartment:o,costPerSqmData:k})=>e.jsxs(V,{children:[e.jsxs(F,{className:"pb-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(K,{className:"text-base font-serif flex items-center gap-2",children:[e.jsx(Me,{className:"h-4 w-4 text-primary"}),i==="de"?"Kosten €/m²":"Costs €/m²",d&&o&&e.jsxs("span",{className:"text-violet-600 text-sm",children:[" vs ",o]})]}),e.jsxs("div",{className:"group relative",children:[e.jsx(R,{className:"h-4 w-4 text-muted-foreground cursor-help"}),e.jsxs("div",{className:"absolute right-0 top-6 z-50 w-64 p-3 bg-popover border rounded-lg shadow-lg text-sm opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all",children:[e.jsx("p",{className:"font-medium mb-1",children:i==="de"?"Was zeigt dieser Graf?":"What does this chart show?"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:i==="de"?"Průměrné náklady na vytápění na metr čtvereční plochy bytu. Sloupce ukazují náklady bytu, čára ukazuje průměr všech bytů v domě.":"Average heating costs per square meter of apartment area. Bars show apartment costs, line shows average of all apartments in building."})]})]})]}),e.jsx(me,{className:"text-xs",children:i==="de"?"Sloupce = byt, žlutá čára = Ø všech bytů (inkl. MwSt)":"Bars = apartment, yellow line = Ø all apartments (incl. VAT)"})]}),e.jsx(W,{children:k.length>0?e.jsx(de,{width:"100%",height:280,children:e.jsxs(ge,{data:k,children:[e.jsx(xe,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(pe,{dataKey:"year",className:"text-xs"}),e.jsx(he,{className:"text-xs",tickFormatter:g=>`${g.toFixed(0)}€`}),e.jsx(ue,{content:({active:g,payload:S,label:h})=>{var B;if(!g||!S||S.length===0)return null;const p=(B=S[0])==null?void 0:B.payload,j=(p==null?void 0:p.costPerSqm)||0,$=(p==null?void 0:p.costPerSqmNet)||0,b=(p==null?void 0:p.apt2CostPerSqm)||0,C=(p==null?void 0:p.apt2CostPerSqmNet)||0,u=(p==null?void 0:p.avgPerSqm)||0,G=(p==null?void 0:p.avgPerSqmNet)||0,N=u>0?(j-u)/u*100:0,z=u>0?(b-u)/u*100:0;return e.jsxs("div",{className:"bg-background border rounded-lg shadow-lg p-3 text-sm",children:[e.jsx("p",{className:"font-semibold mb-2",children:h}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-3 h-3 rounded",style:{backgroundColor:"hsl(var(--primary))"}}),r]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("span",{className:"font-medium",children:[j.toFixed(2)," €/m²",e.jsxs("span",{className:`ml-1 text-xs ${N>0?"text-red-500":N<0?"text-green-500":"text-muted-foreground"}`,children:["(",N>0?"+":"",N.toFixed(0),"%)"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[$.toFixed(2)," €/m² net"]})]})]}),d&&o&&b>0&&e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-3 h-3 rounded",style:{backgroundColor:"hsl(270, 70%, 55%)"}}),o]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("span",{className:"font-medium",children:[b.toFixed(2)," €/m²",e.jsxs("span",{className:`ml-1 text-xs ${z>0?"text-red-500":z<0?"text-green-500":"text-muted-foreground"}`,children:["(",z>0?"+":"",z.toFixed(0),"%)"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[C.toFixed(2)," €/m² net"]})]})]}),e.jsxs("div",{className:"flex justify-between gap-4 text-muted-foreground border-t pt-2 mt-2",children:[e.jsxs("span",{children:["Ø ",i==="de"?"alle":"all"]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("span",{children:[u.toFixed(2)," €/m²"]}),e.jsxs("p",{className:"text-xs",children:[G.toFixed(2)," €/m² net"]})]})]})]})]})}}),e.jsx(je,{wrapperStyle:{fontSize:"11px"},formatter:g=>g==="costPerSqm"?r:g==="apt2CostPerSqm"?o:"Ø"}),e.jsx(I,{dataKey:"costPerSqm",name:r,fill:"hsl(var(--primary))",radius:[4,4,0,0]}),d&&o&&e.jsx(I,{dataKey:"apt2CostPerSqm",name:o,fill:"hsl(270, 70%, 55%)",radius:[4,4,0,0]}),e.jsx(fe,{type:"monotone",dataKey:"avgPerSqm",name:"Ø",stroke:"hsl(45, 85%, 55%)",strokeWidth:2,dot:{fill:"hsl(45, 85%, 55%)",strokeWidth:2,r:4}})]})}):e.jsx("div",{className:"h-[280px] flex items-center justify-center text-muted-foreground",children:i==="de"?"Keine Daten":"No data"})})]}),Cs=({language:i,selectedApartment:r,comparisonMode:d,secondApartment:o,consumptionData:k})=>e.jsxs(V,{children:[e.jsxs(F,{className:"pb-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(K,{className:"text-base font-serif flex items-center gap-2",children:[e.jsx(ms,{className:"h-4 w-4 text-primary"}),i==="de"?"Verbrauch HKV/m²":"Consumption HKV/m²",d&&o&&e.jsxs("span",{className:"text-violet-600 text-sm",children:[" vs ",o]})]}),e.jsxs("div",{className:"group relative",children:[e.jsx(R,{className:"h-4 w-4 text-muted-foreground cursor-help"}),e.jsxs("div",{className:"absolute right-0 top-6 z-50 w-64 p-3 bg-popover border rounded-lg shadow-lg text-sm opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all",children:[e.jsx("p",{className:"font-medium mb-1",children:i==="de"?"Was zeigt dieser Graf?":"What does this chart show?"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:i==="de"?"Spotřeba tepla na metr čtvereční. HKV = jednotky z rozdělovače nákladů. Nižší hodnota = efektivnější vytápění. Průměr zahrnuje pouze byty s HKV měřiči.":"Heat consumption per square meter. HKV = units from heat cost allocator. Lower value = more efficient heating. Average includes only apartments with HKV meters."})]})]})]}),e.jsx(me,{className:"text-xs",children:i==="de"?"Nižší = efektivnější | Ø pouze HKV byty":"Lower = more efficient | Ø only HKV apartments"})]}),e.jsx(W,{children:k.length>0?e.jsx(de,{width:"100%",height:280,children:e.jsxs(ge,{data:k,children:[e.jsx(xe,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(pe,{dataKey:"year",className:"text-xs"}),e.jsx(he,{className:"text-xs",tickFormatter:g=>g.toFixed(0)}),e.jsx(ue,{content:({active:g,payload:S,label:h})=>{var G;if(!g||!S||S.length===0)return null;const p=(G=S[0])==null?void 0:G.payload,j=(p==null?void 0:p.hkvPerSqm)||0,$=(p==null?void 0:p.apt2HkvPerSqm)||0,b=(p==null?void 0:p.avgHkvPerSqm)||0,C=b>0?(j-b)/b*100:0,u=b>0?($-b)/b*100:0;return e.jsxs("div",{className:"bg-background border rounded-lg shadow-lg p-3 text-sm",children:[e.jsx("p",{className:"font-semibold mb-2",children:h}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-3 h-3 rounded",style:{backgroundColor:"hsl(220, 45%, 35%)"}}),r]}),e.jsxs("span",{className:"font-medium",children:[j.toFixed(1)," ",e.jsx("span",{className:"text-muted-foreground font-normal",children:"HKV/m²"}),e.jsxs("span",{className:`ml-1 text-xs ${C>0?"text-red-500":C<0?"text-green-500":"text-muted-foreground"}`,children:["(",C>0?"+":"",C.toFixed(0),"%)"]})]})]}),d&&o&&$>0&&e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-3 h-3 rounded",style:{backgroundColor:"hsl(270, 70%, 55%)"}}),o]}),e.jsxs("span",{className:"font-medium",children:[$.toFixed(1)," ",e.jsx("span",{className:"text-muted-foreground font-normal",children:"HKV/m²"}),e.jsxs("span",{className:`ml-1 text-xs ${u>0?"text-red-500":u<0?"text-green-500":"text-muted-foreground"}`,children:["(",u>0?"+":"",u.toFixed(0),"%)"]})]})]}),e.jsxs("div",{className:"flex justify-between gap-4 text-muted-foreground border-t pt-1 mt-1",children:[e.jsxs("span",{children:["Ø ",i==="de"?"alle":"all"]}),e.jsxs("span",{children:[b.toFixed(1)," HKV/m²"]})]})]})]})}}),e.jsx(je,{wrapperStyle:{fontSize:"11px"},formatter:g=>g==="hkvPerSqm"?r:g==="apt2HkvPerSqm"?o:"Ø"}),e.jsx(I,{dataKey:"hkvPerSqm",name:r,fill:"hsl(220, 45%, 35%)",radius:[4,4,0,0]}),d&&o&&e.jsx(I,{dataKey:"apt2HkvPerSqm",name:o,fill:"hsl(270, 70%, 55%)",radius:[4,4,0,0]}),e.jsx(fe,{type:"monotone",dataKey:"avgHkvPerSqm",name:"Ø",stroke:"hsl(45, 85%, 55%)",strokeWidth:2,dot:{fill:"hsl(45, 85%, 55%)",strokeWidth:2,r:4}})]})}):e.jsx("div",{className:"h-[280px] flex items-center justify-center text-muted-foreground",children:i==="de"?"Keine Daten":"No data"})})]}),qs=({language:i,selectedApartment:r,comparisonMode:d,secondApartment:o,costShareData:k,formatCurrency:g})=>e.jsxs(V,{children:[e.jsxs(F,{className:"pb-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(K,{className:"text-base font-serif flex items-center gap-2",children:[e.jsx(vs,{className:"h-4 w-4 text-primary"}),i==="de"?"Anteil an Gesamtkosten":"Share of Total Costs",d&&o&&e.jsxs("span",{className:"text-violet-600 text-sm",children:[" vs ",o]})]}),e.jsxs("div",{className:"group relative",children:[e.jsx(R,{className:"h-4 w-4 text-muted-foreground cursor-help"}),e.jsxs("div",{className:"absolute right-0 top-6 z-50 w-64 p-3 bg-popover border rounded-lg shadow-lg text-sm opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all",children:[e.jsx("p",{className:"font-medium mb-1",children:i==="de"?"Was zeigt dieser Graf?":"What does this chart show?"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:i==="de"?"Kolik procent z celkových nákladů na vytápění domu připadá na tento byt. Čárkovaná čára ukazuje, jaký by byl podíl, kdyby všechny byty platily stejně.":"How much percent of total building heating costs belongs to this apartment. Dashed line shows what share would be if all apartments paid equally."})]})]})]}),e.jsx(me,{className:"text-xs",children:i==="de"?"Sloupce = skutečný podíl, čárkovaná čára = rovnoměrný podíl":"Bars = actual share, dashed line = equal share"})]}),e.jsx(W,{children:k.length>0?e.jsx(de,{width:"100%",height:280,children:e.jsxs(ge,{data:k,children:[e.jsx(xe,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(pe,{dataKey:"year",className:"text-xs"}),e.jsx(he,{className:"text-xs",tickFormatter:S=>`${S.toFixed(1)}%`}),e.jsx(ue,{content:({active:S,payload:h,label:p})=>{var B;if(!S||!h||h.length===0)return null;const j=(B=h[0])==null?void 0:B.payload,$=(j==null?void 0:j.apt1Share)||0,b=(j==null?void 0:j.apt2Share)||0,C=(j==null?void 0:j.avgShare)||0,u=(j==null?void 0:j.apt1Costs)||0,G=(j==null?void 0:j.totalBuildingCosts)||0,N=C>0?($-C)/C*100:0,z=C>0?(b-C)/C*100:0;return e.jsxs("div",{className:"bg-background border rounded-lg shadow-lg p-3 text-sm",children:[e.jsx("p",{className:"font-semibold mb-2",children:p}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-3 h-3 rounded",style:{backgroundColor:"hsl(150, 60%, 45%)"}}),r]}),e.jsxs("span",{className:"font-medium",children:[$.toFixed(2),"%",e.jsxs("span",{className:`ml-1 text-xs ${N>0?"text-amber-500":N<0?"text-blue-500":"text-muted-foreground"}`,children:["(",N>0?"+":"",N.toFixed(0),"% ",i==="de"?"vs Ø":"vs avg",")"]})]})]}),d&&o&&b>0&&e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-3 h-3 rounded",style:{backgroundColor:"hsl(270, 70%, 55%)"}}),o]}),e.jsxs("span",{className:"font-medium",children:[b.toFixed(2),"%",e.jsxs("span",{className:`ml-1 text-xs ${z>0?"text-amber-500":z<0?"text-blue-500":"text-muted-foreground"}`,children:["(",z>0?"+":"",z.toFixed(0),"% ",i==="de"?"vs Ø":"vs avg",")"]})]})]}),e.jsxs("div",{className:"flex justify-between gap-4 text-muted-foreground border-t pt-1 mt-1",children:[e.jsxs("span",{children:["Ø ",i==="de"?"rovnoměrný podíl":"equal share"]}),e.jsxs("span",{children:[C.toFixed(2),"%"]})]}),e.jsxs("div",{className:"border-t pt-1 mt-1 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{children:[i==="de"?"Byt (brutto)":"Apt (gross)",":"]}),e.jsx("span",{children:g(u)})]}),e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsxs("span",{children:[i==="de"?"netto":"net",":"]}),e.jsx("span",{children:g((j==null?void 0:j.apt1CostsNet)||u/1.2)})]}),e.jsxs("div",{className:"flex justify-between mt-1",children:[e.jsxs("span",{children:[i==="de"?"Dům celkem (brutto)":"Building total (gross)",":"]}),e.jsx("span",{children:g(G)})]}),e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsxs("span",{children:[i==="de"?"netto":"net",":"]}),e.jsx("span",{children:g((j==null?void 0:j.totalBuildingCostsNet)||G/1.2)})]})]})]})]})}}),e.jsx(je,{wrapperStyle:{fontSize:"11px"},formatter:S=>S==="apt1Share"?r:S==="apt2Share"?o:"Ø"}),e.jsx(I,{dataKey:"apt1Share",name:r,fill:"hsl(150, 60%, 45%)",radius:[4,4,0,0]}),d&&o&&e.jsx(I,{dataKey:"apt2Share",name:o,fill:"hsl(270, 70%, 55%)",radius:[4,4,0,0]}),e.jsx(fe,{type:"monotone",dataKey:"avgShare",name:"Ø",stroke:"hsl(45, 85%, 55%)",strokeWidth:2,strokeDasharray:"5 5",dot:{fill:"hsl(45, 85%, 55%)",strokeWidth:2,r:4}})]})}):e.jsx("div",{className:"h-[280px] flex items-center justify-center text-muted-foreground",children:i==="de"?"Keine Daten":"No data"})})]}),Ps=({initialApartment:i})=>{var we,ke;const{language:r}=Ae(),d=Ie(),[o,k]=w.useState([]),[g,S]=w.useState(!0),[h,p]=w.useState(i||""),[j,$]=w.useState(1),[b,C]=w.useState(10),[u,G]=w.useState(!1),[N,z]=w.useState(""),B=w.useMemo(()=>[...new Set(o.map(s=>s.year))].sort((s,a)=>
21a-s),[o]),{selectedYear:L,setSelectedYear:Ne}=as(B);w.useEffect(()=>{Ge()},[]);const Ge=async()=>{const{data:s}=await Qe.from("apartment_heating_costs").select("*").order("year",{ascending:!0}).order("apartment_code",{ascending:!0});if(s){k(s);const a=[...new Set(s.map(l=>l.apartment_code))].sort();a.length>0&&!h&&p(a[0])}S(!1)},Y=w.useMemo(()=>[...new Set(o.map(s=>s.apartment_code))].sort((s,a)=>{const l=parseInt(s.replace(/\D/g,""))||0,t=parseInt(a.replace(/\D/g,""))||0;return l-t}),[o]),Oe=w.useMemo(()=>{if(!h)return null;const s=o.filter(x=>x.apartment_code===h);if(s.length===0)return null;const a=[...s].sort((x,f)=>f.year-x.year),l=a[0],t=X(l.flags),n=a.map(x=>({year:x.year,...X(x.flags)})),m=[...new Set(n.map(x=>x.type))].filter(x=>x!=="unknown");return{currentType:t.type,currentCount:t.count,currentLabel:t.label,uniqueTypes:m,hasMultipleTypes:m.length>1,history:n}},[o,h]),v=w.useMemo(()=>h?o.filter(s=>s.apartment_code===h).filter(s=>L==="all"||s.year===parseInt(L)).sort((s,a)=>a.year-s.year):[],[o,h,L]),q=w.useMemo(()=>!N||!u?[]:o.filter(s=>s.apartment_code===N).filter(s=>L==="all"||s.year===parseInt(L)).sort((s,a)=>a.year-s.year),[o,N,u,L]),O=w.useMemo(()=>{if(!u||q.length===0)return null;const s=q[q.length-1],a=q.reduce((n,m)=>n+Number(m.total_gross_eur),0),l=q.reduce((n,m)=>n+Number(m.heating_net_eur)+Number(m.warmwater_net_eur),0),t=q.reduce((n,m)=>n+(Number(m.avg_price_per_sqm)||0),0)/q.length;return{currentInfo:s,totalPaidGross:a,totalPaidNet:l,avgPricePerSqm:t}},[u,q]),Ee=w.useMemo(()=>{const s=(j-1)*b;return v.slice(s,s+b)},[v,j,b]),Be=Math.ceil(v.length/b),E=w.useMemo(()=>{const s=[],a={};return v.forEach(l=>{a[l.year]||(a[l.year]=[]),a[l.year].push(l)}),Object.entries(a).forEach(([,l])=>{if(l.length>=2){const t=l.sort((x,f)=>(x.period_start||"").localeCompare(f.period_start||"")),n=t[0],m=t[1];n.owner_name&&m.owner_name&&s.push({year:n.year,from:n.owner_name,to:m.owner_name})}}),s.sort((l,t)=>t.year-l.year)},[v]),Q=w.useMemo(()=>{const s={};return[...new Set(o.map(l=>l.year))].forEach(l=>{const t=o.filter(c=>c.year===l),n={};t.forEach(c=>{const _=c.apartment_code,U=X(c.flags);n[_]||(n[_]={total:0,perSqm:[],hkvPerSqm:[],meterType:U.type}),n[_].total+=Number(c.heating_net_eur)+Number(c.warmwater_net_eur),c.avg_price_per_sqm&&n[_].perSqm.push(Number(c.avg_price_per_sqm)),c.area_sqm&&c.consumption_units&&n[_].hkvPerSqm.push(Number(c.consumption_units)/Number(c.area_sqm)),n[_].meterType=U.type});const m=Object.values(n),x=m.length>0?m.reduce((c,_)=>c+_.total,0)/m.length:0,f=m.flatMap(c=>c.perSqm).filter(c=>c>0),P=f.length>0?f.reduce((c,_)=>c+_,0)/f.length:0,T=m.filter(c=>c.meterType==="HKV").flatMap(c=>c.hkvPerSqm).filter(c=>c>0),y=T.length>0?T.reduce((c,_)=>c+_,0)/T.length:0;s[l]={avgTotal:x,avgPerSqm:P,avgHkvPerSqm:y}}),s},[o]),ee=w.useMemo(()=>{const s=[],a=v.filter(t=>t.consumption_units&&t.area_sqm&&Number(t.consumption_units)>0).map(t=>Number(t.consumption_units)/Number(t.area_sqm)),l=a.length>0?a.reduce((t,n)=>t+n,0)/a.length:0;return v.forEach(t=>{if(X(t.flags).type==="unknown"&&s.push({type:"missing_meter",year:t.year,message:r==="de"?`${t.year}: Chybí typ měřiče (HKV/WMZ)`:`${t.year}: Missing meter type (HKV/WMZ)`,severity:"warning"}),(!t.consumption_units||Number(t.consumption_units)===0)&&s.push({type:"missing_consumption",year:t.year,message:r==="de"?`${t.year}: Chybí data o spotřebě`:`${t.year}: Missing consumption data`,severity:"warning"}),t.consumption_units&&t.area_sqm&&l>0){const m=Number(t.consumption_units)/Number(t.area_sqm);m>l*5?s.push({type:"anomaly",year:t.year,message:r==="de"?`${t.year}: Extrémně vysoká spotřeba (${m.toFixed(1)} jednotek/m², průměr: ${l.toFixed(1)})`:`${t.year}: Extremely high consumption (${m.toFixed(1)} units/m², avg: ${l.toFixed(1)})`,severity:"error"}):m<l*.1&&m>0&&s.push({type:"anomaly",year:t.year,message:r==="de"?`${t.year}: Neobvykle nízká spotřeba (${m.toFixed(1)} jednotek/m², průměr: ${l.toFixed(1)})`:`${t.year}: Unusually low consumption (${m.toFixed(1)} units/m², avg: ${l.toFixed(1)})`,severity:"warning"})}}),s},[v,r]),Le=w.useMemo(()=>{const s={};v.forEach(t=>{s[t.year]||(s[t.year]={perSqmValues:[],hasOwnerChange:!1}),t.avg_price_per_sqm&&s[t.year].perSqmValues.push(Number(t.avg_price_per_sqm)),s[t.year].hasOwnerChange=E.some(n=>n.year===t.year)});const a={};u&&q.length>0&&q.forEach(t=>{a[t.year]||(a[t.year]={perSqmValues:[]}),t.avg_price_per_sqm&&a[t.year].perSqmValues.push(Number(t.avg_price_per_sqm))});const l=new Set([...Object.keys(s).map(Number),...Object.keys(a).map(Number)]);return Array.from(l).sort((t,n)=>t-n).map(t=>{var _;const n=s[t],m=a[t],x=(n==null?void 0:n.perSqmValues.length)>0?n.perSqmValues.reduce((U,ie)=>U+ie,0)/n.perSqmValues.length:0,f=(m==null?void 0:m.perSqmValues.length)>0?m.perSqmValues.reduce((U,ie)=>U+ie,0)/m.perSqmValues.length:0,P=((_=Q[t])==null?void 0:_.avgPerSqm)||0,H=P*1.2,T=x*1.2,y=f*1.2,c=H>0?T/H*100:0;return{year:String(t),costPerSqm:T,costPerSqmNet:x,apt2CostPerSqm:y,apt2CostPerSqmNet:f,avgPerSqm:H,avgPerSqmNet:P,hasOwnerChange:(n==null?void 0:n.hasOwnerChange)||!1,percentOfAvg:c,consumptionLevel:c>150?"high":c<75?"low":"normal"}})},[v,q,Q,E,u]),Ye=w.useMemo(()=>{const s={};v.forEach(t=>{s[t.year]||(s[t.year]={hkvPerSqmValues:[],hasOwnerChange:!1}),t.area_sqm&&t.consumption_units&&s[t.year].hkvPerSqmValues.push(Number(t.consumption_units)/Number(t.area_sqm)),s[t.year].hasOwnerChange=E.some(n=>n.year===t.year)});const a={};u&&q.length>0&&q.forEach(t=>{a[t.year]||(a[t.year]={hkvPerSqmValues:[]}),t.area_sqm&&t.consumption_units&&a[t.year].hkvPerSqmValues.push(Number(t.consumption_units)/Number(t.area_sqm))});const l=new Set([...Object.keys(s).map(Number),...Object.keys(a).map(Number)]);return Array.from(l).sort((t,n)=>t-n).map(t=>{var T;const n=s[t],m=a[t],x=(n==null?void 0:n.hkvPerSqmValues.length)>0?n.hkvPerSqmValues.reduce((y,c)=>y+c,0)/n.hkvPerSqmValues.length:0,f=(m==null?void 0:m.hkvPerSqmValues.length)>0?m.hkvPerSqmValues.reduce((y,c)=>y+c,0)/m.hkvPerSqmValues.length:0,P=((T=Q[t])==null?void 0:T.avgHkvPerSqm)||0,H=P>0?x/P*100:0;return{year:String(t),hkvPerSqm:x,apt2HkvPerSqm:f,avgHkvPerSqm:P,hasOwnerChange:(n==null?void 0:n.hasOwnerChange)||!1,percentOfAvg:H,consumptionLevel:H>150?"high":H<75?"low":"normal"}})},[v,q,Q,E,u]),Ze=w.useMemo(()=>[...new Set(o.map(a=>a.year))].sort((a,l)=>a-l).map(a=>{const l=o.filter(y=>y.year===a),t=l.reduce((y,c)=>y+Number(c.total_gross_eur),0),n=l.reduce((y,c)=>y+Number(c.heating_net_eur)+Number(c.warmwater_net_eur),0),m=l.filter(y=>y.apartment_code===h).reduce((y,c)=>y+Number(c.total_gross_eur),0),x=l.filter(y=>y.apartment_code===h).reduce((y,c)=>y+Number(c.heating_net_eur)+Number(c.warmwater_net_eur),0),f=t>0?m/t*100:0;let P=0;if(u&&N){const y=l.filter(c=>c.apartment_code===N).reduce((c,_)=>c+Number(_.total_gross_eur),0);P=t>0?y/t*100:0}const H=new Set(l.map(y=>y.apartment_code)).size,T=H>0?100/H:0;return{year:String(a),apt1Share:f,apt2Share:P,avgShare:T,apt1Costs:m,apt1CostsNet:x,totalBuildingCosts:t,totalBuildingCostsNet:n}
21}),[o,h,N,u]),Re=s=>{var n;if(!s.consumption_units||!s.area_sqm)return{level:"unknown",percent:0};const a=Number(s.consumption_units)/Number(s.area_sqm),l=((n=Q[s.year])==null?void 0:n.avgHkvPerSqm)||0;if(l===0)return{level:"unknown",percent:0};const t=a/l*100;return{level:t>150?"high":t>120?"above":t<75?"low":t<90?"below":"normal",percent:t,consumptionPerSqm:a}},se=v.length>0?v[v.length-1]:null,ae=v.reduce((s,a)=>s+Number(a.total_gross_eur),0),ye=v.reduce((s,a)=>s+Number(a.heating_net_eur)+Number(a.warmwater_net_eur),0),A=s=>new Intl.NumberFormat(r==="de"?"de-DE":"en-GB",{style:"currency",currency:"EUR"}).format(s),ne=s=>s?new Date(s).toLocaleDateString(r==="de"?"de-DE":"en-GB",{day:"2-digit",month:"2-digit",year:"numeric"}):"—",Ue=(s,a)=>{if(!a)return"neutral";const l=(s-a)/a*100;return l>5?"up":l<-5?"down":"neutral"};if(g)return e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(es,{className:"h-8 w-8 animate-spin text-primary"})});const te=Y.indexOf(h),ve=te>0,be=te<Y.length-1,Je=()=>{ve&&p(Y[te-1])},Xe=()=>{be&&p(Y[te+1])};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(J,{variant:"outline",size:"icon",className:"h-9 w-9",onClick:Je,disabled:!ve,title:r==="de"?"Vorheriges Apartment":"Previous apartment",children:e.jsx(ds,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(oe,{className:"h-5 w-5 text-primary"}),e.jsxs(He,{value:h,onValueChange:p,children:[e.jsx(Te,{className:"w-[140px]",children:e.jsx(ze,{placeholder:r==="de"?"Wählen...":"Select..."})}),e.jsx(Ve,{children:Y.map(s=>e.jsx(Fe,{value:s,children:s},s))})]})]}),e.jsx(J,{variant:"outline",size:"icon",className:"h-9 w-9",onClick:Xe,disabled:!be,title:r==="de"?"Nächstes Apartment":"Next apartment",children:e.jsx(xs,{className:"h-4 w-4"})}),e.jsxs("span",{className:"text-sm text-muted-foreground ml-2",children:[te+1," / ",Y.length]})]}),e.jsxs(J,{variant:u?"default":"outline",size:"sm",onClick:()=>{if(G(!u),!u&&!N){const s=Y.find(a=>a!==h);s&&z(s)}},className:"gap-2",children:[e.jsx(bs,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:r==="de"?"Vergleichen":"Compare"})]}),u&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-medium text-violet-600",children:"Apt. 2:"})}),e.jsxs(He,{value:N,onValueChange:z,children:[e.jsx(Te,{className:"w-[140px] border-violet-300 focus:ring-violet-500",children:e.jsx(ze,{placeholder:r==="de"?"Wählen...":"Select..."})}),e.jsx(Ve,{children:Y.filter(s=>s!==h).map(s=>e.jsx(Fe,{value:s,children:s},s))})]}),e.jsx(J,{variant:"ghost",size:"icon",onClick:()=>G(!1),className:"h-8 w-8",children:e.jsx(ss,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[e.jsx(J,{variant:L==="all"?"default":"outline",size:"sm",onClick:()=>Ne("all"),className:"h-7 px-2 text-xs",children:r==="de"?"Alle":"All"}),B.map(s=>e.jsx(J,{variant:L===String(s)?"default":"outline",size:"sm",onClick:()=>Ne(String(s)),className:"h-7 px-2 text-xs",children:s},s))]}),e.jsx(Se,{children:e.jsxs(_e,{children:[e.jsx(Ce,{asChild:!0,children:e.jsx("div",{className:"w-6 h-6 rounded-full bg-muted flex items-center justify-center cursor-help hover:bg-muted/80",children:e.jsx(ps,{className:"h-4 w-4 text-muted-foreground"})})}),e.jsx(qe,{className:"max-w-sm",children:e.jsxs("div",{className:"space-y-2 text-xs",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"HKV"})," = Heizkostenverteiler (",r==="de"?"Elektronische Messgeräte an Heizkörpern":"Electronic heat cost allocators on radiators",")"]}),e.jsxs("p",{children:[e.jsx("strong",{children:"WMZ"})," = Wärmemengenzähler (",r==="de"?"Wärmezähler in kWh":"Heat meters measuring kWh",")"]}),e.jsxs("p",{children:[e.jsx("strong",{children:"VAT"})," = ",r==="de"?"Mehrwertsteuer (MwSt.)":"Value Added Tax"]}),e.jsxs("p",{children:[e.jsx("strong",{children:"sqm/m²"})," = ",r==="de"?"Quadratmeter (Wohnfläche)":"Square meters (living area)"]})]})})]})})]}),h&&se&&e.jsxs(e.Fragment,{children:[u&&O?e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs(V,{className:"border-l-4 border-l-primary",children:[e.jsxs(F,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(K,{className:"text-sm font-medium",children:r==="de"?"Wo
21hnfläche":"Living Area"}),e.jsx(oe,{className:"h-4 w-4 text-primary"})]}),e.jsxs(W,{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("span",{className:"text-sm font-medium text-primary",children:[h,":"]}),e.jsxs("span",{className:"text-lg font-bold",children:[((we=se.area_sqm)==null?void 0:we.toFixed(1))||"—"," m²"]})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("span",{className:"text-sm font-medium text-violet-600",children:[N,":"]}),e.jsxs("span",{className:"text-lg font-bold",children:[((ke=O.currentInfo.area_sqm)==null?void 0:ke.toFixed(1))||"—"," m²"]})]}),e.jsxs("div",{className:"border-t pt-2 flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:r==="de"?"Unterschied:":"Difference:"}),e.jsxs("span",{className:Number(se.area_sqm)>Number(O.currentInfo.area_sqm)?"text-primary":"text-violet-600",children:[(Number(se.area_sqm||0)-Number(O.currentInfo.area_sqm||0)).toFixed(1)," m²"]})]})]})]}),e.jsxs(V,{className:"border-l-4 border-l-green-600",children:[e.jsxs(F,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(K,{className:"text-sm font-medium",children:r==="de"?"Gesamt gezahlt":"Total Paid"}),e.jsx(ce,{className:"h-4 w-4 text-green-600"})]}),e.jsxs(W,{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("span",{className:"text-sm font-medium text-primary",children:[h,":"]}),e.jsxs("div",{className:"text-right",children:[e.jsx("span",{className:"text-lg font-bold",children:A(ae)}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[A(ye)," net"]})]})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("span",{className:"text-sm font-medium text-violet-600",children:[N,":"]}),e.jsxs("div",{className:"text-right",children:[e.jsx("span",{className:"text-lg font-bold",children:A(O.totalPaidGross)}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[A(O.totalPaidNet)," net"]})]})]}),e.jsxs("div",{className:"border-t pt-2 flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:r==="de"?"Unterschied:":"Difference:"}),e.jsx("span",{className:ae>O.totalPaidGross?"text-red-500":"text-green-500",children:A(ae-O.totalPaidGross)})]})]})]}),e.jsxs(V,{className:"border-l-4 border-l-blue-500",children:[e.jsxs(F,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(K,{className:"text-sm font-medium",children:r==="de"?"Prům. €/m²":"Avg €/m²"}),e.jsx(Me,{className:"h-4 w-4 text-blue-500"})]}),e.jsx(W,{className:"space-y-2",children:(()=>{const s=v.reduce((n,m)=>n+(Number(m.avg_price_per_sqm)||0),0)/v.length,a=s*1.2,l=O.avgPricePerSqm,t=l*1.2;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("span",{className:"text-sm font-medium text-primary",children:[h,":"]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("span",{className:"text-lg font-bold",children:[a.toFixed(2)," €"]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.toFixed(2)," € net"]})]})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("span",{className:"text-sm font-medium text-violet-600",children:[N,":"]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("span",{className:"text-lg font-bold",children:[t.toFixed(2)," €"]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[l.toFixed(2)," € net"]})]})]}),e.jsxs("div",{className:"border-t pt-2 flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:r==="de"?"Unterschied:":"Difference:"}),e.jsxs("span",{className:a>t?"text-red-500":"text-green-500",children:[(a-t).toFixed(2)," €/m²"]})]})]})})()})]})]}):e.jsx(Ss,{language:r,currentInfo:se,heatMeterInfo:Oe,totalPaidGross:ae,totalPaidNet:ye,apartmentHistory:v,ownerChanges:E,formatCurrency:A}),E.length>0&&e.jsxs(V,{className:"border-amber-500/50 bg-amber-50/50 dark:bg-amber-950/20",children:[e.jsx(F,{className:"pb-2",children:e.jsxs(K,{className:"text-sm font-medium flex items-center gap-2 text-amber-600",children:[e.jsx(re,{className:"h-4 w-4"}),r==="de"?"Eigentümerwechsel":"Owner Changes"]})}),e.jsx(W,{children:e.jsx("div",{className:"flex flex-wrap gap-4",children:E.map((s,a)=>e.jsxs("div",{className:"text-sm",children:[e.jsx(Z,{variant:"outline",className:"mr-2",children:s.year}),e.jsx("span",{className:"text-muted-foreground",children:s.from}),e.jsx("span",{className:"mx-2",children:"→"}),e.jsx("span",{className:"font-medium",children:s.to})]},a))})})]}),(()=>{const s=new Set(v.map(l=>X(l.flags).type));return s.size>1&&s.has("WMZ")&&s.has("HKV")&&e.jsxs(Ke,{className:"border-amber-500 bg-amber-50 dark:bg-amber-950/20",children:[e.jsx(re,{className:"h-4 w-4 text-amber-600"}),e.jsx(We,{className:"text-amber-700 dark:text-amber-400",children:r==="de"?"Achtung: Dieses Apartment verwendet verschiedene Messgerätetypen (HKV/WMZ) in unterschiedlichen Jahren. Verbrauchswerte sind nicht direkt vergleichbar!":"Warning: This apartment uses different meter types (HKV/WMZ) in different years. Consumption values are not directly comparable!"})]})})(),ee.length>0&&e.jsxs(Ke,{variant:"destructive",className:"border-red-500/50 bg-red-50/50 dark:bg-red-950/20",children:[e.jsx(re,{className:"h-4 w-4"}),e.jsxs(We,{children:[e.jsx("div",{className:"font-medium mb-2",children:r==="de"?"Problémy s kvalitou dat:":"Data quality issues:"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-sm",children:[ee.slice(0,5).map((s,a)=>e.jsx("li",{className:s.severity==="error"?"text-red-600 dark:text-red-400":"text-amber-600 dar
21k:text-amber-400",children:s.message},a)),ee.length>5&&e.jsxs("li",{className:"text-muted-foreground",children:["... ",r==="de"?`a ${ee.length-5} dalších`:`and ${ee.length-5} more`]})]})]})]}),e.jsx(ks,{language:r,selectedApartment:h,comparisonMode:u,secondApartment:N}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx(_s,{language:r,selectedApartment:h,comparisonMode:u,secondApartment:N,costPerSqmData:Le}),e.jsx(Cs,{language:r,selectedApartment:h,comparisonMode:u,secondApartment:N,consumptionData:Ye})]}),e.jsx(qs,{language:r,selectedApartment:h,comparisonMode:u,secondApartment:N,costShareData:Ze,formatCurrency:A}),e.jsxs(V,{children:[e.jsxs(F,{children:[e.jsxs(K,{className:"font-serif flex items-center gap-2",children:[e.jsx(hs,{className:"h-5 w-5 text-primary"}),r==="de"?"Komplette Historie":"Complete History"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:r==="de"?`Heizkostenabrechnung für Apartment ${h}`:`Heating cost statement for apartment ${h}`})]}),e.jsxs(W,{children:[e.jsx("div",{className:"rounded-md border overflow-x-auto",children:e.jsxs(ns,{children:[e.jsx(ls,{children:e.jsxs(Pe,{children:[e.jsx(D,{children:r==="de"?"Jahr":"Year"}),e.jsx(D,{children:r==="de"?"Zeitraum":"Period"}),e.jsx(D,{className:"text-right",children:r==="de"?"Tage":"Days"}),e.jsx(D,{children:r==="de"?"Messgerät":"Meter"}),e.jsx(D,{className:"text-right",children:r==="de"?"Einheiten":"Units"}),e.jsx(D,{className:"text-right",children:r==="de"?"Spotřeba/m²":"Cons./m²"}),e.jsx(D,{className:"text-right",children:r==="de"?"Heizung":"Heating"}),e.jsx(D,{className:"text-right",children:r==="de"?"Warmwasser":"Warm Water"}),e.jsx(D,{className:"text-right font-bold",children:r==="de"?"Gesamt":"Total"}),e.jsx(D,{className:"text-right",children:"€/m²"}),e.jsx(D,{children:"Trend"})]})}),e.jsx(is,{children:Ee.map((s,a)=>{const l=v.findIndex(f=>f.id===s.id),t=l>0?v[l-1]:null,n=t?Ue(Number(s.total_gross_eur),Number(t.total_gross_eur)):"neutral",m=E.some(f=>f.year===s.year),x=Re(s);return e.jsxs(Pe,{className:`cursor-pointer hover:bg-muted/50 transition-colors ${m?"bg-amber-50 dark:bg-amber-950/20":""}`,onClick:()=>d(`/costs/heating/${s.id}?returnTo=/costs?tab=heating&subtab=history&apartment=${encodeURIComponent(h)}`),children:[e.jsx(M,{className:"font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[s.year,m&&e.jsx(Z,{variant:"outline",className:"text-xs text-amber-600 border-amber-500",children:r==="de"?"Wechsel":"Change"})]})}),e.jsxs(M,{className:"text-sm text-muted-foreground",children:[ne(s.period_start)," – ",ne(s.period_end)]}),e.jsx(M,{className:"text-right text-sm",children:s.period_start&&s.period_end?(()=>{const f=Math.round((new Date(s.period_end).getTime()-new Date(s.period_start).getTime())/864e5)+1,P=f<365,H=E.some(T=>T.year===s.year);return e.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[e.jsx("span",{className:P?"font-medium":"",children:f}),P&&e.jsx(Se,{children:e.jsxs(_e,{children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(Z,{variant:"outline",className:"text-[10px] bg-amber-50 dark:bg-amber-950 text-amber-600 dark:text-amber-400 border-amber-300 dark:border-amber-700 gap-1 cursor-help",children:[e.jsx(us,{className:"h-3 w-3"}),r==="de"?"Kurz":"Short"]})}),e.jsx(qe,{side:"top",className:"max-w-xs",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"font-medium",children:[ne(s.period_start)," – ",ne(s.period_end)]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[f," ",r==="de"?"Tage":"days"," (",Math.round(f/365*100),"%)"]}),H&&e.jsxs("p",{className:"text-xs text-amber-600 flex items-center gap-1",children:[e.jsx(re,{className:"h-3 w-3"}),r==="de"?"Eigentümerwechsel":"Owner change"]})]})})]})})]})})():"—"}),e.jsx(M,{children:(()=>{const f=X(s.flags);return e.jsx(Z,{variant:"outline",className:`text-[10px] ${De(f.type)}`,children:f.label})})()}),e.jsx(M,{className:"text-right font-medium",children:s.consumption_units&&Number(s.consumption_units)>0?Number(s.consumption_units).toFixed(1):e.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[e.jsx("span",{className:"text-muted-foreground",children:"0"}),e.jsxs(Z,{variant:"outline",className:"text-[10px] bg-slate-100 dar
21k:bg-slate-800 text-slate-600 dark:text-slate-400 border-slate-300 dark:border-slate-600 gap-1",children:[e.jsx($e,{className:"h-3 w-3"}),r==="de"?"Leer":"Empty"]})]})}),e.jsx(M,{className:"text-right",children:x.consumptionPerSqm?e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("span",{className:`font-medium ${x.level==="high"?"text-red-600 dark:text-red-400":x.level==="above"?"text-orange-500 dark:text-orange-400":x.level==="low"?"text-green-600 dark:text-green-400":x.level==="below"?"text-emerald-500 dark:text-emerald-400":""}`,children:x.consumptionPerSqm.toFixed(1)}),x.level==="high"&&e.jsx("span",{title:`${x.percent.toFixed(0)}% průměru`,children:e.jsx(js,{className:"h-4 w-4 text-red-500"})}),x.level==="above"&&e.jsx("span",{title:`${x.percent.toFixed(0)}% průměru`,children:e.jsx(ws,{className:"h-4 w-4 text-orange-500"})}),(x.level==="low"||x.level==="below")&&e.jsx("span",{title:`${x.percent.toFixed(0)}% průměru`,children:e.jsx(gs,{className:"h-4 w-4 text-emerald-500"})}),e.jsxs("span",{className:`text-[10px] ${x.level==="high"?"text-red-500":x.level==="above"?"text-orange-500":x.level==="low"||x.level==="below"?"text-green-500":"text-muted-foreground"}`,children:["(",x.percent.toFixed(0),"%)"]})]}):e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e.jsx("span",{className:"text-muted-foreground",children:"—"}),(!s.consumption_units||Number(s.consumption_units)===0)&&e.jsx("span",{title:r==="de"?"Leerstand":"Vacancy",children:e.jsx($e,{className:"h-3.5 w-3.5 text-slate-400"})})]})}),e.jsx(M,{className:"text-right",children:A(s.heating_net_eur)}),e.jsx(M,{className:"text-right",children:A(s.warmwater_net_eur)}),e.jsx(M,{className:"text-right font-bold",children:A(s.total_gross_eur)}),e.jsx(M,{className:"text-right",children:s.avg_price_per_sqm?A(s.avg_price_per_sqm):"—"}),e.jsx(M,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[n==="up"&&e.jsx(ce,{className:"h-4 w-4 text-destructive"}),n==="down"&&e.jsx(fs,{className:"h-4 w-4 text-green-600"}),n==="neutral"&&e.jsx(Ns,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(ys,{className:"h-4 w-4 text-muted-foreground"})]})})]},s.id)})})]})}),e.jsx(os,{currentPage:j,totalPages:Be,pageSize:b,totalItems:v.length,onPageChange:$,onPageSizeChange:s=>{C(s),$(1)},language:r})]})]})]})]})},qt=()=>{const{language:i}=Ae(),[r]=ts(),d=r.get("apartment"),o={de:{title:"Apartments",description:"Heizkosten-Historie nach Apartment",costs:"Kosten",heating:"Heizkosten",apartments:"Apartments"},en:{title:"Apartments",description:"Heating cost history by apartment",costs:"Costs",heating:"Heating",apartments:"Apartments"},cs:{title:"Byty",description:"Historie nákladů na vytápění podle bytu",costs:"Náklady",heating:"Vytápění",apartments:"Byty"}},k=o[i]||o.cs,g=[{label:k.costs,href:"/owners/costs"},{label:k.heating,href:"/owners/costs/heating"},{label:k.apartments}];return d&&(g[g.length-1]={label:d}),e.jsx(rs,{title:d?`${k.apartments}: ${d}`:k.title,description:k.description,breadcrumbs:g,children:e.jsx(Ps,{initialApartment:d||void 0})})};export{qt as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.