isaikr 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +35 -0
  2. package/cdn/api.js +19 -0
  3. package/cdn/character.js +254 -0
  4. package/cdn/chat.js +33 -0
  5. package/cdn/code-editor.js +1131 -0
  6. package/cdn/community-compose.js +270 -0
  7. package/cdn/games/2048/index.html +12 -0
  8. package/cdn/games/breakout/index.html +13 -0
  9. package/cdn/games/clicker/index.html +26 -0
  10. package/cdn/games/flappy/index.html +11 -0
  11. package/cdn/games/memory/index.html +34 -0
  12. package/cdn/games/pong/index.html +13 -0
  13. package/cdn/games/reaction/index.html +38 -0
  14. package/cdn/games/runner/index.html +11 -0
  15. package/cdn/games/snake/index.html +11 -0
  16. package/cdn/games/tetris/index.html +14 -0
  17. package/cdn/games/whack/index.html +8 -0
  18. package/cdn/go.js +126 -0
  19. package/cdn/go2.js +127 -0
  20. package/cdn/header3_behavior.js +1167 -0
  21. package/cdn/header3_layout.js +1004 -0
  22. package/cdn/header3_layout.js.bak +1004 -0
  23. package/cdn/header3_style.css +3524 -0
  24. package/cdn/header3_style.css.bak +3514 -0
  25. package/cdn/lang.js +198 -0
  26. package/cdn/loading.js +143 -0
  27. package/cdn/loading2.js +144 -0
  28. package/cdn/local-model.js +2941 -0
  29. package/cdn/main.js +4 -0
  30. package/cdn/main_asset.js +1849 -0
  31. package/cdn/main_asset.js.bak +6999 -0
  32. package/cdn/main_index.css +287 -0
  33. package/cdn/re_board3.css +733 -0
  34. package/cdn/re_board3.js +734 -0
  35. package/cdn/re_chat_tts.js +652 -0
  36. package/cdn/re_local_runtime.js +2246 -0
  37. package/cdn/re_local_runtime.js.bak +2246 -0
  38. package/cdn/re_share.js +577 -0
  39. package/cdn/re_voice.js +542 -0
  40. package/cdn/utils.js +36 -0
  41. package/cdn/view.js +321 -0
  42. package/header3_behavior.js +804 -0
  43. package/header3_layout.js +998 -0
  44. package/header3_style.css +2740 -0
  45. package/index.js +0 -0
  46. package/lang.js +179 -0
  47. package/main_asset.js +2416 -0
  48. package/main_index.css +274 -0
  49. package/package.json +14 -0
  50. package/re_chat_tts.js +1419 -0
  51. package/re_voice.js +430 -0
