<base:WindowBase
    x:Class="v2rayN.Views.DNSSettingWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:base="clr-namespace:v2rayN.Base"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:reactiveui="http://reactiveui.net"
    xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
    xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
    Title="{x:Static resx:ResUI.menuDNSSetting}"
    Width="1000"
    Height="700"
    x:TypeArguments="vms:DNSSettingViewModel"
    ShowInTaskbar="False"
    Style="{StaticResource WindowGlobal}"
    WindowStartupLocation="CenterScreen"
    mc:Ignorable="d">
    <DockPanel Margin="{StaticResource Margin8}">
        <StackPanel
            Margin="{StaticResource Margin4}"
            HorizontalAlignment="Center"
            DockPanel.Dock="Bottom"
            Orientation="Horizontal">
            <Button
                x:Name="btnSave"
                Width="100"
                Content="{x:Static resx:ResUI.TbConfirm}"
                IsDefault="True"
                Style="{StaticResource DefButton}" />
            <Button
                x:Name="btnCancel"
                Width="100"
                Margin="{StaticResource MarginLeftRight8}"
                Content="{x:Static resx:ResUI.TbCancel}"
                IsCancel="true"
                Style="{StaticResource DefButton}" />
        </StackPanel>

        <TabControl HorizontalContentAlignment="Left">
            <TabItem Header="{x:Static resx:ResUI.ThBasicDNSSettings}">
                <ScrollViewer VerticalScrollBarVisibility="Visible">
                    <Grid x:Name="gridBasicDNSSettings" Margin="{StaticResource Margin8}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>

                        <TextBlock
                            x:Name="txtBasicDNSSettingsInvalid"
                            Grid.Row="0"
                            Grid.Column="0"
                            Grid.ColumnSpan="3"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbCustomDNSEnabledPageInvalid}" />

                        <TextBlock
                            Grid.Row="1"
                            Grid.Column="0"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbDomesticDNS}" />
                        <ComboBox
                            x:Name="cmbDirectDNS"
                            Grid.Row="1"
                            Grid.Column="1"
                            Width="300"
                            Margin="{StaticResource Margin8}"
                            IsEditable="True"
                            Style="{StaticResource DefComboBox}" />
                        <TextBlock
                            Grid.Row="1"
                            Grid.Column="2"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbDomesticDNSTips}"
                            TextWrapping="Wrap" />

                        <TextBlock
                            Grid.Row="2"
                            Grid.Column="0"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbRemoteDNS}" />
                        <ComboBox
                            x:Name="cmbRemoteDNS"
                            Grid.Row="2"
                            Grid.Column="1"
                            Width="300"
                            Margin="{StaticResource Margin8}"
                            IsEditable="True"
                            Style="{StaticResource DefComboBox}" />
                        <TextBlock
                            Grid.Row="2"
                            Grid.Column="2"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbRemoteDNSTips}"
                            TextWrapping="Wrap" />

                        <TextBlock
                            Grid.Row="3"
                            Grid.Column="0"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbBootstrapDNS}" />
                        <ComboBox
                            x:Name="cmbBootstrapDNS"
                            Grid.Row="3"
                            Grid.Column="1"
                            Width="300"
                            Margin="{StaticResource Margin8}"
                            IsEditable="True"
                            Style="{StaticResource DefComboBox}" />
                        <TextBlock
                            Grid.Row="3"
                            Grid.Column="2"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbBootstrapDNSTips}"
                            TextWrapping="Wrap" />

                        <TextBlock
                            Grid.Row="5"
                            Grid.Column="0"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbDirectResolveStrategy}" />
                        <ComboBox
                            x:Name="cmbDirectDNSStrategy"
                            Grid.Row="5"
                            Grid.Column="1"
                            Width="200"
                            Margin="{StaticResource Margin8}"
                            materialDesign:HintAssist.Hint="Default"
                            Style="{StaticResource DefComboBox}" />
                        <TextBlock
                            Grid.Row="5"
                            Grid.Column="2"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbDirectResolveStrategyTips}"
                            TextWrapping="Wrap" />

                        <TextBlock
                            Grid.Row="6"
                            Grid.Column="0"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbRemoteResolveStrategy}" />
                        <ComboBox
                            x:Name="cmbRemoteDNSStrategy"
                            Grid.Row="6"
                            Grid.Column="1"
                            Width="200"
                            Margin="{StaticResource Margin8}"
                            materialDesign:HintAssist.Hint="Default"
                            Style="{StaticResource DefComboBox}" />
                        <TextBlock
                            Grid.Row="6"
                            Grid.Column="2"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbRemoteResolveStrategyTips}"
                            TextWrapping="Wrap" />

                        <TextBlock
                            Grid.Row="7"
                            Grid.Column="0"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbParallelQuery}" />
                        <ToggleButton
                            x:Name="togParallelQuery"
                            Grid.Row="7"
                            Grid.Column="1"
                            Margin="{StaticResource Margin8}"
                            HorizontalAlignment="Left" />

                        <TextBlock
                            Grid.Row="8"
                            Grid.Column="0"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbServeStale}" />
                        <ToggleButton
                            x:Name="togServeStale"
                            Grid.Row="8"
                            Grid.Column="1"
                            Margin="{StaticResource Margin8}"
                            HorizontalAlignment="Left" />
                    </Grid>
                </ScrollViewer>
            </TabItem>
            <TabItem Header="{x:Static resx:ResUI.ThAdvancedDNSSettings}">
                <ScrollViewer VerticalScrollBarVisibility="Visible">
                    <Grid x:Name="gridAdvancedDNSSettings" Margin="{StaticResource Margin8}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>

                        <TextBlock
                            x:Name="txtAdvancedDNSSettingsInvalid"
                            Grid.Row="0"
                            Grid.Column="0"
                            Grid.ColumnSpan="3"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbCustomDNSEnabledPageInvalid}" />

                        <TextBlock
                            Grid.Row="1"
                            Grid.Column="0"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbSettingsUseSystemHosts}" />
                        <ToggleButton
                            x:Name="togUseSystemHosts"
                            Grid.Row="1"
                            Grid.Column="1"
                            Margin="{StaticResource Margin8}"
                            HorizontalAlignment="Left" />

                        <TextBlock
                            Grid.Row="2"
                            Grid.Column="0"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbAddCommonDNSHosts}" />
                        <ToggleButton
                            x:Name="togAddCommonHosts"
                            Grid.Row="2"
                            Grid.Column="1"
                            Margin="{StaticResource Margin8}"
                            HorizontalAlignment="Left" />

                        <TextBlock
                            Grid.Row="3"
                            Grid.Column="0"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbFakeIP}" />
                        <ToggleButton
                            x:Name="togFakeIP"
                            Grid.Row="3"
                            Grid.Column="1"
                            Margin="{StaticResource Margin8}"
                            HorizontalAlignment="Left" />
                        <TextBlock
                            Grid.Row="3"
                            Grid.Column="2"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbFakeIPTips}"
                            TextWrapping="Wrap" />

                        <TextBlock
                            Grid.Row="4"
                            Grid.Column="0"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbBlockSVCBHTTPSQueries}" />
                        <ToggleButton
                            x:Name="togBlockBindingQuery"
                            Grid.Row="4"
                            Grid.Column="1"
                            Margin="{StaticResource Margin8}"
                            HorizontalAlignment="Left" />
                        <TextBlock
                            Grid.Row="4"
                            Grid.Column="2"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbBlockSVCBHTTPSQueriesTips}"
                            TextWrapping="Wrap" />

                        <TextBlock
                            Grid.Row="5"
                            Grid.Column="0"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbValidateDirectExpectedIPs}" />
                        <ComboBox
                            x:Name="cmbDirectExpectedIPs"
                            Grid.Row="5"
                            Grid.Column="1"
                            Width="200"
                            Margin="{StaticResource Margin8}"
                            IsEditable="True"
                            Style="{StaticResource DefComboBox}" />
                        <TextBlock
                            Grid.Row="5"
                            Grid.Column="2"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbValidateDirectExpectedIPsDesc}"
                            TextWrapping="Wrap" />

                        <TextBlock
                            Grid.Row="6"
                            Grid.Column="0"
                            Grid.ColumnSpan="3"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Center"
                            Style="{StaticResource ToolbarTextBlock}"
                            Text="{x:Static resx:ResUI.TbDNSHostsConfig}" />
                        <TextBox
                            x:Name="txtHosts"
                            Grid.Row="7"
                            Grid.Column="0"
                            Grid.ColumnSpan="3"
                            Margin="{StaticResource Margin8}"
                            VerticalAlignment="Stretch"
                            materialDesign:HintAssist.Hint="{x:Static resx:ResUI.TbDNSHostsConfig}"
                            AcceptsReturn="True"
                            BorderThickness="1"
                            Style="{StaticResource MaterialDesignOutlinedTextBox}"
                            TextWrapping="Wrap"
                            VerticalScrollBarVisibility="Auto" />
                    </Grid>
                </ScrollViewer>
            </TabItem>

            <TabItem Header="{x:Static resx:ResUI.TbCustomDnsRay}">
                <DockPanel Margin="{StaticResource Margin8}">
                    <Grid DockPanel.Dock="Top">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>

                        <StackPanel Grid.Row="0" Orientation="Horizontal">
                            <TextBlock
                                Margin="{StaticResource Margin8}"
                                VerticalAlignment="Center"
                                Style="{StaticResource ToolbarTextBlock}"
                                Text="{x:Static resx:ResUI.TbCustomDNSEnable}" />
                            <ToggleButton
                                x:Name="togRayCustomDNSEnableCompatible"
                                Margin="{StaticResource Margin8}"
                                HorizontalAlignment="Left" />
                        </StackPanel>

                        <StackPanel Grid.Row="1" Orientation="Horizontal">
                            <TextBlock
                                Margin="{StaticResource Margin8}"
                                VerticalAlignment="Center"
                                Style="{StaticResource ToolbarTextBlock}"
                                Text="{x:Static resx:ResUI.TbSettingsRemoteDNS}" />
                            <TextBlock
                                Margin="{StaticResource Margin8}"
                                VerticalAlignment="Center"
                                Style="{StaticResource ToolbarTextBlock}">
                                <Hyperlink Click="linkDnsObjectDoc_Click">
                                    <TextBlock Text="{x:Static resx:ResUI.TbDnsObjectDoc}" />
                                    <materialDesign:PackIcon Kind="Link" />
                                </Hyperlink>
                            </TextBlock>
                            <Button
                                x:Name="btnImportDefConfig4V2rayCompatible"
                                Margin="{StaticResource Margin8}"
                                Content="{x:Static resx:ResUI.TbSettingDnsImportDefConfig}"
                                Style="{StaticResource DefButton}" />
                        </StackPanel>
                    </Grid>

                    <WrapPanel DockPanel.Dock="Bottom" Orientation="Horizontal">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock
                                Margin="{StaticResource Margin8}"
                                VerticalAlignment="Center"
                                Style="{StaticResource ToolbarTextBlock}"
                                Text="{x:Static resx:ResUI.TbSettingsUseSystemHosts}" />
                            <ToggleButton
                                x:Name="togUseSystemHostsCompatible"
                                Margin="{StaticResource Margin8}"
                                HorizontalAlignment="Left" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal">
                            <TextBlock
                                Margin="{StaticResource Margin8}"
                                VerticalAlignment="Center"
                                Style="{StaticResource ToolbarTextBlock}"
                                Text="{x:Static resx:ResUI.TbSettingsDomainStrategy4Freedom}" />
                            <ComboBox
                                x:Name="cmbdomainStrategy4FreedomCompatible"
                                Width="150"
                                Margin="{StaticResource Margin8}"
                                Style="{StaticResource DefComboBox}" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal">
                            <TextBlock
                                Margin="{StaticResource Margin8}"
                                VerticalAlignment="Center"
                                Style="{StaticResource ToolbarTextBlock}"
                                Text="{x:Static resx:ResUI.TbSettingsDomainDNSAddress}" />
                            <ComboBox
                                x:Name="cmbdomainDNSAddressCompatible"
                                Width="150"
                                Margin="{StaticResource Margin8}"
                                IsEditable="True"
                                Style="{StaticResource DefComboBox}" />
                        </StackPanel>
                    </WrapPanel>

                    <TextBox
                        x:Name="txtnormalDNSCompatible"
                        Margin="{StaticResource Margin8}"
                        VerticalAlignment="Stretch"
                        materialDesign:HintAssist.Hint="HTTP/SOCKS"
                        AcceptsReturn="True"
                        BorderThickness="1"
                        Style="{StaticResource MaterialDesignOutlinedTextBox}"
                        TextWrapping="Wrap"
                        VerticalScrollBarVisibility="Auto" />
                </DockPanel>
            </TabItem>

            <TabItem Header="{x:Static resx:ResUI.TbCustomDnsSingbox}">
                <DockPanel Margin="{StaticResource Margin8}">
                    <Grid DockPanel.Dock="Top">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>

                        <StackPanel Grid.Row="0" Orientation="Horizontal">
                            <TextBlock
                                Margin="{StaticResource Margin8}"
                                VerticalAlignment="Center"
                                Style="{StaticResource ToolbarTextBlock}"
                                Text="{x:Static resx:ResUI.TbCustomDNSEnable}" />
                            <ToggleButton
                                x:Name="togSBCustomDNSEnableCompatible"
                                Margin="{StaticResource Margin8}"
                                HorizontalAlignment="Left" />
                        </StackPanel>

                        <StackPanel Grid.Row="1" Orientation="Horizontal">
                            <TextBlock
                                Margin="{StaticResource Margin8}"
                                VerticalAlignment="Center"
                                Style="{StaticResource ToolbarTextBlock}">
                                <Hyperlink Click="linkDnsSingboxObjectDoc_Click">
                                    <TextBlock Text="{x:Static resx:ResUI.TbDnsSingboxObjectDoc}" />
                                    <materialDesign:PackIcon Kind="Link" />
                                </Hyperlink>
                            </TextBlock>
                            <Button
                                x:Name="btnImportDefConfig4SingboxCompatible"
                                Margin="{StaticResource Margin8}"
                                Content="{x:Static resx:ResUI.TbSettingDnsImportDefConfig}"
                                Style="{StaticResource DefButton}" />
                        </StackPanel>
                    </Grid>

                    <WrapPanel DockPanel.Dock="Bottom" Orientation="Horizontal">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock
                                Margin="{StaticResource Margin8}"
                                VerticalAlignment="Center"
                                Style="{StaticResource ToolbarTextBlock}"
                                Text="{x:Static resx:ResUI.TbSettingsDomainStrategy4Out}" />
                            <ComboBox
                                x:Name="cmbdomainStrategy4OutCompatible"
                                Width="150"
                                Margin="{StaticResource Margin8}"
                                Style="{StaticResource DefComboBox}" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal">
                            <TextBlock
                                Margin="{StaticResource Margin8}"
                                VerticalAlignment="Center"
                                Style="{StaticResource ToolbarTextBlock}"
                                Text="{x:Static resx:ResUI.TbSettingsDomainDNSAddress}" />
                            <ComboBox
                                x:Name="cmbdomainDNSAddress2Compatible"
                                Width="150"
                                Margin="{StaticResource Margin8}"
                                IsEditable="True"
                                Style="{StaticResource DefComboBox}" />
                        </StackPanel>
                    </WrapPanel>

                    <Grid Margin="{StaticResource Margin8}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="1*" />
                            <ColumnDefinition Width="10" />
                            <ColumnDefinition Width="1*" />
                        </Grid.ColumnDefinitions>

                        <TextBox
                            x:Name="txtnormalDNS2Compatible"
                            Grid.Column="0"
                            VerticalAlignment="Stretch"
                            materialDesign:HintAssist.Hint="HTTP/SOCKS"
                            AcceptsReturn="True"
                            BorderThickness="1"
                            Style="{StaticResource MaterialDesignOutlinedTextBox}"
                            TextWrapping="Wrap"
                            VerticalScrollBarVisibility="Auto" />

                        <GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" />

                        <TextBox
                            x:Name="txttunDNS2Compatible"
                            Grid.Column="2"
                            VerticalAlignment="Stretch"
                            materialDesign:HintAssist.Hint="{x:Static resx:ResUI.TbSettingsTunMode}"
                            AcceptsReturn="True"
                            BorderThickness="1"
                            Style="{StaticResource MaterialDesignOutlinedTextBox}"
                            TextWrapping="Wrap"
                            VerticalScrollBarVisibility="Auto" />
                    </Grid>
                </DockPanel>
            </TabItem>
        </TabControl>
    </DockPanel>
</base:WindowBase>
