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75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
-- ========== GENERATED BY XTemplate Editor (Alt-F3) DO NOT EDIT MANUALLY! ==========

PlaceObj('XTemplate', {
	group = "ModManager",
	id = "ModManagerMainContent",
	save_in = "Common",
	PlaceObj('XTemplateWindow', {
		'Id', "idContentWrapper",
	}, {
		PlaceObj('XTemplateWindow', {
			'comment', "content",
			'Id', "idContent",
			'LayoutMethod', "VList",
		}, {
			PlaceObj('XTemplateWindow', {
				'__condition', function (parent, context) return IsModsBackendLoaded() end,
				'Dock', "top",
				'LayoutMethod', "HList",
				'LayoutHSpacing', 12,
			}, {
				PlaceObj('XTemplateWindow', {
					'__condition', function (parent, context) return IsUserCreatedContentAllowed() and GetUIStyleGamepad() end,
					'__class', "XTextButton",
					'Id', "idLeftTrigger",
					'Background', RGBA(0, 0, 0, 0),
					'FocusedBackground', RGBA(0, 0, 0, 0),
					'OnPress', function (self, gamepad)
						self:ResolveId("idBrowse"):Press()
					end,
					'RolloverBackground', RGBA(0, 0, 0, 0),
					'PressedBackground', RGBA(0, 0, 0, 0),
				}),
				PlaceObj('XTemplateWindow', {
					'comment', "browse button",
					'__condition', function (parent, context) return IsUserCreatedContentAllowed() end,
				}, {
					PlaceObj('XTemplateMode', {
						'mode', "browse",
					}, {
						PlaceObj('XTemplateWindow', {
							'__class', "XTextButton",
							'Id', "idBrowse",
							'Padding', box(0, 0, 0, 3),
							'Background', RGBA(0, 0, 0, 0),
							'FocusedBackground', RGBA(0, 0, 0, 0),
							'OnPress', function (self, gamepad)
								ModsUISetDialogMode(self, "browse")
							end,
							'RolloverBackground', RGBA(0, 0, 0, 0),
							'PressedBackground', RGBA(0, 0, 0, 0),
							'Translate', true,
							'Text', T(451852350969, --[[XTemplate ModManagerMainContent Text]] "BROWSE ALL"),
						}),
						}),
					PlaceObj('XTemplateMode', {
						'mode', "installed",
					}, {
						PlaceObj('XTemplateWindow', {
							'__class', "XTextButton",
							'Id', "idBrowse",
							'Padding', box(0, 0, 0, 3),
							'Background', RGBA(0, 0, 0, 0),
							'FocusedBackground', RGBA(0, 0, 0, 0),
							'OnPress', function (self, gamepad)
								ModsUISetDialogMode(self, "browse")
							end,
							'RolloverBackground', RGBA(0, 0, 0, 0),
							'PressedBackground', RGBA(0, 0, 0, 0),
							'Translate', true,
							'Text', T(451852350969, --[[XTemplate ModManagerMainContent Text]] "BROWSE ALL"),
						}),
						}),
					}),
				PlaceObj('XTemplateWindow', {
					'comment', "installed button",
				}, {
					PlaceObj('XTemplateMode', {
						'mode', "browse",
					}, {
						PlaceObj('XTemplateWindow', {
							'__class', "XTextButton",
							'Id', "idInstalled",
							'Padding', box(0, 0, 0, 3),
							'Background', RGBA(0, 0, 0, 0),
							'FocusedBackground', RGBA(0, 0, 0, 0),
							'OnPress', function (self, gamepad)
								ModsUISetDialogMode(self, "installed")
							end,
							'RolloverBackground', RGBA(0, 0, 0, 0),
							'PressedBackground', RGBA(0, 0, 0, 0),
							'Translate', true,
							'Text', T(949405693034, --[[XTemplate ModManagerMainContent Text]] "INSTALLED MODS"),
						}, {
							PlaceObj('XTemplateWindow', {
								'Margins', box(15, 0, 10, 0),
								'VAlign', "center",
							}, {
								PlaceObj('XTemplateWindow', {
									'__class', "XText",
									'Padding', box(0, 0, 0, 0),
									'HAlign', "center",
									'VAlign', "center",
									'HandleMouse', false,
									'Translate', true,
									'Text', T(855054268382, --[[XTemplate ModManagerMainContent Text]] "<InstalledModsCount>"),
								}),
								}),
							}),
						}),
					PlaceObj('XTemplateMode', {
						'mode', "installed",
					}, {
						PlaceObj('XTemplateWindow', {
							'__class', "XTextButton",
							'Id', "idInstalled",
							'Padding', box(0, 0, 0, 3),
							'Background', RGBA(0, 0, 0, 0),
							'FocusedBackground', RGBA(0, 0, 0, 0),
							'OnPress', function (self, gamepad)
								ModsUISetDialogMode(self, "installed")
							end,
							'RolloverBackground', RGBA(0, 0, 0, 0),
							'PressedBackground', RGBA(0, 0, 0, 0),
							'Translate', true,
							'Text', T(949405693034, --[[XTemplate ModManagerMainContent Text]] "INSTALLED MODS"),
						}),
						}),
					}),
				PlaceObj('XTemplateWindow', {
					'__condition', function (parent, context) return IsUserCreatedContentAllowed() and GetUIStyleGamepad() end,
					'__class', "XTextButton",
					'Id', "idRightTrigger",
					'Background', RGBA(0, 0, 0, 0),
					'FocusedBackground', RGBA(0, 0, 0, 0),
					'OnPress', function (self, gamepad)
						self:ResolveId("idInstalled"):Press()
					end,
					'RolloverBackground', RGBA(0, 0, 0, 0),
					'PressedBackground', RGBA(0, 0, 0, 0),
				}),
				PlaceObj('XTemplateCode', {
					'run', function (self, parent, context)
						if GetUIStyleGamepad() then
							local left = parent:ResolveId("idLeftTrigger")
							if left then
								left:SetIcon(GetPlatformSpecificImagePath("LT"))
							end
							local right = parent:ResolveId("idRightTrigger")
							if right then
								right:SetIcon(GetPlatformSpecificImagePath("RT"))
							end
						end
					end,
				}),
				}),
			PlaceObj('XTemplateWindow', {
				'Margins', box(0, 0, 0, 10),
				'Dock', "box",
			}, {
				PlaceObj('XTemplateWindow', nil, {
					PlaceObj('XTemplateWindow', {
						'comment', "info sort",
						'Padding', box(0, 10, 38, 10),
						'Dock', "top",
						'MinHeight', 50,
						'MaxHeight', 50,
					}, {
						PlaceObj('XTemplateWindow', {
							'__class', "XContentTemplate",
							'IdNode', false,
							'LayoutMethod', "HList",
						}, {
							PlaceObj('XTemplateMode', {
								'mode', "installed",
							}, {
								PlaceObj('XTemplateWindow', {
									'__condition', function (parent, context) return context:GetInstalledFilterCount() > 0 end,
									'__class', "XText",
									'VAlign', "center",
									'FoldWhenHidden', true,
									'HandleMouse', false,
									'Translate', true,
									'Text', T(698646285904, --[[XTemplate ModManagerMainContent Text]] "<InstalledFilterCount> active filters,"),
								}),
								PlaceObj('XTemplateWindow', {
									'__class', "XText",
									'Id', "idTextInstalled",
									'VAlign', "center",
									'FoldWhenHidden', true,
									'HandleMouse', false,
									'Translate', true,
									'Text', T(731628863769, --[[XTemplate ModManagerMainContent Text]] "<InstalledModsCount> Installed / <EnabledModsCount> Enabled"),
								}),
								}),
							PlaceObj('XTemplateMode', {
								'mode', "browse",
							}, {
								PlaceObj('XTemplateWindow', {
									'__condition', function (parent, context) return context:GetFilterCount() > 0 end,
									'__class', "XText",
									'VAlign', "center",
									'FoldWhenHidden', true,
									'HandleMouse', false,
									'Translate', true,
									'Text', T(579750785264, --[[XTemplate ModManagerMainContent Text]] "<FilterCount> active filters,"),
								}),
								PlaceObj('XTemplateWindow', {
									'__class', "XText",
									'Id', "idTextAvailable",
									'VAlign', "center",
									'FoldWhenHidden', true,
									'HandleMouse', false,
									'Translate', true,
									'Text', T(922587274886, --[[XTemplate ModManagerMainContent Text]] "<ModsCount> Available"),
								}),
								}),
							PlaceObj('XTemplateMode', {
								'mode', "installed",
							}, {
								PlaceObj('XTemplateWindow', {
									'__class', "XCheckButton",
									'Id', "idAllToggleEnabled",
									'Dock', "right",
									'VAlign', "center",
									'FoldWhenHidden', true,
									'OnContextUpdate', function (self, context, ...)
										XCheckButton.OnContextUpdate(self, context, ...)
										self:Update()
									end,
									'OnPress', function (self, gamepad)
										ModsUISetAllModsEnabledState(GetDialog(self), not self:GetCheck())
										XCheckButton.OnPress(self, gamepad)
									end,
								}, {
									PlaceObj('XTemplateFunc', {
										'name', "Update",
										'func', function (self, ...)
											self:SetEnabled(next(self.context.installed_mods))
											self:SetCheck(ModsUIGetEnableAllButtonState())
										end,
									}),
									}),
								}),
							PlaceObj('XTemplateWindow', {
								'comment', "sort",
								'Id', "idCtrlsSort",
								'Dock', "right",
								'VAlign', "center",
							}, {
								PlaceObj('XTemplateWindow', {
									'__class', "XLabel",
									'Id', "idSortLabel",
									'Dock', "left",
									'VAlign', "center",
									'Translate', true,
									'Text', T(570258089761, --[[XTemplate ModManagerMainContent Text]] "SORT: "),
								}),
								PlaceObj('XTemplateWindow', {
									'__class', "XTextButton",
									'Id', "idSortButton",
									'OnPress', function (self, gamepad)
										local dlg = GetDialog(self)
										ModsUIToggleSortPC(dlg.idContentWrapper, "ModManagerPopup")
									end,
									'Translate', true,
								}, {
									PlaceObj('XTemplateMode', {
										'mode', "browse",
									}, {
										PlaceObj('XTemplateCode', {
											'run', function (self, parent, context)
												local btn = GetParentOfKind(parent, "XTextButton")
												btn:SetText(T(335892826750, "<SortTextUppercase>"))
											end,
										}),
										}),
									PlaceObj('XTemplateMode', {
										'mode', "installed",
									}, {
										PlaceObj('XTemplateCode', {
											'run', function (self, parent, context)
												local btn = GetParentOfKind(parent, "XTextButton")
												btn:SetText(T(619338386138, "<InstalledSortTextUppercase>"))
											end,
										}),
										}),
									}),
								}),
							}),
						}),
					PlaceObj('XTemplateWindow', {
						'Id', "idAboveList",
					}, {
						PlaceObj('XTemplateWindow', {
							'__class', "XSleekScroll",
							'Id', "idScroll",
							'Dock', "right",
							'Target', "idList",
							'AutoHide', true,
						}),
						PlaceObj('XTemplateWindow', {
							'__class', "XContentTemplateList",
							'Id', "idList",
							'BorderWidth', 0,
							'Padding', box(0, 0, 0, 0),
							'MinHeight', 732,
							'MaxHeight', 732,
							'GridStretchX', false,
							'GridStretchY', false,
							'LayoutVSpacing', 4,
							'Background', RGBA(255, 255, 255, 0),
							'FocusedBackground', RGBA(0, 0, 0, 0),
							'VScroll', "idScroll",
							'MouseScroll', true,
							'GamepadInitialSelection', false,
							'OnContextUpdate', function (self, context, ...)
								local mode = GetDialogMode(self)
								if mode == "browse" then
									self:ResolveId("idListSpinner"):SetVisible(not context.counted)
									self:ResolveId("idNoResults"):SetVisible(not context.offline and context.counted and context:GetModsCount() == 0)
									self:ResolveId("idOffline"):SetVisible(context.counted and context.offline and context:GetModsCount() == 0)
								elseif mode == "installed" then
									self:ResolveId("idListSpinner"):SetVisible(not context.installed_retrieved)
									self:ResolveId("idNoInstalledMods"):SetVisible(context.installed_retrieved and context:GetInstalledModsCount() == 0)
								end
								XContentTemplateList.OnContextUpdate(self, context, ...)
								if #self == 0 then
									ModsUISetSelectedMod(false)
								end
							end,
						}, {
							PlaceObj('XTemplateFunc', {
								'name', "Open",
								'func', function (self, ...)
									if GetUIStyleGamepad() then
										self:SetMinWidth(1584)
										self:SetMaxWidth(1584)
										self:SetMinHeight(620)
										self:SetMaxHeight(620)
									end
									XContentTemplateList.Open(self, ...)
									local context = self.context
									local mode = GetDialogMode(self)
									local selection = 1
									local scroll_y = 0
									if mode == "browse" then
										selection = context.last_browse_item or 1
										scroll_y = context.last_browse_y or 0
									elseif mode == "installed" then
										selection = context.last_installed_item or 1
										scroll_y = context.last_installed_y or 0
									end
									self:DeleteThread("scrolling")
									self:CreateThread("scrolling", function(self, selection, scroll_y)
										if GetUIStyleGamepad() then
											self:SetSelection(Min(#self, selection))
										else
											self:ScrollTo(0, scroll_y)
										end
									end, self, selection, scroll_y)
									if mode == "browse" then
										self:ResolveId("idListSpinner"):SetVisible(not context.counted)
										self:ResolveId("idNoResults"):SetVisible(not context.offline and context.counted and context:GetModsCount() == 0)
										self:ResolveId("idOffline"):SetVisible(context.counted and context.offline and context:GetModsCount() == 0)
									elseif mode == "installed" then
										self:ResolveId("idListSpinner"):SetVisible(not context.installed_retrieved)
										self:ResolveId("idNoInstalledMods"):SetVisible(context.installed_retrieved and context:GetInstalledModsCount() == 0)
									end
								end,
							}),
							PlaceObj('XTemplateMode', {
								'mode', "browse",
							}, {
								PlaceObj('XTemplateForEach', {
									'array', function (parent, context) return table.map(context.searched_mods, context.mod_ui_entries) end,
									'run_before', function (parent, context, item, i, n, last)
										local width, height = 387, 269
										if GetUIStyleGamepad() then
											width, height = 524,367
										end
										local child = NewXVirtualContent(parent, item, "ModsUIBrowseListItem", width, height)
										child:SetGridX((i-1)%3 + 1)
										child:SetGridY((i-1)/3 + 1)
										child:SetHAlign("left")
									end,
								}),
								}),
							PlaceObj('XTemplateMode', {
								'mode', "installed",
							}, {
								PlaceObj('XTemplateForEach', {
									'array', function (parent, context) return table.map(context.installed_mods, context.mod_ui_entries) end,
									'run_before', function (parent, context, item, i, n, last)
										local width, height = 1174, 94
										if GetUIStyleGamepad() then
											width, height = 1583,100
										end
										local child = NewXVirtualContent(parent, item, "ModManagerInstalledMod", width, height)
										child:SetGridX(1)
										child:SetGridY(i)
									end,
								}),
								}),
							}),
						PlaceObj('XTemplateTemplate', {
							'__template', "ModManagerLoadingAnim",
							'Id', "idListSpinner",
							'FoldWhenHidden', true,
						}),
						PlaceObj('XTemplateWindow', {
							'__class', "XText",
							'Id', "idNoResults",
							'Dock', "box",
							'HAlign', "center",
							'VAlign', "center",
							'Visible', false,
							'FoldWhenHidden', true,
							'HandleMouse', false,
							'Translate', true,
							'Text', T(341040457448, --[[XTemplate ModManagerMainContent Text]] "No mods match the search criteria"),
							'TextHAlign', "center",
							'TextVAlign', "center",
						}),
						PlaceObj('XTemplateWindow', {
							'__class', "XText",
							'Id', "idNoInstalledMods",
							'Dock', "box",
							'HAlign', "center",
							'VAlign', "center",
							'Visible', false,
							'FoldWhenHidden', true,
							'HandleMouse', false,
							'Translate', true,
							'Text', T(492269718300, --[[XTemplate ModManagerMainContent Text]] "No installed mods match the search criteria"),
							'TextHAlign', "center",
							'TextVAlign', "center",
						}),
						PlaceObj('XTemplateWindow', {
							'__class', "XText",
							'Id', "idOffline",
							'Dock', "box",
							'HAlign', "center",
							'VAlign', "center",
							'Visible', false,
							'FoldWhenHidden', true,
							'HandleMouse', false,
							'Translate', true,
							'Text', T(687823167004, --[[XTemplate ModManagerMainContent Text]] "Mod info could not be retrieved from the server. Check your network connection."),
							'TextHAlign', "center",
							'TextVAlign', "center",
						}),
						}),
					}),
				PlaceObj('XTemplateWindow', {
					'Margins', box(10, 10, 0, 0),
					'Dock', "right",
					'MinWidth', 350,
					'MaxWidth', 350,
					'LayoutMethod', "VList",
				}, {
					PlaceObj('XTemplateWindow', {
						'comment', "search box",
						'Margins', box(15, 0, 15, 0),
						'Dock', "top",
						'MinWidth', 300,
						'MaxWidth', 300,
					}, {
						PlaceObj('XTemplateWindow', {
							'__class', "XEdit",
							'Id', "idSearch",
							'MaxLen', 255,
							'AutoSelectAll', true,
						}, {
							PlaceObj('XTemplateFunc', {
								'name', "OnShortcut(self, shortcut, source, ...)",
								'func', function (self, shortcut, source, ...)
									if shortcut == "Enter" then
										self:ResolveId("idSearchButton"):Press()
										return "break"
									end
									return XEdit.OnShortcut(self, shortcut, source, ...)
								end,
							}),
							}),
						PlaceObj('XTemplateWindow', {
							'__class', "XTextButton",
							'Id', "idSearchButton",
							'HAlign', "right",
							'VAlign', "center",
							'OnPress', function (self, gamepad)
								local mode = GetDialogMode(self)
								local context = self.context
								local text = self:ResolveId("idSearch"):GetText()
								if text == _InternalTranslate(T(10485, "Search mods...")) then
									text = ""
								end
								local old_query = mode == "browse" and context.query or context.installed_query
								if old_query ~= text then
									if mode == "browse" then
										context.query = text
										context:GetMods()
									else
										context.installed_query = text
										context:GetInstalledMods()
									end
								end
							end,
						}),
						PlaceObj('XTemplateCode', {
							'run', function (self, parent, context)
								local mode = GetDialogMode(parent)
								local query = mode == "browse" and context.query or context.installed_query
								query = query ~= "" and query or _InternalTranslate(T(10485, "Search mods..."))
								parent:ResolveId("idSearch"):SetText(query)
							end,
						}),
						}),
					PlaceObj('XTemplateWindow', {
						'comment', "clear tags",
						'__parent', function (parent, context) return GetDialog(parent):ResolveId("idBottomBar") end,
						'Dock', "right",
						'MinWidth', 325,
						'MaxWidth', 325,
					}, {
						PlaceObj('XTemplateWindow', {
							'__class', "XTextButton",
							'HAlign', "left",
							'OnContextUpdate', function (self, context, ...)
								XTextButton.OnContextUpdate(self, context, ...)
								local mode = GetDialogMode(self)
								local t = mode == "browse" and "temp_tags" or "temp_installed_tags"
								t = context[t]
								local compatible = mode == "browse" and "only_compatible" or "only_compatible_installed"
								compatible = context[compatible]
								self:SetVisible(not not next(t) or compatible)
							end,
							'OnPress', function (self, gamepad)
								local dlg = GetDialog(self)
								local mode = dlg:GetMode()
								local changed = ModsUIClearFilter(mode)
								if changed then
									local obj = ResolvePropObj(dlg.context)
									if mode == "installed" then
										ModsUISetInstalledTags()
										obj:GetInstalledMods()
									else
										ModsUISetTags()
										obj:GetMods()
									end
								end
							end,
							'Translate', true,
							'Text', T(704603652674, --[[XTemplate ModManagerMainContent Text]] "CLEAR ALL TAGS"),
						}),
						}),
					PlaceObj('XTemplateWindow', {
						'comment', "tags title",
						'__class', "XLabel",
						'Margins', box(15, 20, 0, 0),
						'Padding', box(0, 0, 0, 0),
						'Dock', "top",
						'Translate', true,
						'Text', T(590534981842, --[[XTemplate ModManagerMainContent Text]] "TAGS"),
					}),
					PlaceObj('XTemplateWindow', {
						'Margins', box(15, 10, 0, 0),
						'Dock', "box",
					}, {
						PlaceObj('XTemplateWindow', {
							'comment', "tags list",
							'__class', "XList",
							'Id', "idTagsList",
							'VScroll', "idTagsScroll",
						}, {
							PlaceObj('XTemplateForEach', {
								'array', function (parent, context) return PredefinedModTags end,
								'__context', function (parent, context, item, i, n) return item end,
								'run_after', function (child, context, item, i, n, last)
									local dlg = GetDialog(child)
									local mode = dlg:GetMode()
									local obj = ResolvePropObj(dlg.context)
									local temp_table = (mode == "installed") and "temp_installed_tags" or "temp_tags"
									local tags_table = (mode == "installed") and "set_installed_tags" or "set_tags"
									local name = context.display_name
									child.idCheck:SetText(name)
									local checked = obj[tags_table][name]
									child.idCheck:SetCheck(checked)
									child.idCheck.OnChange = function(self, check)
										obj[temp_table][name] = check or nil
										if mode == "installed" then
											ModsUISetInstalledTags()
											obj:GetInstalledMods()
										else
											ModsUISetTags()
											obj:GetMods()
										end
									end
								end,
							}, {
								PlaceObj('XTemplateTemplate', {
									'__template', "ModManagerTagListItem",
									'OnContextUpdate', function (self, context, ...)
										local temp_table = (GetDialog(self):GetMode() == "installed") and "temp_installed_tags" or "temp_tags"
										self.idCheck:SetCheck(g_ModsUIContextObj[temp_table][context.display_name])
									end,
								}),
								}),
							PlaceObj('XTemplateTemplate', {
								'__context', function (parent, context) return ModsUIGameCompatibleTagContext end,
								'__template', "ModManagerTagListItem",
								'OnContextUpdate', function (self, context, ...)
									local value = (GetDialog(self):GetMode() == "installed") and "only_compatible_installed" or "only_compatible"
									self.idCheck:SetCheck(g_ModsUIContextObj[value])
								end,
							}, {
								PlaceObj('XTemplateFunc', {
									'name', "Open",
									'func', function (self, ...)
										XListItem.Open(self, ...)
										self.idCheck:SetText(_InternalTranslate(T(12427, "Game version compatible")))
										local dlg = GetDialog(self)
										local mode = dlg:GetMode()
										local obj = ResolvePropObj(dlg.context)
										local value = (mode == "installed") and "temp_only_compatible_installed" or "temp_only_compatible"
										local checked = obj[value]
										self.idCheck:SetCheck(checked)
										self.idCheck.OnChange = function(self, check)
											obj[value] = check or nil
											if mode == "installed" then
												ModsUISetInstalledTags()
												obj:GetInstalledMods()
											else
												ModsUISetTags()
												obj:GetMods()
											end
										end
									end,
								}),
								}),
							}),
						PlaceObj('XTemplateWindow', {
							'__class', "XSleekScroll",
							'Id', "idTagsScroll",
							'Dock', "right",
							'Target', "idTagsList",
							'AutoHide', true,
						}),
						}),
					}),
				}),
			}),
		}),
	PlaceObj('XTemplateAction', {
		'ActionId', "idClose",
		'ActionName', T(743155730858, --[[XTemplate ModManagerMainContent ActionName]] "CLOSE"),
		'ActionToolbar', "bottommenu",
		'ActionShortcut', "Escape",
		'OnActionEffect', "back",
		'OnAction', function (self, host, source, ...)
			local shown = ModsUIIsPopupShown(host)
			if shown then
				if shown == "sort" and not GetUIStyleGamepad() then
					ModsUIToggleSortPC(host)
				else
					ModsUIClosePopup(host)
				end
			else
				CreateRealTimeThread(ModsUIDialogEnd, host)
			end
		end,
	}),
	PlaceObj('XTemplateAction', {
		'ActionId', "idModEditor",
		'ActionName', T(469131084747, --[[XTemplate ModManagerMainContent ActionName]] "MOD EDITOR"),
		'ActionToolbar', "bottommenu",
		'OnAction', function (self, host, source, ...)
			if IsUserCreatedContentAllowed() then
				CreateRealTimeThread(function(host)
					ModsUIDialogEnd(host, ModEditorOpen)
				end, host)
			end
		end,
	}),
	PlaceObj('XTemplateGroup', {
		'__condition', function (parent, context) return GetUIStyleGamepad() end,
	}, {
		PlaceObj('XTemplateMode', {
			'mode', "browse",
		}, {
			PlaceObj('XTemplateAction', {
				'ActionId', "open",
				'ActionName', T(594494773035, --[[XTemplate ModManagerMainContent ActionName]] "Open"),
				'ActionToolbar', "ActionBarLeft",
				'ActionGamepad', "ButtonA",
				'ActionState', function (self, host)
					return ModsUIShowItemAction(host) or "hidden"
				end,
				'OnAction', function (self, host, source, ...)
					ModsUISetDialogMode(host, "details", g_ModsUIContextObj:GetSelectedMod())
				end,
			}),
			PlaceObj('XTemplateAction', {
				'ActionId', "enable",
				'ActionName', T(646340216090, --[[XTemplate ModManagerMainContent ActionName]] "Enable"),
				'ActionToolbar', "ActionBarLeft",
				'ActionGamepad', "ButtonY",
				'ActionState', function (self, host)
					return ModsUIShowItemAction(host, "enabled", false) or "hidden"
				end,
				'OnAction', function (self, host, source, ...)
					ModsUIToggleEnabled(nil, host)
				end,
			}),
			PlaceObj('XTemplateAction', {
				'ActionId', "disable",
				'ActionName', T(241331183269, --[[XTemplate ModManagerMainContent ActionName]] "Disable"),
				'ActionToolbar', "ActionBarLeft",
				'ActionGamepad', "ButtonY",
				'ActionState', function (self, host)
					return ModsUIShowItemAction(host, "enabled", true) or "hidden"
				end,
				'OnAction', function (self, host, source, ...)
					ModsUIToggleEnabled(nil, host)
				end,
			}),
			PlaceObj('XTemplateAction', {
				'ActionId', "install",
				'ActionName', T(351353414605, --[[XTemplate ModManagerMainContent ActionName]] "Install"),
				'ActionToolbar', "ActionBarLeft",
				'ActionGamepad', "ButtonX",
				'ActionState', function (self, host)
					if g_DownloadingMods[host.context.selected_mod_id] then
						return "disabled"
					end
					return ModsUIShowItemAction(host, "installed", false) and IsModsBackendLoaded() or "hidden"
				end,
				'OnAction', function (self, host, source, ...)
					if not g_ModsBackendObj:IsLoggedIn() then
						ModsUIOpenLoginPopup(host.idContentWrapper)
					else
						ModsUIInstallMod()
					end
					host:UpdateActionViews(host)
				end,
			}),
			PlaceObj('XTemplateAction', {
				'ActionId', "uninstall",
				'ActionName', T(174683399082, --[[XTemplate ModManagerMainContent ActionName]] "Uninstall"),
				'ActionToolbar', "ActionBarLeft",
				'ActionGamepad', "ButtonX",
				'ActionState', function (self, host)
					return ModsUIShowItemAction(host, "installed", true) and IsModsBackendLoaded() or "hidden"
				end,
				'OnAction', function (self, host, source, ...)
					ModsUIUninstallMod()
				end,
			}),
			PlaceObj('XTemplateAction', {
				'ActionId', "search",
				'ActionName', T(530535622110, --[[XTemplate ModManagerMainContent ActionName]] "Search"),
				'ActionToolbar', "ActionBarRight",
				'ActionGamepad', "Back",
				'ActionState', function (self, host)
					return not ModsUIIsPopupShown(host) or "hidden"
				end,
				'OnAction', function (self, host, source, ...)
					ModsUIConsoleSearch(host.idContentWrapper)
					host:UpdateActionViews(host)
				end,
			}),
			PlaceObj('XTemplateAction', {
				'ActionId', "filter",
				'ActionName', T(283589763270, --[[XTemplate ModManagerMainContent ActionName]] "Filter"),
				'ActionToolbar', "ActionBarRight",
				'ActionGamepad', "Start",
				'ActionState', function (self, host)
					return not ModsUIIsPopupShown(host) or "hidden"
				end,
				'OnAction', function (self, host, source, ...)
					ModsUIChooseFilter(host.idContentWrapper)
					host:UpdateActionViews(host)
				end,
			}),
			PlaceObj('XTemplateAction', {
				'ActionId', "sort",
				'ActionName', T(600084142632, --[[XTemplate ModManagerMainContent ActionName]] "Sort"),
				'ActionToolbar', "ActionBarRight",
				'ActionGamepad', "RightThumbClick",
				'ActionState', function (self, host)
					return not ModsUIIsPopupShown(host) or "hidden"
				end,
				'OnAction', function (self, host, source, ...)
					ModsUIChooseSort(host.idContentWrapper)
					host:UpdateActionViews(host)
				end,
			}),
			PlaceObj('XTemplateAction', {
				'ActionId', "back",
				'ActionName', T(889105824841, --[[XTemplate ModManagerMainContent ActionName]] "Back"),
				'ActionToolbar', "ActionBarRight",
				'ActionShortcut', "Escape",
				'ActionGamepad', "ButtonB",
				'ActionState', function (self, host)
					return not ModsUIIsPopupShown(host) or "hidden"
				end,
				'OnAction', function (self, host, source, ...)
					CreateRealTimeThread(ModsUIDialogEnd, host)
				end,
			}),
			}),
		PlaceObj('XTemplateMode', {
			'mode', "installed",
		}, {
			PlaceObj('XTemplateAction', {
				'ActionId', "open",
				'ActionName', T(594494773035, --[[XTemplate ModManagerMainContent ActionName]] "Open"),
				'ActionToolbar', "ActionBarLeft",
				'ActionGamepad', "ButtonA",
				'ActionState', function (self, host)
					return ModsUIShowItemAction(host) or "hidden"
				end,
				'OnAction', function (self, host, source, ...)
					ModsUISetDialogMode(host, "details", g_ModsUIContextObj:GetSelectedMod("installed_mods"))
				end,
			}),
			PlaceObj('XTemplateAction', {
				'ActionId', "enable",
				'ActionName', T(646340216090, --[[XTemplate ModManagerMainContent ActionName]] "Enable"),
				'ActionToolbar', "ActionBarLeft",
				'ActionGamepad', "ButtonY",
				'ActionState', function (self, host)
					return ModsUIShowItemAction(host, "enabled", false) or "hidden"
				end,
				'OnAction', function (self, host, source, ...)
					ModsUIToggleEnabled(nil, host, "installed_mods")
				end,
			}),
			PlaceObj('XTemplateAction', {
				'ActionId', "disable",
				'ActionName', T(241331183269, --[[XTemplate ModManagerMainContent ActionName]] "Disable"),
				'ActionToolbar', "ActionBarLeft",
				'ActionGamepad', "ButtonY",
				'ActionState', function (self, host)
					return ModsUIShowItemAction(host, "enabled", true) or "hidden"
				end,
				'OnAction', function (self, host, source, ...)
					ModsUIToggleEnabled(nil, host, "installed_mods")
				end,
			}),
			PlaceObj('XTemplateAction', {
				'ActionId', "uninstall",
				'ActionName', T(174683399082, --[[XTemplate ModManagerMainContent ActionName]] "Uninstall"),
				'ActionToolbar', "ActionBarLeft",
				'ActionGamepad', "ButtonX",
				'ActionState', function (self, host)
					return ModsUIShowItemAction(host, "installed", true) and IsModsBackendLoaded() or "hidden"
				end,
				'OnAction', function (self, host, source, ...)
					ModsUIUninstallMod(nil, "installed_mods")
				end,
			}),
			PlaceObj('XTemplateAction', {
				'ActionId', "disableAll",
				'ActionName', T(812851576389, --[[XTemplate ModManagerMainContent ActionName]] "Disable All"),
				'ActionToolbar', "ActionBarLeft",
				'ActionGamepad', "LeftThumbClick",
				'ActionState', function (self, host)
					return (ModsUIShowItemAction(host) and ModsUIGetEnableAllButtonState() == true) or "hidden"
				end,
				'OnAction', function (self, host, source, ...)
					ModsUISetAllModsEnabledState(host, false)
				end,
			}),
			PlaceObj('XTemplateAction', {
				'ActionId', "enableAll",
				'ActionName', T(875315745274, --[[XTemplate ModManagerMainContent ActionName]] "Enable All"),
				'ActionToolbar', "ActionBarLeft",
				'ActionGamepad', "LeftThumbClick",
				'ActionState', function (self, host)
					return (ModsUIShowItemAction(host) and ModsUIGetEnableAllButtonState() == false) or "hidden"
				end,
				'OnAction', function (self, host, source, ...)
					ModsUISetAllModsEnabledState(host, true)
				end,
			}),
			PlaceObj('XTemplateAction', {
				'ActionId', "search",
				'ActionName', T(530535622110, --[[XTemplate ModManagerMainContent ActionName]] "Search"),
				'ActionToolbar', "ActionBarRight",
				'ActionGamepad', "Back",
				'ActionState', function (self, host)
					return not ModsUIIsPopupShown(host) or "hidden"
				end,
				'OnAction', function (self, host, source, ...)
					ModsUIConsoleSearch(host.idContentWrapper)
					host:UpdateActionViews(host)
				end,
			}),
			PlaceObj('XTemplateAction', {
				'ActionId', "filter",
				'ActionName', T(283589763270, --[[XTemplate ModManagerMainContent ActionName]] "Filter"),
				'ActionToolbar', "ActionBarRight",
				'ActionGamepad', "Start",
				'ActionState', function (self, host)
					return not ModsUIIsPopupShown(host) or "hidden"
				end,
				'OnAction', function (self, host, source, ...)
					ModsUIChooseFilter(host.idContentWrapper)
					host:UpdateActionViews(host)
				end,
			}),
			PlaceObj('XTemplateAction', {
				'ActionId', "sort",
				'ActionName', T(600084142632, --[[XTemplate ModManagerMainContent ActionName]] "Sort"),
				'ActionToolbar', "ActionBarRight",
				'ActionGamepad', "RightThumbClick",
				'ActionState', function (self, host)
					return not ModsUIIsPopupShown(host) or "hidden"
				end,
				'OnAction', function (self, host, source, ...)
					ModsUIChooseSort(host.idContentWrapper)
					host:UpdateActionViews(host)
				end,
			}),
			PlaceObj('XTemplateAction', {
				'ActionId', "back",
				'ActionName', T(889105824841, --[[XTemplate ModManagerMainContent ActionName]] "Back"),
				'ActionToolbar', "ActionBarRight",
				'ActionShortcut', "Escape",
				'ActionGamepad', "ButtonB",
				'ActionState', function (self, host)
					return not ModsUIIsPopupShown(host) or "hidden"
				end,
				'OnAction', function (self, host, source, ...)
					CreateRealTimeThread(ModsUIDialogEnd, host)
				end,
			}),
			}),
		}),
})