nostr-components 0.2.0

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 (132) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +334 -0
  3. package/dist/assets/base-styles-CBypR3FR.js +145 -0
  4. package/dist/assets/base-styles-CBypR3FR.js.map +1 -0
  5. package/dist/assets/copy-delegation-C4uvRTVM.js +15 -0
  6. package/dist/assets/copy-delegation-C4uvRTVM.js.map +1 -0
  7. package/dist/assets/dialog-component-Dqg0QU9I.js +66 -0
  8. package/dist/assets/dialog-component-Dqg0QU9I.js.map +1 -0
  9. package/dist/assets/dialog-likers-BzTesCZa.js +238 -0
  10. package/dist/assets/dialog-likers-BzTesCZa.js.map +1 -0
  11. package/dist/assets/icons-Dr_d9MII.js +105 -0
  12. package/dist/assets/icons-Dr_d9MII.js.map +1 -0
  13. package/dist/assets/nip05-utils-BNBHUmkr.js +2 -0
  14. package/dist/assets/nip05-utils-BNBHUmkr.js.map +1 -0
  15. package/dist/assets/nostr-service-pr_crY62.js +78 -0
  16. package/dist/assets/nostr-service-pr_crY62.js.map +1 -0
  17. package/dist/assets/nostr-user-component-Q7GeeFyu.js +2 -0
  18. package/dist/assets/nostr-user-component-Q7GeeFyu.js.map +1 -0
  19. package/dist/assets/preload-helper-D7HrI6pR.js +2 -0
  20. package/dist/assets/preload-helper-D7HrI6pR.js.map +1 -0
  21. package/dist/assets/pure-jrVhRVpB.js +2 -0
  22. package/dist/assets/pure-jrVhRVpB.js.map +1 -0
  23. package/dist/assets/theme-C1r1Zw8r.js +2 -0
  24. package/dist/assets/theme-C1r1Zw8r.js.map +1 -0
  25. package/dist/assets/user-resolver-C-E6KdwY.js +2 -0
  26. package/dist/assets/user-resolver-C-E6KdwY.js.map +1 -0
  27. package/dist/assets/utils--bxLbhGF.js +2 -0
  28. package/dist/assets/utils--bxLbhGF.js.map +1 -0
  29. package/dist/assets/zap-utils-B1sz0Abx.js +2 -0
  30. package/dist/assets/zap-utils-B1sz0Abx.js.map +1 -0
  31. package/dist/components/nostr-comment.es.js +924 -0
  32. package/dist/components/nostr-comment.es.js.map +1 -0
  33. package/dist/components/nostr-dm.es.js +217 -0
  34. package/dist/components/nostr-dm.es.js.map +1 -0
  35. package/dist/components/nostr-follow-button.es.js +103 -0
  36. package/dist/components/nostr-follow-button.es.js.map +1 -0
  37. package/dist/components/nostr-like.es.js +296 -0
  38. package/dist/components/nostr-like.es.js.map +1 -0
  39. package/dist/components/nostr-live-chat.es.js +523 -0
  40. package/dist/components/nostr-live-chat.es.js.map +1 -0
  41. package/dist/components/nostr-post.es.js +441 -0
  42. package/dist/components/nostr-post.es.js.map +1 -0
  43. package/dist/components/nostr-profile-badge.es.js +100 -0
  44. package/dist/components/nostr-profile-badge.es.js.map +1 -0
  45. package/dist/components/nostr-profile.es.js +287 -0
  46. package/dist/components/nostr-profile.es.js.map +1 -0
  47. package/dist/components/nostr-zap.es.js +694 -0
  48. package/dist/components/nostr-zap.es.js.map +1 -0
  49. package/dist/index.d.ts +2 -0
  50. package/dist/nostr-comment.d.ts +4 -0
  51. package/dist/nostr-components.es.js +2 -0
  52. package/dist/nostr-components.es.js.map +1 -0
  53. package/dist/nostr-components.umd.js +4200 -0
  54. package/dist/nostr-components.umd.js.map +1 -0
  55. package/dist/nostr-dm.d.ts +4 -0
  56. package/dist/nostr-follow-button.d.ts +4 -0
  57. package/dist/nostr-like.d.ts +4 -0
  58. package/dist/nostr-live-chat.d.ts +4 -0
  59. package/dist/nostr-post.d.ts +4 -0
  60. package/dist/nostr-profile-badge.d.ts +4 -0
  61. package/dist/nostr-profile.d.ts +4 -0
  62. package/dist/nostr-zap.d.ts +4 -0
  63. package/dist/src/base/base-component/nostr-base-component.d.ts +116 -0
  64. package/dist/src/base/copy-delegation.d.ts +5 -0
  65. package/dist/src/base/dialog-component/dialog-component.d.ts +67 -0
  66. package/dist/src/base/dialog-component/style.d.ts +5 -0
  67. package/dist/src/base/event-component/nostr-event-component.d.ts +53 -0
  68. package/dist/src/base/render-options.d.ts +5 -0
  69. package/dist/src/base/resolvers/event-resolver.d.ts +20 -0
  70. package/dist/src/base/resolvers/user-resolver.d.ts +19 -0
  71. package/dist/src/base/text-row/render-name.d.ts +7 -0
  72. package/dist/src/base/text-row/render-nip05.d.ts +1 -0
  73. package/dist/src/base/text-row/render-npub.d.ts +1 -0
  74. package/dist/src/base/text-row/render-text-row.d.ts +9 -0
  75. package/dist/src/base/user-component/nostr-user-component.d.ts +43 -0
  76. package/dist/src/common/base-styles.d.ts +44 -0
  77. package/dist/src/common/constants.d.ts +4 -0
  78. package/dist/src/common/date-utils.d.ts +9 -0
  79. package/dist/src/common/icons.d.ts +7 -0
  80. package/dist/src/common/nip05-utils.d.ts +13 -0
  81. package/dist/src/common/nostr-service.d.ts +40 -0
  82. package/dist/src/common/theme.d.ts +4 -0
  83. package/dist/src/common/types.d.ts +1 -0
  84. package/dist/src/common/utils.d.ts +34 -0
  85. package/dist/src/index.d.ts +10 -0
  86. package/dist/src/nostr-comment/nostr-comment.d.ts +60 -0
  87. package/dist/src/nostr-comment/render.d.ts +15 -0
  88. package/dist/src/nostr-comment/utils.d.ts +81 -0
  89. package/dist/src/nostr-dm/nostr-dm.d.ts +34 -0
  90. package/dist/src/nostr-dm/render.d.ts +15 -0
  91. package/dist/src/nostr-follow-button/nostr-follow-button.d.ts +24 -0
  92. package/dist/src/nostr-follow-button/render.d.ts +11 -0
  93. package/dist/src/nostr-follow-button/style.d.ts +1 -0
  94. package/dist/src/nostr-like/dialog-help-style.d.ts +1 -0
  95. package/dist/src/nostr-like/dialog-help.d.ts +2 -0
  96. package/dist/src/nostr-like/dialog-likers-style.d.ts +1 -0
  97. package/dist/src/nostr-like/dialog-likers.d.ts +24 -0
  98. package/dist/src/nostr-like/like-utils.d.ts +52 -0
  99. package/dist/src/nostr-like/nostr-like.d.ts +49 -0
  100. package/dist/src/nostr-like/render.d.ts +10 -0
  101. package/dist/src/nostr-like/style.d.ts +1 -0
  102. package/dist/src/nostr-live-chat/nostr-live-chat.d.ts +65 -0
  103. package/dist/src/nostr-live-chat/render.d.ts +31 -0
  104. package/dist/src/nostr-post/nostr-post.d.ts +25 -0
  105. package/dist/src/nostr-post/parse-text.d.ts +8 -0
  106. package/dist/src/nostr-post/render-content.d.ts +5 -0
  107. package/dist/src/nostr-post/render.d.ts +19 -0
  108. package/dist/src/nostr-post/style.d.ts +1 -0
  109. package/dist/src/nostr-profile/nostr-profile.d.ts +24 -0
  110. package/dist/src/nostr-profile/render-stats.d.ts +1 -0
  111. package/dist/src/nostr-profile/render.d.ts +22 -0
  112. package/dist/src/nostr-profile/style.d.ts +1 -0
  113. package/dist/src/nostr-profile-badge/nostr-profile-badge.d.ts +34 -0
  114. package/dist/src/nostr-profile-badge/render.d.ts +11 -0
  115. package/dist/src/nostr-profile-badge/style.d.ts +1 -0
  116. package/dist/src/nostr-zap/dialog-help-style.d.ts +5 -0
  117. package/dist/src/nostr-zap/dialog-help.d.ts +2 -0
  118. package/dist/src/nostr-zap/dialog-zap-style.d.ts +6 -0
  119. package/dist/src/nostr-zap/dialog-zap.d.ts +31 -0
  120. package/dist/src/nostr-zap/dialog-zappers-style.d.ts +1 -0
  121. package/dist/src/nostr-zap/dialog-zappers.d.ts +25 -0
  122. package/dist/src/nostr-zap/nostr-zap.d.ts +45 -0
  123. package/dist/src/nostr-zap/render.d.ts +9 -0
  124. package/dist/src/nostr-zap/style.d.ts +1 -0
  125. package/dist/src/nostr-zap/zap-utils.d.ts +53 -0
  126. package/dist/themes/dark.css +10 -0
  127. package/dist/themes/light.css +10 -0
  128. package/dist/themes.css +52 -0
  129. package/dist/vite.config.d.ts +2 -0
  130. package/dist/vite.config.esm.d.ts +2 -0
  131. package/dist/vite.config.umd.d.ts +2 -0
  132. package/package.json +95 -0
