<abstract:ComposePageAbstract
    x:Class="Wino.Views.Mail.ComposePage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:abstract="using:Wino.Views.Abstract"
    xmlns:controls="using:Wino.Controls"
    xmlns:controls1="using:Wino.Mail.Controls"
    xmlns:coreControls="using:Wino.Mail.WinUI.Controls"
    xmlns:customcontrols="using:Wino.Mail.WinUI.Controls.CustomControls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:data="using:Wino.Mail.ViewModels.Data"
    xmlns:domain="using:Wino.Core.Domain"
    xmlns:entities="using:Wino.Core.Domain.Entities.Shared"
    xmlns:helpers="using:Wino.Helpers"
    xmlns:mail="using:Wino.Core.Domain.Entities.Mail"
    xmlns:mailkit="using:MimeKit"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
    xmlns:reader="using:Wino.Core.Domain.Models.Reader"
    xmlns:toolkit="using:CommunityToolkit.WinUI.Controls"
    xmlns:ui="using:CommunityToolkit.WinUI"
    x:Name="root"
    d:Background="White"
    Loaded="ComposerLoaded"
    mc:Ignorable="d">

    <Page.Resources>
        <!--  Attachment Template  -->
        <!--  Margin -8 0 is used to remove the padding from the ListViewItem  -->
        <DataTemplate x:Key="ComposerFileAttachmentTemplate" x:DataType="data:MailAttachmentViewModel">
            <Grid
                Height="50"
                Margin="-8,0,0,0"
                Padding="0"
                Background="Transparent"
                ColumnSpacing="3">
                <Grid.ContextFlyout>
                    <MenuFlyout>
                        <MenuFlyoutItem
                            Click="OpenAttachment_Click"
                            CommandParameter="{x:Bind}"
                            Text="{x:Bind domain:Translator.Buttons_Open}" />
                        <MenuFlyoutItem
                            Click="SaveAttachment_Click"
                            CommandParameter="{x:Bind}"
                            Text="{x:Bind domain:Translator.Buttons_Save}" />
                    </MenuFlyout>
                </Grid.ContextFlyout>
                <ToolTipService.ToolTip>
                    <ToolTip Content="{x:Bind FileName}" />
                </ToolTipService.ToolTip>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="36" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <!--  Icon  -->
                <ContentControl
                    VerticalAlignment="Center"
                    Content="{x:Bind AttachmentType}"
                    ContentTemplateSelector="{StaticResource FileTypeIconSelector}" />

                <!--  Name && Size  -->
                <Grid
                    Grid.Column="1"
                    MaxWidth="200"
                    VerticalAlignment="Center">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <TextBlock
                        FontSize="13"
                        MaxLines="2"
                        Text="{x:Bind FileName}"
                        TextTrimming="CharacterEllipsis" />

                    <TextBlock
                        Grid.Row="1"
                        HorizontalAlignment="Right"
                        VerticalAlignment="Bottom"
                        FontSize="11"
                        Foreground="Gray"
                        Text="{x:Bind ReadableSize}" />
                </Grid>

                <Button
                    Grid.Column="2"
                    Margin="0,4,-8,4"
                    VerticalAlignment="Stretch"
                    Background="Transparent"
                    BorderThickness="0"
                    Click="RemoveAttachment_Click"
                    CommandParameter="{x:Bind}">
                    <SymbolIcon
                        Grid.Column="2"
                        VerticalAlignment="Center"
                        Foreground="{StaticResource DeleteBrush}"
                        Symbol="Delete" />
                </Button>

            </Grid>
        </DataTemplate>
    </Page.Resources>

    <Grid
        AllowDrop="True"
        DragLeave="OnComposeGridDragLeave"
        DragOver="OnComposeGridDragOver"
        RowSpacing="7">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Border
            Background="{ThemeResource WinoContentZoneBackgroud}"
            BorderBrush="{StaticResource CardStrokeColorDefaultBrush}"
            BorderThickness="1"
            CornerRadius="7">
            <Grid>
                <Grid.Resources>
                    <SolidColorBrush x:Key="AutoSuggestBoxBorderThemeBrush">Transparent</SolidColorBrush>
                </Grid.Resources>

                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <!--  Format  -->
                <controls1:EditorTabbedCommandBarControl CommandTarget="{x:Bind WebViewEditor}">
                    <controls1:EditorTabbedCommandBarControl.PaneCustomContent>
                        <toolkit:TabbedCommandBarItem
                            CommandAlignment="Right"
                            IsDynamicOverflowEnabled="True"
                            OverflowButtonAlignment="Left">
                            <AppBarElementContainer Visibility="{x:Bind helpers:XamlHelpers.CountToVisibilityConverter(ViewModel.AvailableEmailTemplates.Count), Mode=OneWay}">
                                <ComboBox
                                    x:Name="EmailTemplatesComboBox"
                                    MinWidth="220"
                                    Margin="0,8,8,0"
                                    ItemsSource="{x:Bind ViewModel.AvailableEmailTemplates, Mode=OneWay}"
                                    PlaceholderText="{x:Bind domain:Translator.Composer_EmailTemplatesPlaceholder}"
                                    SelectionChanged="EmailTemplateSelectionChanged">
                                    <ComboBox.ItemTemplate>
                                        <DataTemplate x:DataType="mail:EmailTemplate">
                                            <TextBlock Text="{x:Bind Name}" />
                                        </DataTemplate>
                                    </ComboBox.ItemTemplate>
                                </ComboBox>
                            </AppBarElementContainer>
                            <AppBarButton
                                MinWidth="40"
                                HorizontalContentAlignment="Center"
                                VerticalContentAlignment="Center"
                                Visibility="{x:Bind ViewModel.IsDraftBusy, Mode=OneWay}">
                                <ProgressRing IsActive="True" />
                            </AppBarButton>
                            <AppBarToggleButton
                                x:Name="ComposeAiActionsToggleButton"
                                Checked="ComposeAiActionsToggleButton_Checked"
                                MinWidth="40"
                                HorizontalContentAlignment="Center"
                                LabelPosition="Collapsed"
                                Visibility="{x:Bind GetAiActionsToggleVisibility(ViewModel.PreferencesService.IsAiActionsPanelHidden), Mode=OneWay}"
                                ToolTipService.ToolTip="{x:Bind domain:Translator.Composer_AiActions}">
                                <AppBarToggleButton.Icon>
                                    <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xE945;" />
                                </AppBarToggleButton.Icon>
                            </AppBarToggleButton>
                            <AppBarButton
                                Click="PopOutButton_Click"
                                ToolTipService.ToolTip="{x:Bind domain:Translator.Buttons_PopOut}"
                                Visibility="{x:Bind GetPopOutButtonVisibility(), Mode=OneWay}">
                                <AppBarButton.Icon>
                                    <coreControls:WinoFontIcon Icon="OpenInNewWindow" />
                                </AppBarButton.Icon>
                            </AppBarButton>
                            <AppBarButton Click="ToggleEditorThemeClicked" ToolTipService.ToolTip="{x:Bind GetEditorThemeToolTip(WebViewEditor.IsEditorDarkMode), Mode=OneWay}">
                                <AppBarButton.Icon>
                                    <coreControls:WinoFontIcon Icon="{x:Bind GetEditorThemeIcon(WebViewEditor.IsEditorDarkMode), Mode=OneWay}" />
                                </AppBarButton.Icon>
                            </AppBarButton>
                            <AppBarButton Command="{x:Bind ViewModel.DiscardCommand}" Label="{x:Bind domain:Translator.Buttons_Discard}">
                                <AppBarButton.Icon>
                                    <coreControls:WinoFontIcon Icon="Delete" />
                                </AppBarButton.Icon>
                            </AppBarButton>

                            <AppBarButton
                                Command="{x:Bind ViewModel.SendCommand}"
                                Label="{x:Bind domain:Translator.Buttons_Send}"
                                Visibility="{x:Bind ViewModel.ShouldShowSendButton, Mode=OneWay}">
                                <AppBarButton.Icon>
                                    <coreControls:WinoFontIcon Icon="Send" />
                                </AppBarButton.Icon>
                            </AppBarButton>
                            <AppBarButton
                                Command="{x:Bind ViewModel.SendToServerCommand}"
                                Label="{x:Bind domain:Translator.Buttons_SendToServer}"
                                ToolTipService.ToolTip="{x:Bind domain:Translator.Composer_LocalDraftSyncInfo}"
                                Visibility="{x:Bind ViewModel.ShouldShowSendToServerButton, Mode=OneWay}">
                                <AppBarButton.Icon>
                                    <coreControls:WinoFontIcon Icon="SendNew" />
                                </AppBarButton.Icon>
                            </AppBarButton>
                        </toolkit:TabbedCommandBarItem>
                    </controls1:EditorTabbedCommandBarControl.PaneCustomContent>

                    <controls1:EditorTabbedCommandBarControl.InsertCustomContent>
                        <StackPanel Orientation="Horizontal">
                            <AppBarButton
                                x:Name="FilesButton"
                                Command="{x:Bind ViewModel.AttachFilesCommand}"
                                LabelPosition="Collapsed">
                                <AppBarButton.Icon>
                                    <PathIcon Data="{StaticResource AttachPathIcon}" />
                                </AppBarButton.Icon>
                            </AppBarButton>
                        </StackPanel>
                    </controls1:EditorTabbedCommandBarControl.InsertCustomContent>

                    <controls1:EditorTabbedCommandBarControl.OptionsCustomContent>
                        <StackPanel Orientation="Horizontal" Spacing="8">
                            <ToggleSplitButton x:Name="ImportanceSplitButton" IsChecked="{x:Bind ViewModel.IsImportanceSelected, Mode=TwoWay}">
                                <ToggleSplitButton.Content>
                                    <Viewbox Width="16" Height="16">
                                        <SymbolIcon x:Name="ImportanceSplitButtonContent" Symbol="Important" />
                                    </Viewbox>
                                </ToggleSplitButton.Content>
                                <ToggleSplitButton.Flyout>
                                    <Flyout x:Name="ImportanceFlyout" Placement="Bottom">
                                        <StackPanel Orientation="Horizontal">
                                            <StackPanel.Resources>
                                                <Style TargetType="Button">
                                                    <Setter Property="Padding" Value="4" />
                                                    <Setter Property="MinWidth" Value="0" />
                                                    <Setter Property="MinHeight" Value="0" />
                                                    <Setter Property="Margin" Value="6" />
                                                    <Setter Property="CornerRadius" Value="{StaticResource ControlCornerRadius}" />
                                                </Style>
                                            </StackPanel.Resources>
                                            <Button Click="ImportanceClicked">
                                                <Button.Tag>
                                                    <mailkit:MessageImportance>High</mailkit:MessageImportance>
                                                </Button.Tag>
                                                <SymbolIcon Symbol="Important" />
                                            </Button>
                                            <Button Click="ImportanceClicked">
                                                <Button.Tag>
                                                    <mailkit:MessageImportance>Low</mailkit:MessageImportance>
                                                </Button.Tag>
                                                <SymbolIcon Symbol="Priority" />
                                            </Button>
                                        </StackPanel>
                                    </Flyout>
                                </ToggleSplitButton.Flyout>
                            </ToggleSplitButton>
                            <muxc:ToggleSplitButton
                                x:Name="SignatureToggleButton"
                                Margin="8,0,0,0"
                                IsChecked="{x:Bind ViewModel.IsSmimeSignatureEnabled, Mode=TwoWay}"
                                IsEnabled="{x:Bind ViewModel.AreCertificatesAvailable, Mode=OneWay}"
                                ToolTipService.ToolTip="{x:Bind domain:Translator.Composer_EnableSmimeSignature}">
                                <muxc:ToggleSplitButton.Content>
                                    <Viewbox
                                        Width="16"
                                        Height="16"
                                        Margin="0,0,4,0">
                                        <PathIcon Data="M15 18c.835.629 1.875 1.001 3 1.001a4.978 4.978 0 0 0 3-.999v3.246a.75.75 0 0 1-1.09.67l-.09-.055L18 20.591l-1.82 1.272a.75.75 0 0 1-1.172-.51l-.007-.105L15 18.001Zm4.25-14.996a2.75 2.75 0 0 1 2.745 2.582l.005.168.001 5.246a5.027 5.027 0 0 0-1.5-1.331L20.5 5.754a1.25 1.25 0 0 0-1.122-1.244l-.128-.006H4.75a1.25 1.25 0 0 0-1.244 1.122l-.006.128v9.5c0 .647.492 1.18 1.122 1.243l.128.007h8.92c.1.172.21.338.33.496v1.004H4.75a2.75 2.75 0 0 1-2.745-2.583L2 15.254v-9.5a2.75 2.75 0 0 1 2.582-2.745l.168-.005h14.5ZM18 10A4 4 0 1 1 18 18 4 4 0 0 1 18 10Zm-6.75 2.5a.75.75 0 0 1 .102 1.493L11.25 14h-4.5a.75.75 0 0 1-.102-1.493l.102-.007h4.5Zm6-5.5a.75.75 0 0 1 .102 1.493l-.102.007H6.75a.75.75 0 0 1-.102-1.493L6.75 7h10.5Z" />
                                    </Viewbox>
                                </muxc:ToggleSplitButton.Content>
                                <muxc:ToggleSplitButton.Flyout>
                                    <Flyout Placement="Bottom">
                                        <ListView
                                            Width="320"
                                            ItemsSource="{x:Bind ViewModel.AvailableCertificates, Mode=OneWay}"
                                            SelectedItem="{x:Bind ViewModel.SelectedSigningCertificate, Mode=TwoWay}">
                                            <ListView.ItemTemplate>
                                                <DataTemplate xmlns:x509="using:System.Security.Cryptography.X509Certificates" x:DataType="x509:X509Certificate2">
                                                    <StackPanel Padding="8,4" Orientation="Vertical">
                                                        <TextBlock FontWeight="SemiBold" Text="{x:Bind Subject}" />
                                                        <TextBlock FontSize="12" Text="{x:Bind Issuer}" />
                                                        <TextBlock>
                                                            <Run Text="{x:Bind domain:Translator.Composer_CertificateExpires, Mode=OneTime}" />
                                                            <Run Text="{x:Bind NotAfter, Mode=OneTime}" />
                                                        </TextBlock>
                                                    </StackPanel>
                                                </DataTemplate>
                                            </ListView.ItemTemplate>
                                        </ListView>
                                    </Flyout>
                                </muxc:ToggleSplitButton.Flyout>
                            </muxc:ToggleSplitButton>
                            <ToggleButton
                                x:Name="EncryptionToggleButton"
                                Margin="8,0,0,0"
                                IsChecked="{x:Bind ViewModel.IsSmimeEncryptionEnabled, Mode=TwoWay}"
                                ToolTipService.ToolTip="{x:Bind domain:Translator.Composer_EnableSmimeEncryption}">
                                <ToggleButton.Content>
                                    <Viewbox
                                        Width="16"
                                        Height="16"
                                        Margin="0,0,4,0">
                                        <PathIcon Data="M12 2a4 4 0 0 1 4 4v2h1.75A2.25 2.25 0 0 1 20 10.25v9.5A2.25 2.25 0 0 1 17.75 22H6.25A2.25 2.25 0 0 1 4 19.75v-9.5A2.25 2.25 0 0 1 6.25 8H8V6a4 4 0 0 1 4-4Zm5.75 7.5H6.25a.75.75 0 0 0-.75.75v9.5c0 .414.336.75.75.75h11.5a.75.75 0 0 0 .75-.75v-9.5a.75.75 0 0 0-.75-.75Zm-5.75 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm0-10A2.5 2.5 0 0 0 9.5 6v2h5V6A2.5 2.5 0 0 0 12 3.5Z" />
                                    </Viewbox>
                                </ToggleButton.Content>
                            </ToggleButton>
                            <ToggleButton
                                Margin="8,0,0,0"
                                IsChecked="{x:Bind ViewModel.IsReadReceiptRequested, Mode=TwoWay}"
                                ToolTipService.ToolTip="{x:Bind domain:Translator.Composer_RequestReadReceipt}">
                                <ToggleButton.Content>
                                    <Viewbox
                                        Width="16"
                                        Height="16"
                                        Margin="0,0,4,0">
                                        <PathIcon Data="M10.75 2.5a6.75 6.75 0 1 0 0 13.5 6.75 6.75 0 0 0 0-13.5ZM2.5 9.25a8.25 8.25 0 1 1 15.036 4.71l2.507 2.507a.75.75 0 1 1-1.06 1.06l-2.507-2.507A8.25 8.25 0 0 1 2.5 9.25Zm8.25-3.5a.75.75 0 0 1 .75.75v2.44l1.78 1.187a.75.75 0 0 1-.832 1.248l-2.114-1.41a.75.75 0 0 1-.334-.624V6.5a.75.75 0 0 1 .75-.75Z" />
                                    </Viewbox>
                                </ToggleButton.Content>
                            </ToggleButton>
                        </StackPanel>
                    </controls1:EditorTabbedCommandBarControl.OptionsCustomContent>
                </controls1:EditorTabbedCommandBarControl>

                <!--  Mime Info  -->
                <Grid
                    Grid.Row="1"
                    Padding="16,0,16,4"
                    ColumnSpacing="12"
                    RowSpacing="3">
                    <Grid.RowDefinitions>
                        <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="*" />
                    </Grid.ColumnDefinitions>

                    <!--  From  -->
                    <TextBlock
                        HorizontalAlignment="Right"
                        VerticalAlignment="Center"
                        Text="{x:Bind domain:Translator.ComposerFrom}" />

                    <ComboBox
                        x:Name="AccountsComboBox"
                        Grid.Column="1"
                        IsEditable="False"
                        ItemsSource="{x:Bind ViewModel.AvailableAliases, Mode=OneWay}"
                        SelectedItem="{x:Bind ViewModel.SelectedAlias, Mode=TwoWay}">
                        <ComboBox.ItemTemplate>
                            <DataTemplate x:DataType="mail:MailAccountAlias">
                                <TextBlock Text="{x:Bind AliasAddress}" />
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                    </ComboBox>

                    <!--  To  -->
                    <TextBlock
                        Grid.Row="1"
                        Margin="0,4,0,0"
                        HorizontalAlignment="Right"
                        VerticalAlignment="Center"
                        Text="{x:Bind domain:Translator.ComposerTo}" />

                    <Grid
                        Grid.Row="1"
                        Grid.Column="1"
                        VerticalAlignment="Center">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>

                        <toolkit:TokenizingTextBox
                            x:Name="ToBox"
                            Grid.Column="0"
                            VerticalAlignment="Center"
                            BorderThickness="0"
                            ItemsSource="{x:Bind ViewModel.ToItems, Mode=OneTime}"
                            LostFocus="AddressBoxLostFocus"
                            PlaceholderText="{x:Bind domain:Translator.ComposerToPlaceholder}"
                            SuggestedItemTemplate="{StaticResource ContactSuggestionTemplate}"
                            Tag="ToBox"
                            TokenDelimiter=";"
                            TokenItemAdding="TokenItemAdding"
                            TokenItemTemplate="{StaticResource ContactTokenTemplate}" />

                        <Button
                            x:Name="CCBCCShowButton"
                            Grid.Column="1"
                            Margin="6,6,0,0"
                            VerticalAlignment="Center"
                            Click="ShowCCBCCClicked"
                            GotFocus="CCBBCGotFocus"
                            Visibility="{x:Bind helpers:XamlHelpers.ReverseBoolToVisibilityConverter(ViewModel.IsCCBCCVisible), Mode=OneWay}">
                            <StackPanel Orientation="Horizontal" Spacing="6">
                                <PathIcon
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center"
                                    Data="F1 M 3.75 4.902344 C 3.75 4.225262 3.885091 3.588867 4.155273 2.993164 C 4.425456 2.397461 4.790039 1.878256 5.249023 1.435547 C 5.708008 0.99284 6.238606 0.642904 6.84082 0.385742 C 7.443034 0.128582 8.079427 0 8.75 0 C 9.420572 0 10.056966 0.128582 10.65918 0.385742 C 11.261393 0.642904 11.791992 0.99284 12.250977 1.435547 C 12.709961 1.878256 13.074544 2.397461 13.344727 2.993164 C 13.614908 3.588867 13.75 4.225262 13.75 4.902344 C 13.75 5.332031 13.707682 5.742188 13.623047 6.132812 C 13.538411 6.523438 13.395182 6.907553 13.193359 7.285156 C 12.307942 7.434896 11.484375 7.734375 10.722656 8.183594 C 11.295572 7.819012 11.735025 7.353517 12.041016 6.787109 C 12.347005 6.220704 12.5 5.598959 12.5 4.921875 C 12.5 4.414062 12.399088 3.937176 12.197266 3.491211 C 11.995442 3.045248 11.723633 2.65625 11.381836 2.324219 C 11.040039 1.992188 10.641275 1.730145 10.185547 1.538086 C 9.729817 1.346029 9.251302 1.25 8.75 1.25 C 8.229166 1.25 7.740885 1.347656 7.285156 1.542969 C 6.829427 1.738281 6.432292 2.005209 6.09375 2.34375 C 5.755208 2.682293 5.488281 3.079428 5.292969 3.535156 C 5.097656 3.990887 5 4.479167 5 5 C 5 5.501303 5.096028 5.979818 5.288086 6.435547 C 5.480143 6.891276 5.742188 7.290039 6.074219 7.631836 C 6.40625 7.973633 6.795247 8.245443 7.241211 8.447266 C 7.687174 8.649089 8.164062 8.75 8.671875 8.75 C 9.023438 8.75 9.360352 8.709311 9.682617 8.62793 C 10.004883 8.54655 10.322266 8.417969 10.634766 8.242188 C 9.873047 8.704428 9.222005 9.290365 8.681641 10 L 8.662109 10 C 8.011067 10 7.389323 9.868164 6.796875 9.604492 C 6.204427 9.34082 5.681966 8.984375 5.229492 8.535156 C 4.777018 8.085938 4.417317 7.565104 4.150391 6.972656 C 3.883463 6.380209 3.75 5.755209 3.75 5.097656 Z M 8.75 14.375 C 8.75 13.600261 8.898111 12.871094 9.194336 12.1875 C 9.49056 11.503906 9.892578 10.908203 10.400391 10.400391 C 10.908203 9.892578 11.503906 9.490561 12.1875 9.194336 C 12.871093 8.898112 13.60026 8.75 14.375 8.75 C 14.889322 8.75 15.385741 8.816732 15.864258 8.950195 C 16.342773 9.083659 16.790363 9.272461 17.207031 9.516602 C 17.623697 9.760742 18.004557 10.055339 18.349609 10.400391 C 18.69466 10.745443 18.989258 11.126303 19.233398 11.542969 C 19.477539 11.959636 19.66634 12.407227 19.799805 12.885742 C 19.933268 13.364258 20 13.860678 20 14.375 C 20 15.14974 19.851887 15.878906 19.555664 16.5625 C 19.259439 17.246094 18.857422 17.841797 18.349609 18.349609 C 17.841797 18.857422 17.246094 19.259439 16.5625 19.555664 C 15.878906 19.851889 15.149739 20 14.375 20 C 13.59375 20 12.861328 19.853516 12.177734 19.560547 C 11.494141 19.267578 10.898438 18.867188 10.390625 18.359375 C 9.882812 17.851562 9.482422 17.255859 9.189453 16.572266 C 8.896484 15.888672 8.75 15.15625 8.75 14.375 Z M 0 13.701172 C 0 13.375651 0.066732 13.064779 0.200195 12.768555 C 0.333659 12.472331 0.512695 12.211914 0.737305 11.987305 C 0.961914 11.762695 1.222331 11.583659 1.518555 11.450195 C 1.814779 11.316732 2.125651 11.25 2.451172 11.25 L 7.900391 11.25 C 7.809244 11.451823 7.722981 11.656901 7.641602 11.865234 C 7.560221 12.073568 7.490234 12.285156 7.431641 12.5 L 2.5 12.5 C 2.324219 12.5 2.161458 12.532553 2.011719 12.597656 C 1.861979 12.662761 1.730143 12.752279 1.616211 12.866211 C 1.502279 12.980144 1.41276 13.111979 1.347656 13.261719 C 1.282552 13.411459 1.25 13.574219 1.25 13.75 C 1.25 14.407553 1.359049 14.986979 1.577148 15.488281 C 1.795247 15.989584 2.091471 16.425781 2.46582 16.796875 C 2.840169 17.167969 3.273112 17.478842 3.764648 17.729492 C 4.256185 17.980143 4.777018 18.180338 5.327148 18.330078 C 5.877278 18.479818 6.438802 18.58724 7.011719 18.652344 C 7.584635 18.717447 8.138021 18.75 8.671875 18.75 C 8.847656 18.977865 9.033203 19.192709 9.228516 19.394531 C 9.423828 19.596354 9.635416 19.785156 9.863281 19.960938 C 9.674479 19.973959 9.488932 19.983725 9.306641 19.990234 C 9.124349 19.996744 8.938802 20 8.75 20 C 7.897135 20 7.042643 19.939779 6.186523 19.819336 C 5.330403 19.698893 4.511719 19.462891 3.730469 19.111328 C 3.157552 18.850912 2.641602 18.543295 2.182617 18.188477 C 1.723633 17.833658 1.333008 17.431641 1.010742 16.982422 C 0.688477 16.533203 0.439453 16.035156 0.263672 15.488281 C 0.087891 14.941406 0 14.345703 0 13.701172 Z M 15 15 L 16.875 15 C 17.04427 15 17.190754 14.938151 17.314453 14.814453 C 17.43815 14.690756 17.5 14.544271 17.5 14.375 C 17.5 14.205729 17.43815 14.059245 17.314453 13.935547 C 17.190754 13.81185 17.04427 13.75 16.875 13.75 L 15 13.75 L 15 11.875 C 14.999999 11.705729 14.93815 11.559245 14.814453 11.435547 C 14.690755 11.31185 14.544271 11.25 14.375 11.25 C 14.205729 11.25 14.059244 11.31185 13.935547 11.435547 C 13.811849 11.559245 13.75 11.705729 13.75 11.875 L 13.75 13.75 L 11.875 13.75 C 11.705729 13.75 11.559244 13.81185 11.435547 13.935547 C 11.311849 14.059245 11.25 14.205729 11.25 14.375 C 11.25 14.544271 11.311849 14.690756 11.435547 14.814453 C 11.559244 14.938151 11.705729 15 11.875 15 L 13.75 15 L 13.75 16.875 C 13.75 17.044271 13.811849 17.190756 13.935547 17.314453 C 14.059244 17.43815 14.205729 17.5 14.375 17.5 C 14.544271 17.5 14.690755 17.43815 14.814453 17.314453 C 14.93815 17.190756 14.999999 17.044271 15 16.875 Z " />
                                <TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Composer_CcBcc}" />
                            </StackPanel>
                        </Button>
                    </Grid>

                    <!--  CC BCC  -->
                    <TextBlock
                        x:Name="CCTextBlock"
                        Grid.Row="2"
                        Margin="0,4,0,0"
                        HorizontalAlignment="Right"
                        VerticalAlignment="Center"
                        Text="Cc: "
                        Visibility="{x:Bind ViewModel.IsCCBCCVisible, Mode=OneWay}" />

                    <toolkit:TokenizingTextBox
                        x:Name="CCBox"
                        Grid.Row="2"
                        Grid.Column="1"
                        VerticalAlignment="Center"
                        ItemsSource="{x:Bind ViewModel.CCItems, Mode=OneTime}"
                        LostFocus="AddressBoxLostFocus"
                        PlaceholderText="{x:Bind domain:Translator.ComposerToPlaceholder}"
                        SuggestedItemTemplate="{StaticResource ContactSuggestionTemplate}"
                        Tag="CCBox"
                        TokenDelimiter=";"
                        TokenItemAdding="TokenItemAdding"
                        TokenItemTemplate="{StaticResource ContactTokenTemplate}"
                        Visibility="{x:Bind ViewModel.IsCCBCCVisible, Mode=OneWay}" />

                    <TextBlock
                        x:Name="BccTextBlock"
                        Grid.Row="3"
                        HorizontalAlignment="Right"
                        VerticalAlignment="Center"
                        Text="Bcc: "
                        Visibility="{x:Bind ViewModel.IsCCBCCVisible, Mode=OneWay}" />

                    <toolkit:TokenizingTextBox
                        x:Name="BccBox"
                        Grid.Row="3"
                        Grid.Column="1"
                        VerticalAlignment="Center"
                        ItemsSource="{x:Bind ViewModel.BCCItems, Mode=OneTime}"
                        LostFocus="AddressBoxLostFocus"
                        PlaceholderText="{x:Bind domain:Translator.ComposerToPlaceholder}"
                        SuggestedItemTemplate="{StaticResource ContactSuggestionTemplate}"
                        Tag="BCCBox"
                        TokenDelimiter=";"
                        TokenItemAdding="TokenItemAdding"
                        TokenItemTemplate="{StaticResource ContactTokenTemplate}"
                        Visibility="{x:Bind ViewModel.IsCCBCCVisible, Mode=OneWay}" />

                    <!--  Subject  -->
                    <TextBlock
                        Grid.Row="4"
                        Margin="0,4,0,0"
                        HorizontalAlignment="Right"
                        VerticalAlignment="Center"
                        Text="{x:Bind domain:Translator.ComposerSubject}" />

                    <TextBox
                        Grid.Row="4"
                        Grid.Column="1"
                        Margin="0,4,0,0"
                        BorderThickness="0"
                        Text="{x:Bind ViewModel.Subject, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />

                    <coreControls:AiActionsPanel
                        x:Name="ComposeAiActionsPanel"
                        Grid.Row="5"
                        Grid.ColumnSpan="2"
                        Margin="0,8,0,0"
                        AvailableActions="Rewrite"
                        HtmlHost="{x:Bind}"
                        Visibility="{x:Bind GetAiActionsPanelVisibility(ComposeAiActionsToggleButton.IsChecked, ViewModel.PreferencesService.IsAiActionsPanelHidden), Mode=OneWay}" />

                    <!--  Attachments  -->
                    <ListView
                        x:Name="AttachmentsListView"
                        Grid.Row="6"
                        Grid.ColumnSpan="2"
                        ui:ListViewExtensions.Command="{x:Bind ViewModel.OpenAttachmentCommand}"
                        x:Load="{x:Bind helpers:XamlHelpers.CountToBooleanConverter(ViewModel.IncludedAttachments.Count), Mode=OneWay}"
                        IsItemClickEnabled="True"
                        ItemTemplate="{StaticResource ComposerFileAttachmentTemplate}"
                        ItemsSource="{x:Bind ViewModel.IncludedAttachments, Mode=OneWay}"
                        SelectionMode="None">
                        <ListView.ItemsPanel>
                            <ItemsPanelTemplate>
                                <customcontrols:CustomWrapPanel />
                            </ItemsPanelTemplate>
                        </ListView.ItemsPanel>
                    </ListView>
                </Grid>

                <!--  Dropzone  -->
                <Grid
                    Grid.Row="0"
                    Grid.RowSpan="2"
                    AllowDrop="True"
                    DragLeave="OnFileDropGridDragLeave"
                    DragOver="OnFileDropGridDragOver"
                    Drop="OnFileDropGridFileDropped"
                    Visibility="{x:Bind ViewModel.IsDraggingOverComposerGrid, Mode=OneWay}">
                    <Grid Background="{ThemeResource AcrylicInAppFillColorDefaultBrush}" CornerRadius="9">
                        <Rectangle
                            x:Name="FilesDropZoneBorder"
                            Fill="Transparent"
                            Opacity="0.5"
                            RadiusX="9"
                            RadiusY="9"
                            Stroke="{ThemeResource TextFillColorPrimaryBrush}"
                            StrokeDashArray="3,4"
                            StrokeThickness="2" />
                        <TextBlock
                            x:Name="FilesDropZoneText"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            FontSize="20"
                            FontWeight="SemiBold"
                            Opacity="0.5"
                            Text="{x:Bind domain:Translator.ComposerAttachmentsDropZone_Message}" />
                    </Grid>
                </Grid>
            </Grid>
        </Border>
        <Border
            Grid.Row="1"
            Background="{ThemeResource WinoContentZoneBackgroud}"
            BorderBrush="{StaticResource CardStrokeColorDefaultBrush}"
            BorderThickness="1"
            CornerRadius="7">
            <Grid Margin="1" CornerRadius="7">
                <controls1:WebViewEditorControl x:Name="WebViewEditor" />

                <!--  Dropzone for images  -->
                <Grid
                    AllowDrop="True"
                    DragEnter="OnImageDropGridDragEnter"
                    DragLeave="OnImageDropGridDragLeave"
                    Drop="OnImageDropGridImageDropped"
                    Visibility="{x:Bind ViewModel.IsDraggingOverComposerGrid, Mode=OneWay}">
                    <Grid Background="{ThemeResource AcrylicInAppFillColorDefaultBrush}" CornerRadius="9">
                        <Rectangle
                            x:Name="ImagesDropZoneBorder"
                            Fill="Transparent"
                            Opacity="0.5"
                            RadiusX="9"
                            RadiusY="9"
                            Stroke="{ThemeResource TextFillColorPrimaryBrush}"
                            StrokeDashArray="3,4"
                            StrokeThickness="2" />
                        <TextBlock
                            x:Name="ImagesDropZoneText"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            FontSize="20"
                            FontWeight="SemiBold"
                            Opacity="0.5"
                            Text="{x:Bind domain:Translator.ComposerImagesDropZone_Message}" />
                    </Grid>
                </Grid>
            </Grid>
        </Border>
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="FilesDropZoneState">
                <VisualState x:Name="FilesDropZoneHovered">
                    <VisualState.StateTriggers>
                        <StateTrigger IsActive="{x:Bind ViewModel.IsDraggingOverFilesDropZone, Mode=OneWay}" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="FilesDropZoneText.Opacity" Value="1" />
                        <Setter Target="FilesDropZoneBorder.Opacity" Value="1" />
                    </VisualState.Setters>
                </VisualState>
                <VisualState x:Name="FilesDropZoneNotHovered" />
            </VisualStateGroup>
            <VisualStateGroup x:Name="ImagesDropZoneState">
                <VisualState x:Name="ImagesDropZoneHovered">
                    <VisualState.StateTriggers>
                        <StateTrigger IsActive="{x:Bind ViewModel.IsDraggingOverImagesDropZone, Mode=OneWay}" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="ImagesDropZoneText.Opacity" Value="1" />
                        <Setter Target="ImagesDropZoneBorder.Opacity" Value="1" />
                    </VisualState.Setters>
                </VisualState>
                <VisualState x:Name="ImagesDropZoneNotHovered" />
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>


</abstract:ComposePageAbstract>