@@ -0,0 +1,998 @@
1
+ function __cleanAdHashAndScrollTop() {
2
+ const h = String(window.location.hash || '');
3
+ const isAdHash = /^#_/i.test(h) || /eniple|mobon|ad/i.test(h);
4
+ if (!isAdHash) return;
5
+ if (history && history.replaceState) {
6
+ history.replaceState(null, document.title, window.location.pathname + window.location.search);
7
+ }
8
+ window.scrollTo(0, 0);
9
+ }
10
+ __cleanAdHashAndScrollTop();
11
+ if ('scrollRestoration' in history) {
12
+ history.scrollRestoration = 'manual';
13
+ }
14
+ window.addEventListener('hashchange', __cleanAdHashAndScrollTop);
15
+ function __dockToolbarIfNeeded(toolbarArea, ultraNarrow) {
16
+ if (!toolbarArea) return;
17
+ // Keep toolbar in normal layout flow on mobile as requested.
18
+ toolbarArea.style.setProperty('position', 'relative', 'important');
19
+ toolbarArea.style.setProperty('right', 'auto', 'important');
20
+ toolbarArea.style.setProperty('top', 'auto', 'important');
21
+ toolbarArea.style.setProperty('left', 'auto', 'important');
22
+ toolbarArea.style.setProperty('bottom', 'auto', 'important');
23
+ }
24
+ function __syncAdFrameChildren(adFrame, desktopMode) {
25
+ if (!adFrame) return;
26
+ const nodes = adFrame.querySelectorAll('iframe, object, embed, img');
27
+ nodes.forEach(function (node) {
28
+ if (desktopMode) {
29
+ node.style.width = '';
30
+ node.style.height = '';
31
+ node.style.maxWidth = '';
32
+ node.style.maxHeight = '';
33
+ } else {
34
+ node.style.width = '100%';
35
+ node.style.height = '100%';
36
+ node.style.maxWidth = '100%';
37
+ node.style.maxHeight = '100%';
38
+ }
39
+ node.style.display = 'block';
40
+ node.style.margin = '0 auto';
41
+ });
42
+ }
43
+ function __measureAdContent(adFrame) {
44
+ if (!adFrame) return { width: 300, height: 250 };
45
+ let width = 300;
46
+ let height = 250;
47
+ const nodes = adFrame.querySelectorAll('iframe, object, embed, img, a, div');
48
+ nodes.forEach(function (node) {
49
+ const rect = typeof node.getBoundingClientRect === 'function' ? node.getBoundingClientRect() : null;
50
+ const w = Math.round(
51
+ Math.max(
52
+ rect ? rect.width : 0,
53
+ node.offsetWidth || 0,
54
+ node.clientWidth || 0,
55
+ node.scrollWidth || 0,
56
+ node.naturalWidth || 0
57
+ )
58
+ );
59
+ const h = Math.round(
60
+ Math.max(
61
+ rect ? rect.height : 0,
62
+ node.offsetHeight || 0,
63
+ node.clientHeight || 0,
64
+ node.scrollHeight || 0,
65
+ node.naturalHeight || 0
66
+ )
67
+ );
68
+ if (w > width) width = w;
69
+ if (h > height) height = h;
70
+ });
71
+ return {
72
+ width: Math.max(300, Math.min(336, width)),
73
+ height: Math.max(250, Math.min(280, height))
74
+ };
75
+ }
76
+ function __clearInlineStyleProps(el, props) {
77
+ if (!el || !el.style || !Array.isArray(props)) return;
78
+ props.forEach(function (prop) {
79
+ el.style.removeProperty(prop);
80
+ });
81
+ }
82
+ function __resetChatFullscreenLayoutStyles() {
83
+ const island = document.querySelector('.island-box');
84
+ const mainLayout = document.getElementById('main-layout');
85
+ const chatStack = document.getElementById('chat-main-stack');
86
+ const chatInputField = document.getElementById('chat-input-field');
87
+ const promptInput = document.getElementById('prompt-input');
88
+ const toolbarArea = document.getElementById('toolbar-area');
89
+ const controls = document.getElementById('toolbar-main-controls');
90
+ const iconWrap = document.getElementById('icon-scroll-wrapper');
91
+ const iconContainer = document.getElementById('icon-scroll-container');
92
+ const chatInputActions = document.getElementById('chat-input-actions');
93
+ const adWrap = document.getElementById('chat-side-ad');
94
+ const adBody = document.getElementById('chat-side-ad-body');
95
+ const adFrame = document.getElementById('chat-ad-frame');
96
+ const boardRail = document.getElementById('board-right-rail');
97
+ const rightPanel = document.getElementById('right-panel');
98
+
99
+ __clearInlineStyleProps(mainLayout, [
100
+ 'padding-left',
101
+ 'margin-left',
102
+ 'width',
103
+ 'max-width',
104
+ 'height',
105
+ 'min-height',
106
+ 'flex',
107
+ 'display'
108
+ ]);
109
+ __clearInlineStyleProps(island, [
110
+ 'position',
111
+ 'width',
112
+ 'height',
113
+ 'min-height',
114
+ 'max-height',
115
+ 'margin',
116
+ 'padding',
117
+ 'border-radius',
118
+ 'display',
119
+ 'grid-template-columns',
120
+ 'grid-template-rows',
121
+ 'align-items',
122
+ 'justify-items'
123
+ ]);
124
+ __clearInlineStyleProps(chatStack, [
125
+ 'display',
126
+ 'visibility',
127
+ 'opacity',
128
+ 'grid-column',
129
+ 'grid-row',
130
+ 'flex',
131
+ 'width',
132
+ 'max-width',
133
+ 'min-width',
134
+ 'min-height',
135
+ 'height',
136
+ 'max-height',
137
+ 'padding-right',
138
+ 'box-sizing'
139
+ ]);
140
+ __clearInlineStyleProps(chatInputField, [
141
+ 'width',
142
+ 'max-width',
143
+ 'padding',
144
+ 'padding-right',
145
+ 'box-sizing'
146
+ ]);
147
+ __clearInlineStyleProps(promptInput, [
148
+ 'width',
149
+ 'max-width',
150
+ 'padding',
151
+ 'padding-right',
152
+ 'padding-bottom',
153
+ 'padding-left'
154
+ ]);
155
+ __clearInlineStyleProps(toolbarArea, [
156
+ 'grid-column',
157
+ 'grid-row',
158
+ 'display',
159
+ 'flex',
160
+ 'width',
161
+ 'min-width',
162
+ 'max-width',
163
+ 'height',
164
+ 'min-height',
165
+ 'max-height',
166
+ 'position',
167
+ 'right',
168
+ 'top',
169
+ 'left',
170
+ 'bottom',
171
+ 'z-index',
172
+ 'visibility',
173
+ 'opacity',
174
+ 'pointer-events',
175
+ 'transform'
176
+ ]);
177
+ __clearInlineStyleProps(chatInputActions, [
178
+ 'position',
179
+ 'width',
180
+ 'top',
181
+ 'left',
182
+ 'right',
183
+ 'bottom',
184
+ 'justify-content',
185
+ 'z-index'
186
+ ]);
187
+ __clearInlineStyleProps(controls, [
188
+ 'display',
189
+ 'flex-direction',
190
+ 'align-items',
191
+ 'justify-content',
192
+ 'height',
193
+ 'min-height'
194
+ ]);
195
+ __clearInlineStyleProps(iconWrap, [
196
+ 'display',
197
+ 'width',
198
+ 'flex',
199
+ 'height',
200
+ 'min-height',
201
+ 'overflow',
202
+ 'overflow-y',
203
+ 'overflow-x',
204
+ 'justify-content',
205
+ 'align-items',
206
+ 'mask-image',
207
+ '-webkit-mask-image'
208
+ ]);
209
+ __clearInlineStyleProps(iconContainer, [
210
+ 'display',
211
+ 'flex-direction',
212
+ 'align-items',
213
+ 'justify-content',
214
+ 'width',
215
+ 'height',
216
+ 'min-height',
217
+ 'overflow-y',
218
+ 'overflow-x',
219
+ 'gap',
220
+ 'padding',
221
+ 'margin'
222
+ ]);
223
+ __clearInlineStyleProps(adWrap, [
224
+ 'display',
225
+ 'grid-column',
226
+ 'grid-row',
227
+ 'width',
228
+ 'min-width',
229
+ 'max-width',
230
+ 'flex',
231
+ 'height',
232
+ 'min-height',
233
+ 'max-height',
234
+ 'background'
235
+ ]);
236
+ __clearInlineStyleProps(adBody, [
237
+ 'display',
238
+ 'align-items',
239
+ 'justify-content',
240
+ 'padding',
241
+ 'overflow',
242
+ 'background',
243
+ 'width',
244
+ 'height',
245
+ 'min-height',
246
+ 'max-height'
247
+ ]);
248
+ __clearInlineStyleProps(adFrame, [
249
+ 'display',
250
+ 'width',
251
+ 'height',
252
+ 'min-width',
253
+ 'max-width',
254
+ 'margin',
255
+ 'overflow',
256
+ 'aspect-ratio',
257
+ 'transform',
258
+ 'transform-origin',
259
+ 'box-sizing',
260
+ 'padding'
261
+ ]);
262
+ __clearInlineStyleProps(boardRail, [
263
+ 'display',
264
+ 'grid-column',
265
+ 'grid-row',
266
+ 'width',
267
+ 'min-width',
268
+ 'max-width',
269
+ 'height',
270
+ 'min-height',
271
+ 'max-height'
272
+ ]);
273
+ __clearInlineStyleProps(rightPanel, [
274
+ 'display',
275
+ 'visibility',
276
+ 'grid-column',
277
+ 'grid-row',
278
+ 'width',
279
+ 'min-width',
280
+ 'max-width',
281
+ 'height',
282
+ 'min-height',
283
+ 'max-height',
284
+ 'opacity',
285
+ 'overflow',
286
+ 'position',
287
+ 'top',
288
+ 'left',
289
+ 'right',
290
+ 'bottom',
291
+ 'z-index',
292
+ 'border-top'
293
+ ]);
294
+ }
295
+ function __applyMobileChatRailSafety() {
296
+ const mainLayout = document.getElementById('main-layout');
297
+ const leftPanel = document.getElementById('left-panel');
298
+ const island = document.querySelector('.island-box');
299
+ const chatStack = document.getElementById('chat-main-stack');
300
+ const topZone = document.getElementById('top-zone');
301
+ const chatBox = document.getElementById('chat-box');
302
+ const chatInputShell = document.getElementById('chat-input-shell');
303
+ const chatInputField = document.getElementById('chat-input-field');
304
+ const promptInput = document.getElementById('prompt-input');
305
+ const toolbarArea = document.getElementById('toolbar-area');
306
+ const controls = document.getElementById('toolbar-main-controls');
307
+ const iconWrap = document.getElementById('icon-scroll-wrapper');
308
+ const iconContainer = document.getElementById('icon-scroll-container');
309
+ const chatInputActions = document.getElementById('chat-input-actions');
310
+ const adWrap = document.getElementById('chat-side-ad');
311
+ const adBody = document.getElementById('chat-side-ad-body');
312
+ const adFrame = document.getElementById('chat-ad-frame');
313
+ const boardRail = document.getElementById('board-right-rail');
314
+ const rightPanel = document.getElementById('right-panel');
315
+ const rightPanelOriginAnchor = document.getElementById('right-panel-origin-anchor');
316
+ const desktopCodePanelHost = document.getElementById('desktop-code-panel-host');
317
+ const fullscreenElement = document.fullscreenElement || document.webkitFullscreenElement || null;
318
+ const vw = window.innerWidth || document.documentElement.clientWidth || 0;
319
+ const mobileLike = vw <= 900;
320
+ const ultraNarrow = vw < 500;
321
+ const toolbarWidth = mobileLike ? 58 : 74;
322
+ const fullscreenActive = !!(fullscreenElement && fullscreenElement.classList && fullscreenElement.classList.contains('island-box'));
323
+ const bodyMode = document.body ? String(document.body.getAttribute('data-ui-mode') || '').trim() : '';
324
+ const runtimeMode = bodyMode || (typeof window !== 'undefined' ? String(window.currentMode || window.selectedMode || '').trim() : '');
325
+ const menuModeActive = !!(chatStack && chatStack.classList.contains('menu-mode'));
326
+ const settingsModeActive = runtimeMode === 'settings' || !!(chatStack && chatStack.classList.contains('settings-mode')) || !!(topZone && topZone.classList.contains('settings-mode'));
327
+ const immersiveTopMode = menuModeActive || settingsModeActive;
328
+ const codeModeActive = bodyMode === 'code' || !!(document.body && document.body.classList.contains('mode-code')) || !!(rightPanel && rightPanel.classList.contains('mobile-active'));
329
+ const desktopCodeMode = codeModeActive && !mobileLike;
330
+ const effectiveMobileLike = mobileLike;
331
+ const codePanelVisible = !!(rightPanel && (codeModeActive || rightPanel.classList.contains('mobile-active')));
332
+ const codePanelGridColumn = vw <= 1180 ? '1 / span 2' : '1 / span 4';
333
+ const codePanelGridRow = vw <= 900 ? '2' : (vw <= 1180 ? '3' : '2');
334
+ const codePanelMinHeight = vw <= 900 ? '240px' : '320px';
335
+ const codePanelMaxHeight = vw <= 900 ? '360px' : '520px';
336
+ const desktopFlowBypassModes = ['search', 'image', 'video', 'blog', 'music', 'translate', 'community', 'app'];
337
+
338
+ if (rightPanel) {
339
+ rightPanel.classList.toggle('mobile-active', codeModeActive && mobileLike);
340
+ }
341
+ if (document.body) {
342
+ document.body.classList.toggle('mode-code', codeModeActive && mobileLike);
343
+ document.body.classList.remove('desktop-code-stage');
344
+ document.body.classList.toggle('desktop-code-open', desktopCodeMode);
345
+ document.body.classList.toggle('desktop-code-panel-mounted', desktopCodeMode && !fullscreenActive);
346
+ }
347
+ if (rightPanel && rightPanelOriginAnchor && desktopCodePanelHost) {
348
+ if (desktopCodeMode && !fullscreenActive) {
349
+ desktopCodePanelHost.style.display = 'block';
350
+ desktopCodePanelHost.style.width = '100%';
351
+ desktopCodePanelHost.style.minWidth = '0';
352
+ desktopCodePanelHost.style.minHeight = codePanelMinHeight;
353
+ desktopCodePanelHost.style.visibility = 'visible';
354
+ desktopCodePanelHost.style.opacity = '1';
355
+ if (rightPanel.parentElement !== desktopCodePanelHost) {
356
+ desktopCodePanelHost.appendChild(rightPanel);
357
+ }
358
+ } else {
359
+ desktopCodePanelHost.style.display = 'none';
360
+ desktopCodePanelHost.style.removeProperty('min-height');
361
+ desktopCodePanelHost.style.removeProperty('visibility');
362
+ desktopCodePanelHost.style.removeProperty('opacity');
363
+ desktopCodePanelHost.style.removeProperty('overflow');
364
+ if (rightPanel.parentElement !== rightPanelOriginAnchor.parentElement) {
365
+ rightPanelOriginAnchor.parentElement.insertBefore(rightPanel, rightPanelOriginAnchor.nextSibling);
366
+ }
367
+ }
368
+ }
369
+
370
+ if (chatInputField) {
371
+ chatInputField.style.setProperty('width', '100%', 'important');
372
+ chatInputField.style.setProperty('max-width', '100%', 'important');
373
+ chatInputField.style.setProperty('padding', '0', 'important');
374
+ chatInputField.style.setProperty('padding-right', '0', 'important');
375
+ chatInputField.style.setProperty('box-sizing', 'border-box', 'important');
376
+ }
377
+ if (promptInput) {
378
+ promptInput.style.setProperty('width', '100%', 'important');
379
+ promptInput.style.setProperty('max-width', '100%', 'important');
380
+ promptInput.style.setProperty('padding', '6px 0 0 56px', 'important');
381
+ promptInput.style.setProperty('padding-right', '0', 'important');
382
+ }
383
+ if (topZone) {
384
+ if (settingsModeActive) {
385
+ topZone.style.setProperty('display', 'flex', 'important');
386
+ topZone.style.setProperty('flex', '1 1 auto', 'important');
387
+ topZone.style.setProperty('height', '100%', 'important');
388
+ topZone.style.setProperty('min-height', '0', 'important');
389
+ topZone.style.setProperty('max-height', '100%', 'important');
390
+ topZone.style.setProperty('overflow', 'hidden', 'important');
391
+ topZone.style.setProperty('visibility', 'visible', 'important');
392
+ topZone.style.setProperty('opacity', '1', 'important');
393
+ } else if (menuModeActive) {
394
+ topZone.style.setProperty('display', 'none', 'important');
395
+ topZone.style.setProperty('flex', '0 0 auto', 'important');
396
+ topZone.style.setProperty('height', '0', 'important');
397
+ topZone.style.setProperty('min-height', '0', 'important');
398
+ topZone.style.setProperty('max-height', '0', 'important');
399
+ topZone.style.setProperty('padding', '0', 'important');
400
+ topZone.style.setProperty('margin', '0', 'important');
401
+ topZone.style.setProperty('overflow', 'hidden', 'important');
402
+ topZone.style.setProperty('visibility', 'hidden', 'important');
403
+ topZone.style.setProperty('opacity', '0', 'important');
404
+ } else {
405
+ __clearInlineStyleProps(topZone, ['display', 'flex', 'height', 'min-height', 'max-height', 'padding', 'margin', 'overflow', 'visibility', 'opacity']);
406
+ }
407
+ }
408
+
409
+ if (fullscreenActive) {
410
+ if (mainLayout) {
411
+ mainLayout.style.paddingLeft = '0';
412
+ mainLayout.style.marginLeft = '0';
413
+ mainLayout.style.width = '100%';
414
+ mainLayout.style.maxWidth = '100%';
415
+ mainLayout.style.height = '100%';
416
+ mainLayout.style.minHeight = '100%';
417
+ }
418
+ if (island) {
419
+ island.style.position = 'relative';
420
+ island.style.width = '100vw';
421
+ island.style.height = `${window.innerHeight}px`;
422
+ island.style.minHeight = `${window.innerHeight}px`;
423
+ island.style.maxHeight = `${window.innerHeight}px`;
424
+ island.style.margin = '0';
425
+ island.style.padding = '0';
426
+ island.style.borderRadius = '0';
427
+ island.style.display = 'grid';
428
+ island.style.gridTemplateColumns = `minmax(0, 1fr) ${toolbarWidth}px`;
429
+ island.style.gridTemplateRows = codeModeActive ? 'minmax(0, 1fr) minmax(260px, 42vh)' : 'minmax(0, 1fr)';
430
+ island.style.alignItems = 'stretch';
431
+ island.style.justifyItems = 'stretch';
432
+ }
433
+ if (chatStack) {
434
+ chatStack.style.gridColumn = '1';
435
+ chatStack.style.gridRow = '1';
436
+ chatStack.style.flex = '1 1 auto';
437
+ chatStack.style.width = '100%';
438
+ chatStack.style.maxWidth = '100%';
439
+ chatStack.style.minWidth = '0';
440
+ chatStack.style.minHeight = '0';
441
+ chatStack.style.height = '100%';
442
+ chatStack.style.maxHeight = '100%';
443
+ chatStack.style.paddingRight = '0';
444
+ chatStack.style.boxSizing = 'border-box';
445
+ }
446
+ if (toolbarArea) {
447
+ toolbarArea.style.gridColumn = '2';
448
+ toolbarArea.style.gridRow = codeModeActive ? '1 / span 2' : '1';
449
+ toolbarArea.style.display = 'flex';
450
+ toolbarArea.style.flexDirection = 'column';
451
+ toolbarArea.style.flex = `0 0 ${toolbarWidth}px`;
452
+ toolbarArea.style.width = `${toolbarWidth}px`;
453
+ toolbarArea.style.minWidth = `${toolbarWidth}px`;
454
+ toolbarArea.style.maxWidth = `${toolbarWidth}px`;
455
+ toolbarArea.style.height = '100%';
456
+ toolbarArea.style.minHeight = '100%';
457
+ toolbarArea.style.maxHeight = '100%';
458
+ toolbarArea.style.setProperty('position', 'relative', 'important');
459
+ toolbarArea.style.setProperty('right', 'auto', 'important');
460
+ toolbarArea.style.setProperty('top', 'auto', 'important');
461
+ toolbarArea.style.setProperty('left', 'auto', 'important');
462
+ toolbarArea.style.setProperty('bottom', 'auto', 'important');
463
+ toolbarArea.style.zIndex = '260';
464
+ toolbarArea.style.visibility = 'visible';
465
+ toolbarArea.style.opacity = '1';
466
+ toolbarArea.style.pointerEvents = 'auto';
467
+ toolbarArea.style.transform = 'none';
468
+ toolbarArea.style.overflowY = 'auto';
469
+ toolbarArea.style.overflowX = 'visible';
470
+ toolbarArea.style.scrollbarGutter = 'stable both-edges';
471
+ }
472
+ if (chatInputActions) {
473
+ chatInputActions.style.setProperty('position', 'absolute', 'important');
474
+ chatInputActions.style.setProperty('width', 'auto', 'important');
475
+ chatInputActions.style.setProperty('top', 'auto', 'important');
476
+ chatInputActions.style.setProperty('left', 'auto', 'important');
477
+ chatInputActions.style.setProperty('right', '16px', 'important');
478
+ chatInputActions.style.setProperty('bottom', '12px', 'important');
479
+ chatInputActions.style.setProperty('justify-content', 'flex-end', 'important');
480
+ chatInputActions.style.zIndex = '280';
481
+ }
482
+ if (controls) {
483
+ controls.style.display = 'flex';
484
+ controls.style.flexDirection = 'column';
485
+ controls.style.alignItems = 'center';
486
+ controls.style.justifyContent = 'flex-start';
487
+ controls.style.width = '100%';
488
+ controls.style.flex = '0 0 auto';
489
+ controls.style.height = 'auto';
490
+ controls.style.minHeight = 'auto';
491
+ }
492
+ if (iconWrap) {
493
+ iconWrap.style.display = 'flex';
494
+ iconWrap.style.width = '100%';
495
+ iconWrap.style.flex = '0 0 auto';
496
+ iconWrap.style.height = 'auto';
497
+ iconWrap.style.minHeight = '0';
498
+ iconWrap.style.overflowY = 'visible';
499
+ iconWrap.style.overflowX = 'visible';
500
+ iconWrap.style.justifyContent = 'flex-start';
501
+ iconWrap.style.alignItems = 'flex-start';
502
+ iconWrap.style.maskImage = 'none';
503
+ iconWrap.style.webkitMaskImage = 'none';
504
+ }
505
+ if (iconContainer) {
506
+ iconContainer.style.display = 'flex';
507
+ iconContainer.style.flexDirection = 'column';
508
+ iconContainer.style.alignItems = 'center';
509
+ iconContainer.style.justifyContent = 'flex-start';
510
+ iconContainer.style.width = '100%';
511
+ iconContainer.style.height = 'auto';
512
+ iconContainer.style.minHeight = '0';
513
+ iconContainer.style.overflowY = 'visible';
514
+ iconContainer.style.overflowX = 'visible';
515
+ iconContainer.style.gap = '10px';
516
+ iconContainer.style.padding = '6px 2px 14px';
517
+ iconContainer.style.margin = '0 auto';
518
+ }
519
+ if (adWrap) adWrap.style.display = 'none';
520
+ if (adBody) adBody.style.display = 'none';
521
+ if (adFrame) adFrame.style.display = 'none';
522
+ if (boardRail) boardRail.style.display = 'none';
523
+ if (rightPanel) {
524
+ if (codeModeActive) {
525
+ rightPanel.classList.remove('hidden');
526
+ rightPanel.style.setProperty('grid-column', '1', 'important');
527
+ rightPanel.style.setProperty('grid-row', '2', 'important');
528
+ rightPanel.style.setProperty('width', '100%', 'important');
529
+ rightPanel.style.setProperty('min-width', '0', 'important');
530
+ rightPanel.style.setProperty('max-width', '100%', 'important');
531
+ rightPanel.style.setProperty('height', 'auto', 'important');
532
+ rightPanel.style.setProperty('min-height', '260px', 'important');
533
+ rightPanel.style.setProperty('max-height', '42vh', 'important');
534
+ rightPanel.style.setProperty('position', 'relative', 'important');
535
+ rightPanel.style.setProperty('top', 'auto', 'important');
536
+ rightPanel.style.setProperty('left', 'auto', 'important');
537
+ rightPanel.style.setProperty('right', 'auto', 'important');
538
+ rightPanel.style.setProperty('bottom', 'auto', 'important');
539
+ rightPanel.style.setProperty('z-index', '20', 'important');
540
+ rightPanel.style.setProperty('display', 'flex', 'important');
541
+ rightPanel.style.setProperty('visibility', 'visible', 'important');
542
+ rightPanel.style.setProperty('opacity', '1', 'important');
543
+ rightPanel.style.setProperty('overflow', 'hidden', 'important');
544
+ rightPanel.style.setProperty('border-top', '1px solid rgba(255, 255, 255, 0.06)', 'important');
545
+ } else {
546
+ rightPanel.style.setProperty('display', 'none', 'important');
547
+ rightPanel.style.setProperty('visibility', 'hidden', 'important');
548
+ rightPanel.style.setProperty('opacity', '0', 'important');
549
+ }
550
+ }
551
+ return;
552
+ }
553
+
554
+ __resetChatFullscreenLayoutStyles();
555
+
556
+ if (!mobileLike && !codeModeActive && desktopFlowBypassModes.includes(runtimeMode)) {
557
+ if (desktopCodePanelHost) {
558
+ desktopCodePanelHost.style.display = 'none';
559
+ desktopCodePanelHost.style.removeProperty('min-height');
560
+ desktopCodePanelHost.style.removeProperty('visibility');
561
+ desktopCodePanelHost.style.removeProperty('opacity');
562
+ desktopCodePanelHost.style.removeProperty('overflow');
563
+ }
564
+ if (rightPanel && !rightPanel.classList.contains('mobile-active')) {
565
+ rightPanel.classList.add('hidden');
566
+ __clearInlineStyleProps(rightPanel, ['display', 'visibility', 'opacity', 'width', 'min-width', 'max-width', 'grid-row', 'grid-column', 'height', 'min-height', 'max-height', 'overflow', 'position', 'top', 'left', 'right', 'bottom', 'z-index', 'border-top']);
567
+ }
568
+ return;
569
+ }
570
+
571
+ if (desktopCodeMode) {
572
+ if (rightPanel) {
573
+ rightPanel.classList.remove('hidden');
574
+ rightPanel.classList.remove('mobile-active');
575
+ rightPanel.style.setProperty('display', 'flex', 'important');
576
+ rightPanel.style.setProperty('visibility', 'visible', 'important');
577
+ rightPanel.style.setProperty('opacity', '1', 'important');
578
+ rightPanel.style.setProperty('width', '100%', 'important');
579
+ rightPanel.style.setProperty('min-width', '0', 'important');
580
+ rightPanel.style.setProperty('max-width', '100%', 'important');
581
+ rightPanel.style.removeProperty('grid-column');
582
+ rightPanel.style.removeProperty('grid-row');
583
+ rightPanel.style.setProperty('height', 'auto', 'important');
584
+ rightPanel.style.setProperty('min-height', codePanelMinHeight, 'important');
585
+ rightPanel.style.setProperty('max-height', codePanelMaxHeight, 'important');
586
+ rightPanel.style.setProperty('position', 'relative', 'important');
587
+ rightPanel.style.setProperty('top', 'auto', 'important');
588
+ rightPanel.style.setProperty('left', 'auto', 'important');
589
+ rightPanel.style.setProperty('right', 'auto', 'important');
590
+ rightPanel.style.setProperty('bottom', 'auto', 'important');
591
+ rightPanel.style.setProperty('overflow', 'hidden', 'important');
592
+ rightPanel.style.setProperty('border-top', '1px solid rgba(255, 255, 255, 0.06)', 'important');
593
+ }
594
+ return;
595
+ }
596
+
597
+ if (effectiveMobileLike && mainLayout) {
598
+ const h = mainLayout.getBoundingClientRect().height || 0;
599
+ const island = document.querySelector('.island-box');
600
+ if (h < 180) {
601
+ mainLayout.style.flex = '0 0 auto';
602
+ mainLayout.style.height = 'auto';
603
+ mainLayout.style.minHeight = '250px';
604
+ mainLayout.style.display = 'flex';
605
+ }
606
+ if (leftPanel) {
607
+ leftPanel.style.display = 'flex';
608
+ leftPanel.style.height = 'auto';
609
+ leftPanel.style.minHeight = '250px';
610
+ }
611
+ if (island) {
612
+ island.style.position = 'relative';
613
+ island.style.display = 'grid';
614
+ island.style.gridTemplateColumns = `minmax(0, 1fr) ${toolbarWidth}px`;
615
+ island.style.gridTemplateRows = immersiveTopMode ? 'minmax(0, 1fr) auto 250px' : '250px auto 250px';
616
+ island.style.alignItems = 'stretch';
617
+ island.style.justifyItems = 'stretch';
618
+ }
619
+ if (chatStack) {
620
+ chatStack.style.gridColumn = '1';
621
+ chatStack.style.gridRow = '1';
622
+ chatStack.style.flex = '1 1 auto';
623
+ chatStack.style.width = '100%';
624
+ chatStack.style.maxWidth = '100%';
625
+ chatStack.style.minHeight = immersiveTopMode ? '0' : '250px';
626
+ chatStack.style.height = immersiveTopMode ? '100%' : '250px';
627
+ chatStack.style.maxHeight = immersiveTopMode ? '100%' : '250px';
628
+ chatStack.style.paddingRight = '0';
629
+ chatStack.style.boxSizing = 'border-box';
630
+ }
631
+ if (toolbarArea) {
632
+ toolbarArea.style.gridColumn = '2';
633
+ toolbarArea.style.gridRow = '1';
634
+ toolbarArea.style.display = 'flex';
635
+ toolbarArea.style.flexDirection = 'column';
636
+ toolbarArea.style.flex = `0 0 ${toolbarWidth}px`;
637
+ toolbarArea.style.width = `${toolbarWidth}px`;
638
+ toolbarArea.style.minWidth = `${toolbarWidth}px`;
639
+ toolbarArea.style.maxWidth = `${toolbarWidth}px`;
640
+ toolbarArea.style.height = '250px';
641
+ toolbarArea.style.minHeight = '250px';
642
+ toolbarArea.style.maxHeight = '250px';
643
+ toolbarArea.style.setProperty('position', 'relative', 'important');
644
+ toolbarArea.style.setProperty('right', 'auto', 'important');
645
+ toolbarArea.style.setProperty('top', 'auto', 'important');
646
+ toolbarArea.style.setProperty('left', 'auto', 'important');
647
+ toolbarArea.style.setProperty('bottom', 'auto', 'important');
648
+ toolbarArea.style.zIndex = '260';
649
+ toolbarArea.style.visibility = 'visible';
650
+ toolbarArea.style.opacity = '1';
651
+ toolbarArea.style.pointerEvents = 'auto';
652
+ toolbarArea.style.transform = 'none';
653
+ toolbarArea.style.alignSelf = 'stretch';
654
+ toolbarArea.style.justifySelf = 'stretch';
655
+ toolbarArea.style.overflowY = 'auto';
656
+ toolbarArea.style.overflowX = 'hidden';
657
+ toolbarArea.style.scrollbarGutter = 'stable both-edges';
658
+ }
659
+ if (chatInputActions) {
660
+ chatInputActions.style.setProperty('position', 'absolute', 'important');
661
+ chatInputActions.style.setProperty('width', 'auto', 'important');
662
+ chatInputActions.style.setProperty('top', 'auto', 'important');
663
+ chatInputActions.style.setProperty('left', 'auto', 'important');
664
+ chatInputActions.style.setProperty('right', '14px', 'important');
665
+ chatInputActions.style.setProperty('bottom', '10px', 'important');
666
+ chatInputActions.style.setProperty('justify-content', 'flex-end', 'important');
667
+ chatInputActions.style.zIndex = ultraNarrow ? '280' : '40';
668
+ }
669
+ __dockToolbarIfNeeded(toolbarArea, ultraNarrow);
670
+ if (boardRail) {
671
+ boardRail.style.display = 'flex';
672
+ boardRail.style.gridColumn = '2';
673
+ boardRail.style.gridRow = '3';
674
+ boardRail.style.width = `${toolbarWidth}px`;
675
+ boardRail.style.minWidth = `${toolbarWidth}px`;
676
+ boardRail.style.maxWidth = `${toolbarWidth}px`;
677
+ boardRail.style.height = '250px';
678
+ boardRail.style.minHeight = '250px';
679
+ boardRail.style.maxHeight = '250px';
680
+ boardRail.style.alignSelf = 'stretch';
681
+ boardRail.style.justifySelf = 'stretch';
682
+ }
683
+ if (rightPanel) {
684
+ rightPanel.style.gridColumn = '1 / span 2';
685
+ rightPanel.style.gridRow = '2';
686
+ rightPanel.style.width = '100%';
687
+ rightPanel.style.minWidth = '0';
688
+ rightPanel.style.maxWidth = '100%';
689
+ rightPanel.style.position = 'relative';
690
+ rightPanel.style.top = 'auto';
691
+ rightPanel.style.left = 'auto';
692
+ rightPanel.style.right = 'auto';
693
+ rightPanel.style.bottom = 'auto';
694
+ rightPanel.style.zIndex = '20';
695
+ rightPanel.style.display = codePanelVisible ? 'flex' : 'none';
696
+ rightPanel.style.opacity = codePanelVisible ? '1' : '0';
697
+ rightPanel.style.minHeight = codePanelVisible ? '240px' : '0';
698
+ rightPanel.style.maxHeight = codePanelVisible ? '360px' : '0';
699
+ }
700
+ if (adWrap) {
701
+ adWrap.style.display = 'flex';
702
+ adWrap.style.gridColumn = '1';
703
+ adWrap.style.gridRow = '3';
704
+ adWrap.style.background = '#ffffff';
705
+ adWrap.style.width = 'auto';
706
+ adWrap.style.minWidth = '0';
707
+ adWrap.style.maxWidth = '100%';
708
+ adWrap.style.flex = '1 1 auto';
709
+ adWrap.style.height = '250px';
710
+ adWrap.style.minHeight = '250px';
711
+ adWrap.style.maxHeight = '250px';
712
+ adWrap.style.alignSelf = 'stretch';
713
+ adWrap.style.justifySelf = 'stretch';
714
+ adWrap.style.overflow = 'hidden';
715
+ }
716
+ if (adBody) {
717
+ adBody.style.display = 'flex';
718
+ adBody.style.alignItems = 'center';
719
+ adBody.style.justifyContent = 'center';
720
+ adBody.style.padding = '8px 6px';
721
+ adBody.style.overflow = 'hidden';
722
+ adBody.style.background = '#ffffff';
723
+ adBody.style.width = '100%';
724
+ adBody.style.height = '250px';
725
+ adBody.style.minHeight = '250px';
726
+ adBody.style.maxHeight = '250px';
727
+ }
728
+ if (adFrame) {
729
+ const availableWidth = Math.max(160, (adBody ? adBody.clientWidth : 300) - 12);
730
+ const scale = Math.min(1, availableWidth / 300);
731
+ adFrame.style.width = '300px';
732
+ adFrame.style.height = '250px';
733
+ adFrame.style.minWidth = '0';
734
+ adFrame.style.maxWidth = '300px';
735
+ adFrame.style.margin = '0 auto';
736
+ adFrame.style.overflow = 'visible';
737
+ adFrame.style.aspectRatio = '';
738
+ adFrame.style.transform = `scale(${scale})`;
739
+ adFrame.style.transformOrigin = 'top center';
740
+ adFrame.style.boxSizing = 'border-box';
741
+ adFrame.style.padding = '0';
742
+ __syncAdFrameChildren(adFrame, true);
743
+ }
744
+ if (controls) {
745
+ controls.style.display = 'flex';
746
+ controls.style.flexDirection = 'column';
747
+ controls.style.alignItems = 'center';
748
+ controls.style.justifyContent = 'flex-start';
749
+ controls.style.flex = '0 0 auto';
750
+ controls.style.height = 'auto';
751
+ controls.style.width = '100%';
752
+ controls.style.minHeight = 'auto';
753
+ }
754
+ if (iconWrap) {
755
+ iconWrap.style.display = 'flex';
756
+ iconWrap.style.width = '100%';
757
+ iconWrap.style.flex = '0 0 auto';
758
+ iconWrap.style.height = 'auto';
759
+ iconWrap.style.minHeight = '0';
760
+ iconWrap.style.overflowY = 'visible';
761
+ iconWrap.style.overflowX = 'visible';
762
+ iconWrap.style.justifyContent = 'flex-start';
763
+ iconWrap.style.alignItems = 'flex-start';
764
+ iconWrap.style.maskImage = 'none';
765
+ iconWrap.style.webkitMaskImage = 'none';
766
+ }
767
+ if (iconContainer) {
768
+ iconContainer.style.display = 'flex';
769
+ iconContainer.style.flexDirection = 'column';
770
+ iconContainer.style.alignItems = 'center';
771
+ iconContainer.style.justifyContent = 'flex-start';
772
+ iconContainer.style.width = '100%';
773
+ iconContainer.style.height = 'auto';
774
+ iconContainer.style.minHeight = '0';
775
+ iconContainer.style.overflowY = 'visible';
776
+ iconContainer.style.overflowX = 'hidden';
777
+ iconContainer.style.gap = '10px';
778
+ iconContainer.style.padding = '6px 0 14px';
779
+ iconContainer.style.margin = '0 auto';
780
+ }
781
+ if (toolbarArea) {
782
+ const rect = toolbarArea.getBoundingClientRect();
783
+ if ((rect.width || 0) < 30 || (rect.height || 0) < 120) {
784
+ toolbarArea.style.setProperty('position', 'relative', 'important');
785
+ toolbarArea.style.setProperty('right', 'auto', 'important');
786
+ toolbarArea.style.setProperty('top', 'auto', 'important');
787
+ toolbarArea.style.setProperty('left', 'auto', 'important');
788
+ toolbarArea.style.setProperty('bottom', 'auto', 'important');
789
+ toolbarArea.style.height = '250px';
790
+ toolbarArea.style.minHeight = '250px';
791
+ toolbarArea.style.maxHeight = '250px';
792
+ toolbarArea.style.zIndex = '220';
793
+ }
794
+ }
795
+ } else {
796
+ __dockToolbarIfNeeded(toolbarArea, false);
797
+ if (chatInputActions) {
798
+ chatInputActions.style.setProperty('position', 'absolute', 'important');
799
+ chatInputActions.style.setProperty('width', 'auto', 'important');
800
+ chatInputActions.style.setProperty('top', 'auto', 'important');
801
+ chatInputActions.style.setProperty('left', 'auto', 'important');
802
+ chatInputActions.style.setProperty('right', '16px', 'important');
803
+ chatInputActions.style.setProperty('bottom', '12px', 'important');
804
+ chatInputActions.style.setProperty('justify-content', 'flex-end', 'important');
805
+ chatInputActions.style.zIndex = '12';
806
+ }
807
+ if (boardRail) {
808
+ boardRail.style.display = '';
809
+ }
810
+ const shouldPreserveCodePanel = codeModeActive || bodyMode === 'code' || (rightPanel && rightPanel.classList.contains('mobile-active'));
811
+ if (rightPanel && shouldPreserveCodePanel) {
812
+ rightPanel.classList.remove('hidden');
813
+ rightPanel.style.setProperty('display', 'flex', 'important');
814
+ rightPanel.style.setProperty('visibility', 'visible', 'important');
815
+ rightPanel.style.setProperty('opacity', '1', 'important');
816
+ rightPanel.style.setProperty('width', '100%', 'important');
817
+ rightPanel.style.setProperty('min-width', '0', 'important');
818
+ rightPanel.style.setProperty('max-width', '100%', 'important');
819
+ rightPanel.style.setProperty('grid-column', codePanelGridColumn, 'important');
820
+ rightPanel.style.setProperty('grid-row', codePanelGridRow, 'important');
821
+ rightPanel.style.setProperty('height', 'auto', 'important');
822
+ rightPanel.style.setProperty('min-height', codePanelMinHeight, 'important');
823
+ rightPanel.style.setProperty('max-height', codePanelMaxHeight, 'important');
824
+ rightPanel.style.setProperty('position', 'relative', 'important');
825
+ rightPanel.style.setProperty('top', 'auto', 'important');
826
+ rightPanel.style.setProperty('left', 'auto', 'important');
827
+ rightPanel.style.setProperty('right', 'auto', 'important');
828
+ rightPanel.style.setProperty('bottom', 'auto', 'important');
829
+ rightPanel.style.setProperty('overflow', 'hidden', 'important');
830
+ rightPanel.style.setProperty('border-top', '1px solid rgba(255, 255, 255, 0.06)', 'important');
831
+ } else if (rightPanel) {
832
+ rightPanel.style.display = '';
833
+ rightPanel.style.visibility = '';
834
+ rightPanel.style.opacity = '';
835
+ rightPanel.style.width = '';
836
+ rightPanel.style.minWidth = '';
837
+ rightPanel.style.maxWidth = '';
838
+ rightPanel.style.gridColumn = '';
839
+ rightPanel.style.gridRow = '';
840
+ rightPanel.style.height = '';
841
+ rightPanel.style.minHeight = '';
842
+ rightPanel.style.maxHeight = '';
843
+ rightPanel.style.position = '';
844
+ rightPanel.style.top = '';
845
+ rightPanel.style.left = '';
846
+ rightPanel.style.right = '';
847
+ rightPanel.style.bottom = '';
848
+ rightPanel.style.overflow = '';
849
+ rightPanel.style.borderTop = '';
850
+ }
851
+ if (chatStack) {
852
+ chatStack.style.gridColumn = '';
853
+ chatStack.style.gridRow = '';
854
+ chatStack.style.paddingRight = '';
855
+ chatStack.style.maxWidth = '';
856
+ chatStack.style.width = '';
857
+ chatStack.style.height = immersiveTopMode ? '100%' : '270px';
858
+ chatStack.style.minHeight = immersiveTopMode ? '0' : '270px';
859
+ chatStack.style.maxHeight = immersiveTopMode ? '100%' : '270px';
860
+ }
861
+ if (toolbarArea) {
862
+ toolbarArea.style.gridColumn = '';
863
+ toolbarArea.style.gridRow = '';
864
+ toolbarArea.style.display = 'flex';
865
+ toolbarArea.style.flexDirection = 'column';
866
+ toolbarArea.style.position = 'relative';
867
+ toolbarArea.style.right = '';
868
+ toolbarArea.style.top = '';
869
+ toolbarArea.style.left = '';
870
+ toolbarArea.style.bottom = '';
871
+ toolbarArea.style.flex = '0 0 74px';
872
+ toolbarArea.style.width = '74px';
873
+ toolbarArea.style.minWidth = '74px';
874
+ toolbarArea.style.maxWidth = '74px';
875
+ toolbarArea.style.height = '270px';
876
+ toolbarArea.style.minHeight = '270px';
877
+ toolbarArea.style.maxHeight = '270px';
878
+ toolbarArea.style.zIndex = '20';
879
+ toolbarArea.style.visibility = 'visible';
880
+ toolbarArea.style.opacity = '1';
881
+ toolbarArea.style.pointerEvents = 'auto';
882
+ toolbarArea.style.transform = '';
883
+ toolbarArea.style.overflowY = 'auto';
884
+ toolbarArea.style.overflowX = 'hidden';
885
+ toolbarArea.style.scrollbarGutter = 'stable both-edges';
886
+ }
887
+ if (controls) {
888
+ controls.style.display = 'flex';
889
+ controls.style.flexDirection = 'column';
890
+ controls.style.alignItems = 'center';
891
+ controls.style.justifyContent = 'flex-start';
892
+ controls.style.width = '100%';
893
+ controls.style.flex = '0 0 auto';
894
+ controls.style.height = 'auto';
895
+ controls.style.minHeight = 'auto';
896
+ }
897
+ if (iconWrap) {
898
+ iconWrap.style.display = 'flex';
899
+ iconWrap.style.width = '100%';
900
+ iconWrap.style.flex = '0 0 auto';
901
+ iconWrap.style.height = 'auto';
902
+ iconWrap.style.minHeight = '0';
903
+ iconWrap.style.overflowY = 'visible';
904
+ iconWrap.style.overflowX = 'visible';
905
+ iconWrap.style.justifyContent = 'flex-start';
906
+ iconWrap.style.alignItems = 'flex-start';
907
+ iconWrap.style.maskImage = 'none';
908
+ iconWrap.style.webkitMaskImage = 'none';
909
+ }
910
+ if (iconContainer) {
911
+ iconContainer.style.display = 'flex';
912
+ iconContainer.style.flexDirection = 'column';
913
+ iconContainer.style.alignItems = 'center';
914
+ iconContainer.style.justifyContent = 'flex-start';
915
+ iconContainer.style.width = '100%';
916
+ iconContainer.style.height = 'auto';
917
+ iconContainer.style.minHeight = '0';
918
+ iconContainer.style.overflowY = 'visible';
919
+ iconContainer.style.overflowX = 'hidden';
920
+ iconContainer.style.gap = '10px';
921
+ iconContainer.style.padding = '6px 0 14px';
922
+ }
923
+ if (adWrap) {
924
+ adWrap.style.display = 'flex';
925
+ adWrap.style.gridColumn = '';
926
+ adWrap.style.gridRow = '';
927
+ adWrap.style.background = '#ffffff';
928
+ }
929
+ if (adBody) {
930
+ adBody.style.display = 'flex';
931
+ adBody.style.alignItems = 'center';
932
+ adBody.style.justifyContent = 'center';
933
+ adBody.style.padding = '9px 11px';
934
+ adBody.style.overflow = 'visible';
935
+ adBody.style.background = '#ffffff';
936
+ }
937
+ if (adFrame) {
938
+ __syncAdFrameChildren(adFrame, true);
939
+ const measured = __measureAdContent(adFrame);
940
+ const desktopWidth = measured.width;
941
+ const desktopHeight = measured.height;
942
+ if (adWrap) {
943
+ const wrapWidth = desktopWidth + 24;
944
+ const wrapHeight = desktopHeight + 20;
945
+ adWrap.style.width = `${wrapWidth}px`;
946
+ adWrap.style.minWidth = `${wrapWidth}px`;
947
+ adWrap.style.flex = `0 0 ${wrapWidth}px`;
948
+ adWrap.style.height = `${wrapHeight}px`;
949
+ adWrap.style.minHeight = `${wrapHeight}px`;
950
+ }
951
+ if (adBody) {
952
+ adBody.style.height = `${desktopHeight + 20}px`;
953
+ adBody.style.minHeight = `${desktopHeight + 20}px`;
954
+ }
955
+ adFrame.style.width = `${desktopWidth}px`;
956
+ adFrame.style.height = `${desktopHeight}px`;
957
+ adFrame.style.minWidth = '0';
958
+ adFrame.style.maxWidth = `${desktopWidth}px`;
959
+ adFrame.style.margin = '0 auto';
960
+ adFrame.style.overflow = 'visible';
961
+ adFrame.style.aspectRatio = '';
962
+ adFrame.style.transform = 'none';
963
+ adFrame.style.transformOrigin = 'center center';
964
+ adFrame.style.boxSizing = 'content-box';
965
+ adFrame.style.padding = '1px';
966
+ }
967
+ }
968
+ }
969
+ function __handleChatFullscreenChange() {
970
+ syncFullscreenIcon();
971
+ __applyMobileChatRailSafety();
972
+ [0, 80, 220].forEach(function (delay) {
973
+ setTimeout(__applyMobileChatRailSafety, delay);
974
+ });
975
+ }
976
+ window.addEventListener('load', function () {
977
+ __applyMobileChatRailSafety();
978
+ window.addEventListener('resize', __applyMobileChatRailSafety);
979
+ window.addEventListener('orientationchange', __applyMobileChatRailSafety);
980
+ window.addEventListener('scroll', __applyMobileChatRailSafety, { passive: true });
981
+ document.addEventListener('fullscreenchange', __handleChatFullscreenChange);
982
+ document.addEventListener('webkitfullscreenchange', __handleChatFullscreenChange);
983
+ const adFrame = document.getElementById('chat-ad-frame');
984
+ if (adFrame && !window.__chatAdObserver) {
985
+ const observer = new MutationObserver(function () {
986
+ __applyMobileChatRailSafety();
987
+ });
988
+ observer.observe(adFrame, { childList: true, subtree: true });
989
+ window.__chatAdObserver = observer;
990
+ }
991
+ [0, 120, 360, 800].forEach(function (delay) {
992
+ setTimeout(function () {
993
+ __cleanAdHashAndScrollTop();
994
+ __applyMobileChatRailSafety();
995
+ if (!window.location.hash) window.scrollTo(0, 0);
996
+ }, delay);
997
+ });
998
+ }, { once: true });