<?php
pxl_add_custom_widget(
    array(
        'name' => 'pxl_divider',
        'title' => esc_html__('BR Divider', 'kaitex'),
        'icon' => 'eicon-divider',
        'categories' => array('pxltheme-core'),
        'params' => array(
            'sections' => array(
                array(
                    'name' => 'section_content',
                    'label' => esc_html__('Divider', 'kaitex'),
                    'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
                    'controls' => array(
                        array(
                            'name' => 'style',
                            'label' => esc_html__( 'Style', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'options' => [
                                'solid'          => esc_html__( 'Solid', 'kaitex' ),
                                'double'         => esc_html__( 'Double', 'kaitex' ),
                                'dotted'         => esc_html__( 'Dotted', 'kaitex' ),
                                'dashed'         => esc_html__( 'Dashed', 'kaitex' ),
                                'curly'          => esc_html__( 'Curly', 'kaitex' ),
                                'curved'         => esc_html__( 'Curved', 'kaitex' ),
                                'slashes'        => esc_html__( 'Slashes', 'kaitex' ),
                                'squared'        => esc_html__( 'Squared', 'kaitex' ),
                                'wavy'           => esc_html__( 'Wavy', 'kaitex' ),
                                'zigzag'         => esc_html__( 'Zigzag', 'kaitex' ),
                                'arrows'         => esc_html__( 'Arrows', 'kaitex' ),
                                'pluses'         => esc_html__( 'Pluses', 'kaitex' ),
                                'rhombus'        => esc_html__( 'Rhombus', 'kaitex' ),
                                'parallelogram'  => esc_html__( 'Parallelogram', 'kaitex' ),
                                'rectangles'     => esc_html__( 'Rectangles', 'kaitex' ),
                                'dots_tribal'    => esc_html__( 'Dots', 'kaitex' ),
                                'trees_2_tribal' => esc_html__( 'Fir Tree', 'kaitex' ),
                                'rounds_tribal'  => esc_html__( 'Half Rounds', 'kaitex' ),
                                'leaves_tribal'  => esc_html__( 'Leaves', 'kaitex' ),
                                'stripes_tribal' => esc_html__( 'Stripes', 'kaitex' ),
                                'squares_tribal' => esc_html__( 'Squares', 'kaitex' ),
                                'trees_tribal'   => esc_html__( 'Trees', 'kaitex' ),
                                'planes_tribal'  => esc_html__( 'Tribal', 'kaitex' ),
                                'x_tribal'       => esc_html__( 'X', 'kaitex' ),
                                'zigzag_tribal'  => esc_html__( 'Zigzag', 'kaitex' ),
                            ],
                            'default' => 'solid',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-divider .divider-separator' => 'border-top-style: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'divider_width',
                            'label' => esc_html__('Width', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => [ 'px', '%', 'vw', 'vh' ],
                            'range' => [
                                '%' => [
                                    'min' => 0,
                                    'max' => 100,
                                ],
                                'px' => [
                                    'min' => 0,
                                    'max' => 3000,
                                ],
                                'vw' => [
                                    'min' => 0,
                                    'max' => 3000,
                                ],
                                'vh' => [
                                    'min' => 0,
                                    'max' => 3000,
                                ],
                            ],
                            'control_type' => 'responsive',
                            'default' => [
                                'size' => 100,
                                'unit' => '%',
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-divider .divider-separator' => 'width: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                        array(
                          'name' => 'align',
                            'label' => esc_html__( 'Alignment', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::CHOOSE,
                            'control_type' => 'responsive',
                            'options' => [
                                'left' => [
                                    'title' => esc_html__( 'Left', 'kaitex' ),
                                    'icon' => 'eicon-text-align-left',
                                ],
                                'center' => [
                                    'title' => esc_html__( 'Center', 'kaitex' ),
                                    'icon' => 'eicon-text-align-center',
                                ],
                                'right' => [
                                    'title' => esc_html__( 'Right', 'kaitex' ),
                                    'icon' => 'eicon-text-align-right',
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-icon' => 'text-align: {{VALUE}};',
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-divider .divider-inner' => 'text-align: {{VALUE}}',
                                '{{WRAPPER}} .pxl-divider .divider-separator' => 'margin: 0 auto; margin-{{VALUE}}: 0',
                            ],
                        ),
                    ),
                ),
                array(
                    'name' => 'section_style',
                    'label' => esc_html__('Divider', 'kaitex'),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array(
                        array(
                            'name' => 'color',
                            'label' => esc_html__( 'Color', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'default' => '#000',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-divider .divider-separator' => 'border-top-color: {{VALUE}};',
                            ],
                            'condition' => [
                                'style' => [
                                    'solid',
                                    'double',
                                    'dotted',
                                    'dashed',
                                ],
                            ],
                        ),
                        array(
                            'name' => 'bg_color',
                            'label' => esc_html__( 'Color', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'default' => '#000',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-divider .divider-separator' => 'background-color: {{VALUE}};',
                            ],
                            'condition' => [
                                'style!' => [
                                    'solid',
                                    'double',
                                    'dotted',
                                    'dashed',
                                ],
                            ],
                        ),
                        array(
                            'name'  => 'divider_weight',
                            'label' => esc_html__( 'Weight', 'kaitex' ),
                            'type'  => 'slider',
                            'size_units' => [ 'px', '%', 'vw', 'vh' ],
                            'range' => [
                                '%' => [
                                    'min' => 0,
                                    'max' => 100,
                                    'step' => 0.1,
                                ],
                                'px' => [
                                    'min' => 0,
                                    'max' => 3000,
                                    'step' => 0.1,
                                ],
                                'vw' => [
                                    'min' => 0,
                                    'max' => 3000,
                                    'step' => 0.1,
                                ],
                                'vh' => [
                                    'min' => 0,
                                    'max' => 3000,
                                    'step' => 0.1,
                                ],
                            ],
                            'default' => [
                                'size' => 1,
                                'unit' => 'px',
                            ],
                            'control_type' => 'responsive',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-divider .divider-separator' => 'border-top-width: {{SIZE}}{{UNIT}};',
                            ],
                            'condition' => [
                                'style' => [
                                    'solid',
                                    'double',
                                    'dotted',
                                    'dashed',
                                    'curly',
                                    'curved',
                                    'slashes',
                                    'squared',
                                    'wavy',
                                    'zigzag',
                                ],
                            ],
                        ),
                        array(
                            'name'  => 'divider_height',
                            'label' => esc_html__( 'Size', 'kaitex' ),
                            'type'  => 'slider',
                            'size_units' => [ 'px', '%', 'vw', 'vh' ],
                            'range' => [
                                '%' => [
                                    'min' => 0,
                                    'max' => 100,
                                    'step' => 0.1,
                                ],
                                'px' => [
                                    'min' => 0,
                                    'max' => 3000,
                                    'step' => 0.1,
                                ],
                                'vw' => [
                                    'min' => 0,
                                    'max' => 3000,
                                    'step' => 0.1,
                                ],
                                'vh' => [
                                    'min' => 0,
                                    'max' => 3000,
                                    'step' => 0.1,
                                ],
                            ],
                            'default' => [
                                'size' => 20,
                                'unit' => 'px',
                            ],
                            'control_type' => 'responsive',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-divider .divider-separator' => 'min-height: {{SIZE}}{{UNIT}};',
                            ],
                            'condition' => [
                                'style!' => [
                                    'solid',
                                    'double',
                                    'dotted',
                                    'dashed',
                                ],
                            ],
                        ),
                        array(
                            'name' => 'divider_size',
                            'label' => esc_html__('Divider Size', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::CHOOSE,
                            'control_type' => 'responsive',
                            'options' => [
                                'custom' => [
                                    'title' => esc_html__('Custom', 'kaitex' ),
                                    'icon' => 'eicon-text-align-justify',
                                ],
                                'auto' => [
                                    'title' => esc_html__('Auto', 'kaitex' ),
                                    'icon' => 'eicon-h-align-stretch',
                                ],
                            ],
                            'default' => 'custom',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-divider .divider-separator' => '-webkit-mask-size: {{VALUE}} 100%; mask-size: {{VALUE}} 100%;',
                            ],
                            'condition' => [
                                'style!' => [
                                    'solid',
                                    'double',
                                    'dotted',
                                    'dashed',
                                ],
                            ],
                        ),
                        array(
                            'name'  => 'divider_amount',
                            'label' => esc_html__( 'Amount', 'kaitex' ),
                            'type'  => 'slider',
                            'size_units' => [ 'px', '%', 'vw', 'vh' ],
                            'range' => [
                                '%' => [
                                    'min' => 0,
                                    'max' => 100,
                                    'step' => 0.1,
                                ],
                                'px' => [
                                    'min' => 0,
                                    'max' => 3000,
                                    'step' => 0.1,
                                ],
                                'vw' => [
                                    'min' => 0,
                                    'max' => 3000,
                                    'step' => 0.1,
                                ],
                                'vh' => [
                                    'min' => 0,
                                    'max' => 3000,
                                    'step' => 0.1,
                                ],
                            ],
                            'default' => [
                                'size' => 20,
                                'unit' => 'px',
                            ],
                            'control_type' => 'responsive',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-divider .divider-separator' => '-webkit-mask-size: {{SIZE}}{{UNIT}} 100%; mask-size: {{SIZE}}{{UNIT}} 100%;',
                            ],
                            'condition' => [
                                'style!' => [
                                    'solid',
                                    'double',
                                    'dotted',
                                    'dashed',
                                ],
                                'divider_size' => ['custom'],
                            ],
                        ),
                        array(
                            'name' => 'mask_size',
                            'label' => esc_html__( 'Mask Size', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'options' => [
                                'repeat-x'      => esc_html__( 'Repeat X', 'kaitex' ),
                                'round'         => esc_html__( 'Round', 'kaitex' ),
                            ],
                            'default' => 'repeat-x',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-divider .divider-separator' => '-webkit-mask-repeat: {{VALUE}}; mask-repeat: {{VALUE}}; -webkit-mask-image: var(--divider-pattern-url); mask-image: var(--divider-pattern-url);',
                            ],
                            'condition' => [
                                'style!' => [
                                    'solid',
                                    'double',
                                    'dotted',
                                    'dashed',
                                ],
                            ],
                        ),
                        array(
                            'name'  => 'divider_rotate',
                            'label' => esc_html__( 'Rotate', 'kaitex' ),
                            'type'  => 'slider',
                            'size_units' => [ 'px' ],
                            'range' => [
                                'px' => [
                                    'min' => -360,
                                    'max' => 360,
                                ],
                            ],
                            'control_type' => 'responsive',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-divider' => '-webkit-transform: rotate({{SIZE}}deg); -ms-transform: rotate({{SIZE}}deg); transform: rotate({{SIZE}}deg);',
                            ],
                        ),
                        array(
                            'name' => 'divider_padding',
                            'label' => esc_html__('Padding', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::DIMENSIONS,
                            'control_type' => 'responsive',
                            'size_units' => [ 'px', '%', 'vw', 'vh' ],
                            'default' => [
                                'unit' => 'px',
                                'top' => 15,
                                'right' => 0,
                                'bottom' => 15,
                                'left' => 0,
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-divider .divider-inner' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                            ],
                            'separator' => 'before',
                        ),
                    ),
                ),
                kaitex_widget_animation_settings()
            ),
        ),
    ),
    kaitex_get_class_widget_path()
);