@leadertechie/personal-site-kit 0.1.0-alpha.6 → 0.1.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/api/handlers/about-me.d.ts.map +1 -1
  2. package/dist/api/handlers/auth-handler.d.ts.map +1 -1
  3. package/dist/api/website-api.d.ts.map +1 -1
  4. package/dist/api.js +2 -2
  5. package/dist/chunks/index-CGvOrVf8.js +213 -0
  6. package/dist/chunks/{index-C3wLSCKU.js → index-CYd_Pe2U.js} +1353 -482
  7. package/dist/chunks/{template-MawmknFQ.js → template-D1uGvdWZ.js} +10 -8
  8. package/dist/chunks/{website-api-DI3muo2s.js → website-api-FLejlWxJ.js} +78 -41
  9. package/dist/index.js +19 -9
  10. package/dist/prerender/data-fetcher.d.ts +19 -0
  11. package/dist/prerender/data-fetcher.d.ts.map +1 -0
  12. package/dist/prerender/page-content.d.ts.map +1 -1
  13. package/dist/prerender/page-generators/about.d.ts +16 -0
  14. package/dist/prerender/page-generators/about.d.ts.map +1 -0
  15. package/dist/prerender/page-generators/base.d.ts +26 -0
  16. package/dist/prerender/page-generators/base.d.ts.map +1 -0
  17. package/dist/prerender/page-generators/blog-detail.d.ts +15 -0
  18. package/dist/prerender/page-generators/blog-detail.d.ts.map +1 -0
  19. package/dist/prerender/page-generators/blogs-list.d.ts +17 -0
  20. package/dist/prerender/page-generators/blogs-list.d.ts.map +1 -0
  21. package/dist/prerender/page-generators/home.d.ts +19 -0
  22. package/dist/prerender/page-generators/home.d.ts.map +1 -0
  23. package/dist/prerender/page-generators/index.d.ts +9 -0
  24. package/dist/prerender/page-generators/index.d.ts.map +1 -0
  25. package/dist/prerender/page-generators/not-found.d.ts +14 -0
  26. package/dist/prerender/page-generators/not-found.d.ts.map +1 -0
  27. package/dist/prerender/page-generators/stories-list.d.ts +17 -0
  28. package/dist/prerender/page-generators/stories-list.d.ts.map +1 -0
  29. package/dist/prerender/page-generators/story-detail.d.ts +15 -0
  30. package/dist/prerender/page-generators/story-detail.d.ts.map +1 -0
  31. package/dist/prerender.js +109 -102
  32. package/dist/shared/config/index.d.ts.map +1 -1
  33. package/dist/shared.js +1 -1
  34. package/dist/ui/about-me/index.d.ts +2 -10
  35. package/dist/ui/about-me/index.d.ts.map +1 -1
  36. package/dist/ui/admin/api.d.ts +16 -0
  37. package/dist/ui/admin/api.d.ts.map +1 -0
  38. package/dist/ui/admin/components/AboutMeSection.d.ts +7 -0
  39. package/dist/ui/admin/components/AboutMeSection.d.ts.map +1 -0
  40. package/dist/ui/admin/components/AdminSection.d.ts +13 -0
  41. package/dist/ui/admin/components/AdminSection.d.ts.map +1 -0
  42. package/dist/ui/admin/components/BlogsSection.d.ts +7 -0
  43. package/dist/ui/admin/components/BlogsSection.d.ts.map +1 -0
  44. package/dist/ui/admin/components/HomeSection.d.ts +7 -0
  45. package/dist/ui/admin/components/HomeSection.d.ts.map +1 -0
  46. package/dist/ui/admin/components/ImagesSection.d.ts +7 -0
  47. package/dist/ui/admin/components/ImagesSection.d.ts.map +1 -0
  48. package/dist/ui/admin/components/LoginForm.d.ts +9 -0
  49. package/dist/ui/admin/components/LoginForm.d.ts.map +1 -0
  50. package/dist/ui/admin/components/LogoSection.d.ts +7 -0
  51. package/dist/ui/admin/components/LogoSection.d.ts.map +1 -0
  52. package/dist/ui/admin/components/ProfileSection.d.ts +7 -0
  53. package/dist/ui/admin/components/ProfileSection.d.ts.map +1 -0
  54. package/dist/ui/admin/components/StaticSection.d.ts +13 -0
  55. package/dist/ui/admin/components/StaticSection.d.ts.map +1 -0
  56. package/dist/ui/admin/components/StoriesSection.d.ts +7 -0
  57. package/dist/ui/admin/components/StoriesSection.d.ts.map +1 -0
  58. package/dist/ui/admin/components/index.d.ts +11 -0
  59. package/dist/ui/admin/components/index.d.ts.map +1 -0
  60. package/dist/ui/admin/index.d.ts +10 -26
  61. package/dist/ui/admin/index.d.ts.map +1 -1
  62. package/dist/ui/admin/types.d.ts +24 -0
  63. package/dist/ui/admin/types.d.ts.map +1 -0
  64. package/dist/ui/blog-viewer/index.d.ts.map +1 -1
  65. package/dist/ui/index.d.ts.map +1 -1
  66. package/dist/ui/story-viewer/index.d.ts.map +1 -1
  67. package/dist/ui.js +14 -4
  68. package/package.json +1 -1
  69. package/src/api/handlers/about-me.ts +19 -9
  70. package/src/api/handlers/auth-handler.ts +41 -18
  71. package/src/api/handlers/content.ts +1 -1
  72. package/src/api/handlers/home.ts +2 -2
  73. package/src/api/website-api.ts +25 -13
  74. package/src/prerender/__tests__/page-content.test.ts +1 -11
  75. package/src/prerender/data-fetcher.ts +93 -0
  76. package/src/prerender/page-content.ts +109 -106
  77. package/src/prerender/page-generators/about.ts +38 -0
  78. package/src/prerender/page-generators/base.ts +77 -0
  79. package/src/prerender/page-generators/blog-detail.ts +35 -0
  80. package/src/prerender/page-generators/blogs-list.ts +43 -0
  81. package/src/prerender/page-generators/home.ts +54 -0
  82. package/src/prerender/page-generators/index.ts +8 -0
  83. package/src/prerender/page-generators/not-found.ts +36 -0
  84. package/src/prerender/page-generators/stories-list.ts +43 -0
  85. package/src/prerender/page-generators/story-detail.ts +35 -0
  86. package/src/shared/config/index.ts +4 -2
  87. package/src/shared/page-content.ts +1 -1
  88. package/src/shared/router.ts +5 -5
  89. package/src/ui/about-me/index.ts +23 -57
  90. package/src/ui/admin/api.ts +93 -0
  91. package/src/ui/admin/components/AboutMeSection.ts +47 -0
  92. package/src/ui/admin/components/AdminSection.ts +134 -0
  93. package/src/ui/admin/components/BlogsSection.ts +62 -0
  94. package/src/ui/admin/components/HomeSection.ts +47 -0
  95. package/src/ui/admin/components/ImagesSection.ts +54 -0
  96. package/src/ui/admin/components/LoginForm.ts +116 -0
  97. package/src/ui/admin/components/LogoSection.ts +51 -0
  98. package/src/ui/admin/components/ProfileSection.ts +47 -0
  99. package/src/ui/admin/components/StaticSection.ts +67 -0
  100. package/src/ui/admin/components/StoriesSection.ts +62 -0
  101. package/src/ui/admin/components/index.ts +10 -0
  102. package/src/ui/admin/index.ts +192 -434
  103. package/src/ui/admin/types.ts +26 -0
  104. package/src/ui/blog-viewer/index.ts +4 -1
  105. package/src/ui/index.ts +7 -0
  106. package/src/ui/story-viewer/index.ts +4 -1
  107. package/dist/ui/about-me/renderer.d.ts +0 -5
  108. package/dist/ui/about-me/renderer.d.ts.map +0 -1
  109. package/src/ui/about-me/renderer.ts +0 -7
@@ -84,76 +84,69 @@ const aboutmeStyles = css`
84
84
  font-family: Arial, sans-serif;
85
85
  }
86
86
  `;
87
- class AboutMeRenderer {
88
- renderContent(nodes) {
89
- return nodes;
90
- }
91
- }
92
87
  async function fetchAboutMe(url) {
93
88
  const res = await fetch(`${url}/api/aboutme`);
94
89
  if (!res.ok) throw new Error("Failed to fetch");
95
90
  return res.json();
96
91
  }
97
- var __create$5 = Object.create;
98
- var __defProp$5 = Object.defineProperty;
99
- var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
100
- var __knownSymbol$5 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
101
- var __typeError$5 = (msg) => {
92
+ var __create$f = Object.create;
93
+ var __defProp$f = Object.defineProperty;
94
+ var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
95
+ var __knownSymbol$f = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
96
+ var __typeError$f = (msg) => {
102
97
  throw TypeError(msg);
103
98
  };
104
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
105
- var __name$5 = (target, value) => __defProp$5(target, "name", { value, configurable: true });
106
- var __decoratorStart$5 = (base) => [, , , __create$5(base?.[__knownSymbol$5("metadata")] ?? null)];
107
- var __decoratorStrings$5 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
108
- var __expectFn$5 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$5("Function expected") : fn;
109
- var __decoratorContext$5 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$5[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$5("Already initialized") : fns.push(__expectFn$5(fn || null)) });
110
- var __decoratorMetadata$5 = (array, target) => __defNormalProp$5(target, __knownSymbol$5("metadata"), array[3]);
111
- var __runInitializers$5 = (array, flags, self, value) => {
99
+ var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
100
+ var __name$e = (target, value) => __defProp$f(target, "name", { value, configurable: true });
101
+ var __decoratorStart$f = (base) => [, , , __create$f(base?.[__knownSymbol$f("metadata")] ?? null)];
102
+ var __decoratorStrings$f = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
103
+ var __expectFn$f = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$f("Function expected") : fn;
104
+ var __decoratorContext$f = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$f[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$f("Already initialized") : fns.push(__expectFn$f(fn || null)) });
105
+ var __decoratorMetadata$f = (array, target) => __defNormalProp$f(target, __knownSymbol$f("metadata"), array[3]);
106
+ var __runInitializers$f = (array, flags, self, value) => {
112
107
  for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) flags & 1 ? fns[i2].call(self) : value = fns[i2].call(self, value);
113
108
  return value;
114
109
  };
