@runtypelabs/persona 4.17.1 → 4.18.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 (158) hide show
  1. package/dist/chunk-3I2S3I5P.js +1 -0
  2. package/dist/chunk-76IELU7F.js +1 -0
  3. package/dist/chunk-EFJBUH5F.js +1 -0
  4. package/dist/chunk-PDPVORUF.js +1 -0
  5. package/dist/chunk-Q735PSZL.js +1 -0
  6. package/dist/chunk-VK6JOIYJ.js +1 -0
  7. package/dist/codegen.cjs +4 -4
  8. package/dist/codegen.js +4 -4
  9. package/dist/{context-mentions-BTSTIBFC.js → context-mentions-MJL6S6P2.js} +1 -1
  10. package/dist/context-mentions.cjs +9 -8
  11. package/dist/context-mentions.d.cts +1212 -14
  12. package/dist/context-mentions.d.ts +1212 -14
  13. package/dist/context-mentions.js +9 -8
  14. package/dist/event-stream-view-4EZ7BGFK.js +1 -0
  15. package/dist/event-stream-view.cjs +129 -0
  16. package/dist/event-stream-view.d.cts +8384 -0
  17. package/dist/event-stream-view.d.ts +8384 -0
  18. package/dist/event-stream-view.js +129 -0
  19. package/dist/history-view-BD6OXLNA.js +898 -0
  20. package/dist/history-view.cjs +898 -0
  21. package/dist/history-view.d.cts +1461 -0
  22. package/dist/history-view.d.ts +1461 -0
  23. package/dist/history-view.js +898 -0
  24. package/dist/index.cjs +77 -77
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +1987 -17
  27. package/dist/index.d.ts +1987 -17
  28. package/dist/index.global.js +67 -66
  29. package/dist/index.global.js.map +1 -1
  30. package/dist/index.js +77 -77
  31. package/dist/index.js.map +1 -1
  32. package/dist/launcher.global.js +5 -4
  33. package/dist/launcher.global.js.map +1 -1
  34. package/dist/plugin-kit.cjs +1 -1
  35. package/dist/plugin-kit.d.cts +0 -8
  36. package/dist/plugin-kit.d.ts +0 -8
  37. package/dist/plugin-kit.js +1 -1
  38. package/dist/smart-dom-reader.d.cts +1212 -14
  39. package/dist/smart-dom-reader.d.ts +1212 -14
  40. package/dist/theme-editor-preview.cjs +970 -73
  41. package/dist/theme-editor-preview.d.cts +1331 -15
  42. package/dist/theme-editor-preview.d.ts +1331 -15
  43. package/dist/theme-editor-preview.js +81 -81
  44. package/dist/theme-editor.cjs +7 -7
  45. package/dist/theme-editor.d.cts +1215 -15
  46. package/dist/theme-editor.d.ts +1215 -15
  47. package/dist/theme-editor.js +9 -9
  48. package/dist/theme-reference.cjs +1 -1
  49. package/dist/theme-reference.d.cts +226 -7
  50. package/dist/theme-reference.d.ts +226 -7
  51. package/dist/theme-reference.js +1 -1
  52. package/dist/widget.css +1 -1
  53. package/package.json +16 -4
  54. package/src/client-history-rest.test.ts +1034 -0
  55. package/src/client-visitor-history.test.ts +596 -0
  56. package/src/client.ts +1040 -24
  57. package/src/components/artifact-inline.ts +8 -1
  58. package/src/components/artifact-pane.test.ts +278 -1
  59. package/src/components/artifact-pane.ts +135 -67
  60. package/src/components/artifact-preview.test.ts +14 -1
  61. package/src/components/artifact-preview.ts +9 -0
  62. package/src/components/header-builder.ts +3 -0
  63. package/src/components/header-layouts.test.ts +171 -7
  64. package/src/components/header-layouts.ts +83 -53
  65. package/src/components/header-parts.test.ts +154 -1
  66. package/src/components/header-parts.ts +266 -138
  67. package/src/components/history-confirm-dialog.ts +177 -0
  68. package/src/components/history-shell-copy.ts +99 -0
  69. package/src/components/history-view/announcer.ts +40 -0
  70. package/src/components/history-view/copy.ts +105 -0
  71. package/src/components/history-view/css.ts +1078 -0
  72. package/src/components/history-view/grouping.test.ts +142 -0
  73. package/src/components/history-view/grouping.ts +142 -0
  74. package/src/components/history-view/icons.ts +73 -0
  75. package/src/components/history-view/rows.ts +341 -0
  76. package/src/components/history-view/state.ts +309 -0
  77. package/src/components/history-view.test.ts +2660 -0
  78. package/src/components/history-view.ts +1891 -0
  79. package/src/components/launcher-surface.test.ts +133 -0
  80. package/src/components/launcher.test.ts +18 -0
  81. package/src/components/launcher.ts +7 -7
  82. package/src/components/panel.ts +17 -7
  83. package/src/components/welcome.ts +72 -2
  84. package/src/defaults.ts +36 -3
  85. package/src/event-stream-view-bundle.test.ts +69 -0
  86. package/src/event-stream-view-entry.ts +19 -0
  87. package/src/event-stream-view-loader.ts +31 -0
  88. package/src/event-stream-view.ts +19 -0
  89. package/src/generated/runtype-openapi-contract.ts +1 -0
  90. package/src/history-render.ts +325 -0
  91. package/src/history-view-bundle.test.ts +78 -0
  92. package/src/history-view-entry.ts +41 -0
  93. package/src/history-view-loader.test.ts +30 -0
  94. package/src/history-view-loader.ts +32 -0
  95. package/src/history-view.ts +28 -0
  96. package/src/index-core.ts +50 -2
  97. package/src/index-global.ts +55 -0
  98. package/src/internal/demo-history-provider.test.ts +402 -0
  99. package/src/internal/demo-history-provider.ts +689 -0
  100. package/src/internal/history-provider-registry.ts +25 -0
  101. package/src/internal/history-provider.ts +150 -0
  102. package/src/internal/runtype-history-provider.test.ts +313 -0
  103. package/src/internal/runtype-history-provider.ts +240 -0
  104. package/src/plugin-kit.test.ts +16 -0
  105. package/src/plugin-kit.ts +13 -5
  106. package/src/plugins/types.ts +177 -1
  107. package/src/session-history.test.ts +1397 -0
  108. package/src/session.ts +1200 -26
  109. package/src/styles/widget-styles.test.ts +133 -0
  110. package/src/styles/widget.css +227 -8
  111. package/src/theme-editor/preview-utils.test.ts +19 -0
  112. package/src/theme-editor/preview-utils.ts +15 -1
  113. package/src/theme-editor/preview.ts +7 -1
  114. package/src/theme-editor/role-mappings.ts +4 -1
  115. package/src/theme-editor/sections.test.ts +168 -1
  116. package/src/theme-editor/sections.ts +136 -7
  117. package/src/theme-editor/webmcp/summary.ts +16 -2
  118. package/src/theme-reference.ts +20 -6
  119. package/src/types/theme.ts +213 -7
  120. package/src/types.ts +927 -7
  121. package/src/ui.artifact-rail-resize.test.ts +235 -0
  122. package/src/ui.attachments-drop.test.ts +1 -0
  123. package/src/ui.header-update-stability.test.ts +2 -2
  124. package/src/ui.history-chunk.test.ts +72 -0
  125. package/src/ui.history-config-provider.test.ts +318 -0
  126. package/src/ui.history-controller.test.ts +711 -0
  127. package/src/ui.history-lifecycle.test.ts +456 -0
  128. package/src/ui.history-render-hooks.test.ts +904 -0
  129. package/src/ui.history-shell.test.ts +1887 -0
  130. package/src/ui.rail-overlay.test.ts +573 -0
  131. package/src/ui.rail-resize.test.ts +284 -0
  132. package/src/ui.rebuild-composer.test.ts +21 -0
  133. package/src/ui.render-welcome.test.ts +42 -0
  134. package/src/ui.shortcuts.test.ts +166 -0
  135. package/src/ui.ts +3071 -240
  136. package/src/utils/__fixtures__/client-conversation-history-wire.json +108 -0
  137. package/src/utils/artifact-file.ts +15 -0
  138. package/src/utils/artifact-gate.test.ts +4 -0
  139. package/src/utils/artifact-gate.ts +13 -17
  140. package/src/utils/artifact-resize.test.ts +28 -0
  141. package/src/utils/artifact-resize.ts +9 -2
  142. package/src/utils/buttons.ts +188 -1
  143. package/src/utils/config-merge.test.ts +91 -0
  144. package/src/utils/dropdown.ts +10 -1
  145. package/src/utils/history-messages.test.ts +284 -0
  146. package/src/utils/history-messages.ts +284 -0
  147. package/src/utils/icons.ts +3 -0
  148. package/src/utils/shortcuts.test.ts +288 -0
  149. package/src/utils/shortcuts.ts +221 -0
  150. package/src/utils/theme.test.ts +501 -4
  151. package/src/utils/theme.ts +42 -3
  152. package/src/utils/tokens.ts +153 -15
  153. package/src/utils/tooltip-timing.ts +4 -0
  154. package/src/utils/tooltip.test.ts +249 -7
  155. package/src/utils/tooltip.ts +146 -4
  156. package/src/utils/visitor-store.test.ts +425 -0
  157. package/src/utils/visitor-store.ts +337 -0
  158. package/dist/chunk-QJ4LV2KW.js +0 -1
