@hyzyn/dsh-docker 0.3.3 → 0.4.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.
package/client.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";(()=>{var tt=`/* eslint-disable */
1
+ "use strict";(()=>{var Nn=`/* eslint-disable */
2
2
  /**
3
3
  * @hyzyn/dsh-docker \u2014 \u9762\u677F\u6837\u5F0F\u8868\u3002
4
4
  *
@@ -363,7 +363,7 @@
363
363
  background: transparent;
364
364
  color: var(--dk-label-2);
365
365
  cursor: pointer;
366
- transition: background var(--dk-dur) var(--dk-ease), color var(--dk-dur) var(--dk-ease);
366
+ transition: background var(--dk-dur) var(--dk-ease), color var(--dk-dur) var(--dk-ease), opacity var(--dk-dur) var(--dk-ease);
367
367
  }
368
368
 
369
369
  .dk_iconBtn:hover { background: var(--dk-hover); color: var(--dk-label); }
@@ -389,6 +389,18 @@
389
389
  border-bottom: 1px solid var(--dk-border);
390
390
  }
391
391
 
392
+ /*
393
+ * dock \u6A21\u5F0F\u4E0B\u6CA1\u6709\u9762\u677F\u5934\u90E8\uFF0C\u5237\u65B0 / \u53EA\u8BFB\u5FBD\u6807\u6302\u5230\u5DE5\u5177\u6761\u672B\u5C3E\u5E76\u9760\u53F3\uFF1A
394
+ * margin-left:auto \u5728\u4E0D\u6362\u884C\u65F6\u628A\u5B83\u63A8\u5230\u6574\u884C\u6700\u53F3\uFF0C\u6362\u884C\u65F6\u8D34\u5230\u6700\u540E\u4E00\u884C\u7684\u53F3\u7AEF\u2014\u2014
395
+ * \u4E0E\u300C\u8FC7\u6EE4 / \u7B5B\u9009\u63A7\u4EF6\u4ECE\u5DE6\u5F80\u53F3\u6392\u300D\u533A\u5206\u5F00\uFF0C\u907F\u514D\u5237\u65B0\u88AB\u5F53\u6210\u5DE5\u5177\u6761\u7684\u7B2C\u4E00\u4E2A\u7B5B\u9009\u9879\u3002
396
+ */
397
+ .dk_toolbarEnd {
398
+ display: inline-flex;
399
+ align-items: center;
400
+ gap: var(--dk-gap-sm);
401
+ margin-left: auto;
402
+ }
403
+
392
404
  .dk_select,
393
405
  .dk_input {
394
406
  height: var(--dk-h-lg);
@@ -414,7 +426,13 @@
414
426
  box-shadow: var(--dk-ring);
415
427
  }
416
428
 
417
- .dk_search { flex: 1 1 200px; min-width: 160px; }
429
+ /*
430
+ * \u641C\u7D22\u6846\u662F\u5DE5\u5177\u6761\u91CC\u552F\u4E00\u53EF\u4F38\u7F29\u7684\u9879\uFF0C\u5B83\u7684 min-width \u51B3\u5B9A\u4E86\u300C\u653E\u4E0D\u4E0B\u65F6\u5148\u6324\u8C01\u300D\uFF1A\u7ED9\u5230 160px \u65F6
431
+ * \u7A7A\u9699\u4E0D\u591F\uFF0C\u6D4F\u89C8\u5668\u5B81\u53EF\u628A\u672B\u5C3E\u90A3\u4E2A\u5F00\u5173\u5355\u72EC\u6362\u884C\uFF0C\u4E5F\u4E0D\u80AF\u628A\u641C\u7D22\u6846\u538B\u7A84\u4E00\u70B9\u2014\u2014\u5BBD\u9762\u677F\u91CC\u56E0\u6B64\u591A\u51FA
432
+ * \u4E00\u884C\u53EA\u6709\u4E00\u4E2A\u590D\u9009\u6846\u3002120px \u8BA9\u5B83\u5148\u7626\u4E0B\u6765\u515C\u4F4F\u8FD9\u70B9\u5DEE\u8DDD\uFF08flex-grow \u4ECD\u662F 1\uFF1A\u7A7A\u95F4\u5BCC\u4F59\u65F6\u5B83\u7167\u65E7
433
+ * \u586B\u6EE1\u6574\u884C\uFF0C\u89C6\u89C9\u5BBD\u5EA6\u4E0D\u53D8\uFF09\u3002
434
+ */
435
+ .dk_search { flex: 1 1 120px; min-width: 120px; }
418
436
 
419
437
  /* \u5DE5\u5177\u6761\u91CC\u7684\u7ED3\u679C\u8BA1\u6570\uFF08\u955C\u50CF\uFF1A23 / 23 \u4E2A\u955C\u50CF\uFF09\uFF1A\u522B\u88AB\u538B\u7F29\uFF0C\u6570\u5B57\u7B49\u5BBD */
420
438
  .dk_searchCount { flex: none; font-variant-numeric: tabular-nums; }
@@ -425,9 +443,21 @@
425
443
  border: 1px solid var(--dk-border);
426
444
  border-radius: var(--dk-r-md);
427
445
  background: var(--dk-surface-2);
446
+ /*
447
+ * \u5206\u6BB5\u4ECE\u4E09\u6BB5\u957F\u5230\u4E94\u6BB5\uFF08\u5BB9\u5668/\u955C\u50CF/Compose/\u7F51\u7EDC/\u5377\uFF09\u540E\uFF0C520px \u7684 dock \u7A84\u680F\u91CC\u53EF\u80FD\u653E\u4E0D\u4E0B\uFF1A
448
+ * \u5141\u8BB8\u8FD9\u4E00\u6BB5\u81EA\u5DF1\u6A2A\u5411\u6EDA\u52A8\uFF0C\u800C\u4E0D\u662F\u6574\u4E2A\u5DE5\u5177\u6761\u6362\u884C\u6216\u505A\u4E8C\u7EA7\u83DC\u5355\uFF08\u5207\u9875\u662F\u9AD8\u9891\u52A8\u4F5C\uFF0C
449
+ * \u591A\u4E00\u6B21\u70B9\u51FB\u4E0D\u5212\u7B97\uFF09\u3002\u6EDA\u52A8\u6761\u9690\u85CF\uFF0C\u9760\u4E24\u7AEF\u7684\u88C1\u5207\u7ED9\u51FA\u300C\u8FD8\u6709\u5185\u5BB9\u300D\u7684\u6697\u793A\u3002
450
+ */
451
+ max-width: 100%;
452
+ overflow-x: auto;
453
+ scrollbar-width: none;
428
454
  }
429
455
 
456
+ .dk_seg::-webkit-scrollbar { display: none; }
457
+
430
458
  .dk_segBtn {
459
+ /* \u4E0D\u53C2\u4E0E\u538B\u7F29\uFF1A\u5426\u5219\u7A84\u680F\u91CC\u4E94\u6BB5\u4F1A\u88AB\u538B\u6210\u300C\u5BB9/\u955C/Co/\u7F51/\u5377\u300D\u8FD9\u79CD\u534A\u622A\u5B57 */
460
+ flex: none;
431
461
  height: var(--dk-h-sm);
432
462
  padding: 0 var(--dk-gap-md);
433
463
  border: none;
@@ -459,6 +489,17 @@
459
489
 
460
490
  .dk_check input { accent-color: var(--dk-accent); }
461
491
 
492
+ /*
493
+ * \u5DE5\u5177\u6761\u672B\u5C3E\u7684\u4E24\u4E2A\u5F00\u5173\uFF08\u542B\u5DF2\u505C\u6B62 / \u81EA\u52A8\u5237\u65B0\uFF09\u6210\u7EC4\uFF1A\u5B83\u4EEC\u662F\u4E00\u4E2A\u300C\u5F00\u5173\u7C07\u300D\uFF0C\u5DE5\u5177\u6761\u5728\u5BBD\u9762\u677F\u91CC
494
+ * \u6070\u597D\u5361\u5728\u653E\u5F97\u4E0B\u4E0E\u653E\u4E0D\u4E0B\u7684\u8FB9\u754C\u4E0A\u2014\u2014\u5206\u5F00\u6392\u65F6\u6700\u540E\u4E00\u4E2A\u4F1A\u88AB\u5355\u72EC\u6324\u5230\u7B2C\u4E8C\u884C\uFF08\u4E00\u884C\u53EA\u6709\u4E00\u4E2A\u590D\u9009
495
+ * \u6846\uFF09\u3002\u6210\u7EC4\u540E\u6362\u884C\u4EE5\u7EC4\u4E3A\u5355\u4F4D\uFF0C\u6700\u574F\u60C5\u51B5\u4E5F\u662F\u4E00\u6574\u7EC4\u4E00\u8D77\u4E0B\u53BB\u3002
496
+ */
497
+ .dk_toolbarToggles {
498
+ display: inline-flex;
499
+ align-items: center;
500
+ gap: var(--dk-gap-md);
501
+ }
502
+
462
503
  /* ============================ \u6309\u94AE ============================ */
463
504
 
464
505
  .dk_btn {
@@ -636,6 +677,8 @@
636
677
  font-size: 11px;
637
678
  line-height: 1;
638
679
  white-space: nowrap;
680
+ /* \u542F\u505C\u540E\u72B6\u6001\u5FBD\u6807\u4F1A\u4ECE\u300C\u8FD0\u884C\u4E2D\u300D\u7FFB\u5230\u300C\u5DF2\u505C\u6B62\u300D\uFF1A\u7ED9\u4E2A\u8FC7\u6E21\uFF0C\u522B\u786C\u5207 */
681
+ transition: background-color var(--dk-dur) var(--dk-ease), border-color var(--dk-dur) var(--dk-ease), color var(--dk-dur) var(--dk-ease);
639
682
  }
640
683
 
641
684
  .dk_badge::before {
@@ -741,6 +784,7 @@
741
784
  /* ============================ \u65E5\u5FD7\u89C6\u56FE ============================ */
742
785
 
743
786
  .dk_logs {
787
+ position: relative; /* \u300C\u56DE\u5230\u5E95\u90E8\u300D\u6D6E\u5C42\u5B9A\u4F4D\u57FA\u51C6 */
744
788
  display: flex;
745
789
  flex-direction: column;
746
790
  flex: 1 1 auto;
@@ -782,6 +826,75 @@
782
826
  font-weight: 600;
783
827
  }
784
828
 
829
+ /* \u300C\u805A\u5408\u9009\u62E9\u300D\u6FC0\u6D3B\u6001\uFF1A\u8FD9\u662F\u300C\u8FDB\u5165\u9009\u62E9\u6A21\u5F0F\u300D\u800C\u4E0D\u662F\u300C\u67D0\u4E2A\u5F00\u5173\u5DF2\u5F00\u300D\uFF0C\u7528\u5F3A\u8C03\u8272 */
830
+ .dk_pillPick[data-on="1"] {
831
+ border-color: color-mix(in srgb, var(--dk-accent) 52%, transparent);
832
+ background: color-mix(in srgb, var(--dk-accent) 18%, transparent);
833
+ color: var(--dk-accent);
834
+ font-weight: 600;
835
+ }
836
+
837
+ /* FOLLOW \u6FC0\u6D3B\u6001\u7528\u5F3A\u8C03\u8272\uFF08\u4E0E AUTO REFRESH \u7684\u6210\u529F\u7EFF\u533A\u5206\u5F00\uFF1A\u5B9E\u65F6\u6D41\u5728\u63A8 vs \u8F6E\u8BE2\u5F00\u7740\uFF09 */
838
+ .dk_pillFollow[data-on="1"] {
839
+ border-color: color-mix(in srgb, var(--dk-accent) 52%, transparent);
840
+ background: color-mix(in srgb, var(--dk-accent) 18%, transparent);
841
+ color: var(--dk-accent);
842
+ }
843
+
844
+ .dk_pill:disabled {
845
+ opacity: .45;
846
+ cursor: not-allowed;
847
+ }
848
+
849
+ .dk_pill:disabled:hover { background: var(--dk-surface-2); }
850
+
851
+ /* FOLLOW \u8FDE\u63A5\u72B6\u6001\u884C\uFF1A\u5C0F\u5706\u70B9 + \u6587\u6848\uFF08\u8FDE\u63A5\u9519\u8BEF\u53EA\u5728\u8FD9\u91CC\u8868\u8FBE\uFF0C\u4E0D\u5F39\u6A2A\u5E45\u5237\u5C4F\uFF09 */
852
+ .dk_followState {
853
+ display: flex;
854
+ align-items: center;
855
+ gap: var(--dk-gap-sm);
856
+ flex: 0 0 auto;
857
+ padding: var(--dk-gap-xs) var(--dk-gap-lg);
858
+ border-bottom: 1px solid var(--dk-border);
859
+ background: var(--dk-surface-2);
860
+ color: var(--dk-label-3);
861
+ font-size: 11px;
862
+ }
863
+
864
+ .dk_followState::before {
865
+ content: '';
866
+ width: 6px;
867
+ height: 6px;
868
+ border-radius: 50%;
869
+ background: var(--dk-label-3);
870
+ }
871
+
872
+ .dk_followState[data-state="open"]::before { background: var(--dk-success); }
873
+ .dk_followState[data-state="connecting"]::before,
874
+ .dk_followState[data-state="reconnecting"]::before { background: var(--dk-warn); }
875
+ .dk_followState[data-state="closed"]::before { background: var(--dk-danger); }
876
+
877
+ /* FOLLOW \u6682\u505C\u81EA\u52A8\u6EDA\u52A8\u65F6\u7684\u300C\u56DE\u5230\u5E95\u90E8\u300D\u6D6E\u5C42\uFF08\u4E0D\u5360\u5E03\u5C40\uFF0C\u51FA\u73B0/\u6D88\u5931\u4E0D\u6324\u52A8\u65E5\u5FD7\uFF09 */
878
+ .dk_backToBottom {
879
+ position: absolute;
880
+ right: var(--dk-gap-lg);
881
+ bottom: var(--dk-gap-lg);
882
+ z-index: 2;
883
+ height: var(--dk-h-md);
884
+ padding: 0 var(--dk-gap-md);
885
+ border: 1px solid var(--dk-border-strong);
886
+ border-radius: var(--dk-r-pill);
887
+ background: var(--dk-surface-2);
888
+ color: var(--dk-label);
889
+ font-size: 11px;
890
+ font-family: inherit;
891
+ cursor: pointer;
892
+ box-shadow: 0 2px 10px rgba(0, 0, 0, .28);
893
+ }
894
+
895
+ .dk_backToBottom:hover { background: var(--dk-hover-solid); }
896
+ .dk_backToBottom:focus-visible { outline: none; box-shadow: var(--dk-ring); }
897
+
785
898
 
786
899
  /* \u8FC7\u6EE4\u8F93\u5165\u6846\u5E38\u9A7B\uFF1B\u6E05\u7A7A\u6309\u94AE\u6D6E\u5728\u6846\u5185\u53F3\u4FA7\uFF08\u7EDD\u5BF9\u5B9A\u4F4D \u2192 \u51FA\u73B0/\u6D88\u5931\u90FD\u4E0D\u6324\u52A8\u5E03\u5C40\uFF09 */
787
900
  .dk_filterWrap {
@@ -1007,6 +1120,328 @@
1007
1120
  .dk_images td.dk_mono { font-family: var(--dk-mono); }
1008
1121
  .dk_images tbody tr:hover { background: var(--dk-hover); }
1009
1122
 
1123
+ /* ============================ \u4E34\u65F6\u591A\u9009\u805A\u5408 ============================ */
1124
+
1125
+ /*
1126
+ * \u52FE\u9009\u6846\uFF1A\u7EAF CSS \u753B\u65B9\u6846 + \u52FE\uFF08\u7528\u771F\u5B9E <input type="checkbox"> \u4F1A\u5E26\u8FDB\u6D4F\u89C8\u5668\u539F\u751F
1127
+ * \u5C3A\u5BF8/\u5BF9\u9F50\u5DEE\u5F02\uFF0C\u8FD8\u8981\u5904\u7406\u53EA\u8BFB\u6001\uFF09\u3002\u672A\u52FE\u9009\u65F6\u628A\u52FE\u7684\u5B57\u8272\u8BBE\u6210\u900F\u660E\uFF0C\u5F62\u72B6\u4ECD\u7136\u5360\u4F4D\uFF0C
1128
+ * \u6240\u4EE5\u52FE\u9009/\u53D6\u6D88\u4E0D\u4F1A\u8BA9\u5361\u7247\u5934\u90E8\u6A2A\u5411\u6296\u52A8\u3002
1129
+ */
1130
+ .dk_pick {
1131
+ flex: none;
1132
+ display: inline-flex;
1133
+ align-items: center;
1134
+ justify-content: center;
1135
+ width: 16px;
1136
+ height: 16px;
1137
+ border: 1px solid var(--dk-border-strong);
1138
+ border-radius: var(--dk-r-xs);
1139
+ background: var(--dk-input);
1140
+ color: transparent;
1141
+ font-size: 11px;
1142
+ line-height: 1;
1143
+ transition: background var(--dk-dur) var(--dk-ease), border-color var(--dk-dur) var(--dk-ease), color var(--dk-dur) var(--dk-ease);
1144
+ }
1145
+
1146
+ .dk_pick::after { content: '\u2713'; }
1147
+ .dk_pick[data-on="1"] { background: var(--dk-accent); border-color: var(--dk-accent); color: #fff; }
1148
+
1149
+ /* \u9009\u62E9\u6001\uFF1A\u6574\u5F20\u5361\u7247\u5C31\u662F\u52FE\u9009\u5F00\u5173\uFF0C\u52A8\u4F5C\u6761\u6536\u8D77\uFF08\u5426\u5219\u4E00\u8FB9\u591A\u9009\u4E00\u8FB9\u80FD\u70B9\u5230\u542F\u505C\u5220\uFF09 */
1150
+ .dk_card[data-pick="1"] .dk_actionBar { display: none; }
1151
+ .dk_card[data-picked="1"] { border-color: var(--dk-accent); box-shadow: var(--dk-ring); }
1152
+
1153
+ /* \u805A\u5408\u64CD\u4F5C\u6761\uFF1A\u5939\u5728\u5DE5\u5177\u6761\u4E0E\u6B63\u6587\u4E4B\u95F4\u7684\u4E00\u6761\u6A2A\u680F\uFF0C\u8BA1\u6570\u9760\u5DE6\u3001\u6309\u94AE\u9760\u53F3 */
1154
+ .dk_pickBar {
1155
+ display: flex;
1156
+ align-items: center;
1157
+ gap: var(--dk-gap-md);
1158
+ flex: 0 0 auto;
1159
+ flex-wrap: wrap;
1160
+ padding: var(--dk-gap-sm) var(--dk-gap-lg);
1161
+ border-bottom: 1px solid var(--dk-border);
1162
+ background: var(--dk-surface-2);
1163
+ }
1164
+
1165
+ .dk_pickCount {
1166
+ font-size: 12px;
1167
+ font-weight: 600;
1168
+ color: var(--dk-label);
1169
+ font-variant-numeric: tabular-nums;
1170
+ }
1171
+
1172
+ /* \u63D0\u793A\u5728\u7A84\u680F\u91CC\u53EF\u4EE5\u6362\u884C\uFF0C\u4F46\u4E0D\u8981\u6491\u7834\u884C */
1173
+ .dk_pickHint { min-width: 0; }
1174
+
1175
+ /* ============================ \u4E8B\u4EF6\u6D3B\u52A8\u6761 ============================ */
1176
+
1177
+ /*
1178
+ * \u6D3B\u52A8\u6761\uFF1A\u8D34\u5728\u5BB9\u5668\u5217\u8868\u5934\u90E8\u7684\u4E00\u6761\u7A84\u680F\u3002\u9ED8\u8BA4\u5C55\u5F00\u3001\u53EF\u6298\u53E0\u2014\u2014\u6298\u53E0\u53EA\u6536\u8D77\u660E\u7EC6\uFF0C
1179
+ * \u4E8B\u4EF6\u6D41\u7167\u5E38\u8DD1\uFF08\u5B83\u4E0D\u662F\u6682\u505C\u5F00\u5173\uFF09\uFF0C\u6240\u4EE5\u6298\u53E0\u6001\u4E5F\u8981\u7559\u7740\u6807\u9898\u4E0E\u72B6\u6001\u70B9\u3002
1180
+ */
1181
+ .dk_activity {
1182
+ flex: 0 0 auto;
1183
+ margin-bottom: var(--dk-gap-lg);
1184
+ border: 1px solid var(--dk-border);
1185
+ border-radius: var(--dk-r-md);
1186
+ background: var(--dk-surface-2);
1187
+ overflow: hidden;
1188
+ }
1189
+
1190
+ .dk_activityHead {
1191
+ display: flex;
1192
+ align-items: center;
1193
+ gap: var(--dk-gap-md);
1194
+ width: 100%;
1195
+ min-width: 0;
1196
+ padding: var(--dk-gap-sm) var(--dk-gap-lg);
1197
+ border: none;
1198
+ background: transparent;
1199
+ color: var(--dk-label);
1200
+ font-family: inherit;
1201
+ font-size: 12px;
1202
+ text-align: left;
1203
+ cursor: pointer;
1204
+ }
1205
+
1206
+ .dk_activityHead:hover { background: var(--dk-hover); }
1207
+ .dk_activityHead:focus-visible { outline: none; box-shadow: var(--dk-ring); }
1208
+ .dk_activityTitle { flex: none; font-weight: 600; letter-spacing: .3px; }
1209
+
1210
+ /* \u72B6\u6001\u70B9\u6CBF\u7528 .dk_followState \u7684\u8BED\u4E49\u8272\uFF0C\u4F46\u5185\u8054\u5728\u6807\u9898\u884C\u91CC\u3001\u4E0D\u5360\u6574\u884C\u4E5F\u6CA1\u6709\u4E0B\u8FB9\u6846 */
1211
+ .dk_activityState {
1212
+ display: inline-flex;
1213
+ align-items: center;
1214
+ gap: var(--dk-gap-sm);
1215
+ flex: none;
1216
+ color: var(--dk-label-3);
1217
+ font-size: 11px;
1218
+ }
1219
+
1220
+ .dk_activityState::before {
1221
+ content: '';
1222
+ width: 6px;
1223
+ height: 6px;
1224
+ border-radius: 50%;
1225
+ background: var(--dk-label-3);
1226
+ }
1227
+
1228
+ .dk_activityState[data-state="open"]::before { background: var(--dk-success); }
1229
+ .dk_activityState[data-state="connecting"]::before,
1230
+ .dk_activityState[data-state="reconnecting"]::before { background: var(--dk-warn); }
1231
+ .dk_activityState[data-state="closed"]::before,
1232
+ .dk_activityState[data-state="unsupported"]::before { background: var(--dk-danger); }
1233
+
1234
+ .dk_activityChevron {
1235
+ flex: none;
1236
+ display: inline-flex;
1237
+ color: var(--dk-label-3);
1238
+ transition: transform var(--dk-dur) var(--dk-ease);
1239
+ }
1240
+
1241
+ .dk_activity[data-open="1"] .dk_activityChevron { transform: rotate(180deg); }
1242
+
1243
+ .dk_activityList {
1244
+ display: flex;
1245
+ flex-wrap: wrap;
1246
+ gap: var(--dk-gap-sm);
1247
+ padding: 0 var(--dk-gap-lg) var(--dk-gap-md);
1248
+ }
1249
+
1250
+ .dk_activityEmpty {
1251
+ padding: 0 var(--dk-gap-lg) var(--dk-gap-md);
1252
+ color: var(--dk-label-3);
1253
+ font-size: 11px;
1254
+ }
1255
+
1256
+ .dk_activityItem {
1257
+ display: inline-flex;
1258
+ align-items: center;
1259
+ gap: var(--dk-gap-sm);
1260
+ max-width: 100%;
1261
+ padding: 2px var(--dk-gap-sm);
1262
+ border: 1px solid var(--dk-border);
1263
+ border-radius: var(--dk-r-xs);
1264
+ background: var(--dk-surface-solid);
1265
+ font-size: 11px;
1266
+ }
1267
+
1268
+ .dk_activityTime {
1269
+ color: var(--dk-label-3);
1270
+ font-family: var(--dk-mono);
1271
+ font-variant-numeric: tabular-nums;
1272
+ }
1273
+
1274
+ .dk_activityName {
1275
+ max-width: 200px;
1276
+ color: var(--dk-label);
1277
+ font-family: var(--dk-mono);
1278
+ overflow: hidden;
1279
+ text-overflow: ellipsis;
1280
+ white-space: nowrap;
1281
+ }
1282
+
1283
+ .dk_activityAction { color: var(--dk-label-2); }
1284
+
1285
+ /* \u52A8\u4F5C\u7740\u8272\uFF1Astart \u662F\u300C\u8D77\u6765\u4E86\u300D\uFF0Cdie / oom / kill \u662F\u300C\u51FA\u4E8B\u4E86\u300D\uFF0Chealth \u53EA\u9648\u8FF0\u72B6\u6001 */
1286
+ .dk_activityItem[data-action="start"] .dk_activityAction { color: var(--dk-success); font-weight: 600; }
1287
+ .dk_activityItem[data-action="die"] .dk_activityAction,
1288
+ .dk_activityItem[data-action="oom"] .dk_activityAction,
1289
+ .dk_activityItem[data-action="kill"] .dk_activityAction { color: var(--dk-danger); font-weight: 600; }
1290
+ .dk_activityItem[data-action="stop"] .dk_activityAction,
1291
+ .dk_activityItem[data-action="destroy"] .dk_activityAction { color: var(--dk-warn); }
1292
+ .dk_activityItem[data-action="health_status"] .dk_activityAction { color: var(--dk-label-2); font-style: italic; }
1293
+
1294
+ /* ==================== \u53D8\u66F4\u64CD\u4F5C\u7684\u300C\u6267\u884C\u4E2D\u300D\u6001 ==================== */
1295
+
1296
+ /*
1297
+ * \u542F\u505C\u5220\u5728\u98DE\u7684\u65F6\u5019\uFF08docker stop / rm \u8981\u7B49\u5BB9\u5668\u771F\u7684\u9000\u51FA\uFF0C\u79D2\u7EA7\u5230\u5341\u51E0\u79D2\uFF09\uFF1A
1298
+ * 1. \u6B63\u5728\u8DD1\u7684\u90A3\u4E2A\u6309\u94AE\u628A\u56FE\u6807\u6362\u6210\u8F6C\u5708\uFF08\u89C1 IconAction \u7684 busy\uFF09\uFF1B
1299
+ * 2. \u540C\u4E00\u5F20\u5361\u7247\u7684\u5176\u5B83\u53D8\u66F4\u6309\u94AE\u7F6E\u7070\u538B\u6697\uFF0C\u76F4\u89C2\u8868\u793A\u300C\u8FD9\u4E00\u7EC4\u5148\u522B\u52A8\u300D\uFF1B
1300
+ * 3. \u5361\u7247\u63CF\u8FB9\u8D70\u5F3A\u8C03\u8272\uFF0C\u626B\u5217\u8868\u65F6\u80FD\u770B\u51FA\u54EA\u51E0\u5F20\u6B63\u5728\u5904\u7406\u3002
1301
+ * \u7F6E\u7070\u6309\u94AE\u672C\u8EAB\u6709 opacity .45\uFF0Cbusy \u7684\u90A3\u4E2A\u8981\u9876\u6389\u5B83\uFF0C\u5426\u5219\u8F6C\u5708\u4E5F\u8DDF\u7740\u53D8\u6DE1\u3002
1302
+ */
1303
+ .dk_iconBtn[data-busy="1"] { color: var(--dk-accent); }
1304
+ .dk_iconBtn[data-busy="1"]:disabled { opacity: 1; cursor: progress; }
1305
+ .dk_card[data-pending="1"] .dk_actionBar .dk_iconBtn:not([data-busy="1"]) { opacity: .4; }
1306
+ .dk_card[data-pending="1"] { border-color: color-mix(in srgb, var(--dk-accent) 45%, transparent); }
1307
+
1308
+ /* \u786E\u8BA4\u6846\u91CC\u7684\u300C\u6267\u884C\u4E2D\u2026\u300D\uFF1A\u8F6C\u5708 + \u6587\u6848\u5E76\u6392\uFF0C\u4E0D\u6491\u7834\u6309\u94AE\u9AD8\u5EA6 */
1309
+ .dk_confirmBusy { display: inline-flex; align-items: center; gap: var(--dk-gap-sm); }
1310
+
1311
+ /* \u5FD9\u788C\u7684\u786E\u8BA4\u952E\u540C\u6837\u8981\u9876\u6389 .dk_btn:disabled \u7684 .45\uFF0C\u5426\u5219\u300C\u6267\u884C\u4E2D\u2026\u300D\u770B\u4E0D\u6E05\uFF08\u53D6\u6D88\u952E\u4FDD\u6301\u7F6E\u7070\uFF09 */
1312
+ .dk_confirm[data-busy="1"] .dk_btnDanger { opacity: 1; cursor: progress; }
1313
+
1314
+ /* ==================== \u7F51\u7EDC / \u5377\u5217\u8868 ==================== */
1315
+
1316
+ /*
1317
+ * \u53EF\u70B9\u51FB\u7684\u8868\u683C\u884C\uFF08\u7F51\u7EDC / \u5377\u5217\u8868\uFF1A\u884C = \u8FDB\u8BE6\u60C5\u7684\u5165\u53E3\uFF09\u3002
1318
+ * \u53EA\u7ED9 cursor + hover \u63D0\u793A\uFF0C\u4E0D\u52A0\u4E0B\u5212\u7EBF\u2014\u2014\u8868\u683C\u91CC\u6EE1\u5C4F\u4E0B\u5212\u7EBF\u4F1A\u66F4\u96BE\u770B\u3002
1319
+ */
1320
+ .dk_rowClickable { cursor: pointer; }
1321
+ .dk_rowClickable:hover { background: var(--dk-hover); }
1322
+
1323
+ /* \u6302\u8F7D\u70B9\u5217\uFF1A\u8DEF\u5F84\u5F88\u957F\uFF0C\u6491\u5BBD\u8868\u683C\u4F1A\u628A\u522B\u7684\u5217\u6324\u6CA1\uFF0C\u8FD9\u91CC\u9650\u5BBD + \u7701\u7565\u53F7\uFF0Ctitle \u91CC\u7ED9\u5168\u91CF */
1324
+ .dk_pathCell { max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
1325
+
1326
+ /* ====================== \u591A\u76EE\u6807\u603B\u89C8\uFF08\u53EA\u8BFB\uFF09 ========================= */
1327
+
1328
+ /*
1329
+ * \u4E00\u5C4F\u770B\u5168\u90E8\u76EE\u6807\uFF1A\u4E0A\u9762\u4E00\u884C\u8BA1\u6570\u5361\uFF0C\u4E0B\u9762\u5F02\u5E38\u8868\u3002\u5361\u7247\u884C\u4E0D\u6EDA\uFF08\u76EE\u6807\u6570\u662F\u914D\u7F6E\u51FA\u6765\u7684\uFF0C
1330
+ * \u901A\u5E38\u4E2A\u4F4D\u6570\uFF09\uFF0C\u5F02\u5E38\u8868\u81EA\u5DF1\u6EDA\u3001\u8868\u5934\u5438\u9876\u2014\u2014\u4E0E\u955C\u50CF / \u7F51\u7EDC / \u5377\u9875\u540C\u6B3E\uFF0C\u9760 .dk_mainImages
1331
+ * \u91CC\u90A3\u6761 \`.dk_tableWrap { flex: 1 }\` \u751F\u6548\uFF0C\u6240\u4EE5\u6B63\u6587\u5916\u5C42\u5FC5\u987B\u662F flex \u5217\u7684 .dk_imagesView\u3002
1332
+ */
1333
+ .dk_ovCards {
1334
+ display: grid;
1335
+ grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
1336
+ gap: var(--dk-gap-md);
1337
+ margin-bottom: var(--dk-gap-lg);
1338
+ }
1339
+
1340
+ .dk_ovCard {
1341
+ display: flex;
1342
+ flex-direction: column;
1343
+ gap: var(--dk-gap-sm);
1344
+ padding: var(--dk-gap-md) var(--dk-gap-lg);
1345
+ border: 1px solid var(--dk-border);
1346
+ border-radius: var(--dk-r-md);
1347
+ background: var(--dk-surface-solid);
1348
+ color: inherit;
1349
+ font: inherit;
1350
+ text-align: left;
1351
+ cursor: pointer;
1352
+ transition: border-color var(--dk-dur) var(--dk-ease), box-shadow var(--dk-dur) var(--dk-ease);
1353
+ }
1354
+
1355
+ .dk_ovCard:hover { border-color: var(--dk-border-strong); box-shadow: var(--dk-shadow); }
1356
+ .dk_ovCard:focus-visible { outline: none; box-shadow: var(--dk-ring); }
1357
+
1358
+ /* \u4E0D\u53EF\u8FBE\u7684\u5361\u8981\u5728\u4E00\u5C4F\u91CC\u7B2C\u4E00\u773C\u88AB\u6311\u51FA\u6765\uFF1A\u5371\u9669\u8272\u63CF\u8FB9 + \u6DE1\u5E95\uFF0C\u548C\u300C\u6570\u5B57\u90FD\u6B63\u5E38\u300D\u7684\u5361\u62C9\u5F00 */
1359
+ .dk_ovCard[data-state="error"] {
1360
+ border-color: color-mix(in srgb, var(--dk-danger) 40%, transparent);
1361
+ background: color-mix(in srgb, var(--dk-danger) 8%, transparent);
1362
+ }
1363
+
1364
+ .dk_ovCardHead {
1365
+ display: flex;
1366
+ align-items: center;
1367
+ gap: var(--dk-gap-sm);
1368
+ min-width: 0;
1369
+ }
1370
+
1371
+ .dk_ovCardName {
1372
+ flex: 1 1 auto;
1373
+ min-width: 0;
1374
+ font-size: 13px;
1375
+ font-weight: 600;
1376
+ overflow: hidden;
1377
+ text-overflow: ellipsis;
1378
+ white-space: nowrap;
1379
+ }
1380
+
1381
+ .dk_ovCardCounts { display: flex; flex-wrap: wrap; gap: var(--dk-gap-lg); }
1382
+
1383
+ .dk_ovCount {
1384
+ display: flex;
1385
+ align-items: baseline;
1386
+ gap: 4px;
1387
+ font-size: 12px;
1388
+ color: var(--dk-label-3);
1389
+ }
1390
+
1391
+ .dk_ovCountValue {
1392
+ font-size: 16px;
1393
+ font-weight: 600;
1394
+ font-variant-numeric: tabular-nums;
1395
+ color: var(--dk-label);
1396
+ }
1397
+
1398
+ .dk_ovCount[data-state="running"] .dk_ovCountValue { color: var(--dk-success); }
1399
+ .dk_ovCount[data-state="unhealthy"] .dk_ovCountValue { color: var(--dk-danger); }
1400
+ /*
1401
+ * \u8FD8\u6CA1\u7B54\u5B8C\u7684\u5361\uFF1A\u53EA\u7ED9\u8BFB\u53D6\u6001\uFF0C\u4E0D\u51FA 0/0/0\uFF08\u90A3\u4F1A\u88AB\u8BFB\u6210\u300C\u8FD9\u53F0\u673A\u5668\u6CA1\u6709\u5BB9\u5668\u300D\uFF0C\u800C\u5B83\u53EA\u662F\u8FD8\u6CA1
1402
+ * \u56DE\u7B54\u2014\u2014SSH \u76EE\u6807\u4E0D\u53EF\u8FBE\u65F6\u8981\u7B49 readyTimeout 20s\uFF09\u3002\u6574\u5361\u538B\u6697\u4E00\u70B9\uFF0C\u4E0E\u5DF2\u6709\u7ED3\u679C\u533A\u5206\u5F00\u3002
1403
+ */
1404
+ .dk_ovCard[data-state="loading"] { opacity: .7; }
1405
+
1406
+ .dk_ovCardLoading {
1407
+ display: flex;
1408
+ align-items: center;
1409
+ gap: var(--dk-gap-sm);
1410
+ font-size: 12px;
1411
+ color: var(--dk-label-3);
1412
+ }
1413
+
1414
+ /* \u4E0D\u5065\u5EB7\u4E3A 0 \u65F6\u6570\u5B57\u5373\u7ED3\u8BBA\uFF0C\u4E0D\u8BE5\u7EE7\u7EED\u7528\u5371\u9669\u8272\u558A\u4EBA */
1415
+ .dk_ovCount[data-state="unhealthy"][data-zero="1"] .dk_ovCountValue { color: var(--dk-label-3); }
1416
+
1417
+ .dk_ovCardError {
1418
+ display: flex;
1419
+ align-items: center;
1420
+ gap: var(--dk-gap-sm);
1421
+ min-width: 0;
1422
+ font-size: 12px;
1423
+ }
1424
+
1425
+ /* SSH \u62A5\u9519\u662F\u4E00\u957F\u4E32\uFF1A\u5361\u7247\u91CC\u53EA\u7559\u4E00\u884C\uFF0C\u5168\u91CF\u5728 title \u91CC */
1426
+ .dk_ovCardErrorText {
1427
+ flex: 1 1 auto;
1428
+ min-width: 0;
1429
+ color: var(--dk-label-3);
1430
+ overflow: hidden;
1431
+ text-overflow: ellipsis;
1432
+ white-space: nowrap;
1433
+ }
1434
+
1435
+ .dk_ovSection {
1436
+ margin: 0 0 var(--dk-gap-sm);
1437
+ font-size: 12px;
1438
+ font-weight: 600;
1439
+ color: var(--dk-label-2);
1440
+ }
1441
+
1442
+ /* \u300C\u4E00\u5207\u6B63\u5E38\u300D/\u300C\u8BFB\u53D6\u4E2D\u300D\u8D34\u5728\u5361\u7247\u884C\u4E0B\u9762\uFF0C\u4E0D\u9700\u8981\u6EE1\u5C4F 48px \u7684\u7559\u767D */
1443
+ .dk_ovEmpty { padding: 24px var(--dk-gap-lg); }
1444
+
1010
1445
  /* ============================ \u7A7A\u6001 / \u63D0\u793A ============================ */
1011
1446
 
1012
1447
  .dk_empty {
@@ -1285,9 +1720,159 @@
1285
1720
  .dk_targetInline > .dk_credential { grid-column: 1 / -1; }
1286
1721
  .dk_targetInline > .dk_check { grid-row: auto; grid-column: 2; }
1287
1722
  .dk_cardRow { grid-template-columns: 40px 1fr; }
1723
+ .dk_projectRow { grid-template-columns: 96px 1fr auto; }
1724
+ .dk_projectImage,
1725
+ .dk_projectPorts { display: none; }
1726
+ }
1727
+
1728
+ /* ============================ \u955C\u50CF\u8BE6\u60C5 ============================ */
1729
+
1730
+ /* \u955C\u50CF\u8868\u6700\u540E\u4E00\u5217\uFF08\u64CD\u4F5C\uFF09\uFF1A\u5BBD\u5EA6\u6536\u5230\u5185\u5BB9\u3001\u6309\u94AE\u53F3\u5BF9\u9F50\uFF0C\u4E0D\u8DDF\u6570\u636E\u5217\u62A2\u5BBD\u5EA6 */
1731
+ .dk_colActions { width: 1%; white-space: nowrap; text-align: right; }
1732
+ .dk_rowActions { display: inline-flex; align-items: center; gap: var(--dk-gap-xs); }
1733
+
1734
+ .dk_layerList {
1735
+ display: flex;
1736
+ flex-direction: column;
1737
+ gap: 2px;
1738
+ max-height: 220px;
1739
+ overflow: auto;
1740
+ }
1741
+
1742
+ .dk_layerItem {
1743
+ display: flex;
1744
+ align-items: center;
1745
+ gap: var(--dk-gap-md);
1746
+ font-size: 12px;
1747
+ color: var(--dk-label-2);
1748
+ }
1749
+
1750
+ .dk_layerIndex {
1751
+ flex: none;
1752
+ width: 36px;
1753
+ color: var(--dk-label-3);
1754
+ font-variant-numeric: tabular-nums;
1755
+ text-align: right;
1288
1756
  }
1289
- `;var Mt="/api/dsh-docker",nt="dsh-docker-style";function Fe(){if(document.getElementById(nt)!==null)return;let l=document.createElement("style");l.id=nt,l.textContent=tt,document.head.appendChild(l)}async function G(l,g){let e=await fetch(Mt+l,{...g,headers:{"content-type":"application/json",...g?.headers??{}}}),o=null;try{o=await e.json()}catch{}if(!e.ok){let E=o!==null&&typeof o.error=="string"?o.error:`HTTP ${String(e.status)}`;throw new Error(E)}if(o!==null&&o.ok===!1)throw new Error(typeof o.error=="string"?o.error:"\u8BF7\u6C42\u5931\u8D25");return o}var P={config:()=>G("/config"),saveConfig:l=>G("/config",{method:"POST",body:JSON.stringify(l)}),targets:()=>G("/targets"),probe:l=>G("/probe",{method:"POST",body:JSON.stringify({target:l})}),containers:(l,g)=>G("/containers",{method:"POST",body:JSON.stringify({target:l,all:g})}),inspect:(l,g)=>G("/inspect",{method:"POST",body:JSON.stringify({target:l,id:g})}),logs:(l,g,e)=>G("/logs",{method:"POST",body:JSON.stringify({target:l,id:g,...e})}),stats:(l,g)=>G("/stats",{method:"POST",body:JSON.stringify({target:l,ids:g})}),images:l=>G("/images",{method:"POST",body:JSON.stringify({target:l})}),action:(l,g,e)=>G("/action",{method:"POST",body:JSON.stringify({target:l,action:g,id:e})}),exec:(l,g,e,o)=>G("/exec",{method:"POST",body:JSON.stringify({target:l,id:g,command:e,timeoutSec:o})})};function Ot(l){return l==null||!Number.isFinite(l)?"\u2014":l.toFixed(l>=10?1:2)+"%"}function Rt(l){return l.hostPort===void 0?String(l.containerPort)+"/"+l.protocol:String(l.hostPort)+"\u2192"+String(l.containerPort)+"/"+l.protocol}function at(l){if(!Array.isArray(l)||l.length===0)return"\u65E0\u7AEF\u53E3\u6620\u5C04";let g=new Set,e=[];for(let o of l){let E=Rt(o);g.has(E)||(g.add(E),e.push(E))}return e.join(" ")}function Dt(l){let g=/^(\d{4}-\d{2}-\d{2})[ T](\d{2}:\d{2})/.exec(l);return g===null?l:g[1]+" "+g[2]}function At(l){return{running:"\u8FD0\u884C\u4E2D",exited:"\u5DF2\u505C\u6B62",created:"\u5DF2\u521B\u5EFA",paused:"\u5DF2\u6682\u505C",restarting:"\u91CD\u542F\u4E2D",dead:"dead",removing:"\u5220\u9664\u4E2D",unknown:"\u672A\u77E5"}[l]??l}function Ht(l,g){let e=new Blob([g],{type:"text/plain;charset=utf-8"}),o=URL.createObjectURL(e),E=document.createElement("a");E.href=o,E.download=l,E.click(),setTimeout(()=>URL.revokeObjectURL(o),1e3)}function rt(l){return"docker exec -it '"+String(l).replaceAll("'","'\\''")+"' sh"}var Z=null,de=null,Ne=null,ee=null,Ue=[],Ve=0,Le=null,Ee=!1;function it(l){Ee=l,Le!==null&&Le.set(l)}function st(l){it(!(l!==null&&typeof l=="object"&&l.enabled===!1))}function Ge(l){l!==null&&typeof l=="object"&&(ee=l),Ve=Date.now(),st(ee)}async function Te(){let l=!0;try{ee=(await P.config()).config,Ve=Date.now(),st(ee)}catch(g){l=!1,console.warn("[dsh-docker] \u914D\u7F6E\u7F13\u5B58\u5237\u65B0\u5931\u8D25\uFF1A"+(g instanceof Error?g.message:String(g)))}try{Ue=(await P.targets()).targets??[],Ve=Date.now()}catch(g){Ee&&(l=!1,console.warn("[dsh-docker] \u76EE\u6807\u7F13\u5B58\u5237\u65B0\u5931\u8D25\uFF1A"+(g instanceof Error?g.message:String(g))))}return l}async function Pt(l,g){let e=Ke(l,g);return e!==void 0?e:(await Te(),Ke(l,g))}function Ke(l,g){let e=ee!==null&&Array.isArray(ee.targets)?ee.targets:[];if(typeof g=="string"&&g!==""){let S=e.find(z=>z.kind==="ssh"&&z.book===g);if(S!==void 0)return S.name}let o=typeof l?.host=="string"?l.host:"";if(o==="")return;let E=Number(l?.port),h=Number.isInteger(E)&&E>0?E:22;for(let S of Ue){if(S.kind!=="ssh"||typeof S.label!="string")continue;let z=/^([^@]+)@(.+?)(?::(\d+))?$/.exec(S.label);if(z!==null&&z[2]===o&&Number(z[3]??22)===h)return S.name}}var dt='<svg viewBox="0 0 16 16" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 1.8l5.4 3.1v6.2L8 14.2 2.6 11.1V4.9z"/><path d="M2.6 4.9L8 8l5.4-3.1"/><path d="M8 8v6.2"/></svg>',zt='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 1.8l5.4 3.1v6.2L8 14.2 2.6 11.1V4.9z"/><path d="M2.6 4.9L8 8l5.4-3.1"/><path d="M8 8v6.2"/></svg>',Ce='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M13.2 8a5.2 5.2 0 1 1-1.5-3.7"/><path d="M13.4 2.2v2.6h-2.6"/></svg>',Se='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M4.5 4.5l7 7"/><path d="M11.5 4.5l-7 7"/></svg>',jt='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 3.4l7.4 4.6L5 12.6z"/></svg>',Ft='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4.2" y="4.2" width="7.6" height="7.6" rx="1.2"/></svg>',Gt='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M13.2 8a5.2 5.2 0 1 1-1.5-3.7"/><path d="M13.4 2.2v2.6h-2.6"/></svg>',Vt='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 4.6h10"/><path d="M6.2 4.6V3.4a.8.8 0 0 1 .8-.8h2a.8.8 0 0 1 .8.8v1.2"/><path d="M4.6 4.6l.6 8a.9.9 0 0 0 .9.8h3.8a.9.9 0 0 0 .9-.8l.6-8"/></svg>';var Kt='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 3v7.2"/><path d="M5 7.4L8 10.4l3-3"/><path d="M3.4 12.8h9.2"/></svg>',Ut='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2.6l5.8 10.4H2.2z"/><path d="M8 6.4v3.2"/><path d="M8 11.6h.01"/></svg>',ot='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 5l3.5 3L3 11"/><path d="M8.5 11H13"/></svg>',Wt='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M3 4.5h10"/><path d="M3 8h10"/><path d="M3 11.5h6"/></svg>',Yt='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M3.5 12.5v-4"/><path d="M7 12.5v-8"/><path d="M10.5 12.5v-5"/><path d="M13 12.5v-2"/></svg>',Jt='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12.5 8h-9"/><path d="M7 4.5L3.5 8 7 11.5"/></svg>',lt='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 6.5L8 10.5l4-4"/></svg>';window.__ModuleLoader__.load({id:"@hyzyn/dsh-docker",factory:l=>{let g=l("react"),{jsx:e,jsxs:o}=l("react/jsx-runtime"),{createRoot:E}=l("react-dom/client"),{useState:h,useEffect:S,useRef:z,useCallback:oe}=g;function ct(t,a,d){if(a==="")return t;let k=t.toLowerCase(),w=a.toLowerCase(),r=[],_=0,x=k.indexOf(w),f=0;for(;x>=0&&f<500;)x>_&&r.push(t.slice(_,x)),r.push(e("mark",{children:t.slice(x,x+w.length)},d+"-m"+String(f))),_=x+w.length,f+=1,x=k.indexOf(w,_);return _<t.length&&r.push(t.slice(_)),r}function We(t){let a=t.health==="unhealthy"?"unhealthy":t.state,d=t.health==="unhealthy"?"\u4E0D\u5065\u5EB7":At(t.state);return e("span",{className:"dk_badge","data-state":a,title:t.status??"",children:d})}function V(t){return o("div",{className:"dk_banner","data-kind":t.kind??"error",children:[e("span",{className:"dk_bannerIcon",dangerouslySetInnerHTML:{__html:Ut}},"icon"),o("div",{className:"dk_bannerBody",children:[e("div",{children:t.title}),t.hint===void 0?null:e("div",{className:"dk_hint",style:{marginTop:4},children:t.hint})]},"body"),t.action===void 0?null:e("div",{className:"dk_bannerAction",children:t.action},"action")]})}function Ie(t){return o("div",{className:"dk_confirmBackdrop",onMouseDown:a=>a.stopPropagation(),children:[o("div",{className:"dk_confirm",children:[e("div",{className:"dk_confirmTitle",children:t.title}),e("div",{className:"dk_confirmText",children:t.text}),o("div",{className:"dk_confirmActions",children:[e("button",{type:"button",className:"dk_btn",onClick:t.onCancel,children:"\u53D6\u6D88"}),e("button",{type:"button",className:"dk_btn dk_btnDanger",onClick:t.onConfirm,children:t.confirmLabel})]})]})]})}function $t(t){return e("button",{type:"button",className:"dk_btn"+(t.danger===!0?" dk_btnDanger":""),disabled:t.disabled===!0,title:t.title??"",onClick:a=>{a.stopPropagation(),t.onClick()},children:t.children})}function ke(t){return o("div",{className:"dk_cardRow",children:[e("span",{className:"dk_cardLabel",children:t.label}),e("span",{className:"dk_cardValue",title:String(t.value),children:t.value})]})}function K(t){let a=t.disabled===!0;return e("button",{type:"button",className:"dk_iconBtn"+(t.danger===!0?" dk_iconBtnDanger":""),"data-on":t.on===!0?"1":void 0,"data-spin":t.spin===!0?"1":void 0,disabled:a,title:t.title,"aria-label":t.title,onClick:d=>{d.stopPropagation(),!a&&t.onClick()},children:e("span",{className:"dk_iconGlyph",dangerouslySetInnerHTML:{__html:t.icon}})})}function kt(t){let a=t.item,d=t.allowMutations!==!0,k=a.state==="running"||a.state==="paused"||a.state==="restarting",w=a.createdAt===null?a.runningFor===""?"\u2014":a.runningFor:Dt(a.createdAt);return o("div",{className:"dk_card",role:"button",tabIndex:0,"data-selected":t.selected===!0?"1":"0",onClick:()=>t.onOpen(a,"overview"),onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),t.onOpen(a,"overview"))},children:[o("div",{className:"dk_cardHead",children:[e("span",{className:"dk_cardName",title:a.name,children:a.name}),e(We,{state:a.state,health:a.health,status:a.status})]},"head"),o("div",{className:"dk_cardRows",children:[e(ke,{label:"\u955C\u50CF",value:a.image},"image"),e(ke,{label:"ID",value:a.shortId},"id"),e(ke,{label:"\u7AEF\u53E3",value:at(a.ports)},"ports"),e(ke,{label:"\u521B\u5EFA",value:w},"created"),a.composeProject===null?null:e(ke,{label:"compose",value:a.composeProject+(a.composeService===null?"":"/"+a.composeService)},"compose")]},"rows"),o("div",{className:"dk_actionBar",children:[e(K,{icon:ot,title:"\u5728\u5BB9\u5668\u5185\u6253\u5F00\u4EA4\u4E92\u5F0F\u7EC8\u7AEF\uFF08docker exec -it "+a.name+" sh\uFF09",onClick:()=>t.onExec(a)},"exec"),e(K,{icon:Wt,title:"\u67E5\u770B\u65E5\u5FD7",onClick:()=>t.onOpen(a,"logs")},"logs"),e(K,{icon:Yt,title:"\u8D44\u6E90\u5360\u7528",onClick:()=>t.onOpen(a,"stats")},"stats"),e("span",{className:"dk_actionBarSep","aria-hidden":"true"},"sep"),e(K,{icon:k?Ft:jt,title:d?"\u9700\u8981\u6253\u5F00\u300C\u5141\u8BB8\u53D8\u66F4\u64CD\u4F5C\u300D":k?"\u505C\u6B62\u5BB9\u5668":"\u542F\u52A8\u5BB9\u5668",disabled:d,onClick:()=>t.onAction(k?"stop":"start",a)},"power"),e(K,{icon:Gt,title:d?"\u9700\u8981\u6253\u5F00\u300C\u5141\u8BB8\u53D8\u66F4\u64CD\u4F5C\u300D":"\u91CD\u542F\u5BB9\u5668",disabled:d,onClick:()=>t.onAction("restart",a)},"restart"),e(K,{icon:Vt,danger:!0,title:d?"\u9700\u8981\u6253\u5F00\u300C\u5141\u8BB8\u53D8\u66F4\u64CD\u4F5C\u300D":"\u5220\u9664\u5BB9\u5668\uFF08\u4E0D\u53EF\u6062\u590D\uFF09",disabled:d,onClick:()=>t.onAction("remove",a)},"remove")]},"actions")]})}let ut=/^\s*(\[\d{4}-\d{2}-\d{2}[ T][0-9:.,]+\]|\d{2}:\d{2}:\d{2}[,.]\d{3})/,gt=/^\s*(\[(?:TRACE|DEBUG|INFO|WARN|ERROR|FATAL)\]|\|\s*(?:TRACE|DEBUG|INFO|WARN|ERROR|FATAL))/,ht=/(TRACE|DEBUG|INFO|WARN|ERROR|FATAL)/,Be=2e3;function pt(t,a,d){let k=[],w=t;for(let r=0;r<2;r+=1){let _=ut.exec(w);if(_!==null){k.push(e("span",{className:"dk_logTs",children:_[1]},"ts"+String(r))),w=w.slice(_[0].length);continue}let x=gt.exec(w);if(x!==null){let f=ht.exec(x[1]);k.push(e("span",{className:"dk_logLevel","data-level":f===null?"":f[1],children:x[1].trim()},"lv"+String(r))),w=w.slice(x[0].length);continue}break}return k.push(e("span",{className:"dk_logText",children:ct(w,d,"x"+String(a))},"tx")),o("div",{className:"dk_logLine",children:k},String(a))}function mt(t){let a=t.item,d=t.config,[k,w]=h(t.initialTab??"overview"),[r,_]=h(null),[x,f]=h(""),[N,j]=h({tail:d.logTailDefault,timestamps:!1}),[B,M]=h(null),[C,$]=h(""),[Y,te]=h(!1),[O,R]=h(""),[T,F]=h(!1),[J,i]=h(3),[s,p]=h(null),[I,q]=h(""),[he,X]=h(""),[D,be]=h(null),[pe,A]=h(""),[ne,me]=h(!1);S(()=>{let m=!0;return _(null),f(""),P.inspect(t.target,a.id).then(b=>{m&&_(b.details?.[0]??null)}).catch(b=>{m&&f(b.message)}),()=>{m=!1}},[t.target,a.id,t.refreshToken]);let Q=oe(()=>{te(!0),$(""),P.logs(t.target,a.id,{tail:N.tail,timestamps:N.timestamps}).then(m=>M(m.logs)).catch(m=>$(m.message)).finally(()=>te(!1))},[t.target,a.id,N.tail,N.timestamps]);S(()=>{k==="logs"&&Q()},[k,Q,t.refreshToken]),S(()=>{if(k!=="logs"||!T)return;let m=setInterval(Q,Math.max(1,J)*1e3);return()=>clearInterval(m)},[k,T,J,Q]),S(()=>{if(k!=="stats")return;let m=!0,b=()=>{P.stats(t.target,[a.id]).then(y=>{m&&(p(y.stats?.[0]??null),q(""))}).catch(y=>{m&&q(y.message)})};b();let c=setInterval(b,Math.max(2,d.pollIntervalSec)*1e3);return()=>{m=!1,clearInterval(c)}},[k,t.target,a.id,d.pollIntervalSec,t.refreshToken]);let U=()=>{he.trim()!==""&&(me(!0),A(""),be(null),P.exec(t.target,a.id,he,d.execTimeoutSec).then(m=>be(m.result)).catch(m=>A(m.message)).finally(()=>me(!1)))},W=()=>{if(x!=="")return e(V,{title:"\u8BFB\u53D6\u5BB9\u5668\u8BE6\u60C5\u5931\u8D25",hint:x});if(r===null)return e("div",{className:"dk_empty",children:[e("span",{className:"dk_spin"}),e("div",{children:"\u8BFB\u53D6\u4E2D\u2026"})]});let m=[["\u72B6\u6001",r.state+(r.health===null?"":" / "+r.health)+(r.status===""?"":"\uFF08"+r.status+"\uFF09")],["\u955C\u50CF",r.image],["\u5BB9\u5668 ID",r.shortId],["\u542F\u52A8\u65F6\u95F4",r.startedAt??"\u2014"],["\u7ED3\u675F\u65F6\u95F4",r.finishedAt??"\u2014"],["\u9000\u51FA\u7801",r.exitCode===null?"\u2014":String(r.exitCode)],["\u91CD\u542F\u6B21\u6570",r.restartCount===null?"\u2014":String(r.restartCount)],["\u91CD\u542F\u7B56\u7565",r.restartPolicy??"\u2014"],["PID",r.pid===null?"\u2014":String(r.pid)],["\u7AEF\u53E3",r.ports.length===0?"\u2014":at(r.ports)],["\u6302\u8F7D",r.mounts.length===0?"\u2014":r.mounts.map(c=>c.source+"\u2192"+c.destination+(c.readWrite?"":"\uFF08\u53EA\u8BFB\uFF09")).join(`
1290
- `)],["\u7F51\u7EDC",r.networks.length===0?"\u2014":r.networks.map(c=>c.name+(c.ip===null?"":"\uFF08"+c.ip+"\uFF09")).join(", ")],["\u547D\u4EE4",(r.entrypoint+" "+r.command).trim()||"\u2014"],["\u5DE5\u4F5C\u76EE\u5F55",r.workingDir===""?"\u2014":r.workingDir],["\u7528\u6237",r.user===""?"\u2014":r.user]],b=o("div",{className:"dk_kv",children:m.flatMap(([c,y],L)=>[e("div",{className:"dk_kvKey",children:c},"k"+String(L)),e("div",{className:"dk_kvVal"+(c==="\u5BB9\u5668 ID"||c==="\u547D\u4EE4"||c==="\u955C\u50CF"?" dk_kvValMono":""),children:y},"v"+String(L))])});return o("div",{children:[r.healthLogTail===null?null:e("div",{className:"dk_hint",style:{marginBottom:8},children:"\u6700\u8FD1\u5065\u5EB7\u68C0\u67E5\u8F93\u51FA\uFF1A"+r.healthLogTail}),b,e("div",{className:"dk_cardSection",style:{marginTop:16},children:"\u4E00\u6B21\u6027\u547D\u4EE4\uFF08docker exec\uFF09"}),d.allowExec!==!0?e(V,{kind:"info",title:"exec \u672A\u542F\u7528",hint:"\u5230 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 Docker \u5BB9\u5668\u9762\u677F \u6253\u5F00\u300C\u5141\u8BB8 exec\u300D\uFF0C\u6216\u76F4\u63A5\u590D\u5236\u5361\u7247\u4E0A\u7684 exec \u547D\u4EE4\u5230\u7EC8\u7AEF\u9762\u677F\u4EA4\u4E92\u5F0F\u8FDB\u5165\u5BB9\u5668\u3002"}):o("div",{children:[o("div",{className:"dk_row",children:[e("input",{className:"dk_input",style:{flex:"1 1 auto"},placeholder:"\u5982 ls -la /app \u6216 cat /etc/nginx/nginx.conf",value:he,onChange:c=>X(c.target.value),onKeyDown:c=>{c.key==="Enter"&&U()}}),e("button",{type:"button",className:"dk_btn dk_btnPrimary",disabled:ne,onClick:U,children:ne?"\u6267\u884C\u4E2D\u2026":"\u6267\u884C"})]}),pe===""?null:e(V,{title:"\u6267\u884C\u5931\u8D25",hint:pe}),D===null?null:o("div",{style:{marginTop:8},children:[e("div",{className:"dk_hint",children:"\u9000\u51FA\u7801 "+(D.code===null?"?":String(D.code))+" \xB7 \u8017\u65F6 "+String(D.durationMs)+"ms"+(D.truncated?" \xB7 \u8F93\u51FA\u5DF2\u622A\u65AD":"")}),e("pre",{className:"dk_logBox",style:{marginTop:6},children:(D.stdout||"")+(D.stderr===""?"":`
1757
+
1758
+ .dk_layerId { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1759
+
1760
+ .dk_labelList { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
1761
+ .dk_labelItem { display: grid; grid-template-columns: minmax(0, 240px) 1fr; gap: var(--dk-gap-md); }
1762
+ .dk_labelKey { color: var(--dk-label-3); font-family: var(--dk-mono); overflow-wrap: anywhere; }
1763
+ .dk_labelVal { color: var(--dk-label); font-family: var(--dk-mono); overflow-wrap: anywhere; }
1764
+
1765
+ .dk_historyTable td { vertical-align: top; }
1766
+ .dk_historyCmd { max-width: 440px; overflow: hidden; text-overflow: ellipsis; }
1767
+
1768
+ /* ============================ \u955C\u50CF\u62C9\u53D6\u8FDB\u5EA6 ============================ */
1769
+
1770
+ .dk_pullBody { gap: var(--dk-gap-md); }
1771
+
1772
+ .dk_pullBox {
1773
+ flex: 1 1 auto;
1774
+ min-height: 180px;
1775
+ margin-top: var(--dk-gap-md);
1776
+ padding: var(--dk-gap-md);
1777
+ border: 1px solid var(--dk-border);
1778
+ border-radius: var(--dk-r-md);
1779
+ background: var(--dk-log-bg);
1780
+ color: var(--dk-log-fg);
1781
+ font-family: var(--dk-mono);
1782
+ font-size: 12px;
1783
+ line-height: 1.5;
1784
+ overflow: auto;
1785
+ white-space: pre-wrap;
1786
+ word-break: break-word;
1787
+ }
1788
+
1789
+ .dk_pullLine { min-height: 1.5em; }
1790
+ /* \u9010\u5C42\u72B6\u6001\u884C\uFF1A\u5C42\u952E\u7531 data-key \u6807\u51FA\uFF0C\u7ED9\u5C42\u72B6\u6001\u4E00\u70B9\u8272\u5F69\u533A\u5206 */
1791
+ .dk_pullLine[data-key] { color: color-mix(in srgb, var(--dk-log-fg) 82%, var(--dk-accent)); }
1792
+
1793
+ /* ============================ \u7EDF\u8BA1\u5B9E\u65F6\u8DDF\u968F ============================ */
1794
+
1795
+ .dk_statsView {
1796
+ display: flex;
1797
+ flex-direction: column;
1798
+ gap: var(--dk-gap-md);
1799
+ flex: 1 1 auto;
1800
+ min-height: 0;
1801
+ }
1802
+
1803
+ .dk_statsBar { display: flex; align-items: center; gap: var(--dk-gap-sm); flex-wrap: wrap; }
1804
+ .dk_trend { display: inline-flex; align-items: center; gap: var(--dk-gap-sm); }
1805
+
1806
+ .dk_spark {
1807
+ display: inline-flex;
1808
+ align-items: center;
1809
+ justify-content: center;
1810
+ width: 96px;
1811
+ height: 22px;
1812
+ color: var(--dk-accent);
1813
+ }
1814
+
1815
+ .dk_spark svg { display: block; width: 96px; height: 22px; overflow: visible; }
1816
+ .dk_spark[data-alert="1"] { color: var(--dk-danger); }
1817
+ .dk_sparkEmpty { font-size: 11px; color: var(--dk-label-3); }
1818
+
1819
+ /* ============================ Compose \u9879\u76EE ============================ */
1820
+
1821
+ .dk_projects { display: flex; flex-direction: column; gap: var(--dk-gap-lg); }
1822
+
1823
+ .dk_project {
1824
+ border: 1px solid var(--dk-border);
1825
+ border-radius: var(--dk-r-md);
1826
+ background: var(--dk-surface-2);
1827
+ overflow: hidden;
1828
+ cursor: pointer;
1829
+ transition: border-color var(--dk-dur) var(--dk-ease), box-shadow var(--dk-dur) var(--dk-ease);
1830
+ }
1831
+
1832
+ .dk_project:hover { border-color: var(--dk-border-strong); }
1833
+ .dk_project:focus-visible { outline: none; box-shadow: var(--dk-ring); }
1834
+ .dk_projectHead { display: flex; align-items: center; gap: var(--dk-gap-md); padding: var(--dk-gap-md) var(--dk-gap-lg); }
1835
+ .dk_projectIcon { display: inline-flex; align-items: center; color: var(--dk-accent); }
1836
+ .dk_projectName { font-size: 13px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1837
+ .dk_projectRows { display: flex; flex-direction: column; border-top: 1px solid var(--dk-border); }
1838
+
1839
+ .dk_projectRow {
1840
+ display: grid;
1841
+ grid-template-columns: 120px minmax(120px, 1.1fr) auto minmax(120px, 1.2fr) minmax(80px, 1fr);
1842
+ align-items: center;
1843
+ gap: var(--dk-gap-md);
1844
+ padding: var(--dk-gap-sm) var(--dk-gap-lg);
1845
+ font-size: 12px;
1846
+ border-top: 1px solid var(--dk-border);
1847
+ }
1848
+
1849
+ .dk_projectRow:first-child { border-top: none; }
1850
+ .dk_projectSvc { color: var(--dk-label-2); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1851
+ .dk_projectContainer { font-family: var(--dk-mono); color: var(--dk-label); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1852
+ .dk_projectImage { font-family: var(--dk-mono); color: var(--dk-label-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1853
+ .dk_projectPorts { color: var(--dk-label-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1854
+
1855
+ .dk_composeTable td { vertical-align: middle; }
1856
+
1857
+ /* \u805A\u5408\u65E5\u5FD7\u7684 [service] \u524D\u7F00\uFF08\u540C\u4E00\u4EFD\u65E5\u5FD7\u7740\u8272\uFF0C\u53EA\u591A\u4E00\u4E2A\u6765\u6E90\u6807\u7B7E\uFF09 */
1858
+ .dk_logSvc { margin-right: 6px; color: var(--dk-accent); font-weight: 600; }
1859
+ `;var ln="/api/dsh-docker",Sn="dsh-docker-style";function Xt(){if(document.getElementById(Sn)!==null)return;let i=document.createElement("style");i.id=Sn,i.textContent=Nn,document.head.appendChild(i)}async function X(i,h){let e=await fetch(ln+i,{...h,headers:{"content-type":"application/json",...h?.headers??{}}}),a=null;try{a=await e.json()}catch{}if(!e.ok){let I=a!==null&&typeof a.error=="string"?a.error:`HTTP ${String(e.status)}`;throw new Error(I)}if(a!==null&&a.ok===!1)throw new Error(typeof a.error=="string"?a.error:"\u8BF7\u6C42\u5931\u8D25");return a}var U={config:()=>X("/config"),saveConfig:i=>X("/config",{method:"POST",body:JSON.stringify(i)}),targets:()=>X("/targets"),probe:i=>X("/probe",{method:"POST",body:JSON.stringify({target:i})}),containers:(i,h)=>X("/containers",{method:"POST",body:JSON.stringify({target:i,all:h})}),inspect:(i,h)=>X("/inspect",{method:"POST",body:JSON.stringify({target:i,id:h})}),logs:(i,h,e)=>X("/logs",{method:"POST",body:JSON.stringify({target:i,id:h,...e})}),stats:(i,h)=>X("/stats",{method:"POST",body:JSON.stringify({target:i,ids:h})}),images:i=>X("/images",{method:"POST",body:JSON.stringify({target:i})}),imageInspect:(i,h)=>X("/images/inspect",{method:"POST",body:JSON.stringify({target:i,ref:h})}),imageRemove:(i,h)=>X("/images/remove",{method:"POST",body:JSON.stringify({target:i,ref:h})}),imagePrune:i=>X("/images/prune",{method:"POST",body:JSON.stringify({target:i})}),networks:i=>X("/networks",{method:"POST",body:JSON.stringify({target:i})}),networkInspect:(i,h)=>X("/networks/inspect",{method:"POST",body:JSON.stringify({target:i,name:h})}),networkRemove:(i,h)=>X("/networks/remove",{method:"POST",body:JSON.stringify({target:i,name:h})}),networkPrune:i=>X("/networks/prune",{method:"POST",body:JSON.stringify({target:i})}),volumes:i=>X("/volumes",{method:"POST",body:JSON.stringify({target:i})}),volumeInspect:(i,h)=>X("/volumes/inspect",{method:"POST",body:JSON.stringify({target:i,name:h})}),volumeRemove:(i,h)=>X("/volumes/remove",{method:"POST",body:JSON.stringify({target:i,name:h})}),volumePrune:i=>X("/volumes/prune",{method:"POST",body:JSON.stringify({target:i})}),action:(i,h,e)=>X("/action",{method:"POST",body:JSON.stringify({target:i,action:h,id:e})}),exec:(i,h,e,a)=>X("/exec",{method:"POST",body:JSON.stringify({target:i,id:h,command:e,timeoutSec:a})})};function Ot(i,h){return ln+i+"?"+new URLSearchParams(h).toString()}function Ja(i){return i==null||!Number.isFinite(i)?"\u2014":i.toFixed(i>=10?1:2)+"%"}function Ka(i){return i.hostPort===void 0?String(i.containerPort)+"/"+i.protocol:String(i.hostPort)+"\u2192"+String(i.containerPort)+"/"+i.protocol}function Mt(i){if(!Array.isArray(i)||i.length===0)return"\u65E0\u7AEF\u53E3\u6620\u5C04";let h=new Set,e=[];for(let a of i){let I=Ka(a);h.has(I)||(h.add(I),e.push(I))}return e.join(" ")}function ft(i){let h=/^(\d{4}-\d{2}-\d{2})[ T](\d{2}:\d{2})/.exec(i);return h===null?i:h[1]+" "+h[2]}function Bt(i){if(i==null||!Number.isFinite(i)||i<0)return"\u2014";let h=["B","kB","MB","GB","TB"],e=i,a=0;for(;e>=1e3&&a<h.length-1;)e/=1e3,a+=1;return(a===0?String(Math.round(e)):e.toFixed(e>=100?0:1))+" "+h[a]}function Wa(i){return{running:"\u8FD0\u884C\u4E2D",exited:"\u5DF2\u505C\u6B62",created:"\u5DF2\u521B\u5EFA",paused:"\u5DF2\u6682\u505C",restarting:"\u91CD\u542F\u4E2D",dead:"dead",removing:"\u5220\u9664\u4E2D",unknown:"\u672A\u77E5"}[i]??i}function Ua(i,h){let e=new Blob([h],{type:"text/plain;charset=utf-8"}),a=URL.createObjectURL(e),I=document.createElement("a");I.href=a,I.download=i,I.click(),setTimeout(()=>URL.revokeObjectURL(a),1e3)}function Cn(i){return"docker exec -it '"+String(i).replaceAll("'","'\\''")+"' sh"}var Pe=null,Je=null,Rt=null,je=null,dn=[],nn=0,jt=null,At=!1;function Jn(i){At=i,jt!==null&&jt.set(i)}function Kn(i){Jn(!(i!==null&&typeof i=="object"&&i.enabled===!1))}function Zt(i){i!==null&&typeof i=="object"&&(je=i),nn=Date.now(),Kn(je)}async function Pt(){let i=!0;try{je=(await U.config()).config,nn=Date.now(),Kn(je)}catch(h){i=!1,console.warn("[dsh-docker] \u914D\u7F6E\u7F13\u5B58\u5237\u65B0\u5931\u8D25\uFF1A"+(h instanceof Error?h.message:String(h)))}try{dn=(await U.targets()).targets??[],nn=Date.now()}catch(h){At&&(i=!1,console.warn("[dsh-docker] \u76EE\u6807\u7F13\u5B58\u5237\u65B0\u5931\u8D25\uFF1A"+(h instanceof Error?h.message:String(h))))}return i}async function qa(i,h){let e=an(i,h);return e!==void 0?e:(await Pt(),an(i,h))}function an(i,h){let e=je!==null&&Array.isArray(je.targets)?je.targets:[];if(typeof h=="string"&&h!==""){let O=e.find(K=>K.kind==="ssh"&&K.book===h);if(O!==void 0)return O.name}let a=typeof i?.host=="string"?i.host:"";if(a==="")return;let I=Number(i?.port),k=Number.isInteger(I)&&I>0?I:22;for(let O of dn){if(O.kind!=="ssh"||typeof O.label!="string")continue;let K=/^([^@]+)@(.+?)(?::(\d+))?$/.exec(O.label);if(K!==null&&K[2]===a&&Number(K[3]??22)===k)return O.name}}var Ln='<svg viewBox="0 0 16 16" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 1.8l5.4 3.1v6.2L8 14.2 2.6 11.1V4.9z"/><path d="M2.6 4.9L8 8l5.4-3.1"/><path d="M8 8v6.2"/></svg>',Ya='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 1.8l5.4 3.1v6.2L8 14.2 2.6 11.1V4.9z"/><path d="M2.6 4.9L8 8l5.4-3.1"/><path d="M8 8v6.2"/></svg>',Ke='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M13.2 8a5.2 5.2 0 1 1-1.5-3.7"/><path d="M13.4 2.2v2.6h-2.6"/></svg>',we='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M4.5 4.5l7 7"/><path d="M11.5 4.5l-7 7"/></svg>',$a='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 3.4l7.4 4.6L5 12.6z"/></svg>',Xa='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4.2" y="4.2" width="7.6" height="7.6" rx="1.2"/></svg>',Za='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M13.2 8a5.2 5.2 0 1 1-1.5-3.7"/><path d="M13.4 2.2v2.6h-2.6"/></svg>',Dt='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 4.6h10"/><path d="M6.2 4.6V3.4a.8.8 0 0 1 .8-.8h2a.8.8 0 0 1 .8.8v1.2"/><path d="M4.6 4.6l.6 8a.9.9 0 0 0 .9.8h3.8a.9.9 0 0 0 .9-.8l.6-8"/></svg>';var Qa='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 3v7.2"/><path d="M5 7.4L8 10.4l3-3"/><path d="M3.4 12.8h9.2"/></svg>',er='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2.6l5.8 10.4H2.2z"/><path d="M8 6.4v3.2"/><path d="M8 11.6h.01"/></svg>',Tn='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 5l3.5 3L3 11"/><path d="M8.5 11H13"/></svg>',En='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M3 4.5h10"/><path d="M3 8h10"/><path d="M3 11.5h6"/></svg>',tr='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M3.5 12.5v-4"/><path d="M7 12.5v-8"/><path d="M10.5 12.5v-5"/><path d="M13 12.5v-2"/></svg>',We='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12.5 8h-9"/><path d="M7 4.5L3.5 8 7 11.5"/></svg>',Qt='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 6.5L8 10.5l4-4"/></svg>',nr='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2.6v6.4"/><path d="M5.3 6.5L8 9.2l2.7-2.7"/><path d="M3 11.4v1.2a.8.8 0 0 0 .8.8h8.4a.8.8 0 0 0 .8-.8v-1.2"/></svg>',ar='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2.5" y="3.5" width="11" height="9" rx="1.2"/><path d="M2.5 10.2L5.6 7.6l2.4 2 2.1-1.7 3.4 2.9"/><path d="M6 6.2h.01"/></svg>',en='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3.4 12.6h9.2"/><path d="M5.2 9.6l3.1-3.1"/><path d="M8.4 3.6l2.4 2.4"/><path d="M10.6 6.2l1.8 1.8-3.2 1.2-1.2 3.2-1.8-1.8z"/></svg>',In='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.4 5.9L8 2.8l5.6 3.1L8 9z"/><path d="M2.4 8.4L8 11.5l5.6-3.1"/><path d="M2.4 10.9L8 14l5.6-3.1"/></svg>';var rr='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="8" cy="3.2" r="1.7"/><circle cx="3.4" cy="12.2" r="1.7"/><circle cx="12.6" cy="12.2" r="1.7"/><path d="M6.7 4.6L4.5 10.6"/><path d="M9.3 4.6l2.2 6"/><path d="M5.1 12.2h5.8"/></svg>',or='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><ellipse cx="8" cy="4.2" rx="4.6" ry="1.9"/><path d="M3.4 4.2v7.6c0 1 2.1 1.9 4.6 1.9s4.6-.9 4.6-1.9V4.2"/><path d="M3.4 8c0 1 2.1 1.9 4.6 1.9s4.6-.9 4.6-1.9"/></svg>',Wn=6,rn=8;function On(i){return i>rn?{canRun:!1,hint:"\u6700\u591A "+String(rn)+" \u4E2A\u5BB9\u5668\uFF0C\u6D4F\u89C8\u5668\u5E76\u53D1\u957F\u8FDE\u63A5\u6709\u9650\u5236"}:i>Wn?{canRun:!0,hint:"\u8FDE\u63A5\u6570\u8F83\u591A\uFF0C\u6D4F\u89C8\u5668\u5E76\u53D1\u957F\u8FDE\u63A5\u6709\u9650\u5236"}:i<2?{canRun:!1,hint:i===0?"":"\u81F3\u5C11\u9009\u62E9 2 \u4E2A\u5BB9\u5668"}:{canRun:!0,hint:""}}function Mn(i,h){return i.includes(h)?i.filter(e=>e!==h):[...i,h]}function Bn(i,h){let e=new Set(h.map(I=>I.id)),a=i.filter(I=>e.has(I));return a.length===i.length?i:a}function Rn(i,h){let e=new Map(i.map(a=>[a.id,a]));return h.map(a=>e.get(a)).filter(a=>a!==void 0)}function Dn(){let i=0;return{next(){return i+=1,i},isCurrent(h){return h===i}}}var on=120;function Un(i){return i.filter(h=>h.health==="unhealthy"||h.state==="restarting")}function qn(i){let h=0,e=0,a=0;for(let I of i)I.state==="running"||I.state==="paused"||I.state==="restarting"?h+=1:e+=1,I.health==="unhealthy"&&(a+=1);return{running:h,stopped:e,unhealthy:a}}function Yn(i){let h=e=>e.item.health==="unhealthy"?0:1;return i.slice().sort((e,a)=>{let I=h(e)-h(a);return I!==0?I:e.targetIndex!==a.targetIndex?e.targetIndex-a.targetIndex:e.item.name===a.item.name?0:e.item.name<a.item.name?-1:1})}function $n(i){let h=String(i??"").split(`
1860
+ `)[0].trim();return h===""?"\u672A\u77E5\u9519\u8BEF":h.length>on?h.slice(0,on)+"\u2026":h}function tn(i,h,e){let a=!1,I=i.map(k=>k.name!==h?k:(a=!0,{...k,...e}));return a?I:i}function Pn(i){let h=i.map(a=>{let I=qn(a.containers);return{name:a.name,kind:a.kind==="ssh"?"ssh":"local",label:typeof a.label=="string"?a.label:"",error:a.error===""?"":$n(a.error),loaded:a.loaded===!0,running:I.running,stopped:I.stopped,unhealthy:I.unhealthy}}),e=[];return i.forEach((a,I)=>{for(let k of Un(a.containers))e.push({target:a.name,targetIndex:I,item:k})}),{cards:h,rows:Yn(e),unreachable:h.filter(a=>a.error!==""),loading:i.some(a=>a.loaded!==!0)}}var jn=50,An=8,Hn=500;function zn(i,h,e){let a=[h,...i];return a.length>e?a.slice(0,e):a}function Fn(i){if(typeof i!="number"||!Number.isFinite(i))return"--:--:--";let h=new Date(i*1e3);if(Number.isNaN(h.getTime()))return"--:--:--";let e=a=>String(a).padStart(2,"0");return e(h.getHours())+":"+e(h.getMinutes())+":"+e(h.getSeconds())}function Vn(i){let h=typeof i.action=="string"?i.action:"";return h===""?"?":h.indexOf("die")!==0||i.exitCode===null||i.exitCode===void 0?h:h+"("+String(i.exitCode)+")"}function Gn(i,h){let e=null;return{schedule(){e!==null&&clearTimeout(e),e=setTimeout(()=>{e=null,h()},i)},cancel(){e!==null&&(clearTimeout(e),e=null)}}}window.__ModuleLoader__.load({id:"@hyzyn/dsh-docker",factory:i=>{let h=i("react"),{jsx:e,jsxs:a}=i("react/jsx-runtime"),{createRoot:I}=i("react-dom/client"),{useState:k,useEffect:O,useRef:K,useCallback:ke}=h;function Xn(t,r,d){if(r==="")return t;let l=t.toLowerCase(),m=r.toLowerCase(),o=[],p=0,v=l.indexOf(m),s=0;for(;v>=0&&s<500;)v>p&&o.push(t.slice(p,v)),o.push(e("mark",{children:t.slice(v,v+m.length)},d+"-m"+String(s))),p=v+m.length,s+=1,v=l.indexOf(m,p);return p<t.length&&o.push(t.slice(p)),o}function sn(t){let r=Array.isArray(t.rows)?t.rows:[],d=Array.isArray(t.mono)?t.mono:[];return a("div",{className:"dk_kv",children:r.flatMap(([l,m],o)=>[e("div",{className:"dk_kvKey",children:l},"k"+String(o)),e("div",{className:"dk_kvVal"+(d.indexOf(l)>=0?" dk_kvValMono":""),children:m},"v"+String(o))])})}function nt(t){let r=t.health==="unhealthy"?"unhealthy":t.state,d=t.health==="unhealthy"?"\u4E0D\u5065\u5EB7":Wa(t.state);return e("span",{className:"dk_badge","data-state":r,title:t.status??"",children:d})}function G(t){return a("div",{className:"dk_banner","data-kind":t.kind??"error",children:[e("span",{className:"dk_bannerIcon",dangerouslySetInnerHTML:{__html:er}},"icon"),a("div",{className:"dk_bannerBody",children:[e("div",{children:t.title}),t.hint===void 0?null:e("div",{className:"dk_hint",style:{marginTop:4},children:t.hint})]},"body"),t.action===void 0?null:e("div",{className:"dk_bannerAction",children:t.action},"action")]})}function Ht(t,r,d){return a("span",{className:"dk_ovCount","data-state":t,"data-zero":d===0?"1":void 0,children:[e("span",{className:"dk_ovCountValue",children:String(d)}),e("span",{className:"dk_ovCountLabel",children:r})]},t)}function cn(t,r){if(t.cards.length===0)return a("div",{className:"dk_empty",children:[e("div",{className:"dk_emptyTitle",children:"\u8FD8\u6CA1\u6709\u914D\u7F6E Docker \u76EE\u6807"}),e("div",{className:"dk_emptyHint",children:"\u5230 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 Docker \u5BB9\u5668\u9762\u677F \u6DFB\u52A0\u76EE\u6807\u540E\uFF0C\u603B\u89C8\u4F1A\u5728\u8FD9\u91CC\u4E00\u5C4F\u6C47\u603B\u5168\u90E8\u4E3B\u673A\u3002"})]});let d=t.rows.length===0?t.loading?a("div",{className:"dk_empty dk_ovEmpty",children:[e("span",{className:"dk_spin"}),e("div",{children:"\u8BFB\u53D6\u4E2D\u2026"})]},"loading"):a("div",{className:"dk_empty dk_ovEmpty",children:[e("div",{className:"dk_emptyTitle",children:"\u4E00\u5207\u6B63\u5E38"}),e("div",{className:"dk_emptyHint",children:"\u6240\u6709\u76EE\u6807\u4E0A\u90FD\u6CA1\u6709\u4E0D\u5065\u5EB7\u6216\u91CD\u542F\u4E2D\u7684\u5BB9\u5668\u3002"})]},"empty"):e("div",{className:"dk_tableWrap",children:a("table",{className:"dk_images dk_ovTable",children:[e("thead",{children:a("tr",{children:[e("th",{children:"\u5BB9\u5668\u540D"}),e("th",{children:"\u76EE\u6807"}),e("th",{children:"\u72B6\u6001"}),e("th",{children:"\u955C\u50CF"})]})}),e("tbody",{children:t.rows.map(l=>a("tr",{className:"dk_rowClickable",title:"\u6253\u5F00\u5BB9\u5668\u8BE6\u60C5",onClick:()=>r.onOpenContainer(l.target,l.item),children:[e("td",{className:"dk_mono",title:l.item.name,children:l.item.name}),e("td",{children:l.target}),e("td",{children:e(nt,{state:l.item.state,health:l.item.health,status:l.item.status})}),e("td",{className:"dk_mono dk_pathCell",title:l.item.image,children:l.item.image})]},l.target+"\0"+l.item.id))})]})},0);return a("div",{className:"dk_imagesView dk_ovView",children:[t.unreachable.length===0?null:e(G,{title:String(t.unreachable.length)+" \u4E2A\u76EE\u6807\u4E0D\u53EF\u8FBE",hint:t.unreachable.map(l=>l.name+"\uFF1A"+l.error).join("\uFF1B")+"\uFF08\u5176\u4F59\u76EE\u6807\u7684\u6B63\u5E38\u7ED3\u679C\u4E0D\u53D7\u5F71\u54CD\uFF09"},"unreachable"),e("div",{className:"dk_ovCards",children:t.cards.map(l=>a("button",{type:"button",className:"dk_ovCard","data-state":l.error!==""?"error":l.loaded===!0?"ok":"loading",title:l.error===""?"\u5207\u5230\u8BE5\u76EE\u6807\u7684\u5BB9\u5668\u5217\u8868":l.error,onClick:()=>r.onOpenTarget(l.name),children:[a("div",{className:"dk_ovCardHead",children:[e("span",{className:"dk_ovCardName",title:l.label===""?l.name:l.label,children:l.name}),e("span",{className:"dk_badge","data-state":"paused",children:l.kind==="local"?"\u672C\u673A":"SSH"})]},"head"),l.error===""?l.loaded===!0?a("div",{className:"dk_ovCardCounts",children:[Ht("running","\u8FD0\u884C\u4E2D",l.running),Ht("stopped","\u5DF2\u505C\u6B62",l.stopped),Ht("unhealthy","\u4E0D\u5065\u5EB7",l.unhealthy)]},"counts"):a("div",{className:"dk_ovCardLoading",children:[e("span",{className:"dk_spin"}),e("span",{children:"\u8BFB\u53D6\u4E2D\u2026"})]},"loading"):a("div",{className:"dk_ovCardError",children:[e("span",{className:"dk_badge","data-state":"dead",children:"\u4E0D\u53EF\u8FBE"}),e("span",{className:"dk_ovCardErrorText",title:l.error,children:l.error})]},"error")]},l.name))},1),e("div",{className:"dk_ovSection",children:t.rows.length===0?"\u5F02\u5E38\u5BB9\u5668":"\u5F02\u5E38\u5BB9\u5668\uFF08"+String(t.rows.length)+"\uFF09"},2),d]})}function at(t){let r=t.busy===!0;return a("div",{className:"dk_confirmBackdrop",onMouseDown:d=>d.stopPropagation(),children:[a("div",{className:"dk_confirm","data-busy":r?"1":void 0,children:[e("div",{className:"dk_confirmTitle",children:t.title}),e("div",{className:"dk_confirmText",children:t.text}),a("div",{className:"dk_confirmActions",children:[e("button",{type:"button",className:"dk_btn",disabled:r,onClick:t.onCancel,children:"\u53D6\u6D88"}),e("button",{type:"button",className:"dk_btn dk_btnDanger",disabled:r,"aria-busy":r?"true":void 0,onClick:t.onConfirm,children:r?a("span",{className:"dk_confirmBusy",children:[e("span",{className:"dk_spin"}),"\u6267\u884C\u4E2D\u2026"]}):t.confirmLabel})]})]})]})}function lr(t){return e("button",{type:"button",className:"dk_btn"+(t.danger===!0?" dk_btnDanger":""),disabled:t.disabled===!0,title:t.title??"",onClick:r=>{r.stopPropagation(),t.onClick()},children:t.children})}let un=60;function kn(t,r,d){let l=t.concat([r]);return l.length>d?l.slice(l.length-d):l}function gn(t){let r=Array.isArray(t.values)?t.values:[],d=r.filter(S=>typeof S=="number"&&Number.isFinite(S)),l=96,m=22,o=Math.max(Number(t.max)||0,...d,1),p=r.length>1?l/(r.length-1):0,v=[];r.forEach((S,E)=>{if(typeof S!="number"||!Number.isFinite(S))return;let P=p===0?l:E*p,T=m-Math.min(1,Math.max(0,S/o))*m;v.push(P.toFixed(1)+","+T.toFixed(1))});let s=d.length===0?null:d[d.length-1],N=t.alertAt!==void 0&&s!==null&&s>=t.alertAt;return e("span",{className:"dk_spark","data-alert":N?"1":void 0,title:t.title??"",children:v.length<2?e("span",{className:"dk_sparkEmpty",children:"\u91C7\u6837\u4E2D\u2026"}):e("svg",{viewBox:"0 0 "+String(l)+" "+String(m),preserveAspectRatio:"none","aria-hidden":"true",children:e("polyline",{points:v.join(" "),fill:"none",stroke:"currentColor","stroke-width":"1.4","stroke-linejoin":"round","stroke-linecap":"round","vector-effect":"non-scaling-stroke"})})})}function rt(t){return a("div",{className:"dk_cardRow",children:[e("span",{className:"dk_cardLabel",children:t.label}),e("span",{className:"dk_cardValue",title:String(t.value),children:t.value})]})}function J(t){let r=t.disabled===!0,d=t.busy===!0;return e("button",{type:"button",className:"dk_iconBtn"+(t.danger===!0?" dk_iconBtnDanger":""),"data-on":t.on===!0?"1":void 0,"data-spin":t.spin===!0?"1":void 0,"data-busy":d?"1":void 0,"aria-busy":d?"true":void 0,disabled:r,title:t.title,"aria-label":t.title,onClick:l=>{l.stopPropagation(),!r&&t.onClick()},children:d?e("span",{className:"dk_spin"}):e("span",{className:"dk_iconGlyph",dangerouslySetInnerHTML:{__html:t.icon}})})}function Zn(t){let r=t.item,d=t.pickMode===!0,l=t.picked===!0,m=t.allowMutations!==!0,o=r.state==="running"||r.state==="paused"||r.state==="restarting",p=r.createdAt===null?r.runningFor===""?"\u2014":r.runningFor:ft(r.createdAt),v=typeof t.pending=="string"?t.pending:"",s=v!=="",N=E=>s?"\u6B63\u5728\u6267\u884C "+v+"\u2026\u8BF7\u7A0D\u5019":m?"\u9700\u8981\u6253\u5F00\u300C\u5141\u8BB8\u53D8\u66F4\u64CD\u4F5C\u300D":E,S=()=>{if(d){t.onTogglePick(r);return}t.onOpen(r,"overview")};return a("div",{className:"dk_card",role:d?"checkbox":"button","aria-checked":d?l?"true":"false":void 0,tabIndex:0,"data-selected":t.selected===!0?"1":"0","data-pick":d?"1":void 0,"data-picked":l?"1":void 0,"data-pending":s?"1":void 0,onClick:S,onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),S())},children:[a("div",{className:"dk_cardHead",children:[d?e("span",{className:"dk_pick","data-on":l?"1":"0","aria-hidden":"true"},"pick"):null,e("span",{className:"dk_cardName",title:r.name,children:r.name}),e(nt,{state:r.state,health:r.health,status:r.status})]},"head"),a("div",{className:"dk_cardRows",children:[e(rt,{label:"\u955C\u50CF",value:r.image},"image"),e(rt,{label:"ID",value:r.shortId},"id"),e(rt,{label:"\u7AEF\u53E3",value:Mt(r.ports)},"ports"),e(rt,{label:"\u521B\u5EFA",value:p},"created"),r.composeProject===null?null:e(rt,{label:"compose",value:r.composeProject+(r.composeService===null?"":"/"+r.composeService)},"compose")]},"rows"),d?null:a("div",{className:"dk_actionBar",children:[e(J,{icon:Tn,title:"\u5728\u5BB9\u5668\u5185\u6253\u5F00\u4EA4\u4E92\u5F0F\u7EC8\u7AEF\uFF08docker exec -it "+r.name+" sh\uFF09",onClick:()=>t.onExec(r)},"exec"),e(J,{icon:En,title:"\u67E5\u770B\u65E5\u5FD7",onClick:()=>t.onOpen(r,"logs")},"logs"),e(J,{icon:tr,title:"\u8D44\u6E90\u5360\u7528",onClick:()=>t.onOpen(r,"stats")},"stats"),e("span",{className:"dk_actionBarSep","aria-hidden":"true"},"sep"),e(J,{icon:o?Xa:$a,title:N(o?"\u505C\u6B62\u5BB9\u5668":"\u542F\u52A8\u5BB9\u5668"),disabled:m||s,busy:v===(o?"stop":"start"),onClick:()=>t.onAction(o?"stop":"start",r)},"power"),e(J,{icon:Za,title:N("\u91CD\u542F\u5BB9\u5668"),disabled:m||s,busy:v==="restart",onClick:()=>t.onAction("restart",r)},"restart"),e(J,{icon:Dt,danger:!0,title:N("\u5220\u9664\u5BB9\u5668\uFF08\u4E0D\u53EF\u6062\u590D\uFF09"),disabled:m||s,busy:v==="remove",onClick:()=>t.onAction("remove",r)},"remove")]},"actions")]})}let Qn=/^\s*(\[\d{4}-\d{2}-\d{2}[ T][0-9:.,]+\]|\d{2}:\d{2}:\d{2}[,.]\d{3})/,ea=/^\s*(\[(?:TRACE|DEBUG|INFO|WARN|ERROR|FATAL)\]|\|\s*(?:TRACE|DEBUG|INFO|WARN|ERROR|FATAL))/,ta=/(TRACE|DEBUG|INFO|WARN|ERROR|FATAL)/,ot=2e3,Ue=5e3;function hn(t,r,d){let l=[],m=t;for(let o=0;o<2;o+=1){let p=Qn.exec(m);if(p!==null){l.push(e("span",{className:"dk_logTs",children:p[1]},"ts"+String(o))),m=m.slice(p[0].length);continue}let v=ea.exec(m);if(v!==null){let s=ta.exec(v[1]);l.push(e("span",{className:"dk_logLevel","data-level":s===null?"":s[1],children:v[1].trim()},"lv"+String(o))),m=m.slice(v[0].length);continue}break}return l.push(e("span",{className:"dk_logText",children:Xn(m,d,"x"+String(r))},"tx")),l}function na(t,r,d){return a("div",{className:"dk_logLine",children:hn(t,r,d)},String(r))}function aa(t,r,d){return a("div",{className:"dk_logLine",children:[e("span",{className:"dk_logSvc",children:"["+t.service+"]"},"svc"),...hn(t.text,r,d)]},String(r))}function ra(t){let r=t.item,d=t.config,[l,m]=k(t.initialTab??"overview"),[o,p]=k(null),[v,s]=k(""),[N,S]=k({tail:d.logTailDefault,timestamps:!1}),[E,P]=k(null),[T,Y]=k(""),[$,f]=k(!1),[B,C]=k(""),[j,b]=k(!1),[V,u]=k(3),[g,w]=k(!1),[A,ee]=k([]),[R,F]=k(""),[se,Z]=k(""),[Oe,Ne]=k(""),[Ye,vt]=k(!1),[He,ze]=k(!0),ce=K([]),$e=K(""),te=K(null),[le,re]=k(null),[Se,Be]=k(""),[me,Re]=k(!1),[Ce,Xe]=k(""),[Ze,Fe]=k(""),[Ve,dt]=k({cpu:[],mem:[]}),ge=K({cpu:[],mem:[]}),[Le,Gt]=k(""),[Te,Qe]=k(null),[st,Me]=k(""),[be,bt]=k(!1);O(()=>{let _=!0;return p(null),s(""),U.inspect(t.target,r.id).then(L=>{_&&p(L.details?.[0]??null)}).catch(L=>{_&&s(L.message)}),()=>{_=!1}},[t.target,r.id,t.refreshToken]);let he=ke(()=>{f(!0),Y(""),U.logs(t.target,r.id,{tail:N.tail,timestamps:N.timestamps}).then(_=>P(_.logs)).catch(_=>Y(_.message)).finally(()=>f(!1))},[t.target,r.id,N.tail,N.timestamps]);O(()=>{l==="logs"&&he()},[l,he,t.refreshToken]),O(()=>{if(l!=="logs"||!j||g)return;let _=setInterval(he,Math.max(1,V)*1e3);return()=>clearInterval(_)},[l,j,V,he,g]),O(()=>{if(l!=="logs"||!g)return;if(typeof EventSource!="function"){Z("\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301 EventSource\uFF0C\u65E0\u6CD5\u5B9E\u65F6\u8DDF\u968F"),w(!1);return}ce.current=[],$e.current="",ee([]),vt(!1),Z(""),Ne(""),ze(!0),F("connecting");let _=new URLSearchParams({target:t.target,id:r.id,tail:String(N.tail),...N.timestamps?{timestamps:"1"}:{}}),L=new EventSource(ln+"/logs/stream?"+_.toString()),y=!1,H=()=>{if(!y){y=!0;try{L.close()}catch{}}},ie=M=>{if(M==="")return;let D=($e.current+M).split(`
1861
+ `);if($e.current=D.pop()??"",D.length===0)return;let W=ce.current.concat(D),fe=W.length>Ue?W.slice(W.length-Ue):W;ce.current=fe,fe.length!==W.length&&vt(!0),ee(fe)},De=M=>{let D=null;try{D=JSON.parse(M.data)}catch{return}D===null||typeof D!="object"||(typeof D.d=="string"?ie(D.d):typeof D.e=="string"&&ie(D.e))},de=M=>{let D=null;try{D=JSON.parse(M.data)}catch{}let W=D!==null&&typeof D.reason=="string"?D.reason:"container-exit",fe=D!==null&&typeof D.code=="number"?D.code:null;if(W==="container-exit"){Ne("\u5BB9\u5668\u5DF2\u9000\u51FA"+(fe===null?"":"\uFF08\u9000\u51FA\u7801 "+String(fe)+"\uFF09")+"\uFF0C\u65E5\u5FD7\u6D41\u7ED3\u675F\uFF0C\u5DF2\u5207\u56DE\u5FEB\u7167"),H(),w(!1),he();return}F("reconnecting"),Ne("\u670D\u52A1\u7AEF\u5DF2\u505C\u6B62\u65E5\u5FD7\u6D41\uFF0C\u6B63\u5728\u91CD\u8FDE\u2026")},z=M=>{if(typeof M.data=="string"&&M.data!==""){let D="\u65E5\u5FD7\u6D41\u5F02\u5E38";try{let W=JSON.parse(M.data);W!==null&&typeof W.message=="string"&&(D=W.message)}catch{}Z(D),H(),w(!1),he();return}F(L.readyState===2?"closed":"reconnecting")};return L.addEventListener("line",De),L.addEventListener("end",de),L.addEventListener("error",z),L.onopen=()=>{F("open"),Ne("")},H},[l,g,t.target,r.id,N.tail,N.timestamps,he]),O(()=>{if(l!=="logs"||!g||!He)return;let _=te.current;_!==null&&(_.scrollTop=_.scrollHeight)},[l,g,He,A]);let pe=()=>{if(g){w(!1),F(""),he();return}w(!0),b(!1),Z(""),Ne("")},Ee=()=>{if(me){Re(!1),Xe("");return}Re(!0),Fe(""),Be("")},_t=()=>Ce==="open"?"\u5B9E\u65F6\u8DDF\u968F\u4E2D\uFF08docker stats\uFF09":Ce==="connecting"?"\u6B63\u5728\u8FDE\u63A5\u7EDF\u8BA1\u6D41\u2026":Ce==="reconnecting"?"\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u6B63\u5728\u81EA\u52A8\u91CD\u8FDE\u2026":Ce==="closed"?"\u7EDF\u8BA1\u6D41\u5DF2\u65AD\u5F00":"\u7EDF\u8BA1\u6D41",yt=()=>{let _=te.current;_!==null&&(_.scrollTop=_.scrollHeight),ze(!0)},xt=_=>{if(!g)return;let L=_.currentTarget;ze(L.scrollHeight-L.scrollTop-L.clientHeight<24)},Ge=()=>R==="open"?"\u5B9E\u65F6\u8DDF\u968F\u4E2D\uFF08docker logs -f\uFF09":R==="connecting"?"\u6B63\u5728\u8FDE\u63A5\u65E5\u5FD7\u6D41\u2026":R==="reconnecting"?"\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u6B63\u5728\u81EA\u52A8\u91CD\u8FDE\u2026":R==="closed"?"\u65E5\u5FD7\u6D41\u5DF2\u65AD\u5F00":"\u65E5\u5FD7\u6D41";O(()=>{if(l!=="stats"||me)return;let _=!0,L=()=>{U.stats(t.target,[r.id]).then(H=>{_&&(re(H.stats?.[0]??null),Be(""))}).catch(H=>{_&&Be(H.message)})};L();let y=setInterval(L,Math.max(2,d.pollIntervalSec)*1e3);return()=>{_=!1,clearInterval(y)}},[l,me,t.target,r.id,d.pollIntervalSec,t.refreshToken]),O(()=>{if(l!=="stats"||!me)return;if(typeof EventSource!="function"){Fe("\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301 EventSource\uFF0C\u65E0\u6CD5\u5B9E\u65F6\u8DDF\u968F"),Re(!1);return}ge.current={cpu:[],mem:[]},dt({cpu:[],mem:[]}),Xe("connecting"),Fe(""),Be("");let _=new EventSource(Ot("/stats/stream",{target:t.target,ids:r.id})),L=!1,y=()=>{if(!L){L=!0;try{_.close()}catch{}}},H=de=>{let z=null;try{z=JSON.parse(de.data)}catch{return}if(z===null||typeof z!="object")return;let M=typeof z.cpuPercent=="number"?z.cpuPercent:null,D=typeof z.memPercent=="number"?z.memPercent:null;re(z),Be("");let W={cpu:M===null?ge.current.cpu:kn(ge.current.cpu,M,un),mem:D===null?ge.current.mem:kn(ge.current.mem,D,un)};ge.current=W,dt(W)},ie=de=>{let z=null;try{z=JSON.parse(de.data)}catch{}let M=z!==null&&typeof z.reason=="string"?z.reason:"stats-exit",D=z!==null&&typeof z.code=="number"?z.code:null;Fe("\u7EDF\u8BA1\u6D41\u5DF2\u7ED3\u675F"+(M==="stats-exit"?"\uFF08docker stats \u9000\u51FA"+(D===null?"":"\uFF0C\u9000\u51FA\u7801 "+String(D))+"\uFF09":"")+"\uFF0C\u5DF2\u5207\u56DE\u5FEB\u7167\u8F6E\u8BE2"),y(),Re(!1)},De=de=>{if(typeof de.data=="string"&&de.data!==""){let z="\u7EDF\u8BA1\u6D41\u5F02\u5E38";try{let M=JSON.parse(de.data);M!==null&&typeof M.message=="string"&&(z=M.message)}catch{}Be(z),y(),Re(!1);return}Xe(_.readyState===2?"closed":"reconnecting")};return _.addEventListener("stats",H),_.addEventListener("end",ie),_.addEventListener("error",De),_.onopen=()=>{Xe("open"),Fe("")},y},[l,me,t.target,r.id]);let ct=()=>{Le.trim()!==""&&(bt(!0),Me(""),Qe(null),U.exec(t.target,r.id,Le,d.execTimeoutSec).then(_=>Qe(_.result)).catch(_=>Me(_.message)).finally(()=>bt(!1)))},Jt=()=>{if(v!=="")return e(G,{title:"\u8BFB\u53D6\u5BB9\u5668\u8BE6\u60C5\u5931\u8D25",hint:v});if(o===null)return e("div",{className:"dk_empty",children:[e("span",{className:"dk_spin"}),e("div",{children:"\u8BFB\u53D6\u4E2D\u2026"})]});let _=[["\u72B6\u6001",o.state+(o.health===null?"":" / "+o.health)+(o.status===""?"":"\uFF08"+o.status+"\uFF09")],["\u955C\u50CF",o.image],["\u5BB9\u5668 ID",o.shortId],["\u542F\u52A8\u65F6\u95F4",o.startedAt??"\u2014"],["\u7ED3\u675F\u65F6\u95F4",o.finishedAt??"\u2014"],["\u9000\u51FA\u7801",o.exitCode===null?"\u2014":String(o.exitCode)],["\u91CD\u542F\u6B21\u6570",o.restartCount===null?"\u2014":String(o.restartCount)],["\u91CD\u542F\u7B56\u7565",o.restartPolicy??"\u2014"],["PID",o.pid===null?"\u2014":String(o.pid)],["\u7AEF\u53E3",o.ports.length===0?"\u2014":Mt(o.ports)],["\u6302\u8F7D",o.mounts.length===0?"\u2014":o.mounts.map(y=>y.source+"\u2192"+y.destination+(y.readWrite?"":"\uFF08\u53EA\u8BFB\uFF09")).join(`
1862
+ `)],["\u7F51\u7EDC",o.networks.length===0?"\u2014":o.networks.map(y=>y.name+(y.ip===null?"":"\uFF08"+y.ip+"\uFF09")).join(", ")],["\u547D\u4EE4",(o.entrypoint+" "+o.command).trim()||"\u2014"],["\u5DE5\u4F5C\u76EE\u5F55",o.workingDir===""?"\u2014":o.workingDir],["\u7528\u6237",o.user===""?"\u2014":o.user]],L=a("div",{className:"dk_kv",children:_.flatMap(([y,H],ie)=>[e("div",{className:"dk_kvKey",children:y},"k"+String(ie)),e("div",{className:"dk_kvVal"+(y==="\u5BB9\u5668 ID"||y==="\u547D\u4EE4"||y==="\u955C\u50CF"?" dk_kvValMono":""),children:H},"v"+String(ie))])});return a("div",{children:[o.healthLogTail===null?null:e("div",{className:"dk_hint",style:{marginBottom:8},children:"\u6700\u8FD1\u5065\u5EB7\u68C0\u67E5\u8F93\u51FA\uFF1A"+o.healthLogTail}),L,e("div",{className:"dk_cardSection",style:{marginTop:16},children:"\u4E00\u6B21\u6027\u547D\u4EE4\uFF08docker exec\uFF09"}),d.allowExec!==!0?e(G,{kind:"info",title:"exec \u672A\u542F\u7528",hint:"\u5230 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 Docker \u5BB9\u5668\u9762\u677F \u6253\u5F00\u300C\u5141\u8BB8 exec\u300D\uFF0C\u6216\u76F4\u63A5\u590D\u5236\u5361\u7247\u4E0A\u7684 exec \u547D\u4EE4\u5230\u7EC8\u7AEF\u9762\u677F\u4EA4\u4E92\u5F0F\u8FDB\u5165\u5BB9\u5668\u3002"}):a("div",{children:[a("div",{className:"dk_row",children:[e("input",{className:"dk_input",style:{flex:"1 1 auto"},placeholder:"\u5982 ls -la /app \u6216 cat /etc/nginx/nginx.conf",value:Le,onChange:y=>Gt(y.target.value),onKeyDown:y=>{y.key==="Enter"&&ct()}}),e("button",{type:"button",className:"dk_btn dk_btnPrimary",disabled:be,onClick:ct,children:be?"\u6267\u884C\u4E2D\u2026":"\u6267\u884C"})]}),st===""?null:e(G,{title:"\u6267\u884C\u5931\u8D25",hint:st}),Te===null?null:a("div",{style:{marginTop:8},children:[e("div",{className:"dk_hint",children:"\u9000\u51FA\u7801 "+(Te.code===null?"?":String(Te.code))+" \xB7 \u8017\u65F6 "+String(Te.durationMs)+"ms"+(Te.truncated?" \xB7 \u8F93\u51FA\u5DF2\u622A\u65AD":"")}),e("pre",{className:"dk_logBox",style:{marginTop:6},children:(Te.stdout||"")+(Te.stderr===""?"":`
1291
1863
  [stderr]
1292
- `+D.stderr)||"(\u65E0\u8F93\u51FA)"})]})]})]})},ae=()=>{let m=B!==null&&typeof B=="object"&&typeof B.text=="string"?B.text:"",b=O.trim().toLowerCase(),c=m===""?[]:m.split(`
1293
- `),y=b===""?c:c.filter(L=>L.toLowerCase().includes(b));return{raw:m,needle:b,allLines:c,matchedLines:y}},fe=(m,b,c)=>e("button",{type:"button",className:"dk_pill","data-on":m?"1":"0",onClick:c,children:b}),Re=()=>{let{raw:m}=ae(),b=[...new Set([100,200,500,1e3,5e3,Number(d.logTailDefault)||200,Number(N.tail)||200])].filter(c=>Number.isInteger(c)&&c>0).sort((c,y)=>c-y);return o("div",{className:"dk_logTools",children:[e("span",{className:"dk_toolLabel",children:"LINES"}),e("select",{className:"dk_select dk_selectSm",value:String(N.tail),onChange:c=>j({...N,tail:Number(c.target.value)}),children:b.map(c=>e("option",{value:String(c),children:c===5e3?"Last 5000":"Last "+String(c)},String(c)))}),e("span",{className:"dk_toolLabel",children:"TIMESTAMPS"}),fe(N.timestamps,N.timestamps?"On":"Off",()=>j({...N,timestamps:!N.timestamps})),e("span",{className:"dk_toolLabel",children:"AUTO REFRESH"}),fe(T,T?"On":"Off",()=>F(c=>!c)),e("select",{className:"dk_select dk_selectSm",value:String(J),title:"\u81EA\u52A8\u5237\u65B0\u95F4\u9694\uFF08\u5F00\u542F AUTO REFRESH \u540E\u6309\u6B64\u8F6E\u8BE2\uFF09",onChange:c=>i(Number(c.target.value)),children:[2,3,5,10].map(c=>e("option",{value:String(c),children:String(c)+"s"},String(c)))}),e(K,{icon:Ce,title:"\u5237\u65B0\u65E5\u5FD7",spin:Y,onClick:Q},"refresh"),e(K,{icon:Kt,title:"\u4E0B\u8F7D\u65E5\u5FD7",disabled:m==="",onClick:()=>Ht(a.name+".log",m)},"download")]})},_e=()=>{let{needle:m,allLines:b,matchedLines:c}=ae();return o("div",{className:"dk_filterBar",children:[o("div",{className:"dk_filterWrap",children:[e("input",{className:"dk_input dk_filterInput",placeholder:"\u8FC7\u6EE4\u65E5\u5FD7\u2026",value:O,onChange:y=>R(y.target.value),onKeyDown:y=>{y.key==="Escape"&&O!==""&&(y.stopPropagation(),R(""))}}),O===""?null:e("button",{type:"button",className:"dk_filterClear",title:"\u6E05\u7A7A\u8FC7\u6EE4","aria-label":"\u6E05\u7A7A\u8FC7\u6EE4",onClick:()=>R(""),children:e("span",{className:"dk_iconGlyph",dangerouslySetInnerHTML:{__html:Se}})},"clear")]}),e("span",{className:"dk_filterCount",children:m===""?String(b.length)+" \u884C":String(c.length)+" / "+String(b.length)+" \u884C\u5339\u914D"})]})},De=()=>{let{needle:m,matchedLines:b}=ae(),c=b.length>Be?b.slice(-Be):b;return o("div",{className:"dk_logs",children:[C===""?null:e(V,{title:"\u8BFB\u53D6\u65E5\u5FD7\u5931\u8D25",hint:C+(C.includes("Failed to fetch")?"\uFF08\u7F51\u7EDC\u8BF7\u6C42\u6CA1\u5230\u5BBF\u4E3B\uFF1A\u5BBF\u4E3B\u53EF\u80FD\u521A\u91CD\u542F\u3001\u6216\u8FDE\u63A5\u88AB\u4E2D\u65AD\uFF09":""),action:e("button",{type:"button",className:"dk_btn",disabled:Y,onClick:Q,children:"\u91CD\u8BD5"})}),B!==null&&B.truncated===!0?e(V,{kind:"warn",title:"\u65E5\u5FD7\u8F93\u51FA\u8D85\u8FC7\u4E0A\u9650\uFF0C\u5DF2\u622A\u65AD",hint:"\u8C03\u5C0F\u300CLINES\u300D\u6216\u5230\u8BBE\u7F6E\u5361\u7247\u8C03\u5927\u300C\u5355\u6B21\u547D\u4EE4\u8F93\u51FA\u4E0A\u9650\u300D\u3002"}):null,o("div",{className:"dk_logBody",children:[b.length>c.length?e("div",{className:"dk_logLine dk_logMore",children:"\uFF08\u53EA\u663E\u793A\u6700\u8FD1 "+String(Be)+" \u884C\uFF0C\u5171 "+String(b.length)+" \u884C\u5339\u914D\uFF09"},"more"):null,C!==""?null:B===null?e("div",{className:"dk_logLine",children:"\u8BFB\u53D6\u4E2D\u2026"},"loading"):c.length===0?e("div",{className:"dk_logLine",children:m===""?"(\u65E0\u65E5\u5FD7)":"(\u65E0\u5339\u914D\u65E5\u5FD7)"},"empty"):c.map((y,L)=>pt(y,L,m))]})]})},Ae=()=>{if(I!=="")return e(V,{title:"\u8BFB\u53D6\u7EDF\u8BA1\u5931\u8D25",hint:I});if(s===null)return e("div",{className:"dk_empty",children:[e("span",{className:"dk_spin"}),e("div",{children:"\u8BFB\u53D6\u4E2D\u2026"})]});let m=s.cpuPercent??0,b=s.memPercent??0,c=L=>o("div",{className:"dk_bar",children:[e("div",{className:"dk_barFill","data-warn":L>=60&&L<85?"1":void 0,"data-danger":L>=85?"1":void 0,style:{width:Math.min(100,Math.max(0,L))+"%"}})]}),y=(L,xe,Pe)=>o("tr",{children:[e("td",{children:L}),e("td",{className:"dk_num",children:xe}),e("td",{children:Pe??null})]},L);return o("table",{className:"dk_stats",children:[e("thead",{children:o("tr",{children:[e("th",{children:"\u6307\u6807"}),e("th",{children:"\u6570\u503C"}),e("th",{children:"\u5360\u7528"})]})}),e("tbody",{children:[y("CPU",Ot(s.cpuPercent),c(m)),y("\u5185\u5B58",s.memUsage,c(b)),y("\u7F51\u7EDC IO",s.netIO,null),y("\u78C1\u76D8 IO",s.blockIO,null),y("PIDs",s.pids===null?"\u2014":String(s.pids),null)]})]})},He=[["overview","\u6982\u89C8"],["logs","\u65E5\u5FD7"],["stats","\u7EDF\u8BA1"]],ve=k==="overview"?r===null&&x==="":k==="stats"?s===null&&I==="":!1;return o("div",{className:"dk_detail",children:[o("div",{className:"dk_header dk_headerDetail",children:[e(K,{icon:Jt,title:"\u8FD4\u56DE\u5BB9\u5668\u5217\u8868",onClick:t.onBack},"back"),e("span",{className:"dk_detailTitle",title:a.name,children:a.name}),e(We,{state:a.state,health:a.health,status:a.status}),e("span",{className:"dk_detailSub",children:t.targetLabel??""}),e("span",{className:"dk_headerSpacer"}),k==="logs"?Re():e(K,{icon:Ce,title:"\u5237\u65B0",spin:ve,onClick:t.onRefresh},"refresh"),t.docked===!0?null:e("button",{type:"button",className:"dk_iconBtn",title:"\u5173\u95ED\u9762\u677F",onClick:t.onClose,children:e("span",{className:"dk_iconGlyph",dangerouslySetInnerHTML:{__html:Se}})},"close")]}),o("div",{className:"dk_tabs",children:[...He.map(([m,b])=>e("button",{type:"button",className:"dk_tab","data-on":k===m?"1":"0",onClick:()=>w(m),children:b},m)),k==="logs"?e("span",{className:"dk_headerSpacer"},"spacer"):null,k==="logs"?_e():null]}),e("div",{className:"dk_detailBody",children:k==="overview"?W():k==="logs"?De():Ae()})]})}function ft(t){let a=t.collapsed===!0;return o("div",{className:"dk_drawer","data-collapsed":a?"1":void 0,style:a||t.height===null?void 0:{height:String(t.height)+"px"},children:[e("div",{className:"dk_drawerResize",title:"\u62D6\u52A8\u8C03\u6574\u7EC8\u7AEF\u9AD8\u5EA6\uFF08\u53CC\u51FB\u6298\u53E0 / \u5C55\u5F00\uFF09",onMouseDown:t.onResizeStart,onDoubleClick:t.onToggleCollapse},"resize"),o("div",{className:"dk_drawerHead",children:[e("span",{className:"dk_drawerIcon",dangerouslySetInnerHTML:{__html:ot}}),e("span",{className:"dk_drawerTitle",title:t.label,children:t.label}),e("span",{className:"dk_drawerHint",children:a?"\u5DF2\u6298\u53E0 \xB7 \u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C":"\u7531\u7EC8\u7AEF\u9762\u677F\u627F\u8F7D \xB7 \u6298\u53E0\u4FDD\u7559\u4F1A\u8BDD"}),e("span",{className:"dk_headerSpacer"}),e("button",{type:"button",className:"dk_iconBtn dk_drawerFold",title:a?"\u5C55\u5F00\u7EC8\u7AEF\uFF08\u4F1A\u8BDD\u672A\u4E2D\u65AD\uFF09":"\u6298\u53E0\u7EC8\u7AEF\uFF08\u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C\uFF09",onClick:t.onToggleCollapse,children:e("span",{className:"dk_iconGlyph",dangerouslySetInnerHTML:{__html:lt}})},"fold"),e("button",{type:"button",className:"dk_iconBtn",title:"\u7ED3\u675F\u7EC8\u7AEF\u4F1A\u8BDD\u5E76\u6536\u8D77\u62BD\u5C49",onClick:t.onClose,children:e("span",{dangerouslySetInnerHTML:{__html:Se}})},"close")]}),e("div",{className:"dk_drawerBody",ref:t.hostRef})]})}function Ye(t){let[a,d]=h(null),[k,w]=h([]),[r,_]=h(t.initialTarget??""),x=t.sessionHint!==void 0&&(t.initialTarget??"")==="",[f,N]=h("containers"),[j,B]=h([]),[M,C]=h([]),[$,Y]=h(!1),[te,O]=h(""),[R,T]=h(""),[F,J]=h(!0),[i,s]=h(""),[p,I]=h("all"),[q,he]=h(!1),[X,D]=h(null),[be,pe]=h(0),[A,ne]=h(null),[me,Q]=h(""),U=z(!0),[W,ae]=h(null),fe=z(null),[Re,_e]=h(!1),[De,Ae]=h(null),[He,ve]=h(!1),m=z(null),b=z(!1);S(()=>()=>{U.current=!1},[]),S(()=>{if(W===null)return;let n=fe.current;if(n===null)return;let u=null;try{u=Z.mount(n,W.options)}catch(v){T("\u7EC8\u7AEF\u542F\u52A8\u5931\u8D25\uFF1A"+(v instanceof Error?v.message:String(v))),ae(null);return}return()=>{try{u?.()}catch{}}},[W]);let c=n=>{if(n.button!==void 0&&n.button!==0)return;let u=n.currentTarget.parentElement,v=m.current;if(u===null||v===null)return;n.preventDefault();let se=n.clientY,ce=u.getBoundingClientRect().height,H=Math.max(160,Math.round(v.getBoundingClientRect().height*.75)),Ze=Et=>{let It=Math.round(ce+(se-Et.clientY));Ae(Math.min(H,Math.max(160,It)))},et=()=>{document.removeEventListener("mousemove",Ze),document.removeEventListener("mouseup",et),document.body.style.userSelect=""};document.body.style.userSelect="none",document.addEventListener("mousemove",Ze),document.addEventListener("mouseup",et)},y=()=>{if(W===null){t.onClose();return}ve(!0)};S(()=>{P.config().then(n=>{let u=n.config;d(u),!x&&Array.isArray(u.targets)&&u.targets.length>0&&_(v=>v===""?u.targets[0].name:v),Ge(u)}).catch(n=>O(n.message)),P.targets().then(n=>{w(n.targets??[]),Ue=n.targets??[];let u=(n.targets??[])[0];u!==void 0&&!x&&_(v=>v===""?u.name:v)}).catch(()=>{})},[]);let L=oe(()=>{r!==""&&(Y(!0),P.containers(r,F).then(n=>{U.current&&(B(n.containers??[]),O(""))}).catch(n=>{U.current&&O(n.message)}).finally(()=>{U.current&&Y(!1)}))},[r,F]),xe=oe(()=>{r!==""&&(Y(!0),P.images(r).then(n=>{U.current&&(C(n.images??[]),O(""))}).catch(n=>{U.current&&O(n.message)}).finally(()=>{U.current&&Y(!1)}))},[r]),Pe=oe(()=>pe(n=>n+1),[]),ie=oe(()=>{f==="images"?xe():L(),pe(n=>n+1)},[f,L,xe]);S(()=>{r!==""&&ie()},[r,F,f]),S(()=>{if(!q||r===""||f!=="containers")return;let n=setInterval(ie,Math.max(2,a?.pollIntervalSec??5)*1e3);return()=>clearInterval(n)},[q,ie,r,a,f]),S(()=>{if(R==="")return;let n=setTimeout(()=>T(""),4e3);return()=>clearTimeout(n)},[R]);let we=(n,u)=>{let v=rt(n.name);navigator.clipboard.writeText(v).then(()=>{T("\u5DF2\u590D\u5236\uFF1A"+v+(u===void 0?"":"\uFF08"+u+"\uFF09"))}).catch(()=>T("\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u6267\u884C\uFF1A"+v))},Ct=n=>{let u=rt(n.name);if(Z===null){let H=document.querySelector("[data-dsh-tty-entry]")!==null;we(n,H?"\u7EC8\u7AEF\u9762\u677F\u7248\u672C\u8FC7\u65E7\uFF08\u4EA4\u4E92\u5F0F\u8FDB\u5165\u5BB9\u5668\u9700\u8981 dsh-tty \u2265 0.14.0\uFF09\uFF0C\u547D\u4EE4\u5DF2\u590D\u5236\uFF0C\u53EF\u7C98\u8D34\u5230\u7CFB\u7EDF\u7EC8\u7AEF\u6267\u884C":"\u672A\u5B89\u88C5 dsh-tty \u7EC8\u7AEF\u9762\u677F\uFF0C\u547D\u4EE4\u5DF2\u590D\u5236\uFF0C\u53EF\u7C98\u8D34\u5230\u7CFB\u7EDF\u7EC8\u7AEF\u6267\u884C\uFF08\u88C5 dsh-tty \u540E\u53EF\u76F4\u63A5\u5728\u6B64\u5F00\u7EC8\u7AEF\uFF09");return}let v=(a?.targets??[]).find(H=>H.name===r),se=n.name+" \xB7 exec",ce=v===void 0||v.kind==="local"?{command:u,label:se}:typeof v.book=="string"&&v.book!==""?{book:v.book,command:u,label:se}:(v.auth??"agent")==="agent"?{spec:{host:v.host,port:v.port,username:v.username,auth:"agent",agentForward:v.agentForward===!0},command:u,label:se}:null;if(ce===null){we(n,"\u5185\u8054\u76EE\u6807\u7528\u4E86 key/password \u8BA4\u8BC1\uFF0C\u6D4F\u89C8\u5668\u7AEF\u62FF\u4E0D\u5230\u51ED\u8BC1");return}if(t.docked===!0){try{Z.open(ce)}catch(H){we(n,H instanceof Error?H.message:String(H))}return}if(typeof Z.mount=="function"&&Number(Z.version??0)>=2){ae({label:se,options:ce}),_e(!1);return}try{Z.open(ce),t.onClose()}catch(H){we(n,H instanceof Error?H.message:String(H))}},St=(n,u)=>{ne({title:n==="remove"?"\u5220\u9664\u5BB9\u5668":n==="stop"?"\u505C\u6B62\u5BB9\u5668":n==="start"?"\u542F\u52A8\u5BB9\u5668":"\u91CD\u542F\u5BB9\u5668",text:n==="remove"?`\u786E\u5B9A\u5220\u9664\u5BB9\u5668 ${u.name}\uFF1F\u5BB9\u5668\u7684\u53EF\u5199\u5C42\u4E0E\u914D\u7F6E\u4F1A\u88AB\u5220\u9664\uFF08\u547D\u540D\u6570\u636E\u5377\u4FDD\u7559\uFF09\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002`:`\u786E\u5B9A\u5BF9\u5BB9\u5668 ${u.name} \u6267\u884C${n==="stop"?"\u505C\u6B62":n==="start"?"\u542F\u52A8":"\u91CD\u542F"}\u64CD\u4F5C\uFF1F`,confirmLabel:n==="remove"?"\u5220\u9664":"\u786E\u5B9A",run:()=>{ne(null),P.action(r,n,u.id).then(v=>{T(`${v.result.action} ${u.name}\uFF1A${v.result.message}`),ie()}).catch(v=>O(v.message))}})},ye=X===null?null:j.find(n=>n.id===X.id)??X.item,qe=j.filter(n=>{if(p==="running"&&!(n.state==="running"||n.state==="paused"||n.state==="restarting")||p==="stopped"&&n.state==="running"||p==="unhealthy"&&n.health!=="unhealthy")return!1;let u=i.trim().toLowerCase();return u===""?!0:n.name.toLowerCase().includes(u)||n.image.toLowerCase().includes(u)||n.id.toLowerCase().includes(u)}),ze=M.filter(n=>{let u=me.trim().toLowerCase();return u===""||n.reference.toLowerCase().includes(u)||n.id.toLowerCase().includes(u)}),je=n=>{let u=k.find(v=>v.name===n);return u===void 0||u.label===void 0?n:n+" \xB7 "+u.label},Xe=()=>$?e("div",{className:"dk_empty",children:[e("span",{className:"dk_spin"}),e("div",{children:"\u8BFB\u53D6\u4E2D\u2026"})]}):r===""?x?o("div",{className:"dk_empty",children:[e("div",{className:"dk_emptyTitle",children:"\u5F53\u524D\u4F1A\u8BDD\u4E3B\u673A\u8FD8\u4E0D\u662F Docker \u76EE\u6807"}),e("div",{className:"dk_emptyHint",children:"\u6309\u4E0A\u9762\u7684\u63D0\u793A\u5230 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 Docker \u5BB9\u5668\u9762\u677F \u6DFB\u52A0\u4E00\u6761\u76EE\u6807\uFF08\u63A8\u8350\u76F4\u63A5\u9009\u8FDE\u63A5\u7C3F\u6761\u76EE\uFF09\uFF0C\u4FDD\u5B58\u540E\u56DE\u5230\u8FD9\u91CC\u5237\u65B0\u3002\u4E3A\u907F\u514D\u5F20\u51A0\u674E\u6234\uFF0C\u9762\u677F\u4E0D\u4F1A\u81EA\u52A8\u5207\u5230\u5176\u4ED6\u76EE\u6807\u3002"})]}):o("div",{className:"dk_empty",children:[e("div",{className:"dk_emptyTitle",children:"\u8FD8\u6CA1\u6709\u914D\u7F6E Docker \u76EE\u6807"}),e("div",{className:"dk_emptyHint",children:"\u5230 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 Docker \u5BB9\u5668\u9762\u677F \u6DFB\u52A0\u4E00\u4E2A\u76EE\u6807\uFF1A\u672C\u673A\u76F4\u63A5\u9009\u300C\u672C\u673A\u300D\uFF1B\u8FDC\u7A0B\u4E3B\u673A\u53EF\u4EE5\u5F15\u7528 tty \u7EC8\u7AEF\u9762\u677F\u7684\u8FDE\u63A5\u7C3F\u6761\u76EE\u3002"})]}):o("div",{className:"dk_empty",children:[e("div",{className:"dk_emptyTitle",children:f==="images"?"\u6CA1\u6709\u955C\u50CF":"\u6CA1\u6709\u5BB9\u5668"}),e("div",{className:"dk_emptyHint",children:i.trim()===""?"\u76EE\u6807\u4E0A\u6CA1\u6709\u5339\u914D\u7684\u6570\u636E\uFF0C\u6216\u7B5B\u9009\u6761\u4EF6\u8FC7\u7A84\u3002":"\u6CA1\u6709\u5339\u914D\u300C"+i.trim()+"\u300D\u7684\u7ED3\u679C\u3002"})]}),Tt=()=>f==="images"?o("div",{className:"dk_imagesView",children:[ze.length===0?Xe():e("div",{className:"dk_tableWrap",children:o("table",{className:"dk_images",children:[e("thead",{children:o("tr",{children:[e("th",{children:"\u955C\u50CF"}),e("th",{children:"\u5927\u5C0F"}),e("th",{children:"\u521B\u5EFA"}),e("th",{children:"ID"})]})}),e("tbody",{children:ze.map(n=>o("tr",{children:[e("td",{className:"dk_mono",children:n.reference}),e("td",{children:n.sizeText}),e("td",{children:n.createdSince}),e("td",{className:"dk_mono",children:n.shortId})]},n.id+n.reference))})]})})]}):qe.length===0?Xe():e("div",{className:"dk_grid",children:qe.map(n=>e(kt,{item:n,selected:X!==null&&n.id===X.id,allowMutations:a?.allowMutations===!0,onOpen:(u,v)=>D({id:u.id,tab:v,item:u}),onExec:Ct,onAction:St,onCopyExec:u=>{navigator.clipboard.writeText("docker exec -it "+u.name+" sh").then(()=>T("\u5DF2\u590D\u5236\uFF1Adocker exec -it "+u.name+" sh")).catch(()=>T("\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u590D\u5236"))}},n.id))}),re=t.docked===!0,Lt=[ye!==null?[e(mt,{item:ye,target:r,targetLabel:je(r),config:a??{pollIntervalSec:5,logTailDefault:200,allowExec:!1,execTimeoutSec:30},initialTab:X.tab,refreshToken:be,onBack:()=>D(null),onRefresh:Pe,onClose:y,docked:re},"detail"),A===null?null:e(Ie,{title:A.title,text:A.text,confirmLabel:A.confirmLabel,onCancel:()=>ne(null),onConfirm:A.run},"confirm")]:[re?null:o("div",{className:"dk_header",children:[e("span",{className:"dk_titleIcon",dangerouslySetInnerHTML:{__html:dt}}),e("span",{className:"dk_title",children:"Docker \u5BB9\u5668"}),a?.allowMutations===!0?null:e("span",{className:"dk_badge","data-state":"paused",children:"\u53EA\u8BFB\u6A21\u5F0F"}),e("span",{className:"dk_headerSpacer"}),ye!==null?null:e("button",{type:"button",className:"dk_iconBtn",title:"\u5237\u65B0\u5217\u8868","data-spin":$?"1":void 0,onClick:ie,children:e("span",{className:"dk_iconGlyph",dangerouslySetInnerHTML:{__html:Ce}})}),e("button",{type:"button",className:"dk_iconBtn",title:"\u5173\u95ED\u9762\u677F",onClick:y,children:e("span",{dangerouslySetInnerHTML:{__html:Se}})})]}),ye!==null?null:o("div",{className:"dk_toolbar",children:[re?e("button",{type:"button",className:"dk_iconBtn",title:"\u5237\u65B0\u5217\u8868","data-spin":$?"1":void 0,onClick:ie,children:e("span",{className:"dk_iconGlyph",dangerouslySetInnerHTML:{__html:Ce}})},"refresh"):null,re&&a?.allowMutations!==!0?e("span",{className:"dk_badge","data-state":"paused",children:"\u53EA\u8BFB\u6A21\u5F0F"},"readonly"):null,e("select",{className:"dk_select",value:r,onChange:n=>{_(n.target.value),D(null),t.onTargetChange?.(je(n.target.value))},children:[...r===""?[e("option",{value:"",children:"\uFF08\u672A\u9009\u62E9\u76EE\u6807\uFF09"},"__none")]:[],...(k.length===0&&r!==""?[{name:r,label:void 0}]:k).map(n=>e("option",{value:n.name,children:je(n.name)},n.name))]}),e("div",{className:"dk_seg",children:[["containers","\u5BB9\u5668"],["images","\u955C\u50CF"]].map(([n,u])=>e("button",{type:"button",className:"dk_segBtn","data-on":f===n?"1":"0",onClick:()=>{N(n),D(null)},children:u},n))}),f==="containers"?e("input",{className:"dk_input dk_search",placeholder:"\u641C\u7D22\u540D\u79F0 / \u955C\u50CF / ID",value:i,onChange:n=>s(n.target.value)}):null,f==="images"?e("input",{className:"dk_input dk_search",placeholder:"\u641C\u7D22\u955C\u50CF\uFF08\u4ED3\u5E93 / \u6807\u7B7E / ID\uFF09",value:me,onChange:n=>Q(n.target.value)}):null,f==="images"?e("span",{className:"dk_hint dk_searchCount",children:String(ze.length)+" / "+String(M.length)+" \u4E2A\u955C\u50CF"}):null,f==="containers"?e("div",{className:"dk_seg",children:[["all","\u5168\u90E8"],["running","\u8FD0\u884C\u4E2D"],["stopped","\u5DF2\u505C\u6B62"],["unhealthy","\u4E0D\u5065\u5EB7"]].map(([n,u])=>e("button",{type:"button",className:"dk_segBtn","data-on":p===n?"1":"0",onClick:()=>I(n),children:u},n))}):null,f==="containers"?e("label",{className:"dk_check",children:[e("input",{type:"checkbox",checked:F,onChange:n=>J(n.target.checked)}),"\u542B\u5DF2\u505C\u6B62"]}):null,f==="containers"?e("label",{className:"dk_check",children:[e("input",{type:"checkbox",checked:q,onChange:n=>he(n.target.checked)}),"\u81EA\u52A8\u5237\u65B0"]}):null]}),o("div",{className:"dk_body",children:[o("div",{className:"dk_main"+(f==="images"?" dk_mainImages":""),children:[te===""?null:e(V,{title:"\u64CD\u4F5C\u5931\u8D25",hint:te}),R===""?null:e(V,{kind:"info",title:R}),t.sessionHint===void 0?null:e(V,{kind:"info",title:"\u5F53\u524D\u4F1A\u8BDD\u4E3B\u673A\u8FD8\u6CA1\u914D\u7F6E\u4E3A Docker \u76EE\u6807",hint:"\u4F1A\u8BDD\u4E3B\u673A\uFF1A"+t.sessionHint.host+(t.sessionHint.port===22?"":":"+String(t.sessionHint.port))+(t.sessionHint.book===""?"":"\uFF08\u8FDE\u63A5\u7C3F\uFF1A"+t.sessionHint.book+"\uFF09")+" \u2014 \u5230 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 Docker \u5BB9\u5668\u9762\u677F \u6DFB\u52A0\u4E00\u6761 kind=ssh \u76EE\u6807"+(t.sessionHint.book===""?"\uFF08\u586B host/username\uFF0C\u6216\u7528\u8FDE\u63A5\u7C3F\u6761\u76EE\uFF09":"\uFF0C\u76F4\u63A5\u9009\u8FDE\u63A5\u7C3F\u6761\u76EE\u300C"+t.sessionHint.book+"\u300D")+"\uFF0C\u4FDD\u5B58\u540E\u56DE\u5230\u8FD9\u91CC\u5237\u65B0\u5373\u53EF\u3002"}),a!==null&&a.allowMutations!==!0?e(V,{kind:"info",title:"\u5F53\u524D\u4E3A\u53EA\u8BFB\u6A21\u5F0F",hint:"\u542F\u52A8 / \u505C\u6B62 / \u91CD\u542F / \u5220\u9664\u9700\u8981\u5230 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 Docker \u5BB9\u5668\u9762\u677F \u6253\u5F00\u300C\u5141\u8BB8\u53D8\u66F4\u64CD\u4F5C\u300D\u3002"}):null,Tt()]})]}),A===null?null:e(Ie,{title:A.title,text:A.text,confirmLabel:A.confirmLabel,onCancel:()=>ne(null),onConfirm:A.run})],W===null?null:e(ft,{label:W.label,hostRef:fe,collapsed:Re,height:De,onToggleCollapse:()=>_e(n=>!n),onResizeStart:c,onClose:()=>ae(null)},"execDrawer"),He&&W!==null?e(Ie,{title:"\u7ED3\u675F\u5BB9\u5668\u7EC8\u7AEF\u4F1A\u8BDD",text:"\u5173\u95ED\u9762\u677F\u4F1A\u7ED3\u675F\u300C"+W.label+"\u300D\u7684\u7EC8\u7AEF\u4F1A\u8BDD\uFF08docker exec -it \u2026\uFF09\u3002\u82E5\u53EA\u662F\u60F3\u7ED9\u65E5\u5FD7 / \u5217\u8868\u817E\u5730\u65B9\uFF0C\u5148\u70B9\u62BD\u5C49\u53F3\u4E0A\u89D2\u7684\u6298\u53E0\u6309\u94AE\u5373\u53EF\uFF0C\u4F1A\u8BDD\u4F1A\u4FDD\u6301\u8FD0\u884C\u3002",confirmLabel:"\u7ED3\u675F\u5E76\u5173\u95ED",onCancel:()=>ve(!1),onConfirm:()=>{ve(!1),t.onClose()}},"closeConfirm"):null],Qe=o("div",{className:"dk_panel"+(re?" dk_panelDock":""),"data-dock":re?"1":void 0,ref:m,onMouseDown:n=>n.stopPropagation(),children:Lt});return re?Qe:o("div",{className:"dk_backdrop",onMouseDown:n=>{b.current=n.target===n.currentTarget},onMouseUp:n=>{let u=b.current&&n.target===n.currentTarget;b.current=!1,u&&y()},children:[Qe]})}function vt(){let[t,a]=h(!1),[d,k]=h(null),[w,r]=h(!1),[_,x]=h(!1),[f,N]=h({kind:"",text:""}),j=z(0),B=oe(()=>{P.config().then(i=>{k(i.config),Ge(i.config),j.current=Array.isArray(i.config?.targets)?i.config.targets.length:0,r(!0)}).catch(i=>{N({kind:"error",text:"\u8BFB\u53D6\u914D\u7F6E\u5931\u8D25\uFF1A"+i.message}),r(!0)})},[]);S(()=>{t&&!w&&B()},[t,w,B]);let M=i=>k(s=>({...s,...i})),C=(i,s)=>k(p=>{let I=p.targets.slice();return I[i]={...I[i],...s},{...p,targets:I}}),$=()=>k(i=>({...i,targets:[...i.targets,{name:"\u76EE\u6807"+String(i.targets.length+1),kind:"local",book:"",host:"",port:22,username:"",auth:"agent",keyPath:"",agentForward:!1,passwordSet:!1,passphraseSet:!1}]})),Y=i=>k(s=>({...s,targets:s.targets.filter((p,I)=>I!==i)})),te=i=>k(s=>({...s,hostKeys:s.hostKeys.filter(p=>!(p.host===i.host&&p.port===i.port))})),O=()=>{x(!0),N({kind:"",text:""});let i={enabled:d.enabled,announceToAgent:d.announceToAgent,dockerBin:d.dockerBin,allowMutations:d.allowMutations,allowExec:d.allowExec,execTimeoutSec:d.execTimeoutSec,pollIntervalSec:d.pollIntervalSec,logTailDefault:d.logTailDefault,maxOutputKb:d.maxOutputKb,targets:d.targets.map(s=>({name:s.name,kind:s.kind,book:s.book??"",host:s.host??"",port:Number(s.port)||22,username:s.username??"",auth:s.auth??"agent",keyPath:s.keyPath??"",...s.password===void 0||s.password===""?{}:{password:s.password},...s.passphrase===void 0||s.passphrase===""?{}:{passphrase:s.passphrase},agentForward:s.agentForward===!0})),hostKeys:d.hostKeys,...d.targets.length===0&&j.current>0?{clearTargets:!0}:{}};P.saveConfig(i).then(s=>{k(s.config),Ge(s.config),j.current=Array.isArray(s.config?.targets)?s.config.targets.length:0,Te(),N(s.warning===void 0?{kind:"ok",text:"\u5DF2\u4FDD\u5B58\u5E76\u70ED\u751F\u6548"}:{kind:"error",text:s.warning})}).catch(s=>{N({kind:"error",text:"\u4FDD\u5B58\u5931\u8D25\uFF1A"+s.message})}).finally(()=>x(!1))},R=i=>e("div",{className:"dk_cardSection",children:i}),T=(i,s,p,I)=>o("div",{className:"dk_field","data-span":I===void 0?void 0:String(I),children:[e("span",{className:"dk_label",children:i}),s,p===void 0?null:e("span",{className:"dk_hint",children:p})]}),F=(i,s,p,I)=>e("input",{className:"dk_input",type:"number",min:s,max:p,value:d[i],onChange:q=>M({[i]:Number(q.target.value)})}),J=i=>o("li",{className:"dk_settingsCard"+(t?" dk_settingsCardOpen":""),children:[o("button",{type:"button",className:"dk_settingsHead","aria-expanded":t,onClick:()=>a(s=>!s),children:[o("span",{className:"dk_settingsHeadText",children:[e("span",{className:"dk_settingsName",children:"Docker \u5BB9\u5668\u9762\u677F"}),e("span",{className:"dk_settingsDesc",children:"\u672C\u673A / SSH \u4E3B\u673A\u4E0A\u7684\u5BB9\u5668\u4E0E\u955C\u50CF\uFF1B\u9ED8\u8BA4\u53EA\u8BFB\uFF0C\u53D8\u66F4\u64CD\u4F5C\u9700\u663E\u5F0F\u5F00\u542F"})]}),e("span",{className:"dshkit_badge",children:"Kit"}),e("span",{className:"dk_settingsChevron",dangerouslySetInnerHTML:{__html:lt}})]}),t?e("div",{className:"dk_settingsBody",children:i}):null]});return J(t?!w||d===null?o("div",{className:"dk_row",children:[e("span",{className:"dk_spin"}),"\u8BFB\u53D6\u914D\u7F6E\u2026"]}):[R("\u57FA\u672C"),o("div",{className:"dk_row",children:[e("label",{className:"dk_check",children:[e("input",{type:"checkbox",checked:d.enabled,onChange:i=>M({enabled:i.target.checked})}),"\u542F\u7528\u63D2\u4EF6"]}),e("label",{className:"dk_check",children:[e("input",{type:"checkbox",checked:d.announceToAgent,onChange:i=>M({announceToAgent:i.target.checked})}),"\u5411 agent \u516C\u544A\u80FD\u529B"]})]}),o("div",{className:"dk_fieldGrid",children:[T("docker CLI",e("input",{className:"dk_input",value:d.dockerBin,onChange:i=>M({dockerBin:i.target.value})}),"\u9ED8\u8BA4 docker\uFF1Bpodman \u53EF\u586B podman"),T("\u7EDF\u8BA1\u5237\u65B0\u95F4\u9694\uFF08\u79D2\uFF09",F("pollIntervalSec",1,60)),T("\u65E5\u5FD7\u9ED8\u8BA4\u884C\u6570",F("logTailDefault",1,5e3)),T("\u8F93\u51FA\u4E0A\u9650\uFF08KB\uFF09",F("maxOutputKb",1,8192)),T("exec \u8D85\u65F6\uFF08\u79D2\uFF09",F("execTimeoutSec",1,120))]}),R("\u80FD\u529B\u5F00\u5173\uFF08\u9ED8\u8BA4\u5173\u95ED\uFF09"),o("div",{className:"dk_row",children:[e("label",{className:"dk_check",children:[e("input",{type:"checkbox",checked:d.allowMutations,onChange:i=>M({allowMutations:i.target.checked})}),"\u5141\u8BB8\u53D8\u66F4\u64CD\u4F5C\uFF08\u542F\u52A8 / \u505C\u6B62 / \u91CD\u542F / \u5220\u9664\uFF09"]}),e("label",{className:"dk_check",children:[e("input",{type:"checkbox",checked:d.allowExec,onChange:i=>M({allowExec:i.target.checked})}),"\u5141\u8BB8 exec\uFF08\u5728\u5BB9\u5668\u5185\u6267\u884C\u547D\u4EE4\uFF09"]})]}),e("span",{className:"dk_hint",children:"docker socket \u7B49\u4EF7\u4E8E\u76EE\u6807\u4E3B\u673A\u7684 root \u6743\u9650\u3002\u5F00\u542F\u540E\uFF0C\u6D4F\u89C8\u5668\u9762\u677F\u4E0E agent \u90FD\u80FD\u6267\u884C\u5BF9\u5E94\u64CD\u4F5C\uFF0C\u8BF7\u53EA\u5728\u53EF\u4FE1\u73AF\u5883\u4E0B\u6253\u5F00\u3002"}),R("\u76EE\u6807"),...d.targets.map((i,s)=>o("div",{className:"dk_targetRow",children:[e("input",{className:"dk_input",value:i.name,placeholder:"\u76EE\u6807\u540D",onChange:p=>C(s,{name:p.target.value})}),e("select",{className:"dk_select",value:i.kind,onChange:p=>C(s,{kind:p.target.value}),children:[e("option",{value:"local",children:"\u672C\u673A"}),e("option",{value:"ssh",children:"SSH \u4E3B\u673A"})]}),i.kind==="local"?e("span",{className:"dk_hint",children:"\u5BBF\u4E3B\u6240\u5728\u673A\u5668\u4E0A\u7684 docker"}):o("div",{className:"dk_row",style:{gridColumn:"span 1"},children:[e("select",{className:"dk_select",value:i.book??"",onChange:p=>C(s,{book:p.target.value}),children:[e("option",{value:"",children:d.ttyBooks.length===0?"\uFF08\u65E0 tty \u8FDE\u63A5\u7C3F\uFF0C\u8BF7\u586B\u5185\u8054\u4FE1\u606F\uFF09":"\uFF08\u4E0D\u7528\u8FDE\u63A5\u7C3F\uFF0C\u624B\u586B\uFF09"}),...d.ttyBooks.map(p=>e("option",{value:p,children:"\u8FDE\u63A5\u7C3F\uFF1A"+p},p))]})]}),e("button",{type:"button",className:"dk_btn dk_btnDanger",onClick:()=>Y(s),children:"\u5220\u9664"}),i.kind==="ssh"&&(i.book??"")===""?o("div",{className:"dk_targetInline",children:[e("input",{className:"dk_input",placeholder:"host",value:i.host??"",onChange:p=>C(s,{host:p.target.value})}),e("input",{className:"dk_input",placeholder:"22",title:"\u7AEF\u53E3",value:i.port??22,onChange:p=>C(s,{port:Number(p.target.value)||22})}),e("input",{className:"dk_input",placeholder:"username",value:i.username??"",onChange:p=>C(s,{username:p.target.value})}),e("select",{className:"dk_select",value:i.auth??"agent",onChange:p=>C(s,{auth:p.target.value}),children:[e("option",{value:"agent",children:"ssh-agent"}),e("option",{value:"key",children:"\u79C1\u94A5"}),e("option",{value:"password",children:"\u5BC6\u7801"})]}),(i.auth??"agent")==="key"?e("input",{className:"dk_input dk_credential",placeholder:"~/.ssh/id_ed25519",value:i.keyPath??"",onChange:p=>C(s,{keyPath:p.target.value})}):null,(i.auth??"agent")==="password"?e("input",{className:"dk_input dk_credential",type:"password",placeholder:i.passwordSet===!0?"\uFF08\u5DF2\u8BBE\u7F6E\uFF0C\u7559\u7A7A\u4FDD\u6301\u4E0D\u53D8\uFF09":"env:SSH_PASSWORD",value:i.password??"",onChange:p=>C(s,{password:p.target.value})}):null,e("label",{className:"dk_check",children:[e("input",{type:"checkbox",checked:i.agentForward===!0,onChange:p=>C(s,{agentForward:p.target.checked})}),"agent forwarding"]})]}):null]},String(s)+i.name)),o("div",{className:"dk_row",children:[e("button",{type:"button",className:"dk_btn",onClick:$,children:"\u6DFB\u52A0\u76EE\u6807"}),e("span",{className:"dk_hint",children:"SSH \u76EE\u6807\u63A8\u8350\u76F4\u63A5\u9009 tty \u7EC8\u7AEF\u9762\u677F\u7684\u8FDE\u63A5\u7C3F\u6761\u76EE\uFF08\u51ED\u8BC1\u53EA\u9700\u7EF4\u62A4\u4E00\u5904\uFF09\uFF1B\u624B\u586B\u65F6\u5BC6\u7801 / \u53E3\u4EE4\u5EFA\u8BAE\u5199 env:VAR\u3002"})]}),R("SSH \u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08TOFU\uFF09"),...d.hostKeys.length===0?[e("span",{className:"dk_hint",children:"\u6682\u65E0\u8BB0\u5F55 \u2014 \u9996\u6B21 SSH \u8FDE\u63A5\u6210\u529F\u540E\u81EA\u52A8\u8BB0\u5F55\u4E3B\u673A\u6307\u7EB9\uFF08\u82E5 tty \u5DF2\u8BB0\u5F55\u540C\u4E00\u4E3B\u673A\uFF0C\u4F1A\u76F4\u63A5\u590D\u7528\uFF09\u3002"},"none")]:d.hostKeys.map(i=>o("div",{className:"dk_targetRow",children:[e("span",{children:i.host+":"+String(i.port)}),e("span",{className:"dk_hint",style:{gridColumn:"span 2",wordBreak:"break-all"},children:"sha256:"+i.fingerprint}),e("button",{type:"button",className:"dk_btn",onClick:()=>te(i),children:"\u5220\u9664"})]},i.host+":"+String(i.port))),e("span",{className:"dk_hint",children:"\u6307\u7EB9\u53D8\u66F4\u65F6\u8FDE\u63A5\u4F1A\u88AB\u62D2\u7EDD\uFF08\u9632\u4E2D\u95F4\u4EBA\uFF09\uFF1B\u786E\u8BA4\u5B89\u5168\u540E\u5220\u9664\u5BF9\u5E94\u8BB0\u5F55\u5373\u53EF\u91CD\u8FDE\u3002"}),o("div",{className:"dk_row",children:[e("button",{type:"button",className:"dk_btn dk_btnPrimary",disabled:_,onClick:O,children:_?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58"}),e("span",{className:"dk_msg","data-kind":f.kind,children:f.text})]})]:null)}let ue=null,le=null,Me=null;function ge(){let t=le,a=ue,d=Me;if(le=null,ue=null,Me=null,a!==null&&a.remove(),t!==null&&setTimeout(()=>{try{t.unmount()}catch{}},0),d!==null)try{d.dispose()}catch{}}function bt(t){return t!==null&&typeof t=="object"&&typeof t.appendChild=="function"}function _t(){return typeof de?.mountPane=="function"&&typeof de.isOpen=="function"&&Number(de.version??0)>=1&&de.isOpen()===!0}function Je(t){ge(),Fe();let a={onClose:ge,initialTarget:t?.target??"",sessionHint:t?.sessionHint};if(_t()){let d=null;try{d=de.mountPane({title:"Docker \u5BB9\u5668",hint:t?.target===void 0||t.target===""?"":t.target,size:520,min:360,onClose:()=>ge()})}catch(k){d=null,console.warn("[dsh-docker] \u6302\u8F7D\u5230\u7EC8\u7AEF\u9762\u677F\u5931\u8D25\uFF0C\u56DE\u9000\u5F39\u7A97\uFF1A"+(k instanceof Error?k.message:String(k)))}if(d!==null&&bt(d.element)){Me=d,le=E(d.element),le.render(e(Ye,{...a,docked:!0,onTargetChange:k=>{try{d.setHint(k)}catch{}}}));return}}ue=document.createElement("div"),document.body.appendChild(ue),le=E(ue),le.render(e(Ye,a))}function xt(){let t=document.querySelector('[data-pane="sidebar"], [class*="sidebarCol"]');if(t!==null)return t.querySelector('[class*="logoRow"]')?.parentElement??t.firstElementChild}function wt(t){let a=t.querySelector('button[class*="newSession"]');if(a!==null)return a;for(let d of t.children)if(d.tagName==="BUTTON")return d}function yt(){let t=document.createElement("div");return t.dataset.dshDockerEntry="",t.className="dk_sidebarEntry",t.setAttribute("role","button"),t.setAttribute("aria-label","\u5BB9\u5668"),t.innerHTML='<span class="dk_entryIcon">'+dt+'</span><span class="dk_entryLabel">\u5BB9\u5668</span>',t.addEventListener("click",a=>{a.preventDefault(),Je()}),t}function $e(t,a){let d=wt(t);if(d===void 0)return!1;if(a.parentElement!==t){let k=d.closest('[class*="logoRow"]'),w=k!==null&&k.parentElement===t?k:d,r=Array.from(t.children).filter(_=>_ instanceof HTMLElement&&_.matches("[data-dsh-global-search-entry], [data-dsh-rss-entry], [data-dsh-taskboard-entry], [data-dsh-ssh-entry], [data-dsh-tty-entry], [data-dsh-docker-entry]"));if(r.length>0){let _=r[r.length-1];t.insertBefore(a,_.nextSibling)}else t.insertBefore(a,w.nextElementSibling)}return!0}function Nt(){if(Fe(),document.querySelector("[data-dsh-docker-entry]")!==null)return()=>{};let t=yt(),a,d=!1,k=()=>{if(a!==void 0&&!a.isConnected&&(r.disconnect(),a=void 0,d=!1),d){if(document.body.contains(t))return;r.disconnect(),a=void 0,d=!1}a??(a=xt()),a!==void 0&&(d=$e(a,t),d&&r.observe(a,{childList:!0,subtree:!0}))},w=new MutationObserver(()=>{k()});w.observe(document.body,{childList:!0,subtree:!0});let r=new MutationObserver(()=>{if(a===void 0||!a.isConnected){d=!1,k();return}a.contains(t)||(d=$e(a,t))});return k(),()=>{w.disconnect(),r.disconnect(),t.remove()}}let Oe={};return Oe.inject=["slots"],Oe.apply=t=>{Fe();let a=!1,d=()=>{};Le={set(r){if(r!==a){if(a=r,r){d=Nt();return}d(),d=()=>{},ge(),typeof Ne?.requestRender=="function"&&Ne.requestRender()}}},it(!0);let k=t.slots.inject("settings.plugin.item",()=>t.slots.register({name:"settings.plugin.item",key:"docker",order:102},vt));t.inject(["ttyTerminal"],r=>(Z=r.ttyTerminal??null,()=>{Z=null})),t.inject(["ttyPanel"],r=>(de=r.ttyPanel??null,()=>{de=null}));let w=()=>{};return Te(),t.inject(["ttyConnbar"],r=>{let _=r.ttyConnbar;_!==void 0&&(Ne=_,w=_.addAction(x=>{if(!Ee)return;let f=x?.spec??{};if(f.t!=="ssh")return;let N=typeof x?.bookName=="string"?x.bookName:"",j=Ke(f,N),B=j!==void 0?`\u6253\u5F00\u8BE5\u4E3B\u673A\u7684 Docker \u5BB9\u5668\u9762\u677F\uFF08\u76EE\u6807\uFF1A${j}\uFF09`:ee===null?"\u6253\u5F00\u5F53\u524D\u4F1A\u8BDD\u4E3B\u673A\u7684 Docker \u5BB9\u5668\u9762\u677F":"\u8BE5\u4E3B\u673A\u5C1A\u672A\u914D\u7F6E\u4E3A Docker \u76EE\u6807 \u2014 \u70B9\u51FB\u6253\u5F00\u9762\u677F\u67E5\u770B/\u914D\u7F6E";x.addAction(zt,"\u5BB9\u5668",B,()=>{(async()=>{let M=await Pt(f,N),C=Number(f.port);Je({target:M??"",sessionHint:M===void 0?{host:typeof f.host=="string"?f.host:"",port:Number.isInteger(C)&&C>0?C:22,book:N}:void 0})})()})}),(async()=>{for(let x=0;x<3;x+=1){if(await Te()){typeof _.requestRender=="function"&&_.requestRender();return}await new Promise(f=>setTimeout(f,2e3))}})())}),()=>{w(),k(),Le=null,Ee=!1,Ne=null,d(),ge()}},Oe}});})();
1864
+ `+Te.stderr)||"(\u65E0\u8F93\u51FA)"})]})]})]})},et=()=>{let _=g?A.join(`
1865
+ `):E!==null&&typeof E=="object"&&typeof E.text=="string"?E.text:"",L=B.trim().toLowerCase(),y=_===""?[]:_.split(`
1866
+ `),H=L===""?y:y.filter(ie=>ie.toLowerCase().includes(L));return{raw:_,needle:L,allLines:y,matchedLines:H}},tt=(_,L,y,H)=>e("button",{type:"button",className:"dk_pill"+(H?.className??""),"data-on":_?"1":"0",disabled:H?.disabled===!0,title:H?.title??"",onClick:y,children:L}),wt=()=>{let{raw:_}=et(),L=[...new Set([100,200,500,1e3,5e3,Number(d.logTailDefault)||200,Number(N.tail)||200])].filter(y=>Number.isInteger(y)&&y>0).sort((y,H)=>y-H);return a("div",{className:"dk_logTools",children:[e("span",{className:"dk_toolLabel",children:"LINES"}),e("select",{className:"dk_select dk_selectSm",value:String(N.tail),onChange:y=>S({...N,tail:Number(y.target.value)}),children:L.map(y=>e("option",{value:String(y),children:y===5e3?"Last 5000":"Last "+String(y)},String(y)))}),e("span",{className:"dk_toolLabel",children:"TIMESTAMPS"}),tt(N.timestamps,N.timestamps?"On":"Off",()=>S({...N,timestamps:!N.timestamps})),e("span",{className:"dk_toolLabel",children:"FOLLOW"}),tt(g,g?"On":"Off",pe,{className:" dk_pillFollow",title:g?"\u5173\u95ED\u5B9E\u65F6\u8DDF\u968F\uFF08\u56DE\u5230\u65E5\u5FD7\u5FEB\u7167\uFF09":"\u5B9E\u65F6\u8DDF\u968F\u5BB9\u5668\u65E5\u5FD7\uFF08docker logs -f\uFF09"}),e("span",{className:"dk_toolLabel",children:"AUTO REFRESH"}),tt(j,j?"On":"Off",()=>b(y=>!y),{disabled:g,title:g?"FOLLOW \u6253\u5F00\u65F6\u6682\u505C\u8F6E\u8BE2":"\u6309\u4E0B\u65B9\u95F4\u9694\u91CD\u65B0\u62C9\u53D6\u65E5\u5FD7\u5FEB\u7167"}),e("select",{className:"dk_select dk_selectSm",value:String(V),disabled:g,title:"\u81EA\u52A8\u5237\u65B0\u95F4\u9694\uFF08\u5F00\u542F AUTO REFRESH \u540E\u6309\u6B64\u8F6E\u8BE2\uFF09",onChange:y=>u(Number(y.target.value)),children:[2,3,5,10].map(y=>e("option",{value:String(y),children:String(y)+"s"},String(y)))}),e(J,{icon:Ke,title:"\u5237\u65B0\u65E5\u5FD7",spin:$,onClick:he},"refresh"),e(J,{icon:Qa,title:"\u4E0B\u8F7D\u65E5\u5FD7",disabled:_==="",onClick:()=>Ua(r.name+".log",_)},"download")]})},Kt=()=>{let{needle:_,allLines:L,matchedLines:y}=et();return a("div",{className:"dk_filterBar",children:[a("div",{className:"dk_filterWrap",children:[e("input",{className:"dk_input dk_filterInput",placeholder:"\u8FC7\u6EE4\u65E5\u5FD7\u2026",value:B,onChange:H=>C(H.target.value),onKeyDown:H=>{H.key==="Escape"&&B!==""&&(H.stopPropagation(),C(""))}}),B===""?null:e("button",{type:"button",className:"dk_filterClear",title:"\u6E05\u7A7A\u8FC7\u6EE4","aria-label":"\u6E05\u7A7A\u8FC7\u6EE4",onClick:()=>C(""),children:e("span",{className:"dk_iconGlyph",dangerouslySetInnerHTML:{__html:we}})},"clear")]}),e("span",{className:"dk_filterCount",children:_===""?String(L.length)+" \u884C":String(y.length)+" / "+String(L.length)+" \u884C\u5339\u914D"})]})},ae=()=>{let{needle:_,matchedLines:L}=et(),y=L.length>ot?L.slice(-ot):L;return a("div",{className:"dk_logs",children:[T===""?null:e(G,{title:"\u8BFB\u53D6\u65E5\u5FD7\u5931\u8D25",hint:T+(T.includes("Failed to fetch")?"\uFF08\u7F51\u7EDC\u8BF7\u6C42\u6CA1\u5230\u5BBF\u4E3B\uFF1A\u5BBF\u4E3B\u53EF\u80FD\u521A\u91CD\u542F\u3001\u6216\u8FDE\u63A5\u88AB\u4E2D\u65AD\uFF09":""),action:e("button",{type:"button",className:"dk_btn",disabled:$,onClick:he,children:"\u91CD\u8BD5"})}),se===""?null:e(G,{title:"\u65E5\u5FD7\u6D41\u4E2D\u65AD",hint:se,action:e("button",{type:"button",className:"dk_btn",onClick:pe,children:"\u91CD\u8BD5"})}),Oe===""?null:e(G,{kind:"info",title:Oe}),Ye?e(G,{kind:"warn",title:"\u65E5\u5FD7\u8D85\u8FC7 "+String(Ue)+" \u884C\uFF0C\u5DF2\u4E22\u5F03\u6700\u65E9\u5185\u5BB9",hint:"\u6D41\u5F0F\u65E5\u5FD7\u53EA\u4FDD\u7559\u6700\u8FD1\u7684\u884C\uFF1B\u9700\u8981\u5B8C\u6574\u5386\u53F2\u8BF7\u7528\u5FEB\u7167\u6216\u300C\u4E0B\u8F7D\u65E5\u5FD7\u300D\u3002"}):null,!g&&E!==null&&E.truncated===!0?e(G,{kind:"warn",title:"\u65E5\u5FD7\u8F93\u51FA\u8D85\u8FC7\u4E0A\u9650\uFF0C\u5DF2\u622A\u65AD",hint:"\u8C03\u5C0F\u300CLINES\u300D\u6216\u5230\u8BBE\u7F6E\u5361\u7247\u8C03\u5927\u300C\u5355\u6B21\u547D\u4EE4\u8F93\u51FA\u4E0A\u9650\u300D\u3002"}):null,g?e("div",{className:"dk_followState","data-state":R,children:Ge()}):null,a("div",{className:"dk_logBody",ref:te,onScroll:xt,children:[L.length>y.length?e("div",{className:"dk_logLine dk_logMore",children:"\uFF08\u53EA\u663E\u793A\u6700\u8FD1 "+String(ot)+" \u884C\uFF0C\u5171 "+String(L.length)+" \u884C\u5339\u914D\uFF09"},"more"):null,T!==""?null:!g&&E===null?e("div",{className:"dk_logLine",children:"\u8BFB\u53D6\u4E2D\u2026"},"loading"):y.length===0?e("div",{className:"dk_logLine",children:g?"\u7B49\u5F85\u65E5\u5FD7\u2026":_===""?"(\u65E0\u65E5\u5FD7)":"(\u65E0\u5339\u914D\u65E5\u5FD7)"},"empty"):y.map((H,ie)=>na(H,ie,_))]}),g&&!He?e("button",{type:"button",className:"dk_backToBottom",onClick:yt,children:"\u56DE\u5230\u5E95\u90E8"}):null]})},q=()=>{let _=me,L=a("div",{className:"dk_statsBar",children:[e("span",{className:"dk_toolLabel",children:"FOLLOW"}),tt(_,_?"On":"Off",Ee,{className:" dk_pillFollow",title:_?"\u5173\u95ED\u5B9E\u65F6\u8DDF\u968F\uFF08\u56DE\u5230 docker stats \u5FEB\u7167\uFF09":"\u5B9E\u65F6\u8DDF\u968F\u8D44\u6E90\u5360\u7528\uFF08docker stats \u6BCF\u79D2\u4E00\u884C\uFF09"}),e("span",{className:"dk_hint",children:_?"60 \u70B9 \u2248 \u6700\u8FD1 1 \u5206\u949F":"\u6253\u5F00 FOLLOW \u770B\u5B9E\u65F6\u8D8B\u52BF"}),e("span",{className:"dk_headerSpacer"}),_?e("span",{className:"dk_followState","data-state":Ce,children:_t()}):null]}),y=M=>a("div",{className:"dk_statsView",children:[L,M]});if(Ze!=="")return y(a("div",{children:[e(G,{kind:"info",title:Ze}),Se===""?null:e(G,{title:"\u8BFB\u53D6\u7EDF\u8BA1\u5931\u8D25",hint:Se})]}));if(Se!=="")return y(e(G,{title:"\u8BFB\u53D6\u7EDF\u8BA1\u5931\u8D25",hint:Se}));if(le===null)return y(e("div",{className:"dk_empty",children:[e("span",{className:"dk_spin"}),e("div",{children:"\u8BFB\u53D6\u4E2D\u2026"})]}));let H=le.cpuPercent??0,ie=le.memPercent??0,De=M=>a("div",{className:"dk_bar",children:[e("div",{className:"dk_barFill","data-warn":M>=60&&M<85?"1":void 0,"data-danger":M>=85?"1":void 0,style:{width:Math.min(100,Math.max(0,M))+"%"}})]}),de=Math.max(100,...Ve.cpu),z=(M,D,W)=>a("tr",{children:[e("td",{children:M}),e("td",{className:"dk_num",children:D}),e("td",{children:W??null})]},M);return y(a("table",{className:"dk_stats",children:[e("thead",{children:a("tr",{children:[e("th",{children:"\u6307\u6807"}),e("th",{children:"\u6570\u503C"}),e("th",{children:"\u5360\u7528 / \u8D8B\u52BF"})]})}),e("tbody",{children:[z("CPU",Ja(le.cpuPercent),a("div",{className:"dk_trend",children:[De(H),_||Ve.cpu.length>0?e(gn,{values:Ve.cpu,max:de,alertAt:85,title:"CPU% \u6700\u8FD1 60 \u4E2A\u91C7\u6837"}):null]})),z("\u5185\u5B58",le.memUsage,a("div",{className:"dk_trend",children:[De(ie),_||Ve.mem.length>0?e(gn,{values:Ve.mem,max:100,alertAt:85,title:"\u5185\u5B58\u5360\u7528% \u6700\u8FD1 60 \u4E2A\u91C7\u6837"}):null]})),z("\u7F51\u7EDC IO",le.netIO,null),z("\u78C1\u76D8 IO",le.blockIO,null),z("PIDs",le.pids===null?"\u2014":String(le.pids),null)]})]}))},Ie=[["overview","\u6982\u89C8"],["logs","\u65E5\u5FD7"],["stats","\u7EDF\u8BA1"]],ut=l==="overview"?o===null&&v==="":l==="stats"?le===null&&Se==="":!1;return a("div",{className:"dk_detail",children:[a("div",{className:"dk_header dk_headerDetail",children:[e(J,{icon:We,title:"\u8FD4\u56DE\u5BB9\u5668\u5217\u8868",onClick:t.onBack},"back"),e("span",{className:"dk_detailTitle",title:r.name,children:r.name}),e(nt,{state:r.state,health:r.health,status:r.status}),e("span",{className:"dk_detailSub",children:t.targetLabel??""}),e("span",{className:"dk_headerSpacer"}),l==="logs"?wt():e(J,{icon:Ke,title:"\u5237\u65B0",spin:ut,onClick:t.onRefresh},"refresh"),t.docked===!0?null:e("button",{type:"button",className:"dk_iconBtn",title:"\u5173\u95ED\u9762\u677F",onClick:t.onClose,children:e("span",{className:"dk_iconGlyph",dangerouslySetInnerHTML:{__html:we}})},"close")]}),a("div",{className:"dk_tabs",children:[...Ie.map(([_,L])=>e("button",{type:"button",className:"dk_tab","data-on":l===_?"1":"0",onClick:()=>m(_),children:L},_)),l==="logs"?e("span",{className:"dk_headerSpacer"},"spacer"):null,l==="logs"?Kt():null]}),e("div",{className:"dk_detailBody",children:l==="overview"?Jt():l==="logs"?ae():q()})]})}function zt(t){return t.dangling===!0?t.id:t.reference}function oa(t){let r=t.item,d=zt(r),[l,m]=k("overview"),[o,p]=k(null),[v,s]=k(""),[N,S]=k(!1),E=ke(()=>{S(!0),s(""),U.imageInspect(t.target,d).then(f=>p(f.image)).catch(f=>s(f.message)).finally(()=>S(!1))},[t.target,d]);O(()=>{E()},[E]);let P=f=>a("div",{className:"dk_kv",children:f.flatMap(([B,C],j)=>[e("div",{className:"dk_kvKey",children:B},"k"+String(j)),e("div",{className:"dk_kvVal"+(["ID","\u5165\u53E3","digest"].indexOf(B)>=0?" dk_kvValMono":""),children:C},"v"+String(j))])}),T=()=>{if(v!=="")return e(G,{title:"\u8BFB\u53D6\u955C\u50CF\u8BE6\u60C5\u5931\u8D25",hint:v,action:e("button",{type:"button",className:"dk_btn",onClick:E,children:"\u91CD\u8BD5"})});if(o===null)return e("div",{className:"dk_empty",children:[e("span",{className:"dk_spin"}),e("div",{children:"\u8BFB\u53D6\u4E2D\u2026"})]});let f=o.detail,B=[["\u6807\u7B7E",f.repoTags.length===0?"<none>\uFF08dangling\uFF09":f.repoTags.join(`
1867
+ `)],["ID",f.id],["\u5927\u5C0F",f.size===null?"\u2014":Bt(f.size)],["\u542B\u7236\u5C42",f.virtualSize===null?"\u2014":Bt(f.virtualSize)],["\u521B\u5EFA",f.created===""?"\u2014":ft(f.created)],["\u5E73\u53F0",f.os===""&&f.architecture===""?"\u2014":f.os+"/"+f.architecture],["\u5C42\u6570",String(f.layerCount)],["\u5165\u53E3",(f.entrypoint+" "+f.command).trim()||"\u2014"],["\u5DE5\u4F5C\u76EE\u5F55",f.workingDir===""?"\u2014":f.workingDir],["\u7528\u6237",f.user===""?"\u2014":f.user],["\u66B4\u9732\u7AEF\u53E3",f.exposedPorts.length===0?"\u2014":f.exposedPorts.join(", ")],["digest",f.repoDigests.length===0?"\u2014":f.repoDigests.join(`
1868
+ `)]],C=Object.entries(f.labels);return a("div",{children:[P(B),e("div",{className:"dk_cardSection",style:{marginTop:16},children:"\u5C42\uFF08"+String(f.layerCount)+"\uFF09"}),f.layers.length===0?e("span",{className:"dk_hint",children:"\u8BE5\u955C\u50CF\u6CA1\u6709\u5C42\u4FE1\u606F\uFF08scratch \u6784\u5EFA\u6216\u65E7\u7248 docker\uFF09\u3002"}):e("div",{className:"dk_layerList",children:f.layers.map((j,b)=>a("div",{className:"dk_layerItem",children:[e("span",{className:"dk_layerIndex",children:"#"+String(b)}),e("span",{className:"dk_mono dk_layerId",title:j,children:j.replace(/^sha256:/,"")})]},j+String(b)))}),C.length===0?null:a("div",{children:[e("div",{className:"dk_cardSection",style:{marginTop:16},children:"\u6807\u7B7E\uFF08"+String(C.length)+"\uFF09"}),e("div",{className:"dk_labelList",children:C.map(([j,b])=>a("div",{className:"dk_labelItem",children:[e("span",{className:"dk_labelKey",children:j}),e("span",{className:"dk_labelVal",title:b,children:b})]},j))})]})]})},Y=()=>v!==""?e(G,{title:"\u8BFB\u53D6\u955C\u50CF\u8BE6\u60C5\u5931\u8D25",hint:v}):o===null?e("div",{className:"dk_empty",children:[e("span",{className:"dk_spin"}),e("div",{children:"\u8BFB\u53D6\u4E2D\u2026"})]}):o.historyError!==null?e(G,{kind:"warn",title:"\u8BFB\u53D6\u6784\u5EFA\u5386\u53F2\u5931\u8D25",hint:o.historyError}):o.history.length===0?a("div",{className:"dk_empty",children:[e("div",{className:"dk_emptyTitle",children:"\u6CA1\u6709\u6784\u5EFA\u5386\u53F2"}),e("div",{className:"dk_emptyHint",children:"\u8BE5 docker \u7248\u672C\u65E2\u6CA1\u6709 history --format\uFF08\u9700\u8981 Docker \u2265 26\uFF09\uFF0C\u7EAF\u6587\u672C\u8868\u683C\u4E5F\u6CA1\u89E3\u6790\u51FA\u5185\u5BB9\u3002"})]}):e("div",{className:"dk_tableWrap",children:a("table",{className:"dk_images dk_historyTable",children:[e("thead",{children:a("tr",{children:[e("th",{children:"\u5C42 ID"}),e("th",{children:"\u521B\u5EFA"}),e("th",{children:"\u5927\u5C0F"}),e("th",{children:"\u6784\u5EFA\u547D\u4EE4"})]})}),e("tbody",{children:o.history.map((f,B)=>a("tr",{children:[e("td",{className:"dk_mono",children:f.shortId}),e("td",{children:f.createdSince===""?f.created===""?"\u2014":ft(f.created):f.createdSince}),e("td",{children:f.sizeText===""?f.size===null?"\u2014":Bt(f.size):f.sizeText}),e("td",{className:"dk_mono dk_historyCmd",title:f.createdBy,children:f.createdBy===""?"\u2014":f.createdBy})]},String(B)))})]})}),$=[["overview","\u6982\u89C8"],["history","\u6784\u5EFA\u5386\u53F2"]];return a("div",{className:"dk_detail",children:[a("div",{className:"dk_header dk_headerDetail",children:[e(J,{icon:We,title:"\u8FD4\u56DE\u955C\u50CF\u5217\u8868",onClick:t.onBack},"back"),e("span",{className:"dk_detailTitle",title:d,children:d}),r.dangling===!0?e("span",{className:"dk_badge","data-state":"paused",children:"dangling"}):null,e("span",{className:"dk_detailSub",children:t.targetLabel??""}),e("span",{className:"dk_headerSpacer"}),e(J,{icon:Ke,title:"\u5237\u65B0\u955C\u50CF\u8BE6\u60C5",spin:N,onClick:E},"refresh"),t.docked===!0?null:e("button",{type:"button",className:"dk_iconBtn",title:"\u5173\u95ED\u9762\u677F",onClick:t.onClose,children:e("span",{className:"dk_iconGlyph",dangerouslySetInnerHTML:{__html:we}})},"close")]}),e("div",{className:"dk_tabs",children:$.map(([f,B])=>e("button",{type:"button",className:"dk_tab","data-on":l===f?"1":"0",onClick:()=>m(f),children:B},f))}),e("div",{className:"dk_detailBody",children:l==="overview"?T():Y()})]})}function la(t){let r=t.item,d=r.name,[l,m]=k("overview"),[o,p]=k(null),[v,s]=k(""),[N,S]=k(!1),[E,P]=k(!1),[T,Y]=k(!1),[$,f]=k(""),B=ke(()=>{S(!0),s(""),U.networkInspect(t.target,d).then(u=>p(u.network)).catch(u=>s(u.message)).finally(()=>S(!1))},[t.target,d]);O(()=>{B()},[B]);let C=()=>{Y(!0),f(""),U.networkRemove(t.target,d).then(u=>t.onRemoved(u.result.message)).catch(u=>{P(!1),f(u.message)}).finally(()=>Y(!1))},j=()=>{if(v!=="")return e(G,{title:"\u8BFB\u53D6\u7F51\u7EDC\u8BE6\u60C5\u5931\u8D25",hint:v,action:e("button",{type:"button",className:"dk_btn",onClick:B,children:"\u91CD\u8BD5"})});if(o===null)return e("div",{className:"dk_empty",children:[e("span",{className:"dk_spin"}),e("div",{children:"\u8BFB\u53D6\u4E2D\u2026"})]});let u=o.detail,g=[["\u540D\u79F0",u.name],["ID",u.id],["\u9A71\u52A8",u.driver===""?"\u2014":u.driver],["\u8303\u56F4",u.scope===""?"\u2014":u.scope],["\u521B\u5EFA",u.created===""?"\u2014":ft(u.created)],["\u5B50\u7F51",u.subnets.length===0?"\u2014":u.subnets.map(w=>w.subnet===""?"\u2014":w.subnet).join(`
1869
+ `)],["\u7F51\u5173",u.subnets.length===0?"\u2014":u.subnets.map(w=>w.gateway===""?"\u2014":w.gateway).join(`
1870
+ `)],["\u5C5E\u6027",[u.internal?"internal":"",u.attachable?"attachable":"",u.ingress?"ingress":"",u.enableIpv6?"ipv6":""].filter(w=>w!=="").join(" \xB7 ")||"\u2014"],["\u9009\u9879",Object.keys(u.options).length===0?"\u2014":Object.entries(u.options).map(([w,A])=>w+"="+A).join(`
1871
+ `)],["\u6807\u7B7E",Object.keys(u.labels).length===0?"\u2014":Object.entries(u.labels).map(([w,A])=>w+"="+A).join(`
1872
+ `)]];return e(sn,{rows:g,mono:["ID","\u5B50\u7F51","\u7F51\u5173","\u9009\u9879","\u6807\u7B7E"]})},b=()=>{if(v!=="")return e(G,{title:"\u8BFB\u53D6\u7F51\u7EDC\u8BE6\u60C5\u5931\u8D25",hint:v});if(o===null)return e("div",{className:"dk_empty",children:[e("span",{className:"dk_spin"}),e("div",{children:"\u8BFB\u53D6\u4E2D\u2026"})]});let u=o.detail.containers;return u.length===0?e("div",{className:"dk_empty",children:[e("div",{className:"dk_emptyTitle",children:"\u6CA1\u6709\u5BB9\u5668\u63A5\u5165\u8FD9\u4E2A\u7F51\u7EDC"})]}):e("div",{className:"dk_tableWrap",children:a("table",{className:"dk_images",children:[e("thead",{children:a("tr",{children:[e("th",{children:"\u5BB9\u5668"}),e("th",{children:"IPv4"}),e("th",{children:"IPv6"}),e("th",{children:"MAC"})]})}),e("tbody",{children:u.map(g=>a("tr",{children:[e("td",{className:"dk_mono",title:g.id,children:g.name===""?g.shortId:g.name}),e("td",{className:"dk_mono",children:g.ipv4===""?"\u2014":g.ipv4}),e("td",{className:"dk_mono",children:g.ipv6===""?"\u2014":g.ipv6}),e("td",{className:"dk_mono",children:g.mac===""?"\u2014":g.mac})]},g.id))})]})})},V=[["overview","\u6982\u89C8"],["containers","\u63A5\u5165\u7684\u5BB9\u5668"+(o===null?"":"\uFF08"+String(o.detail.containers.length)+"\uFF09")]];return a("div",{className:"dk_detail",children:[a("div",{className:"dk_header dk_headerDetail",children:[e(J,{icon:We,title:"\u8FD4\u56DE\u7F51\u7EDC\u5217\u8868",onClick:t.onBack},"back"),e("span",{className:"dk_projectIcon",dangerouslySetInnerHTML:{__html:rr}}),e("span",{className:"dk_detailTitle",title:d,children:d}),r.internal===!0?e("span",{className:"dk_badge","data-state":"paused",children:"internal"}):null,e("span",{className:"dk_detailSub",children:t.targetLabel??""}),e("span",{className:"dk_headerSpacer"}),e(J,{icon:Ke,title:"\u5237\u65B0\u7F51\u7EDC\u8BE6\u60C5",spin:N,onClick:B},"refresh"),e(J,{icon:Dt,danger:!0,disabled:t.allowMutations!==!0,title:t.allowMutations===!0?"\u5220\u9664\u7F51\u7EDC\uFF08\u4E0D\u53EF\u6062\u590D\uFF09":"\u5220\u9664\u7F51\u7EDC\u9700\u8981\u6253\u5F00\u300C\u5141\u8BB8\u53D8\u66F4\u64CD\u4F5C\u300D",onClick:()=>P(!0)},"remove"),t.docked===!0?null:e("button",{type:"button",className:"dk_iconBtn",title:"\u5173\u95ED\u9762\u677F",onClick:t.onClose,children:e("span",{className:"dk_iconGlyph",dangerouslySetInnerHTML:{__html:we}})},"close")]}),e("div",{className:"dk_tabs",children:V.map(([u,g])=>e("button",{type:"button",className:"dk_tab","data-on":l===u?"1":"0",onClick:()=>m(u),children:g},u))}),a("div",{className:"dk_detailBody",children:[$===""?null:e(G,{title:"\u5220\u9664\u7F51\u7EDC\u5931\u8D25",hint:$}),l==="overview"?j():b()]}),E?e(at,{title:"\u5220\u9664\u7F51\u7EDC",text:"\u786E\u5B9A\u5220\u9664\u7F51\u7EDC "+d+"\uFF1F\u8FD8\u6709\u5BB9\u5668\u63A5\u7740\u65F6 docker \u4F1A\u62D2\u7EDD\uFF1B\u5220\u9664\u540E\u4F9D\u8D56\u5B83\u7684\u5BB9\u5668\u4F1A\u5931\u53BB\u7F51\u7EDC\uFF0C\u9700\u8981\u91CD\u65B0\u521B\u5EFA\u6216\u63A5\u5165\u522B\u7684\u7F51\u7EDC\u3002",confirmLabel:"\u5220\u9664",busy:T,onCancel:()=>P(!1),onConfirm:C},"confirm"):null]})}function ia(t){let d=t.item.name,[l,m]=k(null),[o,p]=k(""),[v,s]=k(!1),[N,S]=k(!1),[E,P]=k(!1),[T,Y]=k(""),$=ke(()=>{s(!0),p(""),U.volumeInspect(t.target,d).then(C=>m(C.volume)).catch(C=>p(C.message)).finally(()=>s(!1))},[t.target,d]);O(()=>{$()},[$]);let f=()=>{P(!0),Y(""),U.volumeRemove(t.target,d).then(C=>t.onRemoved(C.result.message)).catch(C=>{S(!1),Y(C.message)}).finally(()=>P(!1))},B=()=>{if(o!=="")return e(G,{title:"\u8BFB\u53D6\u5377\u8BE6\u60C5\u5931\u8D25",hint:o,action:e("button",{type:"button",className:"dk_btn",onClick:$,children:"\u91CD\u8BD5"})});if(l===null)return e("div",{className:"dk_empty",children:[e("span",{className:"dk_spin"}),e("div",{children:"\u8BFB\u53D6\u4E2D\u2026"})]});let C=l.detail,j=[["\u540D\u79F0",C.name],["\u9A71\u52A8",C.driver===""?"\u2014":C.driver],["\u8303\u56F4",C.scope===""?"\u2014":C.scope],["\u6302\u8F7D\u70B9",C.mountpoint===""?"\u2014":C.mountpoint],["\u521B\u5EFA",C.created===""?"\u2014":ft(C.created)],["\u9009\u9879",Object.keys(C.options).length===0?"\u2014":Object.entries(C.options).map(([b,V])=>b+"="+V).join(`
1873
+ `)],["\u6807\u7B7E",Object.keys(C.labels).length===0?"\u2014":Object.entries(C.labels).map(([b,V])=>b+"="+V).join(`
1874
+ `)]];return e(sn,{rows:j,mono:["\u6302\u8F7D\u70B9","\u9009\u9879","\u6807\u7B7E"]})};return a("div",{className:"dk_detail",children:[a("div",{className:"dk_header dk_headerDetail",children:[e(J,{icon:We,title:"\u8FD4\u56DE\u5377\u5217\u8868",onClick:t.onBack},"back"),e("span",{className:"dk_projectIcon",dangerouslySetInnerHTML:{__html:or}}),e("span",{className:"dk_detailTitle",title:d,children:d}),e("span",{className:"dk_detailSub",children:t.targetLabel??""}),e("span",{className:"dk_headerSpacer"}),e(J,{icon:Ke,title:"\u5237\u65B0\u5377\u8BE6\u60C5",spin:v,onClick:$},"refresh"),e(J,{icon:Dt,danger:!0,disabled:t.allowMutations!==!0,title:t.allowMutations===!0?"\u5220\u9664\u5377\uFF08\u5377\u91CC\u7684\u6570\u636E\u4F1A\u4E00\u8D77\u6CA1\uFF0C\u4E0D\u53EF\u6062\u590D\uFF09":"\u5220\u9664\u5377\u9700\u8981\u6253\u5F00\u300C\u5141\u8BB8\u53D8\u66F4\u64CD\u4F5C\u300D",onClick:()=>S(!0)},"remove"),t.docked===!0?null:e("button",{type:"button",className:"dk_iconBtn",title:"\u5173\u95ED\u9762\u677F",onClick:t.onClose,children:e("span",{className:"dk_iconGlyph",dangerouslySetInnerHTML:{__html:we}})},"close")]}),a("div",{className:"dk_detailBody",children:[T===""?null:e(G,{title:"\u5220\u9664\u5377\u5931\u8D25",hint:T}),B()]}),N?e(at,{title:"\u5220\u9664\u5377",text:"\u786E\u5B9A\u5220\u9664\u5377 "+d+"\uFF1F\u5377\u91CC\u7684\u6570\u636E\u4F1A\u4E00\u8D77\u5220\u9664\u4E14\u4E0D\u53EF\u6062\u590D\uFF1B\u8FD8\u6709\u5BB9\u5668\u5360\u7528\u65F6 docker \u4F1A\u62D2\u7EDD\u3002",confirmLabel:"\u5220\u9664",busy:E,onCancel:()=>S(!1),onConfirm:f},"confirm"):null]})}let da=2e3;function sa(t,r,d){let l=d+r,m=l.split(/\r\n|\r|\n/),o="";/[\r\n]$/.test(l)||(o=m.pop()??"");let p=t.slice();for(let v of m){let s=v.trim();if(s==="")continue;let N=/^([0-9a-f]{6,}|[A-Za-z][A-Za-z0-9 _-]*?):\s/.exec(s),S=N===null?null:N[1];S!==null&&p.length>0&&p[p.length-1].key===S?p[p.length-1]={key:S,text:s}:p.push({key:S,text:s}),p.length>da&&p.shift()}return{lines:p,pending:o}}function ca(t){let[r,d]=k(""),[l,m]=k(!1),[o,p]=k([]),[v,s]=k(""),[N,S]=k(""),[E,P]=k(null),T=K(""),Y=K([]),$=K(""),f=K(null);O(()=>{if(!l)return;if(typeof EventSource!="function"){S("\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301 EventSource\uFF0C\u65E0\u6CD5\u663E\u793A\u62C9\u53D6\u8FDB\u5EA6"),m(!1);return}s("connecting");let b=new EventSource(Ot("/images/pull/stream",{target:t.target,ref:T.current})),V=!1,u=()=>{if(!V){V=!0;try{b.close()}catch{}}},g=ee=>{let R=null;try{R=JSON.parse(ee.data)}catch{return}if(R===null||typeof R!="object")return;let F=typeof R.d=="string"?R.d:typeof R.e=="string"?R.e:"";if(F==="")return;let se=sa(Y.current,F,$.current);Y.current=se.lines,$.current=se.pending,p(se.lines)},w=ee=>{let R=null;try{R=JSON.parse(ee.data)}catch{}let F=R!==null&&typeof R.code=="number"?R.code:null;P(F),m(!1),s(F===0?"\u62C9\u53D6\u5B8C\u6210":"\u62C9\u53D6\u7ED3\u675F\uFF08\u9000\u51FA\u7801 "+String(F===null?"?":F)+"\uFF09"),F===0&&t.onDone?.()},A=ee=>{if(typeof ee.data=="string"&&ee.data!==""){let R="\u62C9\u53D6\u5931\u8D25";try{let F=JSON.parse(ee.data);F!==null&&typeof F.message=="string"&&(R=F.message)}catch{}S(R),m(!1),s("");return}s(b.readyState===2?"closed":"reconnecting")};return b.addEventListener("line",g),b.addEventListener("end",w),b.addEventListener("error",A),b.onopen=()=>s("open"),()=>{u(),$.current=""}},[l,t.target]),O(()=>{let b=f.current;b!==null&&(b.scrollTop=b.scrollHeight)},[o]);let B=()=>{let b=r.trim();b===""||l||(T.current=b,Y.current=[],$.current="",p([]),S(""),P(null),s(""),m(!0))},C=()=>{m(!1),s("\u5DF2\u505C\u6B62")},j=()=>v==="open"?"\u6B63\u5728\u62C9\u53D6\uFF08docker pull\uFF09\u2026":v==="connecting"?"\u6B63\u5728\u8FDE\u63A5\u62C9\u53D6\u6D41\u2026":v==="reconnecting"?"\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u6B63\u5728\u81EA\u52A8\u91CD\u8FDE\u2026":v==="closed"?"\u62C9\u53D6\u6D41\u5DF2\u65AD\u5F00":v;return a("div",{className:"dk_detail",children:[a("div",{className:"dk_header dk_headerDetail",children:[e(J,{icon:We,title:"\u8FD4\u56DE\u955C\u50CF\u5217\u8868",onClick:t.onBack},"back"),e("span",{className:"dk_detailTitle",children:"\u62C9\u53D6\u955C\u50CF"}),e("span",{className:"dk_detailSub",children:t.targetLabel??""}),e("span",{className:"dk_headerSpacer"}),t.docked===!0?null:e("button",{type:"button",className:"dk_iconBtn",title:"\u5173\u95ED\u9762\u677F",onClick:t.onClose,children:e("span",{className:"dk_iconGlyph",dangerouslySetInnerHTML:{__html:we}})},"close")]}),a("div",{className:"dk_detailBody dk_pullBody",children:[t.allowMutations!==!0?e(G,{kind:"info",title:"\u62C9\u53D6\u955C\u50CF\u9700\u8981\u6253\u5F00\u300C\u5141\u8BB8\u53D8\u66F4\u64CD\u4F5C\u300D",hint:"docker pull \u4F1A\u5199\u5165\u76EE\u6807\u673A\u7684\u955C\u50CF\u5B58\u50A8\u5E76\u5360\u7528\u78C1\u76D8\u4E0E\u5E26\u5BBD\u3002\u5230 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 Docker \u5BB9\u5668\u9762\u677F \u6253\u5F00\u300C\u5141\u8BB8\u53D8\u66F4\u64CD\u4F5C\u300D\u540E\u5373\u53EF\u5728\u6B64\u62C9\u53D6\u3002"}):a("div",{className:"dk_row",children:[e("input",{className:"dk_input",style:{flex:"1 1 auto"},placeholder:"\u955C\u50CF\u5F15\u7528\uFF0C\u5982 nginx:1.27 \u6216 ghcr.io/org/app:latest",value:r,disabled:l,onChange:b=>d(b.target.value),onKeyDown:b=>{b.key==="Enter"&&B()}}),l?e("button",{type:"button",className:"dk_btn dk_btnDanger",onClick:C,children:"\u505C\u6B62"}):e("button",{type:"button",className:"dk_btn dk_btnPrimary",disabled:t.allowMutations!==!0,onClick:B,children:"\u62C9\u53D6"})]}),N===""?null:e(G,{title:"\u62C9\u53D6\u5931\u8D25",hint:N}),v===""?null:e("div",{className:"dk_hint",children:j()+(E===null?"":" \xB7 \u9000\u51FA\u7801 "+String(E))}),a("div",{className:"dk_pullBox",ref:f,children:[o.length===0?e("div",{className:"dk_pullLine",children:l?"\u7B49\u5F85 docker pull \u8F93\u51FA\u2026":"\u586B\u5199\u955C\u50CF\u5F15\u7528\u540E\u70B9\u300C\u62C9\u53D6\u300D\uFF0C\u9010\u5C42\u8FDB\u5EA6\u4F1A\u5B9E\u65F6\u51FA\u73B0\u5728\u8FD9\u91CC\u3002"}):o.map((b,V)=>e("div",{className:"dk_pullLine","data-key":b.key??void 0,children:b.text},String(V)))]})]})]})}function Ft(t){let r=new Map;for(let d of t){let l=d.composeProject===null?"":d.composeProject,m=r.get(l);m===void 0&&(m={project:l,items:[]},r.set(l,m)),m.items.push(d)}return[...r.values()]}let pn=t=>t==="running"||t==="paused"||t==="restarting";function ua(t){return e("div",{className:"dk_projects",children:t.groups.map(r=>{let d=r.items.filter(p=>pn(p.state)).length,l=r.items.filter(p=>p.health==="unhealthy").length,m=[...new Set(r.items.map(p=>p.composeService===null?p.name:p.composeService))],o=r.project===""?"\uFF08\u975E compose \u5BB9\u5668\uFF09":r.project;return a("div",{className:"dk_project",role:"button",tabIndex:0,onClick:()=>t.onOpen(r.project),onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),t.onOpen(r.project))},children:[a("div",{className:"dk_projectHead",children:[e("span",{className:"dk_projectIcon",dangerouslySetInnerHTML:{__html:In}}),e("span",{className:"dk_projectName",title:o,children:o}),e("span",{className:"dk_badge","data-state":d===r.items.length?"running":d===0?"exited":"paused",children:String(d)+" / "+String(r.items.length)+" \u8FD0\u884C\u4E2D"}),l>0?e("span",{className:"dk_badge","data-state":"unhealthy",children:String(l)+" \u4E0D\u5065\u5EB7"}):null,e("span",{className:"dk_headerSpacer"}),e("span",{className:"dk_hint",children:String(m.length)+" \u4E2A\u670D\u52A1"})]}),e("div",{className:"dk_projectRows",children:r.items.map(p=>a("div",{className:"dk_projectRow",children:[e("span",{className:"dk_projectSvc",children:p.composeService===null?"\u2014":p.composeService}),e("span",{className:"dk_projectContainer",title:p.name,children:p.name}),e(nt,{state:p.state,health:p.health,status:p.status}),e("span",{className:"dk_projectImage",title:p.image,children:p.image}),e("span",{className:"dk_projectPorts",children:Mt(p.ports)})]},p.id))})]},r.project===""?"__ungrouped":r.project)})})}function ka(t){let[r,d]=k("services"),l=t.items,m=t.project===""?"\uFF08\u975E compose \u5BB9\u5668\uFF09":t.project,o=l.filter(s=>pn(s.state)).length,p=()=>e("div",{className:"dk_tableWrap",children:a("table",{className:"dk_images dk_composeTable",children:[e("thead",{children:a("tr",{children:[e("th",{children:"\u670D\u52A1"}),e("th",{children:"\u5BB9\u5668"}),e("th",{children:"\u72B6\u6001"}),e("th",{children:"\u7AEF\u53E3"}),e("th",{children:"\u955C\u50CF"})]})}),e("tbody",{children:l.map(s=>a("tr",{children:[e("td",{children:s.composeService===null?"\u2014":s.composeService}),e("td",{className:"dk_mono",title:s.name,children:s.name}),e("td",{children:e(nt,{state:s.state,health:s.health,status:s.status})}),e("td",{children:Mt(s.ports)}),e("td",{className:"dk_mono",title:s.image,children:s.image})]},s.id))})]})}),v=[["services","\u670D\u52A1"],["logs","\u805A\u5408\u65E5\u5FD7"]];return a("div",{className:"dk_detail",children:[a("div",{className:"dk_header dk_headerDetail",children:[e(J,{icon:We,title:"\u8FD4\u56DE Compose \u5217\u8868",onClick:t.onBack},"back"),e("span",{className:"dk_projectIcon",dangerouslySetInnerHTML:{__html:In}}),e("span",{className:"dk_detailTitle",title:m,children:m}),e("span",{className:"dk_badge","data-state":o===l.length?"running":o===0?"exited":"paused",children:String(o)+" / "+String(l.length)+" \u8FD0\u884C\u4E2D"}),e("span",{className:"dk_detailSub",children:t.targetLabel??""}),e("span",{className:"dk_headerSpacer"}),t.docked===!0?null:e("button",{type:"button",className:"dk_iconBtn",title:"\u5173\u95ED\u9762\u677F",onClick:t.onClose,children:e("span",{className:"dk_iconGlyph",dangerouslySetInnerHTML:{__html:we}})},"close")]}),e("div",{className:"dk_tabs",children:v.map(([s,N])=>e("button",{type:"button",className:"dk_tab","data-on":r===s?"1":"0",onClick:()=>d(s),children:N},s))}),e("div",{className:"dk_detailBody",children:r==="services"?p():e(mn,{target:t.target,items:l})})]})}function mn(t){let r=t.items,[d,l]=k([]),[m,o]=k("connecting"),[p,v]=k(""),[s,N]=k(!0),[S,E]=k(!1),P=K([]),T=K(new Map),Y=K(null),$=r.map(b=>b.id).join(",");O(()=>{if(r.length===0){o("empty");return}if(typeof EventSource!="function"){o("unsupported");return}o("connecting"),P.current=[],T.current=new Map,l([]),E(!1);let b=0,V=0,u=r.map(g=>{let w=g.composeService===null?g.name:g.composeService,A=new EventSource(Ot("/logs/stream",{target:t.target,id:g.id,tail:100})),ee=R=>{let se=((T.current.get(g.id)??"")+R).split(`
1875
+ `);if(T.current.set(g.id,se.pop()??""),se.length===0)return;let Z=P.current.concat(se.map(Ne=>({service:w,text:Ne}))),Oe=Z.length>Ue?Z.slice(Z.length-Ue):Z;P.current=Oe,Oe.length!==Z.length&&E(!0),l(Oe)};return A.addEventListener("line",R=>{let F=null;try{F=JSON.parse(R.data)}catch{return}F===null||typeof F!="object"||(typeof F.d=="string"?ee(F.d):typeof F.e=="string"&&ee(F.e))}),A.addEventListener("end",()=>{try{A.close()}catch{}V+=1,V>=r.length&&o("closed")}),A.addEventListener("error",R=>{typeof R.data=="string"&&R.data!==""?o("partial"):o("reconnecting")}),A.onopen=()=>{b+=1,o("open")},()=>{try{A.close()}catch{}}});return()=>{for(let g of u)g()}},[t.target,$]),O(()=>{if(!s)return;let b=Y.current;b!==null&&(b.scrollTop=b.scrollHeight)},[s,d]);let f=p.trim().toLowerCase(),B=f===""?d:d.filter(b=>b.text.toLowerCase().indexOf(f)>=0||b.service.toLowerCase().indexOf(f)>=0),C=B.length>ot?B.slice(-ot):B,j=()=>m==="open"?"\u5DF2\u8FDE\u63A5 "+String(r.length)+" \u6761\u5BB9\u5668\u65E5\u5FD7\u6D41\uFF08docker logs -f\uFF09":m==="connecting"?"\u6B63\u5728\u8FDE\u63A5\u5BB9\u5668\u65E5\u5FD7\u6D41\u2026":m==="reconnecting"?"\u90E8\u5206\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u6B63\u5728\u81EA\u52A8\u91CD\u8FDE\u2026":m==="partial"?"\u90E8\u5206\u5BB9\u5668\u65E5\u5FD7\u6D41\u51FA\u9519":m==="closed"?"\u5168\u90E8\u5BB9\u5668\u65E5\u5FD7\u6D41\u5DF2\u7ED3\u675F":m==="unsupported"?"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301 EventSource":m==="empty"?"\u8BE5\u9879\u76EE\u6CA1\u6709\u53EF\u805A\u5408\u7684\u5BB9\u5668":"\u805A\u5408\u65E5\u5FD7";return a("div",{className:"dk_logs",children:[S?e(G,{kind:"warn",title:"\u805A\u5408\u65E5\u5FD7\u8D85\u8FC7 "+String(Ue)+" \u884C\uFF0C\u5DF2\u4E22\u5F03\u6700\u65E9\u5185\u5BB9"}):null,a("div",{className:"dk_filterBar",children:[a("div",{className:"dk_filterWrap",children:[e("input",{className:"dk_input dk_filterInput",placeholder:"\u8FC7\u6EE4\u670D\u52A1\u540D / \u65E5\u5FD7\u5185\u5BB9\u2026",value:p,onChange:b=>v(b.target.value),onKeyDown:b=>{b.key==="Escape"&&p!==""&&(b.stopPropagation(),v(""))}}),p===""?null:e("button",{type:"button",className:"dk_filterClear",title:"\u6E05\u7A7A\u8FC7\u6EE4",onClick:()=>v(""),children:e("span",{className:"dk_iconGlyph",dangerouslySetInnerHTML:{__html:we}})},"clear")]}),e("button",{type:"button",className:"dk_pill dk_pillFollow","data-on":s?"1":"0",title:s?"\u6682\u505C\u81EA\u52A8\u6EDA\u52A8\uFF08\u65E5\u5FD7\u7EE7\u7EED\u63A5\u6536\uFF09":"\u6062\u590D\u81EA\u52A8\u6EDA\u52A8",onClick:()=>N(b=>!b),children:s?"\u81EA\u52A8\u6EDA\u52A8":"\u5DF2\u6682\u505C"}),e("span",{className:"dk_filterCount",children:f===""?String(d.length)+" \u884C":String(B.length)+" / "+String(d.length)+" \u884C\u5339\u914D"})]}),e("div",{className:"dk_followState","data-state":m==="open"?"open":m==="closed"?"closed":"connecting",children:j()}),e("div",{className:"dk_logBody",ref:Y,children:[C.length===0?e("div",{className:"dk_logLine",children:m==="open"?"\u7B49\u5F85\u65E5\u5FD7\u2026":j()},"empty"):C.map((b,V)=>aa(b,V,f))]})]})}function ga(t,r){let d=typeof t.image=="string"?t.image:"",l=typeof t.composeProject=="string"?t.composeProject:"";return a("span",{className:"dk_activityItem","data-action":String(t.action??"").split(":")[0].trim(),title:l===""?d:d+" \xB7 "+l,children:[e("span",{className:"dk_activityTime",children:Fn(t.time)}),e("span",{className:"dk_activityName",children:t.name}),e("span",{className:"dk_activityAction",children:Vn(t)})]},String(r)+String(t.name)+String(t.time))}function ha(t){let r=t.open===!0,d=Array.isArray(t.events)?t.events:[],l=d.slice(0,An);return a("div",{className:"dk_activity","data-open":r?"1":"0",children:[e("button",{type:"button",className:"dk_activityHead","aria-expanded":r,title:"\u5BB9\u5668\u4E8B\u4EF6\u6D3B\u52A8\uFF08docker events\uFF09\uFF1A\u70B9\u51FB\u6298\u53E0 / \u5C55\u5F00",onClick:t.onToggle,children:[e("span",{className:"dk_activityTitle",children:"\u6D3B\u52A8"}),e("span",{className:"dk_activityState","data-state":t.status??"",children:t.statusText??""}),e("span",{className:"dk_headerSpacer"}),e("span",{className:"dk_hint",children:d.length===0?"\u6682\u65E0\u4E8B\u4EF6":"\u6700\u8FD1 "+String(l.length)+" / "+String(d.length)+" \u6761"}),e("span",{className:"dk_activityChevron",dangerouslySetInnerHTML:{__html:Qt}})]}),r===!1?null:l.length===0?e("div",{className:"dk_activityEmpty",children:"\u6682\u65E0\u4E8B\u4EF6\uFF08\u5BB9\u5668\u7684 start / die / health \u7B49\u52A8\u4F5C\u4F1A\u51FA\u73B0\u5728\u8FD9\u91CC\uFF09"}):e("div",{className:"dk_activityList",children:l.map(ga)})]})}function pa(t){let r=t.info;return a("div",{className:"dk_pickBar",children:[e("span",{className:"dk_pickCount",children:"\u5DF2\u9009 "+String(t.count)+" \u4E2A\u5BB9\u5668"}),r.hint===""?null:e("span",{className:"dk_hint dk_pickHint",children:r.hint}),e("span",{className:"dk_headerSpacer"}),e("button",{type:"button",className:"dk_btn dk_btnPrimary",disabled:r.canRun!==!0,title:r.hint!==""?r.hint:r.canRun===!0?"\u628A\u6240\u9009\u5BB9\u5668\u7684\u65E5\u5FD7\u805A\u5408\u6210\u4E00\u6761\u6D41":"\u81F3\u5C11\u9009\u62E9 2 \u4E2A\u5BB9\u5668",onClick:t.onRun,children:"\u805A\u5408\u65E5\u5FD7"}),e("button",{type:"button",className:"dk_btn",onClick:t.onCancel,children:"\u53D6\u6D88"})]})}function ma(t){return a("div",{className:"dk_detail",children:[a("div",{className:"dk_header dk_headerDetail",children:[e(J,{icon:We,title:"\u8FD4\u56DE\u5BB9\u5668\u5217\u8868\uFF08\u9000\u51FA\u9009\u62E9\u6001\uFF09",onClick:t.onBack},"back"),e("span",{className:"dk_projectIcon",dangerouslySetInnerHTML:{__html:En}}),e("span",{className:"dk_detailTitle",children:"\u805A\u5408\u65E5\u5FD7 \xB7 "+String(t.items.length)+" \u4E2A\u5BB9\u5668"}),e("span",{className:"dk_detailSub",children:t.targetLabel??""}),e("span",{className:"dk_headerSpacer"}),t.docked===!0?null:e("button",{type:"button",className:"dk_iconBtn",title:"\u5173\u95ED\u9762\u677F",onClick:t.onClose,children:e("span",{className:"dk_iconGlyph",dangerouslySetInnerHTML:{__html:we}})},"close")]}),e("div",{className:"dk_detailBody",children:e(mn,{target:t.target,items:t.items})})]})}function fa(t){let r=t.collapsed===!0;return a("div",{className:"dk_drawer","data-collapsed":r?"1":void 0,style:r||t.height===null?void 0:{height:String(t.height)+"px"},children:[e("div",{className:"dk_drawerResize",title:"\u62D6\u52A8\u8C03\u6574\u7EC8\u7AEF\u9AD8\u5EA6\uFF08\u53CC\u51FB\u6298\u53E0 / \u5C55\u5F00\uFF09",onMouseDown:t.onResizeStart,onDoubleClick:t.onToggleCollapse},"resize"),a("div",{className:"dk_drawerHead",children:[e("span",{className:"dk_drawerIcon",dangerouslySetInnerHTML:{__html:Tn}}),e("span",{className:"dk_drawerTitle",title:t.label,children:t.label}),e("span",{className:"dk_drawerHint",children:r?"\u5DF2\u6298\u53E0 \xB7 \u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C":"\u7531\u7EC8\u7AEF\u9762\u677F\u627F\u8F7D \xB7 \u6298\u53E0\u4FDD\u7559\u4F1A\u8BDD"}),e("span",{className:"dk_headerSpacer"}),e("button",{type:"button",className:"dk_iconBtn dk_drawerFold",title:r?"\u5C55\u5F00\u7EC8\u7AEF\uFF08\u4F1A\u8BDD\u672A\u4E2D\u65AD\uFF09":"\u6298\u53E0\u7EC8\u7AEF\uFF08\u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C\uFF09",onClick:t.onToggleCollapse,children:e("span",{className:"dk_iconGlyph",dangerouslySetInnerHTML:{__html:Qt}})},"fold"),e("button",{type:"button",className:"dk_iconBtn",title:"\u7ED3\u675F\u7EC8\u7AEF\u4F1A\u8BDD\u5E76\u6536\u8D77\u62BD\u5C49",onClick:t.onClose,children:e("span",{dangerouslySetInnerHTML:{__html:we}})},"close")]}),e("div",{className:"dk_drawerBody",ref:t.hostRef})]})}function fn(t){let[r,d]=k(null),[l,m]=k([]),[o,p]=k(t.initialTarget??""),v=t.sessionHint!==void 0&&(t.initialTarget??"")==="",[s,N]=k("containers"),[S,E]=k([]),[P,T]=k([]),[Y,$]=k([]),[f,B]=k([]),[C,j]=k([]),[b,V]=k(null),[u,g]=k(null),[w,A]=k(null),[ee,R]=k(null),[F,se]=k(!1),[Z,Oe]=k(!1),[Ne,Ye]=k([]),[vt,He]=k(!1),[ze,ce]=k(!1),[$e,te]=k(""),[le,re]=k(""),[Se,Be]=k(!0),[me,Re]=k(""),[Ce,Xe]=k("all"),[Ze,Fe]=k(!1),[Ve,dt]=k([]),[ge,Le]=k(""),[Gt,Te]=k(!0),Qe=K(null),st=K(""),[Me,be]=k(null),[bt,he]=k(0),[pe,Ee]=k(null),[_t,yt]=k(!1),[xt,Ge]=k({}),[ct,Jt]=k(""),[et,tt]=k(""),[wt,Kt]=k(""),ae=K(!0),q=K(null);q.current===null&&(q.current=Dn());let[Ie,ut]=k(null),_=K(null),[L,y]=k(!1),[H,ie]=k(null),[De,de]=k(!1),z=K(null),M=K(!1);O(()=>()=>{ae.current=!1},[]),O(()=>{if(Ie===null)return;let n=_.current;if(n===null)return;let c=null;try{c=Pe.mount(n,Ie.options)}catch(x){re("\u7EC8\u7AEF\u542F\u52A8\u5931\u8D25\uFF1A"+(x instanceof Error?x.message:String(x))),ut(null);return}return()=>{try{c?.()}catch{}}},[Ie]);let D=n=>{if(n.button!==void 0&&n.button!==0)return;let c=n.currentTarget.parentElement,x=z.current;if(c===null||x===null)return;n.preventDefault();let Q=n.clientY,oe=c.getBoundingClientRect().height,ne=Math.max(160,Math.round(x.getBoundingClientRect().height*.75)),Tt=ue=>{let xe=Math.round(oe+(Q-ue.clientY));ie(Math.min(ne,Math.max(160,xe)))},Et=()=>{document.removeEventListener("mousemove",Tt),document.removeEventListener("mouseup",Et),document.body.style.userSelect=""};document.body.style.userSelect="none",document.addEventListener("mousemove",Tt),document.addEventListener("mouseup",Et)},W=()=>{if(Ie===null){t.onClose();return}de(!0)};O(()=>{U.config().then(n=>{let c=n.config;d(c),!v&&Array.isArray(c.targets)&&c.targets.length>0&&p(x=>x===""?c.targets[0].name:x),Zt(c)}).catch(n=>te(n.message)),U.targets().then(n=>{m(n.targets??[]),dn=n.targets??[];let c=(n.targets??[])[0];c!==void 0&&!v&&p(x=>x===""?c.name:x)}).catch(()=>{})},[]);let fe=ke(()=>{if(o==="")return Promise.resolve();let n=q.current.next();return ce(!0),U.containers(o,Se).then(c=>{!ae.current||!q.current.isCurrent(n)||(E(c.containers??[]),te(""))}).catch(c=>{ae.current&&q.current.isCurrent(n)&&te(c.message)}).finally(()=>{ae.current&&q.current.isCurrent(n)&&ce(!1)})},[o,Se]),kt=ke(()=>{if(o==="")return Promise.resolve();let n=q.current.next();return ce(!0),U.images(o).then(c=>{!ae.current||!q.current.isCurrent(n)||($(c.images??[]),te(""))}).catch(c=>{ae.current&&q.current.isCurrent(n)&&te(c.message)}).finally(()=>{ae.current&&q.current.isCurrent(n)&&ce(!1)})},[o]),Nt=ke(()=>{if(o==="")return Promise.resolve();let n=q.current.next();return ce(!0),U.networks(o).then(c=>{!ae.current||!q.current.isCurrent(n)||(B(c.networks??[]),te(""))}).catch(c=>{ae.current&&q.current.isCurrent(n)&&te(c.message)}).finally(()=>{ae.current&&q.current.isCurrent(n)&&ce(!1)})},[o]),St=ke(()=>{if(o==="")return Promise.resolve();let n=q.current.next();return ce(!0),U.volumes(o).then(c=>{!ae.current||!q.current.isCurrent(n)||(j(c.volumes??[]),te(""))}).catch(c=>{ae.current&&q.current.isCurrent(n)&&te(c.message)}).finally(()=>{ae.current&&q.current.isCurrent(n)&&ce(!1)})},[o]),Wt=ke(()=>{if(l.length===0)return T([]),Promise.resolve();let n=q.current.next();ce(!0),T(l.map(Q=>({name:Q.name,kind:Q.kind,label:Q.label,containers:[],error:"",loaded:!1})));let c=l.length,x=()=>{c-=1,c===0&&ae.current&&q.current.isCurrent(n)&&ce(!1)};return Promise.all(l.map(Q=>U.containers(Q.name,!0).then(oe=>{!ae.current||!q.current.isCurrent(n)||T(ne=>tn(ne,Q.name,{containers:oe.containers??[],error:"",loaded:!0}))}).catch(oe=>{!ae.current||!q.current.isCurrent(n)||T(ne=>tn(ne,Q.name,{error:oe instanceof Error?oe.message:String(oe),loaded:!0}))}).finally(x)))},[l]);O(()=>{Qe.current=fe},[fe]);let Sa=ke(()=>he(n=>n+1),[]),_e=ke(()=>{Oe(!1),Ye([]),He(!1)},[]),Ca=()=>{if(Z){_e();return}Ye([]),He(!1),Oe(!0)},La=n=>Ye(c=>Mn(c,n.id));O(()=>{if(!Z)return;let n=c=>{c.key==="Escape"&&_e()};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[Z,_e]),O(()=>{Z&&Ye(n=>Bn(n,S))},[S,Z]);let Ta=n=>{p(n),te(""),N("containers"),be(null),_e(),Ge({}),t.onTargetChange?.(ye(n))},Ea=(n,c)=>{p(n),te(""),N("containers"),_e(),Ge({}),be({id:c.id,tab:"overview",item:c}),t.onTargetChange?.(ye(n))},gt=ke(()=>{s==="overview"?Wt():s==="images"?kt():s==="networks"?Nt():s==="volumes"?St():fe(),he(n=>n+1)},[s,Wt,fe,kt,Nt,St]);O(()=>{s!=="overview"&&o!==""&&gt()},[o,Se,s]);let Ia=l.map(n=>n.name).join("\0");O(()=>{s==="overview"&&Wt()},[s,Ia]),O(()=>{if(!Ze||s!=="overview"&&(o===""||s==="images"))return;let n=setInterval(gt,Math.max(2,r?.pollIntervalSec??5)*1e3);return()=>clearInterval(n)},[Ze,gt,o,r,s]);let Oa=()=>ge==="open"?"\u5B9E\u65F6\u63A5\u6536\u4E2D\uFF08docker events\uFF09":ge==="connecting"?"\u6B63\u5728\u8FDE\u63A5\u4E8B\u4EF6\u6D41\u2026":ge==="reconnecting"?"\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u6B63\u5728\u81EA\u52A8\u91CD\u8FDE\u2026":ge==="closed"?"\u4E8B\u4EF6\u6D41\u5DF2\u65AD\u5F00":ge==="unsupported"?"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301 EventSource":"\u4E8B\u4EF6\u6D41";O(()=>{if(s!=="containers"||o==="")return;if(typeof EventSource!="function"){Le("unsupported");return}st.current!==o&&(st.current=o,dt([])),Le("connecting");let n=Gn(Hn,()=>{let ue=Qe.current;ue!==null&&ue()}),c=!1,x=new EventSource(Ot("/events/stream",{target:o})),Q=!1,oe=()=>{if(!Q){Q=!0;try{x.close()}catch{}}},ne=ue=>{let xe=null;try{xe=JSON.parse(ue.data)}catch{return}xe===null||typeof xe!="object"||(dt(It=>zn(It,xe,jn)),n.schedule())},Tt=ue=>{let xe=null;try{xe=JSON.parse(ue.data)}catch{}let It=xe!==null&&typeof xe.code=="number"?xe.code:null;Le("closed"),re("\u4E8B\u4EF6\u6D41\u5DF2\u7ED3\u675F"+(It===null?"":"\uFF08\u9000\u51FA\u7801 "+String(It)+"\uFF09")+"\uFF0C\u5217\u8868\u56DE\u5230 AUTO REFRESH / \u624B\u52A8\u5237\u65B0"),oe()},Et=ue=>{if(typeof ue.data=="string"&&ue.data!==""){Le("closed"),oe();return}Le(x.readyState===2?"closed":"reconnecting")};return x.addEventListener("event",ne),x.addEventListener("end",Tt),x.addEventListener("error",Et),x.onopen=()=>{if(Le("open"),c){let ue=Qe.current;ue!==null&&ue()}c=!0},()=>{oe(),n.cancel()}},[s,o]),O(()=>{if(le==="")return;let n=setTimeout(()=>re(""),4e3);return()=>clearTimeout(n)},[le]);let Ct=(n,c)=>{let x=Cn(n.name);navigator.clipboard.writeText(x).then(()=>{re("\u5DF2\u590D\u5236\uFF1A"+x+(c===void 0?"":"\uFF08"+c+"\uFF09"))}).catch(()=>re("\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u6267\u884C\uFF1A"+x))},Ma=n=>{let c=Cn(n.name);if(Pe===null){let ne=document.querySelector("[data-dsh-tty-entry]")!==null;Ct(n,ne?"\u7EC8\u7AEF\u9762\u677F\u7248\u672C\u8FC7\u65E7\uFF08\u4EA4\u4E92\u5F0F\u8FDB\u5165\u5BB9\u5668\u9700\u8981 dsh-tty \u2265 0.14.0\uFF09\uFF0C\u547D\u4EE4\u5DF2\u590D\u5236\uFF0C\u53EF\u7C98\u8D34\u5230\u7CFB\u7EDF\u7EC8\u7AEF\u6267\u884C":"\u672A\u5B89\u88C5 dsh-tty \u7EC8\u7AEF\u9762\u677F\uFF0C\u547D\u4EE4\u5DF2\u590D\u5236\uFF0C\u53EF\u7C98\u8D34\u5230\u7CFB\u7EDF\u7EC8\u7AEF\u6267\u884C\uFF08\u88C5 dsh-tty \u540E\u53EF\u76F4\u63A5\u5728\u6B64\u5F00\u7EC8\u7AEF\uFF09");return}let x=(r?.targets??[]).find(ne=>ne.name===o),Q=n.name+" \xB7 exec",oe=x===void 0||x.kind==="local"?{command:c,label:Q}:typeof x.book=="string"&&x.book!==""?{book:x.book,command:c,label:Q}:(x.auth??"agent")==="agent"?{spec:{host:x.host,port:x.port,username:x.username,auth:"agent",agentForward:x.agentForward===!0},command:c,label:Q}:null;if(oe===null){Ct(n,"\u5185\u8054\u76EE\u6807\u7528\u4E86 key/password \u8BA4\u8BC1\uFF0C\u6D4F\u89C8\u5668\u7AEF\u62FF\u4E0D\u5230\u51ED\u8BC1");return}if(t.docked===!0){try{Pe.open(oe)}catch(ne){Ct(n,ne instanceof Error?ne.message:String(ne))}return}if(typeof Pe.mount=="function"&&Number(Pe.version??0)>=2){ut({label:Q,options:oe}),y(!1);return}try{Pe.open(oe),t.onClose()}catch(ne){Ct(n,ne instanceof Error?ne.message:String(ne))}},_n=n=>Ge(c=>{if(c[n]===void 0)return c;let x={...c};return delete x[n],x}),ht=(n,c)=>{yt(!0);let x=()=>{yt(!1),Ee(null)};Promise.resolve().then(n).then(async()=>{if(x(),c!==void 0)try{await c()}catch(Q){te(Q.message)}},Q=>{x(),te(Q.message)})},Ba=(n,c)=>{xt[c.id]===void 0&&Ee({title:n==="remove"?"\u5220\u9664\u5BB9\u5668":n==="stop"?"\u505C\u6B62\u5BB9\u5668":n==="start"?"\u542F\u52A8\u5BB9\u5668":"\u91CD\u542F\u5BB9\u5668",text:n==="remove"?`\u786E\u5B9A\u5220\u9664\u5BB9\u5668 ${c.name}\uFF1F\u5BB9\u5668\u7684\u53EF\u5199\u5C42\u4E0E\u914D\u7F6E\u4F1A\u88AB\u5220\u9664\uFF08\u547D\u540D\u6570\u636E\u5377\u4FDD\u7559\uFF09\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002`:`\u786E\u5B9A\u5BF9\u5BB9\u5668 ${c.name} \u6267\u884C${n==="stop"?"\u505C\u6B62":n==="start"?"\u542F\u52A8":"\u91CD\u542F"}\u64CD\u4F5C\uFF1F`,confirmLabel:n==="remove"?"\u5220\u9664":"\u786E\u5B9A",run:()=>ht(async()=>{Ge(x=>({...x,[c.id]:n}));try{let x=await U.action(o,n,c.id);re(`${x.result.action} ${c.name}\uFF1A${x.result.message}`)}catch(x){throw _n(c.id),x}},async()=>{try{await fe()}finally{_n(c.id)}})})},Ra=n=>{let c=zt(n);Ee({title:"\u5220\u9664\u955C\u50CF",text:"\u786E\u5B9A\u5220\u9664\u955C\u50CF "+c+"\uFF1F\u955C\u50CF\u88AB\u5BB9\u5668\u6216\u5B50\u955C\u50CF\u5F15\u7528\u65F6\u4F1A\u5931\u8D25\uFF1B\u5220\u9664\u540E\u9700\u8981\u91CD\u65B0\u62C9\u53D6\u6216\u6784\u5EFA\u624D\u80FD\u6062\u590D\uFF0C\u4E14\u4E0D\u53EF\u64A4\u9500\u3002",confirmLabel:"\u5220\u9664",run:()=>ht(async()=>{let x=await U.imageRemove(o,c);re("\u5DF2\u5220\u9664 "+c+"\uFF1A"+x.result.message),b!==null&&zt(b)===c&&V(null),await kt()})})},Da=()=>{Ee({title:"\u6E05\u7406 dangling \u955C\u50CF",text:"\u6E05\u7406\u8BE5\u76EE\u6807\u4E0A\u6240\u6709\u65E0\u6807\u7B7E\uFF08<none>:<none>\uFF09\u7684\u955C\u50CF\u5C42\uFF0C\u91CA\u653E\u78C1\u76D8\u7A7A\u95F4\uFF1B\u4E0D\u4F1A\u5220\u9664\u6709 tag \u7684\u955C\u50CF\u3002",confirmLabel:"\u6E05\u7406",run:()=>ht(async()=>{let n=await U.imagePrune(o),c=String(n.result.message).trim().split(`
1876
+ `).filter(x=>x!=="");re("\u5DF2\u6E05\u7406 dangling \u955C\u50CF\uFF1A"+(c.length===0?"ok":c[c.length-1])),await kt()})})},Pa=()=>{Ee({title:"\u6E05\u7406\u672A\u4F7F\u7528\u7684\u7F51\u7EDC",text:"\u6E05\u7406\u8BE5\u76EE\u6807\u4E0A\u6240\u6709\u6CA1\u6709\u5BB9\u5668\u63A5\u5165\u7684\u7F51\u7EDC\u3002compose \u521B\u5EFA\u7684\u9879\u76EE\u7F51\u7EDC\u4E5F\u5728\u5176\u4E2D\uFF08\u4E0B\u6B21 up \u4F1A\u91CD\u5EFA\uFF09\uFF0C\u4F46\u6B63\u5728\u8DD1\u7684\u9879\u76EE\u4F1A\u77ED\u6682\u5931\u53BB\u7F51\u7EDC\u3002",confirmLabel:"\u6E05\u7406",run:()=>ht(async()=>{let n=await U.networkPrune(o),c=String(n.result.message).trim().split(`
1877
+ `).filter(x=>x!=="");re("\u5DF2\u6E05\u7406\u672A\u4F7F\u7528\u7F51\u7EDC\uFF1A"+(c.length===0?"ok":c[c.length-1])),await Nt()})})},ja=()=>{Ee({title:"\u6E05\u7406\u672A\u4F7F\u7528\u7684\u5377",text:"\u6E05\u7406\u8BE5\u76EE\u6807\u4E0A\u6240\u6709\u6CA1\u6709\u88AB\u5BB9\u5668\u4F7F\u7528\u7684\u5377\u2014\u2014\u5377\u91CC\u7684\u6570\u636E\u4F1A\u4E00\u8D77\u5220\u9664\u4E14\u4E0D\u53EF\u6062\u590D\u3002docker \u2265 23 \u53EA\u5220\u533F\u540D\u5377\uFF08\u4E0D\u5E26 --all\uFF09\uFF0C\u66F4\u8001\u7684\u7248\u672C\u4F1A\u8FDE\u547D\u540D\u5377\u4E00\u8D77\u5220\uFF1B\u6267\u884C\u524D\u8BF7\u786E\u8BA4\u6CA1\u6709\u9700\u8981\u4FDD\u7559\u7684\u6570\u636E\u5377\u3002",confirmLabel:"\u6E05\u7406",run:()=>ht(async()=>{let n=await U.volumePrune(o),c=String(n.result.message).trim().split(`
1878
+ `).filter(x=>x!=="");re("\u5DF2\u6E05\u7406\u672A\u4F7F\u7528\u5377\uFF1A"+(c.length===0?"ok":c[c.length-1])),await St()})})},yn=(n,c)=>x=>{n(),re(x),c()},Lt=Me===null?null:S.find(n=>n.id===Me.id)??Me.item,pt=S.filter(n=>{if(Ce==="running"&&!(n.state==="running"||n.state==="paused"||n.state==="restarting")||Ce==="stopped"&&n.state==="running"||Ce==="unhealthy"&&n.health!=="unhealthy")return!1;let c=me.trim().toLowerCase();return c===""?!0:n.name.toLowerCase().includes(c)||n.image.toLowerCase().includes(c)||n.id.toLowerCase().includes(c)}),Ut=Y.filter(n=>{let c=ct.trim().toLowerCase();return c===""||n.reference.toLowerCase().includes(c)||n.id.toLowerCase().includes(c)}),qt=f.filter(n=>{let c=et.trim().toLowerCase();return c===""||n.name.toLowerCase().includes(c)||n.driver.toLowerCase().includes(c)||n.id.toLowerCase().includes(c)}),Yt=C.filter(n=>{let c=wt.trim().toLowerCase();return c===""||n.name.toLowerCase().includes(c)||n.driver.toLowerCase().includes(c)||n.mountpoint.toLowerCase().includes(c)}),ye=n=>{let c=l.find(x=>x.name===n);return c===void 0||c.label===void 0?n:n+" \xB7 "+c.label},mt=()=>ze?e("div",{className:"dk_empty",children:[e("span",{className:"dk_spin"}),e("div",{children:"\u8BFB\u53D6\u4E2D\u2026"})]}):o===""?v?a("div",{className:"dk_empty",children:[e("div",{className:"dk_emptyTitle",children:"\u5F53\u524D\u4F1A\u8BDD\u4E3B\u673A\u8FD8\u4E0D\u662F Docker \u76EE\u6807"}),e("div",{className:"dk_emptyHint",children:"\u6309\u4E0A\u9762\u7684\u63D0\u793A\u5230 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 Docker \u5BB9\u5668\u9762\u677F \u6DFB\u52A0\u4E00\u6761\u76EE\u6807\uFF08\u63A8\u8350\u76F4\u63A5\u9009\u8FDE\u63A5\u7C3F\u6761\u76EE\uFF09\uFF0C\u4FDD\u5B58\u540E\u56DE\u5230\u8FD9\u91CC\u5237\u65B0\u3002\u4E3A\u907F\u514D\u5F20\u51A0\u674E\u6234\uFF0C\u9762\u677F\u4E0D\u4F1A\u81EA\u52A8\u5207\u5230\u5176\u4ED6\u76EE\u6807\u3002"})]}):a("div",{className:"dk_empty",children:[e("div",{className:"dk_emptyTitle",children:"\u8FD8\u6CA1\u6709\u914D\u7F6E Docker \u76EE\u6807"}),e("div",{className:"dk_emptyHint",children:"\u5230 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 Docker \u5BB9\u5668\u9762\u677F \u6DFB\u52A0\u4E00\u4E2A\u76EE\u6807\uFF1A\u672C\u673A\u76F4\u63A5\u9009\u300C\u672C\u673A\u300D\uFF1B\u8FDC\u7A0B\u4E3B\u673A\u53EF\u4EE5\u5F15\u7528 tty \u7EC8\u7AEF\u9762\u677F\u7684\u8FDE\u63A5\u7C3F\u6761\u76EE\u3002"})]}):a("div",{className:"dk_empty",children:[e("div",{className:"dk_emptyTitle",children:s==="images"?"\u6CA1\u6709\u955C\u50CF":s==="compose"?"\u6CA1\u6709 Compose \u9879\u76EE":s==="networks"?"\u6CA1\u6709\u7F51\u7EDC":s==="volumes"?"\u6CA1\u6709\u5377":"\u6CA1\u6709\u5BB9\u5668"}),e("div",{className:"dk_emptyHint",children:me.trim()===""?"\u76EE\u6807\u4E0A\u6CA1\u6709\u5339\u914D\u7684\u6570\u636E\uFF0C\u6216\u7B5B\u9009\u6761\u4EF6\u8FC7\u7A84\u3002":"\u6CA1\u6709\u5339\u914D\u300C"+me.trim()+"\u300D\u7684\u7ED3\u679C\u3002"})]}),Aa=()=>{if(s==="overview")return cn(Pn(P),{onOpenTarget:Ta,onOpenContainer:Ea});if(s==="images")return a("div",{className:"dk_imagesView",children:[Ut.length===0?mt():e("div",{className:"dk_tableWrap",children:a("table",{className:"dk_images",children:[e("thead",{children:a("tr",{children:[e("th",{children:"\u955C\u50CF"}),e("th",{children:"\u5927\u5C0F"}),e("th",{children:"\u521B\u5EFA"}),e("th",{children:"ID"}),e("th",{className:"dk_colActions",children:"\u64CD\u4F5C"})]})}),e("tbody",{children:Ut.map(n=>a("tr",{children:[e("td",{className:"dk_mono",title:n.reference,children:n.dangling?"<none>\uFF08dangling\uFF09":n.reference}),e("td",{children:n.sizeText===""?n.size===null?"\u2014":Bt(n.size):n.sizeText}),e("td",{children:n.createdSince}),e("td",{className:"dk_mono",children:n.shortId}),e("td",{className:"dk_colActions",children:a("div",{className:"dk_rowActions",children:[e(J,{icon:ar,title:"\u67E5\u770B\u955C\u50CF\u8BE6\u60C5\uFF08\u5C42 / \u6784\u5EFA\u5386\u53F2\uFF09",onClick:()=>V(n)},"inspect"),e(J,{icon:Dt,danger:!0,disabled:r?.allowMutations!==!0,title:r?.allowMutations===!0?"\u5220\u9664\u955C\u50CF\uFF08\u4E0D\u53EF\u6062\u590D\uFF09":"\u9700\u8981\u6253\u5F00\u300C\u5141\u8BB8\u53D8\u66F4\u64CD\u4F5C\u300D",onClick:()=>Ra(n)},"remove")]})},"actions")]},n.id+n.reference))})]})})]});if(s==="compose"){let n=Ft(pt);return n.length===0?mt():e(ua,{groups:n,onOpen:c=>R({project:c})})}return s==="networks"?a("div",{className:"dk_imagesView",children:[qt.length===0?mt():e("div",{className:"dk_tableWrap",children:a("table",{className:"dk_images",children:[e("thead",{children:a("tr",{children:[e("th",{children:"\u540D\u79F0"}),e("th",{children:"\u9A71\u52A8"}),e("th",{children:"\u8303\u56F4"}),e("th",{children:"\u5C5E\u6027"}),e("th",{children:"ID"})]})}),e("tbody",{children:qt.map(n=>a("tr",{className:"dk_rowClickable",onClick:()=>g(n),title:"\u67E5\u770B\u7F51\u7EDC\u8BE6\u60C5",children:[e("td",{className:"dk_mono",title:n.name,children:n.name}),e("td",{children:n.driver===""?"\u2014":n.driver}),e("td",{children:n.scope===""?"\u2014":n.scope}),e("td",{children:n.internal?e("span",{className:"dk_badge","data-state":"paused",children:"internal"}):"\u2014"}),e("td",{className:"dk_mono",title:n.id,children:n.shortId})]},n.id+n.name))})]})})]}):s==="volumes"?a("div",{className:"dk_imagesView",children:[Yt.length===0?mt():e("div",{className:"dk_tableWrap",children:a("table",{className:"dk_images",children:[e("thead",{children:a("tr",{children:[e("th",{children:"\u540D\u79F0"}),e("th",{children:"\u9A71\u52A8"}),e("th",{children:"\u8303\u56F4"}),e("th",{children:"\u6302\u8F7D\u70B9"})]})}),e("tbody",{children:Yt.map(n=>a("tr",{className:"dk_rowClickable",onClick:()=>A(n),title:"\u67E5\u770B\u5377\u8BE6\u60C5",children:[e("td",{className:"dk_mono",title:n.name,children:n.name}),e("td",{children:n.driver===""?"\u2014":n.driver}),e("td",{children:n.scope===""?"\u2014":n.scope}),e("td",{className:"dk_mono dk_pathCell",title:n.mountpoint,children:n.mountpoint===""?"\u2014":n.mountpoint})]},n.name))})]})})]}):pt.length===0?mt():e("div",{className:"dk_grid",children:pt.map(n=>e(Zn,{item:n,selected:Me!==null&&n.id===Me.id,allowMutations:r?.allowMutations===!0,pickMode:Z,picked:Ne.includes(n.id),pending:xt[n.id],onTogglePick:La,onOpen:(c,x)=>be({id:c.id,tab:x,item:c}),onExec:Ma,onAction:Ba,onCopyExec:c=>{navigator.clipboard.writeText("docker exec -it "+c.name+" sh").then(()=>re("\u5DF2\u590D\u5236\uFF1Adocker exec -it "+c.name+" sh")).catch(()=>re("\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u590D\u5236"))}},n.id))})},ve=t.docked===!0,Ha=r??{pollIntervalSec:5,logTailDefault:200,allowExec:!1,allowMutations:!1,execTimeoutSec:30},$t=Rn(S,Ne),za=On($t.length),Fa=ee===null?[]:Ft(S).find(n=>n.project===ee.project)?.items??[],xn=Lt!==null?e(ra,{item:Lt,target:o,targetLabel:ye(o),config:Ha,initialTab:Me.tab,refreshToken:bt,onBack:()=>be(null),onRefresh:Sa,onClose:W,docked:ve},"detail"):b!==null?e(oa,{item:Y.find(n=>n.id===b.id)??b,target:o,targetLabel:ye(o),onBack:()=>V(null),onClose:W,docked:ve},"imageDetail"):F?e(ca,{target:o,targetLabel:ye(o),allowMutations:r?.allowMutations===!0,onBack:()=>se(!1),onDone:kt,onClose:W,docked:ve},"pull"):ee!==null?e(ka,{project:ee.project,items:Fa,target:o,targetLabel:ye(o),onBack:()=>R(null),onClose:W,docked:ve},"composeDetail"):vt?e(ma,{items:$t,target:o,targetLabel:ye(o),onBack:_e,onClose:W,docked:ve},"aggregate"):u!==null?e(la,{item:u,target:o,targetLabel:ye(o),allowMutations:r?.allowMutations===!0,onBack:()=>g(null),onRemoved:yn(()=>g(null),Nt),onClose:W,docked:ve},"networkDetail"):w!==null?e(ia,{item:w,target:o,targetLabel:ye(o),allowMutations:r?.allowMutations===!0,onBack:()=>A(null),onRemoved:yn(()=>A(null),St),onClose:W,docked:ve},"volumeDetail"):null,Va=[xn!==null?[xn,pe===null?null:e(at,{title:pe.title,text:pe.text,confirmLabel:pe.confirmLabel,busy:_t,onCancel:()=>Ee(null),onConfirm:pe.run},"confirm")]:[ve?null:a("div",{className:"dk_header",children:[e("span",{className:"dk_titleIcon",dangerouslySetInnerHTML:{__html:Ln}}),e("span",{className:"dk_title",children:"Docker \u5BB9\u5668"}),r?.allowMutations===!0?null:e("span",{className:"dk_badge","data-state":"paused",children:"\u53EA\u8BFB\u6A21\u5F0F"}),e("span",{className:"dk_headerSpacer"}),Lt!==null?null:e("button",{type:"button",className:"dk_iconBtn",title:"\u5237\u65B0\u5217\u8868","data-spin":ze?"1":void 0,onClick:gt,children:e("span",{className:"dk_iconGlyph",dangerouslySetInnerHTML:{__html:Ke}})}),e("button",{type:"button",className:"dk_iconBtn",title:"\u5173\u95ED\u9762\u677F",onClick:W,children:e("span",{dangerouslySetInnerHTML:{__html:we}})})]}),Lt!==null?null:a("div",{className:"dk_toolbar",children:[e("select",{className:"dk_select",value:s==="overview"?"":o,onChange:n=>{p(n.target.value),te(""),N("containers"),be(null),_e(),Ge({}),t.onTargetChange?.(ye(n.target.value))},children:[...s==="overview"?[e("option",{value:"",children:"\uFF08\u603B\u89C8 \xB7 \u5168\u90E8\u76EE\u6807\uFF09"},"__overview")]:o===""?[e("option",{value:"",children:"\uFF08\u672A\u9009\u62E9\u76EE\u6807\uFF09"},"__none")]:[],...(l.length===0&&o!==""?[{name:o,label:void 0}]:l).map(n=>e("option",{value:n.name,children:ye(n.name)},n.name))]}),l.length<2?null:e("button",{type:"button",className:"dk_pill dk_pillOverview","data-on":s==="overview"?"1":"0",title:s==="overview"?"\u9000\u51FA\u603B\u89C8\uFF0C\u56DE\u5230\u5F53\u524D\u76EE\u6807\u7684\u5BB9\u5668\u5217\u8868":"\u4E0D\u9009\u76EE\u6807\uFF0C\u4E00\u5C4F\u770B\u5168\u90E8\u76EE\u6807\u7684\u5BB9\u5668\u6982\u51B5\uFF08\u53EA\u8BFB\uFF09",onClick:()=>{if(s!=="overview"){N("overview"),te(""),be(null),_e();return}N("containers"),be(null),_e()},children:"\u603B\u89C8"}),e("div",{className:"dk_seg",children:[["containers","\u5BB9\u5668"],["images","\u955C\u50CF"],["compose","Compose"],["networks","\u7F51\u7EDC"],["volumes","\u5377"]].map(([n,c])=>e("button",{type:"button",className:"dk_segBtn","data-on":s===n?"1":"0",onClick:()=>{N(n),be(null),V(null),R(null),g(null),A(null),se(!1),_e()},children:c},n))}),s==="containers"?e("button",{type:"button",className:"dk_pill dk_pillPick","data-on":Z?"1":"0",title:Z?"\u9000\u51FA\u9009\u62E9\u5E76\u6E05\u7A7A\u52FE\u9009\uFF08Esc\uFF09":"\u591A\u9009\u5BB9\u5668\uFF0C\u628A\u5B83\u4EEC\u7684\u65E5\u5FD7\u4E34\u65F6\u805A\u5408\u6210\u4E00\u6761\u6D41",onClick:Ca,children:Z?"\u9000\u51FA\u9009\u62E9":"\u805A\u5408\u9009\u62E9"}):null,s==="containers"?e("input",{className:"dk_input dk_search",placeholder:"\u641C\u7D22\u540D\u79F0 / \u955C\u50CF / ID",value:me,onChange:n=>Re(n.target.value)}):null,s==="compose"?e("input",{className:"dk_input dk_search",placeholder:"\u641C\u7D22\u9879\u76EE / \u670D\u52A1 / \u5BB9\u5668",value:me,onChange:n=>Re(n.target.value)}):null,s==="images"?e("input",{className:"dk_input dk_search",placeholder:"\u641C\u7D22\u955C\u50CF\uFF08\u4ED3\u5E93 / \u6807\u7B7E / ID\uFF09",value:ct,onChange:n=>Jt(n.target.value)}):null,s==="images"?e("span",{className:"dk_hint dk_searchCount",children:String(Ut.length)+" / "+String(Y.length)+" \u4E2A\u955C\u50CF"}):null,s==="images"?e(J,{icon:nr,disabled:r?.allowMutations!==!0,title:r?.allowMutations===!0?"\u62C9\u53D6\u955C\u50CF\uFF08docker pull\uFF0C\u9010\u5C42\u5B9E\u65F6\u8FDB\u5EA6\uFF09":"\u62C9\u53D6\u955C\u50CF\u9700\u8981\u6253\u5F00\u300C\u5141\u8BB8\u53D8\u66F4\u64CD\u4F5C\u300D",onClick:()=>se(!0)},"pull"):null,s==="images"?e(J,{icon:en,danger:!0,disabled:r?.allowMutations!==!0,title:r?.allowMutations===!0?"\u6E05\u7406 dangling\uFF08\u65E0\u6807\u7B7E\uFF09\u955C\u50CF":"\u6E05\u7406 dangling \u9700\u8981\u6253\u5F00\u300C\u5141\u8BB8\u53D8\u66F4\u64CD\u4F5C\u300D",onClick:Da},"prune"):null,s==="networks"?e("input",{className:"dk_input dk_search",placeholder:"\u641C\u7D22\u7F51\u7EDC\uFF08\u540D\u79F0 / \u9A71\u52A8 / ID\uFF09",value:et,onChange:n=>tt(n.target.value)}):null,s==="volumes"?e("input",{className:"dk_input dk_search",placeholder:"\u641C\u7D22\u5377\uFF08\u540D\u79F0 / \u9A71\u52A8 / \u6302\u8F7D\u70B9\uFF09",value:wt,onChange:n=>Kt(n.target.value)}):null,s==="networks"?e("span",{className:"dk_hint dk_searchCount",children:String(qt.length)+" / "+String(f.length)+" \u4E2A\u7F51\u7EDC"}):null,s==="volumes"?e("span",{className:"dk_hint dk_searchCount",children:String(Yt.length)+" / "+String(C.length)+" \u4E2A\u5377"}):null,s==="networks"?e(J,{icon:en,danger:!0,disabled:r?.allowMutations!==!0,title:r?.allowMutations===!0?"\u6E05\u7406\u672A\u4F7F\u7528\u7684\u7F51\u7EDC\uFF08docker network prune\uFF09":"\u6E05\u7406\u7F51\u7EDC\u9700\u8981\u6253\u5F00\u300C\u5141\u8BB8\u53D8\u66F4\u64CD\u4F5C\u300D",onClick:Pa},"prune"):null,s==="volumes"?e(J,{icon:en,danger:!0,disabled:r?.allowMutations!==!0,title:r?.allowMutations===!0?"\u6E05\u7406\u672A\u4F7F\u7528\u7684\u5377\uFF08docker volume prune\uFF0C\u4F1A\u5220\u6570\u636E\uFF09":"\u6E05\u7406\u5377\u9700\u8981\u6253\u5F00\u300C\u5141\u8BB8\u53D8\u66F4\u64CD\u4F5C\u300D",onClick:ja},"prune"):null,s==="compose"?e("span",{className:"dk_hint dk_searchCount",children:String(Ft(pt).length)+" \u4E2A\u9879\u76EE \xB7 "+String(pt.length)+" \u4E2A\u5BB9\u5668"}):null,s==="containers"?e("div",{className:"dk_seg",children:[["all","\u5168\u90E8"],["running","\u8FD0\u884C\u4E2D"],["stopped","\u5DF2\u505C\u6B62"],["unhealthy","\u4E0D\u5065\u5EB7"]].map(([n,c])=>e("button",{type:"button",className:"dk_segBtn","data-on":Ce===n?"1":"0",onClick:()=>Xe(n),children:c},n))}):null,s==="containers"||s==="compose"||s==="overview"?a("div",{className:"dk_toolbarToggles",children:[s==="containers"||s==="compose"?e("label",{className:"dk_check",children:[e("input",{type:"checkbox",checked:Se,onChange:n=>Be(n.target.checked)}),"\u542B\u5DF2\u505C\u6B62"]},"all"):null,e("label",{className:"dk_check",children:[e("input",{type:"checkbox",checked:Ze,onChange:n=>Fe(n.target.checked)}),"\u81EA\u52A8\u5237\u65B0"]},"auto")]}):null,ve?a("div",{className:"dk_toolbarEnd",children:[r?.allowMutations!==!0?e("span",{className:"dk_badge","data-state":"paused",children:"\u53EA\u8BFB\u6A21\u5F0F"},"readonly"):null,e("button",{type:"button",className:"dk_iconBtn",title:"\u5237\u65B0\u5217\u8868","data-spin":ze?"1":void 0,onClick:gt,children:e("span",{className:"dk_iconGlyph",dangerouslySetInnerHTML:{__html:Ke}})},"refresh")]}):null]}),s==="containers"&&Z?e(pa,{count:$t.length,info:za,onRun:()=>He(!0),onCancel:_e},"pickBar"):null,a("div",{className:"dk_body",children:[a("div",{className:"dk_main"+(s==="images"||s==="networks"||s==="volumes"||s==="overview"?" dk_mainImages":""),children:[$e===""||s==="overview"?null:e(G,{title:"\u64CD\u4F5C\u5931\u8D25",hint:$e}),le===""?null:e(G,{kind:"info",title:le}),t.sessionHint===void 0?null:e(G,{kind:"info",title:"\u5F53\u524D\u4F1A\u8BDD\u4E3B\u673A\u8FD8\u6CA1\u914D\u7F6E\u4E3A Docker \u76EE\u6807",hint:"\u4F1A\u8BDD\u4E3B\u673A\uFF1A"+t.sessionHint.host+(t.sessionHint.port===22?"":":"+String(t.sessionHint.port))+(t.sessionHint.book===""?"":"\uFF08\u8FDE\u63A5\u7C3F\uFF1A"+t.sessionHint.book+"\uFF09")+" \u2014 \u5230 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 Docker \u5BB9\u5668\u9762\u677F \u6DFB\u52A0\u4E00\u6761 kind=ssh \u76EE\u6807"+(t.sessionHint.book===""?"\uFF08\u586B host/username\uFF0C\u6216\u7528\u8FDE\u63A5\u7C3F\u6761\u76EE\uFF09":"\uFF0C\u76F4\u63A5\u9009\u8FDE\u63A5\u7C3F\u6761\u76EE\u300C"+t.sessionHint.book+"\u300D")+"\uFF0C\u4FDD\u5B58\u540E\u56DE\u5230\u8FD9\u91CC\u5237\u65B0\u5373\u53EF\u3002"}),r!==null&&r.allowMutations!==!0?e(G,{kind:"info",title:"\u5F53\u524D\u4E3A\u53EA\u8BFB\u6A21\u5F0F",hint:"\u5BB9\u5668\u7684\u542F\u52A8 / \u505C\u6B62 / \u91CD\u542F / \u5220\u9664\uFF0C\u4EE5\u53CA\u955C\u50CF\u3001\u7F51\u7EDC\u3001\u5377\u7684\u5220\u9664\u4E0E\u6E05\u7406\uFF0C\u90FD\u9700\u8981\u5230 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 Docker \u5BB9\u5668\u9762\u677F \u6253\u5F00\u300C\u5141\u8BB8\u53D8\u66F4\u64CD\u4F5C\u300D\u3002"}):null,s==="containers"?e(ha,{events:Ve,status:ge,statusText:Oa(),open:Gt,onToggle:()=>Te(n=>!n)},"activity"):null,Aa()]})]}),pe===null?null:e(at,{title:pe.title,text:pe.text,confirmLabel:pe.confirmLabel,busy:_t,onCancel:()=>Ee(null),onConfirm:pe.run})],Ie===null?null:e(fa,{label:Ie.label,hostRef:_,collapsed:L,height:H,onToggleCollapse:()=>y(n=>!n),onResizeStart:D,onClose:()=>ut(null)},"execDrawer"),De&&Ie!==null?e(at,{title:"\u7ED3\u675F\u5BB9\u5668\u7EC8\u7AEF\u4F1A\u8BDD",text:"\u5173\u95ED\u9762\u677F\u4F1A\u7ED3\u675F\u300C"+Ie.label+"\u300D\u7684\u7EC8\u7AEF\u4F1A\u8BDD\uFF08docker exec -it \u2026\uFF09\u3002\u82E5\u53EA\u662F\u60F3\u7ED9\u65E5\u5FD7 / \u5217\u8868\u817E\u5730\u65B9\uFF0C\u5148\u70B9\u62BD\u5C49\u53F3\u4E0A\u89D2\u7684\u6298\u53E0\u6309\u94AE\u5373\u53EF\uFF0C\u4F1A\u8BDD\u4F1A\u4FDD\u6301\u8FD0\u884C\u3002",confirmLabel:"\u7ED3\u675F\u5E76\u5173\u95ED",onCancel:()=>de(!1),onConfirm:()=>{de(!1),t.onClose()}},"closeConfirm"):null],wn=a("div",{className:"dk_panel"+(ve?" dk_panelDock":""),"data-dock":ve?"1":void 0,ref:z,onMouseDown:n=>n.stopPropagation(),children:Va});return ve?wn:a("div",{className:"dk_backdrop",onMouseDown:n=>{M.current=n.target===n.currentTarget},onMouseUp:n=>{let c=M.current&&n.target===n.currentTarget;M.current=!1,c&&W()},children:[wn]})}function va(){let[t,r]=k(!1),[d,l]=k(null),[m,o]=k(!1),[p,v]=k(!1),[s,N]=k({kind:"",text:""}),S=K(0),E=ke(()=>{U.config().then(u=>{l(u.config),Zt(u.config),S.current=Array.isArray(u.config?.targets)?u.config.targets.length:0,o(!0)}).catch(u=>{N({kind:"error",text:"\u8BFB\u53D6\u914D\u7F6E\u5931\u8D25\uFF1A"+u.message}),o(!0)})},[]);O(()=>{t&&!m&&E()},[t,m,E]);let P=u=>l(g=>({...g,...u})),T=(u,g)=>l(w=>{let A=w.targets.slice();return A[u]={...A[u],...g},{...w,targets:A}}),Y=()=>l(u=>({...u,targets:[...u.targets,{name:"\u76EE\u6807"+String(u.targets.length+1),kind:"local",book:"",host:"",port:22,username:"",auth:"agent",keyPath:"",agentForward:!1,passwordSet:!1,passphraseSet:!1}]})),$=u=>l(g=>({...g,targets:g.targets.filter((w,A)=>A!==u)})),f=u=>l(g=>({...g,hostKeys:g.hostKeys.filter(w=>!(w.host===u.host&&w.port===u.port))})),B=()=>{v(!0),N({kind:"",text:""});let u={enabled:d.enabled,announceToAgent:d.announceToAgent,dockerBin:d.dockerBin,allowMutations:d.allowMutations,allowExec:d.allowExec,execTimeoutSec:d.execTimeoutSec,pollIntervalSec:d.pollIntervalSec,logTailDefault:d.logTailDefault,maxOutputKb:d.maxOutputKb,targets:d.targets.map(g=>({name:g.name,kind:g.kind,book:g.book??"",host:g.host??"",port:Number(g.port)||22,username:g.username??"",auth:g.auth??"agent",keyPath:g.keyPath??"",...g.password===void 0||g.password===""?{}:{password:g.password},...g.passphrase===void 0||g.passphrase===""?{}:{passphrase:g.passphrase},agentForward:g.agentForward===!0})),hostKeys:d.hostKeys,...d.targets.length===0&&S.current>0?{clearTargets:!0}:{}};U.saveConfig(u).then(g=>{l(g.config),Zt(g.config),S.current=Array.isArray(g.config?.targets)?g.config.targets.length:0,Pt(),N(g.warning===void 0?{kind:"ok",text:"\u5DF2\u4FDD\u5B58\u5E76\u70ED\u751F\u6548"}:{kind:"error",text:g.warning})}).catch(g=>{N({kind:"error",text:"\u4FDD\u5B58\u5931\u8D25\uFF1A"+g.message})}).finally(()=>v(!1))},C=u=>e("div",{className:"dk_cardSection",children:u}),j=(u,g,w,A)=>a("div",{className:"dk_field","data-span":A===void 0?void 0:String(A),children:[e("span",{className:"dk_label",children:u}),g,w===void 0?null:e("span",{className:"dk_hint",children:w})]}),b=(u,g,w,A)=>e("input",{className:"dk_input",type:"number",min:g,max:w,value:d[u],onChange:ee=>P({[u]:Number(ee.target.value)})}),V=u=>a("li",{className:"dk_settingsCard"+(t?" dk_settingsCardOpen":""),children:[a("button",{type:"button",className:"dk_settingsHead","aria-expanded":t,onClick:()=>r(g=>!g),children:[a("span",{className:"dk_settingsHeadText",children:[e("span",{className:"dk_settingsName",children:"Docker \u5BB9\u5668\u9762\u677F"}),e("span",{className:"dk_settingsDesc",children:"\u672C\u673A / SSH \u4E3B\u673A\u4E0A\u7684\u5BB9\u5668\u4E0E\u955C\u50CF\uFF1B\u9ED8\u8BA4\u53EA\u8BFB\uFF0C\u53D8\u66F4\u64CD\u4F5C\u9700\u663E\u5F0F\u5F00\u542F"})]}),e("span",{className:"dshkit_badge",children:"Kit"}),e("span",{className:"dk_settingsChevron",dangerouslySetInnerHTML:{__html:Qt}})]}),t?e("div",{className:"dk_settingsBody",children:u}):null]});return V(t?!m||d===null?a("div",{className:"dk_row",children:[e("span",{className:"dk_spin"}),"\u8BFB\u53D6\u914D\u7F6E\u2026"]}):[C("\u57FA\u672C"),a("div",{className:"dk_row",children:[e("label",{className:"dk_check",children:[e("input",{type:"checkbox",checked:d.enabled,onChange:u=>P({enabled:u.target.checked})}),"\u542F\u7528\u63D2\u4EF6"]}),e("label",{className:"dk_check",children:[e("input",{type:"checkbox",checked:d.announceToAgent,onChange:u=>P({announceToAgent:u.target.checked})}),"\u5411 agent \u516C\u544A\u80FD\u529B"]})]}),a("div",{className:"dk_fieldGrid",children:[j("docker CLI",e("input",{className:"dk_input",value:d.dockerBin,onChange:u=>P({dockerBin:u.target.value})}),"\u9ED8\u8BA4 docker\uFF1Bpodman \u53EF\u586B podman"),j("\u7EDF\u8BA1\u5237\u65B0\u95F4\u9694\uFF08\u79D2\uFF09",b("pollIntervalSec",1,60)),j("\u65E5\u5FD7\u9ED8\u8BA4\u884C\u6570",b("logTailDefault",1,5e3)),j("\u8F93\u51FA\u4E0A\u9650\uFF08KB\uFF09",b("maxOutputKb",1,8192)),j("exec \u8D85\u65F6\uFF08\u79D2\uFF09",b("execTimeoutSec",1,120))]}),C("\u80FD\u529B\u5F00\u5173\uFF08\u9ED8\u8BA4\u5173\u95ED\uFF09"),a("div",{className:"dk_row",children:[e("label",{className:"dk_check",children:[e("input",{type:"checkbox",checked:d.allowMutations,onChange:u=>P({allowMutations:u.target.checked})}),"\u5141\u8BB8\u53D8\u66F4\u64CD\u4F5C\uFF08\u5BB9\u5668\u542F\u505C\u5220\u3001\u955C\u50CF\u62C9\u53D6 / \u5220\u9664 / \u6E05\u7406\uFF09"]}),e("label",{className:"dk_check",children:[e("input",{type:"checkbox",checked:d.allowExec,onChange:u=>P({allowExec:u.target.checked})}),"\u5141\u8BB8 exec\uFF08\u5728\u5BB9\u5668\u5185\u6267\u884C\u547D\u4EE4\uFF09"]})]}),e("span",{className:"dk_hint",children:"docker socket \u7B49\u4EF7\u4E8E\u76EE\u6807\u4E3B\u673A\u7684 root \u6743\u9650\u3002\u5F00\u542F\u540E\uFF0C\u6D4F\u89C8\u5668\u9762\u677F\u4E0E agent \u90FD\u80FD\u6267\u884C\u5BF9\u5E94\u64CD\u4F5C\uFF0C\u8BF7\u53EA\u5728\u53EF\u4FE1\u73AF\u5883\u4E0B\u6253\u5F00\u3002"}),C("\u76EE\u6807"),...d.targets.map((u,g)=>a("div",{className:"dk_targetRow",children:[e("input",{className:"dk_input",value:u.name,placeholder:"\u76EE\u6807\u540D",onChange:w=>T(g,{name:w.target.value})}),e("select",{className:"dk_select",value:u.kind,onChange:w=>T(g,{kind:w.target.value}),children:[e("option",{value:"local",children:"\u672C\u673A"}),e("option",{value:"ssh",children:"SSH \u4E3B\u673A"})]}),u.kind==="local"?e("span",{className:"dk_hint",children:"\u5BBF\u4E3B\u6240\u5728\u673A\u5668\u4E0A\u7684 docker"}):a("div",{className:"dk_row",style:{gridColumn:"span 1"},children:[e("select",{className:"dk_select",value:u.book??"",onChange:w=>T(g,{book:w.target.value}),children:[e("option",{value:"",children:d.ttyBooks.length===0?"\uFF08\u65E0 tty \u8FDE\u63A5\u7C3F\uFF0C\u8BF7\u586B\u5185\u8054\u4FE1\u606F\uFF09":"\uFF08\u4E0D\u7528\u8FDE\u63A5\u7C3F\uFF0C\u624B\u586B\uFF09"}),...d.ttyBooks.map(w=>e("option",{value:w,children:"\u8FDE\u63A5\u7C3F\uFF1A"+w},w))]})]}),e("button",{type:"button",className:"dk_btn dk_btnDanger",onClick:()=>$(g),children:"\u5220\u9664"}),u.kind==="ssh"&&(u.book??"")===""?a("div",{className:"dk_targetInline",children:[e("input",{className:"dk_input",placeholder:"host",value:u.host??"",onChange:w=>T(g,{host:w.target.value})}),e("input",{className:"dk_input",placeholder:"22",title:"\u7AEF\u53E3",value:u.port??22,onChange:w=>T(g,{port:Number(w.target.value)||22})}),e("input",{className:"dk_input",placeholder:"username",value:u.username??"",onChange:w=>T(g,{username:w.target.value})}),e("select",{className:"dk_select",value:u.auth??"agent",onChange:w=>T(g,{auth:w.target.value}),children:[e("option",{value:"agent",children:"ssh-agent"}),e("option",{value:"key",children:"\u79C1\u94A5"}),e("option",{value:"password",children:"\u5BC6\u7801"})]}),(u.auth??"agent")==="key"?e("input",{className:"dk_input dk_credential",placeholder:"~/.ssh/id_ed25519",value:u.keyPath??"",onChange:w=>T(g,{keyPath:w.target.value})}):null,(u.auth??"agent")==="password"?e("input",{className:"dk_input dk_credential",type:"password",placeholder:u.passwordSet===!0?"\uFF08\u5DF2\u8BBE\u7F6E\uFF0C\u7559\u7A7A\u4FDD\u6301\u4E0D\u53D8\uFF09":"env:SSH_PASSWORD",value:u.password??"",onChange:w=>T(g,{password:w.target.value})}):null,e("label",{className:"dk_check",children:[e("input",{type:"checkbox",checked:u.agentForward===!0,onChange:w=>T(g,{agentForward:w.target.checked})}),"agent forwarding"]})]}):null]},String(g)+u.name)),a("div",{className:"dk_row",children:[e("button",{type:"button",className:"dk_btn",onClick:Y,children:"\u6DFB\u52A0\u76EE\u6807"}),e("span",{className:"dk_hint",children:"SSH \u76EE\u6807\u63A8\u8350\u76F4\u63A5\u9009 tty \u7EC8\u7AEF\u9762\u677F\u7684\u8FDE\u63A5\u7C3F\u6761\u76EE\uFF08\u51ED\u8BC1\u53EA\u9700\u7EF4\u62A4\u4E00\u5904\uFF09\uFF1B\u624B\u586B\u65F6\u5BC6\u7801 / \u53E3\u4EE4\u5EFA\u8BAE\u5199 env:VAR\u3002"})]}),C("SSH \u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08TOFU\uFF09"),...d.hostKeys.length===0?[e("span",{className:"dk_hint",children:"\u6682\u65E0\u8BB0\u5F55 \u2014 \u9996\u6B21 SSH \u8FDE\u63A5\u6210\u529F\u540E\u81EA\u52A8\u8BB0\u5F55\u4E3B\u673A\u6307\u7EB9\uFF08\u82E5 tty \u5DF2\u8BB0\u5F55\u540C\u4E00\u4E3B\u673A\uFF0C\u4F1A\u76F4\u63A5\u590D\u7528\uFF09\u3002"},"none")]:d.hostKeys.map(u=>a("div",{className:"dk_targetRow",children:[e("span",{children:u.host+":"+String(u.port)}),e("span",{className:"dk_hint",style:{gridColumn:"span 2",wordBreak:"break-all"},children:"sha256:"+u.fingerprint}),e("button",{type:"button",className:"dk_btn",onClick:()=>f(u),children:"\u5220\u9664"})]},u.host+":"+String(u.port))),e("span",{className:"dk_hint",children:"\u6307\u7EB9\u53D8\u66F4\u65F6\u8FDE\u63A5\u4F1A\u88AB\u62D2\u7EDD\uFF08\u9632\u4E2D\u95F4\u4EBA\uFF09\uFF1B\u786E\u8BA4\u5B89\u5168\u540E\u5220\u9664\u5BF9\u5E94\u8BB0\u5F55\u5373\u53EF\u91CD\u8FDE\u3002"}),a("div",{className:"dk_row",children:[e("button",{type:"button",className:"dk_btn dk_btnPrimary",disabled:p,onClick:B,children:p?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58"}),e("span",{className:"dk_msg","data-kind":s.kind,children:s.text})]})]:null)}let lt=null,qe=null,Vt=null;function it(){let t=qe,r=lt,d=Vt;if(qe=null,lt=null,Vt=null,r!==null&&r.remove(),t!==null&&setTimeout(()=>{try{t.unmount()}catch{}},0),d!==null)try{d.dispose()}catch{}}function ba(t){return t!==null&&typeof t=="object"&&typeof t.appendChild=="function"}function _a(){return typeof Je?.mountPane=="function"&&typeof Je.isOpen=="function"&&Number(Je.version??0)>=1&&Je.isOpen()===!0}function vn(t){it(),Xt();let r={onClose:it,initialTarget:t?.target??"",sessionHint:t?.sessionHint};if(_a()){let d=null;try{d=Je.mountPane({title:"Docker \u5BB9\u5668",hint:t?.target===void 0||t.target===""?"":t.target,size:520,min:360,onClose:()=>it()})}catch(l){d=null,console.warn("[dsh-docker] \u6302\u8F7D\u5230\u7EC8\u7AEF\u9762\u677F\u5931\u8D25\uFF0C\u56DE\u9000\u5F39\u7A97\uFF1A"+(l instanceof Error?l.message:String(l)))}if(d!==null&&ba(d.element)){Vt=d,qe=I(d.element),qe.render(e(fn,{...r,docked:!0,onTargetChange:l=>{try{d.setHint(l)}catch{}}}));return}}lt=document.createElement("div"),document.body.appendChild(lt),qe=I(lt),qe.render(e(fn,r))}function ya(){let t=document.querySelector('[data-pane="sidebar"], [class*="sidebarCol"]');if(t!==null)return t.querySelector('[class*="logoRow"]')?.parentElement??t.firstElementChild}function xa(t){let r=t.querySelector('button[class*="newSession"]');if(r!==null)return r;for(let d of t.children)if(d.tagName==="BUTTON")return d}function wa(){let t=document.createElement("div");return t.dataset.dshDockerEntry="",t.className="dk_sidebarEntry",t.setAttribute("role","button"),t.setAttribute("aria-label","\u5BB9\u5668"),t.innerHTML='<span class="dk_entryIcon">'+Ln+'</span><span class="dk_entryLabel">\u5BB9\u5668</span>',t.addEventListener("click",r=>{r.preventDefault(),vn()}),t}function bn(t,r){let d=xa(t);if(d===void 0)return!1;if(r.parentElement!==t){let l=d.closest('[class*="logoRow"]'),m=l!==null&&l.parentElement===t?l:d,o=Array.from(t.children).filter(p=>p instanceof HTMLElement&&p.matches("[data-dsh-global-search-entry], [data-dsh-rss-entry], [data-dsh-taskboard-entry], [data-dsh-ssh-entry], [data-dsh-tty-entry], [data-dsh-docker-entry]"));if(o.length>0){let p=o[o.length-1];t.insertBefore(r,p.nextSibling)}else t.insertBefore(r,m.nextElementSibling)}return!0}function Na(){if(Xt(),document.querySelector("[data-dsh-docker-entry]")!==null)return()=>{};let t=wa(),r,d=!1,l=()=>{if(r!==void 0&&!r.isConnected&&(o.disconnect(),r=void 0,d=!1),d){if(document.body.contains(t))return;o.disconnect(),r=void 0,d=!1}r??(r=ya()),r!==void 0&&(d=bn(r,t),d&&o.observe(r,{childList:!0,subtree:!0}))},m=new MutationObserver(()=>{l()});m.observe(document.body,{childList:!0,subtree:!0});let o=new MutationObserver(()=>{if(r===void 0||!r.isConnected){d=!1,l();return}r.contains(t)||(d=bn(r,t))});return l(),()=>{m.disconnect(),o.disconnect(),t.remove()}}let Ae={};return Ae.inject=["slots"],Ae.__pick={MAX:rn,SOFT_MAX:Wn,decide:On,toggle:Mn,reconcile:Bn,items:Rn},Ae.__events={LIMIT:jn,RECENT:An,DEBOUNCE_MS:Hn,append:zn,actionText:Vn,timeText:Fn,debounce:Gn},Ae.__overview={ERROR_MAX:on,counts:qn,abnormal:Un,sortRows:Yn,patch:tn,errorText:$n,data:Pn,body:cn},Ae.__listSeq={make:Dn},Ae.apply=t=>{Xt();let r=!1,d=()=>{};jt={set(o){if(o!==r){if(r=o,o){d=Na();return}d(),d=()=>{},it(),typeof Rt?.requestRender=="function"&&Rt.requestRender()}}},Jn(!0);let l=t.slots.inject("settings.plugin.item",()=>t.slots.register({name:"settings.plugin.item",key:"docker",order:102},va));t.inject(["ttyTerminal"],o=>(Pe=o.ttyTerminal??null,()=>{Pe=null})),t.inject(["ttyPanel"],o=>(Je=o.ttyPanel??null,()=>{Je=null}));let m=()=>{};return Pt(),t.inject(["ttyConnbar"],o=>{let p=o.ttyConnbar;p!==void 0&&(Rt=p,m=p.addAction(v=>{if(!At)return;let s=v?.spec??{};if(s.t!=="ssh")return;let N=typeof v?.bookName=="string"?v.bookName:"",S=an(s,N),E=S!==void 0?`\u6253\u5F00\u8BE5\u4E3B\u673A\u7684 Docker \u5BB9\u5668\u9762\u677F\uFF08\u76EE\u6807\uFF1A${S}\uFF09`:je===null?"\u6253\u5F00\u5F53\u524D\u4F1A\u8BDD\u4E3B\u673A\u7684 Docker \u5BB9\u5668\u9762\u677F":"\u8BE5\u4E3B\u673A\u5C1A\u672A\u914D\u7F6E\u4E3A Docker \u76EE\u6807 \u2014 \u70B9\u51FB\u6253\u5F00\u9762\u677F\u67E5\u770B/\u914D\u7F6E";v.addAction(Ya,"\u5BB9\u5668",E,()=>{(async()=>{let P=await qa(s,N),T=Number(s.port);vn({target:P??"",sessionHint:P===void 0?{host:typeof s.host=="string"?s.host:"",port:Number.isInteger(T)&&T>0?T:22,book:N}:void 0})})()})}),(async()=>{for(let v=0;v<3;v+=1){if(await Pt()){typeof p.requestRender=="function"&&p.requestRender();return}await new Promise(s=>setTimeout(s,2e3))}})())}),()=>{m(),l(),jt=null,At=!1,Rt=null,d(),it()}},Ae}});})();