<abstract:ComposePageAbstract
    x:Class="Wino.Views.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:coreControls="using:Wino.Core.UWP.Controls"
    xmlns:customcontrols="using:Wino.Core.UWP.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: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>
        <DataTemplate x:Key="TokenBoxTemplate" x:DataType="entities:AccountContact">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <ToolTipService.ToolTip>
                    <ToolTip Content="{x:Bind Address}" />
                </ToolTipService.ToolTip>

                <!--  TODO: Display contact info.  -->
                <!--<Grid.ContextFlyout>
                    <MenuFlyout Placement="RightEdgeAlignedBottom">
                        <MenuFlyoutItem Text="{x:Bind domain:Translator.ViewContactDetails}" />
                    </MenuFlyout>
                </Grid.ContextFlyout>-->

                <Viewbox Width="24">
                    <controls:ImagePreviewControl
                        FromAddress="{x:Bind Address}"
                        FromName="{x:Bind Name}"
                        SenderContactPicture="{x:Bind Base64ContactPicture}" />
                </Viewbox>

                <TextBlock
                    Grid.Column="1"
                    Margin="6,0,8,0"
                    VerticalAlignment="Center"
                    Text="{x:Bind Name}" />
            </Grid>
        </DataTemplate>
        <DataTemplate x:Key="SuggestionBoxTemplate" x:DataType="entities:AccountContact">
            <Grid Margin="0,12" ColumnSpacing="6">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <controls:ImagePreviewControl
                    FromAddress="{x:Bind Address}"
                    FromName="{x:Bind Name}"
                    SenderContactPicture="{x:Bind Base64ContactPicture}" />
                <TextBlock Grid.Column="1">
                    <Run FontWeight="SemiBold" Text="{x:Bind Name}" /><LineBreak /><Run Text="{x:Bind Address}" />
                </TextBlock>
            </Grid>
        </DataTemplate>

        <!--  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
                            Command="{Binding ElementName=root, Path=ViewModel.OpenAttachmentCommand}"
                            CommandParameter="{Binding}"
                            Text="{x:Bind domain:Translator.Buttons_Open}" />
                        <MenuFlyoutItem
                            Command="{Binding ElementName=root, Path=ViewModel.SaveAttachmentCommand}"
                            CommandParameter="{Binding}"
                            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"
                    Command="{Binding ElementName=root, Path=ViewModel.RemoveAttachmentCommand}"
                    CommandParameter="{Binding}">
                    <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  -->
                <toolkit:TabbedCommandBar>
                    <toolkit:TabbedCommandBar.Resources>
                        <SolidColorBrush x:Key="TabContentContentBorderBackground" Color="Transparent" />
                        <SolidColorBrush x:Key="TabContentContentBorderBorderBrush" Color="Transparent" />
                        <Thickness x:Key="TabContentBorderBorderThickness">0</Thickness>
                    </toolkit:TabbedCommandBar.Resources>
                    <toolkit:TabbedCommandBar.PaneCustomContent>
                        <toolkit:TabbedCommandBarItem
                            CommandAlignment="Right"
                            IsDynamicOverflowEnabled="True"
                            OverflowButtonAlignment="Left">
                            <AppBarButton
                                Click="InvertComposerThemeClicked"
                                LabelPosition="Collapsed"
                                ToolTipService.ToolTip="Light Theme"
                                Visibility="{x:Bind IsComposerDarkMode, Mode=OneWay}">
                                <AppBarButton.Icon>
                                    <coreControls:WinoFontIcon Icon="LightEditor" />
                                </AppBarButton.Icon>
                            </AppBarButton>

                            <AppBarButton
                                Click="InvertComposerThemeClicked"
                                LabelPosition="Collapsed"
                                ToolTipService.ToolTip="Dark Theme"
                                Visibility="{x:Bind IsComposerDarkMode, Mode=OneWay, Converter={StaticResource ReverseBooleanToVisibilityConverter}}">
                                <AppBarButton.Icon>
                                    <coreControls:WinoFontIcon Icon="DarkEditor" />
                                </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}">
                                <AppBarButton.Icon>
                                    <coreControls:WinoFontIcon Icon="Send" />
                                </AppBarButton.Icon>
                            </AppBarButton>
                        </toolkit:TabbedCommandBarItem>
                    </toolkit:TabbedCommandBar.PaneCustomContent>
                    <toolkit:TabbedCommandBar.MenuItems>
                        <toolkit:TabbedCommandBarItem DefaultLabelPosition="Collapsed" Header="{x:Bind domain:Translator.EditorToolbarOption_Format}">
                            <AppBarToggleButton
                                x:Name="BoldButton"
                                Click="BoldButtonClicked"
                                Label="Bold">
                                <AppBarToggleButton.Icon>
                                    <PathIcon Data="{StaticResource BoldPathIcon}" />
                                </AppBarToggleButton.Icon>
                            </AppBarToggleButton>
                            <AppBarToggleButton
                                x:Name="ItalicButton"
                                Click="ItalicButtonClicked"
                                Label="Italic">
                                <AppBarToggleButton.Icon>
                                    <PathIcon Data="{StaticResource ItalicPathIcon}" />
                                </AppBarToggleButton.Icon>
                            </AppBarToggleButton>
                            <AppBarToggleButton
                                x:Name="UnderlineButton"
                                Click="UnderlineButtonClicked"
                                Label="Underline">
                                <AppBarToggleButton.Icon>
                                    <PathIcon Data="{StaticResource UnderlinePathIcon}" />
                                </AppBarToggleButton.Icon>
                            </AppBarToggleButton>
                            <AppBarToggleButton
                                x:Name="StrokeButton"
                                Click="StrokeButtonClicked"
                                Label="Stroke">
                                <AppBarToggleButton.Icon>
                                    <PathIcon Data="{StaticResource StrikePathIcon}" />
                                </AppBarToggleButton.Icon>
                            </AppBarToggleButton>

                            <AppBarSeparator />

                            <AppBarToggleButton
                                x:Name="BulletListButton"
                                Click="BulletListButtonClicked"
                                Label="Bullet List">
                                <AppBarToggleButton.Icon>
                                    <PathIcon Data="{StaticResource BulletedListPathIcon}" />
                                </AppBarToggleButton.Icon>
                            </AppBarToggleButton>

                            <AppBarToggleButton
                                x:Name="OrderedListButton"
                                Click="OrderedListButtonClicked"
                                Label="Ordered List">
                                <AppBarToggleButton.Icon>
                                    <PathIcon Data="{StaticResource OrderedListPathIcon}" />
                                </AppBarToggleButton.Icon>
                            </AppBarToggleButton>

                            <AppBarSeparator />

                            <AppBarButton
                                x:Name="DecreaseIndentButton"
                                Click="DecreaseIndentClicked"
                                Label="Outdent">
                                <AppBarButton.Content>
                                    <Viewbox Width="16">
                                        <PathIcon Data="{StaticResource DecreaseIndentPathIcon}" />
                                    </Viewbox>
                                </AppBarButton.Content>
                            </AppBarButton>

                            <AppBarButton
                                x:Name="IncreaseIndentButton"
                                Click="IncreaseIndentClicked"
                                Label="Indent">
                                <AppBarButton.Content>
                                    <Viewbox Width="16">
                                        <PathIcon Data="{StaticResource IncreaseIndentPathIcon}" />
                                    </Viewbox>
                                </AppBarButton.Content>
                            </AppBarButton>

                            <AppBarElementContainer HorizontalAlignment="Center" VerticalAlignment="Center">
                                <ComboBox
                                    x:Name="AlignmentListView"
                                    VerticalAlignment="Center"
                                    Background="Transparent"
                                    BorderBrush="Transparent"
                                    SelectionChanged="AlignmentChanged">
                                    <ComboBoxItem IsSelected="True" Tag="left">
                                        <StackPanel Orientation="Horizontal" Spacing="8">
                                            <Viewbox Width="16">
                                                <PathIcon Data="{StaticResource AlignLeftPathIcon}" />
                                            </Viewbox>
                                            <TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Left}" />
                                        </StackPanel>
                                    </ComboBoxItem>

                                    <ComboBoxItem Tag="center">
                                        <StackPanel Orientation="Horizontal" Spacing="8">
                                            <Viewbox Width="16">
                                                <PathIcon Data="{StaticResource AlignCenterPathIcon}" />
                                            </Viewbox>
                                            <TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Center}" />
                                        </StackPanel>
                                    </ComboBoxItem>

                                    <ComboBoxItem Tag="right">
                                        <StackPanel Orientation="Horizontal" Spacing="8">
                                            <Viewbox Width="16">
                                                <PathIcon Data="{StaticResource AlignRightPathIcon}" />
                                            </Viewbox>
                                            <TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Right}" />
                                        </StackPanel>
                                    </ComboBoxItem>

                                    <ComboBoxItem Tag="justify">
                                        <StackPanel Orientation="Horizontal" Spacing="8">
                                            <Viewbox Width="16">
                                                <PathIcon Data="{StaticResource AlignJustifyPathIcon}" />
                                            </Viewbox>
                                            <TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Justify}" />
                                        </StackPanel>
                                    </ComboBoxItem>
                                </ComboBox>
                            </AppBarElementContainer>

                            <AppBarSeparator />

                            <AppBarToggleButton
                                x:Name="WebviewToolBarButton"
                                Click="WebViewToggleButtonClicked"
                                Label="{x:Bind domain:Translator.EditorTooltip_WebViewEditor}"
                                ToolTipService.ToolTip="{x:Bind domain:Translator.EditorTooltip_WebViewEditor}">
                                <AppBarToggleButton.Icon>
                                    <PathIcon Data="{StaticResource WebviewToolBarPathIcon}" />
                                </AppBarToggleButton.Icon>
                            </AppBarToggleButton>
                        </toolkit:TabbedCommandBarItem>

                        <!--  Insert  -->
                        <toolkit:TabbedCommandBarItem Header="{x:Bind domain:Translator.EditorToolbarOption_Insert}">
                            <AppBarButton
                                x:Name="FilesButton"
                                Command="{x:Bind ViewModel.AttachFilesCommand}"
                                Label="{x:Bind domain:Translator.Files}">
                                <AppBarButton.Icon>
                                    <PathIcon Data="{StaticResource AttachPathIcon}" />
                                </AppBarButton.Icon>
                            </AppBarButton>

                            <AppBarButton
                                x:Name="AddImageButton"
                                Click="AddImageClicked"
                                Label="{x:Bind domain:Translator.Photos}">
                                <AppBarButton.Icon>
                                    <PathIcon Data="{StaticResource AddPhotoPathIcon}" />
                                </AppBarButton.Icon>
                            </AppBarButton>

                            <AppBarButton
                                x:Name="EmojiButton"
                                Click="EmojiButtonClicked"
                                Label="{x:Bind domain:Translator.Emoji}">
                                <AppBarButton.Icon>
                                    <PathIcon Data="{StaticResource EmojiPathIcon}" />
                                </AppBarButton.Icon>
                            </AppBarButton>
                        </toolkit:TabbedCommandBarItem>

                        <!--  Options  -->
                        <toolkit:TabbedCommandBarItem Header="{x:Bind domain:Translator.EditorToolbarOption_Options}">
                            <AppBarElementContainer>
                                <muxc:ToggleSplitButton x:Name="ImportanceSplitButton" IsChecked="{x:Bind ViewModel.IsImportanceSelected, Mode=TwoWay}">
                                    <Viewbox Width="16" Height="16">
                                        <SymbolIcon x:Name="ImportanceSplitButtonContent" Symbol="Important" />
                                    </Viewbox>
                                    <muxc: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>
                                    </muxc:ToggleSplitButton.Flyout>
                                </muxc:ToggleSplitButton>
                            </AppBarElementContainer>
                        </toolkit:TabbedCommandBarItem>
                    </toolkit:TabbedCommandBar.MenuItems>
                </toolkit:TabbedCommandBar>

                <!--  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" />
                    </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"
                        DisplayMemberPath="AliasAddress"
                        IsEditable="False"
                        ItemsSource="{x:Bind ViewModel.AvailableAliases, Mode=OneWay}"
                        SelectedItem="{x:Bind ViewModel.SelectedAlias, Mode=TwoWay}" />

                    <!--  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 SuggestionBoxTemplate}"
                            Tag="ToBox"
                            TokenDelimiter=";"
                            TokenItemAdding="TokenItemAdding"
                            TokenItemTemplate="{StaticResource TokenBoxTemplate}" />

                        <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="Cc &amp; Bcc" />
                            </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 SuggestionBoxTemplate}"
                        Tag="CCBox"
                        TokenDelimiter=";"
                        TokenItemAdding="TokenItemAdding"
                        TokenItemTemplate="{StaticResource TokenBoxTemplate}"
                        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 SuggestionBoxTemplate}"
                        Tag="BCCBox"
                        TokenDelimiter=";"
                        TokenItemAdding="TokenItemAdding"
                        TokenItemTemplate="{StaticResource TokenBoxTemplate}"
                        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}" />

                    <!--  Attachments  -->
                    <ListView
                        x:Name="AttachmentsListView"
                        Grid.Row="5"
                        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">
                <Grid Background="White" Visibility="{x:Bind IsComposerDarkMode, Converter={StaticResource ReverseBooleanToVisibilityConverter}, Mode=OneWay}" />

                <muxc:WebView2 x:Name="Chromium" />

                <!--  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>