115
- var __decorateElement$5 = (array, flags, name, decorators, target, extra) => {
110
+ var __decorateElement$f = (array, flags, name, decorators, target, extra) => {
116
111
  var fn, it, done, ctx, access, k2 = flags & 7, s2 = !!(flags & 8), p2 = !!(flags & 16);
117
- var j = k2 > 3 ? array.length + 1 : k2 ? s2 ? 1 : 2 : 0, key = __decoratorStrings$5[k2 + 5];
112
+ var j = k2 > 3 ? array.length + 1 : k2 ? s2 ? 1 : 2 : 0, key = __decoratorStrings$f[k2 + 5];
118
113
  var initializers = k2 > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
119
- var desc = k2 && (!p2 && !s2 && (target = target.prototype), k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$5(k2 < 4 ? target : { get [name]() {
120
- return __privateGet$4(this, extra);
114
+ var desc = k2 && (!p2 && !s2 && (target = target.prototype), k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$f(k2 < 4 ? target : { get [name]() {
115
+ return __privateGet$7(this, extra);
121
116
  }, set [name](x) {
122
- return __privateSet$4(this, extra, x);
117
+ return __privateSet$7(this, extra, x);
123
118
  } }, name));
124
- k2 ? p2 && k2 < 4 && __name$5(extra, (k2 > 2 ? "set " : k2 > 1 ? "get " : "") + name) : __name$5(target, name);
119
+ k2 ? p2 && k2 < 4 && __name$e(extra, (k2 > 2 ? "set " : k2 > 1 ? "get " : "") + name) : __name$e(target, name);
125
120
  for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
126
- ctx = __decoratorContext$5(k2, name, done = {}, array[3], extraInitializers);
121
+ ctx = __decoratorContext$f(k2, name, done = {}, array[3], extraInitializers);
127
122
  if (k2) {
128
- ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn$4(target, x) : (x) => name in x };
129
- if (k2 ^ 3) access.get = p2 ? (x) => (k2 ^ 1 ? __privateGet$4 : __privateMethod$4)(x, target, k2 ^ 4 ? extra : desc.get) : (x) => x[name];
130
- if (k2 > 2) access.set = p2 ? (x, y2) => __privateSet$4(x, target, y2, k2 ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
123
+ ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn$6(target, x) : (x) => name in x };
124
+ if (k2 ^ 3) access.get = p2 ? (x) => (k2 ^ 1 ? __privateGet$7 : __privateMethod$6)(x, target, k2 ^ 4 ? extra : desc.get) : (x) => x[name];
125
+ if (k2 > 2) access.set = p2 ? (x, y2) => __privateSet$7(x, target, y2, k2 ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
131
126
  }
132
127
  it = (0, decorators[i2])(k2 ? k2 < 4 ? p2 ? extra : desc[key] : k2 > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
133
- if (k2 ^ 4 || it === void 0) __expectFn$5(it) && (k2 > 4 ? initializers.unshift(it) : k2 ? p2 ? extra = it : desc[key] = it : target = it);
134
- else if (typeof it !== "object" || it === null) __typeError$5("Object expected");
135
- else __expectFn$5(fn = it.get) && (desc.get = fn), __expectFn$5(fn = it.set) && (desc.set = fn), __expectFn$5(fn = it.init) && initializers.unshift(fn);
128
+ if (k2 ^ 4 || it === void 0) __expectFn$f(it) && (k2 > 4 ? initializers.unshift(it) : k2 ? p2 ? extra = it : desc[key] = it : target = it);
129
+ else if (typeof it !== "object" || it === null) __typeError$f("Object expected");
130
+ else __expectFn$f(fn = it.get) && (desc.get = fn), __expectFn$f(fn = it.set) && (desc.set = fn), __expectFn$f(fn = it.init) && initializers.unshift(fn);
136
131
  }
137
- return k2 || __decoratorMetadata$5(array, target), desc && __defProp$5(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
132
+ return k2 || __decoratorMetadata$f(array, target), desc && __defProp$f(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
138
133
  };
139
- var __accessCheck$4 = (obj, member, msg) => member.has(obj) || __typeError$5("Cannot " + msg);
140
- var __privateIn$4 = (member, obj) => Object(obj) !== obj ? __typeError$5('Cannot use the "in" operator on this value') : member.has(obj);
141
- var __privateGet$4 = (obj, member, getter) => (__accessCheck$4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
142
- var __privateAdd$4 = (obj, member, value) => member.has(obj) ? __typeError$5("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
143
- var __privateSet$4 = (obj, member, value, setter) => (__accessCheck$4(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
144
- var __privateMethod$4 = (obj, member, method) => (__accessCheck$4(obj, member, "access private method"), method);
145
- var _loading_dec$2, _contentNodes_dec, _profile_dec, _baseUrl_dec, _a$5, _MyAboutme_decorators, _init$5, _baseUrl, _profile, _contentNodes, _loading$2;
134
+ var __accessCheck$7 = (obj, member, msg) => member.has(obj) || __typeError$f("Cannot " + msg);
135
+ var __privateIn$6 = (member, obj) => Object(obj) !== obj ? __typeError$f('Cannot use the "in" operator on this value') : member.has(obj);
136
+ var __privateGet$7 = (obj, member, getter) => (__accessCheck$7(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
137
+ var __privateAdd$7 = (obj, member, value) => member.has(obj) ? __typeError$f("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
138
+ var __privateSet$7 = (obj, member, value, setter) => (__accessCheck$7(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
139
+ var __privateMethod$6 = (obj, member, method) => (__accessCheck$7(obj, member, "access private method"), method);
140
+ var _loading_dec$2, _htmlContent_dec, _profile_dec, _baseUrl_dec, _a$f, _MyAboutme_decorators, _init$f, _baseUrl, _profile, _htmlContent, _loading$2;
146
141
  _MyAboutme_decorators = [customElement("my-aboutme")];
147
- class MyAboutme extends (_a$5 = LitElement, _baseUrl_dec = [property({ type: String })], _profile_dec = [state()], _contentNodes_dec = [state()], _loading_dec$2 = [state()], _a$5) {
148
- constructor(renderer) {
142
+ class MyAboutme extends (_a$f = LitElement, _baseUrl_dec = [property({ type: String })], _profile_dec = [state()], _htmlContent_dec = [state()], _loading_dec$2 = [state()], _a$f) {
143
+ constructor() {
149
144
  super();
150
- __privateAdd$4(this, _baseUrl, __runInitializers$5(_init$5, 8, this, "")), __runInitializers$5(_init$5, 11, this);
151
- __privateAdd$4(this, _profile, __runInitializers$5(_init$5, 12, this, null)), __runInitializers$5(_init$5, 15, this);
152
- __privateAdd$4(this, _contentNodes, __runInitializers$5(_init$5, 16, this, [])), __runInitializers$5(_init$5, 19, this);
153
- __privateAdd$4(this, _loading$2, __runInitializers$5(_init$5, 20, this, true)), __runInitializers$5(_init$5, 23, this);
154
- this.renderer = void 0;
145
+ __privateAdd$7(this, _baseUrl, __runInitializers$f(_init$f, 8, this, "")), __runInitializers$f(_init$f, 11, this);
146
+ __privateAdd$7(this, _profile, __runInitializers$f(_init$f, 12, this, null)), __runInitializers$f(_init$f, 15, this);
147
+ __privateAdd$7(this, _htmlContent, __runInitializers$f(_init$f, 16, this, "")), __runInitializers$f(_init$f, 19, this);
148
+ __privateAdd$7(this, _loading$2, __runInitializers$f(_init$f, 20, this, true)), __runInitializers$f(_init$f, 23, this);
155
149
  this.fetcher = fetchAboutMe;
156
- this.renderer = renderer || new AboutMeRenderer();
157
150
  }
158
151
  get apiBaseUrl() {
159
152
  return this.baseUrl || this.getAttribute("base-url") || "";
@@ -163,34 +156,33 @@ class MyAboutme extends (_a$5 = LitElement, _baseUrl_dec = [property({ type: Str
163
156
  if (typeof window !== "undefined" && window.__HYDRATION_DATA__) {
164
157
  const hydrationData = window.__HYDRATION_DATA__;
165
158
  this.profile = hydrationData.profile;
166
- this.contentNodes = hydrationData.contentNodes;
159
+ this.htmlContent = hydrationData.processedMarkdown;
167
160
  this.loading = false;
168
161
  return;
169
162
  }
170
- const url = this.apiBaseUrl;
171
- if (url) {
172
- this.loadContent();
173
- }
163
+ this.loadContent();
174
164
  }
175
165
  updated(changedProperties) {
176
166
  super.updated(changedProperties);
177
- if (this.loading === false && this.profile && this.contentNodes.length > 0) {
167
+ if (this.loading === false && this.profile && this.htmlContent) {
178
168
  return;
179
169
  }
180
170
  if (changedProperties.has("baseUrl") || changedProperties.has("base-url")) {
181
- const url = this.apiBaseUrl;
182
- if (url) {
183
- this.loadContent();
184
- }
171
+ this.loadContent();
185
172
  }
186
173
  }
187
174
  async loadContent() {
175
+ const url = this.apiBaseUrl;
176
+ if (!url) {
177
+ this.loading = false;
178
+ this.setFallbackContent();
179
+ return;
180
+ }
188
181
  try {
189
182
  this.loading = true;
190
- const url = this.apiBaseUrl;
191
183
  const data = await this.fetcher(url);
192
184
  this.profile = data.profile;
193
- this.contentNodes = data.contentNodes;
185
+ this.htmlContent = data.processedMarkdown;
194
186
  this.loading = false;
195
187
  await this.updateComplete;
196
188
  } catch (error) {
@@ -201,22 +193,18 @@ class MyAboutme extends (_a$5 = LitElement, _baseUrl_dec = [property({ type: Str
201
193
  }
202
194
  setFallbackContent() {
203
195
  this.profile = null;
204
- this.contentNodes = [
205
- {
206
- type: "paragraph",
207
- content: "Unable to Load Content"
208
- }
209
- ];
196
+ this.htmlContent = `
197
+ <h2>Profile Not Found</h2>
198
+ <p>Your about-me profile has not been initialized yet. Please run the seed command to get started:</p>
199
+ <pre>npm run seed -- &lt;username&gt; '&lt;password&gt;'</pre>
200
+ `;
210
201
  }
211
202
  render() {
212
203
  if (this.loading) {
213
204
  return html`<div class="aboutme"><div class="loading">Loading...</div></div>`;
214
205
  }
215
206
  if (!this.profile) {
216
- if (this.contentNodes && this.contentNodes.length > 0) {
217
- return html`<div class="aboutme">${this.renderer.renderContent(this.contentNodes)}</div>`;
218
- }
219
- return html`<div class="aboutme"><div class="loading">Failed to load content</div></div>`;
207
+ return html`<div class="aboutme"><div class="content-section" .innerHTML="${this.htmlContent}"></div></div>`;
220
208
  }
221
209
  const profileImageUrl = this.profile.profileImageUrl ? this.profile.profileImageUrl.startsWith("http") || this.profile.profileImageUrl.startsWith("/") ? this.profile.profileImageUrl : `images/${this.profile.profileImageUrl}` : "";
222
210
  return html`
@@ -229,25 +217,23 @@ class MyAboutme extends (_a$5 = LitElement, _baseUrl_dec = [property({ type: Str
229
217
  <h1>${this.profile.name}</h1>
230
218
  <p class="profile-title">${this.profile.title} • ${this.profile.experience}</p>
231
219
  </div>
232
- <div class="content-section">
233
- ${this.renderer.renderContent(this.contentNodes)}
234
- </div>
220
+ <div class="content-section" .innerHTML="${this.htmlContent}"></div>
235
221
  </div>
236
222
  `;
237
223
  }
238
224
  }
239
- _init$5 = __decoratorStart$5(_a$5);
225
+ _init$f = __decoratorStart$f(_a$f);
240
226
  _baseUrl = /* @__PURE__ */ new WeakMap();
241
227
  _profile = /* @__PURE__ */ new WeakMap();
242
- _contentNodes = /* @__PURE__ */ new WeakMap();
228
+ _htmlContent = /* @__PURE__ */ new WeakMap();
243
229
  _loading$2 = /* @__PURE__ */ new WeakMap();
244
- __decorateElement$5(_init$5, 4, "baseUrl", _baseUrl_dec, MyAboutme, _baseUrl);
245
- __decorateElement$5(_init$5, 4, "profile", _profile_dec, MyAboutme, _profile);
246
- __decorateElement$5(_init$5, 4, "contentNodes", _contentNodes_dec, MyAboutme, _contentNodes);
247
- __decorateElement$5(_init$5, 4, "loading", _loading_dec$2, MyAboutme, _loading$2);
248
- MyAboutme = __decorateElement$5(_init$5, 0, "MyAboutme", _MyAboutme_decorators, MyAboutme);
230
+ __decorateElement$f(_init$f, 4, "baseUrl", _baseUrl_dec, MyAboutme, _baseUrl);
231
+ __decorateElement$f(_init$f, 4, "profile", _profile_dec, MyAboutme, _profile);
232
+ __decorateElement$f(_init$f, 4, "htmlContent", _htmlContent_dec, MyAboutme, _htmlContent);
233
+ __decorateElement$f(_init$f, 4, "loading", _loading_dec$2, MyAboutme, _loading$2);
234
+ MyAboutme = __decorateElement$f(_init$f, 0, "MyAboutme", _MyAboutme_decorators, MyAboutme);
249
235
  MyAboutme.styles = aboutmeStyles;
250
- __runInitializers$5(_init$5, 1, MyAboutme);
236
+ __runInitializers$f(_init$f, 1, MyAboutme);
251
237
  const adminStyles = css`
252
238
  :host {
253
239
  display: block;
@@ -516,467 +502,905 @@ input[type="file"]:hover {
516
502
  }
517
503
  }
518
504
  `;
519
- var __create$4 = Object.create;
520
- var __defProp$4 = Object.defineProperty;
521
- var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
522
- var __knownSymbol$4 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
523
- var __typeError$4 = (msg) => {
505
+ class AdminApiService {
506
+ constructor(apiUrl) {
507
+ this.apiUrl = apiUrl;
508
+ }
509
+ async checkAuthStatus() {
510
+ const res = await fetch(`${this.apiUrl}/api/auth/status`);
511
+ if (!res.ok) throw new Error("Auth status check failed");
512
+ return res.json();
513
+ }
514
+ async tryAutoLogin() {
515
+ const res = await fetch(`${this.apiUrl}/api/content`, {
516
+ credentials: "include"
517
+ });
518
+ if (!res.ok) throw new Error("Auto login failed");
519
+ return res.json();
520
+ }
521
+ async login(username, password) {
522
+ const res = await fetch(`${this.apiUrl}/api/auth/login`, {
523
+ method: "POST",
524
+ credentials: "include",
525
+ headers: { "Content-Type": "application/json" },
526
+ body: JSON.stringify({ username, password })
527
+ });
528
+ if (!res.ok) {
529
+ const data = await res.json();
530
+ throw new Error(data.error || "Login failed");
531
+ }
532
+ }
533
+ async setup(username, password) {
534
+ const res = await fetch(`${this.apiUrl}/api/auth/setup`, {
535
+ method: "POST",
536
+ credentials: "include",
537
+ headers: { "Content-Type": "application/json" },
538
+ body: JSON.stringify({ username, password })
539
+ });
540
+ if (!res.ok) {
541
+ const data = await res.json();
542
+ throw new Error(data.error || "Setup failed");
543
+ }
544
+ }
545
+ async logout() {
546
+ await fetch(`${this.apiUrl}/api/auth/logout`, {
547
+ method: "POST",
548
+ credentials: "include"
549
+ });
550
+ }
551
+ async fetchContent() {
552
+ const res = await fetch(`${this.apiUrl}/api/content`, {
553
+ credentials: "include"
554
+ });
555
+ if (!res.ok) throw new Error("Failed to fetch content");
556
+ return res.json();
557
+ }
558
+ async fetchStaticDetails() {
559
+ const res = await fetch(`${this.apiUrl}/api/static`, {
560
+ credentials: "include"
561
+ });
562
+ if (!res.ok) throw new Error("Failed to fetch static details");
563
+ return res.json();
564
+ }
565
+ async uploadContent(key, file) {
566
+ const res = await fetch(`${this.apiUrl}/api/content/${key}`, {
567
+ method: "PUT",
568
+ credentials: "include",
569
+ body: file
570
+ });
571
+ if (!res.ok) throw new Error("Upload failed");
572
+ }
573
+ async deleteContent(key) {
574
+ const res = await fetch(`${this.apiUrl}/api/content/${key}`, {
575
+ method: "DELETE",
576
+ credentials: "include"
577
+ });
578
+ if (!res.ok) throw new Error("Delete failed");
579
+ }
580
+ async clearCache() {
581
+ const res = await fetch(`${this.apiUrl}/api/cache-clear`, {
582
+ method: "POST",
583
+ credentials: "include"
584
+ });
585
+ if (!res.ok) throw new Error("Failed to clear cache");
586
+ }
587
+ }
588
+ var __create$e = Object.create;
589
+ var __defProp$e = Object.defineProperty;
590
+ var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
591
+ var __knownSymbol$e = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
592
+ var __typeError$e = (msg) => {
524
593
  throw TypeError(msg);
525
594
  };
526
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
527
- var __name$4 = (target, value) => __defProp$4(target, "name", { value, configurable: true });
528
- var __decoratorStart$4 = (base) => [, , , __create$4(base?.[__knownSymbol$4("metadata")] ?? null)];
529
- var __decoratorStrings$4 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
530
- var __expectFn$4 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$4("Function expected") : fn;
531
- var __decoratorContext$4 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$4[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$4("Already initialized") : fns.push(__expectFn$4(fn || null)) });
532
- var __decoratorMetadata$4 = (array, target) => __defNormalProp$4(target, __knownSymbol$4("metadata"), array[3]);
533
- var __runInitializers$4 = (array, flags, self, value) => {
595
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
596
+ var __decoratorStart$e = (base) => [, , , __create$e(base?.[__knownSymbol$e("metadata")] ?? null)];
597
+ var __decoratorStrings$e = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
598
+ var __expectFn$e = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$e("Function expected") : fn;
599
+ var __decoratorContext$e = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$e[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$e("Already initialized") : fns.push(__expectFn$e(fn || null)) });
600
+ var __decoratorMetadata$e = (array, target) => __defNormalProp$e(target, __knownSymbol$e("metadata"), array[3]);
601
+ var __runInitializers$e = (array, flags, self, value) => {
534
602
  for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) flags & 1 ? fns[i2].call(self) : value = fns[i2].call(self, value);
535
603
  return value;
536
604
  };
537
- var __decorateElement$4 = (array, flags, name, decorators, target, extra) => {
605
+ var __decorateElement$e = (array, flags, name, decorators, target, extra) => {
606
+ var fn, it, done, ctx, access, k2 = flags & 7, s2 = false, p2 = false;
607
+ var j = array.length + 1, key = __decoratorStrings$e[k2 + 5];
608
+ var initializers = array[j - 1] = [], extraInitializers = array[j] || (array[j] = []);
609
+ var desc = (target = target.prototype, __getOwnPropDesc$e({ get [name]() {
610
+ return __privateGet$6(this, extra);
611
+ }, set [name](x) {
612
+ return __privateSet$6(this, extra, x);
613
+ } }, name));
614
+ for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
615
+ ctx = __decoratorContext$e(k2, name, done = {}, array[3], extraInitializers);
616
+ {
617
+ ctx.static = s2, ctx.private = p2, access = ctx.access = { has: (x) => name in x };
618
+ access.get = (x) => x[name];
619
+ access.set = (x, y2) => x[name] = y2;
620
+ }
621
+ it = (0, decorators[i2])({ get: desc.get, set: desc.set }, ctx), done._ = 1;
622
+ if (it === void 0) __expectFn$e(it) && (desc[key] = it);
623
+ else if (typeof it !== "object" || it === null) __typeError$e("Object expected");
624
+ else __expectFn$e(fn = it.get) && (desc.get = fn), __expectFn$e(fn = it.set) && (desc.set = fn), __expectFn$e(fn = it.init) && initializers.unshift(fn);
625
+ }
626
+ return desc && __defProp$e(target, name, desc), target;
627
+ };
628
+ var __accessCheck$6 = (obj, member, msg) => member.has(obj) || __typeError$e("Cannot " + msg);
629
+ var __privateGet$6 = (obj, member, getter) => (__accessCheck$6(obj, member, "read from private field"), member.get(obj));
630
+ var __privateAdd$6 = (obj, member, value) => member.has(obj) ? __typeError$e("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
631
+ var __privateSet$6 = (obj, member, value, setter) => (__accessCheck$6(obj, member, "write to private field"), member.set(obj, value), value);
632
+ var _onStatusMessage_dec, _onDelete_dec, _onUpload_dec, _staticDetails_dec$1, _contentList_dec$1, _a$e, _init$e, _contentList$1, _staticDetails$1, _onUpload, _onDelete, _onStatusMessage;
633
+ class AdminSection extends (_a$e = LitElement, _contentList_dec$1 = [property({ type: Array })], _staticDetails_dec$1 = [property({ type: Object })], _onUpload_dec = [property({ type: Function })], _onDelete_dec = [property({ type: Function })], _onStatusMessage_dec = [property({ type: Function })], _a$e) {
634
+ constructor() {
635
+ super(...arguments);
636
+ __privateAdd$6(this, _contentList$1, __runInitializers$e(_init$e, 8, this, [])), __runInitializers$e(_init$e, 11, this);
637
+ __privateAdd$6(this, _staticDetails$1, __runInitializers$e(_init$e, 12, this, {})), __runInitializers$e(_init$e, 15, this);
638
+ __privateAdd$6(this, _onUpload, __runInitializers$e(_init$e, 16, this, async () => {
639
+ })), __runInitializers$e(_init$e, 19, this);
640
+ __privateAdd$6(this, _onDelete, __runInitializers$e(_init$e, 20, this, async () => {
641
+ })), __runInitializers$e(_init$e, 23, this);
642
+ __privateAdd$6(this, _onStatusMessage, __runInitializers$e(_init$e, 24, this, () => {
643
+ })), __runInitializers$e(_init$e, 27, this);
644
+ }
645
+ getContent(key) {
646
+ return this.contentList.find((c2) => c2.key === key);
647
+ }
648
+ getSectionFiles(prefix) {
649
+ return this.contentList.filter((c2) => c2.key.startsWith(prefix));
650
+ }
651
+ }
652
+ _init$e = __decoratorStart$e(_a$e);
653
+ _contentList$1 = /* @__PURE__ */ new WeakMap();
654
+ _staticDetails$1 = /* @__PURE__ */ new WeakMap();
655
+ _onUpload = /* @__PURE__ */ new WeakMap();
656
+ _onDelete = /* @__PURE__ */ new WeakMap();
657
+ _onStatusMessage = /* @__PURE__ */ new WeakMap();
658
+ __decorateElement$e(_init$e, 4, "contentList", _contentList_dec$1, AdminSection, _contentList$1);
659
+ __decorateElement$e(_init$e, 4, "staticDetails", _staticDetails_dec$1, AdminSection, _staticDetails$1);
660
+ __decorateElement$e(_init$e, 4, "onUpload", _onUpload_dec, AdminSection, _onUpload);
661
+ __decorateElement$e(_init$e, 4, "onDelete", _onDelete_dec, AdminSection, _onDelete);
662
+ __decorateElement$e(_init$e, 4, "onStatusMessage", _onStatusMessage_dec, AdminSection, _onStatusMessage);
663
+ __decoratorMetadata$e(_init$e, AdminSection);
664
+ AdminSection.styles = css`
665
+ :host {
666
+ display: block;
667
+ width: 100%;
668
+ }
669
+
670
+ .section {
671
+ width: 100%;
672
+ border: none;
673
+ padding: 24px;
674
+ border-radius: 16px;
675
+ background: var(--card-bg, #fff);
676
+ box-shadow: 0 4px 6px rgba(0,0,0,0.07), 0 10px 20px rgba(0,0,0,0.05);
677
+ margin-bottom: 20px;
678
+ min-height: 450px;
679
+ box-sizing: border-box;
680
+ }
681
+
682
+ .section h3 {
683
+ margin: 0 0 0.5rem 0;
684
+ font-size: 1.25rem;
685
+ }
686
+
687
+ .help-text {
688
+ color: var(--secondary-text, #666);
689
+ margin-bottom: 1rem;
690
+ }
691
+
692
+ .current-file {
693
+ margin-bottom: 1rem;
694
+ padding: 1rem;
695
+ background: var(--nav-link-hover-bg, #f5f5f5);
696
+ border-radius: 8px;
697
+ }
698
+
699
+ input[type="text"],
700
+ input[type="file"] {
701
+ width: 100%;
702
+ padding: 10px;
703
+ margin-bottom: 1rem;
704
+ border: 1px solid var(--border-color);
705
+ border-radius: 4px;
706
+ background: var(--background-color);
707
+ color: var(--text-color);
708
+ box-sizing: border-box;
709
+ }
710
+
711
+ input[type="file"] {
712
+ margin-bottom: 1rem;
713
+ }
714
+
715
+ button {
716
+ padding: 10px 20px;
717
+ border: none;
718
+ border-radius: 4px;
719
+ cursor: pointer;
720
+ font-size: 1rem;
721
+ transition: background-color 0.3s ease;
722
+ margin-right: 10px;
723
+ }
724
+
725
+ .btn-primary {
726
+ background: var(--link-color, #646cff);
727
+ color: white;
728
+ }
729
+
730
+ .btn-primary:hover {
731
+ background: var(--link-hover-color, #535bf2);
732
+ }
733
+
734
+ .btn-secondary {
735
+ background: var(--nav-link-hover-bg, #f0f0f0);
736
+ color: var(--text-color, #213547);
737
+ }
738
+
739
+ .btn-secondary:hover {
740
+ background: var(--border-color, #e0e0e0);
741
+ }
742
+
743
+ .btn-danger {
744
+ background: #dc3545;
745
+ color: white;
746
+ }
747
+
748
+ .btn-danger:hover {
749
+ background: #c82333;
750
+ }
751
+
752
+ .file-list {
753
+ margin-top: 1rem;
754
+ }
755
+
756
+ .file-item {
757
+ display: flex;
758
+ justify-content: space-between;
759
+ align-items: center;
760
+ padding: 0.5rem;
761
+ border-bottom: 1px solid var(--border-color, #eee);
762
+ }
763
+
764
+ .file-item:last-child {
765
+ border-bottom: none;
766
+ }
767
+ `;
768
+ var __create$d = Object.create;
769
+ var __defProp$d = Object.defineProperty;
770
+ var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
771
+ var __knownSymbol$d = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
772
+ var __typeError$d = (msg) => {
773
+ throw TypeError(msg);
774
+ };
775
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
776
+ var __name$d = (target, value) => __defProp$d(target, "name", { value, configurable: true });
777
+ var __decoratorStart$d = (base) => [, , , __create$d(base?.[__knownSymbol$d("metadata")] ?? null)];
778
+ var __decoratorStrings$d = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
779
+ var __expectFn$d = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$d("Function expected") : fn;
780
+ var __decoratorContext$d = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$d[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$d("Already initialized") : fns.push(__expectFn$d(fn || null)) });
781
+ var __decoratorMetadata$d = (array, target) => __defNormalProp$d(target, __knownSymbol$d("metadata"), array[3]);
782
+ var __runInitializers$d = (array, flags, self, value) => {
783
+ for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) flags & 1 ? fns[i2].call(self) : value = fns[i2].call(self, value);
784
+ return value;
785
+ };
786
+ var __decorateElement$d = (array, flags, name, decorators, target, extra) => {
538
787
  var fn, it, done, ctx, access, k2 = flags & 7, s2 = !!(flags & 8), p2 = !!(flags & 16);
539
- var j = k2 > 3 ? array.length + 1 : k2 ? s2 ? 1 : 2 : 0, key = __decoratorStrings$4[k2 + 5];
788
+ var j = k2 > 3 ? array.length + 1 : k2 ? s2 ? 1 : 2 : 0, key = __decoratorStrings$d[k2 + 5];
540
789
  var initializers = k2 > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
541
- var desc = k2 && (!p2 && !s2 && (target = target.prototype), k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$4(k2 < 4 ? target : { get [name]() {
542
- return __privateGet$3(this, extra);
790
+ var desc = k2 && (!p2 && !s2 && (target = target.prototype), k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$d(k2 < 4 ? target : { get [name]() {
791
+ return __privateGet$5(this, extra);
543
792
  }, set [name](x) {
544
- return __privateSet$3(this, extra, x);
793
+ return __privateSet$5(this, extra, x);
545
794
  } }, name));
546
- k2 ? p2 && k2 < 4 && __name$4(extra, (k2 > 2 ? "set " : k2 > 1 ? "get " : "") + name) : __name$4(target, name);
795
+ k2 ? p2 && k2 < 4 && __name$d(extra, (k2 > 2 ? "set " : k2 > 1 ? "get " : "") + name) : __name$d(target, name);
547
796
  for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
548
- ctx = __decoratorContext$4(k2, name, done = {}, array[3], extraInitializers);
797
+ ctx = __decoratorContext$d(k2, name, done = {}, array[3], extraInitializers);
549
798
  if (k2) {
550
- ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn$3(target, x) : (x) => name in x };
551
- if (k2 ^ 3) access.get = p2 ? (x) => (k2 ^ 1 ? __privateGet$3 : __privateMethod$3)(x, target, k2 ^ 4 ? extra : desc.get) : (x) => x[name];
552
- if (k2 > 2) access.set = p2 ? (x, y2) => __privateSet$3(x, target, y2, k2 ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
799
+ ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn$5(target, x) : (x) => name in x };
800
+ if (k2 ^ 3) access.get = p2 ? (x) => (k2 ^ 1 ? __privateGet$5 : __privateMethod$5)(x, target, k2 ^ 4 ? extra : desc.get) : (x) => x[name];
801
+ if (k2 > 2) access.set = p2 ? (x, y2) => __privateSet$5(x, target, y2, k2 ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
553
802
  }
554
803
  it = (0, decorators[i2])(k2 ? k2 < 4 ? p2 ? extra : desc[key] : k2 > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
555
- if (k2 ^ 4 || it === void 0) __expectFn$4(it) && (k2 > 4 ? initializers.unshift(it) : k2 ? p2 ? extra = it : desc[key] = it : target = it);
556
- else if (typeof it !== "object" || it === null) __typeError$4("Object expected");
557
- else __expectFn$4(fn = it.get) && (desc.get = fn), __expectFn$4(fn = it.set) && (desc.set = fn), __expectFn$4(fn = it.init) && initializers.unshift(fn);
804
+ if (k2 ^ 4 || it === void 0) __expectFn$d(it) && (k2 > 4 ? initializers.unshift(it) : k2 ? p2 ? extra = it : desc[key] = it : target = it);
805
+ else if (typeof it !== "object" || it === null) __typeError$d("Object expected");
806
+ else __expectFn$d(fn = it.get) && (desc.get = fn), __expectFn$d(fn = it.set) && (desc.set = fn), __expectFn$d(fn = it.init) && initializers.unshift(fn);
558
807
  }
559
- return k2 || __decoratorMetadata$4(array, target), desc && __defProp$4(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
808
+ return k2 || __decoratorMetadata$d(array, target), desc && __defProp$d(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
560
809
  };
561
- var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$4("Cannot " + msg);
562
- var __privateIn$3 = (member, obj) => Object(obj) !== obj ? __typeError$4('Cannot use the "in" operator on this value') : member.has(obj);
563
- var __privateGet$3 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
564
- var __privateAdd$3 = (obj, member, value) => member.has(obj) ? __typeError$4("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
565
- var __privateSet$3 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
566
- var __privateMethod$3 = (obj, member, method) => (__accessCheck$3(obj, member, "access private method"), method);
567
- var _loginError_dec, _staticDetails_dec, _activeSection_dec, _statusMessage_dec, _contentList_dec, _isLoading_dec, _isSetup_dec, _isAuthenticated_dec, _a$4, _AdminPortal_decorators, _init$4, _isAuthenticated, _isSetup, _isLoading, _contentList, _statusMessage, _activeSection, _staticDetails, _loginError;
568
- _AdminPortal_decorators = [customElement("admin-portal")];
569
- class AdminPortal extends (_a$4 = LitElement, _isAuthenticated_dec = [state()], _isSetup_dec = [state()], _isLoading_dec = [state()], _contentList_dec = [state()], _statusMessage_dec = [state()], _activeSection_dec = [state()], _staticDetails_dec = [state()], _loginError_dec = [state()], _a$4) {
810
+ var __accessCheck$5 = (obj, member, msg) => member.has(obj) || __typeError$d("Cannot " + msg);
811
+ var __privateIn$5 = (member, obj) => Object(obj) !== obj ? __typeError$d('Cannot use the "in" operator on this value') : member.has(obj);
812
+ var __privateGet$5 = (obj, member, getter) => (__accessCheck$5(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
813
+ var __privateAdd$5 = (obj, member, value) => member.has(obj) ? __typeError$d("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
814
+ var __privateSet$5 = (obj, member, value, setter) => (__accessCheck$5(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
815
+ var __privateMethod$5 = (obj, member, method) => (__accessCheck$5(obj, member, "access private method"), method);
816
+ var _isSetup_dec$1, _errorMessage_dec, _a$d, _AdminLoginForm_decorators, _init$d, _errorMessage, _isSetup$1;
817
+ _AdminLoginForm_decorators = [customElement("admin-login-form")];
818
+ class AdminLoginForm extends (_a$d = LitElement, _errorMessage_dec = [property({ type: String })], _isSetup_dec$1 = [property({ type: Boolean })], _a$d) {
570
819
  constructor() {
571
820
  super(...arguments);
572
- __privateAdd$3(this, _isAuthenticated, __runInitializers$4(_init$4, 8, this, false)), __runInitializers$4(_init$4, 11, this);
573
- __privateAdd$3(this, _isSetup, __runInitializers$4(_init$4, 12, this, false)), __runInitializers$4(_init$4, 15, this);
574
- __privateAdd$3(this, _isLoading, __runInitializers$4(_init$4, 16, this, true)), __runInitializers$4(_init$4, 19, this);
575
- __privateAdd$3(this, _contentList, __runInitializers$4(_init$4, 20, this, [])), __runInitializers$4(_init$4, 23, this);
576
- __privateAdd$3(this, _statusMessage, __runInitializers$4(_init$4, 24, this, "")), __runInitializers$4(_init$4, 27, this);
577
- __privateAdd$3(this, _activeSection, __runInitializers$4(_init$4, 28, this, "profile")), __runInitializers$4(_init$4, 31, this);
578
- __privateAdd$3(this, _staticDetails, __runInitializers$4(_init$4, 32, this, {})), __runInitializers$4(_init$4, 35, this);
579
- __privateAdd$3(this, _loginError, __runInitializers$4(_init$4, 36, this, "")), __runInitializers$4(_init$4, 39, this);
821
+ __privateAdd$5(this, _errorMessage, __runInitializers$d(_init$d, 8, this, "")), __runInitializers$d(_init$d, 11, this);
822
+ __privateAdd$5(this, _isSetup$1, __runInitializers$d(_init$d, 12, this, false)), __runInitializers$d(_init$d, 15, this);
580
823
  }
581
- get apiUrl() {
582
- return window.__VITE_API_URL__ || void 0 || "http://localhost:8787";
824
+ handleSubmit(e2) {
825
+ e2.preventDefault();
826
+ const formData = new FormData(e2.target);
827
+ const username = formData.get("username");
828
+ const password = formData.get("password");
829
+ const confirmPassword = formData.get("confirmPassword");
830
+ this.dispatchEvent(new CustomEvent("login-submit", {
831
+ detail: { username, password, confirmPassword },
832
+ bubbles: true,
833
+ composed: true
834
+ }));
583
835
  }
584
- async connectedCallback() {
585
- super.connectedCallback();
586
- await this.checkAuthStatus();
836
+ render() {
837
+ return html`
838
+ <div class="container">
839
+ <div class="login-box">
840
+ <h2>${this.isSetup ? "Admin Login" : "Admin Setup"}</h2>
841
+ <p>${this.isSetup ? "Enter your credentials" : "Create your admin credentials"}</p>
842
+ <form @submit=${this.handleSubmit}>
843
+ <input type="text" name="username" placeholder="Username${this.isSetup ? "" : " (3+ chars)"}" autocomplete="username" required />
844
+ <input type="password" name="password" placeholder="Password${this.isSetup ? "" : " (8+ chars)"}" autocomplete="current-password" required />
845
+ ${!this.isSetup ? html`<input type="password" name="confirmPassword" placeholder="Confirm Password" required />` : ""}
846
+ ${this.errorMessage ? html`<div class="error-message">${this.errorMessage}</div>` : ""}
847
+ <button type="submit" class="btn-primary">${this.isSetup ? "Login" : "Create Account"}</button>
848
+ </form>
849
+ </div>
850
+ </div>
851
+ `;
587
852
  }
588
- async checkAuthStatus() {
589
- try {
590
- const res = await fetch(`${this.apiUrl}/auth/status`, {
591
- credentials: "include"
592
- });
593
- if (res.ok) {
594
- const status = await res.json();
595
- this.isSetup = status.configured;
596
- if (status.configured) {
597
- await this.tryAutoLogin();
598
- } else {
599
- this.isLoading = false;
600
- }
601
- } else {
602
- this.isSetup = false;
603
- this.isLoading = false;
604
- }
605
- } catch (e2) {
606
- this.isSetup = false;
607
- this.isLoading = false;
853
+ }
854
+ _init$d = __decoratorStart$d(_a$d);
855
+ _errorMessage = /* @__PURE__ */ new WeakMap();
856
+ _isSetup$1 = /* @__PURE__ */ new WeakMap();
857
+ __decorateElement$d(_init$d, 4, "errorMessage", _errorMessage_dec, AdminLoginForm, _errorMessage);
858
+ __decorateElement$d(_init$d, 4, "isSetup", _isSetup_dec$1, AdminLoginForm, _isSetup$1);
859
+ AdminLoginForm = __decorateElement$d(_init$d, 0, "AdminLoginForm", _AdminLoginForm_decorators, AdminLoginForm);
860
+ AdminLoginForm.styles = css`
861
+ :host {
862
+ display: block;
863
+ width: 100%;
608
864
  }
609
- }
610
- async tryAutoLogin() {
611
- try {
612
- const res = await fetch(`${this.apiUrl}/content`, {
613
- credentials: "include"
614
- });
615
- if (res.ok) {
616
- this.contentList = await res.json();
617
- this.isAuthenticated = true;
618
- }
619
- } catch (e2) {
865
+
866
+ .container {
867
+ width: 100%;
868
+ max-width: 900px;
869
+ margin: 0 auto;
870
+ padding: 1rem;
620
871
  }
621
- this.isLoading = false;
622
- }
623
- async handleLogin(e2) {
624
- e2.preventDefault();
625
- this.loginError = "";
626
- const usernameInput = this.shadowRoot?.querySelector("#username");
627
- const passwordInput = this.shadowRoot?.querySelector("#password");
628
- if (!usernameInput?.value || !passwordInput?.value) {
629
- this.loginError = "Username and password required";
630
- return;
872
+
873
+ .login-box {
874
+ border: 1px solid var(--border-color, #e0e0e0);
875
+ padding: 3rem 2.5rem;
876
+ border-radius: 16px;
877
+ width: 100%;
878
+ max-width: 420px;
879
+ margin: 80px auto;
880
+ text-align: center;
881
+ background: var(--card-bg, #fff);
882
+ box-shadow: 0 4px 6px rgba(0,0,0,0.07), 0 10px 20px rgba(0,0,0,0.05);
631
883
  }
632
- try {
633
- const res = await fetch(`${this.apiUrl}/auth/login`, {
634
- method: "POST",
635
- credentials: "include",
636
- headers: { "Content-Type": "application/json" },
637
- body: JSON.stringify({
638
- username: usernameInput.value,
639
- password: passwordInput.value
640
- })
641
- });
642
- if (res.ok) {
643
- this.isAuthenticated = true;
644
- await this.fetchContent();
645
- } else {
646
- const data = await res.json();
647
- this.loginError = data.error || "Login failed";
648
- }
649
- } catch (e22) {
650
- this.loginError = "Connection error";
884
+
885
+ .login-box h2 {
886
+ margin: 0 0 0.5rem 0;
887
+ font-size: 1.75rem;
888
+ font-weight: 600;
889
+ color: var(--text-color, #213547);
651
890
  }
652
- }
653
- async handleSetup(e2) {
654
- e2.preventDefault();
655
- this.loginError = "";
656
- const usernameInput = this.shadowRoot?.querySelector("#username");
657
- const passwordInput = this.shadowRoot?.querySelector("#password");
658
- const confirmInput = this.shadowRoot?.querySelector("#confirmPassword");
659
- if (!usernameInput?.value || !passwordInput?.value) {
660
- this.loginError = "Username and password required";
661
- return;
891
+
892
+ .login-box p {
893
+ color: var(--secondary-text, #666);
894
+ margin-bottom: 1.5rem;
662
895
  }
663
- if (usernameInput.value.length < 3) {
664
- this.loginError = "Username must be at least 3 characters";
665
- return;
896
+
897
+ input {
898
+ width: 100%;
899
+ padding: 10px;
900
+ margin-bottom: 20px;
901
+ border: 1px solid var(--border-color);
902
+ border-radius: 4px;
903
+ background: var(--background-color);
904
+ color: var(--text-color);
905
+ box-sizing: border-box;
666
906
  }
667
- if (passwordInput.value.length < 8) {
668
- this.loginError = "Password must be at least 8 characters";
669
- return;
907
+
908
+ button {
909
+ padding: 10px 20px;
910
+ border: none;
911
+ border-radius: 4px;
912
+ cursor: pointer;
913
+ font-size: 1rem;
914
+ transition: background-color 0.3s ease;
670
915
  }
671
- if (passwordInput.value !== confirmInput?.value) {
672
- this.loginError = "Passwords do not match";
673
- return;
916
+
917
+ .btn-primary {
918
+ background: var(--link-color, #646cff);
919
+ color: white;
674
920
  }
675
- try {
676
- const res = await fetch(`${this.apiUrl}/auth/setup`, {
677
- method: "POST",
678
- credentials: "include",
679
- headers: { "Content-Type": "application/json" },
680
- body: JSON.stringify({
681
- username: usernameInput.value,
682
- password: passwordInput.value
683
- })
684
- });
685
- if (res.ok) {
686
- this.isAuthenticated = true;
687
- this.isSetup = true;
688
- await this.fetchContent();
689
- } else {
690
- const data = await res.json();
691
- this.loginError = data.error || "Setup failed";
921
+
922
+ .btn-primary:hover {
923
+ background: var(--link-hover-color, #535bf2);
924
+ }
925
+
926
+ .error-message {
927
+ color: red;
928
+ margin-bottom: 10px;
929
+ }
930
+ `;
931
+ __runInitializers$d(_init$d, 1, AdminLoginForm);
932
+ var __create$c = Object.create;
933
+ var __defProp$c = Object.defineProperty;
934
+ var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
935
+ var __knownSymbol$c = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
936
+ var __typeError$c = (msg) => {
937
+ throw TypeError(msg);
938
+ };
939
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
940
+ var __name$c = (target, value) => __defProp$c(target, "name", { value, configurable: true });
941
+ var __decoratorStart$c = (base) => [, , , __create$c(base?.[__knownSymbol$c("metadata")] ?? null)];
942
+ var __decoratorStrings$c = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
943
+ var __expectFn$c = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$c("Function expected") : fn;
944
+ var __decoratorContext$c = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$c[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$c("Already initialized") : fns.push(__expectFn$c(fn || null)) });
945
+ var __decoratorMetadata$c = (array, target) => __defNormalProp$c(target, __knownSymbol$c("metadata"), array[3]);
946
+ var __runInitializers$c = (array, flags, self, value) => {
947
+ for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) fns[i2].call(self);
948
+ return value;
949
+ };
950
+ var __decorateElement$c = (array, flags, name, decorators, target, extra) => {
951
+ var it, done, ctx, k2 = flags & 7, p2 = false;
952
+ var j = 0;
953
+ var extraInitializers = array[j] || (array[j] = []);
954
+ var desc = k2 && (target = target.prototype, k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$c(target, name));
955
+ __name$c(target, name);
956
+ for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
957
+ ctx = __decoratorContext$c(k2, name, done = {}, array[3], extraInitializers);
958
+ it = (0, decorators[i2])(target, ctx), done._ = 1;
959
+ __expectFn$c(it) && (target = it);
960
+ }
961
+ return __decoratorMetadata$c(array, target), desc && __defProp$c(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
962
+ };
963
+ var _AdminHomeSection_decorators, _init$c, _a$c;
964
+ _AdminHomeSection_decorators = [customElement("admin-home-section")];
965
+ class AdminHomeSection extends (_a$c = AdminSection) {
966
+ async handleUpload() {
967
+ const input = this.shadowRoot?.querySelector("#homeFile");
968
+ if (input.files?.[0]) {
969
+ try {
970
+ await this.onUpload("home.md", input.files[0]);
971
+ this.onStatusMessage("Upload successful!");
972
+ } catch (e2) {
973
+ this.onStatusMessage("Upload failed.");
692
974
  }
693
- } catch (e22) {
694
- this.loginError = "Connection error";
695
975
  }
696
976
  }
697
- async handleLogout() {
977
+ async handleDelete() {
978
+ if (!confirm("Delete home.md?")) return;
698
979
  try {
699
- await fetch(`${this.apiUrl}/auth/logout`, {
700
- method: "POST",
701
- credentials: "include"
702
- });
980
+ await this.onDelete("home.md");
703
981
  } catch (e2) {
982
+ this.onStatusMessage("Delete failed.");
704
983
  }
705
- this.isAuthenticated = false;
706
- this.contentList = [];
707
- }
708
- async fetchContent() {
709
- try {
710
- const res = await fetch(`${this.apiUrl}/content`, {
711
- credentials: "include"
712
- });
713
- if (res.ok) {
714
- this.contentList = await res.json();
715
- } else {
716
- this.statusMessage = "Failed to fetch content.";
717
- }
718
- } catch (e2) {
719
- this.statusMessage = "Error fetching content.";
720
- }
721
- }
722
- async fetchStaticDetails() {
723
- try {
724
- const res = await fetch(`${this.apiUrl}/static`, {
725
- credentials: "include"
726
- });
727
- if (res.ok) {
728
- this.staticDetails = await res.json();
729
- }
730
- } catch (e2) {
731
- }
732
- }
733
- async handleUpload(key, file) {
734
- try {
735
- this.statusMessage = "Uploading...";
736
- const res = await fetch(`${this.apiUrl}/content/${key}`, {
737
- method: "PUT",
738
- credentials: "include",
739
- body: file
740
- });
741
- if (res.ok) {
742
- this.statusMessage = "Upload successful!";
743
- this.fetchContent();
744
- } else {
745
- this.statusMessage = "Upload failed.";
746
- }
747
- } catch (e2) {
748
- this.statusMessage = "Error uploading.";
749
- }
750
- }
751
- async handleClearCache() {
752
- try {
753
- this.statusMessage = "Clearing cache...";
754
- const res = await fetch(`${this.apiUrl}/cache-clear`, {
755
- method: "POST",
756
- credentials: "include"
757
- });
758
- if (res.ok) {
759
- this.statusMessage = "Cache cleared!";
760
- } else {
761
- this.statusMessage = "Failed to clear cache.";
762
- }
763
- } catch (e2) {
764
- this.statusMessage = "Error clearing cache.";
765
- }
766
- }
767
- async handleDelete(key) {
768
- if (!confirm(`Delete ${key}?`)) return;
769
- try {
770
- const res = await fetch(`${this.apiUrl}/content/${key}`, {
771
- method: "DELETE",
772
- credentials: "include"
773
- });
774
- if (res.ok) {
775
- this.fetchContent();
776
- } else {
777
- this.statusMessage = "Delete failed.";
778
- }
779
- } catch (e2) {
780
- this.statusMessage = "Error deleting.";
781
- }
782
- }
783
- getContent(key) {
784
- return this.contentList.find((c2) => c2.key === key);
785
- }
786
- getSectionFiles(prefix) {
787
- return this.contentList.filter((c2) => c2.key.startsWith(prefix));
788
- }
789
- renderLoginForm() {
790
- return html`
791
- <div class="container">
792
- <div class="login-box">
793
- <h2>Admin Setup</h2>
794
- <p>Create your admin credentials</p>
795
- <form @submit=${this.handleSetup}>
796
- <input type="text" id="username" placeholder="Username (3+ chars)" />
797
- <input type="password" id="password" placeholder="Password (8+ chars)" />
798
- <input type="password" id="confirmPassword" placeholder="Confirm Password" />
799
- ${this.loginError ? html`<div class="error-message">${this.loginError}</div>` : ""}
800
- <button type="submit" class="btn-primary">Create Account</button>
801
- </form>
802
- </div>
803
- </div>
804
- `;
805
- }
806
- renderLogin() {
807
- return html`
808
- <div class="container">
809
- <div class="login-box">
810
- <h2>Admin Login</h2>
811
- <p>Enter your credentials</p>
812
- <form @submit=${this.handleLogin}>
813
- <input type="text" id="username" placeholder="Username" autocomplete="username" />
814
- <input type="password" id="password" placeholder="Password" autocomplete="current-password" />
815
- ${this.loginError ? html`<div class="error-message">${this.loginError}</div>` : ""}
816
- <button type="submit" class="btn-primary">Login</button>
817
- </form>
818
- </div>
819
- </div>
820
- `;
821
984
  }
822
- renderHomeSection() {
985
+ render() {
823
986
  const home = this.getContent("home.md");
824
987
  return html`
825
988
  <div class="section">
826
989
  <h3>Home Page</h3>
827
990
  <p class="help-text">Content for your home page. Upload home.md with your main content.</p>
828
-
991
+
829
992
  ${home ? html`
830
993
  <div class="current-file">
831
994
  <strong>Current:</strong> home.md (${home.size} bytes)
832
- <button class="btn-danger" @click=${() => this.handleDelete("home.md")}>Delete</button>
995
+ <button class="btn-danger" @click=${this.handleDelete}>Delete</button>
833
996
  </div>
834
997
  ` : ""}
835
998
 
836
999
  <input type="file" id="homeFile" accept=".md" />
837
- <button class="btn-primary" @click=${() => {
838
- const input = this.shadowRoot?.querySelector("#homeFile");
839
- if (input.files?.[0]) this.handleUpload("home.md", input.files[0]);
840
- }}>Upload home.md</button>
1000
+ <button class="btn-primary" @click=${this.handleUpload}>Upload home.md</button>
841
1001
  </div>
842
1002
  `;
843
1003
  }
844
- renderProfileSection() {
1004
+ }
1005
+ _init$c = __decoratorStart$c(_a$c);
1006
+ AdminHomeSection = __decorateElement$c(_init$c, 0, "AdminHomeSection", _AdminHomeSection_decorators, AdminHomeSection);
1007
+ __runInitializers$c(_init$c, 1, AdminHomeSection);
1008
+ var __create$b = Object.create;
1009
+ var __defProp$b = Object.defineProperty;
1010
+ var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
1011
+ var __knownSymbol$b = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
1012
+ var __typeError$b = (msg) => {
1013
+ throw TypeError(msg);
1014
+ };
1015
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1016
+ var __name$b = (target, value) => __defProp$b(target, "name", { value, configurable: true });
1017
+ var __decoratorStart$b = (base) => [, , , __create$b(base?.[__knownSymbol$b("metadata")] ?? null)];
1018
+ var __decoratorStrings$b = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
1019
+ var __expectFn$b = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$b("Function expected") : fn;
1020
+ var __decoratorContext$b = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$b[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$b("Already initialized") : fns.push(__expectFn$b(fn || null)) });
1021
+ var __decoratorMetadata$b = (array, target) => __defNormalProp$b(target, __knownSymbol$b("metadata"), array[3]);
1022
+ var __runInitializers$b = (array, flags, self, value) => {
1023
+ for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) fns[i2].call(self);
1024
+ return value;
1025
+ };
1026
+ var __decorateElement$b = (array, flags, name, decorators, target, extra) => {
1027
+ var it, done, ctx, k2 = flags & 7, p2 = false;
1028
+ var j = 0;
1029
+ var extraInitializers = array[j] || (array[j] = []);
1030
+ var desc = k2 && (target = target.prototype, k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$b(target, name));
1031
+ __name$b(target, name);
1032
+ for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
1033
+ ctx = __decoratorContext$b(k2, name, done = {}, array[3], extraInitializers);
1034
+ it = (0, decorators[i2])(target, ctx), done._ = 1;
1035
+ __expectFn$b(it) && (target = it);
1036
+ }
1037
+ return __decoratorMetadata$b(array, target), desc && __defProp$b(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
1038
+ };
1039
+ var _AdminProfileSection_decorators, _init$b, _a$b;
1040
+ _AdminProfileSection_decorators = [customElement("admin-profile-section")];
1041
+ class AdminProfileSection extends (_a$b = AdminSection) {
1042
+ async handleUpload() {
1043
+ const input = this.shadowRoot?.querySelector("#profileFile");
1044
+ if (input.files?.[0]) {
1045
+ try {
1046
+ await this.onUpload("profile.json", input.files[0]);
1047
+ this.onStatusMessage("Upload successful!");
1048
+ } catch (e2) {
1049
+ this.onStatusMessage("Upload failed.");
1050
+ }
1051
+ }
1052
+ }
1053
+ async handleDelete() {
1054
+ if (!confirm("Delete profile.json?")) return;
1055
+ try {
1056
+ await this.onDelete("profile.json");
1057
+ } catch (e2) {
1058
+ this.onStatusMessage("Delete failed.");
1059
+ }
1060
+ }
1061
+ render() {
845
1062
  const profile = this.getContent("profile.json");
846
1063
  return html`
847
1064
  <div class="section">
848
1065
  <h3>Profile <span class="required-badge">Required</span></h3>
849
1066
  <p class="help-text">This file contains your profile information (name, title, experience).</p>
850
-
1067
+
851
1068
  ${profile ? html`
852
1069
  <div class="current-file">
853
1070
  <strong>Current:</strong> profile.json (${profile.size} bytes)
854
- <button class="btn-danger" @click=${() => this.handleDelete("profile.json")}>Delete</button>
1071
+ <button class="btn-danger" @click=${this.handleDelete}>Delete</button>
855
1072
  </div>
856
1073
  ` : ""}
857
1074
 
858
1075
  <input type="file" id="profileFile" accept=".json" />
859
- <button class="btn-primary" @click=${() => {
860
- const input = this.shadowRoot?.querySelector("#profileFile");
861
- if (input.files?.[0]) this.handleUpload("profile.json", input.files[0]);
862
- }}>Upload profile.json</button>
1076
+ <button class="btn-primary" @click=${this.handleUpload}>Upload profile.json</button>
863
1077
  </div>
864
1078
  `;
865
1079
  }
866
- renderAboutMeSection() {
1080
+ }
1081
+ _init$b = __decoratorStart$b(_a$b);
1082
+ AdminProfileSection = __decorateElement$b(_init$b, 0, "AdminProfileSection", _AdminProfileSection_decorators, AdminProfileSection);
1083
+ __runInitializers$b(_init$b, 1, AdminProfileSection);
1084
+ var __create$a = Object.create;
1085
+ var __defProp$a = Object.defineProperty;
1086
+ var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
1087
+ var __knownSymbol$a = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
1088
+ var __typeError$a = (msg) => {
1089
+ throw TypeError(msg);
1090
+ };
1091
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1092
+ var __name$a = (target, value) => __defProp$a(target, "name", { value, configurable: true });
1093
+ var __decoratorStart$a = (base) => [, , , __create$a(base?.[__knownSymbol$a("metadata")] ?? null)];
1094
+ var __decoratorStrings$a = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
1095
+ var __expectFn$a = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$a("Function expected") : fn;
1096
+ var __decoratorContext$a = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$a[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$a("Already initialized") : fns.push(__expectFn$a(fn || null)) });
1097
+ var __decoratorMetadata$a = (array, target) => __defNormalProp$a(target, __knownSymbol$a("metadata"), array[3]);
1098
+ var __runInitializers$a = (array, flags, self, value) => {
1099
+ for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) fns[i2].call(self);
1100
+ return value;
1101
+ };
1102
+ var __decorateElement$a = (array, flags, name, decorators, target, extra) => {
1103
+ var it, done, ctx, k2 = flags & 7, p2 = false;
1104
+ var j = 0;
1105
+ var extraInitializers = array[j] || (array[j] = []);
1106
+ var desc = k2 && (target = target.prototype, k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$a(target, name));
1107
+ __name$a(target, name);
1108
+ for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
1109
+ ctx = __decoratorContext$a(k2, name, done = {}, array[3], extraInitializers);
1110
+ it = (0, decorators[i2])(target, ctx), done._ = 1;
1111
+ __expectFn$a(it) && (target = it);
1112
+ }
1113
+ return __decoratorMetadata$a(array, target), desc && __defProp$a(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
1114
+ };
1115
+ var _AdminAboutMeSection_decorators, _init$a, _a$a;
1116
+ _AdminAboutMeSection_decorators = [customElement("admin-about-me-section")];
1117
+ class AdminAboutMeSection extends (_a$a = AdminSection) {
1118
+ async handleUpload() {
1119
+ const input = this.shadowRoot?.querySelector("#aboutFile");
1120
+ if (input.files?.[0]) {
1121
+ try {
1122
+ await this.onUpload("about-me.md", input.files[0]);
1123
+ this.onStatusMessage("Upload successful!");
1124
+ } catch (e2) {
1125
+ this.onStatusMessage("Upload failed.");
1126
+ }
1127
+ }
1128
+ }
1129
+ async handleDelete() {
1130
+ if (!confirm("Delete about-me.md?")) return;
1131
+ try {
1132
+ await this.onDelete("about-me.md");
1133
+ } catch (e2) {
1134
+ this.onStatusMessage("Delete failed.");
1135
+ }
1136
+ }
1137
+ render() {
867
1138
  const aboutMe = this.getContent("about-me.md");
868
1139
  return html`
869
1140
  <div class="section">
870
1141
  <h3>About Me Page <span class="required-badge">Required</span></h3>
871
1142
  <p class="help-text">Content for your About Me page. Supports Markdown with frontmatter.</p>
872
-
1143
+
873
1144
  ${aboutMe ? html`
874
1145
  <div class="current-file">
875
1146
  <strong>Current:</strong> about-me.md (${aboutMe.size} bytes)
876
- <button class="btn-danger" @click=${() => this.handleDelete("about-me.md")}>Delete</button>
1147
+ <button class="btn-danger" @click=${this.handleDelete}>Delete</button>
877
1148
  </div>
878
1149
  ` : ""}
879
1150
 
880
1151
  <input type="file" id="aboutFile" accept=".md" />
881
- <button class="btn-primary" @click=${() => {
882
- const input = this.shadowRoot?.querySelector("#aboutFile");
883
- if (input.files?.[0]) this.handleUpload("about-me.md", input.files[0]);
884
- }}>Upload about-me.md</button>
1152
+ <button class="btn-primary" @click=${this.handleUpload}>Upload about-me.md</button>
885
1153
  </div>
886
1154
  `;
887
1155
  }
888
- renderBlogsSection() {
1156
+ }
1157
+ _init$a = __decoratorStart$a(_a$a);
1158
+ AdminAboutMeSection = __decorateElement$a(_init$a, 0, "AdminAboutMeSection", _AdminAboutMeSection_decorators, AdminAboutMeSection);
1159
+ __runInitializers$a(_init$a, 1, AdminAboutMeSection);
1160
+ var __create$9 = Object.create;
1161
+ var __defProp$9 = Object.defineProperty;
1162
+ var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
1163
+ var __knownSymbol$9 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
1164
+ var __typeError$9 = (msg) => {
1165
+ throw TypeError(msg);
1166
+ };
1167
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1168
+ var __name$9 = (target, value) => __defProp$9(target, "name", { value, configurable: true });
1169
+ var __decoratorStart$9 = (base) => [, , , __create$9(base?.[__knownSymbol$9("metadata")] ?? null)];
1170
+ var __decoratorStrings$9 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
1171
+ var __expectFn$9 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$9("Function expected") : fn;
1172
+ var __decoratorContext$9 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$9[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$9("Already initialized") : fns.push(__expectFn$9(fn || null)) });
1173
+ var __decoratorMetadata$9 = (array, target) => __defNormalProp$9(target, __knownSymbol$9("metadata"), array[3]);
1174
+ var __runInitializers$9 = (array, flags, self, value) => {
1175
+ for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) fns[i2].call(self);
1176
+ return value;
1177
+ };
1178
+ var __decorateElement$9 = (array, flags, name, decorators, target, extra) => {
1179
+ var it, done, ctx, k2 = flags & 7, p2 = false;
1180
+ var j = 0;
1181
+ var extraInitializers = array[j] || (array[j] = []);
1182
+ var desc = k2 && (target = target.prototype, k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$9(target, name));
1183
+ __name$9(target, name);
1184
+ for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
1185
+ ctx = __decoratorContext$9(k2, name, done = {}, array[3], extraInitializers);
1186
+ it = (0, decorators[i2])(target, ctx), done._ = 1;
1187
+ __expectFn$9(it) && (target = it);
1188
+ }
1189
+ return __decoratorMetadata$9(array, target), desc && __defProp$9(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
1190
+ };
1191
+ var _AdminBlogsSection_decorators, _init$9, _a$9;
1192
+ _AdminBlogsSection_decorators = [customElement("admin-blogs-section")];
1193
+ class AdminBlogsSection extends (_a$9 = AdminSection) {
1194
+ async handleUpload() {
1195
+ const metaInput = this.shadowRoot?.querySelector("#blogMetaFile");
1196
+ const contentInput = this.shadowRoot?.querySelector("#blogContentFile");
1197
+ const slugInput = this.shadowRoot?.querySelector("#blogSlug");
1198
+ if (metaInput.files?.[0] && contentInput.files?.[0] && slugInput.value) {
1199
+ try {
1200
+ await this.onUpload(`blogs/${slugInput.value}.json`, metaInput.files[0]);
1201
+ await this.onUpload(`blogs/${slugInput.value}.md`, contentInput.files[0]);
1202
+ this.onStatusMessage("Upload successful!");
1203
+ } catch (e2) {
1204
+ this.onStatusMessage("Upload failed.");
1205
+ }
1206
+ }
1207
+ }
1208
+ async handleDelete(slug) {
1209
+ if (!confirm(`Delete blog ${slug}?`)) return;
1210
+ try {
1211
+ await this.onDelete(`blogs/${slug}.json`);
1212
+ await this.onDelete(`blogs/${slug}.md`);
1213
+ } catch (e2) {
1214
+ this.onStatusMessage("Delete failed.");
1215
+ }
1216
+ }
1217
+ render() {
889
1218
  const blogs = this.getSectionFiles("blogs/").filter((b) => b.key.endsWith(".json"));
890
1219
  return html`
891
1220
  <div class="section">
892
1221
  <h3>Blog Posts</h3>
893
1222
  <p class="help-text">Each blog needs 2 files: a JSON (metadata) and MD (content) file.</p>
894
-
1223
+
895
1224
  <h4>Upload New Blog</h4>
896
1225
  <input type="file" id="blogMetaFile" accept=".json" />
897
1226
  <input type="file" id="blogContentFile" accept=".md" />
898
1227
  <input type="text" id="blogSlug" placeholder="Slug (e.g., my-new-post)" class="mt-1" />
899
- <button class="btn-primary" @click=${() => {
900
- const metaInput = this.shadowRoot?.querySelector("#blogMetaFile");
901
- const contentInput = this.shadowRoot?.querySelector("#blogContentFile");
902
- const slugInput = this.shadowRoot?.querySelector("#blogSlug");
903
- if (metaInput.files?.[0] && contentInput.files?.[0] && slugInput.value) {
904
- this.handleUpload(`blogs/${slugInput.value}.json`, metaInput.files[0]);
905
- this.handleUpload(`blogs/${slugInput.value}.md`, contentInput.files[0]);
906
- }
907
- }}>Upload Blog (JSON + MD)</button>
1228
+ <button class="btn-primary" @click=${this.handleUpload}>Upload Blog (JSON + MD)</button>
908
1229
 
909
1230
  <div class="file-list">
910
1231
  <h4>Current Blogs (${blogs.length})</h4>
911
- ${blogs.map((b) => html`
912
- <div class="file-item">
913
- <span>${b.key.replace(".json", "")}</span>
914
- <button class="btn-danger" @click=${() => {
1232
+ ${blogs.map((b) => {
915
1233
  const slug = b.key.replace("blogs/", "").replace(".json", "");
916
- this.handleDelete(`blogs/${slug}.json`);
917
- this.handleDelete(`blogs/${slug}.md`);
918
- }}>Delete</button>
919
- </div>
920
- `)}
1234
+ return html`
1235
+ <div class="file-item">
1236
+ <span>${b.key.replace(".json", "")}</span>
1237
+ <button class="btn-danger" @click=${() => this.handleDelete(slug)}>Delete</button>
1238
+ </div>
1239
+ `;
1240
+ })}
921
1241
  ${blogs.length === 0 ? html`<p>No blogs yet.</p>` : ""}
922
1242
  </div>
923
1243
  </div>
924
1244
  `;
925
1245
  }
926
- renderStoriesSection() {
1246
+ }
1247
+ _init$9 = __decoratorStart$9(_a$9);
1248
+ AdminBlogsSection = __decorateElement$9(_init$9, 0, "AdminBlogsSection", _AdminBlogsSection_decorators, AdminBlogsSection);
1249
+ __runInitializers$9(_init$9, 1, AdminBlogsSection);
1250
+ var __create$8 = Object.create;
1251
+ var __defProp$8 = Object.defineProperty;
1252
+ var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
1253
+ var __knownSymbol$8 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
1254
+ var __typeError$8 = (msg) => {
1255
+ throw TypeError(msg);
1256
+ };
1257
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1258
+ var __name$8 = (target, value) => __defProp$8(target, "name", { value, configurable: true });
1259
+ var __decoratorStart$8 = (base) => [, , , __create$8(base?.[__knownSymbol$8("metadata")] ?? null)];
1260
+ var __decoratorStrings$8 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
1261
+ var __expectFn$8 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$8("Function expected") : fn;
1262
+ var __decoratorContext$8 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$8[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$8("Already initialized") : fns.push(__expectFn$8(fn || null)) });
1263
+ var __decoratorMetadata$8 = (array, target) => __defNormalProp$8(target, __knownSymbol$8("metadata"), array[3]);
1264
+ var __runInitializers$8 = (array, flags, self, value) => {
1265
+ for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) fns[i2].call(self);
1266
+ return value;
1267
+ };
1268
+ var __decorateElement$8 = (array, flags, name, decorators, target, extra) => {
1269
+ var it, done, ctx, k2 = flags & 7, p2 = false;
1270
+ var j = 0;
1271
+ var extraInitializers = array[j] || (array[j] = []);
1272
+ var desc = k2 && (target = target.prototype, k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$8(target, name));
1273
+ __name$8(target, name);
1274
+ for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
1275
+ ctx = __decoratorContext$8(k2, name, done = {}, array[3], extraInitializers);
1276
+ it = (0, decorators[i2])(target, ctx), done._ = 1;
1277
+ __expectFn$8(it) && (target = it);
1278
+ }
1279
+ return __decoratorMetadata$8(array, target), desc && __defProp$8(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
1280
+ };
1281
+ var _AdminStoriesSection_decorators, _init$8, _a$8;
1282
+ _AdminStoriesSection_decorators = [customElement("admin-stories-section")];
1283
+ class AdminStoriesSection extends (_a$8 = AdminSection) {
1284
+ async handleUpload() {
1285
+ const metaInput = this.shadowRoot?.querySelector("#storyMetaFile");
1286
+ const contentInput = this.shadowRoot?.querySelector("#storyContentFile");
1287
+ const slugInput = this.shadowRoot?.querySelector("#storySlug");
1288
+ if (metaInput.files?.[0] && contentInput.files?.[0] && slugInput.value) {
1289
+ try {
1290
+ await this.onUpload(`stories/${slugInput.value}.json`, metaInput.files[0]);
1291
+ await this.onUpload(`stories/${slugInput.value}.md`, contentInput.files[0]);
1292
+ this.onStatusMessage("Upload successful!");
1293
+ } catch (e2) {
1294
+ this.onStatusMessage("Upload failed.");
1295
+ }
1296
+ }
1297
+ }
1298
+ async handleDelete(slug) {
1299
+ if (!confirm(`Delete story ${slug}?`)) return;
1300
+ try {
1301
+ await this.onDelete(`stories/${slug}.json`);
1302
+ await this.onDelete(`stories/${slug}.md`);
1303
+ } catch (e2) {
1304
+ this.onStatusMessage("Delete failed.");
1305
+ }
1306
+ }
1307
+ render() {
927
1308
  const stories = this.getSectionFiles("stories/").filter((s2) => s2.key.endsWith(".json"));
928
1309
  return html`
929
1310
  <div class="section">
930
1311
  <h3>Stories</h3>
931
1312
  <p class="help-text">Each story needs 2 files: a JSON (metadata) and MD (content) file.</p>
932
-
1313
+
933
1314
  <h4>Upload New Story</h4>
934
1315
  <input type="file" id="storyMetaFile" accept=".json" />
935
1316
  <input type="file" id="storyContentFile" accept=".md" />
936
1317
  <input type="text" id="storySlug" placeholder="Slug (e.g., my-story)" class="mt-1" />
937
- <button class="btn-primary" @click=${() => {
938
- const metaInput = this.shadowRoot?.querySelector("#storyMetaFile");
939
- const contentInput = this.shadowRoot?.querySelector("#storyContentFile");
940
- const slugInput = this.shadowRoot?.querySelector("#storySlug");
941
- if (metaInput.files?.[0] && contentInput.files?.[0] && slugInput.value) {
942
- this.handleUpload(`stories/${slugInput.value}.json`, metaInput.files[0]);
943
- this.handleUpload(`stories/${slugInput.value}.md`, contentInput.files[0]);
944
- }
945
- }}>Upload Story (JSON + MD)</button>
1318
+ <button class="btn-primary" @click=${this.handleUpload}>Upload Story (JSON + MD)</button>
946
1319
 
947
1320
  <div class="file-list">
948
1321
  <h4>Current Stories (${stories.length})</h4>
949
- ${stories.map((s2) => html`
950
- <div class="file-item">
951
- <span>${s2.key.replace(".json", "")}</span>
952
- <button class="btn-danger" @click=${() => {
1322
+ ${stories.map((s2) => {
953
1323
  const slug = s2.key.replace("stories/", "").replace(".json", "");
954
- this.handleDelete(`stories/${slug}.json`);
955
- this.handleDelete(`stories/${slug}.md`);
956
- }}>Delete</button>
957
- </div>
958
- `)}
1324
+ return html`
1325
+ <div class="file-item">
1326
+ <span>${s2.key.replace(".json", "")}</span>
1327
+ <button class="btn-danger" @click=${() => this.handleDelete(slug)}>Delete</button>
1328
+ </div>
1329
+ `;
1330
+ })}
959
1331
  ${stories.length === 0 ? html`<p>No stories yet.</p>` : ""}
960
1332
  </div>
961
1333
  </div>
962
1334
  `;
963
1335
  }
964
- renderImagesSection() {
1336
+ }
1337
+ _init$8 = __decoratorStart$8(_a$8);
1338
+ AdminStoriesSection = __decorateElement$8(_init$8, 0, "AdminStoriesSection", _AdminStoriesSection_decorators, AdminStoriesSection);
1339
+ __runInitializers$8(_init$8, 1, AdminStoriesSection);
1340
+ var __create$7 = Object.create;
1341
+ var __defProp$7 = Object.defineProperty;
1342
+ var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
1343
+ var __knownSymbol$7 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
1344
+ var __typeError$7 = (msg) => {
1345
+ throw TypeError(msg);
1346
+ };
1347
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1348
+ var __name$7 = (target, value) => __defProp$7(target, "name", { value, configurable: true });
1349
+ var __decoratorStart$7 = (base) => [, , , __create$7(base?.[__knownSymbol$7("metadata")] ?? null)];
1350
+ var __decoratorStrings$7 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
1351
+ var __expectFn$7 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$7("Function expected") : fn;
1352
+ var __decoratorContext$7 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$7[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$7("Already initialized") : fns.push(__expectFn$7(fn || null)) });
1353
+ var __decoratorMetadata$7 = (array, target) => __defNormalProp$7(target, __knownSymbol$7("metadata"), array[3]);
1354
+ var __runInitializers$7 = (array, flags, self, value) => {
1355
+ for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) fns[i2].call(self);
1356
+ return value;
1357
+ };
1358
+ var __decorateElement$7 = (array, flags, name, decorators, target, extra) => {
1359
+ var it, done, ctx, k2 = flags & 7, p2 = false;
1360
+ var j = 0;
1361
+ var extraInitializers = array[j] || (array[j] = []);
1362
+ var desc = k2 && (target = target.prototype, k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$7(target, name));
1363
+ __name$7(target, name);
1364
+ for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
1365
+ ctx = __decoratorContext$7(k2, name, done = {}, array[3], extraInitializers);
1366
+ it = (0, decorators[i2])(target, ctx), done._ = 1;
1367
+ __expectFn$7(it) && (target = it);
1368
+ }
1369
+ return __decoratorMetadata$7(array, target), desc && __defProp$7(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
1370
+ };
1371
+ var _AdminImagesSection_decorators, _init$7, _a$7;
1372
+ _AdminImagesSection_decorators = [customElement("admin-images-section")];
1373
+ class AdminImagesSection extends (_a$7 = AdminSection) {
1374
+ async handleUpload() {
1375
+ const fileInput = this.shadowRoot?.querySelector("#imageFile");
1376
+ const pathInput = this.shadowRoot?.querySelector("#imagePath");
1377
+ if (fileInput.files?.[0] && pathInput.value) {
1378
+ try {
1379
+ await this.onUpload(`images/${pathInput.value}`, fileInput.files[0]);
1380
+ this.onStatusMessage("Upload successful!");
1381
+ } catch (e2) {
1382
+ this.onStatusMessage("Upload failed.");
1383
+ }
1384
+ }
1385
+ }
1386
+ async handleDelete(key) {
1387
+ if (!confirm(`Delete ${key}?`)) return;
1388
+ try {
1389
+ await this.onDelete(key);
1390
+ } catch (e2) {
1391
+ this.onStatusMessage("Delete failed.");
1392
+ }
1393
+ }
1394
+ render() {
965
1395
  const images = this.getSectionFiles("images/");
966
1396
  return html`
967
1397
  <div class="section">
968
1398
  <h3>Images</h3>
969
1399
  <p class="help-text">Upload images for use in your content. In markdown, reference images by filename only (e.g., use <code>my-photo.jpg</code> not <code>/images/my-photo.jpg</code>). The renderer automatically prepends <code>images/</code>.</p>
970
-
1400
+
971
1401
  <input type="file" id="imageFile" accept="image/*" />
972
1402
  <input type="text" id="imagePath" placeholder="Image name (e.g., profile-photo.jpg)" class="mt-1" />
973
- <button class="btn-primary" @click=${() => {
974
- const fileInput = this.shadowRoot?.querySelector("#imageFile");
975
- const pathInput = this.shadowRoot?.querySelector("#imagePath");
976
- if (fileInput.files?.[0] && pathInput.value) {
977
- this.handleUpload(`images/${pathInput.value}`, fileInput.files[0]);
978
- }
979
- }}>Upload to images/</button>
1403
+ <button class="btn-primary" @click=${this.handleUpload}>Upload to images/</button>
980
1404
 
981
1405
  <div class="file-list">
982
1406
  <h4>Current Images (${images.length})</h4>
@@ -991,25 +1415,79 @@ class AdminPortal extends (_a$4 = LitElement, _isAuthenticated_dec = [state()],
991
1415
  </div>
992
1416
  `;
993
1417
  }
994
- renderLogoSection() {
1418
+ }
1419
+ _init$7 = __decoratorStart$7(_a$7);
1420
+ AdminImagesSection = __decorateElement$7(_init$7, 0, "AdminImagesSection", _AdminImagesSection_decorators, AdminImagesSection);
1421
+ __runInitializers$7(_init$7, 1, AdminImagesSection);
1422
+ var __create$6 = Object.create;
1423
+ var __defProp$6 = Object.defineProperty;
1424
+ var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
1425
+ var __knownSymbol$6 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
1426
+ var __typeError$6 = (msg) => {
1427
+ throw TypeError(msg);
1428
+ };
1429
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1430
+ var __name$6 = (target, value) => __defProp$6(target, "name", { value, configurable: true });
1431
+ var __decoratorStart$6 = (base) => [, , , __create$6(base?.[__knownSymbol$6("metadata")] ?? null)];
1432
+ var __decoratorStrings$6 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
1433
+ var __expectFn$6 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$6("Function expected") : fn;
1434
+ var __decoratorContext$6 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$6[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$6("Already initialized") : fns.push(__expectFn$6(fn || null)) });
1435
+ var __decoratorMetadata$6 = (array, target) => __defNormalProp$6(target, __knownSymbol$6("metadata"), array[3]);
1436
+ var __runInitializers$6 = (array, flags, self, value) => {
1437
+ for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) fns[i2].call(self);
1438
+ return value;
1439
+ };
1440
+ var __decorateElement$6 = (array, flags, name, decorators, target, extra) => {
1441
+ var it, done, ctx, k2 = flags & 7, p2 = false;
1442
+ var j = 0;
1443
+ var extraInitializers = array[j] || (array[j] = []);
1444
+ var desc = k2 && (target = target.prototype, k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$6(target, name));
1445
+ __name$6(target, name);
1446
+ for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
1447
+ ctx = __decoratorContext$6(k2, name, done = {}, array[3], extraInitializers);
1448
+ it = (0, decorators[i2])(target, ctx), done._ = 1;
1449
+ __expectFn$6(it) && (target = it);
1450
+ }
1451
+ return __decoratorMetadata$6(array, target), desc && __defProp$6(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
1452
+ };
1453
+ var _AdminLogoSection_decorators, _init$6, _a$6;
1454
+ _AdminLogoSection_decorators = [customElement("admin-logo-section")];
1455
+ class AdminLogoSection extends (_a$6 = AdminSection) {
1456
+ async handleUpload() {
1457
+ const input = this.shadowRoot?.querySelector("#logoFile");
1458
+ if (input.files?.[0]) {
1459
+ try {
1460
+ await this.onUpload("logo.svg", input.files[0]);
1461
+ this.onStatusMessage("Upload successful!");
1462
+ } catch (e2) {
1463
+ this.onStatusMessage("Upload failed.");
1464
+ }
1465
+ }
1466
+ }
1467
+ async handleDelete() {
1468
+ if (!confirm("Delete logo.svg?")) return;
1469
+ try {
1470
+ await this.onDelete("logo.svg");
1471
+ } catch (e2) {
1472
+ this.onStatusMessage("Delete failed.");
1473
+ }
1474
+ }
1475
+ render() {
995
1476
  const logo = this.getContent("logo.svg");
996
1477
  return html`
997
1478
  <div class="section">
998
1479
  <h3>Site Logo</h3>
999
1480
  <p class="help-text">Upload your site logo (SVG format recommended). This appears in the header of your site.</p>
1000
-
1481
+
1001
1482
  ${logo ? html`
1002
1483
  <div class="current-file">
1003
1484
  <strong>Current:</strong> logo.svg (${logo.size} bytes)
1004
- <button class="btn-danger" @click=${() => this.handleDelete("logo.svg")}>Delete</button>
1485
+ <button class="btn-danger" @click=${this.handleDelete}>Delete</button>
1005
1486
  </div>
1006
1487
  ` : ""}
1007
1488
 
1008
1489
  <input type="file" id="logoFile" accept=".svg,image/svg+xml" />
1009
- <button class="btn-primary mt-1 mb-1" @click=${() => {
1010
- const input = this.shadowRoot?.querySelector("#logoFile");
1011
- if (input.files?.[0]) this.handleUpload("logo.svg", input.files[0]);
1012
- }}>Upload logo.svg</button>
1490
+ <button class="btn-primary mt-1 mb-1" @click=${this.handleUpload}>Upload logo.svg</button>
1013
1491
 
1014
1492
  <div class="info-box">
1015
1493
  <strong>Tip:</strong> Use an SVG with transparent background. The logo will automatically adapt to light/dark themes.
@@ -1017,67 +1495,449 @@ class AdminPortal extends (_a$4 = LitElement, _isAuthenticated_dec = [state()],
1017
1495
  </div>
1018
1496
  `;
1019
1497
  }
1020
- renderStaticSection() {
1021
- return html`
1022
- <div class="section">
1023
- <h3>Site Settings</h3>
1024
- <p class="help-text">Manage your site's static details like title, footer links, etc.</p>
1025
-
1026
- <div class="mb-1">
1027
- <label style="display:block;margin-bottom:4px;font-weight:500">Site Title</label>
1028
- <input type="text" id="siteTitle" .value=${this.staticDetails?.siteTitle || ""} />
1029
- </div>
1030
-
1031
- <div class="mb-1">
1032
- <label style="display:block;margin-bottom:4px;font-weight:500">Copyright Text</label>
1033
- <input type="text" id="copyright" .value=${this.staticDetails?.copyright || ""} />
1034
- </div>
1035
-
1036
- <div class="mb-1">
1037
- <label style="display:block;margin-bottom:4px;font-weight:500">LinkedIn URL</label>
1038
- <input type="text" id="linkedin" .value=${this.staticDetails?.linkedin || ""} />
1039
- </div>
1040
-
1041
- <div class="mb-1">
1498
+ }
1499
+ _init$6 = __decoratorStart$6(_a$6);
1500
+ AdminLogoSection = __decorateElement$6(_init$6, 0, "AdminLogoSection", _AdminLogoSection_decorators, AdminLogoSection);
1501
+ __runInitializers$6(_init$6, 1, AdminLogoSection);
1502
+ var __create$5 = Object.create;
1503
+ var __defProp$5 = Object.defineProperty;
1504
+ var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
1505
+ var __knownSymbol$5 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
1506
+ var __typeError$5 = (msg) => {
1507
+ throw TypeError(msg);
1508
+ };
1509
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1510
+ var __name$5 = (target, value) => __defProp$5(target, "name", { value, configurable: true });
1511
+ var __decoratorStart$5 = (base) => [, , , __create$5(base?.[__knownSymbol$5("metadata")] ?? null)];
1512
+ var __decoratorStrings$5 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
1513
+ var __expectFn$5 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$5("Function expected") : fn;
1514
+ var __decoratorContext$5 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$5[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$5("Already initialized") : fns.push(__expectFn$5(fn || null)) });
1515
+ var __decoratorMetadata$5 = (array, target) => __defNormalProp$5(target, __knownSymbol$5("metadata"), array[3]);
1516
+ var __runInitializers$5 = (array, flags, self, value) => {
1517
+ for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) flags & 1 ? fns[i2].call(self) : value = fns[i2].call(self, value);
1518
+ return value;
1519
+ };
1520
+ var __decorateElement$5 = (array, flags, name, decorators, target, extra) => {
1521
+ var fn, it, done, ctx, access, k2 = flags & 7, s2 = !!(flags & 8), p2 = !!(flags & 16);
1522
+ var j = k2 > 3 ? array.length + 1 : k2 ? s2 ? 1 : 2 : 0, key = __decoratorStrings$5[k2 + 5];
1523
+ var initializers = k2 > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
1524
+ var desc = k2 && (!p2 && !s2 && (target = target.prototype), k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$5(k2 < 4 ? target : { get [name]() {
1525
+ return __privateGet$4(this, extra);
1526
+ }, set [name](x) {
1527
+ return __privateSet$4(this, extra, x);
1528
+ } }, name));
1529
+ k2 ? p2 && k2 < 4 && __name$5(extra, (k2 > 2 ? "set " : k2 > 1 ? "get " : "") + name) : __name$5(target, name);
1530
+ for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
1531
+ ctx = __decoratorContext$5(k2, name, done = {}, array[3], extraInitializers);
1532
+ if (k2) {
1533
+ ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn$4(target, x) : (x) => name in x };
1534
+ if (k2 ^ 3) access.get = p2 ? (x) => (k2 ^ 1 ? __privateGet$4 : __privateMethod$4)(x, target, k2 ^ 4 ? extra : desc.get) : (x) => x[name];
1535
+ if (k2 > 2) access.set = p2 ? (x, y2) => __privateSet$4(x, target, y2, k2 ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
1536
+ }
1537
+ it = (0, decorators[i2])(k2 ? k2 < 4 ? p2 ? extra : desc[key] : k2 > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
1538
+ if (k2 ^ 4 || it === void 0) __expectFn$5(it) && (k2 > 4 ? initializers.unshift(it) : k2 ? p2 ? extra = it : desc[key] = it : target = it);
1539
+ else if (typeof it !== "object" || it === null) __typeError$5("Object expected");
1540
+ else __expectFn$5(fn = it.get) && (desc.get = fn), __expectFn$5(fn = it.set) && (desc.set = fn), __expectFn$5(fn = it.init) && initializers.unshift(fn);
1541
+ }
1542
+ return k2 || __decoratorMetadata$5(array, target), desc && __defProp$5(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
1543
+ };
1544
+ var __accessCheck$4 = (obj, member, msg) => member.has(obj) || __typeError$5("Cannot " + msg);
1545
+ var __privateIn$4 = (member, obj) => Object(obj) !== obj ? __typeError$5('Cannot use the "in" operator on this value') : member.has(obj);
1546
+ var __privateGet$4 = (obj, member, getter) => (__accessCheck$4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
1547
+ var __privateAdd$4 = (obj, member, value) => member.has(obj) ? __typeError$5("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1548
+ var __privateSet$4 = (obj, member, value, setter) => (__accessCheck$4(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
1549
+ var __privateMethod$4 = (obj, member, method) => (__accessCheck$4(obj, member, "access private method"), method);
1550
+ var _localDetails_dec, _a$5, _AdminStaticSection_decorators, _init$5, _localDetails;
1551
+ _AdminStaticSection_decorators = [customElement("admin-static-section")];
1552
+ class AdminStaticSection extends (_a$5 = AdminSection, _localDetails_dec = [state()], _a$5) {
1553
+ constructor() {
1554
+ super(...arguments);
1555
+ __privateAdd$4(this, _localDetails, __runInitializers$5(_init$5, 8, this, { ...this.staticDetails })), __runInitializers$5(_init$5, 11, this);
1556
+ }
1557
+ async handleSave() {
1558
+ const siteTitle = this.shadowRoot?.querySelector("#siteTitle")?.value;
1559
+ const copyright = this.shadowRoot?.querySelector("#copyright")?.value;
1560
+ const linkedin = this.shadowRoot?.querySelector("#linkedin")?.value;
1561
+ const github = this.shadowRoot?.querySelector("#github")?.value;
1562
+ const email = this.shadowRoot?.querySelector("#email")?.value;
1563
+ const data = {};
1564
+ if (siteTitle) data.siteTitle = siteTitle;
1565
+ if (copyright) data.copyright = copyright;
1566
+ if (linkedin) data.linkedin = linkedin;
1567
+ if (github) data.github = github;
1568
+ if (email) data.email = email;
1569
+ try {
1570
+ await this.onUpload("staticdetails.json", new File([JSON.stringify(data)], "staticdetails.json", { type: "application/json" }));
1571
+ this.onStatusMessage("Settings saved!");
1572
+ } catch (e2) {
1573
+ this.onStatusMessage("Failed to save settings.");
1574
+ }
1575
+ }
1576
+ render() {
1577
+ return html`
1578
+ <div class="section">
1579
+ <h3>Site Settings</h3>
1580
+ <p class="help-text">Manage your site's static details like title, footer links, etc.</p>
1581
+
1582
+ <div class="mb-1">
1583
+ <label style="display:block;margin-bottom:4px;font-weight:500">Site Title</label>
1584
+ <input type="text" id="siteTitle" .value=${this.staticDetails?.siteTitle || ""} />
1585
+ </div>
1586
+
1587
+ <div class="mb-1">
1588
+ <label style="display:block;margin-bottom:4px;font-weight:500">Copyright Text</label>
1589
+ <input type="text" id="copyright" .value=${this.staticDetails?.copyright || ""} />
1590
+ </div>
1591
+
1592
+ <div class="mb-1">
1593
+ <label style="display:block;margin-bottom:4px;font-weight:500">LinkedIn URL</label>
1594
+ <input type="text" id="linkedin" .value=${this.staticDetails?.linkedin || ""} />
1595
+ </div>
1596
+
1597
+ <div class="mb-1">
1042
1598
  <label style="display:block;margin-bottom:4px;font-weight:500">GitHub URL</label>
1043
1599
  <input type="text" id="github" .value=${this.staticDetails?.github || ""} />
1044
1600
  </div>
1045
-
1601
+
1046
1602
  <div class="mb-1">
1047
1603
  <label style="display:block;margin-bottom:4px;font-weight:500">Email</label>
1048
1604
  <input type="text" id="email" .value=${this.staticDetails?.email || ""} />
1049
1605
  </div>
1050
-
1051
- <button class="btn-primary" @click=${async () => {
1052
- const siteTitle = this.shadowRoot?.querySelector("#siteTitle")?.value;
1053
- const copyright = this.shadowRoot?.querySelector("#copyright")?.value;
1054
- const linkedin = this.shadowRoot?.querySelector("#linkedin")?.value;
1055
- const github = this.shadowRoot?.querySelector("#github")?.value;
1056
- const email = this.shadowRoot?.querySelector("#email")?.value;
1057
- const data = {};
1058
- if (siteTitle) data.siteTitle = siteTitle;
1059
- if (copyright) data.copyright = copyright;
1060
- if (linkedin) data.linkedin = linkedin;
1061
- if (github) data.github = github;
1062
- if (email) data.email = email;
1063
- try {
1064
- const url = `${this.apiUrl}/content/staticdetails.json`;
1065
- const res = await fetch(url, {
1066
- method: "PUT",
1067
- credentials: "include",
1068
- headers: { "Content-Type": "application/json" },
1069
- body: JSON.stringify(data)
1070
- });
1071
- if (res.ok) {
1072
- this.statusMessage = "Settings saved!";
1073
- this.fetchContent();
1074
- } else {
1075
- this.statusMessage = "Failed to save settings.";
1076
- }
1077
- } catch (e2) {
1078
- this.statusMessage = "Error saving settings.";
1606
+
1607
+ <button class="btn-primary" @click=${this.handleSave}>Save Settings</button>
1608
+ </div>
1609
+ `;
1610
+ }
1611
+ }
1612
+ _init$5 = __decoratorStart$5(_a$5);
1613
+ _localDetails = /* @__PURE__ */ new WeakMap();
1614
+ __decorateElement$5(_init$5, 4, "localDetails", _localDetails_dec, AdminStaticSection, _localDetails);
1615
+ AdminStaticSection = __decorateElement$5(_init$5, 0, "AdminStaticSection", _AdminStaticSection_decorators, AdminStaticSection);
1616
+ __runInitializers$5(_init$5, 1, AdminStaticSection);
1617
+ var __create$4 = Object.create;
1618
+ var __defProp$4 = Object.defineProperty;
1619
+ var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
1620
+ var __knownSymbol$4 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
1621
+ var __typeError$4 = (msg) => {
1622
+ throw TypeError(msg);
1623
+ };
1624
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1625
+ var __name$4 = (target, value) => __defProp$4(target, "name", { value, configurable: true });
1626
+ var __decoratorStart$4 = (base) => [, , , __create$4(base?.[__knownSymbol$4("metadata")] ?? null)];
1627
+ var __decoratorStrings$4 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
1628
+ var __expectFn$4 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$4("Function expected") : fn;
1629
+ var __decoratorContext$4 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$4[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$4("Already initialized") : fns.push(__expectFn$4(fn || null)) });
1630
+ var __decoratorMetadata$4 = (array, target) => __defNormalProp$4(target, __knownSymbol$4("metadata"), array[3]);
1631
+ var __runInitializers$4 = (array, flags, self, value) => {
1632
+ for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) flags & 1 ? fns[i2].call(self) : value = fns[i2].call(self, value);
1633
+ return value;
1634
+ };
1635
+ var __decorateElement$4 = (array, flags, name, decorators, target, extra) => {
1636
+ var fn, it, done, ctx, access, k2 = flags & 7, s2 = !!(flags & 8), p2 = !!(flags & 16);
1637
+ var j = k2 > 3 ? array.length + 1 : k2 ? s2 ? 1 : 2 : 0, key = __decoratorStrings$4[k2 + 5];
1638
+ var initializers = k2 > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
1639
+ var desc = k2 && (!p2 && !s2 && (target = target.prototype), k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$4(k2 < 4 ? target : { get [name]() {
1640
+ return __privateGet$3(this, extra);
1641
+ }, set [name](x) {
1642
+ return __privateSet$3(this, extra, x);
1643
+ } }, name));
1644
+ k2 ? p2 && k2 < 4 && __name$4(extra, (k2 > 2 ? "set " : k2 > 1 ? "get " : "") + name) : __name$4(target, name);
1645
+ for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
1646
+ ctx = __decoratorContext$4(k2, name, done = {}, array[3], extraInitializers);
1647
+ if (k2) {
1648
+ ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn$3(target, x) : (x) => name in x };
1649
+ if (k2 ^ 3) access.get = p2 ? (x) => (k2 ^ 1 ? __privateGet$3 : __privateMethod$3)(x, target, k2 ^ 4 ? extra : desc.get) : (x) => x[name];
1650
+ if (k2 > 2) access.set = p2 ? (x, y2) => __privateSet$3(x, target, y2, k2 ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
1651
+ }
1652
+ it = (0, decorators[i2])(k2 ? k2 < 4 ? p2 ? extra : desc[key] : k2 > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
1653
+ if (k2 ^ 4 || it === void 0) __expectFn$4(it) && (k2 > 4 ? initializers.unshift(it) : k2 ? p2 ? extra = it : desc[key] = it : target = it);
1654
+ else if (typeof it !== "object" || it === null) __typeError$4("Object expected");
1655
+ else __expectFn$4(fn = it.get) && (desc.get = fn), __expectFn$4(fn = it.set) && (desc.set = fn), __expectFn$4(fn = it.init) && initializers.unshift(fn);
1656
+ }
1657
+ return k2 || __decoratorMetadata$4(array, target), desc && __defProp$4(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
1658
+ };
1659
+ var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$4("Cannot " + msg);
1660
+ var __privateIn$3 = (member, obj) => Object(obj) !== obj ? __typeError$4('Cannot use the "in" operator on this value') : member.has(obj);
1661
+ var __privateGet$3 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
1662
+ var __privateAdd$3 = (obj, member, value) => member.has(obj) ? __typeError$4("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1663
+ var __privateSet$3 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
1664
+ var __privateMethod$3 = (obj, member, method) => (__accessCheck$3(obj, member, "access private method"), method);
1665
+ var _loginError_dec, _staticDetails_dec, _activeSection_dec, _statusMessage_dec, _contentList_dec, _isLoading_dec, _isSetup_dec, _isAuthenticated_dec, _a$4, _AdminPortal_decorators, _init$4, _isAuthenticated, _isSetup, _isLoading, _contentList, _statusMessage, _activeSection, _staticDetails, _loginError;
1666
+ _AdminPortal_decorators = [customElement("admin-portal")];
1667
+ class AdminPortal extends (_a$4 = LitElement, _isAuthenticated_dec = [state()], _isSetup_dec = [state()], _isLoading_dec = [state()], _contentList_dec = [state()], _statusMessage_dec = [state()], _activeSection_dec = [state()], _staticDetails_dec = [state()], _loginError_dec = [state()], _a$4) {
1668
+ constructor() {
1669
+ super();
1670
+ __privateAdd$3(this, _isAuthenticated, __runInitializers$4(_init$4, 8, this, false)), __runInitializers$4(_init$4, 11, this);
1671
+ __privateAdd$3(this, _isSetup, __runInitializers$4(_init$4, 12, this, false)), __runInitializers$4(_init$4, 15, this);
1672
+ __privateAdd$3(this, _isLoading, __runInitializers$4(_init$4, 16, this, true)), __runInitializers$4(_init$4, 19, this);
1673
+ __privateAdd$3(this, _contentList, __runInitializers$4(_init$4, 20, this, [])), __runInitializers$4(_init$4, 23, this);
1674
+ __privateAdd$3(this, _statusMessage, __runInitializers$4(_init$4, 24, this, "")), __runInitializers$4(_init$4, 27, this);
1675
+ __privateAdd$3(this, _activeSection, __runInitializers$4(_init$4, 28, this, "profile")), __runInitializers$4(_init$4, 31, this);
1676
+ __privateAdd$3(this, _staticDetails, __runInitializers$4(_init$4, 32, this, {})), __runInitializers$4(_init$4, 35, this);
1677
+ __privateAdd$3(this, _loginError, __runInitializers$4(_init$4, 36, this, "")), __runInitializers$4(_init$4, 39, this);
1678
+ this.apiService = void 0;
1679
+ const apiUrl = window.location.origin;
1680
+ this.apiService = new AdminApiService(apiUrl);
1681
+ }
1682
+ hasSessionCookie() {
1683
+ return document.cookie.includes("session=");
1684
+ }
1685
+ async connectedCallback() {
1686
+ super.connectedCallback();
1687
+ await this.checkAuthStatus();
1688
+ this.requestUpdate();
1689
+ }
1690
+ async checkAuthStatus() {
1691
+ try {
1692
+ const status = await this.apiService.checkAuthStatus();
1693
+ this.isSetup = status.configured;
1694
+ if (status.configured && this.hasSessionCookie()) {
1695
+ await this.tryAutoLogin();
1079
1696
  }
1080
- }}>Save Settings</button>
1697
+ } catch (e2) {
1698
+ console.error("Auth status check failed:", e2);
1699
+ } finally {
1700
+ this.isLoading = false;
1701
+ }
1702
+ }
1703
+ async tryAutoLogin() {
1704
+ try {
1705
+ this.contentList = await this.apiService.tryAutoLogin();
1706
+ this.isAuthenticated = true;
1707
+ } catch (e2) {
1708
+ console.error("Auto login failed:", e2);
1709
+ }
1710
+ }
1711
+ async handleLogin(e2) {
1712
+ const { username, password } = e2.detail;
1713
+ this.loginError = "";
1714
+ if (!username || !password) {
1715
+ this.loginError = "Username and password required";
1716
+ return;
1717
+ }
1718
+ try {
1719
+ await this.apiService.login(username, password);
1720
+ this.isAuthenticated = true;
1721
+ await this.fetchContent();
1722
+ } catch (e22) {
1723
+ this.loginError = e22.message;
1724
+ }
1725
+ }
1726
+ async handleSetup(e2) {
1727
+ const { username, password, confirmPassword } = e2.detail;
1728
+ this.loginError = "";
1729
+ if (!username || !password) {
1730
+ this.loginError = "Username and password required";
1731
+ return;
1732
+ }
1733
+ if (username.length < 3) {
1734
+ this.loginError = "Username must be at least 3 characters";
1735
+ return;
1736
+ }
1737
+ if (password.length < 8) {
1738
+ this.loginError = "Password must be at least 8 characters";
1739
+ return;
1740
+ }
1741
+ if (password !== confirmPassword) {
1742
+ this.loginError = "Passwords do not match";
1743
+ return;
1744
+ }
1745
+ try {
1746
+ await this.apiService.setup(username, password);
1747
+ this.isAuthenticated = true;
1748
+ this.isSetup = true;
1749
+ await this.fetchContent();
1750
+ } catch (e22) {
1751
+ this.loginError = e22.message;
1752
+ }
1753
+ }
1754
+ async handleLogout() {
1755
+ try {
1756
+ await this.apiService.logout();
1757
+ } catch (e2) {
1758
+ }
1759
+ this.isAuthenticated = false;
1760
+ this.contentList = [];
1761
+ }
1762
+ async fetchContent() {
1763
+ try {
1764
+ this.contentList = await this.apiService.fetchContent();
1765
+ } catch (e2) {
1766
+ this.statusMessage = "Error fetching content.";
1767
+ }
1768
+ }
1769
+ async fetchStaticDetails() {
1770
+ try {
1771
+ this.staticDetails = await this.apiService.fetchStaticDetails();
1772
+ } catch (e2) {
1773
+ }
1774
+ }
1775
+ async handleUpload(key, file) {
1776
+ try {
1777
+ this.statusMessage = "Uploading...";
1778
+ await this.apiService.uploadContent(key, file);
1779
+ this.statusMessage = "Upload successful!";
1780
+ await this.fetchContent();
1781
+ } catch (e2) {
1782
+ this.statusMessage = "Error uploading.";
1783
+ }
1784
+ }
1785
+ async handleClearCache() {
1786
+ try {
1787
+ this.statusMessage = "Clearing cache...";
1788
+ await this.apiService.clearCache();
1789
+ this.statusMessage = "Cache cleared!";
1790
+ } catch (e2) {
1791
+ this.statusMessage = "Error clearing cache.";
1792
+ }
1793
+ }
1794
+ async handleDelete(key) {
1795
+ try {
1796
+ await this.apiService.deleteContent(key);
1797
+ await this.fetchContent();
1798
+ } catch (e2) {
1799
+ this.statusMessage = "Error deleting.";
1800
+ }
1801
+ }
1802
+ handleStatusMessage(message) {
1803
+ this.statusMessage = message;
1804
+ }
1805
+ renderLoginForm() {
1806
+ return html`
1807
+ <admin-login-form
1808
+ .errorMessage=${this.loginError}
1809
+ .isSetup=${false}
1810
+ @login-submit=${this.handleSetup}
1811
+ ></admin-login-form>
1812
+ `;
1813
+ }
1814
+ renderLogin() {
1815
+ return html`
1816
+ <admin-login-form
1817
+ .errorMessage=${this.loginError}
1818
+ .isSetup=${true}
1819
+ @login-submit=${this.handleLogin}
1820
+ ></admin-login-form>
1821
+ `;
1822
+ }
1823
+ render() {
1824
+ if (this.isLoading) {
1825
+ return html`<div class="container"><div class="loading">Loading...</div></div>`;
1826
+ }
1827
+ if (!this.isSetup) {
1828
+ return this.renderLoginForm();
1829
+ }
1830
+ if (!this.isAuthenticated) {
1831
+ return this.renderLogin();
1832
+ }
1833
+ return html`
1834
+ <div class="container">
1835
+ <div class="header">
1836
+ <h1>Content Manager</h1>
1837
+ <button class="btn-secondary" @click=${() => this.handleLogout()}>Logout</button>
1838
+ <button class="btn-secondary" @click=${() => this.handleClearCache()}>Clear Cache</button>
1839
+ </div>
1840
+
1841
+ <div class="nav-tabs">
1842
+ <button class="nav-tab ${this.activeSection === "home" ? "active" : ""}"
1843
+ @click=${() => this.activeSection = "home"}>Home</button>
1844
+ <button class="nav-tab ${this.activeSection === "profile" ? "active" : ""}"
1845
+ @click=${() => this.activeSection = "profile"}>Profile</button>
1846
+ <button class="nav-tab ${this.activeSection === "aboutme" ? "active" : ""}"
1847
+ @click=${() => this.activeSection = "aboutme"}>About Me</button>
1848
+ <button class="nav-tab ${this.activeSection === "blogs" ? "active" : ""}"
1849
+ @click=${() => this.activeSection = "blogs"}>Blogs</button>
1850
+ <button class="nav-tab ${this.activeSection === "stories" ? "active" : ""}"
1851
+ @click=${() => this.activeSection = "stories"}>Stories</button>
1852
+ <button class="nav-tab ${this.activeSection === "images" ? "active" : ""}"
1853
+ @click=${() => this.activeSection = "images"}>Images</button>
1854
+ <button class="nav-tab ${this.activeSection === "logo" ? "active" : ""}"
1855
+ @click=${() => this.activeSection = "logo"}>Logo</button>
1856
+ <button class="nav-tab ${this.activeSection === "static" ? "active" : ""}"
1857
+ @click=${() => {
1858
+ this.activeSection = "static";
1859
+ this.fetchStaticDetails();
1860
+ }}>Site Settings</button>
1861
+ </div>
1862
+
1863
+ ${this.statusMessage ? html`
1864
+ <div class="status-message ${this.statusMessage.includes("successful") || this.statusMessage.includes("cleared") ? "success" : this.statusMessage.includes("failed") || this.statusMessage.includes("Error") ? "error" : ""}">
1865
+ ${this.statusMessage}
1866
+ </div>
1867
+ ` : ""}
1868
+
1869
+ ${this.activeSection === "home" ? html`
1870
+ <admin-home-section
1871
+ .contentList=${this.contentList}
1872
+ .onUpload=${this.handleUpload.bind(this)}
1873
+ .onDelete=${this.handleDelete.bind(this)}
1874
+ .onStatusMessage=${this.handleStatusMessage.bind(this)}
1875
+ ></admin-home-section>
1876
+ ` : ""}
1877
+
1878
+ ${this.activeSection === "profile" ? html`
1879
+ <admin-profile-section
1880
+ .contentList=${this.contentList}
1881
+ .onUpload=${this.handleUpload.bind(this)}
1882
+ .onDelete=${this.handleDelete.bind(this)}
1883
+ .onStatusMessage=${this.handleStatusMessage.bind(this)}
1884
+ ></admin-profile-section>
1885
+ ` : ""}
1886
+
1887
+ ${this.activeSection === "aboutme" ? html`
1888
+ <admin-about-me-section
1889
+ .contentList=${this.contentList}
1890
+ .onUpload=${this.handleUpload.bind(this)}
1891
+ .onDelete=${this.handleDelete.bind(this)}
1892
+ .onStatusMessage=${this.handleStatusMessage.bind(this)}
1893
+ ></admin-about-me-section>
1894
+ ` : ""}
1895
+
1896
+ ${this.activeSection === "blogs" ? html`
1897
+ <admin-blogs-section
1898
+ .contentList=${this.contentList}
1899
+ .onUpload=${this.handleUpload.bind(this)}
1900
+ .onDelete=${this.handleDelete.bind(this)}
1901
+ .onStatusMessage=${this.handleStatusMessage.bind(this)}
1902
+ ></admin-blogs-section>
1903
+ ` : ""}
1904
+
1905
+ ${this.activeSection === "stories" ? html`
1906
+ <admin-stories-section
1907
+ .contentList=${this.contentList}
1908
+ .onUpload=${this.handleUpload.bind(this)}
1909
+ .onDelete=${this.handleDelete.bind(this)}
1910
+ .onStatusMessage=${this.handleStatusMessage.bind(this)}
1911
+ ></admin-stories-section>
1912
+ ` : ""}
1913
+
1914
+ ${this.activeSection === "images" ? html`
1915
+ <admin-images-section
1916
+ .contentList=${this.contentList}
1917
+ .onUpload=${this.handleUpload.bind(this)}
1918
+ .onDelete=${this.handleDelete.bind(this)}
1919
+ .onStatusMessage=${this.handleStatusMessage.bind(this)}
1920
+ ></admin-images-section>
1921
+ ` : ""}
1922
+
1923
+ ${this.activeSection === "logo" ? html`
1924
+ <admin-logo-section
1925
+ .contentList=${this.contentList}
1926
+ .onUpload=${this.handleUpload.bind(this)}
1927
+ .onDelete=${this.handleDelete.bind(this)}
1928
+ .onStatusMessage=${this.handleStatusMessage.bind(this)}
1929
+ ></admin-logo-section>
1930
+ ` : ""}
1931
+
1932
+ ${this.activeSection === "static" ? html`
1933
+ <admin-static-section
1934
+ .contentList=${this.contentList}
1935
+ .staticDetails=${this.staticDetails}
1936
+ .onUpload=${this.handleUpload.bind(this)}
1937
+ .onDelete=${this.handleDelete.bind(this)}
1938
+ .onStatusMessage=${this.handleStatusMessage.bind(this)}
1939
+ ></admin-static-section>
1940
+ ` : ""}
1081
1941
  </div>
1082
1942
  `;
1083
1943
  }
@@ -1159,6 +2019,7 @@ __decorateElement$4(_init$4, 4, "loginError", _loginError_dec, AdminPortal, _log
1159
2019
  AdminPortal = __decorateElement$4(_init$4, 0, "AdminPortal", _AdminPortal_decorators, AdminPortal);
1160
2020
  AdminPortal.styles = adminStyles;
1161
2021
  __runInitializers$4(_init$4, 1, AdminPortal);
2022
+ const adminLoaded = true;
1162
2023
  const bannerStyles = css`
1163
2024
  :host {
1164
2025
  display: block;
@@ -1782,7 +2643,7 @@ class BlogViewer extends (_a$1 = LitElement, _slug_dec$1 = [property({ type: Str
1782
2643
  __privateAdd$1(this, _error$1, __runInitializers$1(_init$1, 20, this, "")), __runInitializers$1(_init$1, 23, this);
1783
2644
  }
1784
2645
  get apiBaseUrl() {
1785
- return "https://api.techieleader.com";
2646
+ return this.getAttribute("api-url") || window.__VITE_API_URL__ || void 0 || "https://api.exampledomain.com";
1786
2647
  }
1787
2648
  connectedCallback() {
1788
2649
  super.connectedCallback();
@@ -1981,7 +2842,7 @@ class StoryViewer extends (_a = LitElement, _slug_dec = [property({ type: String
1981
2842
  __privateAdd(this, _error, __runInitializers(_init, 20, this, "")), __runInitializers(_init, 23, this);
1982
2843
  }
1983
2844
  get apiBaseUrl() {
1984
- return "https://api.techieleader.com";
2845
+ return this.getAttribute("api-url") || window.__VITE_API_URL__ || void 0 || "https://api.exampledomain.com";
1985
2846
  }
1986
2847
  async connectedCallback() {
1987
2848
  super.connectedCallback();
@@ -2061,10 +2922,20 @@ StoryViewer = __decorateElement(_init, 0, "StoryViewer", _StoryViewer_decorators
2061
2922
  StoryViewer.styles = storyviewerStyles;
2062
2923
  __runInitializers(_init, 1, StoryViewer);
2063
2924
  export {
2064
- AdminPortal as A,
2925
+ AdminAboutMeSection as A,
2065
2926
  BlogViewer as B,
2066
2927
  FooterComponent as F,
2067
2928
  MyAboutme as M,
2068
2929
  StoryViewer as S,
2069
- MyBanner as a
2930
+ AdminBlogsSection as a,
2931
+ AdminHomeSection as b,
2932
+ AdminImagesSection as c,
2933
+ AdminLoginForm as d,
2934
+ AdminLogoSection as e,
2935
+ AdminPortal as f,
2936
+ AdminProfileSection as g,
2937
+ AdminStaticSection as h,
2938
+ AdminStoriesSection as i,
2939
+ MyBanner as j,
2940
+ adminLoaded as k
2070
2941
  };