@@ -0,0 +1,924 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pure-jrVhRVpB.js","assets/nostr-service-pr_crY62.js"])))=>i.map(i=>d[i]);
2
+ var Xt=Object.defineProperty;var Zt=(o,r,t)=>r in o?Xt(o,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[r]=t;var f=(o,r,t)=>Zt(o,typeof r!="symbol"?r+"":r,t);import{_ as xe}from"../assets/preload-helper-D7HrI6pR.js";import{N as Qt,D as Jt,e as en}from"../assets/nostr-service-pr_crY62.js";import{n as gt}from"../assets/utils--bxLbhGF.js";function G(o){return o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function tn(o){const t=Date.now()/1e3-o;return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:t<2592e3?`${Math.floor(t/86400)}d ago`:new Date(o*1e3).toLocaleDateString()}function kt(o){var r,t;return(r=o.userProfile)!=null&&r.displayName?o.userProfile.displayName:(t=o.userProfile)!=null&&t.name?o.userProfile.name:`${o.pubkey.slice(0,8)}...${o.pubkey.slice(-4)}`}function nn(o){var r,t;if((r=o.userProfile)!=null&&r.image&&o.userProfile.image.trim()!==""){let n=o.userProfile.image.trim();return console.log("Processing image URL:",n,"for user:",o.userProfile.name||o.pubkey),(n.startsWith("Qm")||n.startsWith("bafy"))&&(n=`https://ipfs.io/ipfs/${n}`,console.log("Converted IPFS to gateway URL:",n)),n.startsWith("//")&&(n="https:"+n,console.log("Added protocol to URL:",n)),console.log("Final image URL:",n),n}return console.log("No image found for user:",((t=o.userProfile)==null?void 0:t.name)||o.pubkey,"using default"),"./assets/default_dp.png"}function St(o,r=!1,t=null,n=null,a="anon",s=!1){const c=kt(o),h=nn(o),g=tn(o.created_at),y=o.depth||0,d=6,E=t===o.id;return`
3
+ <div class="modern-comment" data-comment-id="${G(o.id)}" data-depth="${y}">
4
+ <div class="comment-content-wrapper">
5
+ <div class="comment-avatar-section">
6
+ <img src="${h}" alt="Avatar" class="comment-avatar" />
7
+ </div>
8
+ <div class="comment-body">
9
+ <div class="comment-header">
10
+ <span class="comment-author">${G(c)}</span>
11
+ <span class="comment-time">${G(g)}</span>
12
+ </div>
13
+ <div class="comment-text">
14
+ ${G(o.content.trim())}
15
+ </div>
16
+ <div class="comment-actions">
17
+ ${r?"":`<button class="reply-btn" data-comment-id="${G(o.id)}" aria-label="Reply to comment">
18
+ <span class="reply-icon">💬</span>
19
+ <span class="reply-text">Reply</span>
20
+ </button>`}
21
+ </div>
22
+ ${E?on(o,n,a,s):""}
23
+ </div>
24
+ </div>
25
+ ${o.replies.length>0?`
26
+ <div class="comment-replies" style="margin-left: ${Math.min(y+1,d)*24}px;">
27
+ ${o.replies.map(D=>St(D,r,t,n,a,s)).join("")}
28
+ </div>
29
+ `:""}
30
+ </div>
31
+ `}function on(o,r,t="anon",n=!1){let a="./assets/default_dp.png";if(console.log("renderInlineReplyForm - currentUserProfile:",r),r!=null&&r.image&&r.image.trim()!==""){let c=r.image.trim();console.log("Inline reply form - Processing image URL:",c),(c.startsWith("Qm")||c.startsWith("bafy"))&&(c=`https://ipfs.io/ipfs/${c}`,console.log("Inline reply form - Converted IPFS to gateway URL:",c)),c.startsWith("//")&&(c="https:"+c,console.log("Inline reply form - Added protocol to URL:",c)),console.log("Inline reply form - Final image URL:",c),a=c}else console.log("Inline reply form - No image found, using default");const s=kt(o);return`
32
+ <div class="inline-reply-form">
33
+ <div class="reply-context">
34
+ <span class="reply-context-text">💬 Replying to <strong>${G(s)}</strong></span>
35
+ <button data-role="cancel-reply" class="cancel-reply-btn" aria-label="Cancel reply">✕</button>
36
+ </div>
37
+ <div class="reply-input-container">
38
+ <div class="reply-input-avatar">
39
+ <img src="${a}" alt="Your avatar" class="user-avatar" />
40
+ </div>
41
+ <div class="reply-input-main">
42
+ <textarea
43
+ data-role="comment-input"
44
+ placeholder="Write your reply..."
45
+ rows="2"
46
+ class="modern-comment-textarea"
47
+ ></textarea>
48
+ <div class="reply-input-footer">
49
+ <div class="identity-toggle">
50
+ <button data-role="toggle-as-user" class="identity-btn ${t==="user"?"active":""}" ${n?"":"disabled"} title="${n?"Use your Nostr extension":"NIP-07 extension not detected"}">
51
+ <span class="identity-icon">${n?"✅":"🔌"}</span>
52
+ <span class="identity-text">User</span>
53
+ </button>
54
+ <button data-role="toggle-as-anon" class="identity-btn ${t==="anon"?"active":""}" title="Comment anonymously">
55
+ <span class="identity-icon">👤</span>
56
+ <span class="identity-text">Anonymous</span>
57
+ </button>
58
+ </div>
59
+ <div class="reply-actions">
60
+ <button data-role="cancel-reply" class="cancel-reply-btn" aria-label="Cancel reply">Cancel</button>
61
+ <button data-role="submit-comment" class="submit-reply-btn" aria-label="Submit reply">
62
+ <span class="submit-icon">💬</span>
63
+ <span class="submit-text">Reply</span>
64
+ </button>
65
+ </div>
66
+ </div>
67
+ </div>
68
+ </div>
69
+ </div>
70
+ `}function rn(o,r,t,n,a,s="anon",c=!1){return o?"":(console.log("renderCommentForm - currentUserProfile:",n),`
71
+ <div class="modern-comment-form">
72
+ <div class="comment-input-container">
73
+ <div class="comment-input-main">
74
+ <textarea
75
+ data-role="comment-input"
76
+ placeholder="${G(r)}"
77
+ rows="3"
78
+ ${t?"disabled":""}
79
+ class="modern-comment-textarea"
80
+ ></textarea>
81
+ <div class="comment-input-footer">
82
+ <div class="identity-toggle">
83
+ <button data-role="toggle-as-user" class="identity-btn ${s==="user"?"active":""}" ${c?"":"disabled"} title="${c?"Use your Nostr extension":"NIP-07 extension not detected"}">
84
+ <span class="identity-icon">${c?"✅":"🔌"}</span>
85
+ <span class="identity-text">User</span>
86
+ </button>
87
+ <button data-role="toggle-as-anon" class="identity-btn ${s==="anon"?"active":""}" title="Comment anonymously">
88
+ <span class="identity-icon">👤</span>
89
+ <span class="identity-text">Anonymous</span>
90
+ </button>
91
+ </div>
92
+ <button
93
+ data-role="submit-comment"
94
+ class="submit-comment-btn"
95
+ ${t?"disabled":""}
96
+ aria-label="${t?"Submitting comment":"Submit comment"}"
97
+ >
98
+ ${t?"⏳":"💬"}
99
+ <span class="submit-text">${t?"Submitting...":"Comment"}</span>
100
+ </button>
101
+ </div>
102
+ </div>
103
+ </div>
104
+ </div>
105
+ `)}function an(o,r=!1,t=null,n=null,a="anon",s=!1){const c=Rt(o);return c===0?`
106
+ <div class="no-comments">
107
+ <p>No comments yet. Be the first to comment!</p>
108
+ </div>
109
+ `:`
110
+ <div class="comments-list">
111
+ <div class="comments-header">
112
+ <div class="comments-title">
113
+ <span class="comments-label">Comments</span>
114
+ <span class="comments-count-badge">${c}</span>
115
+ </div>
116
+ </div>
117
+ <div class="comments-container">
118
+ ${o.map(h=>St(h,r,t,n,a,s)).join("")}
119
+ </div>
120
+ </div>
121
+ `}function Rt(o){let r=0;for(const t of o)r+=1+Rt(t.replies);return r}function sn(o,r,t,n,a,s,c,h=null,g=null,y="anon",d=!1){return o?`
122
+ <div class="comment-widget loading">
123
+ <div class="loading-indicator">
124
+ <div class="loading-spinner"></div>
125
+ <p>Loading comments...</p>
126
+ </div>
127
+ </div>
128
+ `:r?`
129
+ <div class="comment-widget error">
130
+ <div class="error-message">
131
+ <p>❌ Failed to load comments</p>
132
+ ${t?`<small>${G(t)}</small>`:""}
133
+ </div>
134
+ </div>
135
+ `:`
136
+ <div class="comment-widget">
137
+ ${rn(a,s,c,h,g,y,d)}
138
+ ${an(n,a,g,h,y,d)}
139
+ <div class="powered-by">
140
+ <small>Powered by <a href="https://nostr.org" target="_blank">Nostr</a></small>
141
+ </div>
142
+ </div>
143
+ `}function ln(o){return`
144
+ <style>
145
+ :host {
146
+ /* Define CSS variables on the host element */
147
+ --nstrc-comment-background: var(--nstrc-comment-background-${o});
148
+ --nstrc-comment-text-color: var(--nstrc-comment-text-color-${o});
149
+ --nstrc-comment-border-color: var(--nstrc-comment-border-color-${o});
150
+ --nstrc-comment-input-background: var(--nstrc-comment-input-background-${o});
151
+ --nstrc-comment-button-background: var(--nstrc-comment-button-background-${o});
152
+ --nstrc-comment-button-text: var(--nstrc-comment-button-text-${o});
153
+ --nstrc-comment-hover-background: var(--nstrc-comment-hover-background-${o});
154
+ --nstrc-comment-meta-color: var(--nstrc-comment-meta-color-${o});
155
+ --nstrc-comment-shadow: var(--nstrc-comment-shadow-${o});
156
+ display: block;
157
+ contain: content;
158
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
159
+ }
160
+
161
+ :host(.dark) {
162
+ --nstrc-comment-background: var(--nstrc-comment-background-dark);
163
+ --nstrc-comment-text-color: var(--nstrc-comment-text-color-dark);
164
+ --nstrc-comment-border-color: var(--nstrc-comment-border-color-dark);
165
+ --nstrc-comment-input-background: var(--nstrc-comment-input-background-dark);
166
+ --nstrc-comment-button-background: var(--nstrc-comment-button-background-dark);
167
+ --nstrc-comment-button-text: var(--nstrc-comment-button-text-dark);
168
+ --nstrc-comment-meta-color: var(--nstrc-comment-meta-color-dark);
169
+ --nstrc-comment-hover-background: var(--nstrc-comment-hover-background-dark);
170
+ --nstrc-comment-shadow: var(--nstrc-comment-shadow-dark);
171
+ }
172
+
173
+ /* CSS Variables with defaults */
174
+ :host {
175
+ --nstrc-comment-background-light: #f8f9fa;
176
+ --nstrc-comment-background-dark: #1a1a1a;
177
+ --nstrc-comment-text-color-light: #333333;
178
+ --nstrc-comment-text-color-dark: #ffffff;
179
+ --nstrc-comment-border-color-light: #e1e5e9;
180
+ --nstrc-comment-border-color-dark: #404040;
181
+ --nstrc-comment-input-background-light: #f5f5f5;
182
+ --nstrc-comment-input-background-dark: #2a2a2a;
183
+ --nstrc-comment-button-background-light: #ff6b35;
184
+ --nstrc-comment-button-background-dark: #ff6b35;
185
+ --nstrc-comment-button-text-light: #ffffff;
186
+ --nstrc-comment-button-text-dark: #ffffff;
187
+ --nstrc-comment-meta-color-light: #6c757d;
188
+ --nstrc-comment-meta-color-dark: #adb5bd;
189
+ --nstrc-comment-hover-background-light: #e9ecef;
190
+ --nstrc-comment-hover-background-dark: #2d2d30;
191
+ --nstrc-comment-shadow-light: 0 2px 8px rgba(0, 0, 0, 0.1);
192
+ --nstrc-comment-shadow-dark: 0 2px 8px rgba(0, 0, 0, 0.3);
193
+ }
194
+
195
+ .nostr-comment-wrapper {
196
+ display: block;
197
+ width: 100%;
198
+ }
199
+
200
+ .comment-widget {
201
+ background: var(--nstrc-comment-background, #ffffff);
202
+ color: var(--nstrc-comment-text-color, #333333);
203
+ border-radius: 8px;
204
+ max-width: 100%;
205
+ box-sizing: border-box;
206
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
207
+ }
208
+
209
+ .comment-widget.loading,
210
+ .comment-widget.error {
211
+ text-align: center;
212
+ padding: 40px 20px;
213
+ }
214
+
215
+ .loading-indicator {
216
+ display: flex;
217
+ flex-direction: column;
218
+ align-items: center;
219
+ gap: 16px;
220
+ }
221
+
222
+ .loading-spinner {
223
+ width: 24px;
224
+ height: 24px;
225
+ border: 2px solid var(--nstrc-comment-border-color, #e1e5e9);
226
+ border-top: 2px solid var(--nstrc-comment-button-background, #007bff);
227
+ border-radius: 50%;
228
+ animation: spin 1s linear infinite;
229
+ }
230
+
231
+ @keyframes spin {
232
+ 0% { transform: rotate(0deg); }
233
+ 100% { transform: rotate(360deg); }
234
+ }
235
+
236
+ .error-message {
237
+ color: #dc3545;
238
+ }
239
+
240
+ /* Modern Comment Form */
241
+ .modern-comment-form {
242
+ margin-bottom: 16px;
243
+ background: var(--nstrc-comment-input-background, #f5f5f5);
244
+ border: 1px solid var(--nstrc-comment-border-color, #e1e5e9);
245
+ border-radius: 12px;
246
+ overflow: hidden;
247
+ box-shadow: var(--nstrc-comment-shadow, 0 2px 8px rgba(0, 0, 0, 0.1));
248
+ }
249
+
250
+ .comment-input-container {
251
+ display: flex;
252
+ padding: 16px;
253
+ gap: 12px;
254
+ align-items: flex-start;
255
+ }
256
+
257
+ .comment-input-main {
258
+ flex: 1;
259
+ min-width: 0;
260
+ }
261
+
262
+ .comment-input-main textarea {
263
+ width: 100%;
264
+ min-height: 60px;
265
+ padding: 12px 16px;
266
+ border: none;
267
+ border-radius: 8px;
268
+ background: var(--nstrc-comment-background, #f8f9fa);
269
+ color: var(--nstrc-comment-text-color, #333333);
270
+ font-family: inherit;
271
+ font-size: 14px;
272
+ resize: vertical;
273
+ box-sizing: border-box;
274
+ transition: all 0.2s ease;
275
+ line-height: 1.4;
276
+ }
277
+
278
+ .comment-input-main textarea:focus {
279
+ outline: none;
280
+ background: var(--nstrc-comment-background, #f8f9fa);
281
+ box-shadow: 0 0 0 2px var(--nstrc-comment-button-background, #ff6b35);
282
+ }
283
+
284
+ .comment-input-main textarea:disabled {
285
+ opacity: 0.6;
286
+ cursor: not-allowed;
287
+ background: var(--nstrc-comment-hover-background, #e9ecef);
288
+ }
289
+
290
+ .comment-input-footer {
291
+ display: flex;
292
+ justify-content: space-between;
293
+ align-items: center;
294
+ margin-top: 12px;
295
+ padding-top: 12px;
296
+ border-top: 1px solid var(--nstrc-comment-border-color, #e1e5e9);
297
+ }
298
+
299
+ .identity-toggle {
300
+ display: flex;
301
+ align-items: center;
302
+ gap: 6px;
303
+ }
304
+
305
+ .identity-btn {
306
+ display: flex;
307
+ align-items: center;
308
+ gap: 4px;
309
+ padding: 6px 12px;
310
+ font-size: 12px;
311
+ border: 1px solid var(--nstrc-comment-border-color, #e1e5e9);
312
+ background: var(--nstrc-comment-background, #f8f9fa);
313
+ color: var(--nstrc-comment-text-color, #333333);
314
+ border-radius: 6px;
315
+ cursor: pointer;
316
+ transition: all 0.2s ease;
317
+ font-weight: 500;
318
+ }
319
+
320
+ .identity-btn:hover {
321
+ background: var(--nstrc-comment-hover-background);
322
+ transform: translateY(-1px);
323
+ }
324
+
325
+ .identity-btn.active {
326
+ background: var(--nstrc-comment-button-background);
327
+ color: var(--nstrc-comment-button-text, #ffffff);
328
+ border-color: var(--nstrc-comment-button-background);
329
+ }
330
+
331
+ .identity-btn:disabled {
332
+ opacity: 0.5;
333
+ cursor: not-allowed;
334
+ transform: none;
335
+ }
336
+
337
+ .identity-icon {
338
+ font-size: 14px;
339
+ }
340
+
341
+ .identity-text {
342
+ font-weight: 500;
343
+ }
344
+
345
+ .reply-indicator {
346
+ display: flex;
347
+ align-items: center;
348
+ justify-content: space-between;
349
+ background: var(--nstrc-comment-hover-background);
350
+ padding: 8px 12px;
351
+ border-radius: 4px;
352
+ margin-bottom: 8px;
353
+ font-size: 13px;
354
+ color: var(--nstrc-comment-button-background, #007bff);
355
+ border: 1px solid var(--nstrc-comment-border-color);
356
+ }
357
+
358
+ .cancel-reply-btn {
359
+ background: none;
360
+ border: none;
361
+ color: var(--nstrc-comment-meta-color, #6c757d);
362
+ cursor: pointer;
363
+ font-size: 14px;
364
+ padding: 4px 8px;
365
+ border-radius: 3px;
366
+ line-height: 1;
367
+ font-weight: bold;
368
+ }
369
+
370
+ .cancel-reply-btn:hover {
371
+ background: #dc3545;
372
+ color: white;
373
+ }
374
+
375
+ .reddit-textarea {
376
+ width: 100%;
377
+ min-height: 80px;
378
+ padding: 12px;
379
+ border: 1px solid var(--nstrc-comment-border-color, #e1e5e9);
380
+ border-radius: 4px;
381
+ background: var(--nstrc-comment-input-background, #ffffff);
382
+ color: var(--nstrc-comment-text-color, #333333);
383
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
384
+ font-size: 14px;
385
+ resize: vertical;
386
+ box-sizing: border-box;
387
+ transition: border-color 0.2s ease;
388
+ }
389
+
390
+ .reddit-textarea:focus {
391
+ outline: none;
392
+ border-color: var(--nstrc-comment-button-background, #007bff);
393
+ box-shadow: 0 0 0 1px var(--nstrc-comment-button-background, #007bff);
394
+ }
395
+
396
+ .reddit-textarea:disabled {
397
+ opacity: 0.6;
398
+ cursor: not-allowed;
399
+ background: var(--nstrc-comment-hover-background);
400
+ }
401
+
402
+ .comment-form-toolbar {
403
+ display: flex;
404
+ justify-content: space-between;
405
+ align-items: center;
406
+ margin-top: 8px;
407
+ padding-top: 8px;
408
+ border-top: 1px solid var(--nstrc-comment-border-color, #e1e5e9);
409
+ }
410
+
411
+ .formatting-help {
412
+ color: var(--nstrc-comment-meta-color, #6c757d);
413
+ }
414
+
415
+ .formatting-help small {
416
+ font-size: 12px;
417
+ }
418
+
419
+ .submit-comment-btn {
420
+ display: flex;
421
+ align-items: center;
422
+ gap: 6px;
423
+ background: var(--nstrc-comment-button-background, #ff6b35);
424
+ color: white;
425
+ border: none;
426
+ border-radius: 8px;
427
+ padding: 8px 16px;
428
+ font-size: 13px;
429
+ font-weight: 600;
430
+ cursor: pointer;
431
+ transition: all 0.2s ease;
432
+ box-shadow: 0 2px 4px rgba(255, 107, 53, 0.2);
433
+ }
434
+
435
+ .submit-comment-btn:hover:not(:disabled) {
436
+ background: #e55a2b;
437
+ transform: translateY(-1px);
438
+ box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
439
+ }
440
+
441
+ .submit-comment-btn:disabled {
442
+ opacity: 0.6;
443
+ cursor: not-allowed;
444
+ transform: none;
445
+ box-shadow: none;
446
+ }
447
+
448
+ .submit-icon {
449
+ font-size: 16px;
450
+ }
451
+
452
+ .submit-text {
453
+ font-weight: 600;
454
+ }
455
+
456
+
457
+ .comments-list {
458
+ margin-bottom: 16px;
459
+ }
460
+
461
+ .comments-header {
462
+ margin-bottom: 12px;
463
+ }
464
+
465
+ .comments-title {
466
+ display: flex;
467
+ align-items: center;
468
+ gap: 12px;
469
+ }
470
+
471
+ .comments-label {
472
+ font-size: 18px;
473
+ font-weight: 600;
474
+ color: var(--nstrc-comment-text-color, #333333);
475
+ }
476
+
477
+ .comments-count-badge {
478
+ background: var(--nstrc-comment-button-background, #007bff);
479
+ color: white;
480
+ padding: 4px 8px;
481
+ border-radius: 12px;
482
+ font-size: 12px;
483
+ font-weight: 600;
484
+ min-width: 20px;
485
+ text-align: center;
486
+ }
487
+
488
+ .no-comments {
489
+ text-align: center;
490
+ padding: 40px 20px;
491
+ color: var(--nstrc-comment-meta-color, #6c757d);
492
+ }
493
+
494
+ .no-comments p {
495
+ margin: 0;
496
+ font-style: italic;
497
+ }
498
+
499
+ .comments-container {
500
+ display: flex;
501
+ flex-direction: column;
502
+ }
503
+
504
+ /* Ultra-Compact Modern Comments */
505
+ .modern-comment {
506
+ background: var(--nstrc-comment-background, #ffffff);
507
+ border-bottom: 1px solid var(--nstrc-comment-border-color, #e1e5e9);
508
+ margin-bottom: 0;
509
+ transition: background-color 0.2s ease;
510
+ }
511
+
512
+ .modern-comment:hover {
513
+ background: var(--nstrc-comment-hover-background, #f8f9fa);
514
+ }
515
+
516
+ .modern-comment:last-child {
517
+ border-bottom: none;
518
+ }
519
+
520
+ .comment-content-wrapper {
521
+ display: flex;
522
+ padding: 8px 12px;
523
+ gap: 8px;
524
+ align-items: flex-start;
525
+ }
526
+
527
+ .comment-avatar-section {
528
+ flex-shrink: 0;
529
+ }
530
+
531
+ .comment-avatar {
532
+ width: 26px;
533
+ height: 26px;
534
+ border-radius: 50%;
535
+ object-fit: cover;
536
+ background: var(--nstrc-comment-border-color, #e1e5e9);
537
+ border: 1px solid var(--nstrc-comment-border-color, #e1e5e9);
538
+ }
539
+
540
+ .comment-body {
541
+ flex: 1;
542
+ min-width: 0;
543
+ margin: 0;
544
+ padding: 0;
545
+ }
546
+
547
+ .comment-header {
548
+ display: flex;
549
+ align-items: center;
550
+ gap: 6px;
551
+ margin-bottom: 2px;
552
+ flex-wrap: wrap;
553
+ }
554
+
555
+ .comment-author {
556
+ font-weight: 600;
557
+ font-size: 12px;
558
+ color: var(--nstrc-comment-text-color, #333333);
559
+ text-decoration: none;
560
+ }
561
+
562
+ .comment-author:hover {
563
+ color: var(--nstrc-comment-button-background, #007bff);
564
+ }
565
+
566
+ .comment-time {
567
+ font-size: 11px;
568
+ color: var(--nstrc-comment-meta-color, #6c757d);
569
+ font-weight: 400;
570
+ }
571
+
572
+ .comment-text {
573
+ font-size: 13px;
574
+ line-height: 0.45;
575
+ color: var(--nstrc-comment-text-color, #333333);
576
+ margin-bottom: 3px;
577
+ white-space: pre-line;
578
+ word-wrap: break-word;
579
+ margin-top: 0;
580
+ }
581
+
582
+ .comment-actions {
583
+ display: flex;
584
+ align-items: center;
585
+ gap: 8px;
586
+ margin-top: 0;
587
+ }
588
+
589
+ .reply-btn {
590
+ display: flex;
591
+ align-items: center;
592
+ gap: 3px;
593
+ background: none;
594
+ border: none;
595
+ color: var(--nstrc-comment-meta-color, #6c757d);
596
+ cursor: pointer;
597
+ font-size: 11px;
598
+ padding: 2px 6px;
599
+ border-radius: 3px;
600
+ transition: all 0.2s ease;
601
+ font-weight: 500;
602
+ }
603
+
604
+ .reply-btn:hover {
605
+ background: var(--nstrc-comment-hover-background);
606
+ color: var(--nstrc-comment-text-color);
607
+ }
608
+
609
+ .reply-icon {
610
+ font-size: 10px;
611
+ }
612
+
613
+ .reply-text {
614
+ font-weight: 500;
615
+ }
616
+
617
+ .comment-replies {
618
+ margin-top: 0;
619
+ border-left: 1px solid var(--nstrc-comment-border-color, #e1e5e9);
620
+ padding-left: 12px;
621
+ margin-left: 34px; /* 26px avatar + 8px gap */
622
+ }
623
+
624
+ /* Ultra-Compact Inline Reply Form */
625
+ .inline-reply-form {
626
+ margin-top: 8px;
627
+ padding: 8px;
628
+ background: var(--nstrc-comment-hover-background);
629
+ border: 1px solid var(--nstrc-comment-border-color, #e1e5e9);
630
+ border-radius: 4px;
631
+ margin-left: 34px; /* Align with comment text */
632
+ }
633
+
634
+ .reply-context {
635
+ display: flex;
636
+ justify-content: space-between;
637
+ align-items: center;
638
+ background: var(--nstrc-comment-button-background, #007bff);
639
+ color: white;
640
+ padding: 6px 10px;
641
+ border-radius: 3px;
642
+ margin-bottom: 8px;
643
+ font-size: 12px;
644
+ font-weight: 500;
645
+ }
646
+
647
+ .reply-context-text {
648
+ color: white;
649
+ }
650
+
651
+ .reply-input-container {
652
+ display: flex;
653
+ gap: 8px;
654
+ align-items: flex-start;
655
+ }
656
+
657
+ .reply-input-avatar {
658
+ flex-shrink: 0;
659
+ }
660
+
661
+ .reply-input-avatar .user-avatar {
662
+ width: 24px;
663
+ height: 24px;
664
+ border-radius: 50%;
665
+ object-fit: cover;
666
+ background: var(--nstrc-comment-border-color, #e1e5e9);
667
+ border: 1px solid var(--nstrc-comment-border-color, #e1e5e9);
668
+ }
669
+
670
+ .reply-form-main {
671
+ flex: 1;
672
+ min-width: 0;
673
+ }
674
+
675
+ .reply-form-header {
676
+ margin-bottom: 8px;
677
+ display: flex;
678
+ align-items: center;
679
+ justify-content: space-between;
680
+ }
681
+
682
+ .reply-form-header .current-user-name {
683
+ font-size: 12px;
684
+ color: var(--nstrc-comment-meta-color, #6c757d);
685
+ font-weight: 500;
686
+ }
687
+
688
+ .reply-form-header .identity-toggle {
689
+ display: flex;
690
+ align-items: center;
691
+ gap: 8px;
692
+ }
693
+
694
+ .reply-form-header .toggle-label {
695
+ font-size: 11px;
696
+ color: var(--nstrc-comment-meta-color, #6c757d);
697
+ font-weight: 500;
698
+ }
699
+
700
+ .reply-form-header .identity-btn {
701
+ padding: 2px 6px;
702
+ font-size: 10px;
703
+ border: 1px solid var(--nstrc-comment-border-color, #e1e5e9);
704
+ background: var(--nstrc-comment-input-background, #ffffff);
705
+ color: var(--nstrc-comment-text-color, #333333);
706
+ border-radius: 3px;
707
+ cursor: pointer;
708
+ }
709
+
710
+ .reply-form-header .identity-btn:hover {
711
+ background: var(--nstrc-comment-hover-background);
712
+ }
713
+
714
+ .reply-form-header .identity-btn.active {
715
+ background: var(--nstrc-comment-button-background);
716
+ color: var(--nstrc-comment-button-text, #ffffff);
717
+ border-color: var(--nstrc-comment-button-background);
718
+ }
719
+
720
+ .reply-form-header .identity-btn:disabled {
721
+ opacity: 0.5;
722
+ cursor: not-allowed;
723
+ }
724
+
725
+ .reply-input-main {
726
+ flex: 1;
727
+ min-width: 0;
728
+ }
729
+
730
+ .reply-input-main textarea {
731
+ width: 100%;
732
+ min-height: 60px;
733
+ padding: 12px;
734
+ border: 2px solid var(--nstrc-comment-border-color, #e1e5e9);
735
+ border-radius: 8px;
736
+ background: var(--nstrc-comment-input-background, #ffffff);
737
+ color: var(--nstrc-comment-text-color, #333333);
738
+ font-family: inherit;
739
+ font-size: 14px;
740
+ resize: vertical;
741
+ box-sizing: border-box;
742
+ transition: all 0.2s ease;
743
+ }
744
+
745
+ .reply-input-main textarea:focus {
746
+ outline: none;
747
+ border-color: var(--nstrc-comment-button-background, #007bff);
748
+ box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
749
+ }
750
+
751
+ .reply-input-footer {
752
+ display: flex;
753
+ justify-content: space-between;
754
+ align-items: center;
755
+ margin-top: 8px;
756
+ padding-top: 8px;
757
+ border-top: 1px solid var(--nstrc-comment-border-color, #e1e5e9);
758
+ }
759
+
760
+ .reply-actions {
761
+ display: flex;
762
+ gap: 6px;
763
+ align-items: center;
764
+ }
765
+
766
+ .cancel-reply-btn {
767
+ background: none;
768
+ border: 1px solid var(--nstrc-comment-border-color, #e1e5e9);
769
+ color: var(--nstrc-comment-meta-color, #6c757d);
770
+ cursor: pointer;
771
+ font-size: 11px;
772
+ padding: 4px 8px;
773
+ border-radius: 3px;
774
+ transition: all 0.2s ease;
775
+ font-weight: 500;
776
+ }
777
+
778
+ .cancel-reply-btn:hover {
779
+ background: var(--nstrc-comment-hover-background);
780
+ color: var(--nstrc-comment-text-color);
781
+ border-color: var(--nstrc-comment-border-color, #e1e5e9);
782
+ }
783
+
784
+ .submit-reply-btn {
785
+ display: flex;
786
+ align-items: center;
787
+ gap: 3px;
788
+ background: var(--nstrc-comment-button-background, #007bff);
789
+ color: white;
790
+ border: none;
791
+ border-radius: 3px;
792
+ padding: 4px 8px;
793
+ font-size: 11px;
794
+ font-weight: 600;
795
+ cursor: pointer;
796
+ transition: all 0.2s ease;
797
+ }
798
+
799
+ .submit-reply-btn:hover:not(:disabled) {
800
+ background: #0056b3;
801
+ transform: translateY(-1px);
802
+ }
803
+
804
+ .submit-reply-btn:disabled {
805
+ opacity: 0.6;
806
+ cursor: not-allowed;
807
+ transform: none;
808
+ }
809
+
810
+ .submit-icon {
811
+ font-size: 14px;
812
+ }
813
+
814
+ .powered-by {
815
+ text-align: center;
816
+ padding-top: 16px;
817
+ border-top: 1px solid var(--nstrc-comment-border-color, #e1e5e9);
818
+ }
819
+
820
+ .powered-by small {
821
+ color: var(--nstrc-comment-meta-color, #6c757d);
822
+ font-size: 12px;
823
+ }
824
+
825
+ .powered-by a {
826
+ color: var(--nstrc-comment-button-background, #007bff);
827
+ text-decoration: none;
828
+ }
829
+
830
+ .powered-by a:hover {
831
+ text-decoration: underline;
832
+ }
833
+
834
+ /* Responsive Design */
835
+ @media (max-width: 768px) {
836
+ .comment-input-container,
837
+ .comment-content-wrapper,
838
+ .reply-input-container {
839
+ padding: 10px;
840
+ gap: 8px;
841
+ }
842
+
843
+ .comment-avatar,
844
+ .user-avatar {
845
+ width: 24px;
846
+ height: 24px;
847
+ }
848
+
849
+ .comment-input-footer {
850
+ flex-direction: column;
851
+ gap: 8px;
852
+ align-items: stretch;
853
+ }
854
+
855
+ .identity-toggle {
856
+ justify-content: center;
857
+ }
858
+
859
+ .submit-comment-btn {
860
+ width: 100%;
861
+ justify-content: center;
862
+ }
863
+ }
864
+
865
+ @media (max-width: 480px) {
866
+ .comment-input-container,
867
+ .comment-content-wrapper,
868
+ .reply-input-container {
869
+ padding: 8px;
870
+ gap: 6px;
871
+ }
872
+
873
+ .comment-avatar,
874
+ .user-avatar {
875
+ width: 22px;
876
+ height: 22px;
877
+ }
878
+
879
+ .comment-text {
880
+ font-size: 12px;
881
+ }
882
+
883
+ .comment-author {
884
+ font-size: 11px;
885
+ }
886
+
887
+ .comment-time {
888
+ font-size: 10px;
889
+ }
890
+
891
+ .comments-title {
892
+ flex-direction: column;
893
+ gap: 4px;
894
+ align-items: flex-start;
895
+ }
896
+
897
+ .comment-replies {
898
+ margin-left: 30px; /* 22px avatar + 8px gap */
899
+ padding-left: 10px;
900
+ }
901
+ }
902
+ </style>
903
+ `}/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:Lt,setPrototypeOf:bt,isFrozen:cn,getPrototypeOf:mn,getOwnPropertyDescriptor:dn}=Object;let{freeze:I,seal:M,create:Pt}=Object,{apply:We,construct:Be}=typeof Reflect<"u"&&Reflect;I||(I=function(r){return r});M||(M=function(r){return r});We||(We=function(r,t,n){return r.apply(t,n)});Be||(Be=function(r,t){return new r(...t)});const ve=C(Array.prototype.forEach),pn=C(Array.prototype.lastIndexOf),yt=C(Array.prototype.pop),se=C(Array.prototype.push),un=C(Array.prototype.splice),Ee=C(String.prototype.toLowerCase),ze=C(String.prototype.toString),xt=C(String.prototype.match),le=C(String.prototype.replace),fn=C(String.prototype.indexOf),hn=C(String.prototype.trim),z=C(Object.prototype.hasOwnProperty),N=C(RegExp.prototype.test),ce=gn(TypeError);function C(o){return function(r){r instanceof RegExp&&(r.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return We(o,r,n)}}function gn(o){return function(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];return Be(o,t)}}function u(o,r){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ee;bt&&bt(o,null);let n=r.length;for(;n--;){let a=r[n];if(typeof a=="string"){const s=t(a);s!==a&&(cn(r)||(r[n]=s),a=s)}o[a]=!0}return o}function bn(o){for(let r=0;r<o.length;r++)z(o,r)||(o[r]=null);return o}function B(o){const r=Pt(null);for(const[t,n]of Lt(o))z(o,t)&&(Array.isArray(n)?r[t]=bn(n):n&&typeof n=="object"&&n.constructor===Object?r[t]=B(n):r[t]=n);return r}function me(o,r){for(;o!==null;){const n=dn(o,r);if(n){if(n.get)return C(n.get);if(typeof n.value=="function")return C(n.value)}o=mn(o)}function t(){return null}return t}const vt=I(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Fe=I(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),$e=I(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),yn=I(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),He=I(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),xn=I(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Tt=I(["#text"]),Et=I(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Ke=I(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),At=I(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Te=I(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),vn=M(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Tn=M(/<%[\w\W]*|[\w\W]*%>/gm),En=M(/\$\{[\w\W]*/gm),An=M(/^data-[\-\w.\u00B7-\uFFFF]+$/),wn=M(/^aria-[\-\w]+$/),Nt=M(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),_n=M(/^(?:\w+script|data):/i),kn=M(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),It=M(/^html$/i),Sn=M(/^[a-z][.\w]*(-[.\w]+)+$/i);var wt=Object.freeze({__proto__:null,ARIA_ATTR:wn,ATTR_WHITESPACE:kn,CUSTOM_ELEMENT:Sn,DATA_ATTR:An,DOCTYPE_NAME:It,ERB_EXPR:Tn,IS_ALLOWED_URI:Nt,IS_SCRIPT_OR_DATA:_n,MUSTACHE_EXPR:vn,TMPLIT_EXPR:En});const de={element:1,text:3,progressingInstruction:7,comment:8,document:9},Rn=function(){return typeof window>"u"?null:window},Ln=function(r,t){if(typeof r!="object"||typeof r.createPolicy!="function")return null;let n=null;const a="data-tt-policy-suffix";t&&t.hasAttribute(a)&&(n=t.getAttribute(a));const s="dompurify"+(n?"#"+n:"");try{return r.createPolicy(s,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},_t=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ct(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Rn();const r=m=>Ct(m);if(r.version="3.2.6",r.removed=[],!o||!o.document||o.document.nodeType!==de.document||!o.Element)return r.isSupported=!1,r;let{document:t}=o;const n=t,a=n.currentScript,{DocumentFragment:s,HTMLTemplateElement:c,Node:h,Element:g,NodeFilter:y,NamedNodeMap:d=o.NamedNodeMap||o.MozNamedAttrMap,HTMLFormElement:E,DOMParser:D,trustedTypes:Y}=o,p=g.prototype,x=me(p,"cloneNode"),k=me(p,"remove"),te=me(p,"nextSibling"),U=me(p,"childNodes"),$=me(p,"parentNode");if(typeof c=="function"){const m=t.createElement("template");m.content&&m.content.ownerDocument&&(t=m.content.ownerDocument)}let L,ne="";const{implementation:Ae,createNodeIterator:Dt,createDocumentFragment:Ot,getElementsByTagName:Mt}=t,{importNode:Ut}=n;let P=_t();r.isSupported=typeof Lt=="function"&&typeof $=="function"&&Ae&&Ae.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:we,ERB_EXPR:_e,TMPLIT_EXPR:ke,DATA_ATTR:zt,ARIA_ATTR:Ft,IS_SCRIPT_OR_DATA:$t,ATTR_WHITESPACE:Ge,CUSTOM_ELEMENT:Ht}=wt;let{IS_ALLOWED_URI:Ye}=wt,A=null;const qe=u({},[...vt,...Fe,...$e,...He,...Tt]);let _=null;const Ve=u({},[...Et,...Ke,...At,...Te]);let v=Object.seal(Pt(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),oe=null,Se=null,je=!0,Re=!0,Xe=!1,Ze=!0,V=!1,pe=!0,q=!1,Le=!1,Pe=!1,j=!1,ue=!1,fe=!1,Qe=!0,Je=!1;const Kt="user-content-";let Ne=!0,re=!1,X={},Z=null;const et=u({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let tt=null;const nt=u({},["audio","video","img","source","image","track"]);let Ie=null;const ot=u({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),he="http://www.w3.org/1998/Math/MathML",ge="http://www.w3.org/2000/svg",H="http://www.w3.org/1999/xhtml";let Q=H,Ce=!1,De=null;const Wt=u({},[he,ge,H],ze);let be=u({},["mi","mo","mn","ms","mtext"]),ye=u({},["annotation-xml"]);const Bt=u({},["title","style","font","a","script"]);let ie=null;const Gt=["application/xhtml+xml","text/html"],Yt="text/html";let w=null,J=null;const qt=t.createElement("form"),rt=function(e){return e instanceof RegExp||e instanceof Function},Oe=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(J&&J===e)){if((!e||typeof e!="object")&&(e={}),e=B(e),ie=Gt.indexOf(e.PARSER_MEDIA_TYPE)===-1?Yt:e.PARSER_MEDIA_TYPE,w=ie==="application/xhtml+xml"?ze:Ee,A=z(e,"ALLOWED_TAGS")?u({},e.ALLOWED_TAGS,w):qe,_=z(e,"ALLOWED_ATTR")?u({},e.ALLOWED_ATTR,w):Ve,De=z(e,"ALLOWED_NAMESPACES")?u({},e.ALLOWED_NAMESPACES,ze):Wt,Ie=z(e,"ADD_URI_SAFE_ATTR")?u(B(ot),e.ADD_URI_SAFE_ATTR,w):ot,tt=z(e,"ADD_DATA_URI_TAGS")?u(B(nt),e.ADD_DATA_URI_TAGS,w):nt,Z=z(e,"FORBID_CONTENTS")?u({},e.FORBID_CONTENTS,w):et,oe=z(e,"FORBID_TAGS")?u({},e.FORBID_TAGS,w):B({}),Se=z(e,"FORBID_ATTR")?u({},e.FORBID_ATTR,w):B({}),X=z(e,"USE_PROFILES")?e.USE_PROFILES:!1,je=e.ALLOW_ARIA_ATTR!==!1,Re=e.ALLOW_DATA_ATTR!==!1,Xe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ze=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,V=e.SAFE_FOR_TEMPLATES||!1,pe=e.SAFE_FOR_XML!==!1,q=e.WHOLE_DOCUMENT||!1,j=e.RETURN_DOM||!1,ue=e.RETURN_DOM_FRAGMENT||!1,fe=e.RETURN_TRUSTED_TYPE||!1,Pe=e.FORCE_BODY||!1,Qe=e.SANITIZE_DOM!==!1,Je=e.SANITIZE_NAMED_PROPS||!1,Ne=e.KEEP_CONTENT!==!1,re=e.IN_PLACE||!1,Ye=e.ALLOWED_URI_REGEXP||Nt,Q=e.NAMESPACE||H,be=e.MATHML_TEXT_INTEGRATION_POINTS||be,ye=e.HTML_INTEGRATION_POINTS||ye,v=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&rt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(v.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&rt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(v.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(v.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),V&&(Re=!1),ue&&(j=!0),X&&(A=u({},Tt),_=[],X.html===!0&&(u(A,vt),u(_,Et)),X.svg===!0&&(u(A,Fe),u(_,Ke),u(_,Te)),X.svgFilters===!0&&(u(A,$e),u(_,Ke),u(_,Te)),X.mathMl===!0&&(u(A,He),u(_,At),u(_,Te))),e.ADD_TAGS&&(A===qe&&(A=B(A)),u(A,e.ADD_TAGS,w)),e.ADD_ATTR&&(_===Ve&&(_=B(_)),u(_,e.ADD_ATTR,w)),e.ADD_URI_SAFE_ATTR&&u(Ie,e.ADD_URI_SAFE_ATTR,w),e.FORBID_CONTENTS&&(Z===et&&(Z=B(Z)),u(Z,e.FORBID_CONTENTS,w)),Ne&&(A["#text"]=!0),q&&u(A,["html","head","body"]),A.table&&(u(A,["tbody"]),delete oe.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw ce('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ce('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');L=e.TRUSTED_TYPES_POLICY,ne=L.createHTML("")}else L===void 0&&(L=Ln(Y,a)),L!==null&&typeof ne=="string"&&(ne=L.createHTML(""));I&&I(e),J=e}},it=u({},[...Fe,...$e,...yn]),at=u({},[...He,...xn]),Vt=function(e){let i=$(e);(!i||!i.tagName)&&(i={namespaceURI:Q,tagName:"template"});const l=Ee(e.tagName),b=Ee(i.tagName);return De[e.namespaceURI]?e.namespaceURI===ge?i.namespaceURI===H?l==="svg":i.namespaceURI===he?l==="svg"&&(b==="annotation-xml"||be[b]):!!it[l]:e.namespaceURI===he?i.namespaceURI===H?l==="math":i.namespaceURI===ge?l==="math"&&ye[b]:!!at[l]:e.namespaceURI===H?i.namespaceURI===ge&&!ye[b]||i.namespaceURI===he&&!be[b]?!1:!at[l]&&(Bt[l]||!it[l]):!!(ie==="application/xhtml+xml"&&De[e.namespaceURI]):!1},F=function(e){se(r.removed,{element:e});try{$(e).removeChild(e)}catch{k(e)}},ee=function(e,i){try{se(r.removed,{attribute:i.getAttributeNode(e),from:i})}catch{se(r.removed,{attribute:null,from:i})}if(i.removeAttribute(e),e==="is")if(j||ue)try{F(i)}catch{}else try{i.setAttribute(e,"")}catch{}},st=function(e){let i=null,l=null;if(Pe)e="<remove></remove>"+e;else{const T=xt(e,/^[\r\n\t ]+/);l=T&&T[0]}ie==="application/xhtml+xml"&&Q===H&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const b=L?L.createHTML(e):e;if(Q===H)try{i=new D().parseFromString(b,ie)}catch{}if(!i||!i.documentElement){i=Ae.createDocument(Q,"template",null);try{i.documentElement.innerHTML=Ce?ne:b}catch{}}const S=i.body||i.documentElement;return e&&l&&S.insertBefore(t.createTextNode(l),S.childNodes[0]||null),Q===H?Mt.call(i,q?"html":"body")[0]:q?i.documentElement:S},lt=function(e){return Dt.call(e.ownerDocument||e,e,y.SHOW_ELEMENT|y.SHOW_COMMENT|y.SHOW_TEXT|y.SHOW_PROCESSING_INSTRUCTION|y.SHOW_CDATA_SECTION,null)},Me=function(e){return e instanceof E&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof d)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},ct=function(e){return typeof h=="function"&&e instanceof h};function K(m,e,i){ve(m,l=>{l.call(r,e,i,J)})}const mt=function(e){let i=null;if(K(P.beforeSanitizeElements,e,null),Me(e))return F(e),!0;const l=w(e.nodeName);if(K(P.uponSanitizeElement,e,{tagName:l,allowedTags:A}),pe&&e.hasChildNodes()&&!ct(e.firstElementChild)&&N(/<[/\w!]/g,e.innerHTML)&&N(/<[/\w!]/g,e.textContent)||e.nodeType===de.progressingInstruction||pe&&e.nodeType===de.comment&&N(/<[/\w]/g,e.data))return F(e),!0;if(!A[l]||oe[l]){if(!oe[l]&&pt(l)&&(v.tagNameCheck instanceof RegExp&&N(v.tagNameCheck,l)||v.tagNameCheck instanceof Function&&v.tagNameCheck(l)))return!1;if(Ne&&!Z[l]){const b=$(e)||e.parentNode,S=U(e)||e.childNodes;if(S&&b){const T=S.length;for(let O=T-1;O>=0;--O){const W=x(S[O],!0);W.__removalCount=(e.__removalCount||0)+1,b.insertBefore(W,te(e))}}}return F(e),!0}return e instanceof g&&!Vt(e)||(l==="noscript"||l==="noembed"||l==="noframes")&&N(/<\/no(script|embed|frames)/i,e.innerHTML)?(F(e),!0):(V&&e.nodeType===de.text&&(i=e.textContent,ve([we,_e,ke],b=>{i=le(i,b," ")}),e.textContent!==i&&(se(r.removed,{element:e.cloneNode()}),e.textContent=i)),K(P.afterSanitizeElements,e,null),!1)},dt=function(e,i,l){if(Qe&&(i==="id"||i==="name")&&(l in t||l in qt))return!1;if(!(Re&&!Se[i]&&N(zt,i))){if(!(je&&N(Ft,i))){if(!_[i]||Se[i]){if(!(pt(e)&&(v.tagNameCheck instanceof RegExp&&N(v.tagNameCheck,e)||v.tagNameCheck instanceof Function&&v.tagNameCheck(e))&&(v.attributeNameCheck instanceof RegExp&&N(v.attributeNameCheck,i)||v.attributeNameCheck instanceof Function&&v.attributeNameCheck(i))||i==="is"&&v.allowCustomizedBuiltInElements&&(v.tagNameCheck instanceof RegExp&&N(v.tagNameCheck,l)||v.tagNameCheck instanceof Function&&v.tagNameCheck(l))))return!1}else if(!Ie[i]){if(!N(Ye,le(l,Ge,""))){if(!((i==="src"||i==="xlink:href"||i==="href")&&e!=="script"&&fn(l,"data:")===0&&tt[e])){if(!(Xe&&!N($t,le(l,Ge,"")))){if(l)return!1}}}}}}return!0},pt=function(e){return e!=="annotation-xml"&&xt(e,Ht)},ut=function(e){K(P.beforeSanitizeAttributes,e,null);const{attributes:i}=e;if(!i||Me(e))return;const l={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:_,forceKeepAttr:void 0};let b=i.length;for(;b--;){const S=i[b],{name:T,namespaceURI:O,value:W}=S,ae=w(T),Ue=W;let R=T==="value"?Ue:hn(Ue);if(l.attrName=ae,l.attrValue=R,l.keepAttr=!0,l.forceKeepAttr=void 0,K(P.uponSanitizeAttribute,e,l),R=l.attrValue,Je&&(ae==="id"||ae==="name")&&(ee(T,e),R=Kt+R),pe&&N(/((--!?|])>)|<\/(style|title)/i,R)){ee(T,e);continue}if(l.forceKeepAttr)continue;if(!l.keepAttr){ee(T,e);continue}if(!Ze&&N(/\/>/i,R)){ee(T,e);continue}V&&ve([we,_e,ke],ht=>{R=le(R,ht," ")});const ft=w(e.nodeName);if(!dt(ft,ae,R)){ee(T,e);continue}if(L&&typeof Y=="object"&&typeof Y.getAttributeType=="function"&&!O)switch(Y.getAttributeType(ft,ae)){case"TrustedHTML":{R=L.createHTML(R);break}case"TrustedScriptURL":{R=L.createScriptURL(R);break}}if(R!==Ue)try{O?e.setAttributeNS(O,T,R):e.setAttribute(T,R),Me(e)?F(e):yt(r.removed)}catch{ee(T,e)}}K(P.afterSanitizeAttributes,e,null)},jt=function m(e){let i=null;const l=lt(e);for(K(P.beforeSanitizeShadowDOM,e,null);i=l.nextNode();)K(P.uponSanitizeShadowNode,i,null),mt(i),ut(i),i.content instanceof s&&m(i.content);K(P.afterSanitizeShadowDOM,e,null)};return r.sanitize=function(m){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,l=null,b=null,S=null;if(Ce=!m,Ce&&(m="<!-->"),typeof m!="string"&&!ct(m))if(typeof m.toString=="function"){if(m=m.toString(),typeof m!="string")throw ce("dirty is not a string, aborting")}else throw ce("toString is not a function");if(!r.isSupported)return m;if(Le||Oe(e),r.removed=[],typeof m=="string"&&(re=!1),re){if(m.nodeName){const W=w(m.nodeName);if(!A[W]||oe[W])throw ce("root node is forbidden and cannot be sanitized in-place")}}else if(m instanceof h)i=st("<!---->"),l=i.ownerDocument.importNode(m,!0),l.nodeType===de.element&&l.nodeName==="BODY"||l.nodeName==="HTML"?i=l:i.appendChild(l);else{if(!j&&!V&&!q&&m.indexOf("<")===-1)return L&&fe?L.createHTML(m):m;if(i=st(m),!i)return j?null:fe?ne:""}i&&Pe&&F(i.firstChild);const T=lt(re?m:i);for(;b=T.nextNode();)mt(b),ut(b),b.content instanceof s&&jt(b.content);if(re)return m;if(j){if(ue)for(S=Ot.call(i.ownerDocument);i.firstChild;)S.appendChild(i.firstChild);else S=i;return(_.shadowroot||_.shadowrootmode)&&(S=Ut.call(n,S,!0)),S}let O=q?i.outerHTML:i.innerHTML;return q&&A["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&N(It,i.ownerDocument.doctype.name)&&(O="<!DOCTYPE "+i.ownerDocument.doctype.name+`>
904
+ `+O),V&&ve([we,_e,ke],W=>{O=le(O,W," ")}),L&&fe?L.createHTML(O):O},r.setConfig=function(){let m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Oe(m),Le=!0},r.clearConfig=function(){J=null,Le=!1},r.isValidAttribute=function(m,e,i){J||Oe({});const l=w(m),b=w(e);return dt(l,b,i)},r.addHook=function(m,e){typeof e=="function"&&se(P[m],e)},r.removeHook=function(m,e){if(e!==void 0){const i=pn(P[m],e);return i===-1?void 0:un(P[m],i,1)[0]}return yt(P[m])},r.removeHooks=function(m){P[m]=[]},r.removeAllHooks=function(){P=_t()},r}var Pn=Ct();class Nn extends HTMLElement{constructor(){super();f(this,"rendered",!1);f(this,"nostrService",Qt.getInstance());f(this,"shadow");f(this,"theme","light");f(this,"isLoading",!0);f(this,"isError",!1);f(this,"errorMessage","");f(this,"comments",[]);f(this,"baseUrl","");f(this,"userPublicKey",null);f(this,"userPrivateKey",null);f(this,"currentUserProfile",null);f(this,"isSubmitting",!1);f(this,"replyingToComment",null);f(this,"commentAs","user");f(this,"hasNip07",!1);f(this,"anonPrivateKeyHex",null);f(this,"eventListeners",[]);f(this,"nip07MonitoringInterval",null);f(this,"loadVersion",0);f(this,"getRelays",()=>{const t=this.getAttribute("relays");return t?t.split(",").map(n=>n.trim()):Jt});f(this,"getTheme",()=>{this.theme="light";const t=this.getAttribute("theme");t&&(["light","dark"].includes(t)?this.theme=t:console.warn(`Invalid theme '${t}'. Accepted values are 'light', 'dark'`))});f(this,"getBaseUrl",()=>{const t=this.getAttribute("url");return t?gt(t):gt(window.location.href)});f(this,"detectNip07Extension",()=>{const t=window.nostr;return t?typeof t.getPublicKey=="function"&&typeof t.signEvent=="function"?!0:(console.warn("NIP-07 extension detected but missing required methods"),!1):!1});f(this,"handleNip07StateChange",async()=>{const t=this.hasNip07,n=this.detectNip07Extension();if(t!==n&&(console.log("NIP-07 extension state changed:",n),this.hasNip07=n,n&&this.commentAs==="user"))try{await this.initializeUser(),this.render()}catch(a){console.warn("Failed to reconnect to NIP-07 extension:",a)}});f(this,"setupNip07StateMonitoring",()=>{const t=setInterval(async()=>{document.contains(this)&&await this.handleNip07StateChange()},2e3);this.nip07MonitoringInterval=t});f(this,"loadComments",async()=>{this.loadVersion++;const t=this.loadVersion;try{this.isLoading=!0,this.isError=!1,this.render();const n=this.getRelays();await this.nostrService.connectToNostr(n);const a={kinds:[1111],"#I":[this.baseUrl],limit:200},s=await this.nostrService.getNDK().fetchEvents(a),c=Array.from(s),h=new Map;c.forEach(p=>h.set(p.id,{content:p.content,id:p.id,tags:p.tags}));const g=[],y=new Set;for(const p of c){let x;const k=(p.tags||[]).filter(U=>U[0]==="e");for(let U=k.length-1;U>=0;U--){const $=k[U];if($[3]==="reply"){x=$[1];break}}if(!x&&k.length>0){const U=k.filter($=>$[3]!=="root");U.length>0?x=U[U.length-1][1]:x=k[k.length-1][1]}const te={id:p.id,pubkey:p.pubkey,content:p.content,created_at:p.created_at,replies:[],replyTo:x,depth:0};y.add(p.pubkey),g.push(te)}const d=Array.from(y).map(async p=>{try{console.log("Fetching profile for pubkey:",p);const x=await this.nostrService.getProfile({pubkey:p});return console.log("Profile fetched for",p,":",x),{pubkey:p,profile:x}}catch(x){return console.warn("Failed to fetch profile for:",p,x),{pubkey:p,profile:null}}}),E=await Promise.allSettled(d),D=new Map;if(E.forEach(p=>{if(p.status==="fulfilled"){const{pubkey:x,profile:k}=p.value;D.set(x,k)}}),g.forEach(p=>{p.userProfile=D.get(p.pubkey)||void 0,console.log("Attached profile to comment:",p.pubkey,"Profile:",p.userProfile)}),t!==this.loadVersion){console.log("Load operation superseded by newer request, aborting");return}this.comments=this.buildCommentTree(g);const Y=new Map;this.comments.forEach(p=>{const x=[p];for(;x.length;){const k=x.pop();Y.set(k.id,k),k.replies.forEach(te=>x.push(te))}}),g.forEach(p=>{const x=p.replyTo?Y.get(p.replyTo):void 0,k=x?x.content:"(no parent)";console.log(`[nostr-comment] recv: "${p.content}" -> parent: ${k}`)})}catch(n){if(t!==this.loadVersion){console.log("Load operation superseded by newer request, aborting error handling");return}this.isError=!0,this.errorMessage=n instanceof Error?n.message:"Failed to load comments",console.error("Error loading comments:",n)}finally{if(t!==this.loadVersion){console.log("Load operation superseded by newer request, aborting final state update");return}this.isLoading=!1,this.render()}});f(this,"buildCommentTree",t=>{const n=new Map,a=[];t.forEach(c=>{n.set(c.id,c)}),t.forEach(c=>{if(c.replyTo&&n.has(c.replyTo)){const h=n.get(c.replyTo);h.replies.push(c),h.replies.sort((g,y)=>g.created_at-y.created_at)}else a.push(c)});const s=(c,h)=>{for(const g of c)g.depth=h,g.replies&&g.replies.length&&s(g.replies,h+1)};return s(a,0),a.sort((c,h)=>h.created_at-c.created_at)});f(this,"initializeUser",async()=>{if(this.hasNip07=this.detectNip07Extension(),console.log("NIP-07 extension detected:",this.hasNip07),this.hasNip07&&this.commentAs==="user")try{this.userPublicKey=await window.nostr.getPublicKey(),console.log("Successfully connected to NIP-07 extension, public key:",this.userPublicKey),this.userPrivateKey=null,this.anonPrivateKeyHex=null}catch(t){console.warn("NIP-07 extension available but failed to get public key:",t),this.commentAs="anon",this.userPublicKey=null,this.userPrivateKey=null}if(!this.userPublicKey){const t=await this.ensureAnonKey();this.anonPrivateKeyHex=t,this.userPrivateKey=t;const{getPublicKey:n}=await xe(async()=>{const{getPublicKey:a}=await import("../assets/pure-jrVhRVpB.js");return{getPublicKey:a}},__vite__mapDeps([0,1]));this.userPublicKey=n(new Uint8Array(t.match(/.{1,2}/g).map(a=>parseInt(a,16)))),console.log("Using anonymous key for user:",this.userPublicKey)}if(this.commentAs==="anon"&&!this.anonPrivateKeyHex){const t=await this.ensureAnonKey();this.anonPrivateKeyHex=t,console.log("Ensured anonymous key is available")}if(this.userPublicKey){try{console.log("Fetching profile for user:",this.userPublicKey);const t=await this.nostrService.getProfile({pubkey:this.userPublicKey});console.log("Profile fetched for current user:",t),t?(this.currentUserProfile=t,console.log("Set currentUserProfile to:",this.currentUserProfile)):(this.currentUserProfile={name:this.commentAs==="anon"?"Anonymous":`User ${this.userPublicKey.slice(0,8)}`,displayName:this.commentAs==="anon"?"Anonymous":`User ${this.userPublicKey.slice(0,8)}`,image:"./assets/default_dp.png"},console.log("Set fallback currentUserProfile to:",this.currentUserProfile))}catch(t){console.error("Error fetching current user profile:",t),this.currentUserProfile={name:this.commentAs==="anon"?"Anonymous":`User ${this.userPublicKey.slice(0,8)}`,displayName:this.commentAs==="anon"?"Anonymous":`User ${this.userPublicKey.slice(0,8)}`,image:"./assets/default_dp.png"},console.log("Set error fallback currentUserProfile to:",this.currentUserProfile)}this.render()}});f(this,"submitComment",async t=>{if(t.trim()){this.userPublicKey||await this.initializeUser(),this.isSubmitting=!0,this.render();try{const n=[];if(n.push(["I",this.baseUrl]),this.replyingToComment){const{rootId:d}=this.findRootAndParent(this.replyingToComment);n.push(["e",d||this.replyingToComment,"","root"]),n.push(["e",this.replyingToComment,"","reply"]),n.push(["k","1111"])}const a={kind:1111,pubkey:this.userPublicKey,content:t.trim(),created_at:Math.floor(Date.now()/1e3),tags:n};let s;if(console.log(`[nostr-comment] Signing attempt - commentAs: ${this.commentAs}, hasNip07: ${!!window.nostr}, anonKey: ${!!this.anonPrivateKeyHex}, userKey: ${!!this.userPrivateKey}`),this.commentAs==="user"&&this.hasNip07&&window.nostr){console.log("[nostr-comment] Using NIP-07 extension to sign");try{s=await window.nostr.signEvent(a),console.log("[nostr-comment] Successfully signed with NIP-07 extension")}catch(d){throw console.error("[nostr-comment] Failed to sign with NIP-07 extension:",d),new Error("Failed to sign with NIP-07 extension. Please check if your extension is unlocked.")}}else if(this.commentAs==="anon"&&this.anonPrivateKeyHex){console.log("[nostr-comment] Using anonymous private key to sign");const{finalizeEvent:d}=await xe(async()=>{const{finalizeEvent:D}=await import("../assets/pure-jrVhRVpB.js");return{finalizeEvent:D}},__vite__mapDeps([0,1])),E=new Uint8Array(this.anonPrivateKeyHex.match(/.{1,2}/g).map(D=>parseInt(D,16)));s=d(a,E)}else if(this.userPrivateKey){console.log("[nostr-comment] Using local private key to sign (fallback)");const{finalizeEvent:d}=await xe(async()=>{const{finalizeEvent:D}=await import("../assets/pure-jrVhRVpB.js");return{finalizeEvent:D}},__vite__mapDeps([0,1])),E=new Uint8Array(this.userPrivateKey.match(/.{1,2}/g).map(D=>parseInt(D,16)));s=d(a,E)}else throw console.error("[nostr-comment] No signing method available - commentAs:",this.commentAs,"hasNip07:",this.hasNip07,"anonKey:",!!this.anonPrivateKeyHex,"userKey:",!!this.userPrivateKey),new Error("No signing method available. Please check your NIP-07 extension or switch to anonymous mode.");await new en(this.nostrService.getNDK(),s).publish();const h={id:s.id,pubkey:s.pubkey,content:s.content,created_at:s.created_at,replies:[],replyTo:this.replyingToComment||void 0,depth:0};if(this.currentUserProfile)h.userProfile=this.currentUserProfile;else{try{const d=await this.nostrService.getProfile({pubkey:s.pubkey});d&&(h.userProfile=d,this.currentUserProfile=d)}catch{console.warn("Could not fetch profile for new comment")}h.userProfile||(h.userProfile={name:this.commentAs==="anon"?"Anonymous":`User ${s.pubkey.slice(0,8)}`,displayName:this.commentAs==="anon"?"Anonymous":`User ${s.pubkey.slice(0,8)}`,image:"./assets/default_dp.png"})}this.replyingToComment?this.addReplyToComment(h,this.replyingToComment):this.comments.unshift(h);const g=n.find(d=>d[0]==="e"&&d[3]==="root"),y=n.find(d=>d[0]==="e"&&d[3]==="reply");if(console.log(`[nostr-comment] send: "${a.content}" root=${g?g[1]:"(none)"} parent=${y?y[1]:"(none)"} `),this.replyingToComment){const d=this.shadow.querySelector(".inline-reply-form"),E=d==null?void 0:d.querySelector('[data-role="comment-input"]');E&&(E.value="")}else{const d=this.shadow.querySelector(".modern-comment-form"),E=d==null?void 0:d.querySelector('[data-role="comment-input"]');E&&(E.value="")}this.replyingToComment=null}catch(n){console.error("Failed to submit comment:",n);let a="Failed to submit comment: "+(n instanceof Error?n.message:"Unknown error");n instanceof Error&&n.message.includes("NIP-07")&&(n.message.includes("extension is unlocked")?a="Please unlock your Nostr extension (nos2x/Alby) and try again.":n.message.includes("getPublicKey")?a="Please authorize this website in your Nostr extension.":a="Nostr extension error. Please check if your extension is working properly."),this.showError(a)}finally{this.isSubmitting=!1,this.render()}}});f(this,"addReplyToComment",(t,n)=>{const a=s=>{for(const c of s){if(c.id===n)return t.depth=(c.depth||0)+1,c.replies.push(t),c.replies.sort((h,g)=>h.created_at-g.created_at),!0;if(c.replies.length>0&&a(c.replies))return!0}return!1};a(this.comments)});f(this,"startReply",t=>{this.replyingToComment=null,this.render(),setTimeout(()=>{this.replyingToComment=t,this.render(),setTimeout(()=>{const n=this.shadow.querySelector(".inline-reply-form"),a=n==null?void 0:n.querySelector('[data-role="comment-input"]');a&&a.focus()},100)},10)});f(this,"cancelReply",()=>{this.replyingToComment=null,this.render()});this.shadow=this.attachShadow({mode:"open"})}findRootAndParent(t){let n,a;const s=(c,h,g)=>{var y;for(const d of c){const E=h??d.id;if(d.id===t)return n=E,a=g,!0;if((y=d.replies)!=null&&y.length&&s(d.replies,E,d.id))return!0}return!1};return s(this.comments),{rootId:n,parentId:a}}async connectedCallback(){if(!this.rendered)try{this.getTheme(),this.baseUrl=this.getBaseUrl(),await this.initializeUser(),await this.loadComments(),this.setupNip07StateMonitoring(),this.rendered=!0}catch(t){console.error("Error in connectedCallback:",t),this.isError=!0,this.errorMessage="Failed to initialize comment component",this.render()}}static get observedAttributes(){return["relays","theme","url","readonly","placeholder"]}async attributeChangedCallback(t,n,a){t==="relays"&&(this.nostrService.connectToNostr(this.getRelays()),await this.loadComments()),t==="theme"&&(this.getTheme(),this.render()),t==="url"&&(this.baseUrl=this.getBaseUrl(),await this.loadComments()),["readonly","placeholder"].includes(t)&&this.render()}disconnectedCallback(){this.removeEventListeners(),this.nip07MonitoringInterval&&(clearInterval(this.nip07MonitoringInterval),this.nip07MonitoringInterval=null)}attachEventListeners(){this.removeEventListeners(),this.shadow.querySelectorAll('[data-role="submit-comment"]').forEach(t=>{const n=a=>{a.preventDefault();const s=a.target.closest(".modern-comment-form, .inline-reply-form"),c=s==null?void 0:s.querySelector('[data-role="comment-input"]');c&&this.submitComment(c.value)};t.addEventListener("click",n),this.eventListeners.push({element:t,type:"click",handler:n})}),this.shadow.querySelectorAll('[data-role="comment-input"]').forEach(t=>{const n=a=>{const s=a;s.key==="Enter"&&(s.ctrlKey||s.metaKey)&&(s.preventDefault(),this.submitComment(t.value))};t.addEventListener("keydown",n),this.eventListeners.push({element:t,type:"keydown",handler:n})}),this.shadow.querySelectorAll('[data-role="cancel-reply"]').forEach(t=>{const n=a=>{a.preventDefault(),this.cancelReply()};t.addEventListener("click",n),this.eventListeners.push({element:t,type:"click",handler:n})}),this.shadow.querySelectorAll(".reply-btn").forEach(t=>{const n=a=>{a.preventDefault();const s=a.currentTarget.getAttribute("data-comment-id");s&&this.startReply(s)};t.addEventListener("click",n),this.eventListeners.push({element:t,type:"click",handler:n})}),this.shadow.querySelectorAll('[data-role="toggle-as-user"]').forEach(t=>{if(!this.hasNip07)t.disabled=!0,t.title="NIP-07 extension not detected";else{const n=async a=>{a.preventDefault(),this.commentAs!=="user"&&(this.commentAs="user",this.userPrivateKey=null,this.anonPrivateKeyHex=null,await this.initializeUser())};t.addEventListener("click",n),this.eventListeners.push({element:t,type:"click",handler:n})}}),this.shadow.querySelectorAll('[data-role="toggle-as-anon"]').forEach(t=>{t.disabled=!1;const n=async a=>{a.preventDefault(),this.commentAs!=="anon"&&(this.commentAs="anon",this.userPublicKey=null,this.userPrivateKey=null,await this.initializeUser())};t.addEventListener("click",n),this.eventListeners.push({element:t,type:"click",handler:n})})}attachAvatarErrorHandlers(){this.shadow.querySelectorAll("img[src]").forEach(t=>{const n=a=>{const s=a.target;if(s.src===this.getDefaultAvatarUrl()){console.warn("Avatar fallback also failed, preventing infinite loop");return}s.src=this.getDefaultAvatarUrl()};t.addEventListener("error",n),this.eventListeners.push({element:t,type:"error",handler:n})})}removeEventListeners(){this.eventListeners.forEach(({element:t,type:n,handler:a})=>{t.removeEventListener(n,a)}),this.eventListeners=[]}showError(t){const n=document.createElement("div");n.className="nostr-comment-error",n.style.cssText=`
905
+ position: fixed;
906
+ top: 20px;
907
+ right: 20px;
908
+ background: #f44336;
909
+ color: white;
910
+ padding: 12px 20px;
911
+ border-radius: 4px;
912
+ box-shadow: 0 2px 10px rgba(0,0,0,0.2);
913
+ z-index: 10000;
914
+ max-width: 300px;
915
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
916
+ font-size: 14px;
917
+ line-height: 1.4;
918
+ `,n.textContent=t,document.body.appendChild(n);const a=t.includes("NIP-07")?8e3:5e3;setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n)},a)}getDefaultAvatarUrl(){try{return new URL("./assets/default_dp.png",import.meta.url).toString()}catch(t){return console.warn("Failed to resolve default avatar URL with import.meta.url, using relative path:",t),"./assets/default_dp.png"}}async ensureAnonKey(){const t="nostr-comment-anon-private-key";try{const s=localStorage.getItem(t);if(s&&s.match(/^[a-f0-9]{64}$/))return s}catch(s){console.warn("Failed to read from localStorage:",s)}const{generateSecretKey:n}=await xe(async()=>{const{generateSecretKey:s}=await import("../assets/pure-jrVhRVpB.js");return{generateSecretKey:s}},__vite__mapDeps([0,1])),a=Array.from(n()).map(s=>s.toString(16).padStart(2,"0")).join("");try{localStorage.setItem(t,a)}catch(s){console.warn("Failed to write to localStorage, using ephemeral key:",s)}return a}render(){this.classList.toggle("dark",this.theme==="dark"),this.classList.toggle("loading",this.isLoading),this.classList.toggle("error-container",this.isError);const t=this.hasAttribute("readonly"),n=this.getAttribute("placeholder")||"Write a comment...",a=sn(this.isLoading,this.isError,this.errorMessage,this.comments,t,n,this.isSubmitting,this.currentUserProfile,this.replyingToComment,this.commentAs,this.hasNip07),s=Pn.sanitize(a,{ALLOWED_TAGS:["div","span","button","textarea","img","a","h3","h4","p","ul","li","small","strong","em"],ALLOWED_ATTR:["class","data-role","data-comment-id","data-depth","src","alt","href","target","rel","placeholder","rows","disabled"],ALLOW_DATA_ATTR:!1});this.shadow.innerHTML=`
919
+ ${ln(this.theme)}
920
+ <div class="nostr-comment-wrapper">
921
+ ${s}
922
+ </div>
923
+ `,this.attachEventListeners(),this.attachAvatarErrorHandlers()}}customElements.get("nostr-comment")||customElements.define("nostr-comment",Nn);
924
+ //# sourceMappingURL=nostr-comment.es.js.map