PageSourceSearch

https://www.temperatur.nu/assets/Kiosk-Bi12HLgw.js

js temperatur.nu collected 2026-09-25 20:49:56 UTC 29,962 bytes, 445 lines download raw bytes

1import{R as N,j as e,d as M,q as r,r as s,f as D,k as Be,Y as Ge,l as Ue,G as Qe,K as Ye,m as Ve,n as Z,o as Je,A as Xe,W as qe}from"./index-DuBzt8AY.js";import{H as Ze}from"./Helmet-DdjTVSHf.js";import{R as et,C as tt,a as fe,L as je,X as nt,Y as Se,T as ot,B as it,b as st}from"./generateCategoricalChart-CG1DXusU.js";import{C as rt}from"./ComposedChart-WYLzFVrz.js";import{a as at}from"./remapRow-DATCQPfU.js";const ee=n=>n?parseFloat(n.replace(",",".")):null,te=52,ze=58,De=5,lt=te,ct=ze+De,dt=(n,o=1)=>{const i=typeof window<"u"?Math.min(window.devicePixelRatio||1,2):1,p=Math.round(n/12)*(i>1?1.2:1)*o;return Math.max(10,Math.min(100,Math.round(p)))},ft=n=>{const o=n.map((i,l)=>({index:l,rawTime:i.time,time:M(i.time).format("HH"),temp:ee(i.temp),precipitation:ee(i.precipitation),wind:ee(i.wind),humidity:ee(i.humidity),symbol:i.symbol||"",windDirection:i.windDirection}));for(let i=1;i<o.length;i++)!o[i].symbol&&o[i-1].symbol&&(o[i].symbol=o[i-1].symbol);for(let i=o.length-2;i>=0;i--)!o[i].symbol&&o[i+1].symbol&&(o[i].symbol=o[i+1].symbol);return o},pt=n=>{const o=[];let i=null;return n.forEach((l,p)=>{const h=M(l.rawTime).format("YYYY-MM-DD");!i||i.dateKey!==h?(i={dateKey:h,label:M(l.rawTime).format("ddd D MMM"),startIndex:p,endIndex:p},o.push(i)):i.endIndex=p}),o},ut=(n,o)=>{const i=o-n;let l;i<=8?l=2:i<=20?l=4:l=5;const p=Math.floor(n/l)*l,h=Math.ceil(o/l)*l,x=[];for(let b=p;b<=h;b+=l)x.push(b);return{domainMin:p,domainMax:h,ticks:x}},xt=r.div`
2  display: flex;
3  padding: 0 ${ct}px 0 ${lt}px;
4  margin-top: 4px;
5  overflow: hidden;
6`,ht=r.div`
7  flex: 1;
8  display: flex;
9  flex-direction: column;
10  align-items: center;
11  justify-content: center;
12  font-size: ${({total:n})=>n>32?15:n>20?17:20}px;
13  font-weight: 600;
14  font-family: 'Roboto', sans-serif;
15  color: #333;
16  min-width: 0;
17  gap: 2px;
18`,gt=r.span`
19  display: inline-block;
20  transform: rotate(${n=>n.deg}deg);
21  line-height: 1;
22  font-size: 1.2em;
23  color: #555;
24`,mt={fontSize:14,fontFamily:"'Roboto', sans-serif",padding:"8px 12px",borderRadius:8,border:"1px solid rgba(0,0,0,0.12)",background:"#fff"},kt=(n,o)=>{if(n==null)return["-",o];const i={temp:"Temperatur",precipitation:"Nederbörd",wind:"Vind",humidity:"Luftfuktighet"},l={temp:"°C",precipitation:" mm",wind:" m/s",humidity:"%"};return[`${String(n).replace(".",",")}${l[o]||""}`,i[o]||o]},bt=(n,o)=>o&&o.length>0&&o[0].payload.rawTime?M(o[0].payload.rawTime).format("ddd D MMM HH:mm"):n,yt=n=>({fontSize:Math.max(12,Math.min(18,Math.round(n/22))),fontFamily:"'Roboto', sans-serif"}),wt=n=>{const{x:o,y:i,payload:l,data:p,chartHeight:h}=n;if(!p)return null;const x=l.value,b=p[x];if(!b)return null;const m=b.time==="00";if(!(p.length<=26||x%2===0))return null;const k=Math.max(12,Math.min(18,Math.round((h||300)/20)));return e.jsx("text",{x:o,y:i-1,textAnchor:"middle",fontSize:k,fontFamily:"'Roboto', sans-serif",fontWeight:m?700:400,fill:"#222",children:b.time})},vt=n=>{const{viewBox:o,value:i,chartHeight:l,topMargin:p}=n;if(!o)return null;const h=Math.max(13,Math.min(20,Math.round((l||300)/18))),x=(p||65)-2;return e.jsx("text",{x:o.x+6,y:x,fontSize:h,fontFamily:"'Quicksand', sans-serif",fontWeight:700,fill:"#111",children:i})},jt=n=>{const{value:o,chartLeft:i,chartHeight:l,topMargin:p}=n,h=Math.max(13,Math.min(20,Math.round((l||300)/18))),x=(p||65)-2;return e.jsx("text",{x:i+4,y:x,fontSize:h,fontFamily:"'Quicksand', sans-serif",fontWeight:700,fill:"#111",children:o})},St=n=>{const{cx:o,cy:i,payload:l,index:p,totalPoints:h,iconSz:x}=n;if(o==null||i==null)return null;const b=h<=24||p%2===0,m=x||28,j=i-m-4;if(b&&l.symbol&&l.symbol!==""){const k=`/weather/${l.symbol}.svg`;return e.jsxs("g",{children:[e.jsx("image",{x:o-m/2,y:j,width:m,height:m,href:k}),e.jsx("circle",{cx:o,cy:i,r:3,fill:l.temp>=0?"#e74c3c":"#2980b9",stroke:"#fff",strokeWidth:.5})]})}return e.jsx("circle",{cx:o,cy:i,r:3,fill:l.temp>=0?"#e74c3c":"#2980b9",stroke:"#fff",strokeWidth:.5})},Tt=(n,o)=>o<=24?!0:o<=36?n%3===0:n%4===0,Mt=({points:n,height:o,iconScale:i=1,stationTitle:l,currentHour:p})=>{const h=o||400,x=60,b=Math.max(48,Math.min(65,Math.round(h/7))),m=h-b-4,j=dt(m,i),k=N.useMemo(()=>n&&n.length>0?ft(n):[],[n]),A=N.useMemo(()=>k.length>0?pt(k):[],[k]);if(!n||n.length===0)return null;const E=k.map(f=>f.temp).filter(f=>
24f!=null),I=Math.min(...E),_=Math.max(...E),{domainMin:w,domainMax:W,ticks:d}=ut(I-1,_+1),B=I<0,S=_>0,v=B&&S,G=_/(_-I),U=!B,oe=!S,Q=`kioskTempGrad_${w}_${W}`,H=U?"#e74c3c":oe?"#2980b9":`url(#${Q})`,ie=k.map(f=>f.precipitation).filter(f=>f!=null),$=Math.max(0,...ie),se=Math.max(5,Math.ceil($)),re=k.map((f,T)=>f.time==="00"?T:null).filter(f=>f!==null),z=k.length,R=yt(m);return e.jsxs("div",{style:{width:"100%",height:h,display:"flex",flexDirection:"column",overflow:"visible"},children:[e.jsx(et,{width:"100%",height:m,children:e.jsxs(rt,{data:k,margin:{top:x,right:De,left:0,bottom:0},style:{overflow:"visible"},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:Q,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:0,stopColor:"#e74c3c"}),e.jsx("stop",{offset:G,stopColor:"#e74c3c"}),e.jsx("stop",{offset:G,stopColor:"#2980b9"}),e.jsx("stop",{offset:1,stopColor:"#2980b9"})]})}),e.jsx(tt,{stroke:"#e0e0e0"}),l&&e.jsx("text",{x:te+4,y:x-28,fontSize:Math.max(16,Math.min(26,Math.round(m/14))),fontFamily:"'Quicksand', sans-serif",fontWeight:700,fill:"#333",opacity:.9,children:l}),A.length>0&&(p??M().hour())<18&&e.jsx(fe,{x:A[0].startIndex,yAxisId:"temp",stroke:"transparent",ifOverflow:"extendDomain",children:e.jsx(je,{content:e.jsx(jt,{value:A[0].label,chartLeft:te,chartHeight:m,topMargin:x})})}),re.map(f=>{const T=A.find(ae=>ae.startIndex===f);return e.jsx(fe,{x:f,stroke:"rgba(0,0,0,0.25)",strokeWidth:2,yAxisId:"temp",children:T&&e.jsx(je,{content:e.jsx(vt,{value:T.label,chartHeight:m,topMargin:x})})},`midnight-${f}`)}),e.jsx(nt,{dataKey:"index",orientation:"top",tick:e.jsx(wt,{data:k,chartHeight:m}),axisLine:{stroke:"#bbb"},tickLine:!1,interval:0}),e.jsx(Se,{yAxisId:"temp",tick:R,tickFormatter:f=>`${f}°`,domain:[w,W],ticks:d,width:te,axisLine:{stroke:"#bbb"},tickLine:{stroke:"#ddd"}}),e.jsx(Se,{yAxisId:"precip",orientation:"right",tick:R,tickFormatter:f=>`${f} mm`,domain:[0,se],allowDecimals:!1,width:ze,axisLine:{stroke:"#bbb"},tickLine:{stroke:"#ddd"}}),v&&e.jsx(fe,{yAxisId:"temp",y:0,stroke:"#666",strokeWidth:1,strokeDasharray:"4 3"}),e.jsx(ot,{contentStyle:mt,formatter:kt,labelFormatter:bt}),e.jsx(it,{yAxisId:"precip",dataKey:"precipitation",fill:"#68CFE8",stroke:"#48AFE8",barSize:12,radius:[3,3,0,0],name:"precipitation"}),e.jsx(st,{yAxisId:"temp",type:"monotone",dataKey:"temp",stroke:H,strokeWidth:3,dot:f=>e.jsx(St,{...f,totalPoints:z,iconSz:j},f.index),activeDot:{r:5,stroke:"#fff",strokeWidth:2},name:"temp"})]})}),e.jsx(xt,{style:{height:b},children:k.map((f,T)=>e.jsx(ht,{total:z,children:f.wind!=null&&Tt(T,z)?e.jsxs(e.Fragment,{children:[f.windDirection!=null&&e.jsx(gt,{deg:f.windDirection,children:"↓"}),e.jsx("span",{children:f.wind})]}):null},T))})]})},Rt=N.memo(Mt);M.locale("sv");const Le="kiosk_settings",pe="kiosk_station",K="kiosk_token",Ct=1800*1e3,Te=180*1e3,At=1800*1e3,Et=10*1e3,Me=5e3,ue={textSize:1,iconScale:1,layoutMode:"top",showWarnings:!0,showTime:!0,showDate:!0,showTemp:!0};function C(n){const o=document.cookie.match(new RegExp("(?:^|; )"+n+"=([^;]*)"));return o?decodeURIComponent(o[1]):null}function ne(n,o,i=365*5){document.cookie=`${n}=${encodeURIComponent(o)}; max-age=${3600*24*i}; path=/`}function Re(n){document.cookie=`${n}=; max-age=0; path=/`}function It(){const n=C(Le);if(!n)return ue;try{return{...ue,...JSON.parse(n)}}catch{return ue}}function _t(n){ne(Le,JSON.stringify(n))}const zt=r.div`
25  position: fixed;
26  inset: 0;
27  display: flex;
28  flex-direction: column;
29  overflow: hidden;
30  background-color: #ffffff;
31  color: #111111;
32  font-family: 'Roboto', sans-serif;
33  user-select: none;
34`,Dt=r.div`
35  position: absolute;
36  top: 0;
37  left: 0;
38  right: 0;
39  background: #c0392b;
40  color: #fff;
41  padding: 8px 16px;
42  font-size: 14px;
43  font-weight: 600;
44  text-align: center;
45  z-index: 1000;
46  display: flex;
47  align-items: center;
48  justify-content: center;
49  gap: 12px;
50  transform: translateY(${({$show:n})=>n?"0":"-100%"});
51  transition: transform 0.4s ease-in-out;
52  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
53`,Lt=r.div`
54  flex: 1;
55  display: flex;
56  flex-direction: ${({$layoutMode:n})=>n==="side"?"row":"column"};
57  min-height: 0;
58  overflow: hidden;
59`,$t=r.div`
60  display: flex;
61  justify-content: space-between;
62  align-items: flex-start;
63  padding: 20px 32px 0;
64  flex-shrink: 0;
65  gap: clamp(24px, 4vw, 60px);
66  
67  ${({$layoutMode:n})=>n==="side"&&Xe`
68    flex-direction: column;
69    justify-content: flex-start;
70    padding: 32px;
71    flex-shrink: 0;
72    width: auto;
73    min-width: 260px;
74    max-width: 45vw;
75    height: 100%;
76    border-right: 1px solid rgba(0,0,0,0.05);
77    overflow: hidden;
78  `}
79`;r.div`
80  display: flex;
81  flex-direction: column;
82  align-items: center;
83  justify-content: flex-start;
84  padding-top: 8px;
85  opacity: 0.45;
86  flex-shrink: 0;
87`;const Ot=r.div`
88  text-align: left;
89`,Kt=r.div`
90  font-size: calc(clamp(84px, 12vw, 180px) * ${({$large:n})=>n?1.2:1} * ${({$scale:n})=>n});
91  font-family: 'Quicksand', sans-serif;
92  font-weight: 700;
93  line-height: 1;
94  letter-spacing: -2px;
95  color: #111;
96`,Ht=r.div`
97  font-size: calc(clamp(18px, 2.6vw, 36px) * ${({$scale:n})=>n});
98  font-family: 'Quicksand', sans-serif;
99  font-weight: 600;
100  color: #444;
101  margin-top: 10px;
102  text-transform: capitalize;
103  white-space: nowrap;
104`,Ft=r.div`
105  display: flex;
106  align-items: baseline;
107  gap: 6px;
108  text-align: right;
109`,Pt=r.div`
110  font-size: calc(clamp(84px, 12vw, 180px) * 1.2 * ${({$scale:n})=>n});
111  font-family: 'Roboto', sans-serif;
112  font-weight: 300;
113  line-height: 1;
114  letter-spacing: -6px;
115  color: #111;
116`;r.span`
117  font-size: calc(clamp(44px, 6vw, 84px) * ${({$scale:n})=>n});
118  font-weight: 300;
119  color: #444;
120  align-self: flex-start;
121  margin-top: 0.1em;
122  letter-spacing: 0;
123`;const Nt=r.div`
124  flex: 1;
125  min-height: 0;
126  padding: 20px 20px 0;
127  display: flex;
128  flex-direction: column;
129  overflow: hidden;
130  position: relative;
131`;r.div`
132  font-size: clamp(14px, 1.8vw, 24px);
133  font-family: 'Quicksand', sans-serif;
134  font-weight: 700;
135  color: #333;
136  margin-top: 4px;
137  margin-bottom: 0;
138  padding-left: 52px;
139  opacity: 0.75;
140  flex-shrink: 0;
141`;const Wt=r.div`
142  display: flex;
143  align-items: center;
144  justify-content: center;
145  flex: 1;
146  opacity: 0.35;
147  font-size: clamp(16px, 2vw, 28px);
148  color: #111;
149`,Bt=N.memo(({duration:n,error:o})=>e.jsx("div",{style:{height:"100%",background:o?"#c0392b":"#3498db",opacity:.5,width:0,animation:`kioskProgress ${n}ms linear forwards`}})),Gt=r.div`
150  flex-shrink: 0;
151  padding: 4px 80px 8px 20px;
152  display: flex;
153  align-items: center;
154  gap: 15px;
155`,Ut=r.div`
156  flex: 1;
157  height: clamp(3px, 0.25vh, 5px);
158  background: rgba(0, 0, 0, 0.08);
159  border-radius: 2px;
160  overflow: hidden;
161`,Qt=r.div`
162  font-size: 11px;
163  color: #999;
164  font-family: 'Roboto', sans-serif;
165  white-space: nowrap;
166`,Yt=r.div`
167  font-size: 11px;
168  color: #999;
169  font-family: 'Roboto', sans-serif;
170  white-space: nowrap;
171  flex-shrink: 0;
172`,Vt=r.button`
173  position: fixed;
174  bottom: 20px;
175  right: 20px;
176  width: 40px;
177  height: 40px;
178  border-radius: 50%;
179  border: 1px solid rgba(0, 0, 0, 0.15);
180  background: rgba(0, 0, 0, 0.05);
181  color: rgba(0, 0, 0, 0.4);
182  cursor: pointer;
183  font-size: 18px;
184  display: flex;
185  align-items: center;
186  justify-content: center;
187  z-index: 100;
188  transition: background 0.2s, color 0.2s;
189  &:hover { background: rgba(0, 0, 0, 0.12); color: #111; }
190`,Jt=r.div`
191  position: fixed;
192  inset: 0;
193  background: rgba(0, 0, 0, 0.45);
194  display: flex;
195  align-items: center;
196  justify-content: center;
197  z-index: 200;
198`,Xt=r.div`
199  background: #ffffff;
200  border: 1px solid rgba(0, 0, 0, 0.1);
201  border-radius: 16px;
202  padding: 24px;
203  width: min(460px, 92vw);
204  max-height: 90vh;
205  overflow-y: auto;
206  color: #111111;
207  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
208`,qt=r.h2`
209  font-family: 'Quicksand', sans-serif;
210  font-weight: 700;
211  font-size: 20px;
212  margin: 0 0 14px 0;
213  color: #111;
214`,Zt=r.button`
215  width: 100%;
216  padding: 12px;
217  border-radius: 10px;
218  border: 1px solid rgba(0, 0, 0, 0.15);
219  background: #f4f4f4;
220  color: #111;
221  font-family: 'Quicksand', sans-serif;
222  font-weight: 600;
223  font-size: 15px;
224  cursor: pointer;
225  margin-bottom: 16px;
226  transition: background 0.2s;
227  &:hover { background: #e8e8e8; }
228  &:disabled { opacity: 0.5; cursor: default; }
229`,en=r.div`
230  text-align: center;
231  margin: 12px 0;
232  font-size: 13px;
233  color: #888;
234`,tn=r.input`
235  width: 100%;
236  padding: 12px 14px;
237  border-radius: 10px;
238  border: 1px solid rgba(0, 0, 0, 0.2);
239  background: #f9f9f9;
240  color: #111;
241  font-family: 'Roboto', sans-serif;
242  font-size: 15px;
243  outline: none;
244  box-sizing: border-box;
245  &::placeholder { color: #aaa; }
246  &:focus { border-color: #0984e3; }
247`,nn=r.ul`
248  list-style: none;
249  margin: 8px 0 0;
250  padding: 0;
251  max-height: 220px;
252  overflow-y: auto;
253  border-radius: 10px;
254  border: 1px solid rgba(0, 0, 0, 0.1);
255  background: #fff;
256`,on=r.li`
257  padding: 12px 14px;
258  cursor: pointer;
259  font-size: 14px;
260  color: #111;
261  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
262  &:last-child { border-bottom: none; }
263  &:hover { background: #f0f4ff; }
264`,sn=r.button`
265  margin-top: 20px;
266  width: 100%;
267  padding: 10px;
268  border-radius: 10px;
269  border: 1px solid rgba(0, 0, 0, 0.12);
270  background: transparent;
271  color: #888;
272  font-family: 'Quicksand', sans-serif;
273  font-size: 14px;
274  cursor: pointer;
275  &:hover { background: #f4f4f4; color: #333; }
276`,rn=r.div`
277  font-size: 13px;
278  color: #666;
279  margin-top: 10px;
280  min-height: 18px;
281  text-align: center;
282`,xe=r.div`
283  margin-top: 16px;
284  padding-top: 14px;
285  border-top: 2px solid rgba(0, 0, 0, 0.06);
286`,Ce=r.h3`
287  font-size: 15px;
288  margin: 0 0 10px;
289  color: #333;
290`,F=r.div`
291  display: flex;
292  align-items: center;
293  justify-content: space-between;
294  margin-bottom: 10px;
295  gap: 12px;
296`,P=r.label`
297  font-size: 13px;
298  font-weight: 600;
299  color: #555;
300  flex: 1;
301`,Ae=r.div`
302  display: flex;
303  align-items: center;
304  gap: 10px;
305  width: 200px;
306`,Ee=r.input`
307  flex: 1;
308  cursor: pointer;
309  height: 32px;
310  -webkit-appearance: none;
311  appearance: none;
312  background: transparent;
313
314  &::-webkit-slider-runnable-track {
315    height: 6px;
316    border-radius: 3px;
317    background: #ddd;
318  }
319
320  &::-webkit-slider-thumb {
321    -webkit-appearance: none;
322    width: 24px;
323    height: 24px;
324    border-radius: 50%;
325    background: #005fcc;
326    border: 2px solid #fff;
327    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
328    margin-top: -9px;
329  }
330
331  &::-moz-range-track {
332    height: 6px;
333    border-radius: 3px;
334    background: #ddd;
335    border: none;
336  }
337
338  &::-moz-range-thumb {
339    width: 24px;
340    height: 24px;
341    border-radius: 50%;
342    background: #005fcc;
343    border: 2px solid #fff;
344    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
345  }
346`,Ie=r.span`
347  font-size: 12px;
348  font-family: monospace;
349  color: #777;
350  width: 32px;
351  text-align: right;
352`,he=r.div`
353  display: flex;
354  background: #eee;
355  padding: 3px;
356  border-radius: 8px;
357`,L=r.button`
358  border: none;
359  background: ${({$active:n})=>n?"#fff":"transparent"};
360  padding: 5px 10px;
361  border-radius: 6px;
362  font-size: 12px;
363  font-weight: 600;
364  color: ${({$active:n})=>n?"#111":"#777"};
365  cursor: pointer;
366  box-shadow: ${({$active:n})=>n?"0 1px 3px rgba(0,0,0,0.1)":"none"};
367  transition: all 0.2s;
368`,an=180*1e3,ln=10*1e3,cn=qe`
369  from { opacity: 0; }
370  to   { opacity: 1; }
371`,_e=r.div`
372  flex-shrink: 0;
373  background: linear-gradient(135deg, #f9ca24 0%, #f0932b 100%);
374  color: #111;
375  padding: 8px 20px;
376  font-family: 'Quicksand', sans-serif;
377  font-weight: 700;
378  font-size: 13px;
379  text-align: center;
380  display: flex;
381  align-items: center;
382  justify-content: center;
383  gap: 12px;
384
385  a {
386    color: #111;
387    text-decoration: underline;
388    font-weight: 700;
389    &:hover { color: #005fcc; }
390  }
391`,dn=r.div`
392  position: fixed;
393  inset: 0;
394  background: rgba(0, 0, 0, 0.55);
395  z-index: 350;
396  display: flex;
397  align-items: center;
398  justify-content: center;
399  animation: ${cn} 0.5s ease;
400`,fn=r.div`
401  background: #fff;
402  border-radius: 16px;
403  padding: 36px 40px;
404  max-width: 440px;
405  width: 90vw;
406  text-align: center;
407  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
408
409  h2 {
410    font-family: 'Quicksand', sans-serif;
411    font-weight: 700;
412    font-size: 22px;
413    margin: 0 0 12px;
414    color: #111;
415  }
416
417  p {
418    font-family: 'Roboto', sans-serif;
419    font-size: 15px;
420    color: #444;
421    line-height: 1.5;
422    margin: 0 0 20px;
423  }
424
425  a {
426    display: inline-block;
427    background: linear-gradient(135deg, #f9ca24 0%, #f0932b 100%);
428    color: #111;
429    font-family: 'Quicksand', sans-serif;
430    font-weight: 700;
431    font-size: 16px;
432    padding: 12px 28px;
433    border-radius: 10px;
434    text-decoration: none;
435    transition: transform 0.2s;
436    &:hover { transform: scale(1.03); }
437  }
438
439  small {
440    display: block;
441    margin-top: 14px;
442    font-size: 12px;
443    color: #999;
444  }
445`,pn=N.memo(({textSize:n,showTime:o,showDate:i})=>{const[l,p]=s.useState(M());return s.useEffect(()=>{const h=setInterval(()=>p(M()),1e3);return()=>clearInterval(h)},[]),e.jsxs(Ot,{children:[o&&e.jsx(Kt,{$scale:n,$large:!i,children:l.format("HH:mm")}
445),i&&e.jsx(Ht,{$scale:n,children:l.format("dddd D MMMM")})]})}),kn=()=>{const[n,o]=s.useState(()=>C(K)),[i,l]=s.useState(()=>!!C(K)),[p,h]=s.useState(!1),x=!!C("no_ads")||i,[b,m]=s.useState(!1),[j,k]=s.useState(""),[A,E]=s.useState(""),[I,_]=s.useState(!1),[w,W]=s.useState(()=>{const t=new URLSearchParams(window.location.search).get("station");return t||C("kiosk_station")||null}),[d,B]=s.useState(It),S=s.useCallback(t=>{B(a=>{const c={...a,...t};return _t(c),c})},[]),[v,G]=s.useState(null),[U,oe]=s.useState([]),[Q,H]=s.useState(!1),[ie,$]=s.useState(!1),[se,re]=s.useState(M().hour()),[z,R]=s.useState(!C(pe)),[f,T]=s.useState(0),[ae,$e]=s.useState(300),ge=s.useRef(null),me=s.useRef(null),Oe=s.useRef(0),[Y,ke]=s.useState(""),[be,V]=s.useState([]),[ye,le]=s.useState(!1),[Ke,O]=s.useState("");s.useEffect(()=>{const t="kiosk-progress-keyframes";if(!document.getElementById(t)){const a=document.createElement("style");a.id=t,a.textContent="@keyframes kioskProgress { from { width: 0%; } to { width: 100%; } }",document.head.appendChild(a)}},[]),s.useEffect(()=>{const t=ge.current;if(!t)return;const a=new ResizeObserver(c=>{for(const u of c){const g=Math.floor(u.contentRect.height)-40;g>100&&$e(g)}});return a.observe(t),()=>a.disconnect()},[]),s.useEffect(()=>{if(!x)return;const t=document.getElementById("sub-badge");return t&&(t.style.display="none"),()=>{t&&(t.style.display="")}},[x]),s.useEffect(()=>{const t=new URLSearchParams(window.location.search).get("station");t&&ne(pe,t)},[]),s.useEffect(()=>{if(!n)return;const t=async()=>{var c,u;try{const g=await D.get(Je,{params:{token:n},timeout:1e4});(c=g.data)!=null&&c.valid?(l(!0),h(!1)):(u=g.data)!=null&&u.paused?(l(!1),h(!0)):(Re(K),o(null),l(!1),h(!1))}catch{}};t();const a=setInterval(t,Ct);return()=>clearInterval(a)},[n]),s.useEffect(()=>{const t=setInterval(()=>{const a=M().hour();re(c=>c!==a?a:c)},6e4);return()=>clearInterval(t)},[]),s.useEffect(()=>{if(x)return;const t=setInterval(()=>{m(!0),setTimeout(()=>m(!1),ln)},an);return()=>clearInterval(t)},[x]);const J=s.useCallback(async t=>{var u;if(!t)return;const a=new AbortController,c=setTimeout(()=>$(!0),Et);try{const y=(u=(await D({url:Be,params:{p:t,_cb:Date.now()},timeout:1e4,signal:a.signal})).data)==null?void 0:u.stations;if(!y)throw new Error("No station data");const q=y[Object.keys(y)[0]];G(q),clearTimeout(c),H(!1),$(!1)}catch{a.signal.aborted||(clearTimeout(c),H(!0),$(!1),setTimeout(()=>J(t),Me))}return()=>{a.abort(),clearTimeout(c)}},[]),X=s.useCallback(async t=>{var c,u;if(!(t!=null&&t.lat)||!(t!=null&&t.lon))return;const a=new AbortController;try{const y=(u=(c=(await D({url:Ge,params:{lat:t.lat,lon:t.lon,altitude:1,_cb:Date.now()},timeout:15e3,signal:a.signal})).data)==null?void 0:c.properties)==null?void 0:u.timeseries;y&&oe(at(y))}catch{a.signal.aborted||setTimeout(()=>X(t),Me)}return()=>a.abort()},[]);s.useEffect(()=>{if(!w)return;J(w);const t=setInterval(()=>{Oe.current+=1,T(a=>a+1),J(w)},Te);return()=>clearInterval(t)},[w,J]),s.useEffect(()=>{if(!v)return;X(v);const t=setInterval(()=>X(v),At);return()=>clearInterval(t)},[v,X]),s.useEffect(()=>{if(!z)return;const t=me.current;if(!t)return;const a=()=>t.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'),c=g=>{if(g.key==="Escape"&&w){R(!1);return}if(g.key!=="Tab")return;const y=a();if(y.length===0)return;const q=y[0],ve=y[y.length-1];g.shiftKey?document.activeElement===q&&(g.preventDefault(),ve.focus()):document.activeElement===ve&&(g.preventDefault(),q.focus())};t.addEventListener("keydown",c);const u=a();return u.length>0&&u[0].focus(),()=>t.removeEventListener("keydown",c)},[z,w]),s.useEffect(()=>{if(!Y.trim()){V([]);return}const t=new AbortController,a=setTimeout(async()=>{var c;try{const g=(c=(await D({url:Ue,params:{search:Y},timeout:5e3,signal:t.signal})).data)==null?void 0:c.stations;Array.isArray(g)?V(g.slice(0,10)):g&&typeof g=="object"&&V(Object.values(g).slice(0,10))}catch{}},350);return()=>{clearTimeout(a),t.abort()}},[Y]);const ce=s.useCallback(t=>{ne(pe,t),W(t),R(!1),ke(""),V([]),T(a=>a+1),H(!1),$(!1)},[]),He=s.useCallback(()=>
445{if(!navigator.geolocation){O("GPS ej tillgänglig i denna webbläsare");return}le(!0),O("Hämtar position..."),navigator.geolocation.getCurrentPosition(async t=>{var a,c,u;try{const y=(u=(c=(a=(await D({url:Qe,params:{lat:t.coords.latitude,lon:t.coords.longitude},timeout:5e3})).data)==null?void 0:a.stations)==null?void 0:c[0])==null?void 0:u.id;y?(ce(y),O("")):O("Ingen station hittades nära din position")}catch{O("Kunde inte hämta närmaste station")}le(!1)},()=>{O("Platsåtkomst nekad"),le(!1)})},[ce]),Fe=s.useCallback(async()=>{var t;if(j.length===6){_(!0),E("");try{const a=await D.post(Ye,{code:j},{timeout:1e4});(t=a.data)!=null&&t.token?(ne(K,a.data.token),o(a.data.token),l(!0),k(""),R(!1)):E("Ogiltig eller utgången kod. Koden gäller i 10 minuter.")}catch{E("Kunde inte validera koden. Försök igen.")}_(!1)}},[j]),Pe=s.useCallback(async()=>{const t=C(K);if(t)try{await D.post(Ve,{token:t},{timeout:1e4})}catch{return}Re(K),o(null),l(!1)},[]),de=Q||ie,we=v==null?void 0:v.temp,Ne=we?we.replace(".",","):v?"—":"···",We=(v==null?void 0:v.title)||null;return e.jsxs(zt,{$layoutMode:d.layoutMode,children:[e.jsx(Ze,{children:e.jsx("meta",{name:"robots",content:"noindex, nofollow"})}),e.jsx(Dt,{$show:de&&d.showWarnings,children:"⚠️ Anslutningsproblem — försöker igen om 5s"}),e.jsxs(Lt,{$layoutMode:d.layoutMode,children:[(d.showTime||d.showDate||d.showTemp)&&e.jsxs($t,{$layoutMode:d.layoutMode,children:[(d.showTime||d.showDate)&&e.jsx(pn,{textSize:d.textSize,showTime:d.showTime,showDate:d.showDate}),d.showTemp&&e.jsx(Ft,{children:e.jsxs(Pt,{$scale:d.textSize,children:[Ne,"°"]})})]}),e.jsx(Nt,{ref:ge,children:U.length>0?e.jsx(Rt,{points:U,height:ae,iconScale:d.iconScale,stationTitle:We,currentHour:se}):e.jsx(Wt,{children:w?"Laddar prognos…":"Välj mätpunkt för att visa prognos"})})]}),p&&!x&&e.jsxs(_e,{children:["Din prenumeration har löpt ut — kioskläget är pausat. Aktivera din prenumeration igen så fungerar allt direkt. ",e.jsx("a",{href:"/prenumerera",onClick:()=>Z("kiosk-paused"),children:"Förnya prenumeration →"})]}),!x&&!p&&(()=>{var a;let t=!1;try{const c=localStorage.getItem("tnu_session"),u=c?JSON.parse(c):null;t=((a=u==null?void 0:u.owned_stations)==null?void 0:a.length)>0}catch{}return e.jsx(_e,{children:t?e.jsxs(e.Fragment,{children:["Kioskläge kräver Hjälte eller Eldsjäl (rapportör-tier). ",e.jsx("a",{href:"/egenadmin/",onClick:()=>Z("kiosk-nag-reporter"),children:"Hantera i egenadmin →"})," Redan prenumerant men inte inloggad i denna webbläsare? Ange aktiveringskod via ⚙"]}):e.jsxs(e.Fragment,{children:["Kioskläge, fullskärm, dashboard och nedladdningar ingår i prenumerationen. ",e.jsx("a",{href:"/prenumerera",onClick:()=>Z("kiosk-nag"),children:"Prenumerera från 39 kr/mån."})," Redan prenumerant men inte inloggad i denna webbläsare? Ange aktiveringskod via ⚙"]})})})(),e.jsxs(Gt,{children:[e.jsx(Qt,{children:de?"Uppdatering misslyckades":"Uppdateras var 3:e minut"}),e.jsx(Ut,{children:w&&e.jsx(Bt,{duration:Te,error:de},f)}),e.jsx(Yt,{children:"Prognosdata från yr.no"}),e.jsx("img",{src:"/logo.webp",alt:"Temperatur.nu",style:{height:26,width:"auto",opacity:.8,flexShrink:0}})]}),e.jsx(Vt,{onClick:()=>R(!0),"aria-label":"Byt mätpunkt",title:"Byt mätpunkt",children:"⚙"}),z&&e.jsx(Jt,{ref:me,onClick:t=>{t.target===t.currentTarget&&w&&R(!1)},children:e.jsxs(Xt,{children:[e.jsx(qt,{children:"Välj mätpunkt"}),e.jsxs(Zt,{onClick:He,disabled:ye,children:["📍 ",ye?"Söker…":"Använd närmaste (GPS)"]}),e.jsx(en,{children:"— eller sök manuellt —"}),e.jsx(tn,{placeholder:"Sök stad eller mätpunkt…","aria-label":"Sök stad eller mätpunkt",value:Y,onChange:t=>ke(t.target.value)}),be.length>0&&e.jsx(nn,{children:be.map(t=>e.jsxs(on,{onClick:()=>ce(t.id),children:[t.title||t.id,t.kommun?e.jsx("span",{style:{opacity:.5,marginLeft:8,fontSize:"12px"},children:t.kommun}):null]},t.id))}),e.jsxs(xe,{children:[e.jsx(Ce,{children:"Inställningar"}),e.jsxs(F,{children:[e.jsx(P,{children:"Textstorlek"}),e.jsxs(Ae,{children:[e.jsx(Ee,{type:"range",min:"0.5",max:"2.0",step:"0.1",value:d.textSize,onChange:t=>S({textSize:parseFloat(t.target.value)})}),e.jsxs(Ie,{children:[d.textSize.toFixed(1),"x"]})]})]}),e.jsxs(F,{children:[e.jsx(P,{children:"Ikonstorlek"}),e.jsxs(Ae,{children:[e.jsx(Ee,{type:"range",min:"0.5",max:"2.0",step:"0.1",value:d.iconScale,onChange:t=>S({iconScale:parseFloat(t.target.value)})}),e.jsxs(Ie,{children:[d.iconScale.toFixed(1),"x"]})]})]}),e.jsxs(F,{children:[e.jsx(P,{children:"Layout"}),e.jsxs(he,{children:[e.jsx(L,{$active:d.layoutMode==="top",onClick:()=>S({layoutMode:"top"}),children:"Topp"}),e.jsx(L,{$active:d.layoutMode==="side",onClick:()=>S({layoutMode:"side"}),children:"Sida"})]})]}),e.jsxs(F,{children:[e.jsx(P,{children:"Visa"}),e.jsxs(he,{children:[e.jsx(L,{$active:d.showTime,onClick:()=>S({showTime:!d.showTime}),children:"Tid"}),e.jsx(L,{$active:d.showDate,onClick:()=>S({showDate:!d.showDate}),children:"Datum"}),e.jsx(L,{$active:d.showTemp,onClick:()=>S({showTemp:!d.showTemp}),children:"Temp"})]})]}),e.jsxs(F,{children:[e.jsx(P,{children:"Nätverksvarning"}),e.jsxs(he,{children:[e.jsx(L,{$active:d.showWarnings,onClick:()=>S({showWarnings:!0}),children:"På"}),e.jsx(L,{$active:!d.showWarnings,onClick:()=>S({showWarnings:!1}),children:"Av"})]})]})]}),e.jsx(xe,{children:e.jsx("a",{href:"/info/fullskarm-kiosklage/",target:"_blank",rel:"noopener noreferrer",style:{fontSize:13,color:"#005fcc",textDecoration:"none"},children:"Manual: Fullskärm & Kioskläge"})}),!C("no_ads")&&e.jsxs(xe,{children:[e.jsx(Ce,{children:"Aktiveringskod"}),i?e.jsxs("div",{children:[e.jsx("div",{style:{color:"#008060",fontWeight:600,fontSize:14,marginBottom:12},children:"Kiosken är aktiverad ✓"}),e.jsx("button",{onClick:Pe,style:{padding:"8px 16px",borderRadius:8,border:"1px solid rgba(0,0,0,0.15)",background:"transparent",color:"#666",fontSize:14,cursor:"pointer",fontFamily:"'Quicksand', sans-serif",fontWeight:600},children:"Avaktivera"})]}):e.jsxs("div",{children:[e.jsxs("p",{style:{fontSize:14,color:"#555",marginBottom:12,lineHeight:1.5},children:["Har du en aktiveringskod? Generera en på ",e.jsx("a",{href:"/prenumerera",target:"_blank",rel:"noopener noreferrer",style:{color:"#005fcc"},children:"/prenumerera"}),"."]}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[e.jsx("input",{type:"text",maxLength:6,"aria-label":"Aktiveringskod",value:j,onChange:t=>{k(t.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,6)),E("")},placeholder:"ABCDEF",style:{width:130,padding:"10px 12px",borderRadius:8,border:"1px solid rgba(0,0,0,0.2)",background:"#f9f9f9",fontFamily:"monospace",fontSize:18,fontWeight:700,letterSpacing:4,textAlign:"center",textTransform:"uppercase",outline:"none",color:"#111"}}),e.jsx("button",{onClick:Fe,disabled:j.length!==6||I,style:{padding:"10px 18px",borderRadius:8,border:"none",background:j.length===6?"#005fcc":"#ccc",color:"#fff",fontSize:14,fontWeight:600,fontFamily:"'Quicksand', sans-serif",curs
445or:j.length===6?"pointer":"default",opacity:I?.6:1},children:I?"Aktiverar...":"Aktivera"})]}),A&&e.jsx("div",{style:{color:"#c0392b",fontSize:13,marginTop:8},children:A})]})]}),e.jsx(rn,{children:Ke}),w&&e.jsx(sn,{onClick:()=>R(!1),children:"Spara"})]})}),!x&&b&&(()=>{var a;let t=!1;try{const c=localStorage.getItem("tnu_session"),u=c?JSON.parse(c):null;t=((a=u==null?void 0:u.owned_stations)==null?void 0:a.length)>0}catch{}return e.jsx(dn,{onClick:()=>m(!1),children:e.jsxs(fn,{onClick:c=>c.stopPropagation(),children:[e.jsx("h2",{children:t?"Kioskläge kräver Hjälte eller Eldsjäl":"Prenumerera på temperatur.nu"}),e.jsx("p",{children:t?"Som mätpunktsägare får du tillgång till kioskläge, fullskärm och dashboard via Hjälte- eller Eldsjäl-nivån. Samma funktioner som vanlig prenumeration, rabatterat pris (99 kr/år).":"Kioskläge, fullskärm, dashboard och nedladdningar ingår i prenumerationen. Stöd sajten och få tillgång till alla funktioner utan avbrott."}),e.jsx("p",{style:{fontSize:"13px",marginBottom:"16px"},children:"Redan prenumerant? Logga in i denna webbläsare eller ange en aktiveringskod via ⚙."}),e.jsx("a",{href:t?"/egenadmin/":"/prenumerera",onClick:()=>Z(t?"kiosk-overlay-reporter":"kiosk-overlay"),children:t?"Hantera i egenadmin →":"Prenumerera från 39 kr/mån"}),e.jsx("small",{children:"Försvinner automatiskt om några sekunder"})]})})})()]})};export{kn 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.