@@ -0,0 +1,898 @@
1
+ var ue=e=>e.nodeType===Node.DOCUMENT_NODE,st=e=>e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host!==void 0;function it(e){let t=e.getRootNode?.();return t&&st(t)||t&&ue(t)?t:e.ownerDocument??document}function ye(e,t,o){let i=ue(e)?e.head:e,a=t.replace(/["\\]/g,"\\$&");if(i.querySelector(`style[data-persona-plugin-style="${a}"]`))return;let u=(ue(e)?e:e.ownerDocument??document).createElement("style");u.setAttribute("data-persona-plugin-style",t),u.textContent=o,i.appendChild(u)}function at(e,t,o){if(ue(e)||st(e)){ye(e,t,o);return}let i=e;if(i.isConnected){ye(it(i),t,o);return}let a=i.ownerDocument??document;ye(a,t,o),queueMicrotask(()=>{let l=it(i);l!==a&&ye(l,t,o)})}var s=(e,t={},...o)=>{let i=document.createElement(e);if(t.className&&(i.className=t.className),t.text!==void 0&&(i.textContent=t.text),t.attrs)for(let[l,u]of Object.entries(t.attrs))i.setAttribute(l,u);if(t.style){let l=i.style,u=t.style;for(let c of Object.keys(u)){let h=u[c];h!=null&&(l[c]=h)}}let a=o.filter(l=>l!=null);return a.length>0&&i.append(...a),i},T=(...e)=>e.filter(Boolean).join(" ");function lt(){let e=document.createElement("div");e.className="persona-history-sr-only",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.setAttribute("data-persona-history-live-region","");let t;return{element:e,announce(o){t!==void 0&&clearTimeout(t),e.textContent="",t=setTimeout(()=>{t=void 0,e.textContent=o},0)},destroy(){t!==void 0&&clearTimeout(t),e.remove()}}}var pt=`
2
+ .persona-history-view {
3
+ --persona-history-surface-bg: var(--persona-surface, #ffffff);
4
+ --persona-history-topbar-bg: var(--persona-header-bg, var(--persona-surface, #ffffff));
5
+ --persona-history-border: var(--persona-divider, var(--persona-border, #e5e7eb));
6
+ --persona-history-row-hover-bg: var(--persona-button-ghost-hover-bg, rgba(0, 0, 0, 0.04));
7
+ --persona-history-row-avatar-bg: var(--persona-header-icon-bg, var(--persona-primary, #2563eb));
8
+ --persona-history-row-active-bg: var(--persona-divider, var(--persona-border, #e5e7eb));
9
+ --persona-history-skeleton-bg: var(--persona-divider, var(--persona-border, #e5e7eb));
10
+ --persona-history-focus-ring: var(--persona-primary, #2563eb);
11
+ --persona-history-slide: 20px;
12
+ --persona-history-row-min-height: 60px;
13
+ --persona-history-topbar-min-height: 56px;
14
+ box-sizing: border-box;
15
+ display: flex;
16
+ flex-direction: column;
17
+ width: 100%;
18
+ max-width: 100%;
19
+ min-width: 0;
20
+ height: 100%;
21
+ overflow: hidden;
22
+ background: var(--persona-history-surface-bg);
23
+ color: var(--persona-text, #111827);
24
+ font-family: var(--persona-font-family, inherit);
25
+ font-size: 14px;
26
+ line-height: 1.45;
27
+ opacity: 1;
28
+ }
29
+ .persona-history-view *,
30
+ .persona-history-view *::before,
31
+ .persona-history-view *::after {
32
+ box-sizing: border-box;
33
+ }
34
+ .persona-history-view--enter .persona-history-body {
35
+ animation: persona-history-enter-body var(--persona-history-enter-ms, 180ms)
36
+ var(--persona-history-enter-easing, cubic-bezier(0, 0, 0.2, 1)) both;
37
+ }
38
+ @keyframes persona-history-enter-body {
39
+ from { opacity: 0; transform: translateX(var(--persona-history-slide)); }
40
+ to { opacity: 1; transform: none; }
41
+ }
42
+ .persona-history-view .persona-history-sr-only,
43
+ .persona-history-view--panel .persona-history-group-heading,
44
+ .persona-history-view--panel .persona-history-conversations-title,
45
+ .persona-history-view .persona-history-scope-alert[data-persona-history-scope-tone="ambient"] {
46
+ position: absolute;
47
+ width: 1px;
48
+ height: 1px;
49
+ margin: -1px;
50
+ padding: 0;
51
+ overflow: hidden;
52
+ clip: rect(0 0 0 0);
53
+ clip-path: inset(50%);
54
+ white-space: nowrap;
55
+ border: 0;
56
+ }
57
+
58
+ .persona-history-view .persona-history-topbar,
59
+ .persona-history-topbar.persona-history-topbar--shell {
60
+ display: grid;
61
+ grid-template-columns: 44px minmax(0, 1fr) 44px;
62
+ align-items: center;
63
+ gap: 4px;
64
+ }
65
+ .persona-history-view .persona-history-topbar {
66
+ min-height: var(--persona-history-topbar-min-height);
67
+ padding: 6px 8px;
68
+ background: var(--persona-history-topbar-bg);
69
+ border-bottom: 1px solid var(--persona-history-border);
70
+ }
71
+ .persona-history-view .persona-history-heading-group,
72
+ .persona-history-topbar--shell .persona-history-heading-group {
73
+ min-width: 0;
74
+ text-align: center;
75
+ }
76
+ .persona-history-view .persona-history-title,
77
+ .persona-history-topbar--shell .persona-history-title {
78
+ margin: 0;
79
+ padding: 0;
80
+ font-family: var(--persona-components-header-title-fontFamily, inherit);
81
+ font-size: var(--persona-components-header-title-fontSize, 1rem);
82
+ font-weight: var(--persona-components-header-title-fontWeight, 600);
83
+ line-height: var(--persona-components-header-title-lineHeight, 1.5rem);
84
+ color: var(--persona-header-title-fg, var(--persona-primary, #0f0f0f));
85
+ overflow: hidden;
86
+ text-overflow: ellipsis;
87
+ white-space: nowrap;
88
+ }
89
+ .persona-history-view .persona-history-caption {
90
+ position: relative;
91
+ display: flex;
92
+ align-items: center;
93
+ gap: 8px;
94
+ padding: 0 4px;
95
+ }
96
+ .persona-history-view .persona-history-scope {
97
+ flex: 1 1 auto;
98
+ margin: 0;
99
+ font-size: 12px;
100
+ line-height: 1.35;
101
+ color: var(--persona-text-muted, #6b7280);
102
+ overflow-wrap: anywhere;
103
+ }
104
+ .persona-history-view .persona-history-conversations-title {
105
+ margin: 0;
106
+ font-family: var(--persona-components-history-listHeading-fontFamily, inherit);
107
+ font-size: var(--persona-components-history-listHeading-fontSize, 14px);
108
+ font-weight: var(--persona-components-history-listHeading-fontWeight, 600);
109
+ line-height: var(--persona-components-history-listHeading-lineHeight, 20px);
110
+ letter-spacing: var(--persona-components-history-listHeading-letterSpacing, normal);
111
+ color: var(--persona-components-history-listHeading-color, var(--persona-text, #111827));
112
+ overflow: hidden;
113
+ text-overflow: ellipsis;
114
+ white-space: nowrap;
115
+ }
116
+ .persona-history-view .persona-history-scope-icon {
117
+ display: none;
118
+ }
119
+ .persona-history-view .persona-history-scope-description {
120
+ display: block;
121
+ }
122
+ .persona-history-view .persona-history-scope-alert {
123
+ display: flex;
124
+ flex-direction: column;
125
+ align-items: flex-start;
126
+ gap: 8px;
127
+ margin: 0;
128
+ padding: 10px 12px;
129
+ border: 1px solid var(--persona-history-border);
130
+ border-radius: var(--persona-radius-md, 8px);
131
+ font-size: 12px;
132
+ color: var(--persona-text-muted, #6b7280);
133
+ }
134
+ .persona-history-view .persona-history-scope-alert-title {
135
+ display: block;
136
+ font-weight: 600;
137
+ color: var(--persona-text, #111827);
138
+ }
139
+
140
+ .persona-history-view button.persona-history-icon-button,
141
+ .persona-history-topbar--shell button.persona-history-icon-button {
142
+ display: inline-flex;
143
+ align-items: center;
144
+ justify-content: center;
145
+ width: 44px;
146
+ height: 44px;
147
+ min-width: 44px;
148
+ min-height: 44px;
149
+ padding: 0;
150
+ margin: 0;
151
+ border: 0;
152
+ border-radius: var(--persona-button-ghost-radius, var(--persona-radius-md, 8px));
153
+ background: transparent;
154
+ color: var(--persona-header-action-icon-fg, var(--persona-text-muted, #6b7280));
155
+ cursor: pointer;
156
+ }
157
+ .persona-history-view button.persona-history-icon-button:hover:not(:disabled),
158
+ .persona-history-topbar--shell button.persona-history-icon-button:hover:not(:disabled) {
159
+ background: var(--persona-button-ghost-hover-bg, rgba(0, 0, 0, 0.04));
160
+ }
161
+ .persona-history-view button:focus-visible,
162
+ .persona-history-view [role="menuitem"]:focus-visible,
163
+ .persona-history-topbar--shell button:focus-visible {
164
+ outline: 2px solid var(--persona-history-focus-ring, var(--persona-primary, #2563eb));
165
+ outline-offset: 2px;
166
+ }
167
+ .persona-history-view button:disabled {
168
+ opacity: 0.55;
169
+ cursor: default;
170
+ }
171
+ .persona-history-view button.persona-history-list-options {
172
+ width: 28px;
173
+ height: 28px;
174
+ min-width: 28px;
175
+ min-height: 28px;
176
+ margin-left: auto;
177
+ }
178
+ .persona-history-view button.persona-history-list-options[aria-expanded="true"] {
179
+ background: var(--persona-button-ghost-hover-bg, rgba(0, 0, 0, 0.04));
180
+ color: var(--persona-text, #111827);
181
+ }
182
+
183
+ .persona-history-view .persona-history-body {
184
+ flex: 1 1 auto;
185
+ min-height: 0;
186
+ overflow-y: auto;
187
+ overflow-x: hidden;
188
+ padding: 12px 16px 16px;
189
+ display: flex;
190
+ flex-direction: column;
191
+ gap: 16px;
192
+ }
193
+ .persona-history-view button.persona-history-new {
194
+ display: inline-flex;
195
+ align-items: center;
196
+ gap: 8px;
197
+ max-width: 100%;
198
+ border: 1px solid transparent;
199
+ border-radius: var(--persona-button-radius, var(--persona-radius-lg, 10px));
200
+ font: inherit;
201
+ font-size: 14px;
202
+ line-height: 20px;
203
+ text-align: left;
204
+ cursor: pointer;
205
+ }
206
+ .persona-history-view button.persona-history-new span {
207
+ min-width: 0;
208
+ overflow-wrap: anywhere;
209
+ }
210
+ .persona-history-view .persona-history-list-region {
211
+ display: flex;
212
+ flex-direction: column;
213
+ gap: 16px;
214
+ min-width: 0;
215
+ }
216
+
217
+ .persona-history-view .persona-history-group-heading {
218
+ margin: 0 0 4px;
219
+ padding: 0 4px;
220
+ font-family: var(--persona-components-history-groupHeading-fontFamily, inherit);
221
+ font-size: var(--persona-components-history-groupHeading-fontSize, 12px);
222
+ font-weight: var(--persona-components-history-groupHeading-fontWeight, 600);
223
+ line-height: var(--persona-components-history-groupHeading-lineHeight, 1.35);
224
+ letter-spacing: var(--persona-components-history-groupHeading-letterSpacing, normal);
225
+ color: var(--persona-components-history-groupHeading-color, var(--persona-text-muted, #6b7280));
226
+ }
227
+ .persona-history-view ul.persona-history-list {
228
+ list-style: none;
229
+ margin: 0;
230
+ padding: 0;
231
+ }
232
+ .persona-history-view li.persona-history-item {
233
+ position: relative;
234
+ margin: 0;
235
+ padding: 0;
236
+ list-style: none;
237
+ }
238
+ .persona-history-view button.persona-history-row {
239
+ display: flex;
240
+ align-items: center;
241
+ gap: 8px;
242
+ width: 100%;
243
+ min-height: var(--persona-history-row-min-height);
244
+ padding: 10px 16px;
245
+ margin: 0;
246
+ border: 0;
247
+ border-radius: 0;
248
+ background: transparent;
249
+ color: inherit;
250
+ font: inherit;
251
+ text-align: left;
252
+ cursor: pointer;
253
+ }
254
+ .persona-history-view li.persona-history-item:hover button.persona-history-row:not(:disabled),
255
+ .persona-history-view button.persona-history-row:hover:not(:disabled) {
256
+ background: var(--persona-history-row-hover-bg);
257
+ }
258
+ .persona-history-view button.persona-history-row[aria-current="page"] {
259
+ background: var(--persona-history-row-active-bg);
260
+ }
261
+ .persona-history-view .persona-history-row-avatar {
262
+ display: flex;
263
+ flex: 0 0 auto;
264
+ align-items: center;
265
+ justify-content: center;
266
+ width: 40px;
267
+ height: 40px;
268
+ overflow: hidden;
269
+ border-radius: 16.7%;
270
+ background: var(--persona-history-row-avatar-bg);
271
+ color: var(--persona-header-icon-fg, var(--persona-text-inverse, #ffffff));
272
+ font-size: 20px;
273
+ line-height: 1;
274
+ }
275
+ .persona-history-view .persona-history-row-avatar img {
276
+ width: 100%;
277
+ height: 100%;
278
+ object-fit: cover;
279
+ }
280
+ .persona-history-view .persona-history-row-body {
281
+ flex: 1 1 auto;
282
+ min-width: 0;
283
+ line-height: 21px;
284
+ }
285
+ .persona-history-view .persona-history-row-head {
286
+ display: flex;
287
+ align-items: baseline;
288
+ gap: 8px;
289
+ min-width: 0;
290
+ }
291
+ .persona-history-view .persona-history-row-title {
292
+ flex: 1 1 auto;
293
+ min-width: 0;
294
+ font-size: 14px;
295
+ font-weight: 600;
296
+ color: var(--persona-text, #111827);
297
+ }
298
+ .persona-history-view .persona-history-truncate {
299
+ display: block;
300
+ overflow: hidden;
301
+ text-overflow: ellipsis;
302
+ white-space: nowrap;
303
+ }
304
+ .persona-history-view time.persona-history-row-time {
305
+ flex: 0 0 auto;
306
+ white-space: nowrap;
307
+ font-size: 14px;
308
+ font-weight: 400;
309
+ font-variant-numeric: tabular-nums;
310
+ color: var(--persona-text-muted, #6b7280);
311
+ }
312
+ .persona-history-view .persona-history-row-star {
313
+ flex: 0 0 auto;
314
+ display: inline-flex;
315
+ align-self: center;
316
+ color: var(--persona-text-muted, #6b7280);
317
+ }
318
+ .persona-history-view .persona-history-row-preview {
319
+ font-size: 14px;
320
+ color: var(--persona-text-muted, #6b7280);
321
+ }
322
+ .persona-history-view button.persona-history-row-menu-button {
323
+ position: absolute;
324
+ top: 50%;
325
+ right: 6px;
326
+ transform: translateY(-50%);
327
+ color: var(--persona-text-muted, #6b7280);
328
+ }
329
+ @media (hover: hover) {
330
+ .persona-history-view button.persona-history-row-menu-button {
331
+ opacity: 0;
332
+ transition: opacity 120ms ease;
333
+ }
334
+ .persona-history-view li.persona-history-item:hover time.persona-history-row-time,
335
+ .persona-history-view li.persona-history-item:focus-within time.persona-history-row-time {
336
+ opacity: 0;
337
+ }
338
+ .persona-history-view li.persona-history-item:hover button.persona-history-row-menu-button,
339
+ .persona-history-view li.persona-history-item:focus-within button.persona-history-row-menu-button {
340
+ opacity: 1;
341
+ }
342
+ }
343
+ .persona-history-view button.persona-history-row-menu-button[aria-expanded="true"] {
344
+ opacity: 1;
345
+ }
346
+ .persona-history-view button.persona-history-row-menu-button:hover:not(:disabled),
347
+ .persona-history-view button.persona-history-row-menu-button[aria-expanded="true"] {
348
+ background: linear-gradient(var(--persona-history-row-hover-bg), var(--persona-history-row-hover-bg)),
349
+ linear-gradient(var(--persona-history-row-hover-bg), var(--persona-history-row-hover-bg)),
350
+ var(--persona-history-surface-bg);
351
+ color: var(--persona-text, #111827);
352
+ }
353
+ @media (hover: hover) {
354
+ .persona-history-view li.persona-history-item:hover .persona-history-row-preview,
355
+ .persona-history-view li.persona-history-item:focus-within .persona-history-row-preview,
356
+ .persona-history-view li.persona-history-item:has(button[aria-expanded="true"]) .persona-history-row-preview {
357
+ -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 84px), transparent calc(100% - 36px));
358
+ mask-image: linear-gradient(to right, #000 calc(100% - 84px), transparent calc(100% - 36px));
359
+ }
360
+ }
361
+ .persona-history-view li.persona-history-item--no-menu:hover time.persona-history-row-time,
362
+ .persona-history-view li.persona-history-item--no-menu:focus-within time.persona-history-row-time {
363
+ opacity: 1;
364
+ }
365
+ .persona-history-view li.persona-history-item--no-menu:hover .persona-history-row-preview,
366
+ .persona-history-view li.persona-history-item--no-menu:focus-within .persona-history-row-preview,
367
+ .persona-history-view li.persona-history-item--no-menu .persona-history-row-preview {
368
+ -webkit-mask-image: none;
369
+ mask-image: none;
370
+ }
371
+ .persona-history-view .persona-history-menu {
372
+ position: absolute;
373
+ top: calc(50% + 20px);
374
+ right: 8px;
375
+ z-index: 2;
376
+ min-width: 160px;
377
+ max-width: calc(100% - 16px);
378
+ padding: 4px;
379
+ border: 1px solid var(--persona-history-border);
380
+ border-radius: var(--persona-history-menu-radius, 12px);
381
+ background: var(--persona-history-surface-bg);
382
+ background: var(--persona-history-menu-bg, color-mix(in srgb, var(--persona-history-surface-bg) 92%, #fff));
383
+ box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
384
+ }
385
+ .persona-history-view .persona-history-caption .persona-history-menu {
386
+ top: calc(100% - 2px);
387
+ right: 4px;
388
+ }
389
+ .persona-history-view--rail .persona-history-caption .persona-history-menu {
390
+ grid-row: 1 / 2;
391
+ grid-column: 1 / -1;
392
+ top: calc(100% + 2px);
393
+ right: 0;
394
+ }
395
+ .persona-history-view button.persona-history-menu-item {
396
+ display: block;
397
+ width: 100%;
398
+ min-height: 32px;
399
+ padding: 6px 10px;
400
+ border: 0;
401
+ border-radius: 8px;
402
+ background: transparent;
403
+ color: var(--persona-text, #111827);
404
+ font: inherit;
405
+ text-align: left;
406
+ cursor: pointer;
407
+ }
408
+ .persona-history-view button.persona-history-menu-item--danger {
409
+ color: var(--persona-history-danger-fg, var(--persona-palette-colors-error-600, #b91c1c));
410
+ }
411
+ .persona-history-view button.persona-history-menu-item:hover:not(:disabled) {
412
+ background: var(--persona-history-row-hover-bg);
413
+ }
414
+ .persona-history-view .persona-history-row-error {
415
+ display: flex;
416
+ flex-wrap: wrap;
417
+ align-items: center;
418
+ gap: 8px;
419
+ padding: 8px 16px 12px;
420
+ font-size: 13px;
421
+ color: var(--persona-history-danger-fg, var(--persona-palette-colors-error-600, #b91c1c));
422
+ }
423
+
424
+ .persona-history-view button.persona-history-secondary {
425
+ display: inline-flex;
426
+ align-items: center;
427
+ justify-content: center;
428
+ gap: 8px;
429
+ width: 100%;
430
+ min-height: 44px;
431
+ padding: 10px 16px;
432
+ margin: 0;
433
+ border: 1px solid var(--persona-history-border);
434
+ border-radius: var(--persona-button-radius, var(--persona-radius-lg, 10px));
435
+ background: transparent;
436
+ color: var(--persona-text, #111827);
437
+ font: inherit;
438
+ font-weight: 500;
439
+ cursor: pointer;
440
+ }
441
+ .persona-history-view button.persona-history-secondary:hover:not(:disabled) {
442
+ background: var(--persona-history-row-hover-bg);
443
+ }
444
+ .persona-history-view .persona-history-state {
445
+ display: flex;
446
+ flex-direction: column;
447
+ align-items: flex-start;
448
+ gap: 8px;
449
+ padding: 8px 4px;
450
+ }
451
+ .persona-history-view .persona-history-state-title {
452
+ margin: 0;
453
+ font-size: 14px;
454
+ font-weight: 600;
455
+ color: var(--persona-text, #111827);
456
+ }
457
+ .persona-history-view .persona-history-state-description {
458
+ margin: 0;
459
+ font-size: 13px;
460
+ color: var(--persona-text-muted, #6b7280);
461
+ overflow-wrap: anywhere;
462
+ }
463
+ .persona-history-view button.persona-history-state-action {
464
+ width: auto;
465
+ min-width: 44px;
466
+ }
467
+ .persona-history-view .persona-history-view-loading {
468
+ display: flex;
469
+ flex-direction: column;
470
+ animation: persona-history-skeleton-in 120ms ease-out 250ms both;
471
+ }
472
+ @keyframes persona-history-skeleton-in {
473
+ from { opacity: 0; }
474
+ to { opacity: 1; }
475
+ }
476
+ .persona-history-view .persona-history-skeleton-row {
477
+ display: flex;
478
+ flex-direction: column;
479
+ justify-content: center;
480
+ gap: 9px;
481
+ min-height: var(--persona-history-row-min-height);
482
+ padding: 10px 16px;
483
+ }
484
+ .persona-history-view .persona-history-skeleton-head {
485
+ display: flex;
486
+ align-items: center;
487
+ justify-content: space-between;
488
+ gap: 8px;
489
+ }
490
+ .persona-history-view .persona-history-skeleton-bar {
491
+ height: 12px;
492
+ border-radius: 999px;
493
+ background: var(--persona-history-skeleton-bg);
494
+ animation: persona-history-pulse 1400ms ease-in-out infinite;
495
+ }
496
+ .persona-history-view .persona-history-skeleton-bar--time {
497
+ flex: 0 0 auto;
498
+ width: 22px;
499
+ }
500
+ .persona-history-view .persona-history-skeleton-bar--preview {
501
+ width: 88%;
502
+ }
503
+ @keyframes persona-history-pulse {
504
+ 0%, 100% { opacity: 1; }
505
+ 50% { opacity: 0.55; }
506
+ }
507
+
508
+ .persona-history-view--panel .persona-history-list-region {
509
+ gap: 0;
510
+ }
511
+ .persona-history-view--panel .persona-history-group {
512
+ margin: 0 -16px;
513
+ }
514
+ .persona-history-view--panel button.persona-history-load-more {
515
+ margin-top: 12px;
516
+ }
517
+ .persona-history-view--panel button.persona-history-new {
518
+ order: 1;
519
+ position: sticky;
520
+ bottom: 12px;
521
+ z-index: 1;
522
+ align-self: center;
523
+ width: auto;
524
+ min-height: 40px;
525
+ padding: 10px 16px;
526
+ margin: auto 0 0;
527
+ background: var(--persona-button-primary-bg, var(--persona-primary, #2563eb));
528
+ color: var(--persona-button-primary-fg, var(--persona-text-inverse, #ffffff));
529
+ font-weight: 600;
530
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
531
+ }
532
+
533
+ .persona-history-view--rail {
534
+ --persona-history-slide: 12px;
535
+ --persona-history-surface-bg: var(--persona-container, #f7f7f8);
536
+ --persona-history-topbar-bg: transparent;
537
+ --persona-history-topbar-min-height: 48px;
538
+ --persona-history-row-min-height: 36px;
539
+ }
540
+ .persona-history-view--rail .persona-history-topbar {
541
+ grid-template-columns: minmax(0, 1fr) auto;
542
+ min-height: var(
543
+ --persona-history-rail-header-min-height,
544
+ var(--persona-header-min-height, 56px)
545
+ );
546
+ padding: 2px 6px;
547
+ background: var(
548
+ --persona-history-rail-header-bg,
549
+ var(--persona-history-surface-bg)
550
+ );
551
+ border-bottom: var(--persona-history-rail-header-border, 0);
552
+ }
553
+ .persona-history-view--rail .persona-history-heading-group {
554
+ text-align: left;
555
+ padding-left: 10px;
556
+ }
557
+ .persona-history-view--rail-right .persona-history-topbar {
558
+ grid-template-columns: auto minmax(0, 1fr);
559
+ }
560
+ .persona-history-view--rail-right .persona-history-heading-group {
561
+ padding: 0 10px 0 0;
562
+ }
563
+ .persona-history-view--rail .persona-history-topbar button.persona-history-icon-button {
564
+ width: 36px;
565
+ height: 36px;
566
+ min-width: 36px;
567
+ min-height: 36px;
568
+ color: var(--persona-text-muted, #6b7280);
569
+ }
570
+ @media (pointer: coarse) {
571
+ .persona-history-view--rail .persona-history-topbar button.persona-history-icon-button {
572
+ width: 44px;
573
+ height: 44px;
574
+ min-width: 44px;
575
+ min-height: 44px;
576
+ }
577
+ .persona-history-view button.persona-history-menu-item {
578
+ min-height: 44px;
579
+ padding: 10px 12px;
580
+ }
581
+ .persona-history-view .persona-history-row-preview {
582
+ -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 84px), transparent calc(100% - 36px));
583
+ mask-image: linear-gradient(to right, #000 calc(100% - 84px), transparent calc(100% - 36px));
584
+ }
585
+ .persona-history-view button.persona-history-list-options {
586
+ width: 40px;
587
+ height: 40px;
588
+ min-width: 40px;
589
+ min-height: 40px;
590
+ }
591
+ }
592
+ .persona-history-view--rail .persona-history-title {
593
+ font-family: var(--persona-components-history-railHeader-title-fontFamily, inherit);
594
+ font-size: var(--persona-components-history-railHeader-title-fontSize, 14px);
595
+ font-weight: var(--persona-components-history-railHeader-title-fontWeight, 600);
596
+ line-height: var(--persona-components-history-railHeader-title-lineHeight, inherit);
597
+ letter-spacing: var(--persona-components-history-railHeader-title-letterSpacing, normal);
598
+ color: var(
599
+ --persona-components-history-railHeader-title-color,
600
+ var(--persona-text, #111827)
601
+ );
602
+ }
603
+ .persona-history-view .persona-history-heading-brand {
604
+ display: flex;
605
+ align-items: center;
606
+ gap: 8px;
607
+ min-width: 0;
608
+ }
609
+ .persona-history-view .persona-history-brand-mark {
610
+ display: flex;
611
+ flex: none;
612
+ align-items: center;
613
+ justify-content: center;
614
+ }
615
+ .persona-history-view .persona-history-brand-mark > img,
616
+ .persona-history-view .persona-history-brand-mark > svg {
617
+ width: 20px;
618
+ height: 20px;
619
+ object-fit: contain;
620
+ }
621
+ .persona-history-view .persona-history-wordmark {
622
+ min-width: 0;
623
+ overflow: hidden;
624
+ color: var(--persona-text, #111827);
625
+ font-size: 14px;
626
+ font-weight: 600;
627
+ text-overflow: ellipsis;
628
+ white-space: nowrap;
629
+ }
630
+ .persona-history-view .persona-history-toggle-brand {
631
+ display: none;
632
+ }
633
+ .persona-history-view--rail-collapsed .persona-history-back--branded .persona-history-toggle-brand {
634
+ display: flex;
635
+ }
636
+ .persona-history-view--rail-collapsed .persona-history-back--branded > svg {
637
+ display: none;
638
+ }
639
+ .persona-history-view--rail-collapsed .persona-history-back--branded:hover .persona-history-toggle-brand,
640
+ .persona-history-view--rail-collapsed .persona-history-back--branded:focus-visible .persona-history-toggle-brand {
641
+ display: none;
642
+ }
643
+ .persona-history-view--rail-collapsed .persona-history-back--branded:hover > svg,
644
+ .persona-history-view--rail-collapsed .persona-history-back--branded:focus-visible > svg {
645
+ display: block;
646
+ }
647
+ @media (pointer: coarse) {
648
+ .persona-history-view--rail-collapsed .persona-history-back--branded .persona-history-toggle-brand {
649
+ display: none;
650
+ }
651
+ .persona-history-view--rail-collapsed .persona-history-back--branded > svg {
652
+ display: block;
653
+ }
654
+ }
655
+ .persona-history-view--rail .persona-history-body {
656
+ gap: 8px;
657
+ padding: 4px 0 12px;
658
+ }
659
+ .persona-history-view--rail .persona-history-caption,
660
+ .persona-history-view--rail .persona-history-scope-alert,
661
+ .persona-history-view--rail .persona-history-state {
662
+ padding-right: 16px;
663
+ padding-left: 16px;
664
+ }
665
+ .persona-history-view--rail .persona-history-caption {
666
+ display: grid;
667
+ grid-template-columns: minmax(0, 1fr) auto;
668
+ /* Explicit rows: the abspos menu is grid-placed into row 1, and abspos
669
+ grid placement only resolves against explicit lines (implicit/auto ends
670
+ fall back to the padding-box edge, i.e. below the scope line). */
671
+ grid-template-rows: auto auto;
672
+ align-items: center;
673
+ row-gap: 2px;
674
+ }
675
+ .persona-history-view--rail .persona-history-conversations-title {
676
+ grid-row: 1;
677
+ grid-column: 1;
678
+ }
679
+ .persona-history-view--rail .persona-history-caption button.persona-history-list-options {
680
+ grid-row: 1;
681
+ grid-column: 2;
682
+ margin-left: 0;
683
+ }
684
+ .persona-history-view--rail .persona-history-scope {
685
+ grid-row: 2;
686
+ grid-column: 1 / -1;
687
+ display: flex;
688
+ align-items: center;
689
+ gap: 6px;
690
+ }
691
+ .persona-history-view--rail .persona-history-scope[hidden] {
692
+ display: none;
693
+ }
694
+ .persona-history-view--rail .persona-history-scope-title {
695
+ min-width: 0;
696
+ overflow: hidden;
697
+ text-overflow: ellipsis;
698
+ white-space: nowrap;
699
+ }
700
+ .persona-history-view--rail .persona-history-scope[data-persona-history-identity="browser_only"] .persona-history-scope-icon {
701
+ display: flex;
702
+ flex: none;
703
+ align-items: center;
704
+ }
705
+ .persona-history-view--rail.persona-history-view--has-nav .persona-history-caption {
706
+ margin-top: 4px;
707
+ padding-top: 12px;
708
+ border-top: 1px solid var(--persona-history-border);
709
+ }
710
+ .persona-history-view--rail button.persona-history-new {
711
+ width: calc(100% - 12px);
712
+ min-height: 36px;
713
+ padding: 6px 10px;
714
+ margin: 0 6px;
715
+ border-radius: 10px;
716
+ background: transparent;
717
+ color: inherit;
718
+ font-weight: 500;
719
+ }
720
+ .persona-history-view--rail button.persona-history-new:hover:not(:disabled) {
721
+ background: var(--persona-history-row-hover-bg);
722
+ }
723
+ .persona-history-view--rail .persona-history-list-region {
724
+ gap: 24px;
725
+ }
726
+ .persona-history-view .persona-history-nav {
727
+ display: flex;
728
+ flex-direction: column;
729
+ gap: 2px;
730
+ }
731
+ .persona-history-view .persona-history-nav--footer {
732
+ margin-top: auto;
733
+ }
734
+ .persona-history-view .persona-history-nav[hidden] {
735
+ display: none;
736
+ }
737
+ .persona-history-view button.persona-history-nav-item {
738
+ display: flex;
739
+ align-items: center;
740
+ gap: 8px;
741
+ width: calc(100% - 12px);
742
+ min-height: 36px;
743
+ padding: 6px 10px;
744
+ margin: 0 6px;
745
+ border: 0;
746
+ border-radius: 10px;
747
+ background: transparent;
748
+ color: inherit;
749
+ font: inherit;
750
+ text-align: left;
751
+ cursor: pointer;
752
+ }
753
+ .persona-history-view button.persona-history-nav-item:hover:not(:disabled) {
754
+ background: var(--persona-history-row-hover-bg);
755
+ }
756
+ .persona-history-view .persona-history-nav-icon {
757
+ display: flex;
758
+ flex: none;
759
+ align-items: center;
760
+ justify-content: center;
761
+ width: 20px;
762
+ height: 20px;
763
+ color: var(--persona-text-muted, #6b7280);
764
+ }
765
+ .persona-history-view .persona-history-nav-icon > * {
766
+ width: 20px;
767
+ height: 20px;
768
+ object-fit: contain;
769
+ }
770
+ .persona-history-view .persona-history-nav-label {
771
+ flex: 1 1 auto;
772
+ min-width: 0;
773
+ }
774
+ .persona-history-view .persona-history-nav-badge {
775
+ flex: none;
776
+ padding: 0 6px;
777
+ border-radius: 999px;
778
+ background: var(--persona-history-row-hover-bg);
779
+ color: var(--persona-text-muted, #6b7280);
780
+ font-size: 11px;
781
+ line-height: 18px;
782
+ }
783
+ .persona-history-view--rail .persona-history-group-heading {
784
+ margin: 0 0 6px;
785
+ padding: 0 16px;
786
+ font-size: var(--persona-components-history-groupHeading-fontSize, 13px);
787
+ font-weight: var(--persona-components-history-groupHeading-fontWeight, 500);
788
+ line-height: var(--persona-components-history-groupHeading-lineHeight, 20px);
789
+ }
790
+ .persona-history-view--rail .persona-history-row-avatar,
791
+ .persona-history-view--rail .persona-history-row-preview,
792
+ .persona-history-view--rail time.persona-history-row-time {
793
+ display: none;
794
+ }
795
+ .persona-history-view--rail button.persona-history-row {
796
+ min-height: 36px;
797
+ padding: 6px 10px;
798
+ margin: 0 6px;
799
+ width: calc(100% - 12px);
800
+ border-radius: 10px;
801
+ }
802
+ .persona-history-view--rail .persona-history-row-title {
803
+ font-weight: 400;
804
+ }
805
+ .persona-history-view--rail button.persona-history-row-menu-button {
806
+ right: 10px;
807
+ width: 28px;
808
+ height: 28px;
809
+ min-width: 28px;
810
+ min-height: 28px;
811
+ }
812
+ .persona-history-view--rail .persona-history-skeleton-row {
813
+ padding: 6px 16px;
814
+ }
815
+ .persona-history-view--rail .persona-history-skeleton-bar--preview,
816
+ .persona-history-view--rail .persona-history-skeleton-bar--time {
817
+ display: none;
818
+ }
819
+ .persona-history-view--rail-collapsed .persona-history-topbar {
820
+ grid-template-columns: minmax(0, 1fr);
821
+ justify-items: center;
822
+ padding: 2px;
823
+ }
824
+ .persona-history-view--rail-collapsed .persona-history-heading-group,
825
+ .persona-history-view--rail-collapsed .persona-history-body > :not(.persona-history-new):not(.persona-history-nav) {
826
+ display: none;
827
+ }
828
+ .persona-history-view--rail-collapsed button.persona-history-new {
829
+ width: 36px;
830
+ padding: 0;
831
+ margin: 0 auto;
832
+ justify-content: center;
833
+ }
834
+ .persona-history-view--rail-collapsed button.persona-history-new span {
835
+ display: none;
836
+ }
837
+ .persona-history-view--rail-collapsed .persona-history-nav .persona-history-group-heading,
838
+ .persona-history-view--rail-collapsed button.persona-history-nav-item:not(.persona-history-nav-item--icon),
839
+ .persona-history-view--rail-collapsed .persona-history-nav-label,
840
+ .persona-history-view--rail-collapsed .persona-history-nav-badge {
841
+ display: none;
842
+ }
843
+ .persona-history-view--rail-collapsed button.persona-history-nav-item {
844
+ width: 36px;
845
+ padding: 0;
846
+ margin: 0 auto;
847
+ justify-content: center;
848
+ }
849
+
850
+ [data-persona-history-suppressed] { display: none !important; }
851
+ .persona-history-header-host {
852
+ display: flex;
853
+ flex: 1 1 auto;
854
+ align-self: stretch;
855
+ align-items: center;
856
+ min-width: 0;
857
+ }
858
+ .persona-history-rail-host {
859
+ transition: flex-basis 180ms cubic-bezier(0, 0, 0.2, 1);
860
+ }
861
+ .persona-history-topbar.persona-history-topbar--shell {
862
+ flex: 1 1 auto;
863
+ min-width: 0;
864
+ grid-template-columns: var(--persona-header-control-size, 44px) minmax(0, 1fr) var(--persona-header-control-size, 44px);
865
+ }
866
+ .persona-history-topbar--shell button.persona-history-icon-button {
867
+ width: var(--persona-header-control-size, 44px);
868
+ height: var(--persona-header-control-size, 44px);
869
+ min-width: var(--persona-header-control-size, 44px);
870
+ min-height: var(--persona-header-control-size, 44px);
871
+ }
872
+ .persona-history-topbar--shell button.persona-history-icon-button svg {
873
+ width: var(--persona-header-control-icon-size, 20px);
874
+ height: var(--persona-header-control-icon-size, 20px);
875
+ }
876
+ @media (pointer: coarse) {
877
+ .persona-history-topbar--shell button.persona-history-icon-button {
878
+ min-width: 40px;
879
+ min-height: 40px;
880
+ }
881
+ }
882
+ .persona-history-topbar--shell.persona-history-topbar--shell-enter {
883
+ animation: persona-history-header-fade 120ms cubic-bezier(0, 0, 0.2, 1) both;
884
+ }
885
+ @keyframes persona-history-header-fade {
886
+ from { opacity: 0; }
887
+ to { opacity: 1; }
888
+ }
889
+
890
+ @media (prefers-reduced-motion: reduce) {
891
+ .persona-history-view--enter .persona-history-body { animation: none; }
892
+ .persona-history-topbar--shell.persona-history-topbar--shell-enter {
893
+ animation: none;
894
+ }
895
+ .persona-history-view .persona-history-skeleton-bar { animation: none; }
896
+ .persona-history-rail-host { transition: none; }
897
+ }
898
+ `;var dt={viewTitle:"Messages",openHistoryLabel:"Messages",openHistoryBusyLabel:"Messages, available once the reply finishes",newConversationLabel:"New conversation",expandLabel:"Expand conversation list",collapseLabel:"Collapse conversation list",resizeLabel:"Resize conversation list",showEarlierMessagesLabel:"Show earlier messages",openConversationLoadingLabel:"Loading conversation",openConversationErrorTitle:"Could not open the conversation.",openConversationRetryLabel:"Try again",openConversationBackLabel:"Back to messages",confirmCancelLabel:"Cancel",deleteConversationConfirmTitle:"Delete conversation",deleteConversationConfirm:"Delete this conversation? This cannot be undone.",deleteConversationConfirmLabel:"Delete",clearHistoryConfirmTitle:"Delete all conversations",clearHistoryConfirm:"Delete all conversations for this assistant on this browser? This cannot be undone.",clearHistoryVerifiedConfirm:"Delete all conversations for this assistant and signed-in user? This cannot be undone.",clearHistoryConfirmLabel:"Delete all",resetIdentityConfirmTitle:"Forget this device",resetIdentityConfirm:"Forget this device? All Persona data stored in this browser is cleared. Records are not deleted elsewhere.",resetIdentityConfirmLabel:"Forget this device",conversationDeletedNotice:"That conversation was deleted. You are now in a new conversation.",identityResetNotice:"This device was forgotten.",identityResetUnconfirmedNotice:"This device was cleared here, but the server could not confirm it."};var he={...dt,emptyTitle:"No conversations yet",emptyDescription:"Start a conversation and it will show up here.",errorTitle:"Could not load conversations",errorDescription:"Something went wrong. Please try again.",retryLabel:"Retry",rateLimitedTitle:"Too many requests",rateLimitedDescription:"Please wait a moment before trying again.",groupStarred:"Starred",groupToday:"Today",groupYesterday:"Yesterday",groupPrevious7Days:"Previous 7 days",groupPrevious30Days:"Previous 30 days",groupMonthYear:"{month} {year}",browserOnlyTitle:"On this device",browserOnlyDescription:"Another browser or device keeps its own separate history.",verifyingTitle:"Checking your account",verifyingDescription:"Looking for messages linked to your account.",verifiedTitle:"Available across signed-in devices",verifiedDescription:"This list refreshes when the chat opens rather than syncing live.",authenticationRequiredTitle:"Sign in to see your messages",authenticationRequiredDescription:"Your session expired. Sign in again to load account history.",identityProviderFailedTitle:"Account history is unavailable",identityProviderFailedDescription:"We could not verify your account, so account history is not shown here.",proofNotAdmittedTitle:"Account history is unavailable",proofNotAdmittedDescription:"This assistant is not set up to accept your account identity.",retryIdentityLabel:"Try again",backLabel:"Back to conversation",closeLabel:"Close conversation list",loadingLabel:"Loading conversations",loadMoreLabel:"Load more",loadingMoreLabel:"Loading more conversations",conversationsTitle:"Conversations",rowActionsLabel:"Conversation options",listOptionsLabel:"Conversation options",deleteConversationLabel:"Delete",clearHistoryLabel:"Delete all conversations",resetIdentityLabel:"Forget this device",messageCountLabel:"{count} messages",messageCountLabelOne:"1 message",conversationRemovedNotice:"Conversation deleted.",historyClearedNotice:"All conversations were deleted.",unavailableTitle:"Conversation history is unavailable",unavailableDescription:"Try again later.",newConversationRequiredTitle:"Start a new conversation",newConversationRequiredDescription:"The previous conversation is gone. Start a new one to keep chatting.",rateLimitedWaitDescription:"You can try again in {seconds} seconds.",openFailedLabel:"Could not open that conversation.",deleteFailedLabel:"Could not delete that conversation.",relativeNow:"now",relativeMinutes:"{value}m",relativeHours:"{value}h",relativeDays:"{value}d",relativeWeeks:"{value}w",relativeYears:"{value}y"};function me(e){if(!e)return he;let t={...he};for(let[o,i]of Object.entries(e))typeof i=="string"&&i.length>0&&(t[o]=i);return t}function E(e,t){return e.replace(/\{(\w+)\}/g,(o,i)=>i in t?String(t[i]):o)}var Ie=864e5;function $t(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function Oe(e,t){let o=Date.parse(e);return Number.isFinite(o)?o:t}function Kt(e,t){let o=Oe(e,t),i=$t(t);if(o>=i)return"today";if(o>=i-Ie)return"yesterday";if(o>=i-7*Ie)return"previous-7-days";if(o>=i-30*Ie)return"previous-30-days";let a=new Date(o);return`month:${a.getFullYear()}-${a.getMonth()}`}function Bt(e,t,o,i){if(e==="today")return i.groupToday;if(e==="yesterday")return i.groupYesterday;if(e==="previous-7-days")return i.groupPrevious7Days;if(e==="previous-30-days")return i.groupPrevious30Days;let a=new Date(Oe(t,o));return E(i.groupMonthYear,{month:a.toLocaleString(void 0,{month:"long"}),year:a.getFullYear()})}function ct(e,t,o,i="time"){let a=e.filter(u=>u.starred),l=a.length>0?[{key:"starred",label:o.groupStarred,items:a}]:[];if(i==="none"){let u=e.filter(c=>!c.starred);return u.length>0&&l.push({key:"recent",label:o.conversationsTitle,items:u}),l}for(let u of e){if(u.starred)continue;let c=Kt(u.updatedAt,t),h=l[l.length-1];if(h&&h.key===c){h.items.push(u);continue}l.push({key:c,label:Bt(c,u.updatedAt,t,o),items:[u]})}return l}function yt(e,t,o){let i=Math.max(0,t-Oe(e,t)),a=Math.floor(i/6e4);if(a<1)return o.relativeNow;if(a<60)return E(o.relativeMinutes,{value:a});let l=Math.floor(a/60);if(l<24)return E(o.relativeHours,{value:l});let u=Math.floor(l/24);if(u<7)return E(o.relativeDays,{value:u});let c=Math.floor(u/7);return u<365?E(o.relativeWeeks,{value:c}):E(o.relativeYears,{value:Math.floor(u/365)})}function ut(e,t){return e===1?t.messageCountLabelOne:E(t.messageCountLabel,{count:e})}var ve="http://www.w3.org/2000/svg",Wt={"arrow-left":["m12 19-7-7 7-7","M19 12H5"],plus:["M5 12h14","M12 5v14"],star:["m12 2 2.9 6.2 6.8.7-5.1 4.5 1.4 6.6-6-3.4-6 3.4 1.4-6.6-5.1-4.5 6.8-.7z"],x:["M18 6 6 18","m6 6 12 12"],"panel-left":["M9 3v18"],monitor:["M8 21h8","M12 17v4"],ellipsis:[]},Yt={"panel-left":[3,3,18,18],monitor:[2,3,20,14]};function _(e,t=20){let o=document.createElementNS(ve,"svg");if(o.setAttribute("width",String(t)),o.setAttribute("height",String(t)),o.setAttribute("viewBox","0 0 24 24"),o.setAttribute("fill","none"),o.setAttribute("stroke","currentColor"),o.setAttribute("stroke-width","2"),o.setAttribute("stroke-linecap","round"),o.setAttribute("stroke-linejoin","round"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false"),e==="ellipsis"){for(let a of[12,19,5]){let l=document.createElementNS(ve,"circle");l.setAttribute("cx",String(a)),l.setAttribute("cy","12"),l.setAttribute("r","1"),o.appendChild(l)}return o}let i=Yt[e];if(i){let a=document.createElementNS(ve,"rect");a.setAttribute("x",String(i[0])),a.setAttribute("y",String(i[1])),a.setAttribute("width",String(i[2])),a.setAttribute("height",String(i[3])),a.setAttribute("rx","2"),o.appendChild(a)}for(let a of Wt[e]){let l=document.createElementNS(ve,"path");l.setAttribute("d",a),o.appendChild(l)}return o}var jt=/^(https?:|\/|data:)/i;function Gt(e){let t=s("span",{className:"persona-history-row-avatar",attrs:{"aria-hidden":"true"}});return jt.test(e)?t.appendChild(s("img",{attrs:{src:e,alt:"",loading:"lazy"}})):t.textContent=e,t}var Ut=e=>`row:${e}`,Xt=e=>`menu:${e}`,te=e=>`menu-item:${e}`;function ht(e){let{conversation:t,copy:o,busy:i,pending:a}=e,l=i||a!==null,u=t.title.trim().length>0,c=t.starred?(()=>{let M=_("star",11);return M.setAttribute("fill","currentColor"),M.setAttribute("stroke-width","1"),s("span",{className:"persona-history-row-star"},M,s("span",{className:"persona-history-sr-only",text:o.groupStarred}))})():null,h=s("div",{className:"persona-history-row-head"},s("span",{className:"persona-history-row-title persona-history-truncate",text:u?t.title:t.preview??""}),c,s("time",{className:"persona-history-row-time",attrs:{datetime:t.updatedAt},text:yt(t.updatedAt,e.nowMs,o)})),C=u&&t.preview?s("span",{className:"persona-history-row-preview persona-history-truncate",text:t.preview}):null,b=s("button",{className:T("persona-history-row",e.active&&"persona-history-row--active",a&&`persona-history-row--${a}`),attrs:{type:"button","data-persona-history-focus":Ut(t.id),"data-persona-history-conversation":t.id,...e.active?{"aria-current":"page"}:{},...l?{"aria-disabled":"true"}:{},...a?{"aria-busy":"true"}:{}}},e.avatar?Gt(e.avatar):null,s("div",{className:"persona-history-row-body"},h,C,s("span",{className:"persona-history-row-count persona-history-sr-only",text:ut(t.messageCount,o)})));b.addEventListener("click",()=>{l||e.onOpen()});let oe=e.showDelete?Ve({className:"persona-history-row-menu-button",label:`${o.rowActionsLabel}: ${t.title}`,focusKey:Xt(t.id),open:e.menuOpen,inert:l,onToggle:e.onToggleMenu}):null;return s("li",{className:T("persona-history-item",!e.showDelete&&"persona-history-item--no-menu"),attrs:{"data-persona-history-item":t.id}},b,oe,e.menuOpen&&e.showDelete?Zt(e):null,e.error?Jt(e.error,o,t.id):null)}function Zt(e){let{conversation:t,copy:o}=e;return ze({label:`${o.rowActionsLabel}: ${t.title}`,items:[{label:o.deleteConversationLabel,focusKey:te(t.id),danger:!0,onSelect:e.onDelete}],onCloseMenu:e.onCloseMenu})}function Ve(e){let t=s("button",{className:T("persona-history-icon-button",e.className),attrs:{type:"button","aria-label":e.label,"aria-haspopup":"menu","aria-expanded":e.open?"true":"false","data-persona-history-focus":e.focusKey,...e.inert?{"aria-disabled":"true"}:{}}});t.appendChild(_("ellipsis",e.iconSize));let o=()=>t.getAttribute("aria-disabled")==="true";return t.addEventListener("click",i=>{i.stopPropagation(),!o()&&e.onToggle()}),t.addEventListener("keydown",i=>{i.key!=="ArrowDown"&&i.key!=="ArrowUp"||(i.preventDefault(),!(o()||t.getAttribute("aria-expanded")==="true")&&e.onToggle())}),t}function ze(e){let t=s("div",{className:"persona-history-menu",attrs:{role:"menu","aria-label":e.label}});for(let o of e.items){let i=s("button",{className:T("persona-history-menu-item",o.danger&&"persona-history-menu-item--danger"),text:o.label,attrs:{type:"button",role:"menuitem",tabindex:"0","data-persona-history-focus":o.focusKey}});i.addEventListener("click",()=>{e.onCloseMenu(),o.onSelect()}),t.appendChild(i)}return t.addEventListener("keydown",o=>{let i=Array.from(t.querySelectorAll('[role="menuitem"]'));if(i.length===0)return;let a=i.indexOf(document.activeElement);if(o.key==="Tab"){e.onCloseMenu({restoreFocus:!0});return}if(o.key==="ArrowDown"){o.preventDefault(),i[(a+1+i.length)%i.length]?.focus();return}if(o.key==="ArrowUp"){o.preventDefault(),i[(a-1+i.length)%i.length]?.focus();return}if(o.key==="Home"){o.preventDefault(),i[0]?.focus();return}o.key==="End"&&(o.preventDefault(),i[i.length-1]?.focus())}),t}function Jt(e,t,o){let i=s("button",{className:"persona-history-secondary persona-history-state-action",text:t.retryLabel,attrs:{type:"button","data-persona-history-focus":`row-retry:${o}`}});return i.addEventListener("click",e.retry),s("div",{className:"persona-history-row-error",attrs:{role:"alert"}},s("span",{text:e.message}),i)}var Fe=class extends Error{constructor(t,o,i){super(o),this.name="HistoryProviderError",this.code=t,i?.retryAfterSeconds!==void 0&&(this.retryAfterSeconds=i.retryAfterSeconds)}};function ge(e){return e instanceof Fe}function Qt(e){switch(e){case"authentication_failed":case"authentication_required":case"identity_provider_failed":case"proof_not_admitted":case"unsupported_scope":case"unavailable":return e;default:return"unknown"}}function mt(e){if(ge(e)){if(e.code==="rate_limited")return{kind:"rate_limited",retryAfterSeconds:e.retryAfterSeconds??0};let t=Qt(e.code);return{kind:"error",reason:t,retryable:t!=="unsupported_scope"}}return{kind:"error",reason:"unknown",retryable:!0}}function er(e,t){switch(e.state){case"authentication_required":return{title:t.authenticationRequiredTitle,description:t.authenticationRequiredDescription};case"identity_provider_failed":return{title:t.identityProviderFailedTitle,description:t.identityProviderFailedDescription};case"configuration_error":return{title:t.proofNotAdmittedTitle,description:t.proofNotAdmittedDescription};default:return null}}function tr(e,t){switch(e){case"authentication_required":case"authentication_failed":return{title:t.authenticationRequiredTitle,description:t.authenticationRequiredDescription};case"identity_provider_failed":return{title:t.identityProviderFailedTitle,description:t.identityProviderFailedDescription};case"proof_not_admitted":case"unsupported_scope":return{title:t.proofNotAdmittedTitle,description:t.proofNotAdmittedDescription};case"unavailable":return{title:t.unavailableTitle,description:t.unavailableDescription};default:return{title:t.errorTitle,description:t.errorDescription}}}function fe(e,t,o,i){let a=s("button",{className:"persona-history-secondary persona-history-state-action",text:e,attrs:{type:"button","data-persona-history-focus":t,...o?{"aria-disabled":"true"}:{}}});return a.addEventListener("click",()=>{o||i()}),a}function re(e,t,o,i,a){return s("div",{className:"persona-history-state",attrs:{"data-persona-history-state":e,...a?{role:"alert"}:{role:"status"}}},s("p",{className:"persona-history-state-title",text:t}),s("p",{className:"persona-history-state-description",text:o}),i)}function rr(e){let t=["42%","58%","34%"],o=["94%","78%","88%"],i=[0,1,2].map(a=>s("div",{className:"persona-history-skeleton-row",attrs:{"aria-hidden":"true"}},s("div",{className:"persona-history-skeleton-head"},s("div",{className:"persona-history-skeleton-bar persona-history-skeleton-bar--title",style:{width:t[a]}}),s("div",{className:"persona-history-skeleton-bar persona-history-skeleton-bar--time"})),s("div",{className:"persona-history-skeleton-bar persona-history-skeleton-bar--preview",style:{width:o[a]}})));return s("div",{className:"persona-history-view-loading",attrs:{"data-persona-history-state":"loading",role:"status","aria-label":e.loadingLabel}},...i)}function vt(e){let{state:t,copy:o,busy:i}=e;if(t.kind==="loading")return rr(o);if(t.kind==="empty"){let c=er(e.identityStatus,o);return c?re("identity",c.title,c.description,e.onRetry?fe(o.retryIdentityLabel,"state-retry",i,e.onRetry):null,!0):re("empty",o.emptyTitle,o.emptyDescription,null,!1)}if(t.kind==="rate_limited"){let c=t.retryAfterSeconds>0?E(o.rateLimitedWaitDescription,{seconds:t.retryAfterSeconds}):o.rateLimitedDescription;return re("rate_limited",o.rateLimitedTitle,c,e.onRetry?fe(o.retryLabel,"state-retry",i,e.onRetry):null,!1)}if(t.kind==="new_conversation_required")return re("new_conversation_required",o.newConversationRequiredTitle,o.newConversationRequiredDescription,e.onStartNew?fe(o.newConversationLabel,"state-retry",i,e.onStartNew):null,!0);let{title:a,description:l}=tr(t.reason,o),u=t.reason==="authentication_required"||t.reason==="authentication_failed"||t.reason==="identity_provider_failed"?o.retryIdentityLabel:o.retryLabel;return re("error",a,l,t.retryable&&e.onRetry?fe(u,"state-retry",i,e.onRetry):null,!0)}var or=25,F="persona:list-options",nr=180,gt=120,ir=160,sr="cubic-bezier(0.4, 0, 1, 1)",ar={panel:20,rail:12},lr=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,pr=e=>e.finished?e.finished.then(()=>{},()=>{}):Promise.resolve();function be(e){return`${e.state}:${"reason"in e?e.reason:""}`}function ft(e,t){switch(e.state){case"verified":return{title:t.verifiedTitle,description:t.verifiedDescription,pending:!1};case"verifying":case"resetting":return{title:t.verifyingTitle,description:t.verifyingDescription,pending:!0};case"authentication_required":return{title:t.authenticationRequiredTitle,description:t.authenticationRequiredDescription,pending:!1};case"identity_provider_failed":return{title:t.identityProviderFailedTitle,description:t.identityProviderFailedDescription,pending:!1};case"configuration_error":return{title:t.proofNotAdmittedTitle,description:t.proofNotAdmittedDescription,pending:!1};case"unavailable":return{title:t.unavailableTitle,description:t.unavailableDescription,pending:!1};default:return{title:t.browserOnlyTitle,description:t.browserOnlyDescription,pending:!1}}}function dr(e){return e.state==="verified"||e.state==="browser_only"}function cr(e){return e.state==="authentication_required"||e.state==="identity_provider_failed"||e.state==="configuration_error"}function bt(e){let t=me(e.copy),o=e.now??(()=>Date.now()),i=e.pageSize??or,a=`persona-history-title-${Math.random().toString(36).slice(2,8)}`,l=[],u=null,c={kind:"loading",phase:"initial"},h=null,C=e.activeConversationId,b=e.provider.getIdentityStatus(),oe=be(b),x=null,M=!1,m=!1,Y=0,S=e.presentation,wt=e.collapsible!==!1,R=e.collapsed===!0,qe=e.railSide==="right",j=e.renderDom!==!1,I=new Map,A=null,we=lt(),ne=r=>{!j&&e.onAnnounce?e.onAnnounce(r):we.announce(r)},w=()=>h!==null,$e=`${a}-body`,f=s("button",{className:"persona-history-icon-button persona-history-back",attrs:{type:"button"}}),G=()=>S==="rail"&&wt,ie,xt=()=>{if(e.railBrand){if(!G()){f.classList.remove("persona-history-back--branded");return}if(ie===void 0){let r=e.railBrand(!0);ie=r?s("span",{className:"persona-history-brand-mark persona-history-toggle-brand",attrs:{"aria-hidden":"true"}},r):null}ie&&(f.classList.add("persona-history-back--branded"),f.appendChild(ie))}},xe=()=>{let r=G(),n=S==="rail";f.setAttribute("data-persona-history-focus",r?"collapse":"close"),f.setAttribute("aria-label",r?R?t.expandLabel:t.collapseLabel:n?t.closeLabel:t.backLabel),r?(f.setAttribute("aria-expanded",R?"false":"true"),f.setAttribute("aria-controls",$e),e.collapseShortcut?.aria&&f.setAttribute("aria-keyshortcuts",e.collapseShortcut.aria)):(f.removeAttribute("aria-expanded"),f.removeAttribute("aria-controls"),f.removeAttribute("aria-keyshortcuts")),f.replaceChildren(_(r?"panel-left":n?"x":"arrow-left")),xt()};xe(),f.addEventListener("click",()=>{G()?e.onToggleCollapse?.():e.onClose()});let He=s("h2",{className:"persona-history-title",text:t.viewTitle,attrs:{id:a}}),Ke=s("span",{className:"persona-history-scope-title"}),q=s("p",{className:"persona-history-scope"},s("span",{className:"persona-history-scope-icon",attrs:{"aria-hidden":"true"}},_("monitor",14)),Ke),se=s("div",{className:"persona-history-heading-group"},He),Be=!1,ae,Ce=()=>{let r=S==="rail",n=r?e.renderRailHeader:void 0,p=null,y=n!==void 0;if(n)try{p=n({collapsed:R,defaultTitle:t.viewTitle})}catch(d){y=!1,Be||(Be=!0,console.warn("[persona] history rail renderHeader threw",d))}if(!y&&r&&e.railBrand){if(ae===void 0){let d=e.railBrand(!1);ae=d?s("span",{className:"persona-history-heading-brand",attrs:{"aria-hidden":"true"}},s("span",{className:"persona-history-brand-mark"},d),s("span",{className:"persona-history-wordmark",text:t.viewTitle})):null}ae&&(y=!0,p=ae)}He.classList.toggle("persona-history-sr-only",y),se.replaceChildren(He),p&&se.appendChild(p)};Ce();let $=s("button",{className:"persona-history-icon-button persona-history-new-icon",attrs:{type:"button","data-persona-history-focus":"new-icon","aria-label":t.newConversationLabel}});$.appendChild(_("plus")),$.addEventListener("click",()=>{ee()});let Ht=[f,$].map(r=>e.attachTooltip?.({anchor:r,text:()=>r.getAttribute("aria-label")??"",...r===f&&e.collapseShortcut?{hint:()=>G()?e.collapseShortcut.hint:""}:{}})),L=s("div",{className:"persona-history-topbar"}),We=null,Se=()=>{let r=S==="rail",n=r?qe?"rail-right":"rail":"panel";n!==We&&(We=n,n==="rail"?L.append(se,f):L.append(f,se),r?$.remove():L.appendChild($),v.classList.toggle("persona-history-view--rail-right",n==="rail-right"))},O=s("div",{className:"persona-history-scope-alert"}),Ye=`${a}-scope`,Ct=_("plus",18),Le=s("button",{className:"persona-history-new",attrs:{type:"button","data-persona-history-focus":"new"}},Ct,s("span",{text:t.newConversationLabel}));Le.addEventListener("click",()=>{ee()});let ke=s("div",{className:"persona-history-list-region"}),je=e.showDeleteAll!==!1,Ge=!!e.provider.resetDevice,Ue=e.listActions??[],V=je||Ge||Ue.length>0?Ve({className:"persona-history-list-options",label:t.listOptionsLabel,focusKey:`menu:${F}`,open:!1,inert:!0,iconSize:16,onToggle:()=>rt(F)}):null,St=s("h3",{className:"persona-history-conversations-title",text:t.conversationsTitle}),K=s("div",{className:"persona-history-caption",attrs:{"data-persona-history-item":F}},St,e.showScopeStatus?q:null,V),B=s("div",{className:"persona-history-body",attrs:{id:$e}},e.showScopeStatus?O:null,Le,K,ke),U=e.headerPlacement??"inline";U==="external"&&L.classList.add("persona-history-topbar--shell","persona-history-topbar--shell-enter");let v=s("div",{className:T("persona-history-view",`persona-history-view--${e.presentation}`,"persona-history-view--enter"),attrs:{role:"region","aria-labelledby":a,"data-persona-history-presentation":e.presentation}},we.element,U==="inline"?L:null,B),Te=()=>{v.classList.toggle("persona-history-view--rail-collapsed",R&&G())};Te(),Se();let Lt=(r,n)=>{let p=`${a}-s${n}`,y=s("div",{className:T("persona-history-nav",r.placement==="footer"&&"persona-history-nav--footer"),attrs:{role:"group","data-persona-rail-section":r.id,...r.title?{"aria-labelledby":p}:{"aria-label":r.id}}});r.title&&y.appendChild(s("h3",{className:"persona-history-group-heading",text:r.title,attrs:{id:p}}));for(let d of r.items){let H=d.iconNode?.()??null,D=s("button",{className:T("persona-history-nav-item",H&&"persona-history-nav-item--icon"),attrs:{type:"button","aria-label":d.label,"data-persona-rail-item":d.id}},H?s("span",{className:"persona-history-nav-icon"},H):null,s("span",{className:"persona-history-nav-label persona-history-truncate",text:d.label}),d.badge?s("span",{className:"persona-history-nav-badge",text:d.badge}):null);D.addEventListener("click",()=>d.onSelect()),y.appendChild(D)}return y},X=null,Xe=null,Ee=()=>{!X||!j||S!=="rail"||R===Xe||(Xe=R,e.railSections.forEach((r,n)=>{if(!r.render)return;let p=X[n],y=r.title?p.firstElementChild:null,d=null;try{d=r.render(R)}catch(H){r.render=void 0,console.warn("[persona] history rail section threw",r.id,H)}p.replaceChildren(...y?[y]:[],...d?[d]:[]),p.hidden=!d}))},Ze=()=>{let r=e.railSections;if(v.classList.toggle("persona-history-view--has-nav",S==="rail"&&!!r?.some(n=>n.placement==="above-conversations")),!!r?.length){if(S!=="rail"){X?.forEach(n=>n.remove());return}X??(X=r.map(Lt));for(let n of["above-conversations","below-conversations","footer"]){let p=n==="above-conversations"?K.parentNode===B?K:ke:null;r.forEach((y,d)=>{y.placement===n&&B.insertBefore(X[d],p)})}Ee()}};Ze(),at(v,"persona-history-view",pt);let Je=(r,n)=>{let p=v.ownerDocument.defaultView?.getComputedStyle(v).getPropertyValue(r),y=Number.parseFloat(p??"");return Number.isFinite(y)&&y>=0?y:n},kt=(r,n)=>v.ownerDocument.defaultView?.getComputedStyle(v).getPropertyValue(r).trim()||n,Z=null,z=()=>{Z!==null&&(clearTimeout(Z),Z=null),v.removeEventListener("animationend",z),v.classList.remove("persona-history-view--enter")};v.addEventListener("animationend",z),Z=setTimeout(()=>{Z=setTimeout(z,Je("--persona-history-enter-ms",nr)+60)},0);let J=null,Q=()=>{J!==null&&(clearTimeout(J),J=null),L.classList.remove("persona-history-topbar--shell-enter")},Tt=()=>{Q(),L.classList.add("persona-history-topbar--shell-enter"),J=setTimeout(Q,gt+60)};U==="external"&&(J=setTimeout(Q,gt+60));let le=[],pe=null,Et=()=>{if(pe)return pe;if(m||lr()||typeof v.animate!="function")return z(),null;let r=v.ownerDocument.defaultView?.getComputedStyle(B).opacity||"1";z(),v.style.pointerEvents="none",P.style.pointerEvents="none";let n={duration:Je("--persona-history-exit-ms",ir),easing:kt("--persona-history-exit-easing",sr),fill:"forwards"},p=ar[S];return le=[B.animate([{opacity:r,transform:"none"},{opacity:0,transform:`translateX(${p}px)`}],n)],pe=Promise.all(le.map(pr)).then(()=>{}),pe},Re=(r,n)=>{r&&(n?r.setAttribute("aria-disabled","true"):r.removeAttribute("aria-disabled"))},P=L,Ae=null,Rt=()=>{let r=e.slots?.header;if(!r)return;let n=`${S}|${be(b)}|${h?`${h.kind}:${"conversationId"in h?h.conversationId:""}`:""}`;if(n===Ae)return;Ae=n;let p=r({identityStatus:b,pendingAction:h,copy:t,defaultRenderer:()=>L})??L;p!==P&&(P.replaceWith(p),P=p)},Qe=null,At=()=>{if(!e.showScopeStatus)return;let r=be(b);if(r===Qe)return;Qe=r;let n=ft(b,t);Ke.textContent=n.title;let p=dr(b);if(q.hidden=!p,O.replaceChildren(...p?[]:[s("span",{className:"persona-history-scope-alert-title",text:n.title})],s("span",{className:"persona-history-scope-description",text:n.description,attrs:{id:Ye}})),O.setAttribute("data-persona-history-scope-tone",p?"ambient":"attention"),p?q.setAttribute("aria-describedby",Ye):q.removeAttribute("aria-describedby"),n.pending?O.setAttribute("role","status"):O.removeAttribute("role"),O.setAttribute("data-persona-history-identity",b.state),q.setAttribute("data-persona-history-identity",b.state),cr(b)){let y=s("button",{className:"persona-history-secondary persona-history-state-action",text:t.retryIdentityLabel,attrs:{type:"button","data-persona-history-focus":"identity-retry"}});y.addEventListener("click",()=>{w()||N("refresh")}),O.appendChild(y)}},et=r=>h?h.kind==="open"&&h.conversationId===r?"opening":h.kind==="delete"&&h.conversationId===r?"deleting":null:null,Nt=()=>{let r=document.activeElement;return!(r instanceof HTMLElement)||!v.contains(r)?null:r.getAttribute("data-persona-history-focus")},Mt=r=>{if(M&&x){M=!1;let n=v.querySelector(`[data-persona-history-focus="${te(x)}"]`);if(n){n.focus();return}}r&&v.querySelector(`[data-persona-history-focus="${r}"]`)?.focus()},Pt=()=>{if(!A)return null;let r=s("button",{className:"persona-history-secondary persona-history-state-action",text:t.retryLabel,attrs:{type:"button","data-persona-history-focus":"action-retry"}}),n=A;return r.addEventListener("click",()=>{w()||n.retry()}),s("div",{className:"persona-history-row-error",attrs:{role:"alert"}},s("span",{text:n.message}),r)},Dt=()=>ct(l,o(),t,e.grouping).map((r,n)=>{let p=`${a}-g${n}`,y=s("ul",{className:"persona-history-list",attrs:{"aria-labelledby":p}});for(let d of r.items){let H=()=>ht({conversation:d,active:d.id===C,pending:et(d.id),busy:w(),menuOpen:x===d.id,error:I.get(d.id)??null,avatar:e.rowAvatar,showDelete:e.showDelete!==!1,nowMs:o(),copy:t,onOpen:()=>{de(d.id)},onToggleMenu:()=>rt(d.id),onCloseMenu:_e=>k(_e),onDelete:()=>{ce(d.id)}}),W=e.slots?.conversation?.({conversation:d,active:d.id===C,pending:et(d.id),open:()=>de(d.id),requestDelete:()=>ce(d.id),defaultRenderer:H})??H();y.appendChild(W instanceof HTMLLIElement?W:s("li",{className:"persona-history-item"},W))}return s("div",{className:"persona-history-group",attrs:{"data-persona-history-group":r.key}},s("h3",{className:T("persona-history-group-heading",r.key==="recent"&&"persona-history-sr-only"),text:r.label,attrs:{id:p}}),y)}),_t=()=>{if(!u)return null;let r=h?.kind==="load-more"||c.kind==="loading"&&c.phase==="load-more",n=s("button",{className:"persona-history-secondary persona-history-load-more",text:r?t.loadingMoreLabel:t.loadMoreLabel,attrs:{type:"button","data-persona-history-focus":"load-more",...r?{"aria-busy":"true","aria-disabled":"true"}:{},...w()&&!r?{"aria-disabled":"true"}:{}}});return n.addEventListener("click",()=>{w()||N("load-more")}),n},It=()=>{let r=Nt(),n=[Pt()],p=l.length>0;if(p&&(n.push(...Dt()),n.push(_t())),c.kind!=="ready"&&!(c.kind==="loading"&&c.phase!=="initial"&&p)){let d=c,H=d.kind==="loading"?void 0:()=>N("refresh"),D=d.kind==="new_conversation_required"?()=>ee():void 0,W=()=>vt({state:d,copy:t,identityStatus:b,busy:w(),...H?{onRetry:()=>{H()}}:{},...D?{onStartNew:()=>{D()}}:{}}),_e=e.slots?.state?.({state:d,identityStatus:b,copy:t,...H?{retry:H}:{},...D?{startNewConversation:D}:{},defaultRenderer:W});n.push(_e??W())}ke.replaceChildren(...n.filter(d=>!!d)),Mt(r)},Ot=()=>{let r=c.kind==="loading"&&l.length===0,n=[],p=()=>n.length===0?te(F):`${te(F)}-${n.length}`;if(!r)for(let y of Ue)n.push({label:y.label,focusKey:p(),danger:y.danger===!0,onSelect:()=>{y.onSelect({conversations:[...l]})}});return je&&!(l.length===0&&(c.kind==="empty"||r))&&n.push({label:t.clearHistoryLabel,focusKey:p(),danger:!0,onSelect:()=>{Me()}}),Ge&&!r&&n.push({label:t.resetIdentityLabel,focusKey:p(),danger:!0,onSelect:()=>{De()}}),n},Vt=()=>{if(Re(Le,w()),Re($,w()),V){let r=Ot(),n=c.kind==="loading"&&l.length===0;V.hidden=r.length===0&&!n,Re(V,w()||r.length===0),V.setAttribute("aria-expanded",x===F?"true":"false");let p=K.querySelector(".persona-history-menu");if(x!==F||r.length===0)p?.remove();else{let y=ze({label:t.listOptionsLabel,items:r,onCloseMenu:d=>k(d)});p?p.replaceWith(y):K.appendChild(y)}}K.hidden=S!=="rail"&&(!V||V.hidden)&&(!e.showScopeStatus||q.hidden)},tt,zt=()=>{let r=e.onActiveConversationChange;if(!r)return;let n=l.find(y=>y.id===C)??null,p=n?`${n.id}\0${n.title}\0${n.starred?1:0}`:"";p!==tt&&(tt=p,r(n))},g=()=>{if(!m){if(zt(),!j){e.onModelChange?.();return}Rt(),At(),Vt(),It(),Ee()}},k=r=>{if(!x)return;let n=x;x=null,M=!1,g(),r?.restoreFocus&&v.querySelector(`[data-persona-history-focus="menu:${n}"]`)?.focus()},rt=r=>{if(x===r){k({restoreFocus:!0});return}x=r,M=!0,g()},ot=r=>{if(!x)return;let n=r.target;n instanceof Node&&v.contains(n)&&n.closest?.(`[data-persona-history-item="${x}"]`)||k()};document.addEventListener("pointerdown",ot,!0);let nt=r=>{r.key!=="Escape"||!x||(r.stopPropagation(),k({restoreFocus:!0}))};v.addEventListener("keydown",nt);async function N(r){if(m)return;let n=++Y,p=r==="load-more"?u:null;if(!(r==="load-more"&&!p)){h={kind:r==="load-more"?"load-more":"refresh"},c={kind:"loading",phase:r},r!=="load-more"&&(I.clear(),A=null),k(),g();try{let y=await e.provider.list({limit:i,context:e.context,...p?{cursor:p}:{},...e.targetId?{targetId:e.targetId}:{}});if(m||n!==Y)return;l=p?[...l,...y.items]:y.items,u=y.nextCursor,c=l.length===0?{kind:"empty"}:{kind:"ready"}}catch(y){if(m||n!==Y)return;c=mt(y)}finally{!m&&n===Y&&(h=null,g())}}}let Ne=r=>{l=l.filter(n=>n.id!==r),I.delete(r),C===r&&(C=null),l.length===0&&!u&&(c={kind:"empty"})};async function de(r){if(!(w()||m)){I.delete(r),k(),h={kind:"open",conversationId:r},g();try{if(await e.onSelect(r),m)return;C=r}catch{if(m)return;I.set(r,{message:t.openFailedLabel,retry:()=>{de(r)}})}finally{m||(h=null,g())}}}async function ce(r){if(w()||m)return"cancelled";I.delete(r),h={kind:"delete",conversationId:r},g();try{let n=await e.onRequestDeleteConversation(r);return m||n==="deleted"&&(Ne(r),ne(t.conversationRemovedNotice)),n}catch(n){return m||(ge(n)&&n.code==="not_found"?Ne(r):I.set(r,{message:t.deleteFailedLabel,retry:()=>{ce(r)}})),"cancelled"}finally{m||(h=null,g())}}async function ee(){if(!(w()||m)){A=null,k(),h={kind:"start-new"},g();try{if(await e.onStartNew(),m)return;c.kind==="new_conversation_required"&&(c=l.length===0?{kind:"empty"}:{kind:"ready"})}catch{if(m)return;A={message:t.errorDescription,retry:()=>{ee()}}}finally{m||(h=null,g())}}}async function Me(){if(w()||m)return"cancelled";A=null,k(),h={kind:"clear"},g();try{let r=await e.onRequestClearHistory();return m||r==="cleared"&&(l=[],u=null,C=null,c={kind:"empty"},ne(t.historyClearedNotice)),r}catch{return m||(A={message:t.errorDescription,retry:()=>{Me()}}),"cancelled"}finally{m||(h=null,g())}}let Pe={outcome:"cancelled"};async function De(){if(w()||m||!e.onRequestResetIdentity)return Pe;A=null,k(),h={kind:"reset"},g();try{let r=await e.onRequestResetIdentity();return m||r.outcome==="reset"&&(ne(r.remoteRevocationConfirmed?t.identityResetNotice:t.identityResetUnconfirmedNotice),h=null,await N("refresh")),r}catch{return m||(A={message:t.errorDescription,retry:()=>{De()}}),Pe}finally{!m&&h?.kind==="reset"&&(h=null,g())}}let Ft=e.provider.subscribeIdentityStatus(r=>{if(m)return;let n=be(r),p=n!==oe;b=r,oe=n,g(),p&&r.state!=="verifying"&&ne(ft(r,t).title)}),qt=e.provider.subscribeAvailability?.(r=>{if(!m){if(r){N("refresh");return}l=[],u=null,c={kind:"error",reason:"unavailable",retryable:!1},g()}});return g(),N("initial"),{element:v,copy:t,getModel:()=>({conversations:l,activeConversationId:C,state:c,pendingAction:h,identityStatus:b,nextCursor:u}),operations:{refresh:async()=>{w()||await N("refresh")},loadMore:async()=>{w()||await N("load-more")},openConversation:r=>de(r),startNewConversation:()=>ee(),requestDeleteConversation:r=>ce(r),requestClearConversationHistory:()=>Me(),requestResetHistoryIdentity:()=>De()},setDomRenderEnabled:r=>{r!==j&&(j=r,r&&g())},refresh:()=>{N("refresh")},setPresentation:r=>{if(r===S)return;z(),S=r,Ae=null;let n=r==="rail";v.classList.toggle("persona-history-view--panel",!n),v.classList.toggle("persona-history-view--rail",n),v.setAttribute("data-persona-history-presentation",r),xe(),Te(),Se(),Ce(),Ze(),g()},setCollapsed:r=>{r!==R&&(R=r,Te(),xe(),Ce(),Ee())},setRailSide:r=>{qe=r==="right",Se()},getHeaderElement:()=>P,setHeaderPlacement:r=>{if(r===U)return;U=r;let n=r==="external";if(L.classList.toggle("persona-history-topbar--shell",n),n){Tt(),P.remove();return}Q(),v.insertBefore(P,B)},setActiveConversationId:r=>{C!==r&&(C=r,g())},applyConversationSummary:r=>{let n=l.findIndex(p=>p.id===r.id);n!==-1&&(l[n]=r,g())},removeConversationSummary:r=>{l.some(n=>n.id===r)&&(Ne(r),g())},setNewConversationRequired:r=>{r?c={kind:"new_conversation_required"}:c.kind==="new_conversation_required"&&(c=l.length===0?{kind:"empty"}:{kind:"ready"}),g()},playExit:Et,destroy:()=>{m=!0,Y+=1,z(),Q(),Ht.forEach(r=>r?.destroy()),P.remove(),le.forEach(r=>r.cancel()),le=[],Ft(),qt?.(),document.removeEventListener("pointerdown",ot,!0),v.removeEventListener("keydown",nt),we.destroy(),v.remove(),v.replaceChildren()}}}export{he as HISTORY_VIEW_COPY_DEFAULTS,bt as createHistoryView,me as resolveHistoryViewCopy};