jammincms 0.1.0 → 0.1.1

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.
@@ -0,0 +1,31 @@
1
+ {
2
+ "manifest_version": 3,
3
+ "name": "Jammin CMS",
4
+ "description": "Inline website editing with Claude Code",
5
+ "version": "1.0.0",
6
+ "permissions": [
7
+ "storage",
8
+ "activeTab",
9
+ "scripting"
10
+ ],
11
+ "host_permissions": [
12
+ "<all_urls>"
13
+ ],
14
+ "background": {
15
+ "service_worker": "background.js",
16
+ "type": "module"
17
+ },
18
+ "content_scripts": [
19
+ {
20
+ "matches": ["<all_urls>"],
21
+ "js": ["content.js"],
22
+ "css": [],
23
+ "run_at": "document_idle"
24
+ }
25
+ ],
26
+ "action": {
27
+ "default_popup": "popup.html",
28
+ "default_title": "Jammin CMS"
29
+ },
30
+ "options_page": "options.html"
31
+ }
@@ -0,0 +1,425 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Jammin CMS - Settings</title>
7
+ <style>
8
+ * {
9
+ box-sizing: border-box;
10
+ margin: 0;
11
+ padding: 0;
12
+ }
13
+
14
+ body {
15
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
16
+ font-size: 14px;
17
+ line-height: 1.5;
18
+ background: #1e1e2e;
19
+ color: #e0e0e0;
20
+ min-height: 100vh;
21
+ }
22
+
23
+ .container {
24
+ max-width: 800px;
25
+ margin: 0 auto;
26
+ padding: 32px 24px;
27
+ }
28
+
29
+ h1 {
30
+ font-size: 24px;
31
+ font-weight: 600;
32
+ margin-bottom: 8px;
33
+ }
34
+
35
+ .subtitle {
36
+ color: #a0a0a0;
37
+ margin-bottom: 32px;
38
+ }
39
+
40
+ h2 {
41
+ font-size: 18px;
42
+ font-weight: 600;
43
+ margin-bottom: 16px;
44
+ padding-bottom: 8px;
45
+ border-bottom: 1px solid #3a3a4e;
46
+ }
47
+
48
+ .section {
49
+ margin-bottom: 32px;
50
+ }
51
+
52
+ /* Site Cards */
53
+ .site-list {
54
+ display: flex;
55
+ flex-direction: column;
56
+ gap: 12px;
57
+ margin-bottom: 16px;
58
+ }
59
+
60
+ .site-card {
61
+ background: #2a2a3e;
62
+ border: 1px solid #3a3a4e;
63
+ border-radius: 8px;
64
+ padding: 16px;
65
+ }
66
+
67
+ .site-header {
68
+ display: flex;
69
+ justify-content: space-between;
70
+ align-items: flex-start;
71
+ margin-bottom: 8px;
72
+ }
73
+
74
+ .site-info {
75
+ flex: 1;
76
+ }
77
+
78
+ .site-name {
79
+ font-weight: 600;
80
+ margin-bottom: 4px;
81
+ }
82
+
83
+ .site-url {
84
+ font-size: 12px;
85
+ color: #a0a0a0;
86
+ font-family: monospace;
87
+ }
88
+
89
+ .site-path {
90
+ font-size: 12px;
91
+ color: #6366f1;
92
+ font-family: monospace;
93
+ margin-bottom: 12px;
94
+ }
95
+
96
+ .btn-edit {
97
+ background: #3a3a4e;
98
+ border: none;
99
+ color: #e0e0e0;
100
+ padding: 6px 12px;
101
+ border-radius: 4px;
102
+ cursor: pointer;
103
+ font-size: 12px;
104
+ }
105
+
106
+ .btn-edit:hover {
107
+ background: #4a4a5e;
108
+ }
109
+
110
+ /* Toggle Switch */
111
+ .toggle {
112
+ position: relative;
113
+ width: 36px;
114
+ height: 20px;
115
+ flex-shrink: 0;
116
+ }
117
+
118
+ .toggle input {
119
+ opacity: 0;
120
+ width: 0;
121
+ height: 0;
122
+ }
123
+
124
+ .toggle-slider {
125
+ position: absolute;
126
+ cursor: pointer;
127
+ top: 0;
128
+ left: 0;
129
+ right: 0;
130
+ bottom: 0;
131
+ background-color: #3a3a4e;
132
+ transition: 0.2s;
133
+ border-radius: 20px;
134
+ }
135
+
136
+ .toggle-slider:before {
137
+ position: absolute;
138
+ content: "";
139
+ height: 14px;
140
+ width: 14px;
141
+ left: 3px;
142
+ bottom: 3px;
143
+ background-color: white;
144
+ transition: 0.2s;
145
+ border-radius: 50%;
146
+ }
147
+
148
+ .toggle input:checked + .toggle-slider {
149
+ background-color: #6366f1;
150
+ }
151
+
152
+ .toggle input:checked + .toggle-slider:before {
153
+ transform: translateX(16px);
154
+ }
155
+
156
+ /* Buttons */
157
+ .btn {
158
+ display: inline-flex;
159
+ align-items: center;
160
+ gap: 6px;
161
+ padding: 10px 16px;
162
+ background: #6366f1;
163
+ color: white;
164
+ border: none;
165
+ border-radius: 6px;
166
+ font-size: 14px;
167
+ cursor: pointer;
168
+ }
169
+
170
+ .btn:hover {
171
+ background: #4f46e5;
172
+ }
173
+
174
+ .btn-secondary {
175
+ background: #3a3a4e;
176
+ }
177
+
178
+ .btn-secondary:hover {
179
+ background: #4a4a5e;
180
+ }
181
+
182
+ .btn-danger {
183
+ background: #ef4444;
184
+ }
185
+
186
+ .btn-danger:hover {
187
+ background: #dc2626;
188
+ }
189
+
190
+ /* Form */
191
+ .form-group {
192
+ margin-bottom: 16px;
193
+ }
194
+
195
+ label {
196
+ display: block;
197
+ margin-bottom: 6px;
198
+ font-weight: 500;
199
+ }
200
+
201
+ .label-hint {
202
+ font-weight: normal;
203
+ color: #a0a0a0;
204
+ font-size: 12px;
205
+ }
206
+
207
+ input[type="text"],
208
+ input[type="url"],
209
+ textarea,
210
+ select {
211
+ width: 100%;
212
+ padding: 10px 12px;
213
+ background: #1e1e2e;
214
+ border: 1px solid #3a3a4e;
215
+ border-radius: 6px;
216
+ color: #e0e0e0;
217
+ font-size: 14px;
218
+ font-family: inherit;
219
+ }
220
+
221
+ input:focus,
222
+ textarea:focus,
223
+ select:focus {
224
+ outline: none;
225
+ border-color: #6366f1;
226
+ }
227
+
228
+ textarea {
229
+ resize: vertical;
230
+ min-height: 80px;
231
+ font-family: monospace;
232
+ }
233
+
234
+ /* Modal */
235
+ .modal {
236
+ position: fixed;
237
+ top: 0;
238
+ left: 0;
239
+ width: 100%;
240
+ height: 100%;
241
+ background: rgba(0, 0, 0, 0.7);
242
+ display: flex;
243
+ align-items: center;
244
+ justify-content: center;
245
+ opacity: 0;
246
+ pointer-events: none;
247
+ transition: opacity 0.2s;
248
+ z-index: 1000;
249
+ }
250
+
251
+ .modal.open {
252
+ opacity: 1;
253
+ pointer-events: auto;
254
+ }
255
+
256
+ .modal-content {
257
+ background: #2a2a3e;
258
+ border: 1px solid #3a3a4e;
259
+ border-radius: 12px;
260
+ width: 100%;
261
+ max-width: 500px;
262
+ max-height: 90vh;
263
+ overflow-y: auto;
264
+ }
265
+
266
+ .modal-header {
267
+ display: flex;
268
+ justify-content: space-between;
269
+ align-items: center;
270
+ padding: 16px 20px;
271
+ border-bottom: 1px solid #3a3a4e;
272
+ }
273
+
274
+ .modal-header h3 {
275
+ font-size: 16px;
276
+ font-weight: 600;
277
+ }
278
+
279
+ .modal-body {
280
+ padding: 20px;
281
+ }
282
+
283
+ .modal-footer {
284
+ display: flex;
285
+ justify-content: space-between;
286
+ gap: 12px;
287
+ padding: 16px 20px;
288
+ border-top: 1px solid #3a3a4e;
289
+ }
290
+
291
+ .modal-footer-left {
292
+ flex: 1;
293
+ }
294
+
295
+ .modal-footer-right {
296
+ display: flex;
297
+ gap: 8px;
298
+ }
299
+
300
+ /* Settings */
301
+ .settings-grid {
302
+ display: grid;
303
+ grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
304
+ gap: 16px;
305
+ }
306
+
307
+ .setting-card {
308
+ background: #2a2a3e;
309
+ border: 1px solid #3a3a4e;
310
+ border-radius: 8px;
311
+ padding: 16px;
312
+ }
313
+
314
+ /* Empty state */
315
+ .empty-state {
316
+ text-align: center;
317
+ padding: 32px;
318
+ color: #a0a0a0;
319
+ }
320
+
321
+ .empty-state p {
322
+ margin-bottom: 8px;
323
+ }
324
+ </style>
325
+ </head>
326
+ <body>
327
+ <div class="container">
328
+ <h1>Jammin CMS</h1>
329
+ <p class="subtitle">Inline website editing with Claude Code</p>
330
+
331
+ <div class="section">
332
+ <h2>Sites</h2>
333
+ <div id="site-list" class="site-list"></div>
334
+ <button id="add-site" class="btn">
335
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
336
+ <line x1="12" y1="5" x2="12" y2="19"></line>
337
+ <line x1="5" y1="12" x2="19" y2="12"></line>
338
+ </svg>
339
+ Add Site
340
+ </button>
341
+ </div>
342
+
343
+ <div class="section">
344
+ <h2>Settings</h2>
345
+ <div class="settings-grid">
346
+ <div class="setting-card">
347
+ <div class="form-group">
348
+ <label for="bridge-url">Bridge URL</label>
349
+ <input type="url" id="bridge-url" placeholder="ws://localhost:9876">
350
+ </div>
351
+ </div>
352
+ <div class="setting-card">
353
+ <div class="form-group">
354
+ <label for="claude-path">Claude CLI Path</label>
355
+ <input type="text" id="claude-path" placeholder="/Users/you/.local/bin/claude">
356
+ </div>
357
+ </div>
358
+ <div class="setting-card">
359
+ <div class="form-group">
360
+ <label for="default-editor">Default Editor</label>
361
+ <select id="default-editor">
362
+ <option value="auto">Auto-detect</option>
363
+ <option value="cursor">Cursor</option>
364
+ <option value="code">VS Code</option>
365
+ </select>
366
+ </div>
367
+ </div>
368
+ </div>
369
+ </div>
370
+ </div>
371
+
372
+ <!-- Site Modal -->
373
+ <div id="site-modal" class="modal">
374
+ <div class="modal-content">
375
+ <div class="modal-header">
376
+ <h3 id="modal-title">Add Site</h3>
377
+ </div>
378
+ <form id="site-form">
379
+ <div class="modal-body">
380
+ <div class="form-group">
381
+ <label for="site-name-input">Name</label>
382
+ <input type="text" id="site-name-input" placeholder="My Website" required>
383
+ </div>
384
+ <div class="form-group">
385
+ <label for="site-pattern">
386
+ URL Pattern
387
+ <span class="label-hint">(use * as wildcard)</span>
388
+ </label>
389
+ <input type="text" id="site-pattern" placeholder="https://example.com/*" required>
390
+ </div>
391
+ <div class="form-group">
392
+ <label for="site-path">Local Project Path</label>
393
+ <input type="text" id="site-path" placeholder="/Users/you/Code/project" required>
394
+ </div>
395
+ <div class="form-group">
396
+ <label for="site-instructions">
397
+ Custom Instructions
398
+ <span class="label-hint">(optional context for Claude)</span>
399
+ </label>
400
+ <textarea id="site-instructions" placeholder="This is a Next.js blog using MDX files in /posts..."></textarea>
401
+ </div>
402
+ <div class="form-group">
403
+ <label for="site-selectors">
404
+ Editable Selectors
405
+ <span class="label-hint">(one per line)</span>
406
+ </label>
407
+ <textarea id="site-selectors" placeholder="main&#10;article&#10;[role='main']"></textarea>
408
+ </div>
409
+ </div>
410
+ <div class="modal-footer">
411
+ <div class="modal-footer-left">
412
+ <button type="button" id="delete-site" class="btn btn-danger" style="display: none;">Delete</button>
413
+ </div>
414
+ <div class="modal-footer-right">
415
+ <button type="button" id="cancel-modal" class="btn btn-secondary">Cancel</button>
416
+ <button type="submit" class="btn">Save</button>
417
+ </div>
418
+ </div>
419
+ </form>
420
+ </div>
421
+ </div>
422
+
423
+ <script type="module" src="options.js"></script>
424
+ </body>
425
+ </html>
@@ -0,0 +1,25 @@
1
+ const m={bridgeUrl:"ws://localhost:9876",claudePath:"claude",defaultEditor:"auto",showStatusPanel:!0,autoSave:!1},u=["main","article",'[role="main"]'],d={SITES:"jammin_sites",SETTINGS:"jammin_settings"},S="jammin_site_form_draft",_=["site-name-input","site-pattern","site-path","site-instructions","site-selectors"];let i=[],a={...m},l=null;const r=document.getElementById("site-list"),A=document.getElementById("add-site"),g=document.getElementById("site-modal"),P=document.getElementById("site-form"),F=document.getElementById("modal-title"),M=document.getElementById("cancel-modal"),h=document.getElementById("delete-site"),f=document.getElementById("bridge-url"),y=document.getElementById("claude-path"),p=document.getElementById("default-editor");async function k(){const e=await chrome.storage.sync.get([d.SITES,d.SETTINGS]);i=e[d.SITES]||[],a={...m,...e[d.SETTINGS]},L(),$()}async function B(){await chrome.storage.sync.set({[d.SITES]:i})}async function T(){await chrome.storage.sync.set({[d.SETTINGS]:a})}function U(){const e={"site-name-input":document.getElementById("site-name-input").value,"site-pattern":document.getElementById("site-pattern").value,"site-path":document.getElementById("site-path").value,"site-instructions":document.getElementById("site-instructions").value,"site-selectors":document.getElementById("site-selectors").value};localStorage.setItem(S,JSON.stringify(e))}function N(){const e=localStorage.getItem(S);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function E(){localStorage.removeItem(S)}function j(e){document.getElementById("site-name-input").value=e["site-name-input"]||"",document.getElementById("site-pattern").value=e["site-pattern"]||"",document.getElementById("site-path").value=e["site-path"]||"",document.getElementById("site-instructions").value=e["site-instructions"]||"",document.getElementById("site-selectors").value=e["site-selectors"]||u.join(`
2
+ `)}function L(){if(i.length===0){r.innerHTML=`
3
+ <div class="empty-state">
4
+ <p>No sites configured yet.</p>
5
+ <p>Click "Add Site" to get started.</p>
6
+ </div>
7
+ `;return}r.innerHTML=i.map(e=>`
8
+ <div class="site-card" data-id="${e.id}">
9
+ <div class="site-header">
10
+ <div class="site-info">
11
+ <div class="site-name">${I(e.name)}</div>
12
+ <div class="site-url">${I(e.urlPattern)}</div>
13
+ </div>
14
+ <label class="toggle">
15
+ <input type="checkbox" ${e.enabled?"checked":""} data-toggle="${e.id}">
16
+ <span class="toggle-slider"></span>
17
+ </label>
18
+ </div>
19
+ <div class="site-path">${I(e.localPath)}</div>
20
+ <button class="btn-edit" data-edit="${e.id}">Edit</button>
21
+ </div>
22
+ `).join(""),r.querySelectorAll("[data-toggle]").forEach(e=>{e.addEventListener("change",t=>{const s=t.target.dataset.toggle,o=i.find(v=>v.id===s);o&&(o.enabled=t.target.checked,B())})}),r.querySelectorAll("[data-edit]").forEach(e=>{e.addEventListener("click",t=>{const s=t.target.dataset.edit;G(s)})})}function $(){f.value=a.bridgeUrl,y.value=a.claudePath||"claude",p.value=a.defaultEditor}function w(){l=null,F.textContent="Add Site",h.style.display="none";const e=N();e?j(e):(P.reset(),document.getElementById("site-selectors").value=u.join(`
23
+ `)),g.classList.add("open")}function G(e){const t=i.find(s=>s.id===e);t&&(l=e,F.textContent="Edit Site",h.style.display="block",E(),document.getElementById("site-name-input").value=t.name,document.getElementById("site-pattern").value=t.urlPattern,document.getElementById("site-path").value=t.localPath,document.getElementById("site-instructions").value=t.customInstructions||"",document.getElementById("site-selectors").value=t.editableSelectors.join(`
24
+ `),g.classList.add("open"))}function b(){g.classList.remove("open"),l=null}function O(){E(),b()}function x(){const e=document.getElementById("site-name-input").value.trim(),t=document.getElementById("site-pattern").value.trim(),s=document.getElementById("site-path").value.trim(),o=document.getElementById("site-instructions").value.trim(),v=document.getElementById("site-selectors").value.trim();if(!e||!t||!s){alert("Please fill in all required fields.");return}const c=v.split(`
25
+ `).map(n=>n.trim()).filter(n=>n);if(l){const n=i.find(D=>D.id===l);n&&(n.name=e,n.urlPattern=t,n.localPath=s,n.customInstructions=o,n.editableSelectors=c.length>0?c:[...u])}else i.push({id:crypto.randomUUID(),name:e,urlPattern:t,localPath:s,customInstructions:o,editableSelectors:c.length>0?c:[...u],enabled:!0});E(),B(),L(),b()}function C(){l&&confirm("Are you sure you want to delete this site?")&&(i=i.filter(e=>e.id!==l),E(),B(),L(),b())}function I(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}A.addEventListener("click",w);M.addEventListener("click",O);h.addEventListener("click",C);P.addEventListener("submit",e=>{e.preventDefault(),x()});_.forEach(e=>{const t=document.getElementById(e);t==null||t.addEventListener("input",()=>{l===null&&g.classList.contains("open")&&U()})});f.addEventListener("change",()=>{a.bridgeUrl=f.value.trim()||m.bridgeUrl,T()});y.addEventListener("change",()=>{a.claudePath=y.value.trim()||m.claudePath,T()});p.addEventListener("change",()=>{a.defaultEditor=p.value,T()});k();
@@ -0,0 +1,191 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Jammin CMS</title>
7
+ <style>
8
+ * {
9
+ box-sizing: border-box;
10
+ margin: 0;
11
+ padding: 0;
12
+ }
13
+
14
+ body {
15
+ width: 280px;
16
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
17
+ font-size: 14px;
18
+ line-height: 1.5;
19
+ background: #1e1e2e;
20
+ color: #e0e0e0;
21
+ }
22
+
23
+ .header {
24
+ padding: 16px;
25
+ background: #2a2a3e;
26
+ border-bottom: 1px solid #3a3a4e;
27
+ }
28
+
29
+ .header h1 {
30
+ font-size: 16px;
31
+ font-weight: 600;
32
+ margin-bottom: 8px;
33
+ }
34
+
35
+ .status-row {
36
+ display: flex;
37
+ align-items: center;
38
+ gap: 8px;
39
+ }
40
+
41
+ .status-dot {
42
+ width: 8px;
43
+ height: 8px;
44
+ border-radius: 50%;
45
+ background: #6b7280;
46
+ }
47
+
48
+ .status-dot.connected {
49
+ background: #22c55e;
50
+ }
51
+
52
+ .status-dot.disconnected {
53
+ background: #ef4444;
54
+ }
55
+
56
+ .status-dot.warning {
57
+ background: #f59e0b;
58
+ }
59
+
60
+ .status-text {
61
+ font-size: 12px;
62
+ color: #a0a0a0;
63
+ }
64
+
65
+ .content {
66
+ padding: 16px;
67
+ }
68
+
69
+ .site-info {
70
+ background: #2a2a3e;
71
+ border-radius: 6px;
72
+ padding: 12px;
73
+ margin-bottom: 12px;
74
+ }
75
+
76
+ .site-header {
77
+ display: flex;
78
+ justify-content: space-between;
79
+ align-items: center;
80
+ margin-bottom: 4px;
81
+ }
82
+
83
+ .site-label {
84
+ font-size: 11px;
85
+ color: #a0a0a0;
86
+ text-transform: uppercase;
87
+ letter-spacing: 0.5px;
88
+ }
89
+
90
+ .site-status {
91
+ font-size: 11px;
92
+ color: #a0a0a0;
93
+ padding: 2px 8px;
94
+ border-radius: 10px;
95
+ background: #3a3a4e;
96
+ }
97
+
98
+ .site-status.active {
99
+ color: #22c55e;
100
+ background: rgba(34, 197, 94, 0.15);
101
+ }
102
+
103
+ .site-name {
104
+ font-weight: 500;
105
+ margin-bottom: 12px;
106
+ }
107
+
108
+ .no-site {
109
+ text-align: center;
110
+ padding: 16px;
111
+ color: #a0a0a0;
112
+ }
113
+
114
+ .no-site p {
115
+ margin-bottom: 12px;
116
+ }
117
+
118
+ .btn {
119
+ display: block;
120
+ width: 100%;
121
+ padding: 10px 16px;
122
+ background: #6366f1;
123
+ color: white;
124
+ border: none;
125
+ border-radius: 6px;
126
+ font-size: 14px;
127
+ cursor: pointer;
128
+ text-align: center;
129
+ text-decoration: none;
130
+ transition: background-color 0.2s;
131
+ }
132
+
133
+ .btn:hover:not(:disabled) {
134
+ background: #4f46e5;
135
+ }
136
+
137
+ .btn:disabled {
138
+ opacity: 0.6;
139
+ cursor: not-allowed;
140
+ }
141
+
142
+ .btn.activated {
143
+ background: #22c55e;
144
+ }
145
+
146
+ .btn-secondary {
147
+ background: #3a3a4e;
148
+ }
149
+
150
+ .btn-secondary:hover:not(:disabled) {
151
+ background: #4a4a5e;
152
+ }
153
+
154
+ .footer {
155
+ padding: 12px 16px;
156
+ border-top: 1px solid #3a3a4e;
157
+ }
158
+ </style>
159
+ </head>
160
+ <body>
161
+ <div class="header">
162
+ <h1>Jammin CMS</h1>
163
+ <div class="status-row">
164
+ <span id="status-dot" class="status-dot"></span>
165
+ <span id="connection-status" class="status-text">Checking...</span>
166
+ </div>
167
+ </div>
168
+
169
+ <div class="content">
170
+ <div id="site-info" class="site-info" style="display: none;">
171
+ <div class="site-header">
172
+ <div class="site-label">Current Site</div>
173
+ <span id="site-status" class="site-status">Inactive</span>
174
+ </div>
175
+ <div id="site-name" class="site-name"></div>
176
+ <button id="activate-btn" class="btn">Activate Editing</button>
177
+ </div>
178
+
179
+ <div id="no-site" class="no-site" style="display: none;">
180
+ <p>This site is not configured for editing.</p>
181
+ <button id="configure-site" class="btn">Configure Site</button>
182
+ </div>
183
+ </div>
184
+
185
+ <div class="footer">
186
+ <button id="open-options" class="btn btn-secondary">Settings</button>
187
+ </div>
188
+
189
+ <script type="module" src="popup.js"></script>
190
+ </body>
191
+ </html>
@@ -0,0 +1 @@
1
+ async function r(){return new Promise(t=>{chrome.runtime.sendMessage({action:"get_connection_status"},e=>{t((e==null?void 0:e.payload)||{connected:!1})})})}async function m(){const[t]=await chrome.tabs.query({active:!0,currentWindow:!0});return t!=null&&t.url?new Promise(e=>{chrome.runtime.sendMessage({action:"get_site_config",payload:{url:t.url}},n=>{e((n==null?void 0:n.payload)||null)})}):null}async function f(){const[t]=await chrome.tabs.query({active:!0,currentWindow:!0});return t!=null&&t.id?new Promise(e=>{chrome.tabs.sendMessage(t.id,{action:"cms_status"},n=>{if(chrome.runtime.lastError||!n){e(!1);return}e((n==null?void 0:n.activated)||!1)})}):!1}async function y(){const[t]=await chrome.tabs.query({active:!0,currentWindow:!0});return t!=null&&t.id?new Promise(e=>{chrome.tabs.sendMessage(t.id,{action:"activate_cms"},n=>{if(chrome.runtime.lastError||!n){e(!1);return}e((n==null?void 0:n.activated)||!1)})}):!1}async function s(){const t=document.getElementById("connection-status"),e=document.getElementById("status-dot"),n=document.getElementById("site-info"),l=document.getElementById("site-name"),i=document.getElementById("site-status"),o=document.getElementById("no-site"),a=document.getElementById("activate-btn"),c=await r();c.connected?(t.textContent=`Connected (v${c.bridgeVersion||"?"})`,e.className="status-dot connected",c.claudeAvailable||(t.textContent+=" - Claude CLI not found",e.className="status-dot warning")):(t.textContent=c.error||"Disconnected",e.className="status-dot disconnected");const d=await m();d?(n.style.display="block",o.style.display="none",l.textContent=d.name,await f()?(i.textContent="Active",i.className="site-status active",a.textContent="Activated",a.classList.add("activated"),a.disabled=!0):(i.textContent="Inactive",i.className="site-status",a.textContent="Activate Editing",a.classList.remove("activated"),a.disabled=!1)):(n.style.display="none",o.style.display="block")}function u(){chrome.runtime.openOptionsPage()}async function g(){const t=document.getElementById("activate-btn");t.textContent="Activating...",t.disabled=!0,await y()?(await s(),setTimeout(()=>window.close(),500)):(t.textContent="Activate Editing",t.disabled=!1)}document.addEventListener("DOMContentLoaded",()=>{var t,e,n;s(),(t=document.getElementById("open-options"))==null||t.addEventListener("click",u),(e=document.getElementById("configure-site"))==null||e.addEventListener("click",u),(n=document.getElementById("activate-btn"))==null||n.addEventListener("click",g),setInterval(s,5e3)});