PageSourceSearch

https://denkzettel.io/assets/index-BCLynis0.js

js denkzettel.io collected 2026-10-02 01:57:14 UTC 259,989 bytes, 356 lines download raw bytes

vendor: 6,388 bytes, lines 1-70
1import{r as o,j as e,m as T,A as ee,R as _e}from"./motion-CVOamqbz.js";import{r as Cs}from"./react-CIhcXKeN.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))a(r);new MutationObserver(r=>{for(const l of r)if(l.type==="childList")for(const i of l.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&a(i)}).observe(document,{childList:!0,subtree:!0});function n(r){const l={};return r.integrity&&(l.integrity=r.integrity),r.referrerPolicy&&(l.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?l.credentials="include":r.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function a(r){if(r.ep)return;r.ep=!0;const l=n(r);fetch(r.href,l)}})();var Vt,Dt=Cs;Vt=Dt.createRoot,Dt.hydrateRoot;/**
2 * @license lucide-react v0.460.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 Ms=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ut=(...t)=>t.filter((s,n,a)=>!!s&&s.trim()!==""&&a.indexOf(s)===n).join(" ").trim();/**
7 * @license lucide-react v0.460.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 */var Ds={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
12 * @license lucide-react v0.460.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 Es=o.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:r="",children:l,iconNode:i,...c},d)=>o.createElement("svg",{ref:d,...Ds,width:s,height:s,stroke:t,strokeWidth:a?Number(n)*24/Number(s):n,className:Ut("lucide",r),...c},[...i.map(([p,u])=>o.createElement(p,u)),...Array.isArray(l)?l:[l]]));/**
17 * @license lucide-react v0.460.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 S=(t,s)=>{const n=o.forwardRef(({className:a,...r},l)=>o.createElement(Es,{ref:l,iconNode:s,className:Ut(`lucide-${Ms(t)}`,a),...r}));return n.displayName=`${t}`,n};/**
22 * @license lucide-react v0.460.0 - ISC
23 *
24 * This source code is licensed under the ISC license.
25 * See the LICENSE file in the root directory of this source tree.
26 */const ke=S("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
27 * @license lucide-react v0.460.0 - ISC
28 *
29 * This source code is licensed under the ISC license.
30 * See the LICENSE file in the root directory of this source tree.
31 */const Se=S("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
32 * @license lucide-react v0.460.0 - ISC
33 *
34 * This source code is licensed under the ISC license.
35 * See the LICENSE file in the root directory of this source tree.
36 */const As=S("BellOff",[["path",{d:"M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5",key:"o7mx20"}],["path",{d:"M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7",key:"16f1lm"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
37 * @license lucide-react v0.460.0 - ISC
38 *
39 * This source code is licensed under the ISC license.
40 * See the LICENSE file in the root directory of this source tree.
41 */const Is=S("BellRing",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}]]);/**
42 * @license lucide-react v0.460.0 - ISC
43 *
44 * This source code is licensed under the ISC license.
45 * See the LICENSE file in the root directory of this source tree.
46 */const qt=S("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
47 * @license lucide-react v0.460.0 - ISC
48 *
49 * This source code is licensed under the ISC license.
50 * See the LICENSE file in the root directory of this source tree.
51 */const Fs=S("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
52 * @license lucide-react v0.460.0 - ISC
53 *
54 * This source code is licensed under the ISC license.
55 * See the LICENSE file in the root directory of this source tree.
56 */const Ts=S("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
57 * @license lucide-react v0.460.0 - ISC
58 *
59 * This source code is licensed under the ISC license.
60 * See the LICENSE file in the root directory of this source tree.
61 */const Bs=S("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/**
62 * @license lucide-react v0.460.0 - ISC
63 *
64 * This source code is licensed under the ISC license.
65 * See the LICENSE file in the root directory of this source tree.
66 */const te=S("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
67 * @license lucide-react v0.460.0 - ISC
68 *
69 * This source code is licensed under the ISC license.
70 * See the LICENSE file in the root directory of this source tree.
71 */const Rs=S("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
72 * @license lucide-react v0.460.0 - ISC
73 *
74 * This source code is licensed under the ISC license.
75 * See the LICENSE file in the root directory of this source tree.
76 */const ae=S("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
77 * @license lucide-react v0.460.0 - ISC
78 *
79 * This source code is licensed under the ISC license.
80 * See the LICENSE file in the root directory of this source tree.
81 */const $s=S("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
82 * @license lucide-react v0.460.0 - ISC
83 *
84 * This source code is licensed under the ISC license.
85 * See the LICENSE file in the root directory of this source tree.
86 */const Ls=S("CircleArrowDown",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"m8 12 4 4 4-4",key:"k98ssh"}]]);/**
87 * @license lucide-react v0.460.0 - ISC
88 *
89 * This source code is licensed under the ISC license.
90 * See the LICENSE file in the root directory of this source tree.
91 */const Ws=S("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
92 * @license lucide-react v0.460.0 - ISC
93 *
94 * This source code is licensed under the ISC license.
95 * See the LICENSE file in the root directory of this source tree.
96 */const Ps=S("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
97 * @license lucide-react v0.460.0 - ISC
98 *
99 * This source code is licensed under the ISC license.
100 * See the LICENSE file in the root directory of this source tree.
101 */const Ee=S("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
102 * @license lucide-react v0.460.0 - ISC
103 *
104 * This source code is licensed under the ISC license.
105 * See the LICENSE file in the root directory of this source tree.
106 */const Ks=S("CloudOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193",key:"yfwify"}],["path",{d:"M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07",key:"jlfiyv"}]]);/**
107 * @license lucide-react v0.460.0 - ISC
108 *
109 * This source code is licensed under the ISC license.
110 * See the LICENSE file in the root directory of this source tree.
111 */const Zt=S("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
112 * @license lucide-react v0.460.0 - ISC
113 *
114 * This source code is licensed under the ISC license.
115 * See the LICENSE file in the root directory of this source tree.
116 */const Jt=S("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
117 * @license lucide-react v0.460.0 - ISC
118 *
119 * This source code is licensed under the ISC license.
120 * See the LICENSE file in the root directory of this source tree.
121 */const ze=S("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
122 * @license lucide-react v0.460.0 - ISC
123 *
124 * This source code is licensed under the ISC license.
125 * See the LICENSE file in the root directory of this source tree.
126 */const Os=S("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
127 * @license lucide-react v0.460.0 - ISC
128 *
129 * This source code is licensed under the ISC license.
130 * See the LICENSE file in the root directory of this source tree.
131 */const Hs=S("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
132 * @license lucide-react v0.460.0 - ISC
133 *
134 * This source code is licensed under the ISC license.
135 * See the LICENSE file in the root directory of this source tree.
136 */const Gs=S("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
137 * @license lucide-react v0.460.0 - ISC
138 *
139 * This source code is licensed under the ISC license.
140 * See the LICENSE file in the root directory of this source tree.
141 */const _s=S("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/**
142 * @license lucide-react v0.460.0 - ISC
143 *
144 * This source code is licensed under the ISC license.
145 * See the LICENSE file in the root directory of this source tree.
146 */const dt=S("HeartHandshake",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M12 5 9.04 7.96a2.17 2.17 0 0 0 0 3.08c.82.82 2.13.85 3 .07l2.07-1.9a2.82 2.82 0 0 1 3.79 0l2.96 2.66",key:"4oyue0"}],["path",{d:"m18 15-2-2",key:"60u0ii"}],["path",{d:"m15 18-2-2",key:"6p76be"}]]);/**
147 * @license lucide-react v0.460.0 - ISC
148 *
149 * This source code is licensed under the ISC license.
150 * See the LICENSE file in the root directory of this source tree.
151 */const Yt=S("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/**
152 * @license lucide-react v0.460.0 - ISC
153 *
154 * This source code is licensed under the ISC license.
155 * See the LICENSE file in the root directory of this source tree.
156 */const Qt=S("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/**
157 * @license lucide-react v0.460.0 - ISC
158 *
159 * This source code is licensed under the ISC license.
160 * See the LICENSE file in the root directory of this source tree.
161 */const Xt=S("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
162 * @license lucide-react v0.460.0 - ISC
163 *
164 * This source code is licensed under the ISC license.
165 * See the LICENSE file in the root directory of this source tree.
166 */const Vs=S("Leaf",[["path",{d:"M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z",key:"nnexq3"}],["path",{d:"M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12",key:"mt58a7"}]]);/**
167 * @license lucide-react v0.460.0 - ISC
168 *
169 * This source code is licensed under the ISC license.
170 * See the LICENSE file in the root directory of this source tree.
171 */const Us=S("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/**
172 * @license lucide-react v0.460.0 - ISC
173 *
174 * This source code is licensed under the ISC license.
175 * See the LICENSE file in the root directory of this source tree.
176 */const es=S("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
177 * @license lucide-react v0.460.0 - ISC
178 *
179 * This source code is licensed under the ISC license.
180 * See the LICENSE file in the root directory of this source tree.
181 */const ut=S("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
182 * @license lucide-react v0.460.0 - ISC
183 *
184 * This source code is licensed under the ISC license.
185 * See the LICENSE file in the root directory of this source tree.
186 */const me=S("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
187 * @license lucide-react v0.460.0 - ISC
188 *
189 * This source code is licensed under the ISC license.
190 * See the LICENSE file in the root directory of this source tree.
191 */const Et=S("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
192 * @license lucide-react v0.460.0 - ISC
193 *
194 * This source code is licensed under the ISC license.
195 * See the LICENSE file in the root directory of this source tree.
196 */const qs=S("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
197 * @license lucide-react v0.460.0 - ISC
198 *
199 * This source code is licensed under the ISC license.
200 * See the LICENSE file in the root directory of this source tree.
201 */const ts=S("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/**
202 * @license lucide-react v0.460.0 - ISC
203 *
204 * This source code is licensed under the ISC license.
205 * See the LICENSE file in the root directory of this source tree.
206 */const Ae=S("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
207 * @license lucide-react v0.460.0 - ISC
208 *
209 * This source code is licensed under the ISC license.
210 * See the LICENSE file in the root directory of this source tree.
211 */const Re=S("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
212 * @license lucide-react v0.460.0 - ISC
213 *
214 * This source code is licensed under the ISC license.
215 * See the LICENSE file in the root directory of this source tree.
216 */const ss=S("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
217 * @license lucide-react v0.460.0 - ISC
218 *
219 * This source code is licensed under the ISC license.
220 * See the LICENSE file in the root directory of this source tree.
221 */const Ve=S("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
222 * @license lucide-react v0.460.0 - ISC
223 *
224 * This source code is licensed under the ISC license.
225 * See the LICENSE file in the root directory of this source tree.
226 */const Zs=S("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/**
227 * @license lucide-react v0.460.0 - ISC
228 *
229 * This source code is licensed under the ISC license.
230 * See the LICENSE file in the root directory of this source tree.
231 */const ns=S("Receipt",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]]);/**
232 * @license lucide-react v0.460.0 - ISC
233 *
234 * This source code is licensed under the ISC license.
235 * See the LICENSE file in the root directory of this source tree.
236 */const Js=S("Recycle",[["path",{d:"M7 19H4.815a1.83 1.83 0 0 1-1.57-.881 1.785 1.785 0 0 1-.004-1.784L7.196 9.5",key:"x6z5xu"}],["path",{d:"M11 19h8.203a1.83 1.83 0 0 0 1.556-.89 1.784 1.784 0 0 0 0-1.775l-1.226-2.12",key:"1x4zh5"}],["path",{d:"m14 16-3 3 3 3",key:"f6jyew"}],["path",{d:"M8.293 13.596 7.196 9.5 3.1 10.598",key:"wf1obh"}],["path",{d:"m9.344 5.811 1.093-1.892A1.83 1.83 0 0 1 11.985 3a1.784 1.784 0 0 1 1.546.888l3.943 6.843",key:"9tzpgr"}],["path",{d:"m13.378 9.633 4.096 1.098 1.097-4.096",key:"1oe83g"}]]);/**
237 * @license lucide-react v0.460.0 - ISC
238 *
239 * This source code is licensed under the ISC license.
240 * See the LICENSE file in the root directory of this source tree.
241 */const xt=S("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
242 * @license lucide-react v0.460.0 - ISC
243 *
244 * This source code is licensed under the ISC license.
245 * See the LICENSE file in the root directory of this source tree.
246 */const mt=S("Scale",[["path",{d:"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"7g6ntu"}],["path",{d:"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"ijws7r"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 3v18",key:"108xh3"}
246],["path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",key:"3gwbw2"}]]);/**
247 * @license lucide-react v0.460.0 - ISC
248 *
249 * This source code is licensed under the ISC license.
250 * See the LICENSE file in the root directory of this source tree.
251 */const Ys=S("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
252 * @license lucide-react v0.460.0 - ISC
253 *
254 * This source code is licensed under the ISC license.
255 * See the LICENSE file in the root directory of this source tree.
256 */const Qs=S("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
257 * @license lucide-react v0.460.0 - ISC
258 *
259 * This source code is licensed under the ISC license.
260 * See the LICENSE file in the root directory of this source tree.
261 */const Ce=S("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
262 * @license lucide-react v0.460.0 - ISC
263 *
264 * This source code is licensed under the ISC license.
265 * See the LICENSE file in the root directory of this source tree.
266 */const Xs=S("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
267 * @license lucide-react v0.460.0 - ISC
268 *
269 * This source code is licensed under the ISC license.
270 * See the LICENSE file in the root directory of this source tree.
271 */const le=S("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
272 * @license lucide-react v0.460.0 - ISC
273 *
274 * This source code is licensed under the ISC license.
275 * See the LICENSE file in the root directory of this source tree.
276 */const en=S("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
277 * @license lucide-react v0.460.0 - ISC
278 *
279 * This source code is licensed under the ISC license.
280 * See the LICENSE file in the root directory of this source tree.
281 */const rs=S("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/**
282 * @license lucide-react v0.460.0 - ISC
283 *
284 * This source code is licensed under the ISC license.
285 * See the LICENSE file in the root directory of this source tree.
286 */const ht=S("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
287 * @license lucide-react v0.460.0 - ISC
288 *
289 * This source code is licensed under the ISC license.
290 * See the LICENSE file in the root directory of this source tree.
291 */const nt=S("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/**
292 * @license lucide-react v0.460.0 - ISC
293 *
294 * This source code is licensed under the ISC license.
295 * See the LICENSE file in the root directory of this source tree.
296 */const Le=S("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);/**
297 * @license lucide-react v0.460.0 - ISC
298 *
299 * This source code is licensed under the ISC license.
300 * See the LICENSE file in the root directory of this source tree.
301 */const Ue=S("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
302 * @license lucide-react v0.460.0 - ISC
303 *
304 * This source code is licensed under the ISC license.
305 * See the LICENSE file in the root directory of this source tree.
306 */const tn=S("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
307 * @license lucide-react v0.460.0 - ISC
308 *
309 * This source code is licensed under the ISC license.
310 * See the LICENSE file in the root directory of this source tree.
311 */const We=S("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
312 * @license lucide-react v0.460.0 - ISC
313 *
314 * This source code is licensed under the ISC license.
315 * See the LICENSE file in the root directory of this source tree.
316 */const V=S("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
317 * @license lucide-react v0.460.0 - ISC
318 *
319 * This source code is licensed under the ISC license.
320 * See the LICENSE file in the root directory of this source tree.
321 */const rt=S("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
322 * @license lucide-react v0.460.0 - ISC
323 *
324 * This source code is licensed under the ISC license.
325 * See the LICENSE file in the root directory of this source tree.
326 */const ft=S("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
327 * @license lucide-react v0.460.0 - ISC
328 *
329 * This source code is licensed under the ISC license.
330 * See the LICENSE file in the root directory of this source tree.
331 */const pt=S("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/**
332 * @license lucide-react v0.460.0 - ISC
333 *
334 * This source code is licensed under the ISC license.
335 * See the LICENSE file in the root directory of this source tree.
336 */const sn=S("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
337 * @license lucide-react v0.460.0 - ISC
338 *
339 * This source code is licensed under the ISC license.
340 * See the LICENSE file in the root directory of this source tree.
341 */const as=S("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
342 * @license lucide-react v0.460.0 - ISC
343 *
344 * This source code is licensed under the ISC license.
345 * See the LICENSE file in the root directory of this source tree.
346 */const nn=S("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
347 * @license lucide-react v0.460.0 - ISC
348 *
349 * This source code is licensed under the ISC license.
350 * See the LICENSE file in the root directory of this source tree.
351 */const U=S("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
352 * @license lucide-react v0.460.0 - ISC
353 *
354 * This source code is licensed under the ISC license.
355 * See the LICENSE file in the root directory of this source tree.
356 */const gt=S("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),at={light:{bg:"#F7F8F5",surface:"#FFFFFF",border:"rgba(15, 23, 17, 0.08)",text:"#0F1711",textMuted:"#6B7570",textSoft:"#9AA39E",brand:"#1F8F5E",brandSoft:"#E6F4EC",gold:"#B89968",goldSoft:"#F5EDDC",danger:"#D9534F",dangerSoft:"#FBEAE9",warn:"#E0A82E",warnSoft:"#FBF3DC",cool:"#3E7CB1",coolSoft:"#E4EEF7",outerBg:"#EAECE6"},dark:{bg:"#0E1411",surface:"#171F1B",border:"rgba(255, 255, 255, 0.07)",text:"#F1F4F2",textMuted:"#9CA8A2",textSoft:"#6B7570",brand:"#3FB682",brandSoft:"rgba(63, 182, 130, 0.12)",gold:"#D4B582",goldSoft:"rgba(212, 181, 130, 0.12)",danger:"#E07570",dangerSoft:"rgba(224, 117, 112, 0.12)",warn:"#E8C04F",warnSoft:"rgba(232, 192, 79, 0.12)",cool:"#7AAED7",coolSoft:"rgba(122, 174, 215, 0.12)",outerBg:"#070A08"}},lt="denkzettel-v1",rn=["frugal-guard-v1"],bt=3,Be={schemaVersion:bt,profile:{name:"Du",mode:"Klarheit",currency:"€",monthlyBudget:0,onboarded:!1},ui:{dark:!1},transactions:[],waitingItems:[],rules:[{id:"r1",kind:"tech-threshold",name:"Technik > 100€",desc:"Score +1 ab 100€",active:!0,triggered:0,params:{threshold:100}},{id:"r2",kind:"late-night",name:"Kein Kauf nach 22h",desc:"Score +2 zwischen 22–6 Uhr",active:!0,triggered:0,params:{startHour:22,endHour:6}},{id:"r3",kind:"shop-monthly-limit",name:"Amazon-Limit",desc:"150€ pro Monat bei Amazon",active:!0,triggered:0,params:{shop:"Amazon",limit:150}},{id:"r4",kind:"category-flag",name:"Kleidung-Check",desc:"Score +1, Schrank zuerst prüfen",active:!0,triggered:0,params:{category:"Kleidung"}},{id:"r5",kind:"stress-mode",name:"Stress-Modus",desc:"Verwerfen erzwingen",active:!1,triggered:0}],goals:[{id:"g1",title:"Notgroschen",target:1e4,current:0,deadline:""}],quickItems:[{id:"q1",title:"Coffee to go",price:4,category:"Lebensmittel",emoji:"☕",miniCheck:!0,goalId:null,resistedCount:0,boughtCount:0},{id:"q2",title:"Snack unterwegs",price:3,category:"Lebensmittel",emoji:"🥨",miniCheck:!1,goalId:null,resistedCount:0,boughtCount:0}],stats:{avoidedTotal:0,avoidedCount:0,waitedSuccess:0,impulseTotal:0,impulseCount:0,waitBonus:0},avoidedItems:[],checkDraft:null};function yt(t,s,n=0){if(n>10||typeof s!="object"||s===null||Array.isArray(s))return s;const a={...t};for(const r of Object.keys(s))typeof s[r]=="object"&&s[r]!==null&&!Array.isArray(s[r])?a[r]=yt(t[r]??{},s[r],n+1):a[r]=s[r];return a}const an={"Technik > 100€":{kind:"tech-threshold",params:{threshold:100}},"Kein Kauf nach 22h":{kind:"late-night",params:{startHour:22,endHour:6}},"Amazon-Limit":{kind:"shop-monthly-limit",params:{shop:"Amazon",limit:150}},"Kleidung-Check":{kind:"category-flag",params:{category:"Kleidung"}},"Stress-Modus":{kind:"stress-mode"}};function ls(t){return Array.isArray(t)?t.map(s=>{if(s.kind)return s;const n=an[s.name];return n?{...s,...n}:{...s,kind:"custom"}}):t}function is(){try{let t=localStorage.getItem(lt);if(!t){for(const a of rn){const r=localStorage.getItem(a);if(r){t=r;try{localStorage.setItem(lt,r),localStorage.removeItem(a)}catch{}break}}if(!t)return{...Be}}const s=JSON.parse(t),n=yt(Be,s);return n.schemaVersion=bt,n.rules=ls(n.rules),n.profile&&"location"in n.profile&&delete n.profile.location,"tools"in n&&delete n.tools,n}catch(t){return console.warn("[storage] Konnte State nicht laden, nutze Defaults:",t),{...Be}}}function jt(t){try{return localStorage.setItem(lt,JSON.stringify(t)),!0}catch(s){const n=s;return n.name==="QuotaExceededError"||n.name==="NS_ERROR_DOM_QUOTA_REACHED"?(console.error("[storage] Browser-Speicher voll — Daten nicht gespeichert.",s),window.dispatchEvent(new CustomEvent("denkzettel:quota-exceeded"))):console.error("[storage] Konnte State nicht speichern:",s),!1}}let ge=null;function ln(t,s=300){ge&&clearTimeout(ge),ge=setTimeout(()=>{jt(t),ge=null},s)}function on(t){ge&&(clearTimeout(ge),ge=null,jt(t))}function cn(t){const s=t??is(),n=new Blob([JSON.stringify(s,null,2)],{type:"application/json"}),a=URL.createObjectURL(n),r=document.createElement("a"),l=new Date().toISOString().split("T")[0];r.href=a,r.download=`denkzettel-export-${l}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(a)}async function dn(t){const s=await t.text();let n;try{n=JSON.parse(s)}catch{throw new Error("Datei ist kein gültiges JSON")}if(typeof n!="object"||n===null||Array.isArray(n))throw new Error("Ungültige Datei: kein JSON-Objekt");
356if(!["profile","transactions","rules","goals","quickItems","stats","waitingItems"].some(i=>i in n))throw new Error("Ungültige Datei: kein Denkzettel-Export erkannt");const l=yt(Be,n);return l.schemaVersion=bt,l.rules=ls(l.rules),jt(l),l}const ce=()=>`id_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;function it(t,s){const n={delta:0,reasons:[],triggeredIds:[],blocked:!1};if(!Array.isArray(t))return n;for(const a of t){if(!a.active)continue;let r=!1;switch(a.kind){case"tech-threshold":{const l=a.params?.threshold??100;s.category==="Technik"&&s.price>=l&&(n.delta+=1,n.reasons.push(`Technik ab ${l}€ — bewusster prüfen`),r=!0);break}case"late-night":{const l=a.params?.startHour??22,i=a.params?.endHour??6;(l<=i?s.hour>=l&&s.hour<i:s.hour>=l||s.hour<i)&&(n.delta+=2,n.reasons.push(`Späte Tageszeit (${s.hour}:00)`),r=!0);break}case"shop-monthly-limit":{const l=a.params?.shop,i=a.params?.limit??150;if(!l||!(s.shop||"").toLowerCase().includes(l.toLowerCase()))break;(s.monthlyShopSpend?.[l.toLowerCase()]??0)+s.price>i&&(n.delta+=2,n.reasons.push(`${l}-Limit ${i}€/Monat überschritten`),r=!0);break}case"category-flag":{const l=a.params?.category;l&&s.category===l&&(n.delta+=1,l==="Kleidung"?n.reasons.push("Erst im Schrank prüfen ob etwas Ähnliches da ist"):n.reasons.push(`Kategorie-Check: ${l}`),r=!0);break}case"stress-mode":{n.delta+=5,n.reasons.push("Stress-Modus aktiv — keine Käufe"),n.blocked=!0,r=!0;break}}r&&n.triggeredIds.push(a.id)}return n}function un(t){const s=new Date,n={};for(const a of t){if(a.amount>=0||!a.shop)continue;const r=new Date(a.date);if(r.getMonth()!==s.getMonth()||r.getFullYear()!==s.getFullYear())continue;const l=a.shop.toLowerCase();n[l]=(n[l]||0)+Math.abs(a.amount)}return n}function xn(){const[t,s]=o.useState(()=>is()),n=o.useRef(t);n.current=t,o.useEffect(()=>{ln(t)},[t]),o.useEffect(()=>()=>on(n.current),[]);const a=o.useCallback(v=>{s(k=>({...k,ui:{...k.ui,dark:v}}))},[]),r=o.useCallback(v=>{s(k=>({...k,profile:{...k.profile,...v}}))},[]),l=o.useCallback(v=>{const k={id:ce(),date:new Date().toISOString(),tags:[],source:"manual",icon:(v.amount??0)<0?"🛍️":"💰",title:"",amount:0,category:"Sonstiges",...v};return s(y=>({...y,transactions:[k,...y.transactions]})),k},[]),i=o.useCallback((v,k)=>{s(y=>({...y,transactions:y.transactions.map(w=>w.id===v?{...w,...k}:w)}))},[]),c=o.useCallback(v=>{s(k=>({...k,transactions:k.transactions.filter(y=>y.id!==v)}))},[]),d=o.useCallback((v,k)=>{const y=k!=null?Date.now()+k*3600*1e3:null,w={id:ce(),title:v.title??"",price:parseFloat(String(v.price??0))||0,category:v.category??"Sonstiges",url:v.url??null,shop:v.shop??"",createdAt:Date.now(),endsAt:y,waitHours:k,decision:v.decision??null,status:"waiting",snoozeCount:0};return s(E=>({...E,waitingItems:[w,...E.waitingItems]})),w},[]),p=o.useCallback((v,k)=>{s(y=>({...y,waitingItems:y.waitingItems.map(w=>{if(w.id!==v)return w;const E={...w,...k};return k.price!==void 0&&(E.price=parseFloat(String(k.price))||0),E})}))},[]),u=o.useCallback((v,k)=>{s(y=>{const w=y.waitingItems.find(q=>q.id===v);if(!w)return y;let E=y.transactions,P={...y.stats},xe=y.avoidedItems||[];if(k==="buy")E=[{id:ce(),title:w.title,amount:-w.price,category:w.category,tags:["Wertvoll","Wartezeit bestanden"],date:new Date().toISOString(),icon:"✅",url:w.url,source:"check-waited"},...y.transactions];else if(k==="dismiss"){P.avoidedTotal+=w.price,P.avoidedCount+=1,P.waitedSuccess+=1;const q=w.snoozeCount??0;P.waitBonus=(P.waitBonus??0)+3+3*q,xe=[{id:ce(),title:w.title,price:w.price,category:w.category,url:w.url,date:new Date().toISOString(),reason:"waited"},...xe]}return{...y,transactions:E,waitingItems:y.waitingItems.map(q=>q.id===v?{...q,status:k==="buy"?"bought":"dismissed",resolvedAt:Date.now()}:q),stats:P,avoidedItems:xe}})},[]),m=o.useCallback((v,k)=>{s(y=>({...y,waitingItems:y.waitingItems.map(w=>{if(w.id!==v)return w;const E=w.endsAt&&w.endsAt>Date.now()?w.endsAt:Date.now();return{...w,endsAt:E+k*3600*1e3,waitHours:k,status:"waiting",snoozeCount:(w.snoozeCount??0)+1}})}))},[]),h=o.useCallback(v=>{s(k=>({...k,waitingItems:k.waitingItems.filter(y=>y.id!==v)}))}
356,[]),b=o.useCallback(v=>{s(k=>({...k,rules:[...k.rules,{id:ce(),active:!0,triggered:0,kind:"custom",name:"",...v}]}))},[]),x=o.useCallback(v=>{s(k=>({...k,rules:k.rules.map(y=>y.id===v?{...y,active:!y.active}:y)}))},[]),f=o.useCallback((v,k)=>{s(y=>({...y,rules:y.rules.map(w=>w.id===v?{...w,...k}:w)}))},[]),g=o.useCallback(v=>{s(k=>({...k,rules:k.rules.filter(y=>y.id!==v)}))},[]),j=o.useCallback(v=>{v?.length&&s(k=>({...k,rules:k.rules.map(y=>v.includes(y.id)?{...y,triggered:(y.triggered||0)+1}:y)}))},[]),M=o.useCallback(v=>{const k=new Set(v);s(y=>({...y,rules:y.rules.map(w=>w.id?.startsWith("r")?{...w,active:k.has(w.id)}:w)}))},[]),W=o.useCallback(v=>{s(k=>({...k,goals:[...k.goals,{id:ce(),current:0,title:"",target:0,...v}]}))},[]),z=o.useCallback((v,k)=>{s(y=>({...y,goals:y.goals.map(w=>w.id===v?{...w,...k}:w)}))},[]),D=o.useCallback((v,k)=>{s(y=>({...y,goals:y.goals.map(w=>w.id===v?{...w,current:w.current+k}:w)}))},[]),I=o.useCallback(v=>{s(k=>({...k,goals:k.goals.filter(y=>y.id!==v)}))},[]),F=o.useCallback(v=>{s(k=>({...k,quickItems:[...k.quickItems||[],{id:ce(),title:"",category:"Lebensmittel",emoji:"",miniCheck:!1,goalId:null,resistedCount:0,boughtCount:0,...v,price:parseFloat(String(v.price??0))||0}]}))},[]),J=o.useCallback((v,k)=>{s(y=>({...y,quickItems:(y.quickItems||[]).map(w=>{if(w.id!==v)return w;const E={...w,...k};return k.price!==void 0&&(E.price=parseFloat(String(k.price))||0),E})}))},[]),ne=o.useCallback(v=>{s(k=>({...k,quickItems:(k.quickItems||[]).filter(y=>y.id!==v)}))},[]),B=o.useCallback(v=>{s(k=>{const y=(k.quickItems||[]).find(E=>E.id===v);if(!y)return k;const w={id:ce(),title:y.title,price:y.price,category:y.category,url:null,date:new Date().toISOString(),reason:"check"};return{...k,stats:{...k.stats,avoidedTotal:k.stats.avoidedTotal+y.price,avoidedCount:k.stats.avoidedCount+1},avoidedItems:[w,...k.avoidedItems||[]],goals:y.goalId?k.goals.map(E=>E.id===y.goalId?{...E,current:E.current+y.price}:E):k.goals,quickItems:(k.quickItems||[]).map(E=>E.id===v?{...E,resistedCount:(E.resistedCount??0)+1}:E)}})},[]),$=o.useCallback(v=>{s(k=>{const y=(k.quickItems||[]).find(E=>E.id===v);if(!y)return k;const w={id:ce(),title:y.title,amount:-y.price,category:y.category,tags:["Impuls"],date:new Date().toISOString(),icon:y.emoji||"⚡",source:"check",url:null};return{...k,transactions:[w,...k.transactions],stats:{...k.stats,impulseTotal:k.stats.impulseTotal+y.price,impulseCount:k.stats.impulseCount+1},quickItems:(k.quickItems||[]).map(E=>E.id===v?{...E,boughtCount:(E.boughtCount??0)+1}:E)}})},[]),H=o.useCallback(v=>{s(k=>({...k,stats:{...k.stats,impulseTotal:k.stats.impulseTotal+v,impulseCount:k.stats.impulseCount+1}}))},[]),re=o.useCallback((v,k)=>{s(y=>{const w=k&&k.title?{id:ce(),title:k.title,price:v,category:k.category||"Sonstiges",url:k.url??null,date:new Date().toISOString(),reason:"check"}:null;return{...y,stats:{...y.stats,avoidedTotal:y.stats.avoidedTotal+v,avoidedCount:y.stats.avoidedCount+1},avoidedItems:w?[w,...y.avoidedItems||[]]:y.avoidedItems}})},[]),ie=o.useCallback(v=>{s(k=>{const y=(k.avoidedItems||[]).find(w=>w.id===v);return y?{...k,avoidedItems:(k.avoidedItems||[]).filter(w=>w.id!==v),stats:{...k.stats,avoidedTotal:Math.max(0,k.stats.avoidedTotal-(y.price||0)),avoidedCount:Math.max(0,k.stats.avoidedCount-1),waitedSuccess:y.reason==="waited"?Math.max(0,k.stats.waitedSuccess-1):k.stats.waitedSuccess}}:k})},[]),A=o.useMemo(()=>{const v=new Date,k=t.transactions.filter(_=>{const Ne=new Date(_.date);return Ne.getMonth()===v.getMonth()&&Ne.getFullYear()===v.getFullYear()}),y=Math.abs(k.filter(_=>_.amount<0).reduce((_,Ne)=>_+Ne.amount,0)),w=k.filter(_=>_.amount>0).reduce((_,Ne)=>_+Ne.amount,0),E=w>0?Math.max(0,(w-y)/w*100):0,P=k.filter(_=>_.tags?.includes("Wertvoll")||_.tags?.includes("Wartezeit bestanden")).length,xe=k.filter(_=>_.tags?.includes("Impuls")).length,q=P+xe,Ze=q>0?P/q:.5,we=Math.min(20,t.stats.avoidedCount*5),fe=Math.round(50+Ze*30+we),se=Math.min(100,Math.max(0,fe)),Z=t.stats.waitBonus??0,oe=se>=100?Math.min(130,100+Z):se,pe=oe>=130?3:oe>=120?2:oe>=110?1:0,Ie=t.waitingItems.filter(_=>_.status==="waiting"),Je=un(t.transactions);return{spent:y,income:w,savingsRate:E,frugalScore:se,frugalScoreRaw:oe,frugalStars:pe,activeWaiting:
356Ie,monthTransactions:k,monthlyShopSpend:Je}},[t.transactions,t.waitingItems,t.stats]),C=o.useCallback(()=>{s(JSON.parse(JSON.stringify(Be)))},[]),G=o.useCallback(v=>{s(v)},[]),K=o.useCallback(v=>{s(k=>({...k,checkDraft:v}))},[]),ue=o.useCallback(()=>{s(v=>v.checkDraft?{...v,checkDraft:null}:v)},[]),he=o.useMemo(()=>({setDark:a,updateProfile:r,addTransaction:l,updateTransaction:i,deleteTransaction:c,addWaitingItem:d,updateWaitingItem:p,resolveWaitingItem:u,snoozeWaitingItem:m,deleteWaitingItem:h,addRule:b,toggleRule:x,updateRule:f,deleteRule:g,incrementRuleTriggers:j,setRulesActive:M,addGoal:W,updateGoal:z,depositToGoal:D,deleteGoal:I,addQuickItem:F,updateQuickItem:J,deleteQuickItem:ne,resistQuickItem:B,buyQuickItem:$,recordImpulse:H,recordAvoided:re,deleteAvoidedItem:ie,saveCheckDraft:K,clearCheckDraft:ue,resetAll:C,replaceState:G}),[a,r,l,i,c,d,p,u,m,h,b,x,f,g,j,M,W,z,D,I,F,J,ne,B,$,H,re,ie,K,ue,C,G]);return{state:t,setState:s,derived:A,actions:he}}const mn="modulepreload",hn=function(t,s){return new URL(t,s).href},At={},fn=function(s,n,a){let r=Promise.resolve();if(n&&n.length>0){const i=document.getElementsByTagName("link"),c=document.querySelector("meta[property=csp-nonce]"),d=c?.nonce||c?.getAttribute("nonce");r=Promise.allSettled(n.map(p=>{if(p=hn(p,a),p in At)return;At[p]=!0;const u=p.endsWith(".css"),m=u?'[rel="stylesheet"]':"";if(!!a)for(let x=i.length-1;x>=0;x--){const f=i[x];if(f.href===p&&(!u||f.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${p}"]${m}`))return;const b=document.createElement("link");if(b.rel=u?"stylesheet":mn,u||(b.as="script"),b.crossOrigin="",b.href=p,d&&b.setAttribute("nonce",d),document.head.appendChild(b),u)return new Promise((x,f)=>{b.addEventListener("load",x),b.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${p}`)))})}))}function l(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return r.then(i=>{for(const c of i||[])c.status==="rejected"&&l(c.reason);return s().catch(l)})},pn="https://krkrmvvfsbcmpldvjbyo.supabase.co",os="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imtya3JtdnZmc2JjbXBsZHZqYnlvIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODA2NzczNjksImV4cCI6MjA5NjI1MzM2OX0.Btg1vSOp5Yq4qMHI1arDsdPQKFDSvUv2UW1INUhnk3w",be=!!os,gn="BJyIvlgAE17oOcriqg-aLdHaeeVMUisfVUTCZ07xyRf6saKJh3SDXzxDpUF_MwR9CeND0w6ZLiOY5GPqyvGsbUk";let Ye=null;function Q(){return be?(Ye||(Ye=fn(async()=>{const{createClient:t}=await import("./index-N-_tOrEr.js");return{createClient:t}},[],import.meta.url).then(({createClient:t})=>t(pn,os,{auth:{persistSession:!0,autoRefreshToken:!0}}))),Ye):Promise.resolve(null)}const Fe="Sync ist nicht konfiguriert.";function bn(){const[t,s]=o.useState(null),[n,a]=o.useState(!be),[r,l]=o.useState(!1);o.useEffect(()=>{if(!be)return;let h=!0,b;return(async()=>{const x=await Q();if(!x||!h)return;const{data:f}=await x.auth.getSession();if(!h)return;s(f.session),a(!0);const{data:g}=x.auth.onAuthStateChange((j,M)=>{s(M),j==="PASSWORD_RECOVERY"&&l(!0)});b=()=>g.subscription.unsubscribe()})(),()=>{h=!1,b?.()}},[]);const i=o.useCallback(async(h,b)=>{const x=await Q();if(!x)return{error:Fe};const{error:f}=await x.auth.signUp({email:h.trim(),password:b});return{error:f?.message}},[]),c=o.useCallback(async(h,b)=>{const x=await Q();if(!x)return{error:Fe};const{error:f}=await x.auth.signInWithPassword({email:h.trim(),password:b});return{error:f?.message}},[]),d=o.useCallback(async()=>{const h=await Q();h&&await h.auth.signOut()},[]),p=o.useCallback(async h=>{const b=await Q();if(!b)return{error:Fe};const{error:x}=await b.auth.resetPasswordForEmail(h.trim());return{error:x?.message}},[]),u=o.useCallback(async h=>{const b=await Q();if(!b)return{error:Fe};const{error:x}=await b.auth.updateUser({password:h});return x||l(!1),{error:x?.message}},[]),m=o.useCallback(async()=>{const h=await Q();if(!h)return{error:Fe};const{error:b}=await h.functions.invoke("delete-account",{method:"POST"});return b?{error:b.message}:(await h.auth.signOut(),{})},[]);return{session:t,user:t?.user??null,ready:n,passwordRecovery:r,signUp:i,signIn:c,signOut:d,resetPassword:p,updatePassword:u,deleteAccount:m}}const cs="user_state",ds="denkzettel-sync-mtime-v1";function yn(){try{return Number(localStorage.getItem(ds))||0}catch{return 0}}
356function It(t){try{localStorage.setItem(ds,String(t))}catch{}}async function jn(){const t=await Q();if(!t)return null;const{data:s,error:n}=await t.from(cs).select("state, client_mtime").maybeSingle();return n?(console.warn("[sync] pull fehlgeschlagen:",n.message),null):s?{state:s.state,clientMtime:Number(s.client_mtime)||0}:null}async function Ft(t,s,n){const a=await Q();if(!a)return!1;const{error:r}=await a.from(cs).upsert({user_id:t,state:s,client_mtime:n,schema_version:s.schemaVersion,updated_at:new Date().toISOString()});return r?(console.warn("[sync] push fehlgeschlagen:",r.message),!1):!0}function kn(t){const s="=".repeat((4-t.length%4)%4),n=(t+s).replace(/-/g,"+").replace(/_/g,"/"),a=atob(n),r=new Uint8Array(new ArrayBuffer(a.length));for(let l=0;l<a.length;l++)r[l]=a.charCodeAt(l);return r}function us(){return typeof navigator<"u"&&"serviceWorker"in navigator&&typeof window<"u"&&"PushManager"in window}async function vn(t){if(!us()||Notification.permission!=="granted")return!1;const s=await Q();if(!s)return!1;try{const n=await navigator.serviceWorker.ready;let a=await n.pushManager.getSubscription();a||(a=await n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:kn(gn)}));const r=a.toJSON(),{error:l}=await s.from("push_subscriptions").upsert({user_id:t,endpoint:a.endpoint,p256dh:r.keys?.p256dh??"",auth:r.keys?.auth??""},{onConflict:"endpoint"});return!l}catch(n){return console.warn("[push] enable fehlgeschlagen:",n),!1}}async function Tt(t,s){const n=await Q();if(!n)return;const a=s.filter(r=>r.status==="waiting"&&r.endsAt);try{await n.from("reminders").delete().eq("user_id",t).eq("sent",!1),a.length&&await n.from("reminders").insert(a.map(r=>({user_id:t,item_id:r.id,title:r.title,price:r.price,ends_at:new Date(r.endsAt).toISOString()})))}catch(r){console.warn("[push] syncReminders fehlgeschlagen:",r)}}const xs="profiles";async function wn(){const t=await Q();if(!t)return!1;const{data:s,error:n}=await t.from(xs).select("marketing_consent").maybeSingle();return n?(console.warn("[marketing] read consent:",n.message),!1):!!s?.marketing_consent}async function Bt(t,s){const n=await Q();if(!n)return!1;const{error:a}=await n.from(xs).upsert({user_id:t,marketing_consent:s,updated_at:new Date().toISOString()});return a&&console.warn("[marketing] write consent:",a.message),!a}const Nn="denkzettel-notif-asked-v1",Me=new Map;function De(){return typeof window<"u"&&"Notification"in window}function Rt(){return De()?Notification.permission:"unsupported"}async function ms(){if(!De())return"unsupported";try{localStorage.setItem(Nn,"1")}catch{}try{return await Notification.requestPermission()}catch(t){return console.warn("[notifications] Permission-Request fehlgeschlagen:",t),"default"}}async function Sn(t,s){if(De()&&Notification.permission==="granted"){if("serviceWorker"in navigator)try{await(await navigator.serviceWorker.ready).showNotification(t,s);return}catch{}try{new Notification(t,s)}catch(n){console.warn("[notifications] show failed:",n)}}}function zn(t){if(!t||t.status!=="waiting")return;const s=(t.endsAt??0)-Date.now();if(He(t.id),s<=0){$t(t);return}const n=Math.min(s,2147e6),a=setTimeout(()=>{Me.delete(t.id),$t(t)},n);Me.set(t.id,a)}function $t(t){Sn("Wartezeit beendet",{body:`${t.title} · ${t.price.toFixed(0)} € — Lust noch da?`,tag:`waiting-${t.id}`,icon:"./icon-192.png",badge:"./icon-192.png",data:{type:"waiting-end",itemId:t.id,url:t.url??null},requireInteraction:!1})}function He(t){const s=Me.get(t);s!==void 0&&(clearTimeout(s),Me.delete(t))}function Cn(t){for(const s of Array.from(Me.keys()))t.some(n=>n.id===s&&n.status==="waiting")||He(s);for(const s of t)s.status==="waiting"&&!Me.has(s.id)&&zn(s)}const Mn=1500,Qe="denkzettel-marketing-pending";function Dn(t){const s=bn(),n=s.user?.id??null,[a,r]=o.useState("idle"),[l,i]=o.useState(null),[c,d]=o.useState(!1),[p,u]=o.useState(!1),m=o.useRef(yn()),h=o.useRef(t.state);h.current=t.state;const b=o.useRef(!0);o.useEffect(()=>{if(b.current){b.current=!1;return}m.current=Date.now(),It(m.current)},[t.state]),o.useEffect(()=>{if(!be)return;if(!n){r("idle"),d(!1);return}let g=!1;r("syncing");const j=setTimeout(()=>{g||r("error")},12e3);return(async()=>{try{const M=await jn();if(g)return;M&&M.clientMtime>m.current?(t.actions.replaceState(M.state),m.current=M.clientMtime,It(m.current)):await Ft(n,h.current,m.current),g||(r("synced"),i(Date.now()))}catch{g||r("error")}finally{clearTimeout(j)}})(),()=>{g=!0,clearTimeout(j)}},[n,t.actions]),o.useEffect(()=>{if(!be||!n)return;const g=setTimeout(()=>{Ft(n,h.current,m.current),Tt(n,h.current.waitingItems),i(Date.now())},Mn);return()=>clearTimeout(g)},[t.state,n]),o.useEffect(()=>{if(!be||!n){u(!1);return}let g=!1;return(async()=>{let j=null;try{j=localStorage.getItem(Qe)}catch{}if(j!==null){const M=j==="1";await Bt(n,M);try{localStorage.removeItem(Qe)}catch{}g||u(M)}else{const M=await wn();g||u(M)}})(),()=>{g=!0}},[n]);const x=o.useCallback(async g=>{if(u(g),n){const j=await Bt(n,g);return j||u(!g),j}try{localStorage.setItem(Qe,g?"1":"0")}catch{}return!0},[n]),f=o.useCallback(async()=>
356{if(!n||await ms()!=="granted")return!1;const j=await vn(n);return d(j),j&&await Tt(n,h.current.waitingItems),j},[n]);return{enabled:be,auth:s,status:a,lastSyncedAt:l,pushSupported:us(),pushEnabled:c,enablePushNotifications:f,marketingConsent:p,setMarketingConsent:x}}function kt(t=1e3){const[s,n]=o.useState(Date.now());return o.useEffect(()=>{const a=setInterval(()=>n(Date.now()),t);return()=>clearInterval(a)},[t]),s}function hs(t,s=Date.now()){if(t===null)return{done:!0,days:0,hours:0,minutes:0,seconds:0,label:"Kaufen erlaubt"};const n=t-s;if(n<=0)return{done:!0,days:0,hours:0,minutes:0,seconds:0,label:"Wartezeit beendet"};const a=Math.floor(n/1e3),r=Math.floor(a/86400),l=Math.floor(a%86400/3600),i=Math.floor(a%3600/60),c=a%60;let d;return r>0?d=`Noch ${r} Tag${r>1?"e":""} ${l} Std.`:l>0?d=`Noch ${l} Std. ${i} Min.`:i>0?d=`Noch ${i} Min. ${c} Sek.`:d=`Noch ${c} Sek.`,{done:!1,days:r,hours:l,minutes:i,seconds:c,label:d}}function En(t=600){const[s,n]=o.useState(()=>typeof document>"u"||!document.fonts?!0:document.fonts.status==="loaded");return o.useEffect(()=>{if(s)return;let a=!1;const r=setTimeout(()=>{a||n(!0)},t);return typeof document<"u"&&document.fonts?.ready&&document.fonts.ready.then(()=>{a||n(!0)}).catch(()=>{}),()=>{a=!0,clearTimeout(r)}},[s,t]),s}const An={questionWeights:{},waitHours:{used:24,wait:48},tone:"neutral",usedFirst:!1,patternFocus:"all"},$e=[{id:"Klarheit",title:"Klarheit",short:"Bewusst, ohne Verzicht",body:"Ausgewogenes Setup. Hilft dir, Impulskäufe zu erkennen und bei größeren Anschaffungen kurz innezuhalten — ohne ständige Bremse.",activeRuleIds:["r1","r2"],greeting:t=>t<11?"Guten Morgen":t<18?"Guten Tag":"Guten Abend",profile:{questionWeights:{},waitHours:{used:24,wait:48},tone:"neutral",usedFirst:!1,patternFocus:"all"}},{id:"FIRE",title:"FIRE",short:"Maximale Sparquote",body:"Strenges Setup für Financial Independence / Early Retirement. Aktiviert Shop-Limits und enge Schwellen — jeder Euro zählt für dein Vermögensziel.",activeRuleIds:["r1","r2","r3"],greeting:()=>"Sparquote im Blick",profile:{questionWeights:{usage:1.3,why:1.2,used:1.2},waitHours:{used:48,wait:72},tone:"fire",usedFirst:!0,patternFocus:"savings"}},{id:"Familie",title:"Familie",short:"Haushaltsoptimierung",body:"Fokus auf Alltagsentscheidungen. Aktiviert Schrank-Check für Kleidung und Spätstunden-Block, damit nachts nicht versehentlich Kinderkram im Warenkorb landet.",activeRuleIds:["r1","r2","r4"],greeting:()=>"Was ist heute wirklich wichtig?",profile:{questionWeights:{similar:1.2,used:1.3},waitHours:{used:24,wait:48},tone:"family",usedFirst:!0,patternFocus:"family"}},{id:"ADHS",title:"ADHS",short:"Impulsschutz im Vordergrund",body:"Maximaler Reibungspuffer. Alle Schutzregeln sind an. Der Stress-Modus ist verfügbar (über Regeln-Tab) und blockiert bei Bedarf jeden Kauf komplett.",activeRuleIds:["r1","r2","r3","r4"],greeting:()=>"Heute ohne Impulskauf?",profile:{questionWeights:{emotional:1.4,why:1.3},waitHours:{used:24,wait:24},tone:"adhs",usedFirst:!1,patternFocus:"time"}},{id:"Unternehmer",title:"Unternehmer",short:"ROI statt Konsum",body:"Für Selbstständige und Gründer. Aktiviert Tech-Schwelle und Shop-Limit — Anschaffungen müssen sich rechnen, kein Schnellschuss.",activeRuleIds:["r1","r3"],greeting:()=>"ROI statt Konsum",profile:{questionWeights:{usage:1.4,need:1.2},waitHours:{used:24,wait:48},tone:"business",usedFirst:!1,patternFocus:"savings"}}];function je(t){return $e.find(s=>s.id===t)??$e[0]}function In(t){return je(t).profile??An}const fs=/https?:\/\/[^\s]+/i,Fn=/(\d{1,6}(?:[.,]\d{1,2})?)\s*(?:€|eur)/i,Tn={amazon:"Amazon",ebay:"eBay",otto:"Otto",zalando:"Zalando",aboutyou:"AboutYou",mediamarkt:"MediaMarkt",saturn:"Saturn",idealo:"idealo",kaufland:"Kaufland",lidl:"Lidl",aldi:"Aldi",ikea:"IKEA",apple:"Apple",thalia:"Thalia",douglas:"Douglas",rossmann:"Rossmann",decathlon:"Decathlon",shein:"SHEIN",temu:"Temu",hm:"H&M",dm:"dm"};function Bn(t){if(t)try{const n=new URL(t).hostname.replace(/^www\./i,"").split("."),a=n.length>=2?n[n.length-2]:n[0];return a?Tn[a]??a.charAt(0).toUpperCase()+a.slice(1):void 0}catch{return}}const ps={"Bücher/Medien":["buch","bücher","kindle","hörbuch","hörspiel","audible","roman","taschenbuch","gebundenes","ebook","e-book","dvd","blu-ray","vinyl","schallplatte","comic","manga","book","paperback","hardcover"],Lebensmittel:["lebensmittel","getränk","getränke","kaffee","supermarkt","grocery","food","snack","süßwaren","wein","bier"],Kleidung:["bekleidung","kleidung","mode","schuh","schuhe","shirt","hose","jacke","kleid","pullover","sneaker","fashion","clothing","shoes","accessoires","schmuck","uhren","tasche","taschen"],Mobilität:["auto","kfz","motorrad","fahrrad","e-bike","scooter","reifen","automotive","bike","roller"],Wohnen:["küche","haushalt","möbel","wohnen","garten","heimwerker","baumarkt","beleuchtung","lampe","bett","matratze","deko","furniture","werkzeug","home"],Freizeit:["sport","fitness","outdoor","camping","spielzeug","spielwaren","spiele","freizeit","hobby","musikinstrument","toys","baby"],Technik:["elektronik","computer","laptop","notebook","foto","kamera","handy","smartphone","tablet","kopfhörer","fernseher","tv","audio","konsole","gaming","technik","drucker","monitor","software","electronics"]},Rn=[...Object.keys(ps),"Sonstiges"],$n=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Ln=Object.entries(ps).map(([t,s])=>({cat:t,re:new RegExp(`\\b(?:${s.map($n).join("|")})\\b`,"i")}));function Wn(t,s){const n=(t||"").trim();if(Rn.includes(n))return n;const a=`${t||""} ${s||""}`;if(a.trim()){for(const{cat:r,re:l}of Ln)if(l.test(a))return r}}function Pn(...t){for(const s of t){const n=s?.match(fs);if(n)return n[0]}}function Kn(...t){for(const s of t){const n=s?.match(Fn);if(n)return n[1].replace(",",".")}}function On(t){const s=new URLSearchParams(t||""),n=(s.get("title")||s.get("name")||"").trim(),a=s.get("text")||"",r=s.get("url")||"",l=Pn(r,a);let i=n;!i&&a&&(i=a.replace(fs,"").trim().slice(0,80));const c=Kn(a,n),d=(s.get("shop")||"").trim()||Bn(l),p=Wn(s.get("category"),i);return!i&&!l&&!c?null:{title:i,url:l,price:c,shop:d,category:p}}const N=({t,w:s="100%",h:n=12,rounded:a=8,className:r="",style:l={}})=>{const i=`${t.text}0D`,c=`${t.text}1A`;return e.jsx("div",{className:`relative overflow-hidden ${r}`,style:{width:s,height:n,borderRadius:a,background:i,...l},"aria-hidden":"true",children:e.jsx(T.div,{className:"absolute inset-y-0",style:{width:"60%",background:`linear-gradient(90deg, transparent 0%, ${c} 50%, transparent 100%)`},initial:{x:"-100%"},animate:{x:"200%"},transition:{duration:1.4,repeat:1/0,ease:"linear"}})})},X=({t,padding:s="p-5",className:n="",children:a})=>e.jsx("div",{className:`rounded-2xl ${s} ${n}`,style:{background:t.surface,border:`1px solid ${t.border}`,boxShadow:"0 1px 2px rgba(0,0,0,0.02), 0 8px 24px -12px rgba(0,0,0,0.06)"},children:a}),R=({children:t,t:s,className:n="",onClick:a,padding:r="p-5"})=>e.jsx("div",{onClick:a,className:`rounded-2xl ${r} ${n} ${a?"cursor-pointer active:scale-[0.99]":""} transition-transform`,style:{background:s.surface,border:`1px solid ${s.border}`,boxShadow:"0 1px 2px rgba(0,0,0,0.02), 0 8px 24px -12px rgba(0,0,0,0.06)"},children:t}),ye=({children:t,t:s,tone:n="neutral"})=>{const a={neutral:{bg:`${s.text}10`,fg:s.textMuted},brand:{bg:s.brandSoft,fg:s.brand},gold:{bg:s.goldSoft,fg:s.gold},danger:{bg:s.dangerSoft,fg:s.danger},warn:{bg:s.warnSoft,fg:s.warn},cool:{bg:s.coolSoft,fg:s.cool}},{bg:r,fg:l}=a[n];return e.jsx("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[12px] font-semibold uppercase tracking-wider",style:{background:r,color:l},children:t})},Hn=({value:t,size:s=96,stroke:n=7,color:a,track:r})=>{const l=(s-n)/2,i=2*Math.PI*l,c=i-Math.min(t,100)/100*i;return e.jsxs("svg",{width:s,height:s,className:"-rotate-90",children:[e.jsx("circle",{cx:s/2,cy:s/2,r:l,stroke:r,strokeWidth:n,fill:"none"}),e.jsx(T.circle,{cx:s/2,cy:s/2,r:l,stroke:a,strokeWidth:n,fill:"none",strokeLinecap:"round",strokeDasharray:i,initial:{strokeDashoffset:i},animate:{strokeDashoffset:c},transition:{duration:1.1,ease:[.16,1,.3,1]}})]})},ot=({value:t,t:s,color:n})=>e.jsx("div",{className:"h-2 overflow-hidden rounded-full",style:{background:`${s.text}0D`},children:e.jsx(T.div,{initial:{width:0},animate:{width:`${Math.min(t,100)}%`},transition:{duration:1,ease:[.16,1,.3,1]},className:"h-full rounded-full",style:{background:n||s.brand}})}),L=({t,label:s,hint:n,prefix:a,suffix:r,...l})=>e.jsxs("div",{children:[s&&e.jsxs("label",{className:"text-[13px] uppercase tracking-wider font-semibold flex items-center gap-1.5",style:{color:t.textSoft},children:[s," ",n&&e.jsx("span",{style:{opacity:.6,textTransform:"none",letterSpacing:0},children:n})]}),e.jsxs("div",{className:"relative mt-1.5",children:[a&&e.jsx("span",{className:"absolute left-4 top-1/2 -translate-y-1/2 text-sm",style:{color:t.textSoft},children:a}),e.jsx("input",{...l,className:`w-full rounded-xl px-4 py-3 text-[15px] outline-none ${a?"pl-8":""}
356 ${r?"pr-9":""}`,style:{background:t.surface,border:`1px solid ${t.border}`,color:t.text}}),r&&e.jsx("span",{className:"absolute right-4 top-1/2 -translate-y-1/2 text-sm",style:{color:t.textSoft},children:r})]})]}),Lt=({t,label:s,hint:n,...a})=>{const[r,l]=o.useState(!1);return e.jsxs("div",{children:[s&&e.jsxs("label",{className:"text-[13px] uppercase tracking-wider font-semibold flex items-center gap-1.5",style:{color:t.textSoft},children:[s," ",n&&e.jsx("span",{style:{opacity:.6,textTransform:"none",letterSpacing:0},children:n})]}),e.jsxs("div",{className:"relative mt-1.5",children:[e.jsx("input",{...a,type:r?"text":"password",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,className:"w-full rounded-xl px-4 py-3 pr-12 text-[15px] outline-none",style:{background:t.surface,border:`1px solid ${t.border}`,color:t.text}}),e.jsx("button",{type:"button",onClick:()=>l(i=>!i),"aria-label":r?"Passwort verbergen":"Passwort anzeigen","aria-pressed":r,className:"absolute right-2 top-1/2 -translate-y-1/2 flex h-9 w-9 items-center justify-center rounded-lg",style:{color:t.textSoft},children:r?e.jsx(Os,{size:17}):e.jsx(Hs,{size:17})})]})]})},O=({t,children:s,...n})=>e.jsx("button",{...n,className:"w-full rounded-2xl py-3.5 text-[15px] font-semibold transition disabled:opacity-40 active:scale-[0.99]",style:{background:t.brand,color:"#fff"},children:s}),ve=({t,children:s,...n})=>e.jsx("button",{...n,className:"w-full rounded-2xl py-3.5 text-[15px] font-medium transition active:scale-[0.99]",style:{background:"transparent",border:`1px solid ${t.border}`,color:t.textMuted},children:s}),qe=({t,title:s,onBack:n,right:a})=>e.jsxs("div",{className:"flex items-center justify-between px-4 pt-4 pb-2",children:[n?e.jsx("button",{onClick:n,className:"flex h-9 w-9 items-center justify-center rounded-full -ml-1.5",style:{color:t.textMuted},"aria-label":"Zurück",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m15 18-6-6 6-6"})})}):e.jsx("div",{className:"w-9"}),e.jsx("div",{className:"text-sm font-semibold",style:{color:t.text},children:s}),e.jsx("div",{className:"w-9 flex justify-end",children:a})]});function Gn({t}){return e.jsxs("div",{className:"space-y-4 pb-28",children:[e.jsxs("div",{className:"px-1 pt-2 space-y-2",children:[e.jsx(N,{t,w:90,h:10}),e.jsx(N,{t,w:160,h:26})]}),e.jsx(X,{t,padding:"p-6",children:e.jsxs("div",{className:"flex items-center gap-5",children:[e.jsx(N,{t,w:104,h:104,rounded:104}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(N,{t,w:90,h:20,rounded:999}),e.jsx(N,{t,w:"85%",h:14}),e.jsx(N,{t,w:"60%",h:10})]})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs(X,{t,children:[e.jsx(N,{t,w:80,h:10}),e.jsx("div",{className:"mt-2",children:e.jsx(N,{t,w:70,h:24})}),e.jsx("div",{className:"mt-3",children:e.jsx(N,{t,w:"100%",h:8,rounded:999})})]}),e.jsxs(X,{t,children:[e.jsx(N,{t,w:80,h:10}),e.jsx("div",{className:"mt-2",children:e.jsx(N,{t,w:70,h:24})}),e.jsx("div",{className:"mt-3",children:e.jsx(N,{t,w:120,h:10})})]})]}),e.jsx(X,{t,padding:"p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(N,{t,w:36,h:36,rounded:12}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx(N,{t,w:80,h:9}),e.jsx(N,{t,w:"70%",h:14})]}),e.jsx(N,{t,w:60,h:14})]})}),e.jsx(X,{t,padding:"p-5",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(N,{t,w:48,h:48,rounded:16}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx(N,{t,w:"50%",h:14}),e.jsx(N,{t,w:"70%",h:10})]})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"px-1",children:e.jsx(N,{t,w:120,h:14})}),e.jsx(X,{t,padding:"p-2",children:[0,1,2,3,4].map(s=>e.jsxs("div",{className:"flex items-center gap-3 p-3",style:{borderBottom:s<4?`1px solid ${t.border}`:"none"},children:[e.jsx(N,{t,w:40,h:40,rounded:12}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx(N,{t,w:"45%",h:12}),e.jsx(N,{t,w:"60%",h:10})]}),e.jsx(N,{t,w:15,h:15,rounded:4})]},s))})]})]})}function _n({t}){return e.jsxs("div",{className:"space-y-4 pb-28",children:[e.jsxs("div",{className:"flex items-center justify-between px-1 pt-2",children:[e.jsx(N,{t,w:120,h:26}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(N,{t,w:40,h:40,rounded:999}),e.jsx(N,{t,w:40,h:40,rounded:999})]})]}),e.jsx("div",{className:"flex gap-2 pb-1",children:["","",""].map((s,n)=>
356e.jsx(N,{t,w:70,h:26,rounded:999},n))}),e.jsx(X,{t,padding:"p-2",children:[0,1,2,3,4].map(s=>e.jsxs("div",{className:"flex items-center gap-3 p-3",style:{borderBottom:s<4?`1px solid ${t.border}`:"none"},children:[e.jsx(N,{t,w:44,h:44,rounded:12}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx(N,{t,w:"55%",h:13}),e.jsx(N,{t,w:"35%",h:10})]}),e.jsx(N,{t,w:60,h:14})]},s))})]})}function Vn({t}){return e.jsxs("div",{className:"space-y-4 pb-28",children:[e.jsxs("div",{className:"px-1 pt-2 space-y-2",children:[e.jsx(N,{t,w:80,h:26}),e.jsx(N,{t,w:"70%",h:12})]}),[0,1].map(s=>e.jsxs(X,{t,padding:"p-5",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx(N,{t,w:"50%",h:16}),e.jsx(N,{t,w:"30%",h:10})]}),e.jsx(N,{t,w:20,h:20,rounded:4})]}),e.jsxs("div",{className:"mt-3 flex items-baseline justify-between",children:[e.jsx(N,{t,w:100,h:24}),e.jsx(N,{t,w:70,h:10})]}),e.jsx("div",{className:"mt-2",children:e.jsx(N,{t,w:"100%",h:8,rounded:999})}),e.jsx("div",{className:"mt-4",children:e.jsx(N,{t,w:"100%",h:36,rounded:12})})]},s)),e.jsx(N,{t,w:"100%",h:52,rounded:16})]})}function Un({t}){return e.jsxs("div",{className:"space-y-4 pb-28",children:[e.jsx(N,{t,w:80,h:26,className:"mt-2 ml-1"}),e.jsx(X,{t,padding:"p-5",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(N,{t,w:56,h:56,rounded:999}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx(N,{t,w:"40%",h:16}),e.jsx(N,{t,w:"55%",h:11}),e.jsx(N,{t,w:120,h:18,rounded:999})]}),e.jsx(N,{t,w:32,h:32,rounded:999})]})}),e.jsx(X,{t,padding:"p-2",children:e.jsxs("div",{className:"flex items-center gap-3 p-4",children:[e.jsx(N,{t,w:40,h:40,rounded:12}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx(N,{t,w:"40%",h:14}),e.jsx(N,{t,w:"70%",h:10})]}),e.jsx(N,{t,w:18,h:18,rounded:4})]})}),e.jsx("div",{className:"grid grid-cols-3 gap-3",children:[0,1,2].map(s=>e.jsxs(X,{t,padding:"p-3",children:[e.jsx(N,{t,w:50,h:9}),e.jsx("div",{className:"mt-1",children:e.jsx(N,{t,w:50,h:18})})]},s))}),e.jsx(X,{t,padding:"p-2",children:e.jsxs("div",{className:"flex items-center gap-3 p-4",children:[e.jsx(N,{t,w:40,h:40,rounded:12}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx(N,{t,w:"35%",h:14}),e.jsx(N,{t,w:"55%",h:10})]}),e.jsx(N,{t,w:44,h:24,rounded:999})]})}),e.jsx(X,{t,padding:"p-2",children:[0,1,2].map(s=>e.jsxs("div",{className:"flex items-center gap-3 p-4",style:{borderBottom:s<2?`1px solid ${t.border}`:"none"},children:[e.jsx(N,{t,w:18,h:18,rounded:4}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx(N,{t,w:"40%",h:13}),e.jsx(N,{t,w:"65%",h:10})]})]},s))})]})}function qn({t}){return e.jsxs("div",{className:"space-y-4 pb-28",children:[e.jsxs("div",{className:"px-1 pt-2 space-y-2",children:[e.jsx(N,{t,w:90,h:26}),e.jsx(N,{t,w:"80%",h:12})]}),e.jsx(X,{t,padding:"p-2",children:[0,1,2,3,4].map(s=>e.jsxs("div",{className:"flex items-center gap-3 p-4",style:{borderBottom:s<4?`1px solid ${t.border}`:"none"},children:[e.jsx(N,{t,w:40,h:40,rounded:12}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx(N,{t,w:"50%",h:13}),e.jsx(N,{t,w:"65%",h:10}),e.jsx(N,{t,w:80,h:9})]}),e.jsx(N,{t,w:28,h:28,rounded:6}),e.jsx(N,{t,w:28,h:28,rounded:6}),e.jsx(N,{t,w:44,h:24,rounded:999})]},s))}),e.jsx(N,{t,w:"100%",h:50,rounded:16})]})}const Zn=[{id:"avoided",label:"Vermieden"},{id:"waited",label:"Wartezeit"},{id:"score",label:"Score"}],Y=1080,Pe=1920,Jn="denkzettel.io",Ke=t=>Math.round(t).toLocaleString("de-DE");function gs(t,s){if(s==="waited"){const n=t.waitedTotal>0;return{grad:["#4A86B8","#234E70"],numberColor:"#ffffff",label:"DURCH WARTEN GERETTET",big:n?`${Ke(t.waitedTotal)} €`:`${t.waitedSuccess}×`,sub:n?`${t.waitedSuccess} Käufe nach der Wartezeit verworfen`:"Impulse ausgesessen statt gekauft",pill:"Der Impuls verging. Das Geld blieb. ⏳",shareText:n?`${Ke(t.waitedTotal)} € durch Warten gerettet ⏳ — statt impulsiv zu kaufen. Mit Denkzettel.`:`${t.waitedSuccess} Impulse ausgesessen statt gekauft ⏳ — mit Denkzettel.`}}return s==="score"?{grad:["#14663F","#0E1411"],numberColor:"#D4B582",label:"MEIN BEWUSST-SCORE",big:`${t.frugalScore}`,sub:"von 100 · bewusst statt impulsiv",pill:"Wie bewusst kaufst du? 🧠",shareText:`Mein Bewusst-Score: ${t.frugalScore}/100 🧠 — bewusst kaufen statt Impuls. Mit Denkzettel.`}:{grad:["#23A06A","#125A38"],numberColor:"#ffffff",label:"INSGESAMT NICHT AUSGEGEBEN",big:`${Ke(t.avoidedTotal)} €`,sub:`${t.avoidedCount} Impulse erkannt · ${t.waitedSuccess} via Wartezeit`,pill:"Mein Zukunfts-Ich sagt danke 🙌",shareText:`Schon ${Ke(t.avoidedTotal)} € nicht ausgegeben 💪 — bewusst kaufen statt Impuls. Mit Denkzettel.`}}function Wt(t,s,n,a,r,l){t.beginPath(),t.moveTo(s+l,n),t.arcTo(s+a,n,s+a,n+r,l),t.arcTo(s+a,n+r,s,n+r,l),t.arcTo(s,n+r,s,n,l),t.arcTo(s,n,s+a,n,l),t.closePath()}function Yn(t,s,n,a,r,l){let i=r;for(t.font=`${n} ${i}px ${a}`;i>80&&t.measureText(s).width>l;)i-=10,t.font=`${n} ${i}px ${a}`;return i}async function Qn(){try{await(document.fonts?.ready??Promise.resolve()),await Promise.all([document.fonts?.load('600 250px "Fraunces"'),document.fonts?.load('600 56px "Fraunces"')])}catch{}}async function vt(t,s="avoided"){await Qn();const n=gs(t,s),a=document.createElement("canvas");a.width=Y,a.height=Pe;const r=a.getContext("2d");if(!r)return a;const l=r.createLinearGradient(0,0,Y,Pe);l.addColorStop(0,n.grad[0]),l.addColorStop(1,n.grad[1]),r.fillStyle=l,r.fillRect(0,0,Y,Pe),r.fillStyle="rgba(255,255,255,0.06)",r.beginPath(),r.arc(Y-120,260,360,0,Math.PI*2),r.fill(),r.beginPath(),r.arc(160,Pe-360,300,0,Math.PI*2),r.fill(),r.textAlign="center";const i=96,c=(Y-i)/2,d=210;r.fillStyle="#ffffff",Wt(r,c,d,i,i,24),r.fill(),r.strokeStyle="#1F8F5E",r.lineWidth=7,r.lineCap="round";for(let f=0;f<3;f++){const g=d+30+f*19;r.beginPath(),r.moveTo(c+24,g),r.lineTo(c+i-24-(f===2?20:0),g),r.stroke()}r.fillStyle="rgba(255,255,255,0.95)",r.font='600 46px "Fraunces", serif',r.fillText("Denkzettel",Y/2,d+i+78),r.fillStyle="rgba(255,255,255,0.78)",r.font="700 36px ui-sans-serif, system-ui, sans-serif";try{r.letterSpacing="6px"}catch{}r.fillText(n.label,Y/2,800);try{r.letterSpacing="0px"}catch{}r.fillStyle=n.numberColor,Yn(r,n.big,600,'"Fraunces", serif',250,Y-160),r.fillText(n.big,Y/2,1010),r.fillStyle="rgba(255,255,255,0.85)",r.font="500 42px ui-sans-serif, system-ui, sans-serif",r.fillText(n.sub,Y/2,1110),r.font="600 44px ui-sans-serif, system-ui, sans-serif";const m=r.measureText(n.pill).width+56*2,h=116,b=(Y-m)/2,x=1300;return r.fillStyle="rgba(255,255,255,0.14)",Wt(r,b,x,m,h,h/2),r.fill(),r.fillStyle="#ffffff",r.fillText(n.pill,Y/2,x+74),r.fillStyle="rgba(255,255,255,0.92)",r.font='600 48px "Fraunces", serif',r.fillText("Bewusst kaufen. Mehr behalten.",Y/2,1700),r.fillStyle="rgba(255,255,255,0.65)",r.font="600 40px ui-sans-serif, system-ui, sans-serif",r.fillText(Jn,Y/2,1772),a}function wt(t){return new Promise(s=>t.toBlob(n=>s(n),"image/png",.95))}async function Xn(t,s="avoided"){try{const n=await vt(t,s),a=await wt(n);if(!a)return"error";
356const r=new File([a],"denkzettel.png",{type:"image/png"}),l=gs(t,s).shareText,i=navigator;if(i.canShare&&i.canShare({files:[r]}))try{return await i.share({files:[r],title:"Mein Denkzettel",text:l}),"shared"}catch(p){return p.name==="AbortError"?"shared":"error"}const c=URL.createObjectURL(a),d=document.createElement("a");return d.href=c,d.download="denkzettel.png",document.body.appendChild(d),d.click(),d.remove(),URL.revokeObjectURL(c),"downloaded"}catch(n){return console.warn("[shareCard] fehlgeschlagen:",n),"error"}}async function er(t,s="avoided"){const n=await vt(t,s),a=await wt(n);if(!a)return;const r=URL.createObjectURL(a),l=document.createElement("a");l.href=r,l.download=`denkzettel-${s}.png`,document.body.appendChild(l),l.click(),l.remove(),URL.revokeObjectURL(r)}function Nt({t,stats:s,onClose:n,initialVariant:a="avoided"}){const[r,l]=o.useState(a),[i,c]=o.useState(null),[d,p]=o.useState(!1),[u,m]=o.useState(null),h=o.useRef(null),{avoidedTotal:b,avoidedCount:x,waitedSuccess:f,waitedTotal:g,frugalScore:j}=s;o.useEffect(()=>{let z=null,D=!1;return c(null),(async()=>{const I=await vt({avoidedTotal:b,avoidedCount:x,waitedSuccess:f,waitedTotal:g,frugalScore:j},r),F=await wt(I);!F||D||(z=URL.createObjectURL(F),c(z))})(),()=>{D=!0,z&&URL.revokeObjectURL(z)}},[b,x,f,g,j,r]),o.useEffect(()=>{const z=document.activeElement;return h.current?.focus(),()=>z?.focus()},[]),o.useEffect(()=>{const z=D=>{D.key==="Escape"&&n()};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[n]);const M=async()=>{p(!0),m(null);const z=await Xn(s,r);p(!1),z==="downloaded"?m("Als Bild gespeichert."):z==="error"&&m('Teilen nicht möglich – versuch „Bild speichern".')},W=async()=>{p(!0),m(null),await er(s,r),p(!1),m("Als Bild gespeichert.")};return e.jsx(T.div,{initial:{opacity:0}
356,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-end md:items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:n,children:e.jsxs(T.div,{initial:{y:40},animate:{y:0},exit:{y:40},transition:{duration:.3,ease:[.16,1,.3,1]},onClick:z=>z.stopPropagation(),className:"w-full max-w-[420px] rounded-t-3xl md:rounded-3xl p-5 pb-8 space-y-4 max-h-[92vh] overflow-y-auto",style:{background:t.bg},role:"dialog","aria-modal":"true","aria-label":"Denkzettel teilen",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-xl font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Teilen"}),e.jsx("button",{ref:h,onClick:n,style:{color:t.textMuted},"aria-label":"Schließen",children:e.jsx(U,{size:20})})]}),e.jsx("p",{className:"text-sm leading-relaxed",style:{color:t.textMuted},children:"Zeig, was du behalten hast — poste es in deine Story oder schick's in den Chat."}),e.jsx("div",{className:"flex gap-1.5 rounded-full p-1",style:{background:t.surface,border:`1px solid ${t.border}`},children:Zn.map(z=>{const D=z.id===r;return e.jsx("button",{onClick:()=>l(z.id),className:"flex-1 rounded-full py-2 text-[13px] font-semibold transition",style:{background:D?t.brand:"transparent",color:D?"#fff":t.textMuted},children:z.label},z.id)})}),e.jsx("div",{className:"mx-auto w-full max-w-[260px] overflow-hidden rounded-2xl",style:{aspectRatio:"9 / 16",background:t.surface,border:`1px solid ${t.border}`},children:i?e.jsx("img",{src:i,alt:"Vorschau deines Sharepics",className:"h-full w-full object-cover"}):e.jsx("div",{className:"flex h-full w-full items-center justify-center",children:e.jsx(me,{size:24,className:"animate-spin",style:{color:t.textSoft}})})}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{onClick:M,disabled:d||!i,className:"flex w-full items-center justify-center gap-2 rounded-2xl py-3.5 text-[15px] font-semibold transition disabled:opacity-50 active:scale-[0.99]",style:{background:t.brand,color:"#fff"},children:[d?e.jsx(me,{size:16,className:"animate-spin"}):e.jsx(Ce,{size:16}),"Teilen"]}),e.jsxs("button",{onClick:W,disabled:d||!i,className:"flex w-full items-center justify-center gap-2 rounded-2xl py-3 text-sm font-semibold transition disabled:opacity-50 active:scale-[0.99]",style:{background:"transparent",border:`1px solid ${t.border}`,color:t.textMuted},children:[e.jsx(Jt,{size:15})," Bild speichern"]}),u&&e.jsx("p",{className:"pt-1 text-center text-[13px]",style:{color:t.textMuted},children:u})]})]})})}function tr({t,amount:s,snoozeCount:n,onShare:a,onClose:r}){const l=n+1;return e.jsx(T.div,{initial:{opacity:0}
356,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[70] flex items-end md:items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:r,children:e.jsx(T.div,{initial:{y:40},animate:{y:0},exit:{y:40},transition:{duration:.3,ease:[.16,1,.3,1]},onClick:i=>i.stopPropagation(),className:"w-full max-w-[420px] rounded-t-3xl md:rounded-3xl p-6 pb-8",style:{background:t.bg},role:"dialog","aria-modal":"true","aria-label":"Wartezeit ausgesessen",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsxs(T.div,{initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:200,damping:14},className:"relative flex h-20 w-20 items-center justify-center rounded-3xl",style:{background:t.coolSoft},children:[e.jsx(pt,{size:38,style:{color:t.cool}}),l>1&&e.jsxs("span",{className:"absolute -right-2 -top-2 flex h-7 min-w-7 items-center justify-center rounded-full px-1.5 text-[13px] font-bold",style:{background:t.gold,color:"#fff"},children:[l,"×"]})]}),e.jsx("h2",{className:"mt-5 text-2xl font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Wartezeit überstanden"}),e.jsxs("p",{className:"mt-2 max-w-xs text-sm leading-relaxed",style:{color:t.textMuted},children:["Der Impuls verging, das Geld blieb."," ",e.jsxs("span",{style:{color:t.cool,fontWeight:600},children:[s.toFixed(0)," €"]})," nicht ausgegeben",l>1&&e.jsxs(e.Fragment,{children:[" — und ",l,"× ausgesessen für extra Bewusst-Punkte ✨"]}),"."]}),l>1&&e.jsx("div",{className:"mt-3 flex items-center gap-1",children:Array.from({length:Math.min(3,l)}).map((i,c)=>e.jsx(nt,{size:16,style:{color:t.gold},fill:t.gold},c))}),e.jsxs("div",{className:"mt-7 w-full max-w-xs space-y-2",children:[e.jsxs("button",{onClick:a,className:"flex w-full items-center justify-center gap-2 rounded-2xl py-3.5 text-[15px] font-semibold transition active:scale-[0.99]",style:{background:t.cool,color:"#fff"},children:[e.jsx(Ce,{size:16})," Erfolg teilen"]}),e.jsx("button",{onClick:r,className:"w-full rounded-2xl py-3 text-sm font-semibold transition active:scale-[0.99]",style:{background:"transparent",border:`1px solid ${t.border}`,color:t.textMuted},children:"Fertig"})]})]})})})}const sr=["Technik","Kleidung","Wohnen","Mobilität","Freizeit","Lebensmittel","Abonnement","Gesundheit","Sonstiges"];function nr({t,item:s,onSave:n,onDelete:a,onClose:r}){const[l,i]=o.useState(s.title||""),[c,d]=o.useState(String(s.price??"")),[p,u]=o.useState(s.category||"Sonstiges"),[m,h]=o.useState(s.url||""),[b,x]=o.useState(!1),f=l.trim().length>0&&c!==""&&!isNaN(parseFloat(c)),g=()=>{f&&(n({title:l.trim(),price:parseFloat(c)||0,category:p,url:m.trim()||null}),r())};return e.jsx(T.div,{initial:{opacity:0}
356,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[70] flex items-end md:items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:r,children:e.jsxs(T.div,{initial:{y:40},animate:{y:0},exit:{y:40},transition:{duration:.3,ease:[.16,1,.3,1]},onClick:j=>j.stopPropagation(),className:"w-full max-w-[420px] rounded-t-3xl md:rounded-3xl p-6 pb-8 max-h-[90vh] overflow-y-auto",style:{background:t.bg},role:"dialog","aria-modal":"true","aria-label":"Denkzettel bearbeiten",children:[e.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl",style:{background:t.coolSoft},children:e.jsx(Re,{size:16,style:{color:t.cool}})}),e.jsx("h2",{className:"text-lg font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Denkzettel bearbeiten"})]}),e.jsx("button",{onClick:r,className:"flex h-8 w-8 items-center justify-center rounded-full",style:{background:`${t.text}08`,color:t.textMuted},"aria-label":"Schließen",children:e.jsx(U,{size:16})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(L,{t,label:"Beschreibung",value:l,onChange:j=>i(j.target.value),placeholder:"z. B. Tauchsieder"}),e.jsx(L,{t,label:"Betrag",suffix:"€",type:"number",inputMode:"decimal",value:c,onChange:j=>d(j.target.value),placeholder:"0,00"}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[13px] uppercase tracking-wider font-semibold",style:{color:t.textSoft},children:"Kategorie"}),e.jsx("div",{className:"mt-1.5 flex flex-wrap gap-2",children:sr.map(j=>e.jsx("button",{onClick:()=>u(j),className:"rounded-full px-3.5 py-1.5 text-sm font-medium",style:{background:p===j?t.brand:t.surface,color:p===j?"#fff":t.text,border:`1px solid ${p===j?t.brand:t.border}`},children:j},j))})]}),e.jsx(L,{t,label:"Produkt-Link",hint:"(optional)",value:m,onChange:j=>h(j.target.value),placeholder:"https://...",type:"url",inputMode:"url"})]}),e.jsxs("div",{className:"mt-6 flex gap-2",children:[e.jsx("button",{onClick:r,className:"flex-1 rounded-2xl py-3.5 text-[15px] font-medium transition active:scale-[0.99]",style:{background:"transparent",border:`1px solid ${t.border}`,color:t.textMuted},children:"Abbrechen"}),e.jsx("button",{onClick:g,disabled:!f,className:"flex-1 rounded-2xl py-3.5 text-[15px] font-semibold transition disabled:opacity-40 active:scale-[0.99]",style:{background:t.brand,color:"#fff"},children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(te,{size:14})," Speichern"]})})]}),b?e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[e.jsx("button",{onClick:()=>x(!1),className:"flex-1 rounded-2xl py-3 text-sm font-medium",style:{background:"transparent",border:`1px solid ${t.border}`,color:t.textMuted},children:"Doch behalten"}),e.jsx("button",{onClick:()=>{a(),r()},className:"flex-1 rounded-2xl py-3 text-sm font-semibold",style:{background:t.danger,color:"#fff"},children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(V,{size:14}
356)," Wirklich löschen"]})})]}):e.jsxs("button",{onClick:()=>x(!0),className:"mt-3 flex w-full items-center justify-center gap-1.5 rounded-2xl py-3 text-sm font-semibold",style:{background:t.dangerSoft,color:t.danger},children:[e.jsx(V,{size:14})," Denkzettel löschen"]})]})})}const rr=["Technik","Kleidung","Wohnen","Mobilität","Freizeit","Lebensmittel","Abonnement","Gesundheit","Sonstiges"],ar=["☕","🥨","🍫","🥤","🍺","🚬","🍔","🛒","🎮","📦","💅","🚕"];function lr({t,store:s}){const{state:n,actions:a}=s,r=n.quickItems||[],[l,i]=o.useState(null),[c,d]=o.useState(null),[p,u]=o.useState(!1),[m,h]=o.useState(null),b=r.reduce((j,M)=>j+(M.resistedCount??0),0),x=r.reduce((j,M)=>j+(M.resistedCount??0)*M.price,0),f=j=>{a.resistQuickItem(j.id);const M=j.goalId?n.goals.find(W=>W.id===j.goalId)?.title:void 0;i(null),h({amount:j.price,goalTitle:M})},g=j=>{a.buyQuickItem(j.id),i(null)};return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between px-1",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("h2",{className:"text-[15px] font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Schnell-Zettel"}),b>0&&e.jsxs("span",{className:"text-[12px]",style:{color:t.textSoft},children:[b,"× widerstanden · ",x.toFixed(0)," € behalten"]})]}),e.jsx(gt,{size:14,style:{color:t.textSoft}})]}),e.jsxs(R,{t,padding:"p-4",children:[e.jsx("p",{className:"text-[13px] leading-relaxed",style:{color:t.textMuted},children:"Kleine Impulse unterwegs — ein Tap genügt. Widerstehen zählt als gespart."}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[r.map(j=>e.jsxs("button",{onClick:()=>i(j),onContextMenu:M=>{M.preventDefault(),d(j)},className:"flex items-center gap-2 rounded-full py-2 pl-3 pr-3.5 text-sm font-medium transition active:scale-[0.97]",style:{background:t.brandSoft,color:t.brand},title:`${j.title} – tippen zum Erfassen, lang drücken zum Bearbeiten`,children:[j.emoji&&e.jsx("span",{className:"text-base leading-none",children:j.emoji}),e.jsx("span",{style:{color:t.text},children:j.title}),e.jsxs("span",{style:{color:t.brand,fontWeight:600},children:[j.price.toFixed(0)," €"]})]},j.id)),e.jsxs("button",{onClick:()=>u(!0),className:"flex items-center gap-1.5 rounded-full py-2 pl-2.5 pr-3.5 text-sm font-semibold transition active:scale-[0.97]",style:{background:t.surface,border:`1px dashed ${t.border}`,color:t.textMuted},"aria-label":"Schnell-Zettel hinzufügen",children:[e.jsx(Ve,{size:15})," Neu"]})]})]}),e.jsxs(ee,{children:[l&&e.jsx(ir,{t,item:l,goalTitle:l.goalId?n.goals.find(j=>j.id===l.goalId)?.title:void 0,onResist:()=>f(l),onBuy:()=>g(l),onEdit:()=>{const j=l;i(null),d(j)},onClose:()=>i(null)}),p&&e.jsx(Pt,{t,goals:n.goals,onClose:()=>u(!1),onSave:j=>{a.addQuickItem(j),u(!1)}}),c&&e.jsx(Pt,{t,goals:n.goals,initial:c,onClose:()=>d(null),onSave:j=>
356{a.updateQuickItem(c.id,j),d(null)},onDelete:()=>{a.deleteQuickItem(c.id),d(null)}}),m&&e.jsx(or,{t,amount:m.amount,goalTitle:m.goalTitle,onClose:()=>h(null)})]})]})}function ir({t,item:s,goalTitle:n,onResist:a,onBuy:r,onEdit:l,onClose:i}){return e.jsxs(bs,{t,onClose:i,title:`${s.emoji?s.emoji+" ":""}${s.title}`,children:[s.miniCheck&&e.jsxs("div",{className:"rounded-2xl p-4",style:{background:t.brandSoft},children:[e.jsx("div",{className:"text-[15px] font-medium",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Brauchst du das gerade wirklich?"}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed",style:{color:t.textMuted},children:"Kurz innehalten — ein Moment Ehrlichkeit, dann entscheide bewusst."})]}),e.jsxs("button",{onClick:a,className:"w-full rounded-2xl py-3.5 text-[15px] font-semibold transition active:scale-[0.99] flex items-center justify-center gap-2",style:{background:t.brand,color:"#fff"},children:[e.jsx(te,{size:17})," Widerstanden — ",s.price.toFixed(0)," € behalten"]}),n&&e.jsxs("p",{className:"-mt-1 text-center text-[12px]",style:{color:t.textSoft},children:["fließt direkt in „",n,'"']}),e.jsx(ve,{t,onClick:r,children:"Trotzdem gekauft"}),e.jsxs("button",{onClick:l,className:"mx-auto flex items-center gap-1.5 text-[13px] font-medium",style:{color:t.textSoft},children:[e.jsx(ss,{size:13})," Bearbeiten"]})]})}function Pt({t,goals:s,initial:n,onClose:a,onSave:r,onDelete:l}){const[i,c]=o.useState(n?.title??""),[d,p]=o.useState(n?String(n.price):""),[u,m]=o.useState(n?.category??"Lebensmittel"),[h,b]=o.useState(n?.emoji??"☕"),[x,f]=o.useState(n?.miniCheck??!1),[g,j]=o.useState(n?.goalId??null),[M,W]=o.useState(!1),z=i.trim()!==""&&parseFloat(d)>0,D=()=>{z&&r({title:i.trim(),price:parseFloat(d),category:u,emoji:h,miniCheck:x,goalId:g})};return e.jsxs(bs,{t,onClose:a,title:n?"Schnell-Zettel bearbeiten":"Neuer Schnell-Zettel",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[13px] uppercase tracking-wider font-semibold",style:{color:t.textSoft},children:"Symbol"}),e.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:ar.map(I=>e.jsx("button",{onClick:()=>b(I),className:"flex h-10 w-10 items-center justify-center rounded-xl text-lg transition active:scale-[0.95]",style:{background:h===I?t.brandSoft:t.surface,border:`1px solid ${h===I?t.brand:t.border}`},"aria-label":`Symbol ${I}`,"aria-pressed":h===I,children:I},I))})]}),e.jsx(L,{t,label:"Titel",value:i,onChange:I=>c(I.target.value),placeholder:"z. B. Coffee to go"}),e.jsx(L,{t,label:"Preis",suffix:"€",type:"number",inputMode:"decimal",value:d,onChange:I=>p(I.target.value),placeholder:"4"}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[13px] uppercase tracking-wider font-semibold",style:{color:t.textSoft},children:"Kategorie"}),e.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:rr.map(I=>e.jsx("button",{onClick:()=>m(I),className:"rounded-full px-3 py-1.5 text-[13px] font-medium transition active:scale-[0.97]",style:{background:u===I?t.brand:t.surface,color:u===I?"#fff":t.textMuted,border:`1px solid ${u===I?t.brand:t.border}`},children:I},I))})]}),s.length>0&&e.jsxs("div",{children:[e.jsxs("label",{className:"text-[13px] uppercase tracking-wider font-semibold flex items-center gap-1.5",style:{color:t.textSoft},children:["Ziel"," ",e.jsx("span",{style:{opacity:.6,textTransform:"none",letterSpacing:0},children:"(optional)"})]}),e.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[e.jsx("button",{onClick:()=>j(null),className:"rounded-full px-3 py-1.5 text-[13px] font-medium transition active:scale-[0.97]",style:{background:g===null?t.gold:t.surface,color:g===null?"#fff":t.textMuted,border:`1px solid ${g===null?t.gold:t.border}`},children:"Kein Ziel"}),s.map(I=>e.jsx("button",{onClick:()=>j(I.id),className:"rounded-full px-3 py-1.5 text-[13px] font-medium transition active:scale-[0.97]",style:{background:g===I.id?t.gold:t.surface,color:g===I.id?"#fff":t.textMuted,border:`1px solid ${g===I.id?t.gold:t.border}`},children:I.title},I.id))]}),e.jsx("p",{className:"mt-1.5 text-[12px]",style:{color:t.textSoft},children:"Widerstandener Betrag fließt direkt in dieses Ziel."})]}),e.jsxs("button",{onClick:()=>f(I=>!I),className:"flex w-full items-center justify-between rounded-xl px-4 py-3",style:{background:t.surface,border:`1px solid ${t.border}`},role:"switch","aria-checked":x,children:[e.jsxs("span",{className:"text-left",children:[e.jsx("span",{className:"block text-sm font-medium",style:{color:t.text},children:"Mini-Check zeigen"}),e.jsx("span",{className:"block text-[12px]",style:{color:t.textSoft},children:"Kurze Stopp-Frage vor dem Erfassen"})]}),e.jsx("span",{className:"relative h-6 w-10 shrink-0 rounded-full transition",style:{background:x?t.brand:`${t.text}20`},children:e.jsx("span",{className:"absolute top-0.5 h-5 w-5 rounded-full bg-white transition-all",style:{left:x?18:2}})})]}),e.jsx(O,{t,onClick:D,disabled:!z,children:n?"Speichern":"Anlegen"}),l&&(M?e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ve,{t,onClick:()=>W(!1),children:"Abbrechen"}),e.jsxs("button",{onClick:l,className:"w-full rounded-2xl py-3.5 text-[15px] font-semibold transition active:scale-[0.99] flex items-center justify-center gap-2",style:{background:t.danger,color:"#fff"},children:[e.jsx(V,{size:16})," Löschen"]})]}):e.jsxs("button",{onClick:()=>W(!0),className:"mx-auto flex items-center gap-1.5 text-[13px] font-medium",style:{color:t.textSoft},children:[e.jsx(V,{size:13})," Schnell-Zettel löschen"]}))]})}function or({t,amount:s,goalTitle:n,onClose:a}){return o.useEffect(()=>{const r=setTimeout(a,1900);return()=>clearTimeout(r)},[a]),e.jsx(T.div,{initial:{opacity:0}
356,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[70] flex items-end md:items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:a,children:e.jsx(T.div,{initial:{y:40},animate:{y:0},exit:{y:40},transition:{duration:.3,ease:[.16,1,.3,1]},onClick:r=>r.stopPropagation(),className:"w-full max-w-[420px] rounded-t-3xl md:rounded-3xl p-6 pb-8",style:{background:t.bg},role:"dialog","aria-modal":"true","aria-label":"Impuls widerstanden",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx(T.div,{initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:200,damping:14},className:"flex h-20 w-20 items-center justify-center rounded-3xl",style:{background:t.goldSoft},children:e.jsx(pt,{size:38,style:{color:t.gold}})}),e.jsx("h2",{className:"mt-5 text-2xl font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Stark!"}),e.jsxs("p",{className:"mt-2 max-w-xs text-sm leading-relaxed",style:{color:t.textMuted},children:[e.jsxs("span",{style:{color:t.gold,fontWeight:600},children:[s.toFixed(0)," €"]})," nicht ausgegeben.",n?e.jsxs(e.Fragment,{children:[" +",s.toFixed(0)," € → „",n,'" ✨']}):e.jsx(e.Fragment,{children:" Summiert sich. 💪"})]})]})})})}function bs({t,onClose:s,title:n,children:a}){const r=o.useRef(null),l=o.useRef(s);return l.current=s,o.useEffect(()=>{const i=document.activeElement;r.current?.focus();const c=d=>{d.key==="Escape"&&l.current()};return document.addEventListener("keydown",c),()=>{document.removeEventListener("keydown",c),i?.focus()}},[]),e.jsx(T.div,{initial:{opacity:0}
356,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-end md:items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:s,children:e.jsxs(T.div,{initial:{y:40},animate:{y:0},exit:{y:40},transition:{duration:.3,ease:[.16,1,.3,1]},onClick:i=>i.stopPropagation(),className:"w-full max-w-[420px] rounded-t-3xl md:rounded-3xl p-5 pb-8 space-y-4 max-h-[85vh] overflow-y-auto",style:{background:t.bg},role:"dialog","aria-modal":"true","aria-label":n,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-xl font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:n}),e.jsx("button",{ref:r,onClick:s,style:{color:t.textMuted},"aria-label":"Schließen",children:e.jsx(U,{size:20})})]}),a]})})}const cr=7*86400*1e3;function dr(t,s){const n=Date.now()-cr,a=(t.avoidedItems||[]).filter(p=>new Date(p.date).getTime()>=n),r=a.reduce((p,u)=>p+(u.price||0),0),l=a.filter(p=>p.reason==="waited").length,i=(t.transactions||[]).filter(p=>p.tags?.includes("Impuls")&&new Date(p.date).getTime()>=n).length;let c=null;if(a.length>0){const p={};for(const h of a)p[h.category]=(p[h.category]||0)+1;const[u,m]=Object.entries(p).sort((h,b)=>b[1]-h[1])[0];m>=2&&(c=`Auffällig: ${u} — ${m}× bewusst gelassen.`)}return{hasData:a.length>0||i>0,keptAmount:r,avoidedCount:a.length,waitedSuccess:l,impulseCount:i,score:s.frugalScore,stars:s.frugalStars,insight:c}}const ur=[{id:"finanzguru",name:"Finanzguru",sub:"Banking & Multibanking",url:"https://finanzguru.de/",tone:"brand",modes:["Klarheit","FIRE","Familie","ADHS","Unternehmer"]},{id:"traderepublic",name:"Trade Republic",sub:"ETF-Sparplan & Aktien",url:"https://refnocode.trade.re/7fjzzxl1",tone:"cool",modes:["Klarheit","FIRE","Unternehmer"]},{id:"fraenk",name:"fraenk",sub:"Mobilfunk-Tarif (D1-Netz)",url:"https://go.fraenk.de/mgm?friendCode=JONP87",tone:"gold",modes:["Klarheit","FIRE","Familie","ADHS"]},{id:"steuern-mit-system",name:"Steuern mit System",sub:"Steuer-Coaching für Selbstständige",url:"https://www.steuernmitsystem.de",tone:"gold",modes:["Unternehmer","FIRE"]}];function xr(t){return ur.filter(s=>!s.modes||s.modes.length===0||s.modes.includes(t))}function St(t){const s=(t??"").trim();return s?/^[a-z][\w+.-]*:\/\//i.test(s)?s:s.startsWith("//")?`https:${s}`:`https://${s}`:""}function mr({t,store:s,onCheckPurchase:n,onOpenRules:a,onOpenMode:r,onOpenExpenses:l}){const[i,c]=o.useState(!1),[d,p]=o.useState(!1),[u,m]=o.useState("avoided"),[h,b]=o.useState(null),[x,f]=o.useState(null),{state:g,derived:j,actions:M}=s,W=kt(1e3),z=dr(g,j),D=A=>{const C=g.waitingItems.find(G=>G.id===A);M.resolveWaitingItem(A,"dismiss"),b({amount:C?.price??0,snoozeCount:C?.snoozeCount??0})},I=g.profile.monthlyBudget||0,F=I>0,J=F?j.spent/I*100:0,ne=new Date().getHours(),B=ne<11?"Guten Morgen":ne<18?"Guten Tag":"Guten Abend",$=je(g.profile.mode),H=$.greeting?.(ne),re=g.rules.filter(A=>A.active).length,ie=xr(g.profile.mode);return e.jsxs("div",{className:"space-y-4 pb-28",children:[e.jsxs("div",{className:"px-1 pt-2",children:[e.jsxs("p",{className:"text-[13px] uppercase tracking-wider",style:{color:t.textSoft},children:[B,g.profile.name?`, ${g.profile.name}`:""]}),e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Übersicht"})]}),e.jsx(R,{t,padding:"p-6",children:e.jsxs("div",{className:"flex items-center gap-5",children:[e.jsxs("div",{className:"relative flex shrink-0 items-center justify-center",children:[e.jsx(Hn,{value:j.frugalScore,size:104,stroke:6,color:t.brand,track:`${t.text}10`}),e.jsxs("div",{className:"absolute text-center",children:[j.frugalStars>0&&e.jsx("div",{className:"flex items-center justify-center gap-0.5",title:`${j.frugalStars}× Aussitz-Stern`,children:Array.from({length:j.frugalStars}).map((A,C)=>e.jsx(nt,{size:9,style:{color:t.gold},fill:t.gold},C))}),e.jsx("div",{className:"text-3xl font-semibold leading-none",style:{color:t.text,fontFamily:"Fraunces, serif"},children:j.frugalScore}),e.jsx("div",{className:"mt-0.5 text-[13px] uppercase tracking-widest",style:{color:t.textSoft},children:"/ 100"})]})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx(ye,{t,tone:"brand",children:j.frugalScore>=80?"Sehr bewusst":j.frugalScore>=60?"Auf gutem Weg":j.frugalScore>=40?"Achte mehr darauf":"Brauchst Schutz"}),e.jsx("p",{className:"mt-2 text-[15px] leading-snug font-medium",style:{color:t.text,fontFamily:"Fraunces, serif"},children:j.frugalScore>=70?"Deine Entscheidungen sind diesen Monat sehr bewusst.":"Bewusstheit wächst — Schritt für Schritt."}),e.jsxs("p",{className:"mt-1 text-sm leading-relaxed",style:{color:t.textMuted},children:[g.stats.avoidedCount," Käufe vermieden · ",g.stats.avoidedTotal.toFixed(0)," € gespart"]})]})]})}),e.jsxs("div",{className:F?"grid grid-cols-2 gap-3":"",children:[F&&e.jsxs(R,{t,onClick:l,children:[e.jsx("div",{className:"text-[13px] uppercase tracking-wider",style:{color:t.textSoft},children:"Ausgaben"}),e.jsxs("div",{className:"mt-2 text-2xl font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:[j.spent.toFixed(0)," €"]}),e.jsxs("div",{className:"mt-1 text-[13px]",style:{color:t.textMuted},children:["von ",I," € · ",J.toFixed(0)," %"]}),e.jsx("div",{className:"mt-3",children:e.jsx(ot,{value:J,t,color:J>100?t.danger:t.brand})})]}),e.jsxs(R,{t,children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx("div",{className:"text-[13px] uppercase tracking-wider",style:{color:t.textSoft},children:"Vermieden"}),g.stats.avoidedCount>0&&e.jsx("button",{onClick:()=>{m("avoided"),p(!0)},className:"-mr-1 -mt-1 flex h-7 w-7 items-center justify-center rounded-full",style:{background:t.goldSoft,color:t.gold},"aria-label":"Vermieden-Bilanz teilen",title:"Teilen",children:e.jsx(Ce,{size:13})})]}),e.jsxs("div",{className:"mt-2 text-2xl font-semibold",style:{color:t.gold,fontFamily:"Fraunces, serif"},children:[g.stats.avoidedTotal.toFixed(0)," €"]}),e.jsxs("div",{className:"mt-1 text-[13px]",style:{color:t.textMuted},children:[g.stats.avoidedCount," Käufe insgesamt"]}),e.jsxs("div",{className:"mt-3 flex items-center gap-1.5 text-[13px]",style:{color:t.brand},children:[e.jsx(rt,{size:12}),e.jsxs("span",{className:"font-semibold",children:[g.stats.waitedSuccess," via Wartezeit"]})]})]})]}),H&&e.jsxs("div",{className:"rounded-2xl flex items-stretch overflow-hidden",style:{background:t.surface,border:`1px solid ${t.border}`,boxShadow:"0 1px 2px rgba(0,0,0,0.02), 0 8px 24px -12px rgba(0,0,0,0.06)"},children:[e.jsxs("button",{onClick:r,className:"flex flex-1 items-center gap-3 p-4 text-left transition active:scale-[0.99]","aria-label":"Modus öffnen",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl",style:{background:t.goldSoft},children:e.jsx(le,{size:16,style:{color:t.gold}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"text-[13px] uppercase tracking-wider",style:{color:t.textSoft},children:["Modus „",$.title,'"']}),e.jsx("div",{className:"text-sm font-medium",style:{color:t.text},children:H})]})]}),e.jsxs("button",{onClick:a,className:"flex shrink-0 items-center gap-1.5 px-4 transition active:scale-[0.97]",style:{borderLeft:`1px solid ${t.border}`,color:t.gold},"aria-label":"Regeln öffnen",children:[e.jsx(mt,{size:14}),e.jsxs("span",{className:"text-[13px] font-semibold",children:[re," Regeln"]})]})]}),z.hasData&&e.jsxs(R,{t,padding:"p-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Bs,{size:15,style:{color:t.cool}}),e.jsx("h2",{className:"text-[15px] font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Dein Wochenrückblick"})]}
356),z.keptAmount>0&&e.jsx("button",{onClick:()=>{m("waited"),p(!0)},className:"flex h-7 w-7 items-center justify-center rounded-full",style:{background:t.coolSoft,color:t.cool},"aria-label":"Wochenrückblick teilen",title:"Teilen",children:e.jsx(Ce,{size:13})})]}),e.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-3xl font-semibold",style:{color:t.cool,fontFamily:"Fraunces, serif"},children:[z.keptAmount.toFixed(0)," €"]}),e.jsx("span",{className:"text-sm",style:{color:t.textMuted},children:"behalten · 7 Tage"})]}),e.jsxs("div",{className:"mt-1 text-[13px]",style:{color:t.textMuted},children:[z.avoidedCount," Impulse erkannt",z.waitedSuccess>0&&e.jsxs(e.Fragment,{children:[" · ",z.waitedSuccess," ausgesessen"]}),z.impulseCount>0&&e.jsxs(e.Fragment,{children:[" · ",z.impulseCount," doch gekauft"]})]}),z.insight&&e.jsxs("div",{className:"mt-3 flex items-start gap-2 rounded-xl p-3",style:{background:t.brandSoft},children:[e.jsx(rt,{size:14,style:{color:t.brand,flexShrink:0,marginTop:2}}),e.jsx("span",{className:"text-[13px] leading-relaxed",style:{color:t.text},children:z.insight})]}),e.jsxs("div",{className:"mt-3 flex items-center gap-1.5 text-[13px]",style:{color:t.textSoft},children:[e.jsxs("span",{children:["Bewusst-Score: ",e.jsx("span",{style:{color:t.brand,fontWeight:600},children:z.score})]}),z.stars>0&&e.jsx("span",{className:"flex items-center gap-0.5",children:Array.from({length:z.stars}).map((A,C)=>e.jsx(nt,{size:10,style:{color:t.gold},fill:t.gold},C))})]})]}),e.jsx(R,{t,onClick:n,padding:"p-5",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl",style:{background:t.brandSoft},children:e.jsx(le,{size:22,style:{color:t.brand}})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-[15px] font-semibold",style:{color:t.text},children:"Kauf prüfen"}),e.jsx("div",{className:"text-sm",style:{color:t.textMuted},children:"Bewusst entscheiden in 6 Fragen"})]}),e.jsx(ae,{size:20,style:{color:t.textSoft}})]})}),e.jsx(lr,{t,store:s}),j.activeWaiting.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between px-1",children:[e.jsx("h2",{className:"text-[15px] font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Wartezeiten aktiv"}),e.jsx(ye,{t,tone:"cool",children:j.activeWaiting.length})]}),e.jsx(R,{t,padding:"p-2",children:e.jsx("div",{children:j.activeWaiting.map((A,C)=>{const G=hs(A.endsAt,W),K=G.done;return e.jsxs("div",{className:"flex items-center gap-3 p-3",style:{borderBottom:C<j.activeWaiting.length-1?`1px solid ${t.border}`:"none"},children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-lg",style:{background:K?t.brandSoft:t.coolSoft},children:K?"✅":"⏳"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-sm font-medium",style:{color:t.text},children:A.title}),(A.snoozeCount??0)>0&&e.jsxs("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[11px] font-bold leading-none",style:{background:t.goldSoft,color:t.gold},title:`${(A.snoozeCount??0)+1}× ausgesessen`,children:[(A.snoozeCount??0)+1,"×"]})]}),e.jsxs("div",{className:"text-[13px]",style:{color:K?t.brand:t.textMuted,fontWeight:K?600:400},children:[A.price.toFixed(0)," € · ",G.label]})]}),K?e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx("button",{onClick:()=>D(A.id),className:"flex h-8 w-8 items-center justify-center rounded-lg",style:{background:t.dangerSoft,color:t.danger},"aria-label":"Verwerfen",title:"Doch nicht kaufen",children:e.jsx(U,{size:14})}),e.jsx("button",{onClick:()=>M.snoozeWaitingItem(A.id,24),className:"flex h-8 w-8 items-center justify-center rounded-lg",style:{background:t.coolSoft,color:t.cool},"aria-label":"Nochmal drüber schlafen",title:"Nochmal 24 h drüber schlafen",children:e.jsx(Ae,{size:14})}),e.jsx("button",{onClick:()=>M.resolveWaitingItem(A.id,"buy"),className:"flex h-8 w-8 items-center justify-center rounded-lg",style:{background:t.brand,color:"#fff"},"aria-label":"Kaufen",title:"Jetzt bewusst kaufen",children:e.jsx(te,{size:14})})]}):e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{onClick:()=>f(A),className:"flex h-8 w-8 items-center justify-center rounded-lg",style:{background:t.coolSoft,color:t.cool},"aria-label":"Denkzettel bearbeiten",title:"Bearbeiten",children:e.jsx(ss,{size:14})}),A.url?e.jsx("a",{href:St(A.url),target:"_blank",rel:"noopener noreferrer",onClick:ue=>ue.stopPropagation(),className:"flex h-8 w-8 items-center justify-center rounded-lg",style:{background:`${t.text}06`,color:t.cool},"aria-label":"Produkt-Link öffnen",children:e.jsx(ze,{size:14})}):e.jsx(Ee,{size:14,style:{color:t.cool}})]})]},A.id)})})})]}),ie.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between px-1",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("h2",{className:"text-[15px] font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Tipps & Tools"}),e.jsxs("span",{className:"text-[12px]",style:{color:t.textSoft},children:["für ",$.title]})]}),e.jsxs("button",{onClick:()=>c(A=>!A),className:"flex items-center gap-1 rounded-full px-2 py-1 text-[12px] font-semibold",style:{background:i?t.goldSoft:"transparent",color:t.gold},"aria-label":"Affiliate-Hinweis ein-/ausblenden",children:[e.jsx(Xt,{size:11}),e.jsx("span",{children:"Affiliate-Hinweis"})]})]}),e.jsx(ee,{children:i&&e.jsx(T.div,{initial:{opacity:0,height:0,marginBottom:0}
356,animate:{opacity:1,height:"auto",marginBottom:8},exit:{opacity:0,height:0,marginBottom:0},transition:{duration:.2},className:"overflow-hidden",children:e.jsxs("div",{className:"rounded-2xl p-4 text-[13px] leading-relaxed",style:{background:t.goldSoft,color:t.text},children:[e.jsx("div",{className:"font-semibold mb-1",style:{color:t.gold},children:"Transparenz-Hinweis (§ 5a UWG / § 6 TMG)"}),e.jsxs("p",{style:{color:t.textMuted},children:["Die hier verlinkten Anbieter sind eine kuratierte Empfehlung. Einzelne Links können",e.jsx("span",{style:{color:t.text,fontWeight:600},children:" Affiliate- oder Werbe-Links"})," sein. Wenn du einen Vertrag abschließt oder ein Konto eröffnest, erhält der Betreiber dieser App ggf. eine Vergütung.",e.jsxs("span",{style:{color:t.text,fontWeight:600},children:[" ","Für dich entstehen dadurch keine zusätzlichen Kosten."]})]}),e.jsxs("p",{className:"mt-2",style:{color:t.textMuted},children:["Die Auswahl spiegelt persönliche Erfahrung / Einschätzung wider und stellt",e.jsx("span",{style:{color:t.text,fontWeight:600},children:" keine Anlageberatung"})," dar. Prüfe Konditionen jeweils selbst beim Anbieter."]})]})})}),e.jsx(R,{t,padding:"p-2",children:ie.map((A,C)=>{const G=A.tone==="brand"?{bg:t.brandSoft,fg:t.brand}:A.tone==="gold"?{bg:t.goldSoft,fg:t.gold}:{bg:t.coolSoft,fg:t.cool};return e.jsxs("a",{href:A.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 p-3 transition active:scale-[0.99]",style:{borderBottom:C<ie.length-1?`1px solid ${t.border}`:"none"},children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-bold",style:{background:G.bg,color:G.fg},children:A.name.slice(0,2).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:t.text},children:A.name}),e.jsx("div",{className:"text-[13px]",style:{color:t.textMuted},children:A.sub})]}),e.jsx(ze,{size:15,style:{color:t.textSoft,flexShrink:0}})]},A.id)})})]}),g.goals.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between px-1",children:[e.jsx("h2",{className:"text-[15px] font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Ziele"}),e.jsx(We,{size:14,style:{color:t.textSoft}})]}),e.jsx(R,{t,padding:"p-5",children:e.jsx("div",{className:"space-y-5",children:g.goals.map(A=>{const C=A.target>0?Math.round(A.current/A.target*100):0;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-sm font-medium",style:{color:t.text},children:A.title}),e.jsxs("span",{className:"text-[13px]",style:{color:t.textMuted},children:[e.jsx("span",{style:{color:t.brand,fontWeight:600},children:A.current.toLocaleString("de-DE")})," ","/ ",A.target.toLocaleString("de-DE")," €"]})]}),e.jsx("div",{className:"mt-2",children:e.jsx(ot,{value:C,t})}),e.jsxs("div",{className:"mt-1 flex justify-between text-[12px]",style:{color:t.textSoft},children:[e.jsxs("span",{children:[C,"%"]}),A.deadline&&e.jsxs("span",{children:["bis ",A.deadline]})]})]},A.id)})})})]}),e.jsx(ee,{children:x&&e.jsx(nr,{t,item:x,onSave:A=>M.updateWaitingItem(x.id,A),onDelete:()=>M.deleteWaitingItem(x.id),onClose:()=>f(null)})}),e.jsx(ee,{children:h&&e.jsx(tr,{t,amount:h.amount,snoozeCount:h.snoozeCount,onShare:()=>{b(null),m("waited"),p(!0)},onClose:()=>b(null)})}),e.jsx(ee,{children:d&&e.jsx(Nt,{t,initialVariant:u,stats:{avoidedTotal:g.stats.avoidedTotal,avoidedCount:g.stats.avoidedCount,waitedSuccess:g.stats.waitedSuccess,waitedTotal:(g.avoidedItems||[]).filter(A=>A.reason==="waited").reduce((A,C)=>A+(C.price||0),0),frugalScore:j.frugalScore},onClose:()=>p(!1)})})]})}const hr={tag:tn,"shopping-bag":rs,refresh:xt,"trending-up":rt,flame:_s,"shield-check":le,leaf:Vs,heart:Yt};function fr({t,links:s,title:n}){return s?.length?e.jsxs("div",{className:"mt-5",children:[e.jsx("div",{className:"mb-2 px-1 text-[13px] uppercase tracking-wider font-semibold",style:{color:t.textSoft},children:n}),e.jsx("div",{className:"space-y-2",children:s.map((a,r)=>
356{const l=hr[a.iconName]??ze,i=a.tone==="brand"?{bg:t.brandSoft,fg:t.brand}:a.tone==="gold"?{bg:t.goldSoft,fg:t.gold}:{bg:t.coolSoft,fg:t.cool};return e.jsxs(T.a,{href:a.url,target:"_blank",rel:"noopener noreferrer",initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{delay:.1+r*.05},className:"flex items-center gap-3 rounded-2xl p-3 transition active:scale-[0.99]",style:{background:t.surface,border:`1px solid ${t.border}`},children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl",style:{background:i.bg},children:e.jsx(l,{size:18,style:{color:i.fg}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:t.text},children:a.name}),e.jsx("div",{className:"text-[13px]",style:{color:t.textMuted},children:a.sub})]}),e.jsx(ze,{size:15,style:{color:t.textSoft,flexShrink:0}})]},a.name+r)})})]}):null}const pr={Technik:35,Kleidung:50,Wohnen:40,Mobilität:30,Freizeit:40,"Bücher/Medien":50,Sonstiges:30};function gr(t){if(!t||t==="Lebensmittel")return null;if(t==="Bücher/Medien")return"Einmal lesen reicht? Bibliothek oder Onleihe kostet fast nichts — sonst gebraucht oft ~50 % günstiger.";const s=pr[t];return s?`${t} ist gebraucht oft rund ${s} % günstiger — kurz unten checken?`:null}function br(t){return`https://www.kleinanzeigen.de/s-${t.toLowerCase().replace(/ä/g,"ae").replace(/ö/g,"oe").replace(/ü/g,"ue").replace(/ß/g,"ss").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}/k0`}function yr(t,s,n=!1){if(!t?.title)return[];const a=encodeURIComponent(t.title),r=br(t.title),l=t.category;if(l==="Lebensmittel")return[{name:"Too Good To Go",sub:"Lebensmittel retten & günstig sichern",url:"https://toogoodtogo.com/de-de",iconName:"leaf",tone:"brand"},{name:"Foodsharing",sub:"Kostenlos teilen & retten",url:"https://foodsharing.de",iconName:"heart",tone:"cool"}];if(l==="Bücher/Medien")return[{name:"Bibliothek / Onleihe",sub:"Einmal lesen? Leihen kostet fast nichts",url:"https://www.onleihe.de",iconName:"heart",tone:"brand"},{name:"rebuy",sub:"Gebrauchte Bücher, Filme, Spiele, Musik",url:`https://www.rebuy.de/kaufen/suchergebnis?q=${a}`,iconName:"shield-check",tone:"cool"},{name:"Kleinanzeigen",sub:"Lokal gebraucht",url:r,iconName:"tag",tone:"gold"},{name:"eBay",sub:"Gebraucht & antiquarisch",url:`https://www.ebay.de/sch/i.html?_nkw=${a}&LH_ItemCondition=3000`,iconName:"refresh",tone:"cool"}];const i=["Kleidung","Technik","Freizeit","Wohnen","Sonstiges"].includes(l??""),c=[];if(s==="used"){if(c.push({name:"Kleinanzeigen",sub:"Lokal & deutschlandweit",url:r,iconName:"tag",tone:"brand"}),i){const d=l==="Kleidung"?"Mode & Accessoires":l==="Technik"?"Elektronik gebraucht":l==="Freizeit"?"Hobby, Sport, Sammler":l==="Wohnen"?"Home & Haushalt":"Second-Hand-Marktplatz";c.push({name:"Vinted",sub:d,url:`https://www.vinted.de/catalog?search_text=${a}`,iconName:"shopping-bag",tone:"cool"})}c.push({name:"eBay",sub:"Auktionen & Sofort-Kauf",url:`https://www.ebay.de/sch/i.html?_nkw=${a}&LH_ItemCondition=3000`,iconName:"refresh",tone:"gold"}),l==="Technik"&&(c.push({name:"rebuy",sub:"Geprüfte gebrauchte Elektronik",url:`https://www.rebuy.de/kaufen/suchergebnis?q=${a}`,iconName:"shield-check",tone:"brand"}),c.push({name:"Back Market",sub:"Refurbished mit Garantie",url:`https://www.backmarket.de/de-de/search?q=${a}`,iconName:"refresh",tone:"cool"}))}if((s==="wait"||s==="buy")&&(c.push({name:"idealo",sub:"Preisvergleich & Verlauf",url:`https://www.idealo.de/preisvergleich/MainSearchProductCategory.html?q=${a}`,iconName:"trending-up",tone:"cool"}),c.push({name:"mydealz",sub:"Deals & Preisalarm setzen",url:`https://www.mydealz.de/search?q=${a}`,iconName:"flame",tone:"gold"}),s==="wait"&&(c.push({name:"Kleinanzeigen",sub:"Alternative: gebraucht",url:r,iconName:"tag",tone:"brand"}),i&&c.push({name:"Vinted",sub:"Alternative: gebraucht",url:`https://www.vinted.de/catalog?search_text=${a}`,iconName:"shopping-bag",tone:"cool"}))),n&&c.length>1){const d=new Set(["Kleinanzeigen","Vinted","eBay","rebuy","Back Market"]);return[...c].sort((p,u)=>{const m=d.has(p.name)?0:1,h=d.has(u.name)?0:1;return m-h})}return c}function jr(t,s,n=0){if(!t||t<=0)return 0;let a=0;if(s.deadline){const r=Math.max(0,s.target-s.current),l=Math.ceil((new Date(s.deadline).getTime()-Date.now())/864e5);r>0&&l>0&&(a=r/l)}return a<=0&&n>0&&(a=n/30),a<=0&&(a=30),Math.max(1,Math.round(t/a))}const kr=86400*1e3;function Ge(t){return(t||"").trim().toLowerCase()}function Xe(t,s){const n=new Set(Ge(t).split(/\s+/).filter(r=>r.length>=4)),a=Ge(s).split(/\s+/).filter(r=>r.length>=4);return n.size===0||a.length===0?!1:a.some(r=>n.has(r))}function vr(t,s,n="all"){const a=[],r=Date.now(),l=t.transactions||[],i=t.avoidedItems||[],c=Ge(s.shop),d=s.category;if(c){const h=new Date;h.setDate(1),h.setHours(0,0,0,0);const b=h.getTime(),x=l.filter(g=>Ge(g.shop||"")===c&&new Date(g.date).getTime()>=b).length+i.filter(g=>new Date(g.date).getTime()>=b&&Xe(g.title,s.title)).length,f=i.filter(g=>new Date(g.date).getTime()>=b&&Xe(g.title,s.title)).length;x>=2&&a.push({id:"repeat-shop",tone:"warn",text:f>0?`Bei ${s.shop} ist das diesen Monat dein ${x+1}. Mal — ${f}× hast du's gelassen. 💪`:`Bei ${s.shop} bist du diesen Monat schon häufiger — kurz innehalten.`})}const p=i.find(h=>Xe(h.title,s.title));if(p){const h=Math.max(1,Math.round((r-new Date(p.date).getTime())/kr));a.push({id:"seen-before",tone:"brand",text:`Das hattest du vor ${h} Tag${h===1?"":"en"} schon mal — und verworfen.`})}if(d){const h=l.filter(x=>x.category===d&&x.amount<0),b=h.filter(x=>x.tags?.includes("Impuls")).length;h.length>=3&&b/h.length>=.5&&a.push({id:"category-impulse",tone:"warn",text:`${d} wird bei dir überdurchschnittlich oft zum Impuls.`})}if(s.hour>=21||s.hour<6){const h=l.filter(b=>{if(!b.tags?.includes("Impuls"))return!1;const x=new Date(b.date).getHours();return x>=21||x<6}).length;h>=2&&a.push({id:"late-impulse",tone:"warn",text:`Abends ging bei dir schon ${h}× ein Kauf als Impuls aus.`})}const m={time:["late-impulse"],savings:["category-impulse","repeat-shop"],family:["category-impulse","seen-before"]}[n];return m&&a.sort((h,b)=>{const x=m.includes(h.id)?0:1,f=m.includes(b.id)?0:1;return x-f}),a.slice(0,2)}const wr={adhs:{wait:"Der Impuls ist gerade laut. Schlaf einmal drüber — ist er morgen noch da, ist er echt. 🙂",skip:"Starkes Nein. Du hast den Impuls erkannt, bevor er dich erwischt hat. 💪"},business:{wait:"Kein Schnellschuss. Rechnet sich der ROI in 48 h immer noc
356h, kauf bewusst.",skip:"Die Zahlen sprechen dagegen. Kein Investment, das sich trägt."},family:{wait:"Lohnt sich das für die Familie? Wenn der Wunsch in 48 h bleibt, ist er echt.",used:"Für die Familie reicht gebraucht oft locker — und spart spürbar."},fire:{wait:"Jeder Euro arbeitet fürs Ziel. Wartezeit läuft — Sparquote im Blick.",skip:"Nicht ausgegeben ist investiert. Dein Vermögens-Ich dankt dir."}},Nr={buy:"Bewusster Beitrag — und du unterstützt damit direkt den guten Zweck. 👍",used:"Der Zweck zählt. Wenn dir das Produkt selbst weniger wichtig ist, hilft auch eine Direktspende.",wait:"Kurz ehrlich: willst du das Produkt — oder geht es dir um den Zweck? Beides ist okay, nur bewusst.",skip:"Spricht eher gegen das Produkt. Ist dir der Zweck wichtig, kommt eine Direktspende oft mehr an."},Sr={used:"Gebraucht gibt es das oft deutlich günstiger — oder du leihst es einfach in der Bibliothek."},et={title:"Aber das Angebot läuft ab?",points:['Künstliche Verknappung macht aus dem Kauf eine „letzte Chance" — Druck schaltet das ruhige Abwägen aus.',"Echte Knappheit ist selten: Derselbe Deal kommt fast immer wieder.","Ein Rabatt auf etwas Unnötiges ist 100 % Ausgabe — nicht X % Ersparnis."],hint:"Läuft es vor Ende der Wartezeit ab? Genau das ist der Test."},tt=[{key:"need",icon:le,q:"Brauche ich das wirklich?",sub:"Löst es ein echtes Problem?",opts:[{label:"Ja, dringend",score:0},{label:"Eher ja",score:1},{label:"Eher nein",score:2},{label:"Nein",score:3}]},{key:"similar",icon:rs,q:"Habe ich etwas Ähnliches?",sub:"Doppelte vermeiden",opts:[{label:"Nein",score:0},{label:"Vielleicht",score:1},{label:"Ja, eines",score:2},{label:"Mehrfach",score:3}]},{key:"usage",icon:gt,q:"Wie oft werde ich das nutzen?",sub:"Nutzen pro Monat abschätzen",opts:[{label:"Täglich",score:0},{label:"Wöchentlich",score:1},{label:"Monatlich",score:2},{label:"Selten",score:3}]},{key:"why",icon:Yt,q:"Warum will ich das gerade jetzt?",sub:"Motiv erkennen",opts:[{label:"Geplant",score:0},{label:"Echter Bedarf",score:0},{label:"Empfehlung",score:1},{label:"Belohnung",score:2},{label:"Langeweile",score:3},{label:"Spontan entdeckt",score:3}]},{key:"used",icon:xt,q:"Würde gebraucht reichen?",sub:"Refurbished spart oft 30–50 %",opts:[{label:"Ja",score:2},{label:"Wahrscheinlich",score:1},{label:"Eher nein",score:0},{label:"Muss neu sein",score:0}]},{key:"emotional",icon:ht,q:"Ist der Wunsch emotional gerade?",sub:"Stress, Frust, Belohnung?",opts:[{label:"Gar nicht",score:0},{label:"Wenig",score:1},{label:"Etwas",score:2},{label:"Stark",score:3}]}],zr={key:"usage",icon:gt,q:"Werde ich das wirklich nutzen?",sub:"Einmal lesen/sehen reicht — aber lese/sehe ich es überhaupt?",opts:[{label:"Ganz sicher",score:0},{label:"Wahrscheinlich",score:1},{label:"Vielleicht",score:2},{label:"Eher nicht",score:3}]},zt="Bücher/Medien",Cr=["Technik","Kleidung","Wohnen","Mobilität","Freizeit","Lebensmittel",zt,"Sonstiges"],Mr=24*60*60*1e3,Dr={title:"",price:"",shop:"",category:"Technik",url:"",goodCause:!1};function Er({t,store:s,onClose:n,initialItem:a}){const{actions:r,state:l,derived:i}=s,c=!a&&l.checkDraft&&Date.now()-l.checkDraft.updatedAt<Mr?l.checkDraft:null,[d,p]=o.useState(c?c.stage:"input"),[u,m]=o.useState(()=>c?{...c.item}:{title:a?.title??"",price:String(a?.price??""),shop:a?.shop??"",category:a?.category??"Technik",url:a?.url??"",goodCause:a?.goodCause??!1}),[h,b]=o.useState(c?c.qIndex:0),[x,f]=o.useState(c?{...c.answers}:{}),[g,j]=o.useState(!1),[M,W]=o.useState(!1);o.useEffect(()=>{if(g||!(u.title.trim()!==""||u.price.trim()!==""||Object.keys(x).length>0))return;const P=window.setTimeout(()=>{r.saveCheckDraft({stage:d,item:u,qIndex:h,answers:x,updatedAt:Date.now()})},400);return()=>window.clearTimeout(P)},[d,u,h,x,g,r]);const z=()=>{r.clearCheckDraft(),p("input"),m({...Dr}),b(0),f({})},D=o.useMemo(()=>In(l.profile.mode),[l.profile.mode]),I=u.category==="Lebensmittel"||u.goodCause,F=u.category===zt,J=o.useMemo(()=>{const E=I?tt.filter(P=>P.key!=="used"):tt;return F?E.map(P=>P.key==="usage"?zr:P):E},[I,F]),ne=o.useMemo(()=>it(l.rules,{price:parseFloat(u.price)||0,category:u.category,shop:u.shop,hour:new Date().getHours(),monthlyShopSpend:i?.monthlyShopSpend||{}}),[l.rules,u,i?.monthlyShopSpend]),B=o.useMemo(()=>
356{if(d!=="result")return null;const E=Math.round(Object.entries(x).reduce((pe,[Ie,Je])=>pe+Je*(D.questionWeights[Ie]??1),0)),P=new Date().getHours(),xe=parseFloat(u.price)||0,q=u.goodCause,Ze=wr[D.tone]??{},we=(pe,Ie)=>q?Nr[pe]:Ze[pe]??(F?Sr[pe]:void 0)??Ie,fe=it(l.rules,{price:xe,category:u.category,shop:u.shop,hour:P,monthlyShopSpend:i?.monthlyShopSpend||{}});let se=E+fe.delta;xe>300&&(se+=1);const Z=[];q&&Z.push("Unterstützt einen guten Zweck"),(x.emotional??0)>=2&&Z.push("Emotionaler Auslöser erkannt"),(x.why??0)>=2&&Z.push("Belohnungs- oder Lückenmotiv"),(x.similar??0)>=2&&Z.push("Du besitzt Vergleichbares"),(x.usage??0)===3&&Z.push(F?"Bleibt vermutlich ungenutzt":"Geringe Nutzungsfrequenz"),(x.used??0)>=1&&Z.push("Gebraucht wäre möglich"),xe>300&&Z.push("Größere Anschaffung (>300€)"),Z.push(...fe.reasons);const oe=fe.triggeredIds;return fe.blocked?{type:"skip",label:"Verwerfen",tone:"danger",icon:U,text:fe.reasons[0]||"Eine aktive Regel blockiert diesen Kauf.",waitHours:0,reasons:Z,score:se,triggeredIds:oe}:se<=3?{type:"buy",label:q?"Bewusster Beitrag":"Bewusster Kauf",tone:"brand",icon:q?dt:te,text:we("buy","Diese Anschaffung passt zu deinen Werten. Genieße sie ohne schlechtes Gewissen."),waitHours:0,reasons:Z,score:se,triggeredIds:oe}:se<=7?{type:"used",label:"Gebraucht prüfen",tone:"gold",icon:xt,text:we("used","Refurbished oder Kleinanzeigen sparen hier oft spürbar — ohne Funktionsverlust."),waitHours:D.waitHours.used,reasons:Z,score:se,triggeredIds:oe}:se<=11?{type:"wait",label:`Warte ${D.waitHours.wait} Stunden`,tone:"cool",icon:Ee,text:we("wait",`Hohe Wahrscheinlichkeit für einen Impulskauf. Wenn der Wunsch in ${D.waitHours.wait} h noch da ist, ist er echt.`),waitHours:D.waitHours.wait,reasons:Z,score:se,triggeredIds:oe}:{type:"skip",label:"Verwerfen",tone:"danger",icon:U,text:we("skip","Mehrere Signale deuten auf einen emotionalen Kauf hin. Dein zukünftiges Ich dankt dir."),waitHours:0,reasons:Z,score:se,triggeredIds:oe}},[d,x,u,l.rules,i?.monthlyShopSpend,D,F]),$=o.useMemo(()=>B&&!u.goodCause?yr(u,B.type,D.usedFirst):[],[B,u,D.usedFirst]),H=o.useMemo(()=>B&&u.goodCause&&((x.similar??0)>=2||B.type==="wait"||B.type==="skip")?"Wenn es dir um den Zweck geht: Eine Direktspende kommt oft stärker an als das Produkt — ohne dass du etwas bekommst, das du schon hast.":null,[B,u.goodCause,x.similar]),re=o.useMemo(()=>d==="result"?vr(l,{title:u.title,category:u.category,shop:u.shop,price:parseFloat(u.price)||0,hour:new Date().getHours()},D.patternFocus):[],[d,l,u,D.patternFocus]),ie=o.useMemo(()=>B&&!u.goodCause&&(B.type==="used"||B.type==="wait")?gr(u.category):null,[B,u.category,u.goodCause]),A=E=>{const P={...x,[J[h].key]:E};f(P),h<J.length-1?setTimeout(()=>b(h+1),120):setTimeout(()=>p("result"),200)},C=()=>{B&&(r.addWaitingItem({...u,decision:{...B,icon:void 0}},B.waitHours),r.incrementRuleTriggers(B.triggeredIds),r.clearCheckDraft(),n())},G=()=>{B&&(r.addWaitingItem({...u,decision:{...B,icon:void 0}},null),r.incrementRuleTriggers(B.triggeredIds),r.clearCheckDraft(),n())},K=()=>{if(!B)return;const E=B.type==="skip"||B.type==="wait";r.addTransaction({title:u.title,amount:-parseFloat(u.price),category:u.category,tags:E?["Impuls"]:["Wertvoll"],url:u.url,shop:u.shop,icon:E?"⚡":"🛍️",source:"check"}),E&&r.recordImpulse(parseFloat(u.price)),r.incrementRuleTriggers(B.triggeredIds),r.clearCheckDraft(),n()},ue=()=>{B&&(r.recordAvoided(parseFloat(u.price),{title:u.title,category:u.category,url:u.url}),r.incrementRuleTriggers(B.triggeredIds),r.clearCheckDraft(),j(!0))},he={avoidedTotal:l.stats.avoidedTotal,avoidedCount:l.stats.avoidedCount,waitedSuccess:l.stats.waitedSuccess,waitedTotal:(l.avoidedItems||[]).filter(E=>E.reason==="waited").reduce((E,P)=>E+(P.price||0),0),frugalScore:i.frugalScore},v={brand:t.brand,gold:t.gold,cool:t.cool,danger:t.danger},k={brand:t.brandSoft,gold:t.goldSoft,cool:t.coolSoft,danger:t.dangerSoft},y=B?v[B.tone]:t.brand,w=B?k[B.tone]:t.brandSoft;return e.jsxs("div",{className:"-mx-5 -mt-2 flex flex-col",style:{background:t.bg},children:[g?e.jsx(Ar,{t,item:u,stats:he,onShare:()=>W(!0),onClose:n}):e.jsxs(e.Fragment,{children:[d==="input"&&e.jsx(Ir,{t,item:u,livePreview:ne,onItemChange:m,onStart:()=>p("questions"),onClose:n,onDiscard:z}),d==="questions"&&e.jsx(Fr,{t,qIndex:h,activeQuestions:J,onAnswer:A,onBack:()=>h===0?p("input"):b(h-1)}),d==="result"&&B&&e.jsx(Tr,{t,item:u,decision:B,decisionColor:y,decisionSoft:w,smartLinks:$,patterns:re,usedHint:ie,causeNote:H,goals:l.goals,monthlyBudget:l.profile.monthlyBudget,onStartWait:C,onSaveForLater:G,onBuyAnyway:K,onDismiss:ue,onBack:()=>{p("questions"),b(tt.length-1)}})]}),e.jsx(ee,{children:M&&e.jsx(Nt,{t,stats:he,onClose:()=>W(!1)})})]})}function Ar({t,item:s,stats:n,onShare:a,onClose:r}){const l=parseFloat(s.price)||0;return e.jsxs(T.div,{initial:{opacity:0}
356,animate:{opacity:1},children:[e.jsx(qe,{t,title:"Stark!",onBack:r}),e.jsxs("div",{className:"flex flex-col items-center px-5 py-6 text-center",children:[e.jsx(T.div,{initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:200,damping:14},className:"flex h-20 w-20 items-center justify-center rounded-3xl",style:{background:t.brandSoft},children:e.jsx(pt,{size:38,style:{color:t.brand}})}),e.jsxs("h2",{className:"mt-5 text-2xl font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:[l.toFixed(0)," € nicht ausgegeben"]}),e.jsxs("p",{className:"mt-2 max-w-xs text-sm leading-relaxed",style:{color:t.textMuted},children:["Bewusst entschieden statt impulsiv gekauft. Insgesamt schon"," ",e.jsxs("span",{style:{color:t.brand,fontWeight:600},children:[n.avoidedTotal.toFixed(0)," €"]})," behalten."]}),e.jsxs("div",{className:"mt-7 w-full max-w-xs space-y-2",children:[e.jsxs("button",{onClick:a,className:"flex w-full items-center justify-center gap-2 rounded-2xl py-3.5 text-[15px] font-semibold transition active:scale-[0.99]",style:{background:t.brand,color:"#fff"},children:[e.jsx(Ce,{size:16})," Erfolg teilen"]}),e.jsx("button",{onClick:r,className:"w-full rounded-2xl py-3 text-sm font-semibold transition active:scale-[0.99]",style:{background:"transparent",border:`1px solid ${t.border}`,color:t.textMuted},children:"Fertig"})]})]})]})}function Ir({t,item:s,livePreview:n,onItemChange:a,onStart:r,onClose:l,onDiscard:i}){const c=s.title&&s.price&&parseFloat(s.price)>0,d=!!(s.title||s.price||s.url||s.shop||s.goodCause);return e.jsxs(T.div,{initial:{x:30,opacity:0},animate:{x:0,opacity:1},className:"flex flex-col",children:[e.jsx(qe,{t,title:"Kauf prüfen",onBack:l}),e.jsxs("div",{className:"px-5 py-4 space-y-5",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-semibold tracking-tight",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Was möchtest du kaufen?"}),e.jsx("p",{className:"mt-1 text-sm",style:{color:t.textMuted},children:"Wir helfen dir, bewusst zu entscheiden — in unter zwei Minuten."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(L,{t,label:"Produkt",value:s.title,onChange:p=>a({...s,title:p.target.value}),placeholder:"z. B. MacBook Air M3"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(L,{t,label:"Preis",suffix:"€",value:s.price,onChange:p=>a({...s,price:p.target.value}),placeholder:"0",type:"number",inputMode:"decimal",min:"0",max:"9999999"}),e.jsx(L,{t,label:"Shop",value:s.shop,onChange:p=>a({...s,shop:p.target.value}),placeholder:"Apple, Amazon …"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[13px] uppercase tracking-wider font-semibold",style:{color:t.textSoft},children:"Kategorie"}),e.jsx("div",{className:"mt-1.5 flex flex-wrap gap-2",children:Cr.map(p=>e.jsx("button",{onClick:()=>a({...s,category:p}),className:"rounded-full px-3.5 py-1.5 text-sm font-medium transition",style:{background:s.category===p?t.brand:t.surface,color:s.category===p?"#fff":t.text,border:`1px solid ${s.category===p?t.brand:t.border}`},children:p},p))})]}),e.jsx(L,{t,label:e.jsxs(e.Fragment,{children:[e.jsx(ut,{size:11,className:"inline mr-1"})," Produkt-Link"]}),hint:"(optional)",value:s.url,onChange:p=>a({...s,url:p.target.value}),placeholder:"https://...",type:"url",inputMode:"url"}),e.jsxs("button",{type:"button",onClick:()=>a({...s,goodCause:!s.goodCause}),className:"flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left transition active:scale-[0.99]",style:{background:s.goodCause?t.brandSoft:t.surface,border:`1px solid ${s.goodCause?t.brand:t.border}`},"aria-pressed":s.goodCause,children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl",style:{background:s.goodCause?t.brand:`${t.text}08`},children:e.jsx(dt,{size:17,style:{color:s.goodCause?"#fff":t.textMuted}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:t.text},children:"Unterstützt einen guten Zweck"}),e.jsx("div",{className:"text-[12px]",style:{color:t.textMuted},children:"Fundraiser, Charity, Spenden-Merch — Gebraucht-Frage entfällt"})]}),e.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full",style:{border:`2px solid ${s.goodCause?t.brand:t.border}`,background:s.goodCause?t.brand:"transparent"},children:s.goodCause&&e.jsx(te,{size:13,color:"#fff",strokeWidth:3})})]})]}),n.reasons.length>0&&e.jsx("div",{className:"rounded-2xl p-4",style:{background:n.blocked?t.dangerSoft:t.warnSoft},children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(ft,{size:18,style:{color:n.blocked?t.danger:t.warn,flexShrink:0,marginTop:2}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium",style:{color:t.text},children:n.blocked?"Käufe sind aktuell blockiert":"Aktive Regeln greifen jetzt"}),e.jsx("ul",{className:"mt-1.5 space-y-0.5 text-sm leading-relaxed",style:{color:t.textMuted},children:n.reasons.map(p=>e.jsxs("li",{className:"flex items-start gap-1.5",children:[e.jsx("span",{style:{color:n.blocked?t.danger:t.warn},children:"•"}),e.jsx("span",{children:p})]},p))}),!n.blocked&&e.jsxs("div",{className:"mt-1.5 text-[12px]",style:{color:t.textSoft},children:["Dein Score wird um ",n.delta," Punkte erhöht — der Check wird strenger."]})]})]})}),e.jsx("div",{className:"rounded-2xl p-4",style:{background:t.goldSoft},children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(es,{size:18,style:{color:t.gold,flexShrink:0,marginTop:2}}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",style:{color:t.text},children:"Tipp"}),e.jsx("div",{className:"mt-0.5 text-sm leading-relaxed",style:{color:t.textMuted},children:"Sechs kurze Fragen helfen dir, zwischen echtem Bedarf und Impuls zu unterscheiden."})]})]})})]}),e.jsxs("div",{className:"px-5 pb-4 pt-3",style:{borderTop:`1px solid ${t.border}`},children:[e.jsx(O,{t,onClick:r,disabled:!c,children:"Denkzettel-Check starten"}),d&&e.jsx("button",{type:"button",onClick:i,className:"mt-2 w-full rounded-2xl py-3 text-sm font-semibold transition active:scale-[0.99]",style:{background:"transparent",border:`1px solid ${t.border}`,color:t.danger},children:"Entwurf verwerfen"})]})]})}function Fr({t,qIndex:s,activeQuestions:n,onAnswer:a,onBack:r}){const l=n[s];return e.jsxs("div",{className:"flex flex-col",children:[e.jsx(qe,{t,title:`Frage ${s+1} / ${n.length}`,onBack:r}),e.jsx("div",{className:"px-5 pb-3",children:e.jsx("div",{className:"h-1 overflow-hidden rounded-full",style:{background:`${t.text}10`},children:e.jsx(T.div,{className:"h-full rounded-full",style:{background:t.brand},animate:{width:`${(s+1)/n.length*100}%`},transition:{duration:.5}})})}),e.jsx(ee,{mode:"wait",children:e.jsxs(T.div,{initial:{x:20,opacity:0}
356,animate:{x:0,opacity:1},exit:{x:-20,opacity:0},transition:{duration:.25},className:"flex flex-col px-5 pb-6",children:[e.jsxs("div",{className:"pt-4",children:[e.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-2xl",style:{background:t.brandSoft},children:_e.createElement(l.icon,{size:26,style:{color:t.brand}})}),e.jsx("h2",{className:"mt-5 text-2xl font-semibold leading-tight",style:{color:t.text,fontFamily:"Fraunces, serif"},children:l.q}),e.jsx("p",{className:"mt-2 text-sm",style:{color:t.textMuted},children:l.sub})]}),e.jsx("div",{className:"mt-7 space-y-2.5",children:l.opts.map((i,c)=>e.jsxs(T.button,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:c*.04},onClick:()=>a(i.score),className:"flex w-full items-center justify-between rounded-2xl px-5 py-4 text-[15px] font-medium text-left transition active:scale-[0.99]",style:{background:t.surface,border:`1px solid ${t.border}`,color:t.text},children:[i.label,e.jsx(ae,{size:18,style:{color:t.textSoft}})]},i.label))})]},s)})]})}function Tr({t,item:s,decision:n,decisionColor:a,decisionSoft:r,smartLinks:l,patterns:i,usedHint:c,causeNote:d,goals:p,monthlyBudget:u,onStartWait:m,onSaveForLater:h,onBuyAnyway:b,onDismiss:x,onBack:f}){const g=p.length>0?jr(parseFloat(s.price),p[0],u):0,[j,M]=o.useState(!1);return e.jsxs(T.div,{initial:{opacity:0}
356,animate:{opacity:1},className:"flex flex-col",children:[e.jsx(qe,{t,title:"Ergebnis",onBack:f}),e.jsxs("div",{className:"px-5 py-4",children:[e.jsxs(T.div,{initial:{scale:.95,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.4,ease:[.16,1,.3,1]},className:"rounded-3xl p-7 text-center",style:{background:r},children:[e.jsx(T.div,{initial:{scale:0,rotate:-20},animate:{scale:1,rotate:0},transition:{delay:.15,type:"spring",stiffness:180},className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full",style:{background:a},children:_e.createElement(n.icon,{size:30,color:"#fff",strokeWidth:2.5})}),e.jsx("h2",{className:"mt-4 text-2xl font-semibold",style:{color:a,fontFamily:"Fraunces, serif"},children:n.label}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed mx-auto max-w-xs",style:{color:t.text,opacity:.85},children:n.text})]}),e.jsxs(R,{t,className:"mt-4",padding:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-11 w-11 items-center justify-center rounded-xl text-xl",style:{background:`${t.text}08`},children:"📦"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold",style:{color:t.text},children:s.title}),e.jsxs("div",{className:"text-sm",style:{color:t.textMuted},children:[s.category,s.shop&&` · ${s.shop}`]})]}),e.jsxs("div",{className:"text-base font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:[parseFloat(s.price).toFixed(2)," €"]})]}),s.url&&e.jsxs("a",{href:St(s.url),target:"_blank",rel:"noopener noreferrer",className:"mt-3 flex items-center justify-between rounded-xl px-3 py-2.5 text-sm transition active:scale-[0.99]",style:{background:`${t.text}06`,color:t.textMuted},children:[e.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(ut,{size:13,style:{color:t.cool,flexShrink:0}}),e.jsx("span",{className:"truncate",style:{color:t.text,fontWeight:500},children:"Zum Produkt"})]}),e.jsx(ze,{size:13,style:{flexShrink:0}})]})]}),i.length>0&&e.jsx("div",{className:"mt-4 space-y-2",children:i.map(z=>{const D=z.tone==="warn"?t.warn:t.brand,I=z.tone==="warn"?t.warnSoft:t.brandSoft;return e.jsxs("div",{className:"flex items-start gap-3 rounded-2xl p-4",style:{background:I},children:[e.jsx(ht,{size:18,style:{color:D,flexShrink:0,marginTop:1}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[12px] uppercase tracking-wider font-semibold",style:{color:D},children:"Dein Muster"}),e.jsx("div",{className:"mt-0.5 text-sm leading-relaxed",style:{color:t.text},children:z.text})]})]},z.id)})}),n.reasons.length>0&&e.jsxs("div",{className:"mt-5",children:[e.jsx("div",{className:"mb-2 px-1 text-[13px] uppercase tracking-wider font-semibold",style:{color:t.textSoft},children:"Warum diese Empfehlung"}),e.jsx(R,{t,padding:"p-2",children:n.reasons.map((z,D)=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",style:{borderBottom:D<n.reasons.length-1?`1px solid ${t.border}`:"none"},children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full",style:{background:t.gold}}),e.jsx("span",{className:"text-sm",style:{color:t.text},children:z})]},z))})]}),d&&e.jsxs("div",{className:"mt-5 flex items-start gap-2.5 rounded-2xl p-3.5",style:{background:t.brandSoft},children:[e.jsx(dt,{size:16,style:{color:t.brand,flexShrink:0,marginTop:1}}),e.jsx("span",{className:"text-[13px] leading-relaxed",style:{color:t.text},children:d})]}),c&&l.length>0&&e.jsxs("div",{className:"mt-5 flex items-start gap-2.5 rounded-2xl p-3.5",style:{background:t.goldSoft},children:[e.jsx(es,{size:16,style:{color:t.gold,flexShrink:0,marginTop:1}}),e.jsx("span",{className:"text-[13px] leading-relaxed",style:{color:t.text},children:c})]}),e.jsx(fr,{t,links:l,title:s.category==="Lebensmittel"?"Foodsharing-Alternativen":s.category===zt?"Leihen oder gebraucht holen":n.type==="used"?"Gebrauchte Angebote suchen":n.type==="wait"?"Preis beobachten in der Wartezeit":"Vor dem Kauf prüfen"}),n.type!=="buy"&&e.jsxs("div",{className:"mt-5",children:[e.jsxs("button",{type:"button",onClick:()=>M(z=>!z),"aria-expanded":j,className:"flex w-full items-center gap-2.5 rounded-2xl p-3.5 text-left",style:{background:t.warnSoft},children:[e.jsx(Ee,{size:16,style:{color:t.warn,flexShrink:0}}),e.jsx("span",{className:"flex-1 text-[13px] font-medium",style:{color:t.text},children:et.title}),e.jsx(ae,{size:16,style:{color:t.textSoft,flexShrink:0,transform:j?"rotate(90deg)":"none",transition:"transform 150ms"}})]}),e.jsx(ee,{initial:!1,children:j&&e.jsx(T.div,{initial:{opacity:0,height:0}
356,animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"overflow-hidden",children:e.jsxs("div",{className:"mt-2 rounded-2xl p-3.5 text-[13px] leading-relaxed",style:{background:t.warnSoft,color:t.text},children:[e.jsx("ul",{className:"space-y-1.5",children:et.points.map(z=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{style:{color:t.warn},children:"•"}),e.jsx("span",{children:z})]},z))}),e.jsx("p",{className:"mt-2.5 font-medium",style:{color:t.text},children:et.hint}),e.jsxs("a",{href:"./ratgeber/fomo-shopping.html",target:"_blank",rel:"noopener noreferrer",className:"mt-2.5 inline-flex items-center gap-1.5 font-medium underline-offset-2 hover:underline",style:{color:t.brand},children:["Mehr dazu im FOMO-Ratgeber",e.jsx(ze,{size:13})]})]})})})]}),p.length>0&&e.jsxs("div",{className:"mt-5",children:[e.jsx("div",{className:"mb-2 px-1 text-[13px] uppercase tracking-wider font-semibold",style:{color:t.textSoft},children:"Auswirkung"}),e.jsx(R,{t,padding:"p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(We,{size:18,style:{color:t.gold}}),e.jsx("div",{className:"flex-1 text-sm",style:{color:t.text},children:n.type==="skip"||n.type==="wait"?e.jsxs(e.Fragment,{children:["So viel länger müsstest du für dein Ziel"," ",e.jsx("span",{style:{fontWeight:600},children:p[0].title})," sparen:"," ",e.jsxs("span",{style:{fontWeight:600,color:t.gold},children:[g," ",g===1?"Tag":"Tage"]}),"."]}):e.jsxs(e.Fragment,{children:["Du bist"," ",e.jsx("span",{style:{fontWeight:600,color:t.brand},children:"bewusst"})," mit deinen Zielen unterwegs."]})})]})})]})]}),e.jsxs("div",{className:"px-5 pb-4 pt-3 space-y-2",style:{borderTop:`1px solid ${t.border}`},children:[(n.type==="wait"||n.type==="used")&&e.jsxs(O,{t,onClick:m,children:["In Wartezeit schicken (",n.waitHours," h)"]}),n.type==="buy"&&e.jsx(O,{t,onClick:b,children:"Kauf bewusst durchführen"}),n.type==="skip"&&e.jsx(O,{t,onClick:x,children:"Gut, ich lass es"}),e.jsx(ve,{t,onClick:n.type==="buy"?h:b,children:n.type==="buy"?"Später entscheiden":"Trotzdem kaufen"})]})]})}const ys={Lebensmittel:"🛒",Elektronik:"📦",Abonnement:"🔁",Mobilität:"⛽",Wohnen:"🪑",Freizeit:"☕",Kleidung:"👕",Technik:"💻",Gesundheit:"💊",Einkommen:"💰",Sonstiges:"📁"},Br=["Technik","Kleidung","Wohnen","Mobilität","Freizeit","Lebensmittel","Abonnement","Gesundheit","Sonstiges"],Rr=t=>t?new Date(`${t}T12:00:00`).toISOString():new Date().toISOString(),$r=t=>{try{return new Date(t).toISOString().slice(0,10)}catch{return new Date().toISOString().slice(0,10)}};function Lr({t,store:s,onCheckInstead:n}){const{state:a,actions:r}=s,[l,i]=o.useState({type:"list"}),[c,d]=o.useState(""),[p,u]=o.useState(!1),[m,h]=o.useState("Alle"),b=()=>i({type:"list"}),x=o.useMemo(()=>{let f=a.transactions;if(c){const g=c.toLowerCase();f=f.filter(j=>j.title.toLowerCase().includes(g)||j.category?.toLowerCase().includes(g))}return m==="Impuls"&&(f=f.filter(g=>g.tags?.includes("Impuls"))),m==="Wertvoll"&&(f=f.filter(g=>g.tags?.includes("Wertvoll"))),f},[a.transactions,c,m]);return l.type==="add"?e.jsx(Kt,{t,mode:"add",rules:a.rules,monthlyShopSpend:s.derived?.monthlyShopSpend,onBack:b,onSubmit:f=>{r.addTransaction(f.txData),f.recordImpulse&&r.recordImpulse(Math.abs(f.txData.amount??0)),b()},onCheckInstead:n?f=>{n({title:f.title,price:f.amount,category:f.category,url:f.url}),b()}:void 0}):l.type==="edit"?e.jsx(Kt,{t,mode:"edit",initial:l.tx,rules:a.rules,monthlyShopSpend:s.derived?.monthlyShopSpend,onBack:b,onSubmit:f=>{r.updateTransaction(l.tx.id,f.txData),b()},onDelete:()=>{r.deleteTransaction(l.tx.id),b()}}):e.jsxs("div",{className:"space-y-4 pb-28",children:[e.jsxs("div",{className:"flex items-center justify-between px-1 pt-2",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Verlauf"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>u(!p),className:"flex h-10 w-10 items-center justify-center rounded-full",style:{background:p?t.brandSoft:t.surface,border:`1px solid ${t.border}`,color:p?t.brand:t.textMuted},children:e.jsx(Ys,{size:18})}),e.jsx("button",{onClick:()=>i({type:"add"}),className:"flex h-10 w-10 items-center justify-center rounded-full",style:{background:t.brand,color:"#fff"},"aria-label":"Neuer Eintrag",children:e.jsx(Ve,{size:20})})]})]}),e.jsx(ee,{children:p&&e.jsx(T.div,{initial:{opacity:0,height:0}
356,animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},children:e.jsx(L,{t,value:c,onChange:f=>d(f.target.value),placeholder:"Suchen..."})})}),e.jsx("div",{className:"flex gap-1.5 overflow-x-auto pb-1 pr-1",children:["Alle","Impuls","Wertvoll","Vermieden"].map(f=>e.jsx("button",{onClick:()=>h(f),className:"rounded-full px-3.5 py-1.5 text-sm font-semibold transition whitespace-nowrap",style:{background:m===f?t.brand:t.surface,color:m===f?"#fff":t.textMuted,border:`1px solid ${m===f?t.brand:t.border}`},children:f},f))}),m==="Vermieden"?(a.avoidedItems||[]).length===0?e.jsx(R,{t,padding:"p-8",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-4xl mb-2",children:"🛑"}),e.jsx("div",{className:"text-sm font-medium",style:{color:t.text},children:"Noch keine vermiedenen Käufe"}),e.jsx("div",{className:"text-sm mt-1",style:{color:t.textMuted},children:'Wenn du im Check „Gut, ich lass es" tippst oder eine Wartezeit verwirfst, landet das hier.'})]})}):e.jsx(R,{t,padding:"p-2",children:(a.avoidedItems||[]).map((f,g,j)=>e.jsx(Pr,{t,item:f,isLast:g===j.length-1,onDelete:()=>r.deleteAvoidedItem(f.id)},f.id))}):x.length===0?e.jsx(R,{t,padding:"p-8",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-4xl mb-2",children:"📭"}),e.jsx("div",{className:"text-sm font-medium",style:{color:t.text},children:"Noch keine Einträge"}),e.jsx("div",{className:"text-sm mt-1",style:{color:t.textMuted},children:"Tippe oben rechts auf + um Ausgabe oder Einnahme zu erfassen."})]})}):e.jsx(R,{t,padding:"p-2",children:x.map((f,g)=>e.jsx(Wr,{t,tx:f,isLast:g===x.length-1,onEdit:()=>i({type:"edit",tx:f}),onDelete:()=>r.deleteTransaction(f.id)},f.id))})]})}function Wr({t,tx:s,isLast:n,onEdit:a,onDelete:r}){const[l,i]=o.useState(!1),c=s.icon||ys[s.category]||"📁",d=o.useMemo(()=>{try{const m=new Date(s.date),h=new Date,b=new Date(h);return b.setDate(b.getDate()-1),m.toDateString()===h.toDateString()?"Heute":m.toDateString()===b.toDateString()?"Gestern":m.toLocaleDateString("de-DE",{day:"2-digit",month:"short"})}catch{return s.date}},[s.date]),p=s.source||"manual",u=p==="check-waited"?{Icon:le,color:t.brand}:p==="check"?{Icon:le,color:t.cool}:{Icon:Re,color:t.textSoft};return e.jsxs("div",{style:{borderBottom:n?"none":`1px solid ${t.border}`},children:[e.jsxs("div",{className:"flex items-center gap-3 p-3 cursor-pointer",onClick:()=>i(!l),children:[e.jsx("div",{className:"flex h-11 w-11 items-center justify-center rounded-xl text-xl",style:{background:`${t.text}08`},children:c}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold",style:{color:t.text},children:s.title}),e.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 text-[13px]",style:{color:t.textMuted},children:[e.jsx(u.Icon,{size:10,style:{color:u.color}}),e.jsxs("span",{children:[s.category," · ",d]})]}),(s.tags?.includes("Impuls")||s.tags?.includes("Wertvoll")||s.tags?.includes("Wartezeit bestanden"))&&e.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[s.tags?.includes("Impuls")&&e.jsx(ye,{t,tone:"danger",children:"Impuls"}),s.tags?.includes("Wertvoll")&&e.jsx(ye,{t,tone:"brand",children:"Wertvoll"}),s.tags?.includes("Wartezeit bestanden")&&e.jsx(ye,{t,tone:"cool",children:"Gewartet"})]})]}),e.jsxs("div",{className:"text-sm font-semibold tabular-nums",style:{color:s.amount<0?t.text:t.brand,fontFamily:"Fraunces, serif"},children:[s.amount>0?"+":"",s.amount.toFixed(2)," €"]})]}),e.jsx(ee,{children:l&&e.jsx(T.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},children:e.jsxs("div",{className:"px-3 pb-3 pt-1 flex gap-2 items-center",children:[s.url&&e.jsxs("a",{href:St(s.url),target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-sm",style:{background:t.coolSoft,color:t.cool},onClick:m=>m.stopPropagation(),children:[e.jsx(ut,{size:12})," Produkt-Link"]}),e.jsxs("button",{onClick:m=>{m.stopPropagation(),a()},className:"flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-sm",style:{background:t.coolSoft,color:t.cool},children:[e.jsx(Re,{size:12})," Bearbeiten"]}),e.jsxs("button",{onClick:m=>{m.stopPropagation(),r()},className:"ml-auto flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-sm",style:{background:t.dangerSoft,color:t.danger},children:[e.jsx(V,{size:12})," Löschen"]})]})})})]})}function Pr({t,item:s,isLast:n,onDelete:a}){const[r,l]=o.useState(!1),i=o.useMemo(()=>{try{const d=new Date(s.date),p=new Date,u=new Date(p);return u.setDate(u.getDate()-1),d.toDateString()===p.toDateString()?"Heute":d.toDateString()===u.toDateString()?"Gestern":d.toLocaleDateString("de-DE",{day:"2-digit",month:"short"})}catch{return s.date}},[s.date]),c=s.reason==="waited"?"Wartezeit verworfen":"Im Check abgelehnt";return e.jsxs("div",{className:"flex items-center gap-3 p-3",style:{borderBottom:n?"none":`1px solid ${t.border}`,opacity:.92},children:[e.jsx("div",{className:"flex h-11 w-11 items-center justify-center rounded-xl text-xl",style:{background:`${t.brand}12`},children:"🛑"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold",style:{color:t.text},children:s.title}),e.jsx("div",{className:"mt-0.5 flex items-center gap-1.5 text-[13px]",style:{color:t.textMuted},children:e.jsxs("span",{children:[s.category," · ",i," · ",c]})})]}),e.jsxs("div",{className:"text-sm font-semibold tabular-nums line-through",style:{color:t.textSoft,fontFamily:"Fraunces, serif"},children:[s.price.toFixed(2)," €"]}),r?e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>l(!1),className:"flex h-7 w-7 items-center justify-center rounded-md",style:{background:`${t.text}08`,color:t.textMuted},children:e.jsx(U,{size:12})}),e.jsx("button",{onClick:()=>{a(),l(!1)},className:"flex h-7 w-7 items-center justify-center rounded-md",style:{background:t.danger,color:"#fff"},title:"Endgültig löschen (Statistik wird mitkorrigiert)",children:e.jsx(V,{size:12})})]}):e.jsx("button",{onClick:()=>l(!0),className:"flex h-7 w-7 items-center justify-center rounded-md",style:{color:t.textSoft},"aria-label":"Löschen",children:e.jsx(V,{size:14})})]})}function Kt({t,mode:s,initial:n,rules:a,monthlyShopSpend:r,onBack:l,onSubmit:i,onDelete:c,onCheckInstead:d}){const p=new Date().toISOString().slice(0,10),u=()=>{if(s==="edit"&&n){const g=n.amount>0,j=n.tags?.includes("Wertvoll")?"wertvoll":n.tags?.includes("Impuls")?"impuls":"neutral";return{title:n.title||"",amount:String(Math.abs(n.amount||0)),category:n.category||"Sonstiges",isIncome:g,tag:j,date:$r(n.date),url:n.url||""}}return{title:"",amount:"",category:"Sonstiges",isIncome:!1,tag:"neutral",date:p,url:""}}
356,[m,h]=o.useState(u),b=m.title.trim().length>0&&m.amount!==""&&!isNaN(parseFloat(m.amount)),x=o.useMemo(()=>m.isIncome||!a?{reasons:[],blocked:!1,delta:0}:it(a,{price:parseFloat(m.amount)||0,category:m.category,shop:"",hour:new Date().getHours(),monthlyShopSpend:r||{}}),[a,m.isIncome,m.amount,m.category,r]),f=()=>{if(!b)return;const g=parseFloat(m.amount),j=!m.isIncome&&m.tag!=="neutral"?[m.tag==="wertvoll"?"Wertvoll":"Impuls"]:[],M=m.isIncome?"💰":m.tag==="wertvoll"?"🛍️":m.tag==="impuls"?"⚡":ys[m.category]||"📁",W={title:m.title.trim(),amount:m.isIncome?Math.abs(g):-Math.abs(g),category:m.isIncome?"Einkommen":m.category,tags:j,icon:M,date:Rr(m.date),url:m.url.trim()||void 0},z=s==="add"&&!m.isIncome&&m.tag==="impuls";i({txData:W,recordImpulse:z})};return e.jsxs(T.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{duration:.2},className:"space-y-4 pb-28",children:[e.jsxs("div",{className:"px-1 pt-2",children:[e.jsxs("button",{onClick:l,className:"-ml-2 mb-1 flex h-8 items-center gap-1 px-2 text-sm font-semibold",style:{color:t.textMuted},"aria-label":"Zurück",children:[e.jsx(ke,{size:14})," Zurück"]}),e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",style:{color:t.text,fontFamily:"Fraunces, serif"},children:s==="add"?"Eintrag erfassen":"Eintrag bearbeiten"})]}),e.jsxs("div",{className:"flex gap-2 p-1 rounded-full",style:{background:t.surface,border:`1px solid ${t.border}`},children:[e.jsx("button",{onClick:()=>h({...m,isIncome:!1}),className:"flex-1 py-2 rounded-full text-sm font-semibold",style:{background:m.isIncome?"transparent":t.brand,color:m.isIncome?t.textMuted:"#fff"},children:"Ausgabe"}),e.jsx("button",{onClick:()=>h({...m,isIncome:!0}),className:"flex-1 py-2 rounded-full text-sm font-semibold",style:{background:m.isIncome?t.brand:"transparent",color:m.isIncome?"#fff":t.textMuted},children:"Einnahme"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(L,{t,label:"Beschreibung",value:m.title,onChange:g=>h({...m,title:g.target.value}),placeholder:"z. B. REWE Einkauf"}),e.jsx(L,{t,label:"Betrag",suffix:"€",type:"number",inputMode:"decimal",value:m.amount,onChange:g=>h({...m,amount:g.target.value}),placeholder:"0,00"}),e.jsx(L,{t,label:"Datum",type:"date",value:m.date,onChange:g=>h({...m,date:g.target.value})}),!m.isIncome&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[13px] uppercase tracking-wider font-semibold",style:{color:t.textSoft},children:"Kategorie"}),e.jsx("div",{className:"mt-1.5 flex flex-wrap gap-2",children:Br.map(g=>e.jsx("button",{onClick:()=>h({...m,category:g}),className:"rounded-full px-3.5 py-1.5 text-sm font-medium",style:{background:m.category===g?t.brand:t.surface,color:m.category===g?"#fff":t.text,border:`1px solid ${m.category===g?t.brand:t.border}`},children:g},g))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[13px] uppercase tracking-wider font-semibold",style:{color:t.textSoft},children:"Bewertung"}),e.jsx("div",{className:"mt-1.5 grid grid-cols-3 gap-2",children:[{id:"neutral",label:"Neutral",tone:{bg:t.surface,fg:t.text,border:t.border}},{id:"wertvoll",label:"Wertvoll",tone:{bg:t.brandSoft,fg:t.brand,border:t.brand}},{id:"impuls",label:"Impuls",tone:{bg:t.dangerSoft,fg:t.danger,border:t.danger}}].map(g=>{const j=m.tag===g.id;return e.jsx("button",{onClick:()=>h({...m,tag:g.id}),className:"rounded-xl py-2 text-sm font-semibold transition",style:{background:j?g.tone.bg:t.surface,color:j?g.tone.fg:t.textMuted,border:`1px solid ${j?g.tone.border:t.border}`},children:g.label},g.id)})}),e.jsx("div",{className:"mt-1 text-[12px] leading-relaxed",style:{color:t.textSoft},children:"Wertvoll = bewusst und passend zu deinen Werten. Impuls = später bereut, hat dir nicht gedient."})]})]}),e.jsx(L,{t,label:"Produkt-Link",hint:"(optional)",value:m.url,onChange:g=>h({...m,url:g.target.value}),placeholder:"https://...",type:"url",inputMode:"url"})]}),!m.isIncome&&x.reasons.length>0&&e.jsx("div",{className:"rounded-2xl p-4",style:{background:x.blocked?t.dangerSoft:t.warnSoft},children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(ft,{size:18,style:{color:x.blocked?t.danger:t.warn,flexShrink:0,marginTop:2}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium",style:{color:t.text},children:x.blocked?"Stress-Modus ist aktiv":"Eine deiner Schutzregeln greift gerade"}),e.jsx("ul",{className:"mt-1.5 space-y-0.5 text-sm leading-relaxed",style:{color:t.textMuted},children:x.reasons.map(g=>e.jsxs("li",{className:"flex items-start gap-1.5",children:[e.jsx("span",{style:{color:x.blocked?t.danger:t.warn},children:"•"}),e.jsx("span",{children:g})]},g))})]})]})}),s==="add"&&!m.isIncome&&b&&d&&e.jsx("div",{className:"rounded-2xl p-4",style:{background:t.brandSoft},children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(le,{size:18,style:{color:t.brand,flexShrink:0,marginTop:2}}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:t.text},children:"Lieber bewusst entscheiden?"}),e.jsx("div",{className:"mt-0.5 text-[13px] leading-relaxed",style:{color:t.textMuted},children:"Den Denkzettel-Check durchlaufen statt direkt zu erfassen — deine Werte werden übernommen."}),e.jsx("button",{onClick:()=>d(m),className:"mt-2 w-full rounded-xl py-2 text-sm font-semibold",style:{background:t.brand,color:"#fff"},children:"Stattdessen prüfen →"})]})]})}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx(ve,{t,onClick:l,children:"Abbrechen"}),e.jsx(O,{t,onClick:f,disabled:!b,children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(te,{size:14})," ",s==="add"?"Hinzufügen":"Speichern"]})})]}),s==="edit"&&c&&e.jsxs("button",{onClick:c,className:"flex w-full items-center justify-center gap-1.5 rounded-2xl py-3 text-sm font-semibold",style:{background:t.dangerSoft,color:t.danger},children:[e.jsx(V,{size:14})," Eintrag löschen"]})]})}const Ct={"tech-threshold":"Technik-Schwelle","late-night":"Spätstunden-Block","shop-monthly-limit":"Shop-Monatslimit","category-flag":"Kategorie-Flag","stress-mode":"Stress-Modus",custom:"Notiz"}
356,ct={"tech-threshold":"Bei Technik-Anschaffungen ab einer Preis-Schwelle (€) wird im Check ein Score-Punkt addiert — du wirst eher zur Wartezeit geleitet.","late-night":"Zwischen Start- und End-Stunde (Standard 22–6 Uhr) bekommen Käufe +2 Score — verhindert Müdigkeits-Spontankäufe.","shop-monthly-limit":"Wenn der Shop-Name übereinstimmt UND dein Monatsausgaben bei diesem Shop plus dem aktuellen Preis das Limit übersteigen, wird +2 Score addiert.","category-flag":'Käufe in der gewählten Kategorie bekommen +1 Score plus einen kontextuellen Hinweis (z. B. „Schrank prüfen" bei Kleidung).',"stress-mode":'Wenn aktiv: erzwingt für JEDEN Kauf die Entscheidung „Verwerfen". Aktiviere ihn an stressigen Tagen.',custom:"Reine Notiz — wird im Denkzettel-Check NICHT automatisch angewendet. Hilft dir nur, deine Prinzipien sichtbar zu halten."},js=[{kind:"tech-threshold",name:"Technik-Schwelle",fields:[{key:"threshold",label:"Preis-Schwelle (€)",type:"number",placeholder:"100",default:100,min:1,max:1e5}],buildDesc:t=>`Score +1 ab ${t.threshold}€ (nur Technik)`},{kind:"late-night",name:"Spätstunden-Block",fields:[{key:"startHour",label:"Ab Uhrzeit (0–23)",type:"number",placeholder:"22",default:22,min:0,max:23},{key:"endHour",label:"Bis Uhrzeit (0–23)",type:"number",placeholder:"6",default:6,min:0,max:23}],buildDesc:t=>`Score +2 zwischen ${t.startHour}–${t.endHour} Uhr`},{kind:"shop-monthly-limit",name:"Shop-Monatslimit",fields:[{key:"shop",label:"Shop-Name",type:"text",placeholder:"Amazon",default:""},{key:"limit",label:"Limit (€)",type:"number",placeholder:"150",default:150,min:1,max:1e5}],buildDesc:t=>`${t.limit}€ pro Monat bei ${t.shop}`},{kind:"category-flag",name:"Kategorie-Flag",fields:[{key:"category",label:"Kategorie",type:"text",placeholder:"Kleidung",default:""}],buildDesc:t=>`Score +1 in Kategorie ${t.category}`},{kind:"stress-mode",name:"Stress-Modus",fields:[],buildDesc:()=>'Erzwingt „Verwerfen" für jeden Kauf'},{kind:"custom",name:"Eigene Notiz (ohne Auto-Effekt)",fields:[{key:"__name",label:"Name",type:"text",placeholder:"z. B. Bücher-Limit",default:""},{key:"__desc",label:"Beschreibung",type:"text",placeholder:"z. B. 30 € pro Monat",default:""}],buildDesc:()=>null}];function Kr({t,store:s,onBack:n}){const{state:a,actions:r}=s,[l,i]=o.useState({type:"list"}),c=()=>i({type:"list"});return l.type==="info"?e.jsx(Hr,{t,rule:l.rule,onBack:c}):l.type==="edit"?e.jsx(Gr,{t,rule:l.rule,onBack:c,onSave:d=>{r.updateRule(l.rule.id,d),c()}}):l.type==="add"?e.jsx(_r,{t,onBack:c,onAdd:d=>{r.addRule(d),c()}}):e.jsxs("div",{className:"space-y-4 pb-28",children:[e.jsxs("div",{className:"px-1 pt-2",children:[n&&e.jsxs("button",{onClick:n,className:"-ml-2 mb-1 flex h-8 items-center gap-1 px-2 text-sm font-semibold",style:{color:t.textMuted},"aria-label":"Zurück",children:[e.jsx(ke,{size:14})," Zurück"]}),e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Regeln"}),e.jsx("p",{className:"mt-1 text-sm",style:{color:t.textMuted},children:"Dein persönliches Schutzsystem. Aktive Regeln beeinflussen den Check automatisch."})]}),e.jsx(R,{t,padding:"p-2",children:a.rules.map((d,p)=>e.jsx(Or,{t,rule:d,isLast:p===a.rules.length-1,onToggle:()=>r.toggleRule(d.id),onDelete:()=>r.deleteRule(d.id),onInfo:()=>i({type:"info",rule:d}),onEdit:()=>i({type:"edit",rule:d})},d.id))}),e.jsxs("button",{onClick:()=>i({type:"add"}),className:"flex w-full items-center justify-center gap-2 rounded-2xl py-3.5 text-sm font-semibold",style:{background:t.surface,border:`1px dashed ${t.border}`,color:t.text},children:[e.jsx(Ve,{size:16})," Neue Regel aus Vorlage"]})]})}function Or({t,rule:s,isLast:n,onToggle:a,onDelete:r,onInfo:l,onEdit:i}){const[c,d]=o.useState(!1),p=s.kind!=="stress-mode",u="flex h-8 items-center gap-1.5 rounded-lg px-2.5 text-[13px] font-medium";return e.jsxs("div",{className:"p-4",style:{borderBottom:n?"none":`1px solid ${t.border}`},children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl",style:{background:s.active?t.brandSoft:`${t.text}08`},children:e.jsx(mt,{size:18,style:{color:s.active?t.brand:t.textSoft}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:t.text},children:s.name}),e.jsxs("div",{className:"text-[13px]",style:{color:t.textMuted},children:[s.desc," · ",s.triggered||0,"× ausgelöst"]}),e.jsx("div",{className:"mt-0.5 text-[12px] uppercase tracking-wider font-semibold",style:{color:t.textSoft},children:Ct[s.kind]||"Regel"})]}),e.jsx("button",{onClick:a,className:"relative h-6 w-11 shrink-0 rounded-full transition",style:{background:s.active?t.brand:`${t.text}15`},"aria-label":s.active?"Regel deaktivieren":"Regel aktivieren",children:e.jsx(T.div,{className:"absolute top-0.5 h-5 w-5 rounded-full bg-white shadow",animate:{left:s.active?22:2},transition:{type:"spring",stiffness:500,damping:30}})})]}),e.jsx("div",{className:"mt-2.5 flex items-center justify-end gap-1.5",children:c?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-auto text-[13px]",style:{color:t.textMuted},children:"Regel wirklich löschen?"}),e.jsxs("button",{onClick:()=>d(!1),className:u,style:{background:`${t.text}08`,color:t.textMuted},children:[e.jsx(U,{size:13})," Abbrechen"]}),e.jsxs("button",{onClick:r,className:u,style:{background:t.danger,color:"#fff"},children:[e.jsx(V,{size:13})," Löschen"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:l,className:u,style:{background:`${t.text}06`,color:t.textMuted},children:[e.jsx(Xt,{size:13})," Info"]}),p&&e.jsxs("button",{onClick:i,className:u,style:{background:`${t.text}06`,color:t.textMuted},children:[e.jsx(Re,{size:13})," Bearbeiten"]}),e.jsx("button",{onClick:()=>d(!0),className:"flex h-8 w-8 items-center justify-center rounded-lg",style:{background:`${t.text}06`,color:t.textSoft},"aria-label":"Löschen",children:e.jsx(V,{size:14})})]})})]})}function Mt({t,onBack:s,title:n}){return e.jsxs("div",{className:"px-1 pt-2",children:[e.jsxs("button",{onClick:s,className:"-ml-2 mb-1 flex h-8 items-center gap-1 px-2 text-sm font-semibold",style:{color:t.textMuted},"aria-label":"Zurück",children:[e.jsx(ke,{size:14})," Zurück"]}),e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",style:{color:t.text,fontFamily:"Fraunces, serif"},children:n})]})}function Hr({t,rule:s,onBack:n}){const a=ct[s.kind]||"Keine Beschreibung verfügbar.";return e.jsxs(T.div,{initial:{opacity:0,x:20}
356,animate:{opacity:1,x:0},transition:{duration:.2},className:"space-y-4 pb-28",children:[e.jsx(Mt,{t,onBack:n,title:s.name}),e.jsxs("div",{className:"rounded-2xl p-4",style:{background:t.brandSoft},children:[e.jsxs("div",{className:"text-[12px] uppercase tracking-wider font-semibold",style:{color:t.brand},children:["Typ: ",Ct[s.kind]||"Regel"]}),e.jsx("div",{className:"mt-2 text-sm leading-relaxed",style:{color:t.text},children:a})]}),s.params&&Object.keys(s.params).length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 px-1 text-[12px] uppercase tracking-wider font-semibold",style:{color:t.textSoft},children:"Parameter"}),e.jsx(R,{t,padding:"p-4",children:e.jsx("div",{className:"space-y-1.5 text-sm",children:Object.entries(s.params).map(([r,l])=>e.jsxs("div",{className:"flex justify-between gap-3",children:[e.jsx("span",{style:{color:t.textMuted},children:r}),e.jsx("span",{style:{color:t.text,fontWeight:600},children:String(l)})]},r))})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 px-1 text-[12px] uppercase tracking-wider font-semibold",style:{color:t.textSoft},children:"Status"}),e.jsx(R,{t,padding:"p-4",children:e.jsxs("div",{className:"space-y-1.5 text-sm",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:t.textMuted},children:"Status"}),e.jsx("span",{style:{color:s.active?t.brand:t.textSoft,fontWeight:600},children:s.active?"Aktiv":"Inaktiv"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:t.textMuted},children:"Bereits ausgelöst"}),e.jsxs("span",{style:{color:t.text,fontWeight:600},children:[s.triggered||0,"×"]})]})]})})]})]})}function Gr({t,rule:s,onBack:n,onSave:a}){const r=js.find(x=>x.kind===s.kind),l=s.kind==="custom",[i,c]=o.useState(s.name||""),[d,p]=o.useState(s.desc||""),[u,m]=o.useState(()=>{if(l||!r)return{};const x={};for(const f of r.fields)x[f.key]=s.params?.[f.key]??f.default;return x}),h=i.trim().length>0&&(l||!r?!0:r.fields.every(x=>{const f=u[x.key];if(x.type==="number"){const g=typeof f=="number"?f:parseFloat(String(f));return!(isNaN(g)||x.min!==void 0&&g<x.min||x.max!==void 0&&g>x.max)}return f!=null&&String(f).trim().length>0})),b=()=>{if(l||!r){a({name:i.trim(),desc:d.trim()||"Eigene Notiz"});return}const x={};for(const f of r.fields){const g=u[f.key];x[f.key]=f.type==="number"?parseFloat(String(g)):String(g).trim()}a({name:i.trim(),desc:r.buildDesc(x)||s.desc,params:x})};return e.jsxs(T.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{duration:.2},className:"space-y-4 pb-28",children:[e.jsx(Mt,{t,onBack:n,title:"Regel bearbeiten"}),e.jsx(R,{t,padding:"p-3",children:e.jsxs("div",{className:"text-[13px] leading-relaxed",style:{color:t.textMuted},children:[e.jsx("span",{style:{color:t.textSoft},children:"Typ:"})," ",e.jsx("span",{style:{color:t.text,fontWeight:600},children:Ct[s.kind]||"Regel"})]})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(L,{t,label:"Name",value:i,onChange:x=>c(x.target.value),placeholder:"z. B. Technik > 200€"}),l&&e.jsx(L,{t,label:"Beschreibung",value:d,onChange:x=>p(x.target.value),placeholder:"z. B. 30 € pro Monat"}),!l&&r&&r.fields.map(x=>e.jsx(L,{t,label:x.label,type:x.type,inputMode:x.type==="number"?"decimal":void 0,placeholder:x.placeholder,value:u[x.key]??"",onChange:f=>m({...u,[x.key]:x.type==="number"?f.target.value===""?"":parseFloat(f.target.value):f.target.value})},x.key))]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ve,{t,onClick:n,children:"Abbrechen"}),e.jsx(O,{t,onClick:b,disabled:!h,children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(te,{size:14})," Speichern"]})})]})]})}function _r({t,onBack:s,onAdd:n}){const[a,r]=o.useState(0),[l,i]=o.useState(null),[c,d]=o.useState({}),p=b=>{i(b);const x={};for(const f of b.fields)x[f.key]=f.default;d(x),r(1)},u=l!=null&&l.fields.every(b=>{const x=c[b.key];if(b.type==="number"){const f=typeof x=="number"?x:parseFloat(String(x));return!(isNaN(f)||b.min!==void 0&&f<b.min||b.max!==void 0&&f>b.max)}return x!=null&&String(x).trim().length>0}),m=()=>{if(!l)return;
356if(l.kind==="custom"){n({kind:"custom",name:String(c.__name),desc:String(c.__desc)||"Eigene Notiz",params:{}});return}const b={};for(const f of l.fields){const g=c[f.key];b[f.key]=f.type==="number"?parseFloat(String(g)):String(g).trim()}const x=`${l.name}${b.shop?`: ${b.shop}`:b.category?`: ${b.category}`:""}`;n({kind:l.kind,name:x,desc:l.buildDesc(b)||"",params:b})},h=()=>{a===1?(r(0),i(null)):s()};return e.jsxs(T.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{duration:.2},className:"space-y-4 pb-28",children:[e.jsx(Mt,{t,onBack:h,title:a===0?"Vorlage wählen":l?.name||"Regel"}),a===0&&e.jsx("div",{className:"space-y-2",children:js.map(b=>e.jsxs("button",{onClick:()=>p(b),className:"flex w-full items-center gap-3 rounded-2xl p-4 text-left transition active:scale-[0.99]",style:{background:t.surface,border:`1px solid ${t.border}`},children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:t.text},children:b.name}),e.jsx("div",{className:"mt-0.5 text-[13px] leading-relaxed",style:{color:t.textMuted},children:ct[b.kind]})]}),e.jsx(ae,{size:18,style:{color:t.textSoft}})]},b.kind))}),a===1&&l&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(R,{t,padding:"p-3",children:e.jsx("div",{className:"text-[13px] leading-relaxed",style:{color:t.textMuted},children:ct[l.kind]})}),l.fields.map(b=>e.jsx(L,{t,label:b.label,type:b.type,inputMode:b.type==="number"?"decimal":void 0,placeholder:b.placeholder,value:c[b.key]??"",onChange:x=>d({...c,[b.key]:b.type==="number"?x.target.value===""?"":parseFloat(x.target.value):x.target.value})},b.key)),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx(ve,{t,onClick:()=>{r(0),i(null)},children:"Vorlage wechseln"}),e.jsx(O,{t,onClick:m,disabled:!u,children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(te,{size:14})," Hinzufügen"]})})]})]})]})}function Vr({t,store:s}){const{state:n,actions:a}=s,[r,l]=o.useState(!1),[i,c]=o.useState(null),[d,p]=o.useState(null);return e.jsxs("div",{className:"space-y-4 pb-28",children:[e.jsxs("div",{className:"px-1 pt-2",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Ziele"}),e.jsx("p",{className:"mt-1 text-sm",style:{color:t.textMuted},children:"Wofür sparst du? Was willst du erreichen?"})]}),n.goals.length===0?e.jsx(R,{t,padding:"p-8",children:e.jsxs("div",{className:"text-center",children:[e.jsx(We,{size:32,style:{color:t.textSoft,margin:"0 auto"}}),e.jsx("div",{className:"mt-2 text-sm font-medium",style:{color:t.text},children:"Noch keine Ziele"}),e.jsx("div",{className:"text-sm mt-1",style:{color:t.textMuted},children:"Lege ein Ziel an, um deine Fortschritte zu sehen."})]})}):e.jsx("div",{className:"space-y-3",children:n.goals.map(u=>{const m=u.target>0?Math.round(u.current/u.target*100):0;return e.jsxs(R,{t,padding:"p-5",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-base font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:u.title}),u.deadline&&e.jsxs("div",{className:"text-[13px] mt-0.5",style:{color:t.textMuted},children:["bis ",u.deadline]})]}),d===u.id?e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx("button",{onClick:()=>p(null),className:"flex h-7 w-7 items-center justify-center rounded-md",style:{background:`${t.text}08`,color:t.textMuted},"aria-label":"Abbrechen",children:e.jsx(U,{size:12})}),e.jsx("button",{onClick:()=>{a.deleteGoal(u.id),p(null)},className:"flex h-7 w-7 items-center justify-center rounded-md",style:{background:t.danger,color:"#fff"},"aria-label":"Endgültig löschen",children:e.jsx(V,{size:12})})]}):e.jsx("button",{onClick:()=>p(u.id),style:{color:t.textSoft},"aria-label":"Ziel löschen",children:e.jsx(V,{size:14})})]}),e.jsxs("div",{className:"mt-3 flex items-baseline justify-between",children:[e.jsxs("span",{className:"text-2xl font-semibold",style:{color:t.brand,fontFamily:"Fraunces, serif"}
356,children:[u.current.toLocaleString("de-DE")," €"]}),e.jsxs("span",{className:"text-sm",style:{color:t.textMuted},children:["von ",u.target.toLocaleString("de-DE")," €"]})]}),e.jsx("div",{className:"mt-2",children:e.jsx(ot,{value:m,t})}),e.jsxs("div",{className:"mt-1 flex justify-between text-[12px]",style:{color:t.textSoft},children:[e.jsxs("span",{children:[m,"%"]}),e.jsxs("span",{children:["noch ",Math.max(0,u.target-u.current).toLocaleString("de-DE")," €"]})]}),e.jsxs("button",{onClick:()=>c(u.id),className:"mt-4 w-full flex items-center justify-center gap-2 rounded-xl py-2.5 text-sm font-semibold",style:{background:t.brandSoft,color:t.brand},children:[e.jsx(Ls,{size:16})," Einzahlung erfassen"]})]},u.id)})}),e.jsxs("button",{onClick:()=>l(!0),className:"flex w-full items-center justify-center gap-2 rounded-2xl py-3.5 text-sm font-semibold",style:{background:t.surface,border:`1px dashed ${t.border}`,color:t.text},children:[e.jsx(Ve,{size:16})," Neues Ziel"]}),e.jsxs(ee,{children:[r&&e.jsx(Ur,{t,onClose:()=>l(!1),onAdd:a.addGoal}),i&&e.jsx(qr,{t,goal:n.goals.find(u=>u.id===i)??null,onClose:()=>c(null),onDeposit:u=>{a.depositToGoal(i,u),c(null)}})]})]})}function Ur({t,onClose:s,onAdd:n}){const[a,r]=o.useState({title:"",target:"",deadline:""}),l=()=>{!a.title||!a.target||(n({title:a.title,target:parseFloat(a.target),deadline:a.deadline}),s())};return e.jsxs(ks,{t,onClose:s,title:"Neues Ziel",children:[e.jsx(L,{t,label:"Titel",value:a.title,onChange:i=>r({...a,title:i.target.value}),placeholder:"z. B. Notgroschen"}),e.jsx(L,{t,label:"Zielbetrag",suffix:"€",type:"number",inputMode:"decimal",value:a.target,onChange:i=>r({...a,target:i.target.value}),placeholder:"10000"}),e.jsx(L,{t,label:"Deadline",hint:"(optional)",value:a.deadline,onChange:i=>r({...a,deadline:i.target.value}),placeholder:"z. B. Dez 2026"}),e.jsx(O,{t,onClick:l,disabled:!a.title||!a.target,children:"Ziel anlegen"})]})}function qr({t,goal:s,onClose:n,onDeposit:a}){const[r,l]=o.useState("");return s?e.jsxs(ks,{t,onClose:n,title:`Einzahlen → ${s.title}`,children:[e.jsx(L,{t,label:"Betrag",suffix:"€",type:"number",inputMode:"decimal",value:r,onChange:i=>l(i.target.value),placeholder:"100",autoFocus:!0}),e.jsx(O,{t,onClick:()=>a(parseFloat(r)),disabled:!r||parseFloat(r)<=0,children:"Einzahlen"})]}):null}function ks({t,onClose:s,title:n,children:a}){const r=o.useRef(null);return o.useEffect(()=>{const l=document.activeElement;r.current?.focus();const i=c=>{c.key==="Escape"&&s()};return document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i),l?.focus()}},[s]),e.jsx(T.div,{initial:{opacity:0}
356,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-end md:items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:s,children:e.jsxs(T.div,{initial:{y:40},animate:{y:0},exit:{y:40},transition:{duration:.3,ease:[.16,1,.3,1]},onClick:l=>l.stopPropagation(),className:"w-full max-w-[420px] rounded-t-3xl md:rounded-3xl p-5 pb-8 space-y-4 max-h-[80vh] overflow-y-auto",style:{background:t.bg},role:"dialog","aria-modal":"true","aria-label":n,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-xl font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:n}),e.jsx("button",{ref:r,onClick:s,style:{color:t.textMuted},"aria-label":"Schließen",children:e.jsx(U,{size:20})})]}),a]})})}const Zr="[email protected]";function vs(t){return!!t&&t.toLowerCase()===Zr.toLowerCase()}async function Jr(t){const s=await Q();if(!s)return{ok:!1,error:"Sync ist nicht konfiguriert."};const{data:n,error:a}=await s.functions.invoke("broadcast",{body:t});return a?{ok:!1,error:a.message}:n?.error?{ok:!1,error:String(n.error)}:{ok:!0,sent:Number(n?.sent)||0,recipients:Number(n?.recipients)||0}}function Yr(t){if(!t)return"";const s=Math.max(0,Date.now()-t);if(s<6e4)return"gerade eben";const n=Math.round(s/6e4);return n<60?`vor ${n} min`:`vor ${Math.round(n/60)} h`}function Qr({t,sync:s}){const[n,a]=o.useState("login"),[r,l]=o.useState(""),[i,c]=o.useState(""),[d,p]=o.useState(""),[u,m]=o.useState(!1),[h,b]=o.useState(!1),[x,f]=o.useState(null);if(o.useEffect(()=>{if(!x)return;const F=setTimeout(()=>f(null),6e3);return()=>clearTimeout(F)},[x]),!s.enabled)return null;const{auth:g}=s,j=g.passwordRecovery,M=!!g.user,W=async()=>{if(!r||i.length<6){f({type:"error",text:"E-Mail und Passwort (min. 6 Zeichen) nötig."});return}m(!0),f(null);const F=n==="register"?await g.signUp(r,i):await g.signIn(r,i);m(!1),F.error?f({type:"error",text:F.error}):n==="register"?(await s.setMarketingConsent(h),f({type:"ok",text:"Fast geschafft — bitte E-Mail bestätigen."})):c("")},z=async()=>{if(!r){f({type:"error",text:"Bitte E-Mail eingeben."});return}m(!0),f(null);const F=await g.resetPassword(r);m(!1),f(F.error?{type:"error",text:F.error}:{type:"ok",text:"Reset-Link gesendet — schau in dein Postfach."})},D=async()=>{if(d.length<6){f({type:"error",text:"Neues Passwort: min. 6 Zeichen."});return}m(!0),f(null);const F=await g.updatePassword(d);m(!1),p(""),f(F.error?{type:"error",text:F.error}:{type:"ok",text:"Passwort aktualisiert."})},I=async()=>{m(!0);const F=await s.enablePushNotifications();m(!1),f(F?{type:"ok",text:"Benachrichtigungen aktiv — auch bei geschlossener App."}:{type:"error",text:"Benachrichtigungen konnten nicht aktiviert werden."})};return e.jsxs(R,{t,padding:"p-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl",style:{background:t.brandSoft},children:M?e.jsx(Zt,{size:18,style:{color:t.brand}}):e.jsx(Ks,{size:18,style:{color:t.textSoft}})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[15px] font-semibold",style:{color:t.text},children:"Konto & Sync"}),e.jsx("div",{className:"truncate text-[13px]",style:{color:t.textMuted},children:M?g.user?.email:"Geräte synchronisieren & Erinnerungen erhalten"})]})]}),j&&e.jsxs("div",{className:"mt-4 space-y-2",children:[e.jsx("p",{className:"text-[13px]",style:{color:t.textMuted},children:"Wähle ein neues Passwort für dein Konto."}),e.jsx(Lt,{t,autoComplete:"new-password",placeholder:"Neues Passwort",value:d,onChange:F=>p(F.target.value)}),e.jsxs(O,{t,onClick:D,disabled:u,children:[u?e.jsx(me,{size:16,className:"animate-spin"}):null,"Passwort speichern"]})]}),!M&&!j&&n!=="forgot"&&e.jsxs("div",{className:"mt-4 space-y-2",children:[e.jsx(L,{t,type:"email",autoComplete:"email",placeholder:"E-Mail",value:r,onChange:F=>l(F.target.value)}),e.jsx(Lt,{t,autoComplete:n==="register"?"new-password":"current-password",placeholder:"Passwort",value:i,onChange:F=>c(F.target.value)}),n==="register"&&e.jsxs("button",{type:"button",onClick:()=>b(F=>!F),className:"flex items-start gap-2.5 pt-1 text-left",children:[e.jsx("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded",style:{background:h?t.brand:"transparent",border:`1.5px solid ${h?t.brand:t.border}`},children:h&&e.jsx(te,{size:12,color:"#fff",strokeWidth:3})}),e.jsxs("span",{className:"text-[12px] leading-relaxed",style:{color:t.textMuted},children:["Schick mir ab und zu Tipps & Aktionen — z. B. eine"," ",e.jsx("span",{style:{color:t.text},children:'„No-Spend-Monat"-Challenge'})," oder ausgewählte Spar-Deals. Hilft beim Dranbleiben, ",e.jsx("span",{style:{color:t.text},children:"jederzeit abschaltbar"}),"."]})]}),e.jsxs(O,{t,onClick:W,disabled:u||!g.ready,children:[u?e.jsx(me,{size:16,className:"animate-spin"}):null,n==="register"?"Konto erstellen":"Anmelden"]}),e.jsxs("div",{className:"flex items-center justify-between pt-1 text-[13px] font-medium",children:[e.jsx("button",{onClick:()=>{a(n==="login"?"register":"login"),f(null)},style:{color:t.textMuted},children:n==="login"?"Noch kein Konto? Registrieren":"Schon ein Konto? Anmelden"}),n==="login"&&e.jsx("button",{onClick:()=>{a("forgot"),f(null)},style:{color:t.textSoft},children:"Passwort vergessen?"})]})]}),!M&&!j&&n==="forgot"&&e.jsxs("div",{className:"mt-4 space-y-2",children:[e.jsx("p",{className:"text-[13px]",style:{color:t.textMuted},children:"Wir senden dir einen Link zum Zurücksetzen."}),e.jsx(L,{t,type:"email",autoComplete:"email",placeholder:"E-Mail",value:r,onChange:F=>l(F.target.value)}),e.jsxs(O,{t,onClick:z,disabled:u,children:[u?e.jsx(me,{size:16,className:"animate-spin"}):null,"Reset-Link senden"]}),e.jsx("button",{onClick:()=>{a("login"),f(null)},className:"w-full pt-1 text-center text-[13px] font-medium",style:{color:t.textMuted},children:"Zurück zur Anmeldung"})]}),M&&!j&&e.jsxs("div",{className:"mt-4 space-y-2",children:[e.jsx("div",{className:"flex items-center gap-2 text-[13px]",style:{color:t.textMuted},children:s.status==="syncing"?e.jsxs(e.Fragment,{children:[e.jsx(me,{size:13,className:"animate-spin"})," Synchronisiere …"]}):s.status==="error"?e.jsxs(e.Fragment,{children:[e.jsx(Ps,{size:13,style:{color:t.danger}})," Nicht synchronisiert — Verbindung prüfen"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ws,{size:13,style:{color:t.brand}})," Synchronisiert ",Yr(s.lastSyncedAt)]})}),s.pushSupported&&!s.pushEnabled&&e.jsxs("button",{onClick:I,disabled:u,className:"flex w-full items-center justify-center gap-2 rounded-2xl py-3 text-sm font-semibold transition disabled:opacity-50 active:scale-[0.99]",style:{background:t.brandSoft,color:t.brand},children:[e.jsx(Is,{size:15})," Erinnerungen auf dieses Gerät"]}),e.jsxs("button",{type:"button",onClick:async()=>{const F=await s.setMarketingConsent(!s.marketingConsent);f(F?null:{type:"error",text:"Einstellung konnte nicht gespeichert werden — bitte später erneut."})},className:"flex w-full items-center gap-2.5 rounded-2xl px-3 py-3 text-left transition active:scale-[0.99]",style:{border:`1px solid ${t.border}`},children:[e.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded",style:{background:s.marketingConsent?t.brand:"transparent",border:`1.5px solid ${s.marketingConsent?t.brand:t.border}`},children:s.marketingConsent&&e.jsx(te,{size:12,color:"#fff",strokeWidth:3})}),e.jsxs("span",{className:"flex-1 text-[13px]",style:{color:t.textMuted},children:["Tipps & Aktionen erhalten ",e.jsx("span",{style:{color:t.textSoft},children:"(z. B. Challenges)"})]})]}),e.jsxs("button",{onClick:()=>g.signOut(),className:"flex w-full items-center justify-center gap-2 rounded-2xl py-3 text-sm font-semibold transition active:scale-[0.99]",style:{background:"transparent",border:`1px solid ${t.border}`,color:t.textMuted},children:[e.jsx(qs,{size:15})," Abmelden"]}),x&&e.jsx("p",{className:"pt-1 text-center text-[13px]",style:{color:x.type==="error"?t.danger:t.brand},children:x.text})]}),!M&&x&&e.jsx("p",{className:"pt-3 text-center text-[13px]",style:{color:x.type==="error"?t.danger:t.brand},children:x.text})]})}function Xr({t,store:s,sync:n,onOpenRules:a,onOpenMode:r,onOpenImpressum:l,onOpenDatenschutz:i}){const{state:c,actions:d}=s,p=o.useRef(null),[u,m]=o.useState(!1),[h,b]=o.useState({...c.profile}),[x,f]=o.useState(!1),[g,j]=o.useState(!1),[M,W]=o.useState(!1),[z,D]=o.use
356State(!1),[I,F]=o.useState(null),J=(c.profile.name||"Du").split(" ").map($=>$[0]).join("").slice(0,2).toUpperCase(),ne=async $=>{try{const H=await dn($);d.replaceState(H),F({type:"success",text:"Daten erfolgreich importiert."})}catch(H){F({type:"error",text:"Import fehlgeschlagen: "+H.message})}setTimeout(()=>F(null),4e3)},B=()=>{d.updateProfile({name:h.name,monthlyBudget:h.monthlyBudget}),m(!1),F({type:"success",text:"Profil aktualisiert."}),setTimeout(()=>F(null),3e3)};return e.jsxs("div",{className:"space-y-4 pb-28",children:[e.jsx("h1",{className:"px-1 pt-2 text-2xl font-semibold tracking-tight",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Profil"}),I&&e.jsx("div",{className:"rounded-xl px-4 py-3 text-sm",style:{background:I.type==="error"?t.dangerSoft:t.brandSoft,color:I.type==="error"?t.danger:t.brand},children:I.text}),e.jsxs(R,{t,padding:"p-5",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-full text-lg font-semibold",style:{background:t.brand,color:"#fff",fontFamily:"Fraunces, serif"},children:J}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-base font-semibold",style:{color:t.text},children:c.profile.name||"Du"}),e.jsx("div",{className:"mt-0.5 text-sm",style:{color:t.textMuted},children:je(c.profile.mode).short}),e.jsxs("button",{onClick:r,className:"mt-1.5 inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[12px] font-semibold uppercase tracking-wider",style:{background:t.goldSoft,color:t.gold},"aria-label":"Modus öffnen",children:["Modus: ",c.profile.mode,e.jsx(ae,{size:11})]})]}),e.jsx("button",{onClick:()=>m(!u),className:"flex h-8 w-8 items-center justify-center rounded-full",style:{background:u?t.brand:`${t.text}08`,color:u?"#fff":t.textMuted},children:e.jsx(Re,{size:14})})]}),u&&e.jsxs("div",{className:"mt-4 space-y-3 pt-4 border-t",style:{borderColor:t.border},children:[e.jsx(L,{t,label:"Name",value:h.name,onChange:$=>b({...h,name:$.target.value})}),e.jsx(L,{t,label:"Monatsbudget",hint:"(optional)",suffix:"€",type:"number",inputMode:"decimal",value:h.monthlyBudget||"",onChange:$=>b({...h,monthlyBudget:parseFloat($.target.value)||0}),placeholder:"z. B. 2000"}),e.jsxs("div",{className:"rounded-xl p-3 text-[13px] leading-relaxed",style:{background:t.surface,border:`1px solid ${t.border}`,color:t.textMuted},children:["Den"," ",e.jsx("span",{style:{color:t.text,fontWeight:600},children:"Modus"})," änderst du über die Pille oben — dort siehst du auch die jeweilige Beschreibung."]}),e.jsx(O,{t,onClick:B,children:"Speichern"})]})]}),e.jsx(R,{t,padding:"p-2",children:e.jsxs("button",{onClick:a,className:"flex w-full items-center gap-3 p-4 text-left",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl",style:{background:t.brandSoft,color:t.brand},children:e.jsx(mt,{size:18})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:t.text},children:"Regeln verwalten"}),e.jsxs("div",{className:"text-[13px]",style:{color:t.textMuted},children:[c.rules.filter($=>$.active).length," von ",c.rules.length," aktiv · Schutzsystem für deinen Check"]})]}),e.jsx(ae,{size:18,style:{color:t.textSoft}})]})}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs(R,{t,padding:"p-3",children:[e.jsx("div",{className:"text-[12px] uppercase tracking-wider",style:{color:t.textSoft},children:"Vermieden"}),e.jsxs("div",{className:"mt-1 text-lg font-semibold",style:{color:t.brand,fontFamily:"Fraunces, serif"},children:[c.stats.avoidedTotal.toFixed(0)," €"]})]}),e.jsxs(R,{t,padding:"p-3",children:[e.jsx("div",{className:"text-[12px] uppercase tracking-wider",style:{color:t.textSoft},children:"Impuls"}),e.jsx("div",{className:"mt-1 text-lg font-semibold",style:{color:t.danger,fontFamily:"Fraunces, serif"},children:c.stats.impulseCount})]}),e.jsxs(R,{t,padding:"p-3",children:[e.jsx("div",{className:"text-[12px] uppercase tracking-wider",style:{color:t.textSoft},children:"Wartezeiten"}),e.jsx("div",{className:"mt-1 text-lg font-semibold",style:{color:t.cool,fontFamily:"Fraunces, serif"},children:c.stats.waitedSuccess})]})]}),c.stats.avoidedCount>0&&e.jsxs("button",{onClick:()=>D(!0),className:"flex w-full items-center justify-center gap-2 rounded-2xl py-3 text-sm font-semibold transition active:scale-[0.99]",style:{background:t.brandSoft,color:t.brand},children:[e.jsx(Ce,{size:15})," Bilanz teilen"]}),e.jsx(Qr,{t,sync:n}),e.jsx(R,{t,padding:"p-2",children:e.jsxs("div",{className:"flex items-center gap-3 p-4",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl",style:{background:`${t.text}08`},children:c.ui.dark?e.jsx(Ae,{size:18,style:{color:t.textMuted}}):e.jsx(Ue,{size:18,style:{color:t.gold}})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:t.text},children:"Dark Mode"}),e.jsx("div",{className:"text-[13px]",style:{color:t.textMuted},children:c.ui.dark?"Aktiviert":"Deaktiviert"})]}),e.jsx("button",{onClick:()=>d.setDark(!c.ui.dark),className:"relative h-6 w-11 rounded-full transition",style:{background:c.ui.dark?t.brand:`${t.text}15`},children:e.jsx("div",{className:"absolute top-0.5 h-5 w-5 rounded-full bg-white shadow transition-all",style:{left:c.ui.dark?22:2}})})]})}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 px-1 text-[13px] uppercase tracking-wider font-semibold",style:{color:t.textSoft},children:"Daten"}),e.jsxs(R,{t,padding:"p-2",children:[e.jsxs("button",{onClick:()=>cn(c),className:"flex w-full items-center gap-3 p-4 text-left",style:{borderBottom:`1px solid ${t.border}`},children:[e.jsx(Jt,{size:18,style:{color:t.cool}}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:t.text},children:"Daten exportieren"}),e.jsx("div",{className:"text-[13px]",style:{color:t.textMuted},children:"Als JSON-Datei herunterladen"})]})]}),e.jsxs("button",{onClick:()=>p.current?.click(),className:"flex w-full items-center gap-3 p-4 text-left",style:{borderBottom:`1px solid ${t.border}`},children:[e.jsx(sn,{size:18,style:{color:t.gold}}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:t.text},children:"Daten importieren"}),e.jsx("div",{className:"text-[13px]",style:{color:t.textMuted},children:"JSON-Datei einlesen (überschreibt aktuelle Daten)"})]})]}),e.jsx("input",{ref:p,type:"file",accept:".json,application/json",style:{display:"none"},onChange:$=>$.target.files?.[0]&&ne($.target.files[0])}),n.enabled&&!n.auth.user&&e.jsxs("div",{className:"flex items-start gap-3 p-4 text-[13px]",style:{borderBottom:`1px solid ${t.border}`,color:t.textMuted},children:[e.jsx(Zt,{size:18,style:{color:t.brand,flexShrink:0}}),e.jsxs("div",{children:["Mehrere Geräte? Mit einem Konto unter"," ",e.jsx("span",{style:{color:t.text},children:"Konto & Sync"})," ","synchronisieren sich deine Daten automatisch — ohne Datei-Export."]})]}),x?e.jsxs("div",{className:"p-4 space-y-3",style:{background:t.dangerSoft},children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ft,{size:16,style:{color:t.danger,flexShrink:0,marginTop:2}}),e.jsx("div",{className:"text-sm",style:{color:t.text}
356,children:"Wirklich alle Daten löschen? Das kann nicht rückgängig gemacht werden."})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>f(!1),className:"flex-1 rounded-lg py-2 text-sm font-semibold",style:{background:t.surface,color:t.text,border:`1px solid ${t.border}`},children:"Abbrechen"}),e.jsx("button",{onClick:()=>{d.resetAll(),f(!1)},className:"flex-1 rounded-lg py-2 text-sm font-semibold",style:{background:t.danger,color:"#fff"},children:"Ja, alles löschen"})]})]}):e.jsxs("button",{onClick:()=>f(!0),className:"flex w-full items-center gap-3 p-4 text-left",children:[e.jsx(V,{size:18,style:{color:t.danger}}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:t.danger},children:"Alle Daten zurücksetzen"}),e.jsx("div",{className:"text-[13px]",style:{color:t.textMuted},children:"Löscht alle Transaktionen, Ziele, Regeln"})]})]})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 px-1 text-[13px] uppercase tracking-wider font-semibold",style:{color:t.textSoft},children:"Hilfe & Support"}),e.jsxs(R,{t,padding:"p-2",children:[e.jsxs("a",{href:"./ratgeber/handbuch.html",target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-3 p-4 text-left",style:{borderBottom:`1px solid ${t.border}`},children:[e.jsx(Fs,{size:18,style:{color:t.textMuted}}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:t.text},children:"Handbuch & Ratgeber"}),e.jsx("div",{className:"text-[13px]",style:{color:t.textMuted},children:"Erste Schritte & alle Funktionen"})]}),e.jsx(ae,{size:18,style:{color:t.textSoft}})]}),e.jsxs("a",{href:"mailto:[email protected]?subject=Support%20%E2%80%93%20denkzettel.io",className:"flex w-full items-center gap-3 p-4 text-left",children:[e.jsx(Us,{size:18,style:{color:t.textMuted}}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:t.text},children:"Support & Kontakt"}),e.jsx("div",{className:"text-[13px]",style:{color:t.textMuted},children:"Fragen, Feedback, Fehler melden"})]}),e.jsx(ae,{size:18,style:{color:t.textSoft}})]}),vs(n.auth.user?.email)&&e.jsxs("button",{onClick:()=>{window.location.hash="#admin"},className:"flex w-full items-center gap-3 p-4 text-left",style:{borderTop:`1px solid ${t.border}`},children:[e.jsx(ts,{size:18,style:{color:t.textMuted}}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:t.text},children:"Broadcast (Admin)"}),e.jsx("div",{className:"text-[13px]",style:{color:t.textMuted},children:"Aktion / Challenge senden"})]}),e.jsx(ae,{size:18,style:{color:t.textSoft}})]}),e.jsx("div",{className:"px-4 pb-4 pt-2 text-[12px] leading-relaxed",style:{color:t.textSoft},children:"Denkzettel ist ein kleines Ein-Personen-Projekt. Ich lese jede Nachricht persönlich — Antworten können aber ein paar Tage dauern. Danke für deine Geduld. 🙏"})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 px-1 text-[13px] uppercase tracking-wider font-semibold",style:{color:t.textSoft},children:"Rechtliches"}),e.jsxs(R,{t,padding:"p-2",children:[e.jsxs("button",{onClick:l,className:"flex w-full items-center gap-3 p-4 text-left",style:{borderBottom:`1px solid ${t.border}`},children:[e.jsx(Gs,{size:18,style:{color:t.textMuted}}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:t.text},children:"Impressum"}),e.jsx("div",{className:"text-[13px]",style:{color:t.textMuted},children:"Angaben gemäß §5 TMG"})]}),e.jsx(ae,{size:18,style:{color:t.textSoft}})]}),e.jsxs("button",{onClick:i,className:"flex w-full items-center gap-3 p-4 text-left",children:[e.jsx(en,{size:18,style:{color:t.textMuted}}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:t.text},children:"Datenschutzerklärung"}),e.jsx("div",{className:"text-[13px]",style:{color:t.textMuted},children:"Informationen nach DSGVO"})]}),e.jsx(ae,{size:18,style:{color:t.textSoft}})]})]})]}),n.auth.user&&e.jsxs("button",{onClick:()=>j(!0),disabled:M,className:"flex w-full items-center justify-center gap-2 rounded-2xl py-3 text-sm font-semibold transition disabled:opacity-50 active:scale-[0.99]",style:{background:"transparent",border:`1px solid ${t.danger}`,color:t.danger},children:[e.jsx(V,{size:15})," Konto löschen"]}),e.jsx("div",{className:"text-center text-[12px]",style:{color:t.textSoft},children:"Denkzettel v0.2 · Lokal gespeichert in deinem Browser"}),g&&e.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center p-5",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>{M||j(!1)},children:e.jsxs("div",{className:"w-full max-w-sm rounded-3xl p-5",style:{background:t.surface},onClick:$=>$.stopPropagation(),children:[e.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-2xl",style:{background:t.dangerSoft},children:e.jsx(V,{size:20,style:{color:t.danger}})}),e.jsx("div",{className:"text-[16px] font-semibold",style:{color:t.text},children:"Konto wirklich löschen?"}),e.jsx("p",{className:"text-[13px] leading-relaxed",style:{color:t.textMuted},children:"Dein Konto und alle serverseitig gespeicherten Daten (Sync, Erinnerungen) werden unwiderruflich gelöscht. De
356ine lokalen Daten auf diesem Gerät bleiben erhalten."})]}),e.jsxs("div",{className:"mt-4 flex gap-2",children:[e.jsx("button",{onClick:()=>j(!1),disabled:M,className:"flex-1 rounded-2xl py-3 text-sm font-semibold transition disabled:opacity-50 active:scale-[0.99]",style:{background:"transparent",border:`1px solid ${t.border}`,color:t.textMuted},children:"Abbrechen"}),e.jsxs("button",{onClick:async()=>{W(!0);const $=await n.auth.deleteAccount();W(!1),j(!1),$.error&&F({type:"error",text:$.error})},disabled:M,className:"flex flex-1 items-center justify-center gap-2 rounded-2xl py-3 text-sm font-semibold transition disabled:opacity-50 active:scale-[0.99]",style:{background:t.danger,color:"#fff"},children:[M?e.jsx(me,{size:16,className:"animate-spin"}):e.jsx(V,{size:15})," Löschen"]})]})]})}),e.jsx(ee,{children:z&&e.jsx(Nt,{t,stats:{avoidedTotal:c.stats.avoidedTotal,avoidedCount:c.stats.avoidedCount,waitedSuccess:c.stats.waitedSuccess,waitedTotal:(c.avoidedItems||[]).filter($=>$.reason==="waited").reduce(($,H)=>$+(H.price||0),0),frugalScore:s.derived.frugalScore},onClose:()=>D(!1)})})]})}function ea({t,onComplete:s}){const[n,a]=o.useState(0),[r,l]=o.useState({name:"",mode:"Klarheit"}),i=[{content:e.jsxs("div",{className:"text-center space-y-5 px-2",children:[e.jsx(T.div,{initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:180},className:"mx-auto flex h-20 w-20 items-center justify-center rounded-3xl",style:{background:t.brand},children:e.jsx(Le,{size:38,color:"#fff",strokeWidth:2.2})}),e.jsxs("h1",{className:"text-3xl font-semibold tracking-tight",style:{color:t.text,fontFamily:"Fraunces, serif"},children:["Bewusst kaufen.",e.jsx("br",{}),"Mehr behalten."]}),e.jsx("p",{className:"text-sm leading-relaxed max-w-xs mx-auto",style:{color:t.textMuted},children:"Denkzettel ist kein Budget-Tracker. Es ist ein System für bewusste Kaufentscheidungen."})]})},{content:e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Wie heißt du?"}),e.jsx("p",{className:"text-sm mt-1",style:{color:t.textMuted},children:"Nur für die Begrüßung — alle Daten bleiben in deinem Browser."})]}),e.jsx(L,{t,label:"Vorname",value:r.name,onChange:p=>l({...r,name:p.target.value}),placeholder:"z. B. Jonas",autoFocus:!0})]})},{content:e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Welcher Modus passt zu dir?"}),e.jsx("p",{className:"text-sm mt-1",style:{color:t.textMuted},children:"Der Modus aktiviert passende Default-Regeln. Kannst du jederzeit ändern."})]}),e.jsx("div",{className:"space-y-2",children:$e.map(p=>e.jsxs("button",{onClick:()=>l({...r,mode:p.id}),className:"flex w-full items-start gap-3 rounded-2xl p-4 text-left transition",style:{background:r.mode===p.id?t.brandSoft:t.surface,border:`1px solid ${r.mode===p.id?t.brand:t.border}`},children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[15px] font-semibold",style:{color:t.text},children:p.title}),e.jsx("div",{className:"text-[13px] mt-0.5",style:{color:t.textMuted},children:p.short}),e.jsx("div",{className:"text-[13px] mt-1.5 leading-relaxed",style:{color:t.textSoft},children:p.body})]}),r.mode===p.id&&e.jsx("div",{className:"flex h-5 w-5 shrink-0 mt-0.5 items-center justify-center rounded-full",style:{background:t.brand},children:e.jsx(te,{size:12,color:"#fff",strokeWidth:3})})]},p.id))})]})}],c=()=>{n<i.length-1?a(n+1):s(r)},d=n===0||n===1&&r.name.trim().length>0||n===2;return e.jsxs("div",{className:"flex flex-col h-full w-full max-w-md mx-auto",children:[e.jsx("div",{className:"flex items-center gap-1 px-5 pt-6",children:i.map((p,u)=>e.jsx("div",{className:"h-1 flex-1 rounded-full transition-colors",style:{background:u<=n?t.brand:`${t.text}10`}},u))}),e.jsx(T.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{duration:.3},className:"flex-1 px-5 py-8 overflow-y-auto",children:e.jsx("div",{className:"w-full",children:i[n].content})},n),e.jsx("div",{className:"px-5 pb-8 pt-3",style:{borderTop:`1px solid ${t.border}`},children:e.jsx(O,{t,onClick:c,disabled:!d,children:e.jsxs("span",{className:"inline-flex items-center gap-2",children:[n===i.length-1?"Los geht's":"Weiter",e.jsx(Se,{size:16})]})})})]})}const ta=["Der Warenkorb füllt sich um 23:47 Uhr — und du weißt nicht mehr, warum.",'„Nur kurz gucken" auf dem Sofa endet mit drei Paketen.',"Das Teil kommt an, der Kick ist weg, das Geld auch.","Du verdienst genug. Trotzdem ist am Monatsende nichts übrig."],sa=[{icon:Le,title:"Tippe ein, was du kaufen willst",body:"Produkt, Preis, Kategorie — in zehn Sekunden. Oder teile ein Produkt direkt aus dem Shop in Denkzettel hinein."},{icon:le,title:"Beantworte ein paar ehrliche Fragen",body:"Brauchst du es? Hast du Ähnliches? Warum gerade jetzt? Ein Score, eine klare Empfehlung — passend zu deinem Modus."},{icon:Ee,title:"Entscheide bewusst",body:"Kaufen, gebraucht prüfen, warten oder verwerfen. Was du nicht kaufst, zählt als Gewinn — überstandene Wartezeiten bringen sogar Sterne."}],na=["Chrome","Brave","Vivaldi"],ra=["Edge","Firefox","Safari","Opera"],aa="https://chromewebstore.google.com/detail/denkzettel-%E2%80%94-bewusst-kauf/fbppen
356ahbbhikeigmbmpocjiofcfefgn",la="Aktuell im Chrome Web Store — viele Chromium-Browser können es von dort ebenfalls laden. Eigene Versionen für Edge, Firefox & Safari folgen.",ia=[{them:"Zeigen, was schon weg ist",us:"Greift ein, bevor es weg ist"},{them:"Jeden Euro tracken",us:"Ein Moment, wenn es zählt"},{them:"Fühlt sich wie Kontrolle an",us:"Du setzt die Regeln"},{them:"Deine Daten zwingend in der Cloud",us:"Lokal — Sync nur, wenn du willst"}],oa=[{q:"Schon wieder eine App, die mich überwacht?",a:"Nein. Standardmäßig bleibt alles in deinem Browser — kein Tracking, kein Verkauf deiner Daten. Ein Konto ist rein optional und nur für die Synchronisierung über mehrere Geräte da."},{q:"Kann ich Denkzettel auf mehreren Geräten nutzen?",a:"Ja. Ohne Konto überträgst du deine Daten per Export/Import. Mit einem kostenlosen Konto (E-Mail & Passwort) synchronisiert sich alles automatisch über deine Geräte — und Erinnerungen erreichen dich auch bei geschlossener App."},{q:"Ich hab keine Lust, alles zu tracken.",a:"Musst du nicht. Denkzettel ist für genau einen Moment da: kurz bevor du kaufst."},{q:"Bringt das wirklich was?",a:"Die simpelste Verhaltens-Intervention der Psychologie ist Verzögerung. Wer wartet, kauft seltener. Das ist der ganze Trick."},{q:"Und wenn ich für einen guten Zweck kaufe?",a:'Dafür gibt es im Check den Schalter „Unterstützt einen guten Zweck". Dann fällt die Gebraucht-Frage weg und es geht nicht ums Sparen, sondern um die ehrliche Frage: willst du das Produkt — oder den Zweck unterstützen? Geht es dir um den Zweck, bringt eine Direktspende oft mehr an.'},{q:"Kostet das was?",a:"Nein. Denkzettel ist kostenlos."}];function ca({t,dark:s,onStart:n,onQuickStart:a,onToggleDark:r,onOpenDatenschutz:l,onOpenImpressum:i}){return e.jsxs("div",{className:"h-full overflow-y-auto",style:{background:t.bg},children:[e.jsx("div",{className:"pt-[env(safe-area-inset-top)]"}),e.jsxs("div",{className:"mx-auto flex max-w-3xl items-center justify-between px-5 pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg",style:{background:t.brand},children:e.jsx(Le,{size:15,color:"#fff",strokeWidth:2.2})}),e.jsx("span",{className:"text-sm font-semibold tracking-tight",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Denkzettel"})]}),e.jsx("button",{onClick:r,className:"flex h-8 w-8 items-center justify-center rounded-full",style:{color:t.textMuted},"aria-label":s?"Light Mode":"Dark Mode",children:s?e.jsx(Ue,{size:16}):e.jsx(Ae,{size:16})})]}),e.jsxs("section",{className:"mx-auto max-w-3xl px-5 pt-10 pb-4 text-center",children:[e.jsxs(T.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.4},children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-[12px] font-semibold uppercase tracking-wider",style:{background:t.brandSoft,color:t.brand},children:[e.jsx(ht,{size:12})," Kein Budget-Tracker"]}),e.jsxs("h1",{className:"mt-5 text-[34px] leading-[1.1] font-semibold tracking-tight md:text-5xl",style:{color:t.text,fontFamily:"Fraunces, serif"},children:["Der Moment zwischen"," ",e.jsx("span",{style:{color:t.brand},children:'„Will ich"'})," ","und ",e.jsx("span",{style:{color:t.brand},children:'„Klick"'})," —",e.jsx("br",{className:"hidden sm:block"})," gehört wieder dir."]}),e.jsx("p",{className:"mx-auto mt-4 max-w-xl text-[15px] leading-relaxed md:text-base",style:{color:t.textMuted},children:"6 kurze Fragen vor dem Kauf zeigen dir, ob es echter Bedarf ist oder nur ein Impuls — bevor das Geld weg ist. Alles lokal in deinem Browser."}),e.jsxs("div",{className:"mt-7",children:[e.jsxs("button",{onClick:a,className:"inline-flex items-center justify-center gap-2 rounded-2xl px-7 py-3.5 text-[15px] font-semibold shadow-lg transition active:scale-95",style:{background:t.brand,color:"#fff",boxShadow:`0 12px 28px -8px ${t.brand}80`},children:["Jetzt Kauf prüfen — kostenlos ",e.jsx(Se,{size:17})]}),e.jsx("div",{className:"mt-2",children:e.jsx("button",{onClick:n,className:"text-[13px] font-medium underline-offset-2 hover:underline",style:{color:t.textMuted},children:"Lieber kurz einrichten (30 Sek.)"})}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-center gap-x-4 gap-y-1 text-[12px]",style:{color:t.textSoft},children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Et,{size:11})," Konto optional"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(As,{size:11})," Kein Tracking"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(nn,{size:11})," Läuft offline"]})]})]})]}),e.jsxs(T.div,{initial:{opacity:0,y:16}
356,animate:{opacity:1,y:0},transition:{duration:.5,delay:.15},className:"mx-auto mt-10 max-w-sm rounded-3xl p-6 text-left",style:{background:t.surface,border:`1px solid ${t.border}`,boxShadow:"0 20px 50px -24px rgba(0,0,0,0.25)"},children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium",style:{color:t.textMuted},children:"Sony WH-1000XM5"}),e.jsx("span",{className:"text-sm font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"299 €"})]}),e.jsxs("div",{className:"mt-4 flex items-center gap-3 rounded-2xl p-4",style:{background:t.coolSoft},children:[e.jsx("div",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-xl",style:{background:t.cool},children:e.jsx(Ee,{size:20,color:"#fff"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[15px] font-semibold",style:{color:t.text},children:"48 Stunden warten"}),e.jsx("div",{className:"text-[13px]",style:{color:t.textMuted},children:"Späte Tageszeit · emotionaler Wunsch"})]})]}),e.jsx("p",{className:"mt-3 text-[13px] leading-relaxed",style:{color:t.textSoft},children:"Wenn du es in 48 Stunden immer noch willst, kauf es mit gutem Gewissen."})]})]}),e.jsx("section",{className:"mx-auto max-w-3xl px-5 pt-12",children:e.jsxs("div",{className:"mx-auto max-w-xl rounded-3xl p-6 text-center md:p-7",style:{background:t.brandSoft},children:[e.jsxs("p",{className:"text-[18px] leading-snug md:text-[22px]",style:{color:t.text,fontFamily:"Fraunces, serif"},children:["„Jemandem einen ",e.jsx("span",{style:{color:t.brand},children:"Denkzettel"}),' verpassen" — eine Lektion, die haften bleibt.']}),e.jsxs("p",{className:"mx-auto mt-3 max-w-md text-sm leading-relaxed",style:{color:t.textMuted},children:["Hier verpasst ",e.jsx("span",{className:"font-semibold",style:{color:t.text},children:"du"})," ihn — deinem nächsten Impulskauf. Kurz innehalten, bewusst entscheiden, mehr behalten."]})]})}),e.jsxs("section",{className:"mx-auto max-w-3xl px-5 pt-12",children:[e.jsx("h2",{className:"text-center text-2xl font-semibold tracking-tight md:text-3xl",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Kennst du das?"}),e.jsx("div",{className:"mx-auto mt-5 max-w-xl space-y-2.5",children:ta.map(d=>e.jsxs("div",{className:"flex items-start gap-3 rounded-2xl p-4",style:{background:t.surface,border:`1px solid ${t.border}`},children:[e.jsx("span",{className:"mt-0.5 text-lg leading-none",children:"💸"}),e.jsx("span",{className:"text-sm leading-relaxed",style:{color:t.text},children:d})]},d))}),e.jsx("div",{className:"mx-auto mt-6 max-w-xl rounded-2xl p-5",style:{background:t.brandSoft},children:e.jsxs("p",{className:"text-sm leading-relaxed",style:{color:t.text},children:[e.jsx("span",{className:"font-semibold",children:"Das liegt nicht an dir."})," ",'One-Click, Mitternachts-Deals und „nur noch 2 auf Lager" sind darauf gebaut, dein Wollen in Sekunden in einen Kauf zu verwandeln — bevor dein Verstand mitredet. Denkzettel gibt dir die paar Sekunden zurück.']})})]}),e.jsxs("section",{className:"mx-auto max-w-3xl px-5 pt-14",children:[e.jsx("h2",{className:"text-center text-2xl font-semibold tracking-tight md:text-3xl",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"So funktioniert's"}),e.jsx("div",{className:"mt-6 grid gap-3 md:grid-cols-3",children:sa.map((d,p)=>{const u=d.icon;return e.jsxs("div",{className:"rounded-2xl p-5",style:{background:t.surface,border:`1px solid ${t.border}`},children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl",style:{background:t.brandSoft},children:e.jsx(u,{size:19,style:{color:t.brand}})}),e.jsxs("span",{className:"text-[13px] font-bold",style:{color:t.textSoft},children:["0",p+1]})]}),e.jsx("div",{className:"mt-3 text-[15px] font-semibold",style:{color:t.text},children:d.title}),e.jsx("div",{className:"mt-1 text-sm leading-relaxed",style:{color:t.textMuted},children:d.body})]},d.title)})}),e.jsx("div",{className:"mt-6 text-center",children:e.jsxs("button",{onClick:a,className:"inline-flex items-center justify-center gap-2 rounded-2xl px-7 py-3.5 text-[15px] font-semibold shadow-lg transition active:scale-95",style:{background:t.brand,color:"#fff",boxShadow:`0 12px 28px -8px ${t.brand}80`},children:["Jetzt ausprobieren — kostenlos ",e.jsx(Se,{size:17})]})})]}),e.jsxs("section",{className:"mx-auto max-w-3xl px-5 pt-14",children:[e.jsx("h2",{className:"text-center text-2xl font-semibold tracking-tight md:text-3xl",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Ein Klick im Shop — und es liegt im Denkzettel"}),e.jsxs("div",{className:"mx-auto mt-5 max-w-xl rounded-2xl p-5",style:{background:t.surface,border:`1px solid ${t.border}`},children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl",style:{background:t.brandSoft},children:e.jsx(Zs,{size:19,style:{color:t.brand}})}),e.jsxs("p",{className:"text-sm leading-relaxed",style:{color:t.text},children:["Mit dem ",e.jsx("span",{className:"font-semibold",children:"Browser-Plugin"})," prüfst du jeden Kauf direkt dort, wo er entsteht: Auf der Produktseite tippst du auf
356s Denkzettel-Icon (oder Rechtsklick → ",e.jsx("span",{className:"font-semibold",children:'„Als Denkzettel prüfen"'}),") —"," ",e.jsx("span",{className:"font-semibold",children:"Titel, Preis, Link, Shop und Kategorie"})," werden automatisch übernommen und der Check öffnet sich. Kein Abtippen, kein Copy-&-Paste."]})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[na.map(d=>e.jsx("span",{className:"rounded-full px-3 py-1.5 text-[13px] font-medium",style:{background:t.brandSoft,border:`1px solid ${t.brand}33`,color:t.brand},children:d},d)),ra.map(d=>e.jsxs("span",{className:"rounded-full px-3 py-1.5 text-[13px] font-medium",style:{background:t.bg,border:`1px solid ${t.border}`,color:t.textSoft},children:[d," · bald"]},d))]}),e.jsxs("div",{className:"mt-4 flex items-start gap-2 text-[12px] leading-relaxed",style:{color:t.textSoft},children:[e.jsx(Et,{size:13,style:{flexShrink:0,marginTop:1}}),e.jsx("span",{children:"Wird nur auf deinen Klick aktiv — kein Mitlesen im Hintergrund, kein Tracking."})]}),e.jsxs("div",{className:"mt-4",children:[e.jsxs("a",{href:aa,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center gap-2 rounded-2xl px-5 py-2.5 text-[14px] font-semibold transition active:scale-95",style:{background:t.brand,color:"#fff"},children:["Plugin installieren ",e.jsx(Se,{size:15})]}),e.jsx("p",{className:"mt-2 text-[12px] leading-relaxed",style:{color:t.textSoft},children:la})]})]})]}),e.jsxs("section",{className:"mx-auto max-w-3xl px-5 pt-14",children:[e.jsx("h2",{className:"text-center text-2xl font-semibold tracking-tight md:text-3xl",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Erst schauen, ob's günstiger geht"}),e.jsxs("div",{className:"mx-auto mt-5 max-w-xl rounded-2xl p-5",style:{background:t.surface,border:`1px solid ${t.border}`},children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl",style:{background:t.brandSoft},children:e.jsx(Js,{size:19,style:{color:t.brand}})}),e.jsxs("p",{className:"text-sm leading-relaxed",style:{color:t.text},children:["Bevor du neu kaufst, schlägt Denkzettel passende"," ",e.jsx("span",{className:"font-semibold",children:"gebrauchte, refurbishte und Preisvergleichs-Alternativen"})," ","vor — direkt zur Suche beim jeweiligen Anbieter. Oft 20–40 % günstiger, ohne Funktionsverlust."]})]}),e.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:["Kleinanzeigen","Vinted","eBay","rebuy","Back Market","idealo","mydealz","Too Good To Go"].map(d=>e.jsx("span",{className:"rounded-full px-3 py-1.5 text-[13px] font-medium",style:{background:t.bg,border:`1px solid ${t.border}`,color:t.textMuted},children:d},d))}),e.jsx("p",{className:"mt-4 text-[12px] leading-relaxed",style:{color:t.textSoft},children:"Transparenz: Einzelne dieser Links können Affiliate- oder Werbe-Links sein — für dich ohne Mehrkosten."})]})]}),e.jsx("section",{className:"mx-auto max-w-3xl px-5 pt-14",children:e.jsxs("div",{className:"overflow-hidden rounded-3xl p-7 text-center md:p-10",style:{background:t.brand},children:[e.jsx("div",{className:"text-[13px] font-semibold uppercase tracking-wider",style:{color:"#ffffffcc"},children:"Diesen Monat"}),e.jsx("div",{className:"mt-1 text-5xl font-semibold md:text-6xl",style:{color:"#fff",fontFamily:"Fraunces, serif"},children:"568 €"}),e.jsx("div",{className:"mt-1 text-[15px]",style:{color:"#ffffffe0"},children:"nicht ausgegeben · 4 Impulse erkannt"}),e.jsx("p",{className:"mx-auto mt-4 max-w-md text-sm leading-relaxed",style:{color:"#ffffffcc"},children:"Kein Schuld-Diagramm. Eine Siegesliste. Jeder Kauf, den du dir sparst, landet hier — und dein Zukunfts-Ich sagt danke."})]})}),e.jsxs("section",{className:"mx-auto max-w-3xl px-5 pt-10 text-center",children:[e.jsx("p",{className:"text-[15px] font-medium",style:{color:t.textMuted},children:"Dein nächster Kauf wartet vielleicht schon im Warenkorb."}),e.jsxs("button",{onClick:a,className:"mt-3 inline-flex items-center justify-center gap-2 rounded-2xl px-6 py-3 text-[15px] font-semibold transition active:scale-95",style:{background:t.brand,color:"#fff"},children:["In 30 Sekunden prüfen ",e.jsx(Se,{size:16})]})]}),e.jsxs("section",{className:"mx-auto max-w-3xl px-5 pt-14",children:[e.jsx("h2",{className:"text-center text-2xl font-semibold tracking-tight md:text-3xl",style:{color:t.text,fontFamily:"Fraunces, serif"},children:'Besonders für dich, wenn dein Kopf schneller „ja" sagt als du'}),e.jsx("div",{className:"mx-auto mt-5 max-w-xl rounded-2xl p-5",style:{background:t.surface,border:`1px solid ${t.border}`},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl",style:{background:t.goldSoft},children:e.jsx(Ts,{size:19,style:{color:t.gold}})}),e.jsxs("p",{className:"text-sm leading-relaxed",style:{color:t.text},children:["Impulskontrolle ist Kopfsache — und manchen Köpfen fällt sie schwerer. Denkzettel ist die externe Bremse: ein eigener ",e.jsx("span",{className:"font-semibold",children:"ADHS-Modus"})," und ein ",e.jsx("span",{className:"font-semibold",children:"Stress-Notfall-Knopf"}),", der an schweren Tagen jeden Kauf blockiert. Kein Vorwurf. Nur Rückhalt."]})]})}),e.jsx("div",{className:"mt-5 flex flex-wrap justify-center gap-2",children:$e.map(d=>e.jsxs("div",{className:"rounded-full px-3.5 py-1.5 text-[13px] font-medium",style:{background:t.surface,border:`1px solid ${t.border}`,color:t.textMuted},children:[e.jsx("span",{className:"font-semibold",style:{color:t.text},children:d.title})," · ",d.short]},d.id))})]}),e.jsxs("section",{className:"mx-auto max-w-3xl px-5 pt-14",children:[e.jsx("h2",{className:"text-center text-2xl font-semibold tracking-tight md:text-3xl",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Nicht noch eine Finanz-App"}),e.jsx("div",{className:"mx-auto mt-6 max-w-xl space-y-2",children:ia.map(d=>e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 rounded-xl p-3 text-[13px]",style:{background:t.surface,border:`1px solid ${t.border}`,color:t.textSoft},children:[e.jsx(U,{size:14,style:{color:t.danger,flexShrink:0}}),e.jsx("span",{className:"line-through",children:d.them})]}),e.jsxs("div",{className:"flex items-center gap-2 rounded-xl p-3 text-[13px] font-medium",style:{background:t.brandSoft,color:t.text},children:[e.jsx(te,{size:14,style:{color:t.brand,flexShrink:0}}),e.jsx("span",{children:d.us})]})]},d.us))})]}),e.jsxs("section",{className:"mx-auto max-w-3xl px-5 pt-14",children:[e.jsx("h2",{className:"text-center text-2xl font-semibold tracking-tight md:text-3xl",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Häufige Fragen"}),e.jsx("div",{className:"mx-auto mt-5 max-w-xl space-y-2",children:oa.map(d=>e.jsx(da,{t,q:d.q,a:d.a},d.q))})]}),e.jsxs("section",{className:"mx-auto max-w-3xl px-5 pb-16 pt-14 text-center",children:[e.jsx("h2",{className:"text-2xl font-semibold tracking-tight md:text-3xl",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Der nächste Impuls kommt bestimmt."}),e.jsxs("p",{className:"mt-1 text-[15px]",style:{color:t.textMuted},children:["Verpass ihm einen ",e.jsx("span",{className:"font-semibold",style:{color:t.brand},children:"Denkzettel"}),"."]}),e.jsxs("button",{onClick:a,className:"mt-6 inline-flex items-center justify-center gap-2 rounded-2xl px-7 py-3.5 text-[15px] font-semibold shadow-lg transition active:scale-95",style:{background:t.brand,color:"#fff",boxShadow:`0 12px 28px -8px ${t.brand}80`},children:["Jetzt Kauf prüfen — kostenlos ",e.jsx(Se,{size:17})]}),e.jsxs("div",{className:"mt-8 flex flex-wrap items-center justify-center gap-x-4 gap-y-1 text-[12px]",style:{color:t.textSoft},children:[e.jsx("a",{href:"./ratgeber/",className:"underline-offset-2 hover:underline",children:"Ratgeber"}),e.jsx("span",{children:"·"}),e.jsx("button",{onClick:l,className:"underline-offset-2 hover:underline",children:"Datenschutz"}),e.jsx("span",{children:"·"}),e.jsx("button",{onClick:i,className:"underline-offset-2 hover:underline",children:"Impressum"}),e.jsx("span",{children:"·"}),e.jsx("a",{href:"mailto:[email protected]?subject=Kontakt%20%E2%80%93%20denkzettel.io",className:"underline-offset-2 hover:underline",children:"Kontakt"}),e.jsx("span",{children:"·"}),e.jsx("span",{children:"Lokal in deinem Browser"})]})]})]})}function da({t,q:s,a:n}){const[a,r]=o.useState(!1);return e.jsxs("div",{className:"rounded-2xl",style:{background:t.surface,border:`1px solid ${t.border}`},children:[e.jsxs("button",{onClick:()=>r(l=>!l),className:"flex w-full items-center justify-between gap-3 p-4 text-left","aria-expanded":a,children:[e.jsx("span",{className:"text-sm font-semibold",style:{color:t.text},children:s}),e.jsx(Rs,{size:18,style:{color:t.textSoft,flexShrink:0,transform:a?"rotate(180deg)":"none",transition:"transform 0.2s"}})]}),a&&e.jsx("div",{className:"px-4 pb-4 -mt-1 text-sm leading-relaxed",style:{color:t.textMuted},children:n})]})}function ua({t,store:s,onBack:n}){const{state:a,actions:r}
356=s,l=a.profile.mode,[i,c]=o.useState(null),[d,p]=o.useState(!1),m=je(i||l),h=x=>{if(x===l){c(null);return}c(x),p(!1)},b=x=>{if(i){if(r.updateProfile({mode:i}),x){const f=je(i);r.setRulesActive(f.activeRuleIds)}c(null),p(!0),setTimeout(()=>p(!1),2500)}};return e.jsxs(T.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{duration:.2},className:"space-y-4 pb-28",children:[e.jsxs("div",{className:"px-1 pt-2",children:[e.jsxs("button",{onClick:n,className:"-ml-2 mb-1 flex h-8 items-center gap-1 px-2 text-sm font-semibold",style:{color:t.textMuted},"aria-label":"Zurück",children:[e.jsx(ke,{size:14})," Zurück"]}),e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Modus"}),e.jsx("p",{className:"mt-1 text-sm",style:{color:t.textMuted},children:"Aktiviert eine passende Default-Auswahl an Schutzregeln. Tippe einen Modus an, um zu wechseln."})]}),d&&e.jsx(T.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},className:"rounded-xl px-4 py-3 text-sm",style:{background:t.brandSoft,color:t.brand},children:"Modus aktualisiert."}),e.jsx("div",{className:"space-y-2",children:$e.map(x=>{const f=x.id===l&&!i,g=x.id===i,j=g?t.gold:f?t.brand:t.border,M=g?t.goldSoft:f?t.brandSoft:t.surface;return e.jsxs("button",{onClick:()=>h(x.id),className:"flex w-full items-start gap-3 rounded-2xl p-4 text-left transition active:scale-[0.99]",style:{background:M,border:`1px solid ${j}`},children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"text-[15px] font-semibold",style:{color:t.text},children:x.title}),f&&e.jsx(ye,{t,tone:"brand",children:"aktiv"}),g&&e.jsx(ye,{t,tone:"gold",children:"ausgewählt"})]}),e.jsx("div",{className:"mt-0.5 text-[13px]",style:{color:t.textMuted},children:x.short}),e.jsx("div",{className:"mt-1.5 text-sm leading-relaxed",style:{color:t.textSoft},children:x.body}),e.jsxs("div",{className:"mt-2 text-[12px] uppercase tracking-wider font-semibold",style:{color:t.textSoft},children:["Aktiviert ",x.activeRuleIds.length," ",x.activeRuleIds.length===1?"Regel":"Regeln"]})]}),(f||g)&&e.jsx("div",{className:"flex h-5 w-5 shrink-0 mt-0.5 items-center justify-center rounded-full",style:{background:g?t.gold:t.brand},children:e.jsx(te,{size:12,color:"#fff",strokeWidth:3})})]},x.id)})}),i&&e.jsxs(R,{t,padding:"p-4",children:[e.jsxs("div",{className:"text-sm font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:["Regeln an „",m.title,'" anpassen?']}),e.jsxs("p",{className:"mt-1 text-sm leading-relaxed",style:{color:t.textMuted},children:["Der neue Modus schlägt ",m.activeRuleIds.length," aktive Schutzregeln vor. Eigene Regeln bleiben unangetastet."]}),e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsx(O,{t,onClick:()=>b(!0),children:"Ja, Regeln anpassen"}),e.jsx(ve,{t,onClick:()=>b(!1),children:"Nein, Regeln unverändert lassen"}),e.jsx("button",{onClick:()=>c(null),className:"w-full py-2 text-sm font-medium",style:{color:t.textSoft},children:"Abbrechen"})]})]})]})}function Oe({title:t,children:s,t:n}){return e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-[13px] uppercase tracking-wider font-semibold",style:{color:n.textSoft},children:t}),e.jsx("div",{className:"text-sm leading-relaxed",style:{color:n.text},children:s})]})}function Ot({t,onBack:s}){const a=`./eu-ai-icons/label-ai-generated-${t===at.dark?"white":"black"}.svg`;return e.jsxs(T.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{duration:.2},className:"flex flex-col h-full",style:{background:t.bg},children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 pt-14 pb-4",style:{borderBottom:`1px solid ${t.border}`},children:[e.jsx("button",{onClick:s,className:"flex h-8 w-8 items-center justify-center rounded-full",style:{background:`${t.text}10`,color:t.text},"aria-label":"Zurück",children:e.jsx(ke,{size:16})}),e.jsx("h1",{className:"text-lg font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Impressum"})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-4 pb-28",children:[e.jsx(R,{t,padding:"p-5",children:e.jsxs("div",{className:"space-y-5",children:[e.jsxs(Oe,{title:"Angaben gemäß §5 TMG",t,children:[e.jsx("p",{children:"Jonas Prokop"}),e.jsx("p",{children:"Matthias-Grünewald-Str. 6"}),e.jsx("p",{children:"78224 Singen"})]}),e.jsx("div",{style:{borderTop:`1px solid ${t.border}`}}),e.jsx(Oe,{title:"Kontakt",t,children:e.jsxs("p",{children:["E-Mail:"," ",e.jsx("a",{href:"mailto:[email protected]?subject=Kontakt%20%C3%BCber%20denkzettel.io",className:"underline underline-offset-2",style:{color:t.brand},children:"[email protected]"})]})}),e.jsx("div",{style:{borderTop:`1px solid ${t.border}`}}),e.jsx(Oe,{title:"Hinweis zur App",t,children:e.jsx("p",{style:{color:t.textMuted},children:"Denkzettel ist eine kostenlose Progressive Web App (PWA). Alle Nutzerdaten werden ausschließlich lokal im Browser gespeichert. Es werden keine Nutzerdaten an den Betreiber übertragen."})}),e.jsx("div",{style:{borderTop:`1px solid ${t.border}`}}
356),e.jsxs(Oe,{title:"Transparenz: Künstliche Intelligenz",t,children:[e.jsxs("p",{style:{color:t.textMuted},children:["Denkzettel wurde mit Unterstützung KI-gestützter Entwicklungswerkzeuge erstellt. Zur Laufzeit nutzt die App"," ",e.jsx("span",{style:{color:t.text},children:"kein KI- oder Sprachmodell"}),": Die Muster-Erkennung ist reine lokale Heuristik, und deine Daten bleiben auf deinem Gerät."]}),e.jsx("p",{className:"mt-2",style:{color:t.textMuted},children:"Einzelne sichtbare Inhalte wurden mit Hilfe von KI erstellt — die Ratgeber- und Hilfetexte sowie App-Icon und Vorschaubild."}),e.jsx("img",{src:a,alt:"EU-Kennzeichnung: KI-generierter Inhalt",className:"mt-2 h-8 w-auto"}),e.jsxs("p",{className:"mt-2",style:{color:t.textSoft},children:["Kennzeichnung im Sinne der"," ",e.jsx("a",{href:"https://digital-strategy.ec.europa.eu/en/policies/eu-icons-labelling-ai-generated-content",target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2",style:{color:t.brand},children:"EU-Transparenzregeln für KI-Inhalte"})," ","(Art. 50 KI-Verordnung)."]})]})]})}),e.jsx("p",{className:"text-center text-[12px]",style:{color:t.textSoft},children:"Denkzettel · §5 Telemediengesetz (TMG)"})]})]})}function de({title:t,children:s,t:n}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-[13px] uppercase tracking-wider font-semibold",style:{color:n.textSoft},children:t}),e.jsx("div",{className:"text-sm leading-relaxed space-y-2",style:{color:n.textMuted},children:s})]})}function Ht({t,onBack:s}){return e.jsxs(T.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{duration:.2},className:"flex flex-col h-full",style:{background:t.bg},children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 pt-14 pb-4",style:{borderBottom:`1px solid ${t.border}`},children:[e.jsx("button",{onClick:s,className:"flex h-8 w-8 items-center justify-center rounded-full",style:{background:`${t.text}10`,color:t.text},"aria-label":"Zurück",children:e.jsx(ke,{size:16})}),e.jsx("h1",{className:"text-lg font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Datenschutzerklärung"})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-3 pb-28",children:[e.jsx(R,{t,padding:"p-5",children:e.jsxs("div",{className:"space-y-5",children:[e.jsxs(de,{title:"Verantwortlicher (Art. 4 Nr. 7 DSGVO)",t,children:[e.jsx("p",{children:"Jonas Prokop · Matthias-Grünewald-Str. 6 · 78224 Singen"}),e.jsxs("p",{children:["E-Mail:"," ",e.jsx("a",{href:"mailto:[email protected]?subject=Datenschutzanfrage",className:"underline underline-offset-2",style:{color:t.brand},children:"[email protected]"})]})]}),e.jsx("div",{style:{borderTop:`1px solid ${t.border}`}}),e.jsxs(de,{title:"Hosting",t,children:[e.jsx("p",{children:"Diese App wird gehostet bei der Mittwald CM Service GmbH & Co. KG, Königsberger Str. 4–6, 32339 Espelkamp. Beim Aufruf der App erstellt der Webserver automatisch Server-Logfiles, die IP-Adresse, Zeitstempel, aufgerufene URL, HTTP-Statuscode und Browserkennung enthalten können."}),e.jsx("p",{children:"Rechtsgrundlage: Art. 6 Abs. 1 lit. f DSGVO (berechtigtes Interesse an sicherem und stabilem Betrieb). Speicherdauer: 7–30 Tage."})]}),e.jsx("div",{style:{borderTop:`1px solid ${t.border}`}}),e.jsxs(de,{title:"Lokale Datenspeicherung",t,children:[e.jsxs("p",{children:["Solange du ",e.jsx("span",{style:{color:t.text},children:"kein Konto"}),' anlegst, werden alle von dir eingegebenen Daten (Transaktionen, Ziele, Regeln, Profil) ausschließlich lokal in deinem Browser im sog. localStorage gespeichert. Diese Daten verlassen deinen Browser nicht und sind für den Betreiber zu keinem Zeitpunkt zugänglich. Erst wenn du dich für die optionale Synchronisierung registrierst, werden Daten serverseitig verarbeitet (siehe „Konto & Sync").']}),e.jsxs("p",{children:["Du kannst alle Daten jederzeit über"," ",e.jsx("span",{style:{color:t.text},children:"Profil → Daten zurücksetzen"})," ","vollständig löschen oder über"," ",e.jsx("span",{style:{color:t.text},children:"Profil → Daten exportieren"})," ","sichern."]})]}),e.jsx("div",{style:{borderTop:`1px solid ${t.border}`}}),e.jsxs(de,{title:"Push-Benachrichtigungen (optional)",t,children:[e.jsx("p",{children:"Ohne Konto werden Erinnerungen ausschließlich lokal in deinem Browser ausgelöst, solange die App geöffnet ist — es findet keine serverseitige Verarbeitung statt."}),e.jsx("p",{children:'Wenn du ein Konto nutzt und Push-Benachrichtigungen aktivierst, speichern wir die Push-Adresse deines Browsers sowie die anstehenden Erinnerungen (Titel der Wartezeit, Ablaufzeitpunkt) bei unserem Auftragsverarbeiter (siehe „Konto & Sync"), damit dich Erinnerungen auch bei geschlossener App erreichen. Die Zustellung erfolgt über den Benachrichtigungsdienst de
356ines Browsers. Die Aktivierung ist freiwillig und jederzeit widerrufbar.'}),e.jsx("p",{children:'Unabhängig davon kannst du — nur mit gesonderter Einwilligung (Art. 6 Abs. 1 lit. a DSGVO, § 7 UWG) — gelegentliche Hinweise zu Aktionen und Challenges erhalten. Diese Einwilligung ist optional, standardmäßig deaktiviert und jederzeit in „Konto & Sync" widerrufbar.'})]}),e.jsx("div",{style:{borderTop:`1px solid ${t.border}`}}),e.jsxs(de,{title:"Konto & Sync (optional)",t,children:[e.jsx("p",{children:"Du kannst optional ein Konto (E-Mail und Passwort) anlegen, um deine Daten zwischen mehreren Geräten zu synchronisieren und Erinnerungen zu erhalten. In diesem Fall werden deine App-Daten verschlüsselt übertragen und bei unserem Auftragsverarbeiter gespeichert:"}),e.jsx("p",{style:{color:t.text},children:"Supabase (hosted by Supabase, Inc.) — Hosting in der EU (Region Frankfurt). Es besteht ein Vertrag zur Auftragsverarbeitung (Art. 28 DSGVO)."}),e.jsx("p",{children:"Verarbeitet werden: deine E-Mail-Adresse (zur Anmeldung), die von dir erfassten App-Daten sowie — bei aktivierten Benachrichtigungen — deine Push-Adresse. Rechtsgrundlage ist die Erfüllung des mit dir geschlossenen Nutzungsvertrags (Art. 6 Abs. 1 lit. b DSGVO)."}),e.jsxs("p",{children:["Du kannst dein Konto jederzeit über"," ",e.jsx("span",{style:{color:t.text},children:"Profil → Konto löschen"})," ","entfernen. Dabei werden alle serverseitig gespeicherten Daten (Konto, synchronisierte Daten, Push-Adressen, Erinnerungen) unwiderruflich gelöscht."]})]}),e.jsx("div",{style:{borderTop:`1px solid ${t.border}`}}),e.jsx(de,{title:"Schriftarten",t,children:e.jsx("p",{children:'Diese App verwendet die Schriftart „Fraunces", die selbst gehostet und direkt vom Server dieser App ausgeliefert wird. Es findet keine Verbindung zu externen Schriftart-Diensten (z. B. Google Fonts) statt.'})}),e.jsx("div",{style:{borderTop:`1px solid ${t.border}`}}),e.jsx(de,{title:"Cookies & Tracking",t,children:e.jsx("p",{children:"Diese App setzt keine Cookies. Es wird kein Tracking, keine Analyse und keine Werbung eingesetzt."})}),e.jsx("div",{style:{borderTop:`1px solid ${t.border}`}}),e.jsxs(de,{title:"Affiliate- & Werbe-Links",t,children:[e.jsxs("p",{children:["In der App verlinken wir externe Anbieter für gebrauchte, refurbishte oder günstigere Alternativen (z. B. Kleinanzeigen, Vinted, eBay, rebuy, Back Market, idealo, mydealz). Einzelne dieser Links können"," ",e.jsx("span",{style:{color:t.text},children:"Affiliate- oder Werbe-Links"})," sein."]}),e.jsx("p",{children:"Klickst du einen solchen Link, verlässt du Denkzettel; der jeweilige Anbieter kann eigene Cookies setzen und ist eigenständig für seine Datenverarbeitung verantwortlich. Schließt du dort etwas ab, erhalten wir ggf. eine Provision — für dich ohne Mehrkosten. Rechtsgrundlage: Art. 6 Abs. 1 lit. f DSGVO (berechtigtes Interesse an der Finanzierung des kostenlosen Angebots); Kennzeichnung gemäß § 5a UWG."})]}),e.jsx("div",{style:{borderTop:`1px solid ${t.border}`}}),e.jsx(de,{title:"Datenübermittlung & Drittländer",t,children:e.jsx("p",{children:"Es werden keine Daten zu Werbe- oder Tracking-Zwecken an Dritte weitergegeben. Eine Verarbeitung durch Auftragsverarbeiter findet nur im technisch notwendigen Umfang statt (Hosting Mittwald; bei Nutzung eines Kontos zusätzlich Supabase, jeweils mit Servern in der EU). Eine Übermittlung in Drittländer außerhalb der EU/des EWR ist nicht vorgesehen."})}),e.jsx("div",{style:{borderTop:`1px solid ${t.border}`}}),e.jsxs(de,{title:"Deine Rechte (Art. 15–22 DSGVO)",t,children:[e.jsxs("p",{children:["Du hast das Recht auf Auskunft, Berichtigung, Löschung, Einschränkung der Verarbeitung, Datenübertragbarkeit sowie Widerspruch. Ohne Konto werden alle Daten ausschließlich lokal in deinem Browser gespeichert und sind dem Betreiber nicht zugänglich — du übst diese Rechte über die App-Einstellungen selbst aus (Löschen und Exportieren). Nutzt du ein Konto, kannst du es über"," ",e.jsx("span",{style:{color:t.text},children:"Profil → Konto löschen"})," ","jederzeit samt aller serverseitigen Daten entfernen; für Auskunft oder Berichtigung genügt eine E-Mail an den Verantwortlichen."]}),e.jsx("p",{children:"Beschwerden können an die zuständige Datenschutz-Aufsichtsbehörde gerichtet werden (für Baden-Württemberg: Landesbeauftragter für Datenschutz und Informationsfreiheit Baden-Württemberg)."})]})]})}),e.jsx("p",{className:"text-center text-[12px]",style:{color:t.textSoft},children:"Stand: Juni 2026 · DSGVO Art. 13"})]})]})}const xa=[{label:"No-Spend-Monat",url:"/aktion/no-spend-monat.html",suggestTitle:"No-Spend-Monat startet 🚀",suggestBody:"30 Tage bewusst. Bist du dabei?"}];function st({t,active:s,onClick:n,children:a}){return e.jsx("button",{type:"button",onClick:n,className:"rounded-full px-3 py-1.5 text-[13px] font-medium transition",style:s?{background:t.brand,color:"#fff"}:{background:t.surface,border:`1px solid ${t.border}`,color:t.textMuted},children:a})}const Te="__custom__";function ma({t,sync:s,onBack:n}){const a=vs(s.auth.user?.email),[r,l]=o.useState(""),[i,c]=o.useState(""),[d,p]=o.use
356State(""),[u,m]=o.useState(""),[h,b]=o.useState(!1),[x,f]=o.useState(!1),[g,j]=o.useState(null),M=d===Te?u.trim():d,W=D=>{p(D.url),f(!1),!r.trim()&&D.suggestTitle&&l(D.suggestTitle),!i.trim()&&D.suggestBody&&c(D.suggestBody)},z=async()=>{if(!r.trim()||!i.trim()){j({type:"error",text:"Titel und Text sind nötig."});return}if(d===Te&&!u.trim()){j({type:"error",text:"Eigener Link ist leer."});return}if(!x){f(!0),j({type:"error",text:'Geht an ALLE Einwilligenden. Nochmal „Senden" zum Bestätigen.'});return}b(!0),j(null);const D=await Jr({title:r.trim(),body:i.trim(),url:M||void 0});b(!1),f(!1),D.ok?(j({type:"ok",text:`Gesendet an ${D.sent} Gerät(e) · ${D.recipients} Einwilligende.`}),l(""),c(""),p(""),m("")):j({type:"error",text:D.error})};return e.jsxs(T.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{duration:.2},className:"flex flex-col h-full",style:{background:t.bg},children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 pt-14 pb-4",style:{borderBottom:`1px solid ${t.border}`},children:[e.jsx("button",{onClick:n,className:"flex h-8 w-8 items-center justify-center rounded-full",style:{background:`${t.text}10`,color:t.text},"aria-label":"Zurück",children:e.jsx(ke,{size:16})}),e.jsx("h1",{className:"text-lg font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Broadcast"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-4 pb-28",children:a?e.jsxs(R,{t,padding:"p-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl",style:{background:t.brandSoft},children:e.jsx(ts,{size:18,style:{color:t.brand}})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[15px] font-semibold",style:{color:t.text},children:"Aktion / Challenge senden"}),e.jsx("div",{className:"truncate text-[13px]",style:{color:t.textMuted},children:"Push an alle mit Marketing-Einwilligung"})]})]}),e.jsxs("div",{className:"mt-4 space-y-2",children:[e.jsx(L,{t,placeholder:"Titel (z. B. No-Spend-Monat startet 🚀)",value:r,onChange:D=>{l(D.target.value),f(!1)}}),e.jsx(L,{t,placeholder:"Text (z. B. 30 Tage bewusst. Dabei?)",value:i,onChange:D=>{c(D.target.value),f(!1)}}),e.jsxs("div",{className:"pt-1",children:[e.jsx("div",{className:"mb-1.5 text-[12px] font-semibold uppercase tracking-wider",style:{color:t.textSoft},children:"Ziel beim Tippen"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(st,{t,active:d==="",onClick:()=>{p(""),f(!1)},children:"Kein Link"}),xa.map(D=>e.jsx(st,{t,active:d===D.url,onClick:()=>W(D),children:D.label},D.url)),e.jsx(st,{t,active:d===Te,onClick:()=>{p(Te),f(!1)},children:"Eigener Link"})]}),d===Te&&e.jsx("div",{className:"mt-2",children:e.jsx(L,{t,type:"url",placeholder:"https://… (z. B. Affiliate-/Partnerseite)",value:u,onChange:D=>{m(D.target.value),f(!1)}})}),M&&e.jsxs("p",{className:"mt-1.5 truncate text-[12px]",style:{color:t.textSoft},children:["Öffnet: ",M]})]}),e.jsx(O,{t,onClick:z,disabled:h,children:e.jsxs("span",{className:"inline-flex items-center justify-center gap-2",children:[h?e.jsx(me,{size:16,className:"animate-spin"}):e.jsx(Qs,{size:16}),x?"Wirklich an alle senden?":"Senden"]})}),e.jsx("p",{className:"pt-1 text-[12px] leading-relaxed",style:{color:t.textSoft},children:"Empfänger sind nur Nutzer:innen, die der Marketing-Kommunikation zugestimmt haben. Bitte sparsam einsetzen."})]}),g&&e.jsx("p",{className:"pt-3 text-center text-[13px]",style:{color:g.type==="error"?t.danger:t.brand},children:g.text})]}):e.jsx(R,{t,padding:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[e.jsx(Xs,{size:28,style:{color:t.danger}}),e.jsx("div",{className:"text-[15px] font-semibold",style:{color:t.text},children:"Kein Zugriff"}),e.jsx("p",{className:"text-[13px]",style:{color:t.textMuted},children:"Diese Seite ist nur für den Admin-Account. Der Server lehnt fremde Anfragen ohnehin ab."})]})})})]})}function ha({t,onAccept:s,onOpenDatenschutz:n}){return e.jsx("div",{className:"fixed inset-x-0 bottom-0 z-50 px-3 pt-3",style:{paddingBottom:"calc(env(safe-area-inset-bottom, 0px) + 12px)"},children:e.jsxs("div",{className:"mx-auto max-w-xl rounded-2xl p-4 shadow-xl",style:{background:t.surface,border:`1px solid ${t.border}`},children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl",style:{background:t.brandSoft},children:e.jsx(le,{size:17,style:{color:t.brand}})}),e.jsxs("p",{className:"text-[13px] leading-relaxed",style:{color:t.textMuted},children:["Denkzettel speichert deine Daten lokal in deinem Browser —"," ",e.jsx("span",{style:{color:t.text}
356,children:"kein Tracking, keine Werbe-Cookies, keine Analyse."})," ","Mehr dazu in der"," ",e.jsx("button",{onClick:n,className:"underline underline-offset-2",style:{color:t.brand},children:"Datenschutzerklärung"}),"."]})]}),e.jsx("button",{onClick:s,className:"mt-3 w-full rounded-xl py-2.5 text-sm font-semibold transition active:scale-[0.99]",style:{background:t.brand,color:"#fff"},children:"Verstanden"})]})})}const ws={home:"home",expenses:"verlauf",goals:"ziele",profile:"profil",rules:"regeln",mode:"modus",impressum:"impressum",datenschutz:"datenschutz",admin:"admin"},fa=Object.fromEntries(Object.entries(ws).map(([t,s])=>[s,t]));function Gt(){return typeof window>"u"?null:fa[window.location.hash.replace(/^#/,"")]??null}function pa(t){return`#${ws[t]??"home"}`}function ga(){const t=xn(),{state:s,actions:n}=t,a=Dn(t),[r,l]=o.useState(()=>Gt()??"home"),[i,c]=o.useState(!1),[d,p]=o.useState("home"),[u,m]=o.useState(!1),[h,b]=o.useState(null),x=y=>{b({title:y.title,price:y.price,shop:y.shop,category:y.category,url:y.url??void 0}),m(!0)},f=()=>{m(!1),b(null)},[g,j]=o.useState(!1),[M,W]=o.useState(()=>Rt()),[z,D]=o.useState(!1),[I,F]=o.useState(!1),[J,ne]=o.useState(!1),[B,$]=o.useState(()=>{try{return localStorage.getItem("denkzettel-cookie-ack")==="1"}catch{return!0}}),[H,re]=o.useState(null),ie=()=>{$(!0);try{localStorage.setItem("denkzettel-cookie-ack","1")}catch{}},A=En(),C=s.ui.dark?at.dark:at.light,G=o.useRef(null),K=y=>{y!==r&&p(r),f(),l(y);const w=pa(y);window.location.hash!==w&&window.history.pushState(null,"",w),D(!0),G.current?.scrollTo({top:0,behavior:"instant"}),setTimeout(()=>D(!1),150)};o.useEffect(()=>{G.current?.scrollTo({top:0})},[r]),o.useEffect(()=>{const y=()=>{m(!1),b(null),j(!1),l(Gt()??"home")};return window.addEventListener("popstate",y),window.addEventListener("hashchange",y),()=>{window.removeEventListener("popstate",y),window.removeEventListener("hashchange",y)}},[]),o.useEffect(()=>{if(!("serviceWorker"in navigator))return;const y="./sw.js",w=()=>{navigator.serviceWorker.register(y).then(E=>{E.addEventListener("updatefound",()=>{const P=E.installing;P&&P.addEventListener("statechange",()=>{P.state==="installed"&&navigator.serviceWorker.controller&&ne(!0)})})}).catch(E=>console.warn("SW registration failed:",E))};document.readyState==="complete"?w():window.addEventListener("load",w,{once:!0})},[]),o.useEffect(()=>{const y=document.querySelector('meta[name="theme-color"]:not([media])');y&&y.setAttribute("content",C.brand)},[C.brand]),o.useEffect(()=>{Cn(s.waitingItems)},[s.waitingItems]);const ue=o.useRef(!1);o.useEffect(()=>{if(ue.current||!window.location.search)return;const y=On(window.location.search);y&&(ue.current=!0,window.history.replaceState(null,"",window.location.pathname+window.location.hash),s.profile.onboarded&&x({title:y.title,url:y.url,price:y.price,shop:y.shop,category:y.category}))},[s.profile.onboarded]);const he=o.useRef(!1);o.useEffect(()=>{if(he.current||window.location.search||!s.profile.onboarded)return;const y=s.checkDraft;y&&Date.now()-y.updatedAt<24*60*60*1e3&&(he.current=!0,m(!0))},[s.profile.onboarded,s.checkDraft]),o.useEffect(()=>{if(!("serviceWorker"in navigator))return;const y=w=>{w.data?.type==="notification-click"&&j(!0)};return navigator.serviceWorker.addEventListener("message",y),()=>navigator.serviceWorker.removeEventListener("message",y)},[]),o.useEffect(()=>{const y=()=>{document.hidden||W(Rt())};return document.addEventListener("visibilitychange",y),()=>document.removeEventListener("visibilitychange",y)},[]),o.useEffect(()=>{const y=()=>F(!0);return window.addEventListener("denkzettel:quota-exceeded",y),()=>window.removeEventListener("denkzettel:quota-exceeded",y)},[]);const v=e.jsxs(e.Fragment,{children:[J&&e.jsxs("div",{className:"fixed inset-x-0 top-0 z-[80] flex items-center justify-center gap-3 px-4 py-2.5 text-[13px] font-medium shadow-md",style:{background:C.brand,color:"#fff",paddingTop:"calc(env(safe-area-inset-top, 0px) + 10px)"},children:[e.jsx("span",{children:"Neue Version verfügbar."}),e.jsx("button",{onClick:()=>window.location.reload(),className:"rounded-full px-3 py-1 text-[12px] font-semibold",style:{background:"#ffffff",color:C.brand},children:"Neu laden"})]}),!B&&e.jsx(ha,{t:C,onAccept:ie,onOpenDatenschutz:()=>re("datenschutz")}),H==="datenschutz"&&e.jsx("div",{className:"fixed inset-0 z-[60]",style:{background:C.bg},children:e.jsx(Ht,{t:C,onBack:()=>re(null)})}),H==="impressum"&&e.jsx("div",{className:"fixed inset-0 z-[60]",style:{background:C.bg},children:e.jsx(Ot,{t:C,onBack:()=>re(null)})})]});if(!s.profile.onboarded)return e.jsxs(e.Fragment,{children:[e.jsx(_t,{t:C,dark:s.ui.dark,children:i?e.jsx(ea,{t:C,onComplete:y=>{n.updateProfile({...y,onboarded:!0});const w=je(y.mode);n.setRulesActive(w.activeRuleIds)}}):e.jsx(ca,{t:C,dark:s.ui.dark,onStart:()=>c(!0),onQuickStart:()=>{n.updateProfile({onboarded:!0}),n.setRulesActive(je(s.profile.mode).activeRuleIds),m(!0)},onToggleDark:()=>n.setDark(!s.ui.dark),onOpenDatenschutz:()=>re("datenschutz"),onOpenImpressum:()=>re("impressum")}
356)}),v]});const k=[{id:"home",label:"Übersicht",icon:Qt},{id:"expenses",label:"Verlauf",icon:ns},{id:"check",label:"",icon:le,primary:!0},{id:"goals",label:"Ziele",icon:We},{id:"profile",label:"Profil",icon:as}];return e.jsxs(e.Fragment,{children:[e.jsxs(_t,{t:C,dark:s.ui.dark,sidebar:e.jsx(ya,{t:C,store:t,tab:r,checkOpen:u,notifPermission:M,dark:s.ui.dark,onNavigate:K,onCheckToggle:()=>{u?f():m(!0)},onNotifOpen:()=>j(!0),onToggleDark:()=>n.setDark(!s.ui.dark)}),children:[e.jsx("div",{className:"pt-[env(safe-area-inset-top)] md:hidden"}),I&&e.jsxs("div",{className:"mx-3 mt-2 flex items-center justify-between gap-2 rounded-2xl px-4 py-2.5 text-sm font-medium",style:{background:C.dangerSoft,color:C.danger},children:[e.jsx("span",{children:"Speicher voll — ältere Daten löschen oder exportieren"}),e.jsx("button",{onClick:()=>F(!1),"aria-label":"Warnung schließen",style:{color:C.danger},children:e.jsx(U,{size:14})})]}),e.jsxs("div",{className:`${u?"hidden":"md:hidden flex"} items-center justify-between px-5 pt-2 pb-1`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg",style:{background:C.brand},children:e.jsx(Le,{size:15,color:"#fff",strokeWidth:2.2})}),e.jsx("span",{className:"text-sm font-semibold tracking-tight",style:{color:C.text,fontFamily:"Fraunces, serif"},children:"Denkzettel"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Ns,{t:C,store:t}),e.jsx(Ss,{t:C,store:t,permission:M,onOpen:()=>j(!0)}),e.jsx("button",{onClick:()=>n.setDark(!s.ui.dark),className:"flex h-8 w-8 items-center justify-center rounded-full",style:{color:C.textMuted},"aria-label":s.ui.dark?"Light Mode":"Dark Mode",children:s.ui.dark?e.jsx(Ue,{size:16}):e.jsx(Ae,{size:16})})]})]}),e.jsx("div",{ref:G,className:"flex-1 overflow-y-auto px-5 pt-2 pb-[120px] md:pb-8",children:e.jsx("div",{className:"md:max-w-3xl md:mx-auto md:pt-4",children:e.jsx(ee,{mode:"wait",children:e.jsx(T.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0},transition:{duration:.2},children:u?e.jsx(Er,{t:C,store:t,onClose:f,initialItem:h}):!A||z?e.jsx(ba,{t:C,tab:r}):e.jsxs(e.Fragment,{children:[r==="home"&&e.jsx(mr,{t:C,store:t,onCheckPurchase:()=>m(!0),onOpenRules:()=>K("rules"),onOpenMode:()=>K("mode"),onOpenExpenses:()=>K("expenses")}),r==="expenses"&&e.jsx(Lr,{t:C,store:t,onCheckInstead:x}),r==="rules"&&e.jsx(Kr,{t:C,store:t,onBack:()=>K(d==="rules"?"home":d)}),r==="mode"&&e.jsx(ua,{t:C,store:t,onBack:()=>K(d==="mode"?"home":d)}),r==="goals"&&e.jsx(Vr,{t:C,store:t}),r==="profile"&&e.jsx(Xr,{t:C,store:t,sync:a,onOpenRules:()=>K("rules"),onOpenMode:()=>K("mode"),onOpenImpressum:()=>K("impressum"),onOpenDatenschutz:()=>K("datenschutz")}),r==="impressum"&&e.jsx(Ot,{t:C,onBack:()=>K(d==="impressum"?"profile":d)}),r==="datenschutz"&&e.jsx(Ht,{t:C,onBack:()=>K(d==="datenschutz"?"profile":d)}),r==="admin"&&e.jsx(ma,{t:C,sync:a,onBack:()=>K("profile")})]})},u?"check":r)})})}),e.jsx("div",{className:"md:hidden absolute inset-x-0 bottom-0 px-3 pt-2",style:{paddingBottom:"calc(16px + env(safe-area-inset-bottom))",background:s.ui.dark?"linear-gradient(to top, rgba(14,20,17,1) 70%, rgba(14,20,17,0))":"linear-gradient(to top, rgba(247,248,245,1) 70%, rgba(247,248,245,0))"},children:e.jsx("div",{className:"flex items-end justify-around rounded-3xl px-2 py-2",style:{background:C.surface,border:`1px solid ${C.border}`,boxShadow:"0 -2px 16px -4px rgba(0,0,0,0.05)"},children:k.map(y=>{if(y.primary){const E=u;return e.jsx("button",{onClick:()=>{u?f():m(!0)},className:"-mt-7 flex h-14 w-14 items-center justify-center rounded-2xl shadow-lg transition active:scale-95",style:{background:E?C.danger:C.brand,boxShadow:`0 10px 24px -6px ${E?C.danger:C.brand}80`},"aria-label":E?"Check abbrechen":"Kauf prüfen",children:E?e.jsx(U,{size:26,color:"#fff",strokeWidth:2.5}):e.jsx(y.icon,{size:26,color:"#fff",strokeWidth:2.3})},y.id)}const w=!u&&r===y.id;return e.jsxs("button",{onClick:()=>K(y.id),className:"flex flex-1 flex-col items-center gap-0.5 px-1 py-1.5 transition",style:{color:w?C.brand:C.textSoft},children:[e.jsx(y.icon,{size:19,strokeWidth:w?2.4:1.8}),e.jsx("span",{className:"text-[13px] font-semibold tracking-wide",children:y.label})]},y.id)})})}),e.jsx(ee,{children:g&&e.jsx(ja,{t:C,store:t,permission:M,onPermissionChange:W,onClose:()=>j(!1)})})]}),v]})}function ba({t,tab:s}){return s==="expenses"?e.jsx(_n,{t}):s==="goals"?e.jsx(Vn,{t}):s==="profile"?e.jsx(Un,{t}):s==="rules"?e.jsx(qn,{t}):e.jsx(Gn,{t})}function ya({t,store:s,tab:n,checkOpen:a,notifPermission:r,dark:l,onNavigate:i,onCheckToggle:c,onNotifOpen:d,onToggleDark:p}){const u=[{id:"home",label:"Übersicht",icon:Qt},{id:"expenses",label:"Verlauf",icon:ns},{id:"goals",label:"Ziele",icon:We},{id:"profile",label:"Profil",icon:as}];return e.jsxs("aside",{className:"hidden md:flex flex-col w-60 shrink-0 border-r",style:{background:t.surface,borderColor:t.border},children:[e.jsxs("div",{className:"flex items-center gap-2.5 px-5 py-5",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg",style:{background:t.brand},children:e.jsx(Le,{size:16,color:"#fff",strokeWidth:2.2})}),e.jsx("span",{className:"text-base font-semibold tracking-tight",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Denkzettel"})]}),e.jsx("div",{className:"px-3 mb-3",children:e.jsxs("button",{onClick:c,className:"flex w-full items-center gap-3 rounded-xl px-4 py-3 text-sm font-semibold transition active:scale-95",style:{background:a?t.danger:t.brand,color:"#fff"},"aria-label":a?"Check abbrechen":"Kauf prüfen",children:[a?e.jsx(U,{size:18}):e.jsx(le,{size:18}),a?"Abbrechen":"Kauf prüfen"]})}),e.jsx("nav",{className:"flex-1 px-3 space-y-0.5",children:u.map(m=>{const h=!a&&n===m.id,b=m.icon;return e.jsxs("button",{onClick:()=>i(m.id),className:"flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-sm transition",style:{background:h?t.brandSoft:"transparent",color:h?t.brand:t.textMuted,fontWeight:h?600:400},children:[e.jsx(b,{size:17,strokeWidth:h?2.4:1.8}),m.label]},m.id)})}),e.jsxs("div",{className:"flex items-center gap-1 px-4 py-4 border-t",style:{borderColor:t.border},children:[e.jsx(Ns,{t,store:s}),e.jsx(Ss,{t,store:s,permission:r,onOpen:d}),e.jsx("button",{onClick:p,className:"ml-auto flex h-8 w-8 items-center justify-center rounded-full",style:{color:t.textMuted},"aria-label":l?"Light Mode":"Dark Mode",children:l?e.jsx(Ue,{size:16}):e.jsx(Ae,{size:16})})]})]})}function Ns({t,store:s}){const n=s.state.rules.find(c=>c.kind==="stress-mode"),[a,r]=o.useState(0);if(!n)return null;const l=n.active,i=()=>{const c=!l;s.actions.toggleRule(n.id),c&&r(d=>d+1)};return e.jsxs("button",{onClick:i,className:"relative flex h-8 w-8 items-center justify-center rounded-full transition",style:{background:l?t.danger:`${t.text}10`,color:l?"#fff":t.textMuted},"aria-label":l?"Stress-Modus deaktivieren":"Stress-Modus aktivieren",title:"Notfall: Käufe blockieren",children:[e.jsx($s,{size:16,strokeWidth:l?2.5:2}),l&&a>0&&e.jsx(T.span,{className:"absolute inset-0 rounded-full pointer-events-none",style:{background:t.danger}
356,initial:{scale:1,opacity:.55},animate:{scale:1.9,opacity:0},transition:{duration:.9,ease:"easeOut"}},a)]})}function Ss({t,store:s,permission:n,onOpen:a}){const r=kt(5e3),l=o.useMemo(()=>s.state.waitingItems.filter(c=>c.status==="waiting"&&c.endsAt!=null&&c.endsAt<=r).length,[s.state.waitingItems,r]),i=l>0||n==="default"&&De();return e.jsxs("button",{onClick:a,className:"relative flex h-8 w-8 items-center justify-center rounded-full",style:{color:t.textMuted},"aria-label":"Benachrichtigungen",children:[e.jsx(qt,{size:16}),i&&e.jsx("span",{className:"absolute -right-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-full text-[13px] font-bold px-1",style:{background:l>0?t.brand:t.gold,color:"#fff"},children:l>0?l:"!"})]})}function ja({t,store:s,permission:n,onPermissionChange:a,onClose:r}){const{state:l,actions:i}=s,c=kt(1e3),d=o.useRef(null);o.useEffect(()=>{const h=document.activeElement;d.current?.focus();const b=x=>{x.key==="Escape"&&r()};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b),h?.focus()}},[r]);const p=l.waitingItems.filter(h=>h.status==="waiting"&&h.endsAt!=null&&h.endsAt<=c),u=l.waitingItems.filter(h=>h.status==="waiting"&&(h.endsAt===null||h.endsAt>c)).sort((h,b)=>h.endsAt===null?1:b.endsAt===null?-1:h.endsAt-b.endsAt).slice(0,5),m=async()=>{const h=await ms();a(h)};return e.jsx(T.div,{initial:{opacity:0}
356,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-end md:items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:r,children:e.jsxs(T.div,{initial:{y:40},animate:{y:0},exit:{y:40},transition:{duration:.3,ease:[.16,1,.3,1]},onClick:h=>h.stopPropagation(),className:"w-full max-w-[420px] rounded-t-3xl md:rounded-3xl p-5 pb-8 space-y-4 max-h-[80vh] overflow-y-auto",style:{background:t.bg},role:"dialog","aria-modal":"true","aria-label":"Benachrichtigungen",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-xl font-semibold",style:{color:t.text,fontFamily:"Fraunces, serif"},children:"Benachrichtigungen"}),e.jsx("button",{ref:d,onClick:r,style:{color:t.textMuted},"aria-label":"Schließen",children:e.jsx(U,{size:20})})]}),De()&&n!=="granted"&&e.jsxs("div",{className:"rounded-2xl p-4 space-y-3",style:{background:t.goldSoft},children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(qt,{size:16,style:{color:t.gold,flexShrink:0,marginTop:2}}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:t.text},children:n==="denied"?"Benachrichtigungen blockiert":"Push-Benachrichtigungen aktivieren"}),e.jsx("div",{className:"mt-0.5 text-sm leading-relaxed",style:{color:t.textMuted},children:n==="denied"?"Erlaube Benachrichtigungen in den Browser-Einstellungen, um über Wartezeit-Ende informiert zu werden.":"Erhalte eine Erinnerung, wenn eine Wartezeit abgelaufen ist — auch wenn die App im Hintergrund läuft."})]})]}),n==="default"&&e.jsx("button",{onClick:m,className:"w-full rounded-xl py-2.5 text-sm font-semibold",style:{background:t.gold,color:"#fff"},children:"Aktivieren"})]}),p.length===0&&u.length===0&&e.jsxs("div",{className:"rounded-2xl p-8 text-center",style:{background:t.surface,border:`1px solid ${t.border}`},children:[e.jsx("div",{className:"text-4xl mb-2",children:"🔕"}),e.jsx("div",{className:"text-sm font-medium",style:{color:t.text},children:"Keine offenen Wartezeiten"}),e.jsx("div",{className:"text-sm mt-1",style:{color:t.textMuted},children:"Sobald du etwas in Wartezeit schickst, taucht es hier auf."})]}),p.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2 px-1 text-[13px] uppercase tracking-wider font-semibold",style:{color:t.brand},children:["Wartezeit beendet · ",p.length]}),e.jsx("div",{className:"rounded-2xl overflow-hidden",style:{background:t.surface,border:`1px solid ${t.border}`},children:p.map((h,b)=>e.jsxs("div",{className:"flex items-center gap-3 p-3",style:{borderBottom:b<p.length-1?`1px solid ${t.border}`:"none"},children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-lg",style:{background:t.brandSoft},children:"✅"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-medium",style:{color:t.text},children:h.title}),e.jsxs("div",{className:"text-[13px]",style:{color:t.brand,fontWeight:600},children:[h.price.toFixed(0)," € · Entscheide jetzt"]})]}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx("button",{onClick:()=>{i.resolveWaitingItem(h.id,"dismiss"),He(h.id)},className:"flex h-8 w-8 items-center justify-center rounded-lg",style:{background:t.dangerSoft,color:t.danger},"aria-label":"Verwerfen",children:e.jsx(U,{size:14})}),e.jsx("button",{onClick:()=>i.snoozeWaitingItem(h.id,24),className:"flex h-8 w-8 items-center justify-center rounded-lg",style:{background:t.coolSoft,color:t.cool},"aria-label":"Nochmal drüber schlafen",title:"Nochmal 24 h",children:e.jsx(Ae,{size:14})}),e.jsx("button",{onClick:()=>{i.resolveWaitingItem(h.id,"buy"),He(h.id)},className:"flex h-8 w-8 items-center justify-center rounded-lg",style:{background:t.brand,color:"#fff"},"aria-label":"Kaufen",children:e.jsx(te,{size:14})})]})]},h.id))})]}),u.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 px-1 text-[13px] uppercase tracking-wider font-semibold",style:{color:t.textSoft},children:"Anstehend"}),e.jsx("div",{className:"rounded-2xl overflow-hidden",style:{background:t.surface,border:`1px solid ${t.border}`},children:u.map((h,b)=>{const x=hs(h.endsAt,c);return e.jsxs("div",{className:"flex items-center gap-3 p-3",style:{borderBottom:b<u.length-1?`1px solid ${t.border}`:"none"},children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl",style:{background:t.coolSoft,color:t.cool},children:e.jsx(Ee,{size:16})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-medium",style:{color:t.text},children:h.title}),e.jsxs("div",{className:"text-[13px]",style:{color:t.textMuted},children:[h.price.toFixed(0)," € · ",x.label]})]})]}
356,h.id)})})]}),!De()&&e.jsx("div",{className:"text-[12px] text-center",style:{color:t.textSoft},children:"Dieser Browser unterstützt keine Notifications."})]})})}function _t({t,dark:s,children:n,sidebar:a}){return e.jsxs("div",{className:"flex w-full items-center justify-center p-0 sm:p-6 md:items-stretch md:justify-start md:p-0",style:{background:s?"#070A08":"#EAECE6",fontFamily:"ui-sans-serif, system-ui, -apple-system, sans-serif",minHeight:"100dvh",height:"100dvh"},children:[a,e.jsx("div",{className:"relative w-full overflow-hidden flex flex-col sm:max-w-[420px] sm:rounded-[40px] sm:shadow-2xl md:flex-1 md:max-w-none md:rounded-none md:shadow-none",style:{background:t.bg,minHeight:"100dvh",height:"100dvh",maxHeight:"100dvh",border:`1px solid ${t.border}`},children:n})]})}class ka extends _e.Component{constructor(s){super(s),this.state={error:null}}static getDerivedStateFromError(s){return{error:s}}componentDidCatch(s,n){console.error("[ErrorBoundary]",s,n.componentStack)}render(){return this.state.error?e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100dvh",padding:"2rem",textAlign:"center",fontFamily:"system-ui, sans-serif",background:"#0f0f0f",color:"#f5f5f5"},children:[e.jsx("div",{style:{fontSize:"2.5rem",marginBottom:"1rem"},children:"💥"}),e.jsx("h1",{style:{fontSize:"1.25rem",fontWeight:700,marginBottom:"0.5rem"},children:"Etwas ist schiefgelaufen"}),e.jsx("p",{style:{fontSize:"0.875rem",color:"#999",marginBottom:"1.5rem",maxWidth:"300px"},children:this.state.error.message||"Unbekannter Fehler"}),e.jsx("button",{onClick:()=>this.setState({error:null}),style:{padding:"0.625rem 1.25rem",borderRadius:"0.75rem",border:"none",background:"#6c47ff",color:"#fff",fontSize:"0.875rem",fontWeight:600,cursor:"pointer"},children:"Nochmal versuchen"})]}):this.props.children}}const zs=document.getElementById("root");if(!zs)throw new Error("Root element not found");Vt(zs).render(e.jsx(_e.StrictMode,{children:e.jsx(ka,{children:e.jsx(ga,{})})}));

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.