Plugin Directory

Changeset 3443916


Ignore:
Timestamp:
01/21/2026 09:56:34 AM (5 weeks ago)
Author:
alimran01
Message:

Added new v1.4.0 in trunk

Location:
changeloger/trunk
Files:
211 added
6 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • changeloger/trunk/admin/class-changeloger-admin.php

    r3397941 r3443916  
    1414    private $usage_table;
    1515    private $settings;
     16    private $releases;
     17    private $feedback;
     18    private $roadmap;
    1619
    1720    public static function get_instance() {
     
    2629        $this->init_admin_pages();
    2730        add_action( 'admin_menu', [ $this, 'add_admin_menu' ] );
     31        add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_global_styles' ] );
    2832    }
    2933
     
    3438        require_once __DIR__ . '/class-changeloger-dashboard.php';
    3539        require_once __DIR__ . '/class-changeloger-usage-table.php';
    36         require_once __DIR__ . '/class-changeloger-settings.php';
     40        // Settings are now handled by CSF in includes/options/settings-options.php
     41        require_once __DIR__ . '/class-changeloger-releases.php';
     42       
     43        // Always load promo classes in free plugin
     44        // Premium classes are provided by changeloger-pro plugin
     45        require_once __DIR__ . '/class-changeloger-feedback-promo.php';
     46        require_once __DIR__ . '/class-changeloger-roadmap-promo.php';
     47    }
     48
     49    /**
     50     * Check if user has premium access
     51     * Uses global cha_is_premium() which checks both Freemius license
     52     * AND Changeloger_Pro class existence (following EazyDocs pattern).
     53     */
     54    private function is_premium() {
     55        return function_exists( 'cha_is_premium' ) && cha_is_premium();
    3756    }
    3857
     
    4362        $this->dashboard = new Changeloger_Dashboard();
    4463        $this->usage_table = new Changeloger_Usage_Table_Admin();
    45         $this->settings = new Changeloger_Settings();
     64        // Settings are now handled by CSF
     65        $this->releases = new Changeloger_Releases();
     66       
     67        // Feedback and Roadmap are initialized lazily via get_feedback() and get_roadmap()
     68        // to allow changeloger-pro to load its classes first
    4669    }
    4770
     
    6184        );
    6285
     86        // Add Dashboard submenu (replaces the default 'Changeloger' submenu label)
     87        add_submenu_page(
     88            'changeloger',
     89            __( 'Dashboard', 'changeloger' ),
     90            __( 'Dashboard', 'changeloger' ),
     91            'manage_options',
     92            'changeloger',
     93            [ $this->dashboard, 'render_page' ]
     94        );
     95
    6396        // Add Usage Table submenu
    6497        add_submenu_page(
     
    71104        );
    72105
    73         // Add Settings submenu
    74         add_submenu_page(
    75             'changeloger',
    76             __( 'Settings', 'changeloger' ),
    77             __( 'Settings', 'changeloger' ),
    78             'manage_options',
    79             'changeloger-settings',
    80             [ $this->settings, 'render_page' ]
    81         );
     106        // Settings submenu is created automatically by CSF in includes/options/settings-options.php
     107
     108        // Add Releases submenu
     109        add_submenu_page(
     110            'changeloger',
     111            __( 'Releases', 'changeloger' ),
     112            __( 'Releases', 'changeloger' ),
     113            'manage_options',
     114            'changeloger-releases',
     115            [ $this->releases, 'render_page' ]
     116        );
     117
     118        // Add Feedback submenu
     119        add_submenu_page(
     120            'changeloger',
     121            __( 'Feedback', 'changeloger' ),
     122            __( 'Feedback', 'changeloger' ),
     123            'manage_options',
     124            'changeloger-feedback',
     125            [ $this, 'render_feedback_page' ]
     126        );
     127
     128        // Add Roadmap submenu
     129        add_submenu_page(
     130            'changeloger',
     131            __( 'Roadmap', 'changeloger' ),
     132            __( 'Roadmap', 'changeloger' ),
     133            'manage_options',
     134            'changeloger-roadmap',
     135            [ $this, 'render_roadmap_page' ]
     136        );
     137    }
     138
     139    /**
     140     * Render feedback page - lazy loads the correct class
     141     */
     142    public function render_feedback_page() {
     143        $this->get_feedback()->render_page();
     144    }
     145
     146    /**
     147     * Render roadmap page - lazy loads the correct class
     148     */
     149    public function render_roadmap_page() {
     150        $this->get_roadmap()->render_page();
    82151    }
    83152
     
    101170    public function get_settings() {
    102171        return $this->settings;
     172    }
     173
     174    /**
     175     * Get feedback instance - lazy loads the correct class
     176     * Uses premium class from changeloger-pro if available, else promo page
     177     */
     178    public function get_feedback() {
     179        if ( null === $this->feedback ) {
     180            if ( $this->is_premium() && class_exists( 'Changeloger_Feedback' ) ) {
     181                $this->feedback = Changeloger_Feedback::get_instance();
     182            } else {
     183                $this->feedback = Changeloger_Feedback_Promo::get_instance();
     184            }
     185        }
     186        return $this->feedback;
     187    }
     188
     189    /**
     190     * Get roadmap instance - lazy loads the correct class
     191     * Uses premium class from changeloger-pro if available, else promo page
     192     */
     193    public function get_roadmap() {
     194        if ( null === $this->roadmap ) {
     195            if ( $this->is_premium() && class_exists( 'Changeloger_Roadmap' ) ) {
     196                $this->roadmap = Changeloger_Roadmap::get_instance();
     197            } else {
     198                $this->roadmap = Changeloger_Roadmap_Promo::get_instance();
     199            }
     200        }
     201        return $this->roadmap;
     202    }
     203
     204    /**
     205     * Enqueue global styles on all Changeloger admin pages
     206     *
     207     * @param string $hook Current admin page hook.
     208     */
     209    public function enqueue_global_styles( $hook ) {
     210        $changeloger_pages = [
     211            'toplevel_page_changeloger',
     212            'changeloger_page_changeloger-usage',
     213            'changeloger_page_changeloger-settings',
     214            'changeloger_page_changeloger-releases',
     215            'changeloger_page_changeloger-feedback',
     216            'changeloger_page_changeloger-roadmap',
     217        ];
     218
     219        // Check if current page is a Changeloger page
     220        if ( in_array( $hook, $changeloger_pages, true ) ) {
     221            wp_enqueue_style(
     222                'cha-admin-global',
     223                plugins_url( 'assets/css/admin-global.css', dirname( __FILE__ ) ),
     224                [],
     225                '1.0.0'
     226            );
     227        }
    103228    }
    104229}
     
    113238    function cha_hide_notices_on_dashboard(): void {
    114239        $page = $_GET['page'] ?? '';
    115         if ( in_array( $page, [ 'changeloger', 'changeloger-settings', 'changeloger-usage' ] ) ) {
     240        if ( in_array( $page, [ 'changeloger', 'changeloger-settings', 'changeloger-usage', 'changeloger-releases', 'changeloger-feedback', 'changeloger-roadmap' ,'changeloger-account'] ) ) {
    116241            // Remove all admin notices
    117242            remove_all_actions( 'admin_notices' );
  • changeloger/trunk/admin/class-changeloger-dashboard.php

    r3397941 r3443916  
    11<?php
    22
    3 if ( ! defined( 'ABSPATH' ) ) {
    4     exit; // Exit if accessed directly.
     3if (! defined('ABSPATH')) {
     4    exit;
    55}
    66
    77/**
    88 * Changeloger Dashboard Admin Page
     9 *
     10 * Practical, data-focused dashboard with actionable insights.
    911 */
    10 class Changeloger_Dashboard {
    11 
    12     public function __construct() {
    13         // Constructor can be used for hooks specific to dashboard
     12class Changeloger_Dashboard
     13{
     14
     15    public function __construct()
     16    {
     17        add_action('admin_enqueue_scripts', [$this, 'enqueue_dashboard_styles']);
     18    }
     19
     20    /**
     21     * Enqueue dashboard-specific styles
     22     */
     23    public function enqueue_dashboard_styles($hook)
     24    {
     25        // Only load on Changeloger pages
     26        if ($hook !== 'toplevel_page_changeloger') {
     27            return;
     28        }
     29
     30        wp_enqueue_style(
     31            'cha-dashboard',
     32            plugins_url('assets/css/dashboard.css', dirname(__FILE__)),
     33            [],
     34            defined('CHANGELOGER_VERSION') ? CHANGELOGER_VERSION : '1.0.0'
     35        );
    1436    }
    1537
     
    1739     * Render the dashboard page
    1840     */
    19     public function render_page() {
    20         echo '<div class="wrap">';
    21         echo '<h1>' . __( 'Changeloger Dashboard', 'changeloger' ) . '</h1>';
    22         echo '<div class="changeloger-dashboard">';
    23 
    24         // Statistics cards
    25         echo '<div class="changeloger-stats-grid" style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin: 20px 0;">';
    26 
    27         // Total usage card
    28         $total_usage = $this->get_total_usage();
    29         echo '<div class="changeloger-stat-card" style="background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">';
    30         echo '<h3 style="margin: 0 0 10px 0; color: #2271b1;">' . __( 'Total Usage', 'changeloger' ) . '</h3>';
    31         echo '<p style="font-size: 24px; font-weight: bold; margin: 0; color: #1d2327;">' . $total_usage . '</p>';
    32         echo '<p style="margin: 5px 0 0 0; color: #646970;">' . __( 'Posts and pages using Changeloger blocks', 'changeloger' ) . '</p>';
    33         echo '</div>';
    34 
    35         // Block types card
    36         $block_stats = $this->get_block_statistics();
    37         echo '<div class="changeloger-stat-card" style="background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">';
    38         echo '<h3 style="margin: 0 0 10px 0; color: #2271b1;">' . __( 'Block Types', 'changeloger' ) . '</h3>';
    39         echo '<p style="margin: 5px 0; color: #1d2327;"><strong>' . __( 'Changeloger:', 'changeloger' ) . '</strong> ' . $block_stats['changeloger'] . '</p>';
    40         echo '<p style="margin: 5px 0; color: #1d2327;"><strong>' . __( 'Tabbed Changeloger:', 'changeloger' ) . '</strong> ' . $block_stats['tabbed'] . '</p>';
    41         echo '</div>';
    42 
    43         echo '</div>';
    44 
    45         // Quick actions
    46         echo '<div class="changeloger-quick-actions" style="margin: 30px 0;">';
    47         echo '<h2>' . __( 'Quick Actions', 'changeloger' ) . '</h2>';
    48         echo '<div style="display: flex; gap: 15px; flex-wrap: wrap;">';
    49         echo '<a href="' . admin_url( 'admin.php?page=changeloger-usage' ) . '" class="button button-primary">' . __( 'View Usage Table', 'changeloger' ) . '</a>';
    50         echo '<a href="' . admin_url( 'admin.php?page=changeloger-settings' ) . '" class="button button-secondary">' . __( 'Settings', 'changeloger' ) . '</a>';
    51         echo '<a href="' . admin_url( 'post-new.php' ) . '" class="button button-secondary">' . __( 'Create New Post', 'changeloger' ) . '</a>';
    52         echo '</div>';
    53         echo '</div>';
    54 
    55         // Recent usage
    56         echo '<div class="changeloger-recent-usage" style="margin: 30px 0;">';
    57         echo '<h2>' . __( 'Recent Usage', 'changeloger' ) . '</h2>';
    58         $recent_items = $this->get_recent_usage(5);
    59         if (!empty($recent_items)) {
    60             echo '<div class="changeloger-recent-list" style="background: #fff; border: 1px solid #ddd; border-radius: 8px;">';
    61             foreach ($recent_items as $item) {
    62                 echo '<div style="padding: 15px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center;">';
    63                 echo '<div>';
    64                 echo '<strong><a href="' . $item['edit_link'] . '">' . esc_html($item['title']) . '</a></strong>';
    65                 echo '<br><small style="color: #646970;">' . esc_html($item['post_type']) . ' • ' . esc_html($item['block_name']) . '</small>';
    66                 echo '</div>';
    67                 echo '<div style="text-align: right; color: #646970; font-size: 12px;">';
    68                 echo date('M j, Y', strtotime($item['date']));
    69                 echo '</div>';
    70                 echo '</div>';
    71             }
    72             echo '</div>';
    73         } else {
    74             echo '<p>' . __( 'No recent usage found.', 'changeloger' ) . '</p>';
     41    public function render_page()
     42    {
     43        $stats = $this->get_all_stats();
     44        $feedback_status = $this->get_feedback_by_status();
     45        $recent_releases = $this->get_recent_releases(5);
     46        $recent_feedback = $this->get_recent_feedback(5);
     47        $system_status = $this->get_system_status();
     48        $is_premium = function_exists('cha_fs') && cha_fs()->can_use_premium_code__premium_only();
     49        $version = defined('CHANGELOGER_VERSION') ? CHANGELOGER_VERSION : '1.0.0';
     50
     51?>
     52        <div class="cha-dashboard">
     53            <!-- Header -->
     54            <div class="cha-dash-header">
     55                <h1>
     56                    <?php esc_html_e('Dashboard', 'changeloger'); ?>
     57                    <span class="version">v<?php echo esc_html($version); ?></span>
     58                </h1>
     59                <div class="cha-dash-header-actions">
     60                    <a href="<?php echo esc_url(admin_url('admin.php?page=changeloger-releases')); ?>" class="cha-dash-btn cha-dash-btn-primary">
     61                        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" width="16" height="16">
     62                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
     63                        </svg>
     64                        <?php esc_html_e('New Release', 'changeloger'); ?>
     65                    </a>
     66                    <a href="<?php echo esc_url(admin_url('admin.php?page=changeloger-settings')); ?>" class="cha-dash-btn cha-dash-btn-secondary">
     67                        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" width="16" height="16">
     68                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
     69                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
     70                        </svg>
     71                        <?php esc_html_e('Settings', 'changeloger'); ?>
     72                    </a>
     73                </div>
     74            </div>
     75
     76            <!-- Stats Grid -->
     77            <div class="cha-stats-grid">
     78                <!-- Products Card -->
     79                <a href="<?php echo esc_url(admin_url('admin.php?page=changeloger-releases')); ?>" class="cha-stat-card">
     80                    <div class="cha-stat-icon-wrapper" style="background: #eff6ff; color: #3b82f6;">
     81                        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
     82                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" />
     83                        </svg>
     84                    </div>
     85                    <div class="cha-stat-content">
     86                        <span class="cha-stat-label"><?php esc_html_e('Total Products', 'changeloger'); ?></span>
     87                        <div class="cha-stat-value"><?php echo esc_html($stats['products']); ?></div>
     88                    </div>
     89                    <div class="cha-stat-arrow">
     90                        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
     91                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
     92                        </svg>
     93                    </div>
     94                </a>
     95
     96                <!-- Releases Card -->
     97                <a href="<?php echo esc_url(admin_url('admin.php?page=changeloger-releases')); ?>" class="cha-stat-card">
     98                    <div class="cha-stat-icon-wrapper" style="background: #fdf4ff; color: #a855f7;">
     99                        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
     100                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z" />
     101                        </svg>
     102                    </div>
     103                    <div class="cha-stat-content">
     104                        <span class="cha-stat-label"><?php esc_html_e('Active Releases', 'changeloger'); ?></span>
     105                        <div class="cha-stat-value"><?php echo esc_html($stats['releases']); ?></div>
     106                    </div>
     107                    <div class="cha-stat-arrow">
     108                        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
     109                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
     110                        </svg>
     111                    </div>
     112                </a>
     113
     114                <!-- Feedback Card -->
     115                <a href="<?php echo esc_url(admin_url('admin.php?page=changeloger-feedback')); ?>" class="cha-stat-card">
     116                    <div class="cha-stat-icon-wrapper" style="background: #ecfdf5; color: #10b981;">
     117                        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
     118                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z" />
     119                        </svg>
     120                    </div>
     121                    <div class="cha-stat-content">
     122                        <span class="cha-stat-label"><?php esc_html_e('User Feedback', 'changeloger'); ?></span>
     123                        <div class="cha-stat-value"><?php echo esc_html($stats['feedback']); ?></div>
     124                    </div>
     125                    <div class="cha-stat-arrow">
     126                        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
     127                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
     128                        </svg>
     129                    </div>
     130                </a>
     131
     132                <!-- Roadmap Card -->
     133                <a href="<?php echo esc_url(admin_url('admin.php?page=changeloger-roadmap')); ?>" class="cha-stat-card">
     134                    <div class="cha-stat-icon-wrapper" style="background: #fff7ed; color: #f97316;">
     135                        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
     136                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 17V7m0 10a2 2 0 01-2 2H5a2 2 0 01-2-2V7a2 2 0 012-2h2a2 2 0 012 2m0 10a2 2 0 002 2h2a2 2 0 002-2M9 7a2 2 0 012-2h2a2 2 0 012 2m0 10V7m0 10a2 2 0 002 2h2a2 2 0 002-2V7a2 2 0 00-2-2h-2a2 2 0 00-2 2" />
     137                        </svg>
     138                    </div>
     139                    <div class="cha-stat-content">
     140                        <span class="cha-stat-label"><?php esc_html_e('Roadmap Items', 'changeloger'); ?></span>
     141                        <div class="cha-stat-value"><?php echo esc_html($stats['roadmap']); ?></div>
     142                    </div>
     143                    <div class="cha-stat-arrow">
     144                        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
     145                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
     146                        </svg>
     147                    </div>
     148                </a>
     149            </div>
     150
     151            <!-- Main Grid -->
     152            <div class="cha-dash-grid">
     153                <!-- Left Column -->
     154                <div class="cha-dash-left">
     155                    <!-- Recent Releases -->
     156                    <div class="cha-dash-card">
     157                        <div class="cha-dash-card-header">
     158                            <h3 class="cha-dash-card-title"><?php esc_html_e('Recent Releases', 'changeloger'); ?></h3>
     159                            <a href="<?php echo esc_url(admin_url('admin.php?page=changeloger-releases')); ?>" class="cha-stat-link"><?php esc_html_e('View All', 'changeloger'); ?></a>
     160                        </div>
     161                        <div class="cha-dash-card-body">
     162                            <?php if (! empty($recent_releases)) : ?>
     163                                <ul class="cha-activity-list">
     164                                    <?php foreach ($recent_releases as $release) : ?>
     165                                        <li class="cha-activity-item">
     166                                            <div class="cha-activity-icon" style="background: #dbeafe; color: #2563eb;">
     167                                                <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
     168                                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z" />
     169                                                </svg>
     170                                            </div>
     171                                            <div class="cha-activity-content">
     172                                                <div class="cha-activity-title"><?php echo esc_html($release['title']); ?></div>
     173                                                <div class="cha-activity-meta">
     174                                                    <span><?php echo esc_html($release['product']); ?></span>
     175                                                    <span>•</span>
     176                                                    <span><?php echo esc_html($release['date']); ?></span>
     177                                                </div>
     178                                            </div>
     179                                        </li>
     180                                    <?php endforeach; ?>
     181                                </ul>
     182                            <?php else : ?>
     183                                <div class="cha-activity-empty"><?php esc_html_e('No releases yet. Create your first release!', 'changeloger'); ?></div>
     184                            <?php endif; ?>
     185                        </div>
     186                    </div>
     187
     188                    <!-- Feedback Status -->
     189                    <div class="cha-dash-card">
     190                        <div class="cha-dash-card-header">
     191                            <h3 class="cha-dash-card-title"><?php esc_html_e('Feedback Overview', 'changeloger'); ?></h3>
     192                            <a href="<?php echo esc_url(admin_url('admin.php?page=changeloger-feedback')); ?>" class="cha-stat-link"><?php esc_html_e('View All', 'changeloger'); ?></a>
     193                        </div>
     194                        <div class="cha-dash-card-body">
     195                            <div class="cha-status-grid">
     196                                <div class="cha-status-item">
     197                                    <div class="cha-status-count"><?php echo esc_html($feedback_status['open'] ?? 0); ?></div>
     198                                    <div class="cha-status-name"><?php esc_html_e('Open', 'changeloger'); ?></div>
     199                                </div>
     200                                <div class="cha-status-item">
     201                                    <div class="cha-status-count"><?php echo esc_html($feedback_status['planned'] ?? 0); ?></div>
     202                                    <div class="cha-status-name"><?php esc_html_e('Planned', 'changeloger'); ?></div>
     203                                </div>
     204                                <div class="cha-status-item">
     205                                    <div class="cha-status-count"><?php echo esc_html($feedback_status['in_progress'] ?? 0); ?></div>
     206                                    <div class="cha-status-name"><?php esc_html_e('In Progress', 'changeloger'); ?></div>
     207                                </div>
     208                                <div class="cha-status-item">
     209                                    <div class="cha-status-count"><?php echo esc_html($feedback_status['completed'] ?? 0); ?></div>
     210                                    <div class="cha-status-name"><?php esc_html_e('Completed', 'changeloger'); ?></div>
     211                                </div>
     212                            </div>
     213                            <?php
     214                            $total = array_sum($feedback_status);
     215                            $resolved = ($feedback_status['completed'] ?? 0) + ($feedback_status['rejected'] ?? 0);
     216                            $percent = $total > 0 ? round(($resolved / $total) * 100) : 0;
     217                            ?>
     218                            <div class="cha-progress-bar">
     219                                <div class="cha-progress-fill" style="width: <?php echo esc_attr($percent); ?>%;"></div>
     220                            </div>
     221                            <div class="cha-progress-text">
     222                                <span><?php printf(esc_html__('%d%% resolved', 'changeloger'), $percent); ?></span>
     223                                <span><?php printf(esc_html__('%d total items', 'changeloger'), $total); ?></span>
     224                            </div>
     225                        </div>
     226                    </div>
     227                </div>
     228
     229                <!-- Right Column -->
     230                <div class="cha-dash-right">
     231                    <!-- Quick Actions -->
     232                    <div class="cha-dash-card">
     233                        <div class="cha-dash-card-header">
     234                            <h3 class="cha-dash-card-title"><?php esc_html_e('Quick Actions', 'changeloger'); ?></h3>
     235                        </div>
     236                        <div class="cha-dash-card-body">
     237                            <div class="cha-quick-actions">
     238                                <a href="<?php echo esc_url(admin_url('admin.php?page=changeloger-releases')); ?>" class="cha-quick-action">
     239                                    <div class="cha-quick-action-icon" style="background: #dbeafe; color: #2563eb;">
     240                                        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
     241                                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
     242                                        </svg>
     243                                    </div>
     244                                    <span><?php esc_html_e('Create Release', 'changeloger'); ?></span>
     245                                </a>
     246                                <a href="<?php echo esc_url(admin_url('admin.php?page=changeloger-roadmap')); ?>" class="cha-quick-action">
     247                                    <div class="cha-quick-action-icon" style="background: #fef3c7; color: #d97706;">
     248                                        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
     249                                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 17V7m0 10a2 2 0 01-2 2H5a2 2 0 01-2-2V7a2 2 0 012-2h2a2 2 0 012 2m0 10a2 2 0 002 2h2a2 2 0 002-2M9 7a2 2 0 012-2h2a2 2 0 012 2m0 10V7m0 10a2 2 0 002 2h2a2 2 0 002-2V7a2 2 0 00-2-2h-2a2 2 0 00-2 2" />
     250                                        </svg>
     251                                    </div>
     252                                    <span><?php esc_html_e('Add Roadmap Item', 'changeloger'); ?></span>
     253                                </a>
     254                                <a href="<?php echo esc_url(admin_url('admin.php?page=changeloger-settings')); ?>" class="cha-quick-action">
     255                                    <div class="cha-quick-action-icon" style="background: #f3f4f6; color: #6b7280;">
     256                                        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
     257                                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
     258                                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
     259                                        </svg>
     260                                    </div>
     261                                    <span><?php esc_html_e('Settings', 'changeloger'); ?></span>
     262                                </a>
     263                                <a href="https://helpdesk.spider-themes.net/docs/changeloger/" target="_blank" class="cha-quick-action">
     264                                    <div class="cha-quick-action-icon" style="background: #ede9fe; color: #7c3aed;">
     265                                        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
     266                                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253" />
     267                                        </svg>
     268                                    </div>
     269                                    <span><?php esc_html_e('Documentation', 'changeloger'); ?></span>
     270                                </a>
     271                            </div>
     272                        </div>
     273                    </div>
     274
     275                    <!-- System Status -->
     276                    <div class="cha-dash-card">
     277                        <div class="cha-dash-card-header">
     278                            <h3 class="cha-dash-card-title"><?php esc_html_e('System Status', 'changeloger'); ?></h3>
     279                        </div>
     280                        <div class="cha-dash-card-body">
     281                            <ul class="cha-system-list">
     282                                <li class="cha-system-item">
     283                                    <span class="cha-system-label"><?php esc_html_e('REST API', 'changeloger'); ?></span>
     284                                    <?php if ($system_status['rest_api']) : ?>
     285                                        <span class="cha-system-badge cha-badge-success">
     286                                            <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" width="12" height="12">
     287                                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
     288                                            </svg>
     289                                            <?php esc_html_e('Active', 'changeloger'); ?>
     290                                        </span>
     291                                    <?php else : ?>
     292                                        <span class="cha-system-badge cha-badge-warning"><?php esc_html_e('Issue', 'changeloger'); ?></span>
     293                                    <?php endif; ?>
     294                                </li>
     295                                <li class="cha-system-item">
     296                                    <span class="cha-system-label"><?php esc_html_e('Version', 'changeloger'); ?></span>
     297                                    <span class="cha-system-value"><?php echo esc_html($version); ?></span>
     298                                </li>
     299                                <li class="cha-system-item">
     300                                    <span class="cha-system-label"><?php esc_html_e('License', 'changeloger'); ?></span>
     301                                    <?php if ($is_premium) : ?>
     302                                        <span class="cha-system-badge cha-badge-info"><?php esc_html_e('Pro', 'changeloger'); ?></span>
     303                                    <?php else : ?>
     304                                        <span class="cha-system-badge cha-badge-warning"><?php esc_html_e('Free', 'changeloger'); ?></span>
     305                                    <?php endif; ?>
     306                                </li>
     307                            </ul>
     308                        </div>
     309                    </div>
     310                </div>
     311            </div>
     312        </div>
     313<?php
     314    }
     315
     316    /**
     317     * Get all stats
     318     */
     319    private function get_all_stats()
     320    {
     321        return [
     322            'products' => $this->get_products_count(),
     323            'releases' => $this->get_releases_count(),
     324            'feedback' => $this->get_feedback_count(),
     325            'roadmap'  => $this->get_roadmap_count(),
     326        ];
     327    }
     328
     329    /**
     330     * Get products count
     331     */
     332    private function get_products_count()
     333    {
     334        $terms = get_terms([
     335            'taxonomy'   => 'cha_product',
     336            'hide_empty' => false,
     337        ]);
     338        return ! is_wp_error($terms) ? count($terms) : 0;
     339    }
     340
     341    /**
     342     * Get releases count
     343     */
     344    private function get_releases_count()
     345    {
     346        $count = wp_count_posts('cha_release');
     347        return isset($count->publish) ? $count->publish : 0;
     348    }
     349
     350    /**
     351     * Get feedback count
     352     */
     353    private function get_feedback_count()
     354    {
     355        $count = wp_count_posts('cha_feedback');
     356        return isset($count->publish) ? $count->publish : 0;
     357    }
     358
     359    /**
     360     * Get roadmap items count (feedback items with roadmap statuses)
     361     */
     362    private function get_roadmap_count()
     363    {
     364        global $wpdb;
     365        $sql = "SELECT COUNT(*) FROM {$wpdb->posts} p
     366                INNER JOIN {$wpdb->postmeta} pm ON p.ID = pm.post_id
     367                WHERE p.post_type = 'cha_feedback'
     368                AND p.post_status = 'publish'
     369                AND pm.meta_key = '_cha_feedback_status'
     370                AND pm.meta_value IN ('planned', 'in_progress', 'completed')";
     371        return (int) $wpdb->get_var($sql);
     372    }
     373
     374    /**
     375     * Get feedback by status
     376     */
     377    private function get_feedback_by_status()
     378    {
     379        global $wpdb;
     380
     381        $result = [
     382            'open'        => 0,
     383            'planned'     => 0,
     384            'in_progress' => 0,
     385            'completed'   => 0,
     386            'rejected'    => 0,
     387        ];
     388
     389        // Get all published feedback
     390        $total_feedback = $wpdb->get_var(
     391            "SELECT COUNT(*) FROM {$wpdb->posts}
     392            WHERE post_type = 'cha_feedback'
     393            AND post_status = 'publish'"
     394        );
     395
     396        // Count feedback with specific statuses
     397        $statuses_with_meta = ['planned', 'in_progress', 'completed', 'rejected'];
     398        $counted_with_status = 0;
     399
     400        foreach ($statuses_with_meta as $status) {
     401            $sql = $wpdb->prepare(
     402                "SELECT COUNT(*) FROM {$wpdb->posts} p
     403                INNER JOIN {$wpdb->postmeta} pm ON p.ID = pm.post_id
     404                WHERE p.post_type = 'cha_feedback'
     405                AND p.post_status = 'publish'
     406                AND pm.meta_key = '_cha_feedback_status'
     407                AND pm.meta_value = %s",
     408                $status
     409            );
     410            $count = (int) $wpdb->get_var($sql);
     411            $result[$status] = $count;
     412            $counted_with_status += $count;
    75413        }
    76         echo '</div>';
    77 
    78         echo '</div>';
    79         echo '</div>';
    80     }
    81 
    82     /**
    83      * Get total usage count
    84      */
    85     private function get_total_usage() {
    86         global $wpdb;
    87 
    88         $sql = "SELECT COUNT(DISTINCT p.ID)
    89                 FROM {$wpdb->posts} p
    90                 WHERE (p.post_content LIKE '%wp:cha/changeloger%' OR p.post_content LIKE '%wp:cha/tabbed-changeloger%')
    91                 AND p.post_status IN ('publish', 'draft', 'private', 'pending')";
    92 
    93         return $wpdb->get_var($sql) ?: 0;
    94     }
    95 
    96     /**
    97      * Get block type statistics
    98      */
    99     private function get_block_statistics() {
    100         global $wpdb;
    101 
    102         $sql = "SELECT p.post_content
    103                 FROM {$wpdb->posts} p
    104                 WHERE (p.post_content LIKE '%wp:cha/changeloger%' OR p.post_content LIKE '%wp:cha/tabbed-changeloger%')
    105                 AND p.post_status IN ('publish', 'draft', 'private', 'pending')";
    106 
    107         $results = $wpdb->get_results($sql);
    108 
    109         $stats = ['changeloger' => 0, 'tabbed' => 0];
    110 
    111         foreach ($results as $result) {
    112             if (strpos($result->post_content, 'wp:cha/changeloger') !== false && strpos($result->post_content, 'wp:cha/tabbed-changeloger') === false) {
    113                 $stats['changeloger']++;
    114             }
    115             if (strpos($result->post_content, 'wp:cha/tabbed-changeloger') !== false) {
    116                 $stats['tabbed']++;
    117             }
    118         }
    119 
    120         return $stats;
    121     }
    122 
    123     /**
    124      * Get recent usage items
    125      */
    126     private function get_recent_usage($limit = 5) {
    127         global $wpdb;
    128 
    129         $sql = "SELECT p.ID, p.post_title, p.post_type, p.post_date, p.post_content
    130                 FROM {$wpdb->posts} p
    131                 WHERE (p.post_content LIKE '%wp:cha/changeloger%' OR p.post_content LIKE '%wp:cha/tabbed-changeloger%')
    132                 AND p.post_status IN ('publish', 'draft', 'private', 'pending')
    133                 ORDER BY p.post_date DESC
    134                 LIMIT %d";
    135 
    136         $results = $wpdb->get_results($wpdb->prepare($sql, $limit));
    137 
    138         $data = [];
    139         foreach ($results as $result) {
    140             $block_names = [];
    141 
    142             if (strpos($result->post_content, 'wp:cha/changeloger') !== false) {
    143                 $block_names[] = 'Changeloger';
    144             }
    145             if (strpos($result->post_content, 'wp:cha/tabbed-changeloger') !== false) {
    146                 $block_names[] = 'Tabbed Changeloger';
    147             }
    148 
    149             $data[] = [
    150                 'title' => $result->post_title ?: __('(no title)', 'changeloger'),
    151                 'post_type' => ucfirst($result->post_type),
    152                 'block_name' => implode(', ', $block_names),
    153                 'date' => $result->post_date,
    154                 'edit_link' => get_edit_post_link($result->ID),
     414
     415        // Count explicitly set 'open' status
     416        $explicit_open = (int) $wpdb->get_var(
     417            "SELECT COUNT(*) FROM {$wpdb->posts} p
     418            INNER JOIN {$wpdb->postmeta} pm ON p.ID = pm.post_id
     419            WHERE p.post_type = 'cha_feedback'
     420            AND p.post_status = 'publish'
     421            AND pm.meta_key = '_cha_feedback_status'
     422            AND pm.meta_value = 'open'"
     423        );
     424
     425        // Open = total - those with other statuses (this includes items with no status meta)
     426        $result['open'] = max(0, (int) $total_feedback - $counted_with_status);
     427
     428        return $result;
     429    }
     430
     431    /**
     432     * Get recent releases
     433     */
     434    private function get_recent_releases($limit = 5)
     435    {
     436        $releases = get_posts([
     437            'post_type'      => 'cha_release',
     438            'posts_per_page' => $limit,
     439            'post_status'    => 'publish',
     440            'orderby'        => 'date',
     441            'order'          => 'DESC',
     442        ]);
     443
     444        $result = [];
     445        foreach ($releases as $release) {
     446            $products = wp_get_object_terms($release->ID, 'cha_product');
     447            $product_name = ! empty($products) ? $products[0]->name : __('No Product', 'changeloger');
     448
     449            $result[] = [
     450                'id'      => $release->ID,
     451                'title'   => $release->post_title,
     452                'product' => $product_name,
     453                'date'    => human_time_diff(strtotime($release->post_date), current_time('timestamp')) . ' ' . __('ago', 'changeloger'),
    155454            ];
    156455        }
    157456
    158         return $data;
     457        return $result;
     458    }
     459
     460    /**
     461     * Get recent feedback
     462     */
     463    private function get_recent_feedback($limit = 5)
     464    {
     465        $items = get_posts([
     466            'post_type'      => 'cha_feedback',
     467            'posts_per_page' => $limit,
     468            'post_status'    => 'publish',
     469            'orderby'        => 'date',
     470            'order'          => 'DESC',
     471        ]);
     472
     473        $result = [];
     474        foreach ($items as $item) {
     475            $status = get_post_meta($item->ID, '_cha_feedback_status', true) ?: 'open';
     476
     477            $result[] = [
     478                'id'     => $item->ID,
     479                'title'  => $item->post_title,
     480                'status' => $status,
     481                'date'   => human_time_diff(strtotime($item->post_date), current_time('timestamp')) . ' ' . __('ago', 'changeloger'),
     482            ];
     483        }
     484
     485        return $result;
     486    }
     487
     488    /**
     489     * Get system status
     490     */
     491    private function get_system_status()
     492    {
     493        return [
     494            'rest_api'    => $this->check_rest_api(),
     495            'cron_active' => (bool) wp_next_scheduled('cha_daily_version_check'),
     496        ];
     497    }
     498
     499    /**
     500     * Check REST API availability
     501     */
     502    private function check_rest_api()
     503    {
     504        $cached = get_transient('changeloger_rest_api_status');
     505        if (false !== $cached) {
     506            return (bool) $cached;
     507        }
     508
     509        $response = wp_remote_get(rest_url('changeloger/v1/'), [
     510            'timeout'   => 5,
     511            'sslverify' => false,
     512        ]);
     513        $status = ! is_wp_error($response) && wp_remote_retrieve_response_code($response) < 500;
     514
     515        set_transient('changeloger_rest_api_status', (int) $status, HOUR_IN_SECONDS);
     516
     517        return $status;
    159518    }
    160519}
  • changeloger/trunk/admin/class-changeloger-usage-table.php

    r3397941 r3443916  
    9292        $sql = "SELECT p.ID, p.post_title, p.post_type, p.post_date, p.post_status, p.post_content
    9393                FROM {$wpdb->posts} p
    94                 WHERE (p.post_content LIKE '%wp:cha/changeloger%' OR p.post_content LIKE '%wp:cha/tabbed-changeloger%')
     94                WHERE (p.post_content LIKE '%wp:cha/changeloger%' OR p.post_content LIKE '%wp:cha/tabbed-changeloger%' OR p.post_content LIKE '%wp:cha/release-hub%')
    9595                AND p.post_status IN ('publish', 'draft', 'private', 'pending')
    9696                ORDER BY p.{$orderby} {$order}
     
    109109            if ( strpos( $result->post_content, 'wp:cha/tabbed-changeloger' ) !== false ) {
    110110                $block_names[] = 'Tabbed Changeloger';
     111            }
     112            if ( strpos( $result->post_content, 'wp:cha/release-hub' ) !== false ) {
     113                $block_names[] = 'Release Hub';
    111114            }
    112115
     
    131134        $sql = "SELECT COUNT(*)
    132135                FROM {$wpdb->posts} p
    133                 WHERE (p.post_content LIKE '%wp:cha/changeloger%' OR p.post_content LIKE '%wp:cha/tabbed-changeloger%')
     136                WHERE (p.post_content LIKE '%wp:cha/changeloger%' OR p.post_content LIKE '%wp:cha/tabbed-changeloger%' OR p.post_content LIKE '%wp:cha/release-hub%')
    134137                AND p.post_status IN ('publish', 'draft', 'private', 'pending')";
    135138
  • changeloger/trunk/build/changeloger/index.asset.php

    r3419755 r3443916  
    1 <?php return array('dependencies' => array('lodash', 'react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'bedbd82eb86099fed7e8');
     1<?php return array('dependencies' => array('lodash', 'react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '4da68f4bec4110c4da45');
  • changeloger/trunk/build/changeloger/index.js

    r3419755 r3443916  
    1 (()=>{"use strict";var e,t={20:(e,t,a)=>{var n=a(609),o=Symbol.for("react.element"),l=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),r=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,a){var n,c={},i=null,g=null;for(n in void 0!==a&&(i=""+a),void 0!==t.key&&(i=""+t.key),void 0!==t.ref&&(g=t.ref),t)l.call(t,n)&&!s.hasOwnProperty(n)&&(c[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===c[n]&&(c[n]=t[n]);return{$$typeof:o,type:e,key:i,ref:g,props:c,_owner:r.current}}},221:(e,t,a)=>{var n=a(609);const o=window.wp.blocks,l=window.wp.i18n,r=window.wp.element,s=window.wp.blockEditor,c=window.wp.data,i=window.wp.components;class g{constructor(e){this.changelog=e,this.datePattern=/\b(\d{1,2}[\/-]\d{1,2}[\/-]\d{2,4}|\d{4}-\d{2}-\d{2}|\d{1,2} \w+ \d{4})\b/,this.versionPattern=/(?:[vV]?\s*)?(\d+(\.\d+){0,3})(?:\s*\(.*\))?/}parseSection(e){const t=e.split("\n").filter(e=>""!==e.trim());if(!(t.length>1))return!1;const a=t[0].trim(),n=this.datePattern.exec(a),o=this.versionPattern.exec(a);if(!o)return!1;const l=o[1].trim(),r=t.slice(1);return{version:l,date:n?n[0]:null,changes:this.parseChanges(r)}}parseChanges(e){const t=[];let a="General";return e.forEach(e=>{if(""===e.trim())return;const n=e.match(/^\*\*([^*]+)\*\*\s*:?\s*$/);if(n)a=n[1].trim();else if(e.trim().startsWith("*")){let n=e.trim().replace(/^\*\s*/,"");t.push({category:a,change:this.processLinks(n)})}else{const a=e.indexOf(":"),n=e.indexOf(" - "),o=-1!==a&&(-1===n||a<n)?a:n;if(-1!==o){let a=e.substring(0,o).trim();a=a.trim();const l=e.substring(o+(o===n?3:1)).trim();t.push({category:a,change:this.processLinks(l)})}}}),t}processLinks(e){return e.replace(/\[(.*?)\]\((.*?)\)/g,'<a href="$2">$1</a>')}parse(){const e=this.changelog.replace(/\n\s*(?=\n.*:)/g,"").split(/\n(?=\s*\d{2} \w+ \d{4}|\s*=+\s*[\d.]+|v[\d.]+|#*\s*[\d.]+|-{1,12}\s*[\d.]+\s*\(.*\)\s*-{1,12}|\s*=\s*[\d.]+\s*\(.*?\)\s*=)/),t=[];return e.forEach(e=>{const a=this.parseSection(e);a&&t.push(a)}),t}normalizeVersion(e){const t=e.split(".");return 1===t.length?t.push("0","0"):2===t.length&&t.push("0"),t.join(".")}getVersions(){const e=this.parse(),t={};e.forEach(e=>{const a=this.normalizeVersion(e.version),n=a.split("."),o=`${n[0]}.${n[1]}.x`;t[o]||(t[o]={version:o,children:[]}),t[o].children.push({...e,version:a,children:[]})});const a=Object.values(t).map(e=>(e.children.sort((e,t)=>this.compareVersions(t.version,e.version)),e));return a.sort((e,t)=>this.compareVersions(t.version,e.version)),a}compareVersions(e,t){const a=e.split(".").map(e=>parseInt(e,10)),n=t.split(".").map(e=>parseInt(e,10));for(let e=0;e<Math.max(a.length,n.length);e++){if((a[e]||0)>(n[e]||0))return 1;if((a[e]||0)<(n[e]||0))return-1}return 0}convertToPlainText(e){let t="";return e.forEach(e=>{t+=`= ${e.version} (${e.date}) =\n`,e.changes.forEach(e=>{t+=`${e.category}: ${e.change}\n`}),t+="\n"}),t.trim()}hasNewVersionAdded(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;if(0===e.length&&t.length>0)return!0;if(0===t.length)return!1;const a=e.map(e=>e.version),n=a.length>0?a.reduce((e,t)=>this.compareVersions(t,e)>0?t:e):null,o=t.map(e=>e.version),l=o.length>0?o.reduce((e,t)=>this.compareVersions(t,e)>0?t:e):null;return!(!l||!n)&&this.compareVersions(l,n)>0}}const m=window.lodash,h=({label:e,colorValue:t,onColorChange:a,colors:o=[],className:l})=>(0,n.createElement)(i.Dropdown,{popoverProps:{placement:"left-start",offset:36,shift:!0},className:`changeloger-color-dropdown-control ${l}`,contentClassName:"changeloger-color-dropdown-control-content",renderToggle:({isOpen:a,onToggle:o})=>(0,n.createElement)(i.Button,{className:`changeloger-color-dropdown-control-button ${a&&"is-open"} ${l}`,onClick:o,"aria-expanded":a},(0,n.createElement)(i.ColorIndicator,{colorValue:t}),e),renderContent:()=>(0,n.createElement)(s.__experimentalColorGradientControl,{colors:o,colorValue:t,onColorChange:a})}),p=function(e){const t=(()=>{const t=[];return e.changelog.forEach(e=>{const a=[];e.changes.forEach(e=>{t.includes(e.category)||a.includes(e.category)||a.push(e.category)}),t.push(...a)}),t})();return t.map((a,o)=>{const l=(0,m.get)(e.value,a.toLowerCase(),"");return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(h,{className:t.length>0&&0===o?"is-list is-first":"is-list",colors:e.colors,label:a.concat(" Color"),colorValue:l,onColorChange:t=>e.onChange({...e.value,[a.toLowerCase()]:t})}))})},d=!!changeloger_local_object.licensing,u=function(e){const{attributes:t,setAttributes:a}=e,{perPage:o,changelog:r,enableVersions:m,paginationType:u,enablePagination:E,versionsPosition:C,paginationBgColor:v,customLogTypeColors:f,paginationTextColor:b,paginationActiveBgColor:_,paginationActiveTextColor:w,paginationHoverBgColor:N,paginationHoverTextColor:y,enableFilter:x,filterPosition:k,enableSearch:T,searchPlaceholder:D,changelogLayout:A,enableSubscription:P,subscriptionProductName:V,emailEndingMessage:L}=t,F=[{label:(0,l.__)("Left","changeloger"),value:"left"},{label:(0,l.__)("Right","changeloger"),value:"right"}],I=[{icon:"editor-alignleft",label:(0,l.__)("Left","changeloger"),value:"left"},{icon:"editor-aligncenter",label:(0,l.__)("Left","changeloger"),value:"center"},{icon:"editor-alignright",label:(0,l.__)("Right","changeloger"),value:"right"}],{defaultColors:S}=(0,c.useSelect)(e=>({defaultColors:e("core/block-editor")?.getSettings()?.__experimentalFeatures?.color?.palette?.default})),B=d?"":"cha-pro-element",M=new g(r).parse();return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(s.InspectorControls,null,(0,n.createElement)(i.PanelBody,{title:(0,l.__)("Versions","changeloger"),initialOpen:!0},(0,n.createElement)(i.ToggleControl,{label:(0,l.__)("Sidebar Versions","changeloger"),checked:m,onChange:()=>a({enableVersions:!m})}),m&&(0,n.createElement)(i.__experimentalToggleGroupControl,{isBlock:!0,value:C,label:(0,l.__)("Versions Position","changeloger")},F.map(e=>(0,n.createElement)(i.__experimentalToggleGroupControlOption,{value:e.value,label:e.label,onClick:()=>a({versionsPosition:e.value})})))),(0,n.createElement)(i.PanelBody,{title:(0,l.__)("Pagination","changeloger"),className:B,initialOpen:!1},(0,n.createElement)(i.ToggleControl,{label:(0,l.__)("Pagination","changeloger"),checked:E,disabled:!d,onChange:()=>a({enablePagination:!E})}),E&&d&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)(i.SelectControl,{label:(0,l.__)("Pagination Type","changeloger"),value:u,options:[{label:"Load More",value:"load-more"},{label:"Numbered",value:"numbered"}],onChange:e=>a({paginationType:e}),__nextHasNoMarginBottom:!0}),(0,n.createElement)(i.TextControl,{label:(0,l.__)("Per Page","changeloger"),value:o.toString(),type:"number",onChange:e=>a({perPage:Number(e)})}))),(0,n.createElement)(i.PanelBody,{title:(0,l.__)("Filter","changeloger"),className:B,initialOpen:!1},(0,n.createElement)(i.ToggleControl,{label:(0,l.__)("Filter","changeloger"),checked:x,disabled:!d,onChange:()=>a({enableFilter:!x})}),x&&d&&(0,n.createElement)(i.__experimentalToggleGroupControl,{isBlock:!0,value:k,label:(0,l.__)("Filter Position","changeloger")},I.map(e=>(0,n.createElement)(i.__experimentalToggleGroupControlOptionIcon,{icon:e.icon,value:e.value,label:e.label,onClick:()=>a({filterPosition:e.value})})))),(0,n.createElement)(i.PanelBody,{title:(0,l.__)("Search","changeloger"),className:B,initialOpen:!1},(0,n.createElement)(i.ToggleControl,{label:(0,l.__)("Enable Search","changeloger"),checked:T,disabled:!d,onChange:()=>a({enableSearch:!T})}),T&&d&&(0,n.createElement)(i.TextControl,{label:(0,l.__)("Search Placeholder","changeloger"),value:D,onChange:e=>a({searchPlaceholder:e}),placeholder:(0,l.__)("Type your placeholder text…","changeloger")})),(0,n.createElement)(i.PanelBody,{title:(0,l.__)("Layout","changeloger"),className:B,initialOpen:!1},(0,n.createElement)(i.SelectControl,{label:(0,l.__)("Changelog Layout","changeloger"),value:A||"individual",options:[{label:"Individual (Category per item)",value:"individual"},{label:"Grouped (Categories grouped together)",value:"grouped"}],onChange:e=>a({changelogLayout:e}),__nextHasNoMarginBottom:!0,disabled:!d})),(0,n.createElement)(i.PanelBody,{title:(0,l.__)("Subscription","changeloger"),className:B,initialOpen:!1},(0,n.createElement)(i.ToggleControl,{label:(0,l.__)("Enable Subscription","changeloger"),checked:P,disabled:!d,onChange:()=>a({enableSubscription:!P})}),P&&d&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)(i.TextControl,{label:(0,l.__)("Product Name","changeloger"),value:V,onChange:e=>a({subscriptionProductName:e}),placeholder:(0,l.__)("e.g., My Product","changeloger"),help:(0,l.__)("This name will be used in notification emails to identify the product.","changeloger")}),(0,n.createElement)(i.TextControl,{label:(0,l.__)("Email Ending Message","changeloger"),value:L,onChange:e=>a({emailEndingMessage:e}),placeholder:(0,l.__)("e.g., Update today and enjoy new features!","changeloger"),help:(0,l.__)('This message will appear before the "View Changes" button in notification emails.',"changeloger")})))),(0,n.createElement)(s.InspectorControls,{group:"styles"},(0,n.createElement)(i.PanelBody,{title:(0,l.__)("Log Tags","changeloger"),initialOpen:!0},(0,n.createElement)(p,{changelog:M,colors:S,value:f,onChange:e=>{a({customLogTypeColors:e})}})),E&&d&&(0,n.createElement)(i.PanelBody,{title:(0,l.__)("Pagination","changeloger"),initialOpen:!1},(0,n.createElement)(h,{className:"is-list is-first",colors:S,label:(0,l.__)("Text Color","changeloger"),colorValue:b,onColorChange:e=>a({paginationTextColor:e})}),(0,n.createElement)(h,{className:"is-list",colors:S,label:(0,l.__)("Bg Color","changeloger"),colorValue:v,onColorChange:e=>a({paginationBgColor:e})}),(0,n.createElement)(h,{className:"is-list",colors:S,label:(0,l.__)("Text Hover Color","changeloger"),colorValue:y,onColorChange:e=>a({paginationHoverTextColor:e})}),(0,n.createElement)(h,{className:"is-list",colors:S,label:(0,l.__)("Bg Hover Color","changeloger"),colorValue:N,onColorChange:e=>a({paginationHoverBgColor:e})}),"numbered"===u&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)(h,{className:"is-list",colors:S,label:(0,l.__)("Active Text Color","changeloger"),colorValue:w,onColorChange:e=>a({paginationActiveTextColor:e})}),(0,n.createElement)(h,{className:"is-list",colors:S,label:(0,l.__)("Active Bg Color","changeloger"),colorValue:_,onColorChange:e=>a({paginationActiveBgColor:e})})),(0,n.createElement)(s.ContrastChecker,{backgroundColor:v,textColor:b}))))},E=window.wp.primitives;var C=a(848);const v=(0,C.jsx)(E.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,C.jsx)(E.Path,{d:"M4 9v1.5h16V9H4zm12 5.5h4V13h-4v1.5zm-6 0h4V13h-4v1.5zm-6 0h4V13H4v1.5z"})}),f=function({isOpen:e,onClose:t}){if(!e)return null;const a=window.location.href.substring(0,window.location.href.lastIndexOf("/wp-admin"))+"/wp-admin/admin.php?page=changeloger-pricing";return(0,n.createElement)(i.Modal,{title:(0,l.__)("Version Limit Reached","changeloger"),onRequestClose:t,className:"changeloger-version-limit-modal"},(0,n.createElement)("div",{className:"changeloger-modal-content"},(0,n.createElement)("p",{className:"changeloger-modal-message"},(0,l.__)("You have reached the maximum limit of 20 versions for the free version.","changeloger")),(0,n.createElement)("p",{className:"changeloger-modal-submessage"},(0,l.__)("Upgrade to Changeloger Pro to add unlimited versions and unlock more powerful features!","changeloger")),(0,n.createElement)("div",{className:"changeloger-modal-actions"},(0,n.createElement)(i.Button,{variant:"primary",href:a,target:"_blank",className:"changeloger-upgrade-button"},(0,l.__)("Upgrade to Pro","changeloger")),(0,n.createElement)(i.Button,{variant:"secondary",onClick:t,className:"changeloger-close-button"},(0,l.__)("Close","changeloger")))))},b=()=>(0,n.createElement)(n.Fragment,null,(0,n.createElement)("div",{className:"loader-wave"},(0,n.createElement)("div",{className:"wave-bar"}),(0,n.createElement)("div",{className:"wave-bar"}),(0,n.createElement)("div",{className:"wave-bar"}),(0,n.createElement)("div",{className:"wave-bar"}),(0,n.createElement)("div",{className:"wave-bar"}))),_=({onClose:e,handleUrlFile:t,handleUrlChange:a,textUrl:o,isOpen:r,loader:s,errorMessage:c})=>r?(0,n.createElement)(n.Fragment,null,(0,n.createElement)(i.Modal,{title:(0,l.__)("File URL","changeloger"),onRequestClose:e,className:`changeloger-version-limit-modal changeloger-text-url ${s&&"changeloger-modal-loader"}`},(0,n.createElement)("div",{className:"changeloger-modal-content"},(0,n.createElement)("p",{className:"changeloger-modal-message"},(0,l.__)("Changelog File URL.","changeloger")),(0,n.createElement)(i.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,placeholder:(0,l.__)("Enter URL to changelog text file","changeloger"),onChange:a,value:o,type:"url",required:!0,className:"changeloger-text-url-input"}),(0,n.createElement)("p",{className:"changeloger-text-url-note"},(0,l.__)("Note: Only text files are supported. (.txt)","changeloger")),c&&(0,n.createElement)("div",{className:"changeloger-text-url-error"},c),(0,n.createElement)("div",{className:"changeloger-modal-actions"},(0,n.createElement)(i.Button,{variant:"primary",onClick:t,className:"changeloger-upgrade-button"},s&&(0,n.createElement)(b,null),(0,n.createElement)("span",null,(0,l.__)("Fetch URL Data","changeloger"))))))):null,w=function({isOpen:e,onClose:t}){if(!e)return null;const a=window.location.href.substring(0,window.location.href.lastIndexOf("/wp-admin"))+"/wp-admin/admin.php?page=changeloger-pricing";return(0,n.createElement)(i.Modal,{title:(0,l.__)("Pro Features","changeloger"),onRequestClose:t,className:"changeloger-pro-features-modal"},(0,n.createElement)("div",{className:"changeloger-modal-content"},(0,n.createElement)("p",{className:"changeloger-modal-message"},(0,l.__)("Unlock more powerful features with Changeloger Pro!","changeloger")),(0,n.createElement)("p",{className:"changeloger-modal-submessage"},(0,l.__)("Upgrade to Changeloger Pro to unlock more powerful features!","changeloger")),(0,n.createElement)("div",{className:"changeloger-modal-actions"},(0,n.createElement)(i.Button,{variant:"primary",href:a,target:"_blank",className:"changeloger-upgrade-button"},(0,l.__)("Upgrade to Pro","changeloger")),(0,n.createElement)(i.Button,{variant:"secondary",onClick:t,className:"changeloger-close-button"},(0,l.__)("Close","changeloger")))))},N=function(e){const{attributes:t,setAttributes:a}=e,{changelog:o,showPlaceholder:s,showTextArea:c,uniqueId:m}=t,[h,p]=(0,r.useState)(!1),[u,E]=(0,r.useState)(!1),[C,b]=(0,r.useState)(""),[N,y]=(0,r.useState)(!1),[x,k]=(0,r.useState)(""),[T,D]=(0,r.useState)(!1),[A,P]=(0,r.useState)(!1),V=(0,r.useRef)(null),L=(e=>{const t=new g(e),[a,n]=(0,r.useState)(()=>t.parse()),o=(e,a)=>{a({changelog:t.convertToPlainText(e)})};return{parsedChangelog:a,setParsedChangelog:n,handleChangeChange:(e,t,l,r)=>{const s=[...a];s[t].changes[l].change=e,n(s),o(s,r)},handleCategoryChange:(e,t,l,r)=>{const s=[...a];s[t].changes[l].category=e,n(s),o(s,r)},handleDateChange:(e,t,l)=>{const r=[...a];r[t].date=e,n(r),o(r,l)},handleVersionChange:(e,t,l)=>{const r=[...a];r[t].version=e,n(r),o(r,l)},handleAddChangeItem:(e,t)=>{const l=[...a];l[e].changes||(l[e].changes=[]),l[e].changes.push({category:"NEW",change:"Added a new feature"}),n(l),o(l,t)},handleAddVersion:e=>{const t=[...a],l={version:"New Version",date,changes:[{category:"NEW",change:"Added a new feature"}]};t.push(l),n(t),o(t,e)},handleRemoveChangeItem:(e,t,l)=>{const r=[...a];r[e].changes.splice(t,1),n(r),o(r,l)},handleRemoveVersion:(e,t)=>{const l=[...a];l.splice(e,1),n(l),o(l,t)},updateChangelogAttribute:o}})(o),{parsedChangelog:F,handleChangeChange:I,handleCategoryChange:S,handleDateChange:B,handleVersionChange:M}=L;e.parsedChangelog=F,e.handleChangeChange=(e,t,n)=>I(e,t,n,a),e.handleCategoryChange=(e,t,n)=>S(e,t,n,a),e.handleDateChange=(e,t)=>B(e,t,a),e.handleVersionChange=(e,t)=>M(e,t,a),(0,r.useEffect)(()=>{if(!o||!m)return;const{select:e}=wp.data,a=e("core/editor").getCurrentPostId();if(!a)return;const n=new g(o).parse();if(0===n.length)return;const l=setTimeout(()=>{fetch(`${window.location.origin}${window.location.pathname.split("/wp-admin")[0]}/wp-json/changeloger/v1/track-version`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":window.changeloger_local_object?.nonce||""},body:JSON.stringify({post_id:a,unique_id:m,parsed_changelog:n,is_pro:d,url:t.textUrl||"",enableVersions:t.enableVersions||!1})}).then(e=>e.json()).then(e=>{e.success&&e.new_version_detected&&console.log("Version tracked:",e)}).catch(e=>{console.error("Version tracking error:",e)})},2e3);return()=>clearTimeout(l)},[o,m,t.textUrl]);const[H,O]=(0,r.useState)(!1),R=e=>{if(!d&&e){const t=new g(e).parse();if(t.length>20){O(!0);const e=t.slice(0,20);let a="";return e.forEach(e=>{a+=`= ${e.version} (${e.date}) =\n`,e.changes.forEach(e=>{a+=`${e.category}: ${e.change}\n`}),a+="\n"}),a.trim()}}return e};return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(w,{isOpen:u,onClose:()=>E(!1)}),s&&(0,n.createElement)(i.Placeholder,{icon:v,className:"changelogger-placeholder",label:(0,l.__)("Changeloger","changeloger"),instructions:(0,l.__)("Paste your changelog here, or upload changelog from a text file.","changeloger")},(0,n.createElement)("div",{className:"changeloger-placeholder-actions"},(0,n.createElement)("div",{style:{position:"relative"}},(0,n.createElement)(i.Button,{variant:"primary",onClick:()=>D(!T)},(0,l.__)("Add Changelog","changeloger")),T&&(0,n.createElement)(i.Popover,{className:"add-changelog-popover",position:"bottom right",onClose:()=>D(!1)},(0,n.createElement)(i.MenuGroup,null,(0,n.createElement)(i.MenuItem,{onClick:()=>{d?p(!0):E(!0),D(!1)}},(0,l.__)("Changelog URL","changeloger")),(0,n.createElement)(i.MenuItem,{onClick:()=>{V.current&&V.current(),D(!1)}},(0,l.__)("Upload from File","changeloger")),(0,n.createElement)(i.MenuItem,{onClick:()=>{a({showPlaceholder:!1,showTextArea:!0}),D(!1)}},(0,l.__)("Plain Text","changeloger"))))),(0,n.createElement)(i.Button,{className:"placeholder-sample-button",variant:"tertiary",onClick:()=>{const e=R(`${o}\n= 3.0.0 (01 April 2025) =\nNew: Added a bulk edit feature for faster modifications.\nTweaked: Adjusted UI spacing for better readability.\nUpdated: Refreshed third-party dependencies for stability.\nFixed: Resolved a bug causing layout shifts on mobile.\nimprovement: Enhanced performance for faster load times.\n\n= 2.0.0 (01 March 2025) =\nNew: Added a bulk edit feature for faster modifications.\nTweaked: Adjusted UI spacing for better readability.\nUpdated: Refreshed third-party dependencies for stability.\nFixed: Resolved a bug causing layout shifts on mobile.\nimprovement: Enhanced performance for faster load times.\n\n= 1.0.0 (01 Feb 2025) =\nNew: Added a bulk edit feature for faster modifications.\nTweaked: Adjusted UI spacing for better readability.\nUpdated: Refreshed third-party dependencies for stability.\nFixed: Resolved a bug causing layout shifts on mobile.\nimprovement: Enhanced performance for faster load times.\n`);a({showPlaceholder:!1,showTextArea:!0,changelog:e})}},(0,l.__)("Load Sample Data","changeloger")),(0,n.createElement)(_,{isOpen:h,onClose:()=>p(!1),handleUrlFile:()=>{C&&(/^https?:\/\/([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(?:\/[^\s?#]*)*\.txt(?:\?[^\s#]*)?(?:#[^\s]*)?$/.test(C)?C.toLowerCase().endsWith(".txt")?(y(!0),a({textUrl:C}),fetch(`${window.location.origin}${window.location.pathname.split("/wp-admin")[0]}/wp-json/changeloger/v1/fetch-txt?url=${encodeURIComponent(C)}`).then(e=>e.json()).then(e=>{if(!e||!e.content||""===e.content.trim())return k("This URL has no data inside the .txt file!"),void y(!1);const t=R(e.content);a({changelog:t,showPlaceholder:!1}),p(!1)}).catch(()=>{k("Failed to fetch the file. Please check the URL and try again.")}).finally(()=>y(!1))):k("Please enter a .txt file URL only!"):k("Please enter a valid .txt URL"))},handleUrlChange:e=>{b(e)},textUrl:C,loader:N,errorMessage:x}),(0,n.createElement)(i.FormFileUpload,{accept:"text/plain",onChange:e=>(e=>{const t=new FileReader;t.onload=e=>{const t=e.target.result,n=R(t);a({changelog:n,showPlaceholder:!1})},t.readAsText(e.target.files[0])})(e),render:({openFileDialog:e})=>(V.current=e,null)}))),!s&&c&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)(i.TextareaControl,{label:(0,l.__)("Paste your changelog Here","changeloger"),rows:20,value:o,onChange:e=>{const t=R(e);a({changelog:t})}}),(0,n.createElement)(i.Button,{className:"placeholder-cancel-button",variant:"secondary",onClick:()=>a({showPlaceholder:!0})},(0,l.__)("Cancel","changeloger")),(0,n.createElement)(i.Button,{variant:"primary",onClick:()=>a({showTextArea:!1})},(0,l.__)("View Visual Changelogs","changeloger"))),(0,n.createElement)(f,{isOpen:H,onClose:()=>O(!1)}))},y=function(e){const{attributes:t,setAttributes:a}=e;return(0,n.createElement)(s.BlockControls,null,(0,n.createElement)(i.ToolbarGroup,null,(0,n.createElement)(i.ToolbarButton,{onClick:()=>a({showTextArea:!0})},(0,l.__)("Edit",""))))},x=function e(t){var a;return(0,n.createElement)("ul",{className:null!==(a=!t?.isChild)&&void 0!==a&&a?"changeloger-version-list-wrapper":""},t.versions.map(a=>{const o=a?.children?.length>0;return(0,n.createElement)("li",{key:a.version,className:t?.isChild?"changeloger-version-list-main-item":""},(0,n.createElement)("a",{href:"#"+t.uniqueId+"-"+a.version},"Version ",a.version),o?(0,n.createElement)(e,{isChild:!0,versions:a?.children,uniqueId:t.uniqueId}):null)}))},k=e=>{const t=(()=>{const t=[];return e.parsedChangelog.forEach(e=>{e.changes.forEach(e=>{const a=(0,m.lowerCase)(e.category);t.includes(a)||t.push(a)})}),t})();return(0,n.createElement)("div",{className:"changeloger-filter-wrapper"},(0,n.createElement)("button",{className:"changeloger-filter-popover-button"},(0,n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",className:"lucide lucide-filter buttonIcon"},(0,n.createElement)("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})),"Filter",(0,n.createElement)("span",{className:"arrow-icon"},(0,n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",className:"lucide lucide-chevron-down buttonIcon"},(0,n.createElement)("path",{d:"m6 9 6 6 6-6"}))),(0,n.createElement)("span",{className:"cross-icon"},(0,n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"lucide lucide-x buttonIcon"},(0,n.createElement)("path",{d:"M18 6 6 18"}),(0,n.createElement)("path",{d:"m6 6 12 12"})))),(0,n.createElement)("div",{className:"changeloger-filter-popover"},(0,n.createElement)("div",{className:"drop-title"},(0,n.createElement)("div",{className:"title"},"Filters")),(0,n.createElement)("div",{className:"drop-body"},(0,n.createElement)("div",{className:"title"},"Type"),(0,n.createElement)("div",{className:"filter-button-group"},(0,n.createElement)("button",{"data-filter":"all"},"All Entries"),t.map(e=>(0,n.createElement)("button",{key:e,"data-filter":e},e))))))},T=({uniqueId:e,enableSearch:t,isProChangeloger:a})=>t&&a?(0,n.createElement)("div",{className:"changelog_form_inner"},(0,n.createElement)("div",{className:"changelog_form_group"},(0,n.createElement)("input",{type:"search","data-searchTarget":e,className:"changelog-search-control changelog_form_control noEnterSubmit",placeholder:"Search your changelog..."})),(0,n.createElement)("span",{id:"changelog-search-help-block",className:"help-block"})):null,D=(0,C.jsx)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,C.jsx)(E.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})}),A=(0,C.jsx)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,C.jsx)(E.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})}),P=({date:e,version:t,versionName:a,versionIndex:o,handleDateChange:c,handleVersionChange:g,handleRemoveVersion:m,setAttributes:h,isProChangeloger:p})=>{const[d,u]=(0,r.useState)(!1);return(0,n.createElement)(n.Fragment,null,(0,n.createElement)("div",{className:"date"},p?(0,n.createElement)(s.RichText,{tagName:"span",value:e||"",onChange:e=>c(e,o),placeholder:(0,l.__)("Date","changeloger")}):(0,n.createElement)("span",null,e),(0,n.createElement)(s.RichText,{tagName:"span",className:"changeloger-version-name",placeholder:(0,l.__)("Version Name","changeloger"),value:a[t],onChange:e=>h({versionName:{...a,[t]:e}})})),(0,n.createElement)("div",{className:"version"},p?(0,n.createElement)(s.RichText,{tagName:"span",className:"version-tag",value:t,onChange:e=>g(e,o),placeholder:(0,l.__)("Version","changeloger")}):(0,n.createElement)("span",{className:"version-tag"},t),(0,n.createElement)("span",{className:"line"}),p?(0,n.createElement)("button",{onClick:()=>m(o),className:"delete-version"},(0,n.createElement)(i.Icon,{icon:A,size:20,color:"#ff0000",fill:"#ff0000"})):(0,n.createElement)(n.Fragment,null,(0,n.createElement)("button",{onClick:()=>u(!0),className:"delete-version"},(0,n.createElement)(i.Icon,{icon:A,size:20,color:"#ff0000",fill:"#ff0000"})),(0,n.createElement)(w,{isOpen:d,onClose:()=>u(!1)}))))},V=({category:e,customLogTypeColors:t,onChange:a,isProChangeloger:o,isEditable:r=!0})=>{const c=e.toLowerCase(),i=(0,m.has)(t,c)?{backgroundColor:(0,m.get)(t,c)}:{},g=`tag ${c.replace(" ","-")}`;return o&&r&&a?(0,n.createElement)(s.RichText,{tagName:"span",style:i,className:g,value:e,onChange:a,placeholder:(0,l.__)("Category","changeloger")}):(0,n.createElement)("span",{style:i,className:g},e)},L=({changes:e,versionIndex:t,customLogTypeColors:a,handleCategoryChange:o,handleChangeChange:r,isProChangeloger:c})=>(0,n.createElement)(n.Fragment,null,(e=>{const t={};return e.forEach(e=>{const a=e.category.toLowerCase();t[a]||(t[a]={category:e.category,changes:[]}),t[a].changes.push(e)}),Object.values(t)})(e).map(i=>{const g=i.category.toLowerCase();return(0,n.createElement)("div",{key:g,className:"changelog-category-group"},(0,n.createElement)(V,{category:i.category,customLogTypeColors:a,onChange:a=>{i.changes.forEach(n=>{const l=e.findIndex(e=>e.category===n.category&&e.change===n.change);o(a,t,l)})},isProChangeloger:c}),(0,n.createElement)("ul",{className:"changelog-items-list"},i.changes.map((a,o)=>{const i=e.findIndex(e=>e.category===a.category&&e.change===a.change);return(0,n.createElement)("li",{key:o,className:"change"},c?(0,n.createElement)(s.RichText,{style:{whiteSpace:"normal",minWidth:"0"},tagName:"span",value:a.change||"Enter Text here",placeholder:(0,l.__)("Change","changeloger"),onChange:e=>r(e,t,i)}):(0,n.createElement)("span",null,a.change))})))})),F=({item:e,versionIndex:t,changeIndex:a,customLogTypeColors:o,handleCategoryChange:l,handleChangeChange:r,handleRemoveChangeItem:c,isProChangeloger:i})=>(0,n.createElement)("p",{className:"rich-text-delete"},i?(0,n.createElement)(n.Fragment,null,(0,n.createElement)(V,{category:e.category,customLogTypeColors:o,onChange:e=>l(e,t,a),isProChangeloger:i})):(0,n.createElement)(V,{category:e.category,customLogTypeColors:o,isProChangeloger:i,isEditable:!1}),(0,n.createElement)("span",{className:"change"},i?(0,n.createElement)(n.Fragment,null,(0,n.createElement)(s.RichText,{tagName:"span",value:e.change,onChange:e=>r(e,t,a)}),(0,n.createElement)("button",{className:"rich-text-delete-btn",onClick:()=>c(t,a)},(0,n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",class:"bi bi-trash",viewBox:"0 0 16 16"},(0,n.createElement)("path",{d:"M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z"}),(0,n.createElement)("path",{d:"M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z"})))):(0,n.createElement)("span",{className:"change"},e.change))),I=({changes:e,versionIndex:t,customLogTypeColors:a,handleCategoryChange:o,handleChangeChange:l,handleRemoveChangeItem:r,isProChangeloger:s})=>(0,n.createElement)(n.Fragment,null,e.map((e,c)=>(0,n.createElement)(F,{key:c,item:e,versionIndex:t,changeIndex:c,customLogTypeColors:a,handleCategoryChange:o,handleChangeChange:l,handleRemoveChangeItem:r,isProChangeloger:s}))),S=({onClick:e,label:t="Add New Item"})=>(0,n.createElement)("button",{className:"changeloger-add-item",onClick:e},(0,n.createElement)("span",null,(0,n.createElement)("svg",{height:"24",width:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,n.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),(0,n.createElement)("path",{d:"M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z",fill:"currentColor"})),t)),B=function(e){const[t,a]=(0,r.useState)(!1),{action:o,currentLinks:s,customLinks:c,setAttributes:g,version:h}=e;return!(0,m.isEmpty)(o)&&(0,n.createElement)("div",{className:"changeloger-link-item"},(0,n.createElement)("a",{className:"changeloger-custom-link",href:"#",onClick:e=>(e=>{e.preventDefault(),a(!0)})(e)},!(0,m.isEmpty)(o.icon)&&(0,n.createElement)("span",{className:"changeloger-custom-link-icon",style:{WebkitMaskImage:`url(${o.icon})`}}),o.name),t&&(0,n.createElement)(i.Modal,{title:"Customise Link",onRequestClose:()=>a(!1),shouldCloseOnClickOutside:!1},(0,n.createElement)(i.TextControl,{label:(0,l.__)("Text","changeloger"),value:o?.name,onChange:t=>g({customLinks:{...c,[h]:s.map((a,n)=>n!==e.index?a:{...a,name:t})}})}),(0,n.createElement)(i.TextControl,{label:(0,l.__)("Link","changeloger"),value:o?.link,onChange:t=>g({customLinks:{...c,[h]:s.map((a,n)=>n!==e.index?a:{...a,link:t})}})}),(0,n.createElement)(i.FormFileUpload,{variant:"secondary",accept:"image/*",onChange:t=>(t=>{const n=new FileReader;n.onload=t=>{const n=t.target.result;let o="data:image/svg+xml;base64,"+window.btoa(n);g({customLinks:{...c,[h]:s.map((t,a)=>a!==e.index?t:{...t,icon:o})}}),a(!1)},n.readAsText(t.target.files[0])})(t)},(0,l.__)("Upload Icon","changeloger")),(0,n.createElement)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"20px"}},(0,n.createElement)(i.Button,{style:{marginRight:"10px"},isDestructive:!0,onClick:()=>{g({customLinks:{...c,[h]:s.filter((t,a)=>a!==e.index)}}),a(!1)}},(0,l.__)("Delete","changeloger")),(0,n.createElement)(i.Button,{variant:"primary",onClick:()=>a(!1)},(0,l.__)("Save","changeloger")))))},M=({item:e,versionIndex:t,customLinks:a,versionName:o,changelogLayout:l,customLogTypeColors:s,uniqueId:c,handleDateChange:g,handleVersionChange:h,handleCategoryChange:p,handleChangeChange:d,handleAddChangeItem:u,handleRemoveChangeItem:E,handleRemoveVersion:C,setAttributes:v,isProChangeloger:f})=>{const{date:b,version:_,changes:N}=e,y=(0,m.get)(a,_,[]),x=[...new Set(N.map(e=>e.category.toLowerCase()))],[k,T]=(0,r.useState)(!1);return(0,n.createElement)("div",{className:"changelog-info-item","data-filter":x.join(" ")},(0,n.createElement)(P,{date:b,version:_,versionName:o,versionIndex:t,handleDateChange:g,handleVersionChange:h,handleRemoveVersion:C,setAttributes:v,isProChangeloger:f}),(0,n.createElement)("div",{className:"content"},"grouped"===l&&f?(0,n.createElement)(L,{changes:N,versionIndex:t,customLogTypeColors:s,handleCategoryChange:p,handleChangeChange:d,isProChangeloger:f}):(0,n.createElement)(I,{changes:N,versionIndex:t,customLogTypeColors:s,handleCategoryChange:p,handleChangeChange:d,handleRemoveChangeItem:E,isProChangeloger:f}),f?(0,n.createElement)(S,{onClick:()=>u(t)}):(0,n.createElement)(n.Fragment,null,(0,n.createElement)(S,{onClick:()=>T(!0)}),(0,n.createElement)(w,{isOpen:k,onClose:()=>T(!1)})),y&&y.length>0&&(0,n.createElement)("div",{className:"changeloger-link-wrapper"},y.map((e,t)=>(0,n.createElement)(B,{key:t,action:e,index:t,customLinks:a,currentLinks:y,setAttributes:v,version:_})),(0,n.createElement)(i.Button,{isSmall:!0,isPressed:!0,icon:D,label:"Add Link",onClick:()=>v({customLinks:{...a,[_]:[...y,{name:"Link",link:`${c}#`,icon:""}]}})}))))},H=({onClick:e})=>(0,n.createElement)("div",{className:"timeline-add-version-wrapper"},(0,n.createElement)("div",{className:"timeline-line-extension"}),(0,n.createElement)("button",{className:"timeline-circle-btn",onClick:e},(0,n.createElement)("svg",{height:"24",width:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,n.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),(0,n.createElement)("path",{d:"M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z",fill:"currentColor"})),(0,n.createElement)("span",{className:"btn-text"},"Add New Version"))),O=({enablePagination:e,paginationType:t,paginationLoadMoreText:a,paginationTextColor:o,paginationBgColor:l,setAttributes:r,isProChangeloger:c})=>e&&c?(0,n.createElement)("div",{className:"changeloger-pagination-wrapper"},"load-more"===t&&(0,n.createElement)("div",{className:"wp-block-button"},(0,n.createElement)(s.RichText,{tagName:"button",style:{color:o,backgroundColor:l},className:"changeloger-pagination-button wp-block-button__link wp-element-button",value:a,onChange:e=>r({paginationLoadMoreText:e})})),"numbered"===t&&(0,n.createElement)("div",{className:"changeloger-pagination-inner-wrapper"},(0,n.createElement)("span",{className:"changeloger-prev-button page-navigator"},"« Previous"),(0,n.createElement)("span",{className:"page-numbers current"},"1"),(0,n.createElement)("span",{className:"page-numbers"},"2"),(0,n.createElement)("span",{className:"page-numbers"},"3"),(0,n.createElement)("span",{className:"changeloger-next-button page-navigator"},"Next »"))):null,R=JSON.parse('{"UU":"cha/changeloger"}');(0,o.registerBlockType)(R.UU,{icon:{src:(0,n.createElement)("svg",{width:"20",height:"20",viewBox:"0 0 77 77",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.createElement)("path",{d:"M70.9 76.2455H5.34545C2.3939 76.2455 0 73.8516 0 70.9V5.34545C0 2.3939 2.3939 0 5.34545 0H70.9C73.8516 0 76.2455 2.3939 76.2455 5.34545V70.9C76.2455 73.8516 73.8516 76.2455 70.9 76.2455Z",fill:"#29235C"}),(0,n.createElement)("path",{d:"M44.0745 14.8029H28.1813C27.8623 14.8029 27.6011 14.5442 27.6011 14.2227V12.3437C27.6011 12.0247 27.8598 11.7635 28.1813 11.7635H44.0745C44.3935 11.7635 44.6548 12.0222 44.6548 12.3437V14.2227C44.6523 14.5442 44.3935 14.8029 44.0745 14.8029Z",fill:"url(#paint0_linear_1355_1437)"}),(0,n.createElement)("path",{d:"M66.8228 21.1105H28.1813C27.8623 21.1105 27.6011 20.8518 27.6011 20.5303V18.6513C27.6011 18.3323 27.8598 18.071 28.1813 18.071H66.8228C67.1418 18.071 67.4031 18.3298 67.4031 18.6513V20.5303C67.4005 20.8493 67.1418 21.1105 66.8228 21.1105Z",fill:"url(#paint1_linear_1355_1437)"}),(0,n.createElement)("path",{d:"M61.1659 27.4155H28.1813C27.8623 27.4155 27.6011 27.1567 27.6011 26.8352V24.9563C27.6011 24.6373 27.8598 24.376 28.1813 24.376H61.1659C61.4849 24.376 61.7461 24.6347 61.7461 24.9563V26.8352C61.7461 27.1567 61.4874 27.4155 61.1659 27.4155Z",fill:"url(#paint2_linear_1355_1437)"}),(0,n.createElement)("path",{d:"M55.5542 33.7206H28.1813C27.8623 33.7206 27.6011 33.4618 27.6011 33.1403V31.2614C27.6011 30.9423 27.8598 30.6811 28.1813 30.6811H55.5542C55.8732 30.6811 56.1344 30.9398 56.1344 31.2614V33.1403C56.1344 33.4618 55.8757 33.7206 55.5542 33.7206Z",fill:"url(#paint3_linear_1355_1437)"}),(0,n.createElement)("path",{d:"M44.0745 45.562H28.1813C27.8623 45.562 27.6011 45.3032 27.6011 44.9817V43.1028C27.6011 42.7837 27.8598 42.5225 28.1813 42.5225H44.0745C44.3935 42.5225 44.6548 42.7812 44.6548 43.1028V44.9817C44.6523 45.3007 44.3935 45.562 44.0745 45.562Z",fill:"url(#paint4_linear_1355_1437)"}),(0,n.createElement)("path",{d:"M66.8228 51.867H28.1813C27.8623 51.867 27.6011 51.6083 27.6011 51.2868V49.4078C27.6011 49.0888 27.8598 48.8275 28.1813 48.8275H66.8228C67.1418 48.8275 67.4031 49.0863 67.4031 49.4078V51.2868C67.4005 51.6083 67.1418 51.867 66.8228 51.867Z",fill:"url(#paint5_linear_1355_1437)"}),(0,n.createElement)("path",{d:"M61.1659 58.1721H28.1813C27.8623 58.1721 27.6011 57.9134 27.6011 57.5918V55.7129C27.6011 55.3939 27.8598 55.1326 28.1813 55.1326H61.1659C61.4849 55.1326 61.7461 55.3914 61.7461 55.7129V57.5918C61.7461 57.9134 61.4874 58.1721 61.1659 58.1721Z",fill:"url(#paint6_linear_1355_1437)"}),(0,n.createElement)("path",{d:"M55.5542 64.4771H28.1813C27.8623 64.4771 27.6011 64.2183 27.6011 63.8968V62.0179C27.6011 61.6988 27.8598 61.4376 28.1813 61.4376H55.5542C55.8732 61.4376 56.1344 61.6963 56.1344 62.0179V63.8968C56.1344 64.2183 55.8757 64.4771 55.5542 64.4771Z",fill:"url(#paint7_linear_1355_1437)"}),(0,n.createElement)("path",{d:"M9.6586 11.766H23.6778C24.1275 11.766 24.4917 12.1302 24.4917 12.5798V14.5166C24.4917 14.9662 24.1275 15.3304 23.6778 15.3304H9.6586C9.20896 15.3304 8.84473 14.9662 8.84473 14.5166V12.5798C8.84473 12.1327 9.20896 11.766 9.6586 11.766Z",fill:"#DADADA"}),(0,n.createElement)("path",{d:"M13.2108 16.9808H24.0273C24.2835 16.9808 24.492 17.1893 24.492 17.4455V18.6965C24.492 18.9527 24.2835 19.1612 24.0273 19.1612H13.2108C12.9546 19.1612 12.7461 18.9527 12.7461 18.6965V17.4455C12.7461 17.1893 12.9546 16.9808 13.2108 16.9808Z",fill:"#DADADA"}),(0,n.createElement)("path",{d:"M9.6586 42.525H23.6778C24.1275 42.525 24.4917 42.8892 24.4917 43.3388V45.2756C24.4917 45.7252 24.1275 46.0894 23.6778 46.0894H9.6586C9.20896 46.0894 8.84473 45.7252 8.84473 45.2756V43.3388C8.84473 42.8892 9.20896 42.525 9.6586 42.525Z",fill:"#DADADA"}),(0,n.createElement)("path",{d:"M13.2108 47.7399H24.0273C24.2835 47.7399 24.492 47.9484 24.492 48.2046V49.4556C24.492 49.7118 24.2835 49.9203 24.0273 49.9203H13.2108C12.9546 49.9203 12.7461 49.7118 12.7461 49.4556V48.2046C12.7461 47.9484 12.9546 47.7399 13.2108 47.7399Z",fill:"#DADADA"}),(0,n.createElement)("defs",null,(0,n.createElement)("linearGradient",{id:"paint0_linear_1355_1437",x1:"27.6018",y1:"13.2854",x2:"44.6527",y2:"13.2854",gradientUnits:"userSpaceOnUse"},(0,n.createElement)("stop",{"stop-color":"#DADADA"}),(0,n.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,n.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,n.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,n.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,n.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,n.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,n.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,n.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,n.createElement)("linearGradient",{id:"paint1_linear_1355_1437",x1:"27.6018",y1:"19.5913",x2:"67.4014",y2:"19.5913",gradientUnits:"userSpaceOnUse"},(0,n.createElement)("stop",{"stop-color":"#DADADA"}),(0,n.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,n.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,n.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,n.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,n.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,n.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,n.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,n.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,n.createElement)("linearGradient",{id:"paint2_linear_1355_1437",x1:"27.6018",y1:"25.8971",x2:"61.7464",y2:"25.8971",gradientUnits:"userSpaceOnUse"},(0,n.createElement)("stop",{"stop-color":"#DADADA"}),(0,n.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,n.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,n.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,n.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,n.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,n.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,n.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,n.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,n.createElement)("linearGradient",{id:"paint3_linear_1355_1437",x1:"27.6018",y1:"32.203",x2:"56.1342",y2:"32.203",gradientUnits:"userSpaceOnUse"},(0,n.createElement)("stop",{"stop-color":"#DADADA"}),(0,n.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,n.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,n.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,n.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,n.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,n.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,n.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,n.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,n.createElement)("linearGradient",{id:"paint4_linear_1355_1437",x1:"27.6018",y1:"44.0424",x2:"44.6527",y2:"44.0424",gradientUnits:"userSpaceOnUse"},(0,n.createElement)("stop",{"stop-color":"#DADADA"}),(0,n.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,n.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,n.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,n.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,n.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,n.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,n.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,n.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,n.createElement)("linearGradient",{id:"paint5_linear_1355_1437",x1:"27.6018",y1:"50.3483",x2:"67.4014",y2:"50.3483",gradientUnits:"userSpaceOnUse"},(0,n.createElement)("stop",{"stop-color":"#DADADA"}),(0,n.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,n.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,n.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,n.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,n.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,n.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,n.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,n.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,n.createElement)("linearGradient",{id:"paint6_linear_1355_1437",x1:"27.6018",y1:"56.6542",x2:"61.7464",y2:"56.6542",gradientUnits:"userSpaceOnUse"},(0,n.createElement)("stop",{"stop-color":"#DADADA"}),(0,n.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,n.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,n.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,n.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,n.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,n.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,n.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,n.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,n.createElement)("linearGradient",{id:"paint7_linear_1355_1437",x1:"27.6018",y1:"62.96",x2:"56.1342",y2:"62.96",gradientUnits:"userSpaceOnUse"},(0,n.createElement)("stop",{"stop-color":"#DADADA"}),(0,n.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,n.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,n.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,n.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,n.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,n.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,n.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,n.createElement)("stop",{offset:"1","stop-color":"#DADADA"}))))},edit:function(e){const[t,a]=(0,r.useState)(!1),{attributes:o,setAttributes:l}=e,{uniqueId:c,changelog:i,customLinks:m,newTagColor:h,versionName:p,showTextArea:E,fixedTagColor:C,paginationType:v,enableVersions:f,updateTagColor:b,tweakedTagColor:_,showPlaceholder:D,enablePagination:A,versionsPosition:P,paginationBgColor:V,improvementTagColor:L,paginationTextColor:F,customLogTypeColors:I,paginationLoadMoreText:S,paginationActiveBgColor:B,paginationActiveTextColor:R,paginationHoverBgColor:U,paginationHoverTextColor:$,enableFilter:j,enableSearch:q,changelogLayout:z,filterPosition:G}=o;let{parsedChangelog:Z,handleChangeChange:W,handleCategoryChange:J,handleDateChange:Y,handleVersionChange:X,handleAddChangeItem:K,handleAddVersion:Q,handleRemoveChangeItem:ee,handleRemoveVersion:te}=e;if(!Z){const e=new g(i);Z=e.parse()}const ae=new g(i);W||(W=(e,t,a)=>{const n=[...Z];n[t].changes[a].change=e;const o=ae.convertToPlainText(n);l({changelog:o})}),J||(J=(e,t,a)=>{const n=[...Z];n[t].changes[a].category=e;const o=ae.convertToPlainText(n);l({changelog:o})}),Y||(Y=(e,t)=>{const a=[...Z];a[t].date=e;const n=ae.convertToPlainText(a);l({changelog:n})}),X||(X=(e,t)=>{const a=[...Z];a[t].version=e;const n=ae.convertToPlainText(a);l({changelog:n})}),K||(K=e=>{const t=[...Z];t[e].changes||(t[e].changes=[]),t[e].changes.push({category:"NEW",change:"Added a new feature"});const a=ae.convertToPlainText(t);l({changelog:a})}),Q||(Q=()=>{const e=[...Z],t={version:"1.0.0",date:(new Date).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}),changes:[{category:"NEW",change:"Added a new feature"}]};e.unshift(t);const a=ae.convertToPlainText(e);l({changelog:a})}),ee||(ee=(e,t)=>{const a=[...Z];a[e].changes.splice(t,1);const n=ae.convertToPlainText(a);l({changelog:n})}),te||(te=e=>{const t=[...Z];t.splice(e,1);const a=ae.convertToPlainText(t);l({changelog:a})});const ne=(0,s.useBlockProps)({className:"changeloger-container",style:{"--changeloger-pagination-text-color":F,"--changeloger-pagination-bg-color":V,"--changeloger-pagination-active-text-color":R,"--changeloger-pagination-active-bg-color":B,"--changeloger-pagination-hover-text-color":$,"--changeloger-pagination-hover-bg-color":U,"--changeloger-improvement-tag-bg-color":L,"--changeloger-new-tag-bg-color":h,"--changeloger-update-tag-bg-color":b,"--changeloger-fixed-tag-bg-color":C,"--changeloger-tweaked-tag-bg-color":_}}),oe=ae.getVersions(),le=f&&"left"===P,re=f&&"right"===P;return(0,r.useEffect)(()=>{if(!c){const e=Math.floor(Date.now()/1e3),t=Math.random().toString(36).substr(2,6);l({uniqueId:`cha-${e}-${t}`})}},[]),(0,n.createElement)("div",{...ne,id:c},(0,n.createElement)(T,{uniqueId:c,enableSearch:q,isProChangeloger:d}),!D&&!E&&(0,n.createElement)(n.Fragment,null,j&&d&&(0,n.createElement)("div",{className:`changeloger-action-alignment align-${G}`},(0,n.createElement)(k,{...e,parsedChangelog:Z})),(0,n.createElement)("div",{className:"changelog-wrapper"},le&&(0,n.createElement)("div",{className:"changeloger-version-list-container changeloger-version-list-position-left"},(0,n.createElement)("h6",{className:"version-title"},"Versions"),(0,n.createElement)(x,{versions:oe,uniqueId:c})),(0,n.createElement)("div",{className:"changeloger-info-inner-wrapper"},(0,n.createElement)("div",{className:"changeloger-items"},d?(0,n.createElement)(H,{onClick:Q}):(0,n.createElement)(n.Fragment,null,(0,n.createElement)("div",{className:"timeline-add-version-wrapper"},(0,n.createElement)("button",{className:"timeline-circle-btn",onClick:()=>a(!0)},(0,n.createElement)("svg",{height:"24",width:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,n.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),(0,n.createElement)("path",{d:"M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z",fill:"currentColor"})),(0,n.createElement)("span",{className:"btn-text"},"Add New Version")),(0,n.createElement)(w,{isOpen:t,onClose:()=>a(!1)}))),Z.map((e,t)=>(0,n.createElement)(M,{key:t,item:e,versionIndex:t,customLinks:m,versionName:p,changelogLayout:z,customLogTypeColors:I,uniqueId:c,handleDateChange:Y,handleVersionChange:X,handleCategoryChange:J,handleChangeChange:W,handleAddChangeItem:K,handleRemoveChangeItem:ee,handleRemoveVersion:te,setAttributes:l,isProChangeloger:d})))),re&&(0,n.createElement)("div",{className:"changeloger-version-list-container changeloger-version-list-position-right"},(0,n.createElement)("h6",{className:"version-title"},"Versions"),(0,n.createElement)(x,{versions:oe,uniqueId:c}))),(0,n.createElement)(O,{enablePagination:A,paginationType:v,paginationLoadMoreText:S,paginationTextColor:F,paginationBgColor:V,setAttributes:l,isProChangeloger:d})),(0,n.createElement)(u,{...e}),(0,n.createElement)(N,{...e}),(0,n.createElement)(y,{...e}))},save:function(e){const{uniqueId:t,customLinks:a,newTagColor:o,versionName:r,fixedTagColor:c,paginationType:i,updateTagColor:h,tweakedTagColor:p,enablePagination:u,paginationBgColor:E,improvementTagColor:C,paginationTextColor:v,customLogTypeColors:f,paginationLoadMoreText:b,paginationActiveBgColor:_,paginationActiveTextColor:w,paginationHoverBgColor:N,paginationHoverTextColor:y,enableFilter:T,enableVersions:D,versionsPosition:A,perPage:P,enableSearch:V,changelogLayout:L,filterPosition:F,enableSubscription:I,subscriptionProductName:S,emailEndingMessage:B,searchPlaceholder:M}=e.attributes,H=s.useBlockProps.save({className:"changeloger-container",style:{"--changeloger-pagination-text-color":v,"--changeloger-pagination-bg-color":E,"--changeloger-pagination-active-text-color":w,"--changeloger-pagination-active-bg-color":_,"--changeloger-pagination-hover-text-color":y,"--changeloger-pagination-hover-bg-color":N,"--changeloger-improvement-tag-bg-color":C,"--changeloger-new-tag-bg-color":o,"--changeloger-update-tag-bg-color":h,"--changeloger-fixed-tag-bg-color":c,"--changeloger-tweaked-tag-bg-color":p}}),O=new g(e.attributes.changelog);let R=O.parse();!d&&R.length>20&&(R=R.slice(0,20));const U=O.getVersions(),$=D&&"left"===A,j=D&&"right"===A;return(0,n.createElement)("div",{...H,id:t},V&&d&&(0,n.createElement)("div",{className:"changelog_form_inner"},(0,n.createElement)("div",{className:"changelog_form_group"},(0,n.createElement)("input",{type:"search","data-searchTarget":t,className:"changelog-search-control changelog_form_control noEnterSubmit",placeholder:M||"Search your changelog...",checked:V})),(0,n.createElement)("span",{id:"changelog-search-help-block",className:"help-block"})),d&&(0,n.createElement)("div",{className:`changeloger-action-alignment align-${F}`},I&&(0,n.createElement)("div",{className:"cha-subscription-button-container","data-product-name":S,"data-ending-message":B,"data-block-id":t}),T&&(0,n.createElement)(k,{...e,parsedChangelog:R})),(0,n.createElement)("div",{className:"changelog-wrapper"},$&&(0,n.createElement)("div",{className:"changeloger-version-list-container changeloger-version-list-position-left"},(0,n.createElement)("h6",{className:"version-title"},"Versions"),(0,n.createElement)(x,{versions:U,uniqueId:t})),(0,n.createElement)("span",{"data-changeloger-content":"start"}),(0,n.createElement)("div",{className:"changeloger-info-inner-wrapper"},(0,n.createElement)("div",{className:"changeloger-items"},R&&R.length>0?R.map(e=>{const{date:o,version:c,changes:i}=e,g=(0,m.get)(a,c,[]),h=[...new Set(i.map(e=>e.category.toLowerCase()))];return(0,n.createElement)("div",{key:e.version,id:t+"-"+e.version,className:"changelog-info-item","data-filter":h.join(" ")},(0,n.createElement)("div",{className:"date"},(0,n.createElement)("span",null,o),r&&r[c]&&(0,n.createElement)(s.RichText.Content,{tagName:"span",className:"changeloger-version-name",placeholder:(0,l.__)("Version Name","changeloger"),value:r[c]})),(0,n.createElement)("div",{className:"version"},(0,n.createElement)("span",{className:"version-tag"},c),(0,n.createElement)("span",{className:"line"})),(0,n.createElement)("div",{className:"content"},"grouped"===L&&d?function(e){const t={};return e.forEach(e=>{const a=e.category.toLowerCase();t[a]||(t[a]={category:e.category,changes:[]}),t[a].changes.push(e)}),Object.values(t)}(i).map(e=>{const t=e.category.toLowerCase(),a=(0,m.has)(f,t);return(0,n.createElement)("div",{key:t,className:"changelog-category-group"},(0,n.createElement)("span",{style:a?{backgroundColor:(0,m.get)(f,t)}:{},className:`tag ${t.toLowerCase().replace(/\s/g,"-")}`},e.category),(0,n.createElement)("ul",{className:"changelog-items-list"},e.changes.map((e,t)=>(0,n.createElement)("li",{key:t,className:"change"},e.change))))}):i.map(e=>{const t=e.category.toLowerCase(),a=(0,m.has)(f,t);return(0,n.createElement)("p",null,(0,n.createElement)("span",{style:a?{backgroundColor:(0,m.get)(f,t)}:{},className:`tag ${t.toLowerCase().replace(/\s/g,"-")}`},e.category),(0,n.createElement)("span",{className:"change"},e.change))}),g&&g.length>0&&(0,n.createElement)("div",{className:"changeloger-link-wrapper"},g.map(e=>(0,n.createElement)("a",{href:e.link,className:"changeloger-custom-link",target:"_blank"},e.icon&&(0,n.createElement)("span",{className:"changeloger-custom-link-icon",style:{WebkitMaskImage:`url(${e.icon})`}}),e.name)))))}):(0,n.createElement)("p",null,(0,l.__)("No changelog data available","changeloger")))),(0,n.createElement)("span",{"data-changeloger-content":"end"}),j&&(0,n.createElement)("div",{className:"changeloger-version-list-container changeloger-version-list-position-right"},(0,n.createElement)("h6",{className:"version-title"},"Versions"),(0,n.createElement)("span",{"data-changeloger-version":"start"}),(0,n.createElement)(x,{versions:U,uniqueId:t}),(0,n.createElement)("span",{"data-changeloger-version":"end"}))),u&&d&&(0,n.createElement)("div",{className:"changeloger-pagination-wrapper","data-per-page":P},"load-more"===i&&(0,n.createElement)("div",{className:"wp-block-button"},(0,n.createElement)(s.RichText.Content,{tagName:"button",style:{color:v,backgroundColor:E},className:"changeloger-pagination-button wp-block-button__link wp-element-button",value:b})),"numbered"===i&&d&&(0,n.createElement)("div",{className:"changeloger-pagination-inner-wrapper"},(0,n.createElement)("span",{className:"changeloger-prev-button page-navigator"},"« Previous"),(0,n.createElement)("span",{className:"page-numbers current"},"1"),(0,n.createElement)("span",{className:"page-numbers"},"2"),(0,n.createElement)("span",{className:"page-numbers"},"3"),(0,n.createElement)("span",{className:"changeloger-next-button page-navigator"},"Next »"))))},deprecated:[{attributes:{changelog:{type:"string",default:""},enablePagination:{type:"boolean",default:!1},paginationLoadMoreText:{type:"string",default:"Load More"},perPage:{type:"number",default:10},paginationType:{type:"string",default:"load-more"},showPlaceholder:{type:"boolean",default:!0},showTextArea:{type:"boolean",default:!1},paginationTextColor:{type:"string",default:"#ffffff"},paginationBgColor:{type:"string",default:"#000000"},paginationActiveTextColor:{type:"string",default:"#000000"},paginationActiveBgColor:{type:"string",default:"#f5f5f5"},customLogTypeColors:{type:"object",default:{}},customLinks:{type:"object",default:{}},versionName:{type:"object",default:{}},enableVersions:{type:"boolean",default:"true"},versionsPosition:{type:"string",default:"right"}},save:function(e){const{uniqueId:t,customLinks:a,newTagColor:o,versionName:r,fixedTagColor:c,paginationType:i,updateTagColor:h,tweakedTagColor:p,enablePagination:u,paginationBgColor:E,improvementTagColor:C,paginationTextColor:v,customLogTypeColors:f,paginationLoadMoreText:b,paginationActiveBgColor:_,paginationActiveTextColor:w,paginationHoverBgColor:N,paginationHoverTextColor:y,enableFilter:T,enableVersions:D,versionsPosition:A,perPage:P,enableSearch:V,changelogLayout:L,filterPosition:F,enableSubscription:I,subscriptionProductName:S,emailEndingMessage:B,searchPlaceholder:M}=e.attributes,H=s.useBlockProps.save({className:"changeloger-container",style:{"--changeloger-pagination-text-color":v,"--changeloger-pagination-bg-color":E,"--changeloger-pagination-active-text-color":w,"--changeloger-pagination-active-bg-color":_,"--changeloger-pagination-hover-text-color":y,"--changeloger-pagination-hover-bg-color":N,"--changeloger-improvement-tag-bg-color":C,"--changeloger-new-tag-bg-color":o,"--changeloger-update-tag-bg-color":h,"--changeloger-fixed-tag-bg-color":c,"--changeloger-tweaked-tag-bg-color":p}}),O=new g(e.attributes.changelog),R=O.parse(),U=O.getVersions(),$=D&&"left"===A,j=D&&"right"===A;return(0,n.createElement)("div",{...H,id:t},V&&d&&(0,n.createElement)("div",{className:"changelog_form_inner"},(0,n.createElement)("div",{className:"changelog_form_group"},(0,n.createElement)("input",{type:"search","data-searchTarget":t,className:"changelog-search-control changelog_form_control noEnterSubmit",placeholder:"Search your changelog...",checked:V})),(0,n.createElement)("span",{id:"changelog-search-help-block",className:"help-block"})),T&&d&&(0,n.createElement)(k,{...e,parsedChangelog:R}),(0,n.createElement)("div",{className:"changelog-wrapper"},$&&(0,n.createElement)("div",{className:"changeloger-version-list-container changeloger-version-list-position-left"},(0,n.createElement)("h6",{className:"version-title"},"Versions"),(0,n.createElement)(x,{versions:U,uniqueId:t})),(0,n.createElement)("div",{className:"changeloger-info-inner-wrapper"},(0,n.createElement)("div",{className:"changeloger-items"},R.map(e=>{const{date:o,version:c,changes:i}=e,g=(0,m.get)(a,c,[]),h=[...new Set(i.map(e=>e.category.toLowerCase()))];return(0,n.createElement)("div",{key:e.version,id:t+"-"+e.version,className:"changelog-info-item","data-filter":h.join(" ")},(0,n.createElement)("div",{className:"date"},(0,n.createElement)("span",null,o),(0,n.createElement)(s.RichText.Content,{tagName:"span",className:"changeloger-version-name",placeholder:(0,l.__)("Version Name","changeloger"),value:r[c]})),(0,n.createElement)("div",{className:"version"},(0,n.createElement)("span",{className:"version-tag"},c),(0,n.createElement)("span",{className:"line"})),(0,n.createElement)("div",{className:"content"},"grouped"===L&&d?function(e){const t={};return e.forEach(e=>{const a=e.category.toLowerCase();t[a]||(t[a]={category:e.category,changes:[]}),t[a].changes.push(e)}),Object.values(t)}(i).map(e=>{const t=e.category.toLowerCase(),a=(0,m.has)(f,t);return(0,n.createElement)("div",{key:t,className:"changelog-category-group"},(0,n.createElement)("span",{style:a?{backgroundColor:(0,m.get)(f,t)}:{},className:`tag ${t.toLowerCase().replace(/\s/g,"-")}`},e.category),(0,n.createElement)("ul",{className:"changelog-items-list"},e.changes.map((e,t)=>(0,n.createElement)("li",{key:t,className:"change"},e.change))))}):i.map(e=>{const t=e.category.toLowerCase(),a=(0,m.has)(f,t);return(0,n.createElement)("p",null,(0,n.createElement)("span",{style:a?{backgroundColor:(0,m.get)(f,t)}:{},className:`tag ${t.toLowerCase().replace(/\s/g,"-")}`},e.category),(0,n.createElement)("span",{className:"change"},e.change))}),(0,n.createElement)("div",{className:"changeloger-link-wrapper"},g.map(e=>(0,n.createElement)("a",{href:e.link,className:"changeloger-custom-link",target:"_blank"},e.icon&&(0,n.createElement)("span",{className:"changeloger-custom-link-icon",style:{WebkitMaskImage:`url(${e.icon})`}}),e.name)))))}))),j&&(0,n.createElement)("div",{className:"changeloger-version-list-container changeloger-version-list-position-right"},(0,n.createElement)("h6",{className:"version-title"},"Versions"),(0,n.createElement)(x,{versions:U,uniqueId:t}))),u&&d&&(0,n.createElement)("div",{className:"changeloger-pagination-wrapper","data-per-page":P},"load-more"===i&&(0,n.createElement)("div",{className:"wp-block-button"},(0,n.createElement)(s.RichText.Content,{tagName:"button",style:{color:v,backgroundColor:E},className:"changeloger-pagination-button wp-block-button__link wp-element-button",value:b})),"numbered"===i&&d&&(0,n.createElement)("div",{className:"changeloger-pagination-inner-wrapper"},(0,n.createElement)("span",{className:"changeloger-prev-button page-navigator"},"« Previous"),(0,n.createElement)("span",{className:"page-numbers current"},"1"),(0,n.createElement)("span",{className:"page-numbers"},"2"),(0,n.createElement)("span",{className:"page-numbers"},"3"),(0,n.createElement)("span",{className:"changeloger-next-button page-navigator"},"Next »"))))}}]})},609:e=>{e.exports=window.React},848:(e,t,a)=>{e.exports=a(20)}},a={};function n(e){var o=a[e];if(void 0!==o)return o.exports;var l=a[e]={exports:{}};return t[e](l,l.exports,n),l.exports}n.m=t,e=[],n.O=(t,a,o,l)=>{if(!a){var r=1/0;for(g=0;g<e.length;g++){for(var[a,o,l]=e[g],s=!0,c=0;c<a.length;c++)(!1&l||r>=l)&&Object.keys(n.O).every(e=>n.O[e](a[c]))?a.splice(c--,1):(s=!1,l<r&&(r=l));if(s){e.splice(g--,1);var i=o();void 0!==i&&(t=i)}}return t}l=l||0;for(var g=e.length;g>0&&e[g-1][2]>l;g--)e[g]=e[g-1];e[g]=[a,o,l]},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={391:0,423:0};n.O.j=t=>0===e[t];var t=(t,a)=>{var o,l,[r,s,c]=a,i=0;if(r.some(t=>0!==e[t])){for(o in s)n.o(s,o)&&(n.m[o]=s[o]);if(c)var g=c(n)}for(t&&t(a);i<r.length;i++)l=r[i],n.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return n.O(g)},a=globalThis.webpackChunkchangeloger=globalThis.webpackChunkchangeloger||[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))})();var o=n.O(void 0,[423],()=>n(221));o=n.O(o)})();
     1(()=>{"use strict";var e,t={20:(e,t,a)=>{var n=a(609),o=Symbol.for("react.element"),l=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),r=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,a){var n,c={},i=null,g=null;for(n in void 0!==a&&(i=""+a),void 0!==t.key&&(i=""+t.key),void 0!==t.ref&&(g=t.ref),t)l.call(t,n)&&!s.hasOwnProperty(n)&&(c[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===c[n]&&(c[n]=t[n]);return{$$typeof:o,type:e,key:i,ref:g,props:c,_owner:r.current}}},221:(e,t,a)=>{var n=a(609);const o=window.wp.blocks,l=window.wp.i18n,r=window.wp.element,s=window.wp.blockEditor,c=window.wp.data,i=window.wp.components;class g{constructor(e){this.changelog=e,this.datePattern=/\b(\d{1,2}[\/-]\d{1,2}[\/-]\d{2,4}|\d{4}-\d{2}-\d{2}|\d{1,2} \w+ \d{4})\b/,this.versionPattern=/(?:[vV]?\s*)?(\d+(\.\d+){0,3})(?:\s*\(.*\))?/}parseSection(e){const t=e.split("\n").filter(e=>""!==e.trim());if(!(t.length>1))return!1;const a=t[0].trim(),n=this.datePattern.exec(a),o=this.versionPattern.exec(a);if(!o)return!1;const l=o[1].trim(),r=t.slice(1);return{version:l,date:n?n[0]:null,changes:this.parseChanges(r)}}parseChanges(e){const t=[];let a="General";return e.forEach(e=>{if(""===e.trim())return;const n=e.match(/^\*\*([^*]+)\*\*\s*:?\s*$/);if(n)a=n[1].trim();else if(e.trim().startsWith("*")){let n=e.trim().replace(/^\*\s*/,"");t.push({category:a,change:this.processLinks(n)})}else{const a=e.indexOf(":"),n=e.indexOf(" - "),o=-1!==a&&(-1===n||a<n)?a:n;if(-1!==o){let a=e.substring(0,o).trim();a=a.trim();const l=e.substring(o+(o===n?3:1)).trim();t.push({category:a,change:this.processLinks(l)})}}}),t}processLinks(e){return e.replace(/\[(.*?)\]\((.*?)\)/g,'<a href="$2">$1</a>')}parse(){const e=this.changelog.replace(/\n\s*(?=\n.*:)/g,"").split(/\n(?=\s*\d{2} \w+ \d{4}|\s*=+\s*[\d.]+|v[\d.]+|#*\s*[\d.]+|-{1,12}\s*[\d.]+\s*\(.*\)\s*-{1,12}|\s*=\s*[\d.]+\s*\(.*?\)\s*=)/),t=[];return e.forEach(e=>{const a=this.parseSection(e);a&&t.push(a)}),t}normalizeVersion(e){const t=e.split(".");return 1===t.length?t.push("0","0"):2===t.length&&t.push("0"),t.join(".")}getVersions(){const e=this.parse(),t={};e.forEach(e=>{const a=this.normalizeVersion(e.version),n=a.split("."),o=`${n[0]}.${n[1]}.x`;t[o]||(t[o]={version:o,children:[]}),t[o].children.push({...e,version:a,children:[]})});const a=Object.values(t).map(e=>(e.children.sort((e,t)=>this.compareVersions(t.version,e.version)),e));return a.sort((e,t)=>this.compareVersions(t.version,e.version)),a}compareVersions(e,t){const a=e.split(".").map(e=>parseInt(e,10)),n=t.split(".").map(e=>parseInt(e,10));for(let e=0;e<Math.max(a.length,n.length);e++){if((a[e]||0)>(n[e]||0))return 1;if((a[e]||0)<(n[e]||0))return-1}return 0}convertToPlainText(e){let t="";return e.forEach(e=>{t+=`= ${e.version} (${e.date}) =\n`,e.changes.forEach(e=>{t+=`${e.category}: ${e.change}\n`}),t+="\n"}),t.trim()}hasNewVersionAdded(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;if(0===e.length&&t.length>0)return!0;if(0===t.length)return!1;const a=e.map(e=>e.version),n=a.length>0?a.reduce((e,t)=>this.compareVersions(t,e)>0?t:e):null,o=t.map(e=>e.version),l=o.length>0?o.reduce((e,t)=>this.compareVersions(t,e)>0?t:e):null;return!(!l||!n)&&this.compareVersions(l,n)>0}}const m=window.lodash,h=({label:e,colorValue:t,onColorChange:a,colors:o=[],className:l})=>(0,n.createElement)(i.Dropdown,{popoverProps:{placement:"left-start",offset:36,shift:!0},className:`changeloger-color-dropdown-control ${l}`,contentClassName:"changeloger-color-dropdown-control-content",renderToggle:({isOpen:a,onToggle:o})=>(0,n.createElement)(i.Button,{className:`changeloger-color-dropdown-control-button ${a&&"is-open"} ${l}`,onClick:o,"aria-expanded":a},(0,n.createElement)(i.ColorIndicator,{colorValue:t}),e),renderContent:()=>(0,n.createElement)(s.__experimentalColorGradientControl,{colors:o,colorValue:t,onColorChange:a})}),p=function(e){const t=(()=>{const t=[];return e.changelog.forEach(e=>{const a=[];e.changes.forEach(e=>{t.includes(e.category)||a.includes(e.category)||a.push(e.category)}),t.push(...a)}),t})();return t.map((a,o)=>{const l=(0,m.get)(e.value,a.toLowerCase(),"");return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(h,{className:t.length>0&&0===o?"is-list is-first":"is-list",colors:e.colors,label:a.concat(" Color"),colorValue:l,onColorChange:t=>e.onChange({...e.value,[a.toLowerCase()]:t})}))})},d=!!changeloger_local_object.licensing,u=function(e){const{attributes:t,setAttributes:a}=e,{perPage:o,changelog:r,enableVersions:m,paginationType:u,enablePagination:E,versionsPosition:C,paginationBgColor:v,customLogTypeColors:f,paginationTextColor:b,paginationActiveBgColor:_,paginationActiveTextColor:w,paginationHoverBgColor:y,paginationHoverTextColor:N,enableFilter:x,filterPosition:k,enableSearch:T,searchPlaceholder:D,changelogLayout:A,enableSubscription:P,subscriptionProductName:V,emailEndingMessage:F}=t,L=[{label:(0,l.__)("Left","changeloger"),value:"left"},{label:(0,l.__)("Right","changeloger"),value:"right"}],I=[{icon:"editor-alignleft",label:(0,l.__)("Left","changeloger"),value:"left"},{icon:"editor-aligncenter",label:(0,l.__)("Left","changeloger"),value:"center"},{icon:"editor-alignright",label:(0,l.__)("Right","changeloger"),value:"right"}],{defaultColors:S}=(0,c.useSelect)(e=>({defaultColors:e("core/block-editor")?.getSettings()?.__experimentalFeatures?.color?.palette?.default})),B=d?"":"cha-pro-element",H=new g(r).parse();return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(s.InspectorControls,null,(0,n.createElement)(i.PanelBody,{title:(0,l.__)("Versions","changeloger"),initialOpen:!0},(0,n.createElement)(i.ToggleControl,{label:(0,l.__)("Sidebar Versions","changeloger"),checked:m,onChange:()=>a({enableVersions:!m})}),m&&(0,n.createElement)(i.__experimentalToggleGroupControl,{isBlock:!0,value:C,label:(0,l.__)("Versions Position","changeloger")},L.map(e=>(0,n.createElement)(i.__experimentalToggleGroupControlOption,{value:e.value,label:e.label,onClick:()=>a({versionsPosition:e.value})})))),(0,n.createElement)(i.PanelBody,{title:(0,l.__)("Pagination","changeloger"),className:B,initialOpen:!1},(0,n.createElement)(i.ToggleControl,{label:(0,l.__)("Pagination","changeloger"),checked:E,disabled:!d,onChange:()=>a({enablePagination:!E})}),E&&d&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)(i.SelectControl,{label:(0,l.__)("Pagination Type","changeloger"),value:u,options:[{label:"Load More",value:"load-more"},{label:"Numbered",value:"numbered"}],onChange:e=>a({paginationType:e}),__nextHasNoMarginBottom:!0}),(0,n.createElement)(i.TextControl,{label:(0,l.__)("Per Page","changeloger"),value:o.toString(),type:"number",onChange:e=>a({perPage:Number(e)})}))),(0,n.createElement)(i.PanelBody,{title:(0,l.__)("Filter","changeloger"),className:B,initialOpen:!1},(0,n.createElement)(i.ToggleControl,{label:(0,l.__)("Filter","changeloger"),checked:x,disabled:!d,onChange:()=>a({enableFilter:!x})}),x&&d&&(0,n.createElement)(i.__experimentalToggleGroupControl,{isBlock:!0,value:k,label:(0,l.__)("Filter Position","changeloger")},I.map(e=>(0,n.createElement)(i.__experimentalToggleGroupControlOptionIcon,{icon:e.icon,value:e.value,label:e.label,onClick:()=>a({filterPosition:e.value})})))),(0,n.createElement)(i.PanelBody,{title:(0,l.__)("Search","changeloger"),className:B,initialOpen:!1},(0,n.createElement)(i.ToggleControl,{label:(0,l.__)("Enable Search","changeloger"),checked:T,disabled:!d,onChange:()=>a({enableSearch:!T})}),T&&d&&(0,n.createElement)(i.TextControl,{label:(0,l.__)("Search Placeholder","changeloger"),value:D,onChange:e=>a({searchPlaceholder:e}),placeholder:(0,l.__)("Type your placeholder text…","changeloger")})),(0,n.createElement)(i.PanelBody,{title:(0,l.__)("Layout","changeloger"),className:B,initialOpen:!1},(0,n.createElement)(i.SelectControl,{label:(0,l.__)("Changelog Layout","changeloger"),value:A||"individual",options:[{label:"Individual (Category per item)",value:"individual"},{label:"Grouped (Categories grouped together)",value:"grouped"}],onChange:e=>a({changelogLayout:e}),__nextHasNoMarginBottom:!0,disabled:!d})),(0,n.createElement)(i.PanelBody,{title:(0,l.__)("Subscription","changeloger"),className:B,initialOpen:!1},(0,n.createElement)(i.ToggleControl,{label:(0,l.__)("Enable Subscription","changeloger"),checked:P,disabled:!d,onChange:()=>a({enableSubscription:!P})}),P&&d&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)(i.TextControl,{label:(0,l.__)("Product Name","changeloger"),value:V,onChange:e=>a({subscriptionProductName:e}),placeholder:(0,l.__)("e.g., My Product","changeloger"),help:(0,l.__)("This name will be used in notification emails to identify the product.","changeloger")}),(0,n.createElement)(i.TextControl,{label:(0,l.__)("Email Ending Message","changeloger"),value:F,onChange:e=>a({emailEndingMessage:e}),placeholder:(0,l.__)("e.g., Update today and enjoy new features!","changeloger"),help:(0,l.__)('This message will appear before the "View Changes" button in notification emails.',"changeloger")})))),(0,n.createElement)(s.InspectorControls,{group:"styles"},(0,n.createElement)(i.PanelBody,{title:(0,l.__)("Log Tags","changeloger"),initialOpen:!0},(0,n.createElement)(p,{changelog:H,colors:S,value:f,onChange:e=>{a({customLogTypeColors:e})}})),E&&d&&(0,n.createElement)(i.PanelBody,{title:(0,l.__)("Pagination","changeloger"),initialOpen:!1},(0,n.createElement)(h,{className:"is-list is-first",colors:S,label:(0,l.__)("Text Color","changeloger"),colorValue:b,onColorChange:e=>a({paginationTextColor:e})}),(0,n.createElement)(h,{className:"is-list",colors:S,label:(0,l.__)("Bg Color","changeloger"),colorValue:v,onColorChange:e=>a({paginationBgColor:e})}),(0,n.createElement)(h,{className:"is-list",colors:S,label:(0,l.__)("Text Hover Color","changeloger"),colorValue:N,onColorChange:e=>a({paginationHoverTextColor:e})}),(0,n.createElement)(h,{className:"is-list",colors:S,label:(0,l.__)("Bg Hover Color","changeloger"),colorValue:y,onColorChange:e=>a({paginationHoverBgColor:e})}),"numbered"===u&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)(h,{className:"is-list",colors:S,label:(0,l.__)("Active Text Color","changeloger"),colorValue:w,onColorChange:e=>a({paginationActiveTextColor:e})}),(0,n.createElement)(h,{className:"is-list",colors:S,label:(0,l.__)("Active Bg Color","changeloger"),colorValue:_,onColorChange:e=>a({paginationActiveBgColor:e})})),(0,n.createElement)(s.ContrastChecker,{backgroundColor:v,textColor:b}))))},E=window.wp.primitives;var C=a(848);const v=(0,C.jsx)(E.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,C.jsx)(E.Path,{d:"M4 9v1.5h16V9H4zm12 5.5h4V13h-4v1.5zm-6 0h4V13h-4v1.5zm-6 0h4V13H4v1.5z"})}),f=function({isOpen:e,onClose:t}){if(!e)return null;const a=window.location.href.substring(0,window.location.href.lastIndexOf("/wp-admin"))+"/wp-admin/admin.php?page=changeloger-pricing";return(0,n.createElement)(i.Modal,{title:(0,l.__)("Version Limit Reached","changeloger"),onRequestClose:t,className:"changeloger-version-limit-modal"},(0,n.createElement)("div",{className:"changeloger-modal-content"},(0,n.createElement)("p",{className:"changeloger-modal-message"},(0,l.__)("You have reached the maximum limit of 20 versions for the free version.","changeloger")),(0,n.createElement)("p",{className:"changeloger-modal-submessage"},(0,l.__)("Upgrade to Changeloger Pro to add unlimited versions and unlock more powerful features!","changeloger")),(0,n.createElement)("div",{className:"changeloger-modal-actions"},(0,n.createElement)(i.Button,{variant:"primary",href:a,target:"_blank",className:"changeloger-upgrade-button"},(0,l.__)("Upgrade to Pro","changeloger")),(0,n.createElement)(i.Button,{variant:"secondary",onClick:t,className:"changeloger-close-button"},(0,l.__)("Close","changeloger")))))},b=()=>(0,n.createElement)(n.Fragment,null,(0,n.createElement)("div",{className:"loader-wave"},(0,n.createElement)("div",{className:"wave-bar"}),(0,n.createElement)("div",{className:"wave-bar"}),(0,n.createElement)("div",{className:"wave-bar"}),(0,n.createElement)("div",{className:"wave-bar"}),(0,n.createElement)("div",{className:"wave-bar"}))),_=({onClose:e,handleUrlFile:t,handleUrlChange:a,textUrl:o,isOpen:r,loader:s,errorMessage:c})=>r?(0,n.createElement)(n.Fragment,null,(0,n.createElement)(i.Modal,{title:(0,l.__)("File URL","changeloger"),onRequestClose:e,className:`changeloger-version-limit-modal changeloger-text-url ${s&&"changeloger-modal-loader"}`},(0,n.createElement)("div",{className:"changeloger-modal-content"},(0,n.createElement)("p",{className:"changeloger-modal-message"},(0,l.__)("Changelog File URL.","changeloger")),(0,n.createElement)(i.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,placeholder:(0,l.__)("Enter URL to changelog text file","changeloger"),onChange:a,value:o,type:"url",required:!0,className:"changeloger-text-url-input"}),(0,n.createElement)("p",{className:"changeloger-text-url-note"},(0,l.__)("Note: Only text files are supported. (.txt)","changeloger")),c&&(0,n.createElement)("div",{className:"changeloger-text-url-error"},c),(0,n.createElement)("div",{className:"changeloger-modal-actions"},(0,n.createElement)(i.Button,{variant:"primary",onClick:t,className:"changeloger-upgrade-button"},s&&(0,n.createElement)(b,null),(0,n.createElement)("span",null,(0,l.__)("Fetch URL Data","changeloger"))))))):null,w=function({isOpen:e,onClose:t}){if(!e)return null;const a=window.location.href.substring(0,window.location.href.lastIndexOf("/wp-admin"))+"/wp-admin/admin.php?page=changeloger-pricing";return(0,n.createElement)(i.Modal,{title:(0,l.__)("Pro Features","changeloger"),onRequestClose:t,className:"changeloger-pro-features-modal"},(0,n.createElement)("div",{className:"changeloger-modal-content"},(0,n.createElement)("p",{className:"changeloger-modal-message"},(0,l.__)("Unlock more powerful features with Changeloger Pro!","changeloger")),(0,n.createElement)("p",{className:"changeloger-modal-submessage"},(0,l.__)("Upgrade to Changeloger Pro to unlock more powerful features!","changeloger")),(0,n.createElement)("div",{className:"changeloger-modal-actions"},(0,n.createElement)(i.Button,{variant:"primary",href:a,target:"_blank",className:"changeloger-upgrade-button"},(0,l.__)("Upgrade to Pro","changeloger")),(0,n.createElement)(i.Button,{variant:"secondary",onClick:t,className:"changeloger-close-button"},(0,l.__)("Close","changeloger")))))},y=function(e){const{attributes:t,setAttributes:a}=e,{changelog:o,showPlaceholder:s,showTextArea:c,uniqueId:m}=t,[h,p]=(0,r.useState)(!1),[u,E]=(0,r.useState)(!1),[C,b]=(0,r.useState)(""),[y,N]=(0,r.useState)(!1),[x,k]=(0,r.useState)(""),[T,D]=(0,r.useState)(!1),[A,P]=(0,r.useState)(!1),V=(0,r.useRef)(null),F=(e=>{const t=new g(e),[a,n]=(0,r.useState)(()=>t.parse()),o=(e,a)=>{a({changelog:t.convertToPlainText(e)})};return{parsedChangelog:a,setParsedChangelog:n,handleChangeChange:(e,t,l,r)=>{const s=[...a];s[t].changes[l].change=e,n(s),o(s,r)},handleCategoryChange:(e,t,l,r)=>{const s=[...a];s[t].changes[l].category=e,n(s),o(s,r)},handleDateChange:(e,t,l)=>{const r=[...a];r[t].date=e,n(r),o(r,l)},handleVersionChange:(e,t,l)=>{const r=[...a];r[t].version=e,n(r),o(r,l)},handleAddChangeItem:(e,t)=>{const l=[...a];l[e].changes||(l[e].changes=[]),l[e].changes.push({category:"NEW",change:"Added a new feature"}),n(l),o(l,t)},handleAddVersion:e=>{const t=[...a],l={version:"New Version",date,changes:[{category:"NEW",change:"Added a new feature"}]};t.push(l),n(t),o(t,e)},handleRemoveChangeItem:(e,t,l)=>{const r=[...a];r[e].changes.splice(t,1),n(r),o(r,l)},handleRemoveVersion:(e,t)=>{const l=[...a];l.splice(e,1),n(l),o(l,t)},updateChangelogAttribute:o}})(o),{parsedChangelog:L,handleChangeChange:I,handleCategoryChange:S,handleDateChange:B,handleVersionChange:H}=F;e.parsedChangelog=L,e.handleChangeChange=(e,t,n)=>I(e,t,n,a),e.handleCategoryChange=(e,t,n)=>S(e,t,n,a),e.handleDateChange=(e,t)=>B(e,t,a),e.handleVersionChange=(e,t)=>H(e,t,a),(0,r.useEffect)(()=>{if(!o||!m)return;const{select:e}=wp.data,a=e("core/editor").getCurrentPostId();if(!a)return;const n=new g(o).parse();if(0===n.length)return;const l=setTimeout(()=>{fetch(`${window.location.origin}${window.location.pathname.split("/wp-admin")[0]}/wp-json/changeloger/v1/track-version`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":window.changeloger_local_object?.nonce||""},body:JSON.stringify({post_id:a,unique_id:m,parsed_changelog:n,is_pro:d,url:t.textUrl||"",enableVersions:t.enableVersions||!1})}).then(e=>e.json()).then(e=>{e.success&&e.new_version_detected&&console.log("Version tracked:",e)}).catch(e=>{console.error("Version tracking error:",e)})},2e3);return()=>clearTimeout(l)},[o,m,t.textUrl]);const[M,O]=(0,r.useState)(!1),R=e=>{if(!d&&e){const t=new g(e).parse();if(t.length>20){O(!0);const e=t.slice(0,20);let a="";return e.forEach(e=>{a+=`= ${e.version} (${e.date}) =\n`,e.changes.forEach(e=>{a+=`${e.category}: ${e.change}\n`}),a+="\n"}),a.trim()}}return e};return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(w,{isOpen:u,onClose:()=>E(!1)}),s&&(0,n.createElement)(i.Placeholder,{icon:v,className:"changelogger-placeholder",label:(0,l.__)("Changeloger","changeloger"),instructions:(0,l.__)("Paste your changelog here, or upload changelog from a text file.","changeloger")},(0,n.createElement)("div",{className:"changeloger-placeholder-actions"},(0,n.createElement)("div",{style:{position:"relative"}},(0,n.createElement)(i.Button,{variant:"primary",onClick:()=>D(!T)},(0,l.__)("Add Changelog","changeloger")),T&&(0,n.createElement)(i.Popover,{className:"add-changelog-popover",position:"bottom right",onClose:()=>D(!1)},(0,n.createElement)(i.MenuGroup,null,(0,n.createElement)(i.MenuItem,{onClick:()=>{d?p(!0):E(!0),D(!1)}},(0,l.__)("Changelog URL","changeloger")),(0,n.createElement)(i.MenuItem,{onClick:()=>{V.current&&V.current(),D(!1)}},(0,l.__)("Upload from File","changeloger")),(0,n.createElement)(i.MenuItem,{onClick:()=>{a({showPlaceholder:!1,showTextArea:!0}),D(!1)}},(0,l.__)("Plain Text","changeloger"))))),(0,n.createElement)(i.Button,{className:"placeholder-sample-button",variant:"tertiary",onClick:()=>{const e=R(`${o}\n= 3.0.0 (01 April 2025) =\nNew: Added a bulk edit feature for faster modifications.\nTweaked: Adjusted UI spacing for better readability.\nUpdated: Refreshed third-party dependencies for stability.\nFixed: Resolved a bug causing layout shifts on mobile.\nimprovement: Enhanced performance for faster load times.\n\n= 2.0.0 (01 March 2025) =\nNew: Added a bulk edit feature for faster modifications.\nTweaked: Adjusted UI spacing for better readability.\nUpdated: Refreshed third-party dependencies for stability.\nFixed: Resolved a bug causing layout shifts on mobile.\nimprovement: Enhanced performance for faster load times.\n\n= 1.0.0 (01 Feb 2025) =\nNew: Added a bulk edit feature for faster modifications.\nTweaked: Adjusted UI spacing for better readability.\nUpdated: Refreshed third-party dependencies for stability.\nFixed: Resolved a bug causing layout shifts on mobile.\nimprovement: Enhanced performance for faster load times.\n`);a({showPlaceholder:!1,showTextArea:!0,changelog:e})}},(0,l.__)("Load Sample Data","changeloger")),(0,n.createElement)(_,{isOpen:h,onClose:()=>p(!1),handleUrlFile:()=>{C&&(/^https?:\/\/([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(?:\/[^\s?#]*)*\.txt(?:\?.*)?(?:#.*)?$/.test(C)?(N(!0),a({textUrl:C}),fetch(`${window.location.origin}${window.location.pathname.split("/wp-admin")[0]}/wp-json/changeloger/v1/fetch-txt?url=${encodeURIComponent(C)}`).then(e=>e.json()).then(e=>{if(!e||!e.content||""===e.content.trim())return k("This URL has no data inside the .txt file!"),void N(!1);const t=R(e.content);a({changelog:t,showPlaceholder:!1}),p(!1)}).catch(()=>{k("Failed to fetch the file. Please check the URL and try again.")}).finally(()=>N(!1))):k("Please enter a valid .txt URL"))},handleUrlChange:e=>{b(e)},textUrl:C,loader:y,errorMessage:x}),(0,n.createElement)(i.FormFileUpload,{accept:"text/plain",onChange:e=>(e=>{const t=new FileReader;t.onload=e=>{const t=e.target.result,n=R(t);a({changelog:n,showPlaceholder:!1})},t.readAsText(e.target.files[0])})(e),render:({openFileDialog:e})=>(V.current=e,null)}))),!s&&c&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)(i.TextareaControl,{label:(0,l.__)("Paste your changelog Here","changeloger"),rows:20,value:o,onChange:e=>{const t=R(e);a({changelog:t})}}),(0,n.createElement)(i.Button,{className:"placeholder-cancel-button",variant:"secondary",onClick:()=>a({showPlaceholder:!0})},(0,l.__)("Cancel","changeloger")),(0,n.createElement)(i.Button,{variant:"primary",onClick:()=>a({showTextArea:!1})},(0,l.__)("View Visual Changelogs","changeloger"))),(0,n.createElement)(f,{isOpen:M,onClose:()=>O(!1)}))},N=function(e){const{attributes:t,setAttributes:a}=e;return(0,n.createElement)(s.BlockControls,null,(0,n.createElement)(i.ToolbarGroup,null,(0,n.createElement)(i.ToolbarButton,{onClick:()=>a({showTextArea:!0})},(0,l.__)("Edit",""))))},x=function e(t){var a;return(0,n.createElement)("ul",{className:null!==(a=!t?.isChild)&&void 0!==a&&a?"changeloger-version-list-wrapper":""},t.versions.map(a=>{const o=a?.children?.length>0;return(0,n.createElement)("li",{key:a.version,className:t?.isChild?"changeloger-version-list-main-item":""},(0,n.createElement)("a",{href:"#"+t.uniqueId+"-"+a.version},"Version ",a.version),o?(0,n.createElement)(e,{isChild:!0,versions:a?.children,uniqueId:t.uniqueId}):null)}))},k=e=>{const t=(()=>{const t=[];return e.parsedChangelog.forEach(e=>{e.changes.forEach(e=>{const a=(0,m.lowerCase)(e.category);t.includes(a)||t.push(a)})}),t})();return(0,n.createElement)("div",{className:"changeloger-filter-wrapper"},(0,n.createElement)("button",{className:"changeloger-filter-popover-button"},(0,n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",className:"lucide lucide-filter buttonIcon"},(0,n.createElement)("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})),"Filter",(0,n.createElement)("span",{className:"arrow-icon"},(0,n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",className:"lucide lucide-chevron-down buttonIcon"},(0,n.createElement)("path",{d:"m6 9 6 6 6-6"}))),(0,n.createElement)("span",{className:"cross-icon"},(0,n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"lucide lucide-x buttonIcon"},(0,n.createElement)("path",{d:"M18 6 6 18"}),(0,n.createElement)("path",{d:"m6 6 12 12"})))),(0,n.createElement)("div",{className:"changeloger-filter-popover"},(0,n.createElement)("div",{className:"drop-title"},(0,n.createElement)("div",{className:"title"},"Filters")),(0,n.createElement)("div",{className:"drop-body"},(0,n.createElement)("div",{className:"title"},"Type"),(0,n.createElement)("div",{className:"filter-button-group"},(0,n.createElement)("button",{"data-filter":"all"},"All Entries"),t.map(e=>(0,n.createElement)("button",{key:e,"data-filter":e},e))))))},T=({uniqueId:e,enableSearch:t,isProChangeloger:a})=>t&&a?(0,n.createElement)("div",{className:"changelog_form_inner"},(0,n.createElement)("div",{className:"changelog_form_group"},(0,n.createElement)("input",{type:"search","data-searchTarget":e,className:"changelog-search-control changelog_form_control noEnterSubmit",placeholder:"Search your changelog..."})),(0,n.createElement)("span",{id:"changelog-search-help-block",className:"help-block"})):null,D=(0,C.jsx)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,C.jsx)(E.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})}),A=(0,C.jsx)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,C.jsx)(E.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})}),P=({date:e,version:t,versionName:a,versionIndex:o,handleDateChange:c,handleVersionChange:g,handleRemoveVersion:m,setAttributes:h,isProChangeloger:p})=>{const[d,u]=(0,r.useState)(!1);return(0,n.createElement)(n.Fragment,null,(0,n.createElement)("div",{className:"date"},p?(0,n.createElement)(s.RichText,{tagName:"span",value:e||"",onChange:e=>c(e,o),placeholder:(0,l.__)("Date","changeloger")}):(0,n.createElement)("span",null,e),(0,n.createElement)(s.RichText,{tagName:"span",className:"changeloger-version-name",placeholder:(0,l.__)("Version Name","changeloger"),value:a[t],onChange:e=>h({versionName:{...a,[t]:e}})})),(0,n.createElement)("div",{className:"version"},p?(0,n.createElement)(s.RichText,{tagName:"span",className:"version-tag",value:t,onChange:e=>g(e,o),placeholder:(0,l.__)("Version","changeloger")}):(0,n.createElement)("span",{className:"version-tag"},t),(0,n.createElement)("span",{className:"line"}),p?(0,n.createElement)("button",{onClick:()=>m(o),className:"delete-version"},(0,n.createElement)(i.Icon,{icon:A,size:20,color:"#ff0000",fill:"#ff0000"})):(0,n.createElement)(n.Fragment,null,(0,n.createElement)("button",{onClick:()=>u(!0),className:"delete-version"},(0,n.createElement)(i.Icon,{icon:A,size:20,color:"#ff0000",fill:"#ff0000"})),(0,n.createElement)(w,{isOpen:d,onClose:()=>u(!1)}))))},V=({category:e,customLogTypeColors:t,onChange:a,isProChangeloger:o,isEditable:r=!0})=>{const c=e.toLowerCase(),i=(0,m.has)(t,c)?{backgroundColor:(0,m.get)(t,c)}:{},g=`tag ${c.replace(" ","-")}`;return o&&r&&a?(0,n.createElement)(s.RichText,{tagName:"span",style:i,className:g,value:e,onChange:a,placeholder:(0,l.__)("Category","changeloger")}):(0,n.createElement)("span",{style:i,className:g},e)},F=({changes:e,versionIndex:t,customLogTypeColors:a,handleCategoryChange:o,handleChangeChange:r,isProChangeloger:c})=>(0,n.createElement)(n.Fragment,null,(e=>{const t={};return e.forEach(e=>{const a=e.category.toLowerCase();t[a]||(t[a]={category:e.category,changes:[]}),t[a].changes.push(e)}),Object.values(t)})(e).map(i=>{const g=i.category.toLowerCase();return(0,n.createElement)("div",{key:g,className:"changelog-category-group"},(0,n.createElement)(V,{category:i.category,customLogTypeColors:a,onChange:a=>{i.changes.forEach(n=>{const l=e.findIndex(e=>e.category===n.category&&e.change===n.change);o(a,t,l)})},isProChangeloger:c}),(0,n.createElement)("ul",{className:"changelog-items-list"},i.changes.map((a,o)=>{const i=e.findIndex(e=>e.category===a.category&&e.change===a.change);return(0,n.createElement)("li",{key:o,className:"change"},c?(0,n.createElement)(s.RichText,{style:{whiteSpace:"normal",minWidth:"0"},tagName:"span",value:a.change||"Enter Text here",placeholder:(0,l.__)("Change","changeloger"),onChange:e=>r(e,t,i)}):(0,n.createElement)("span",null,a.change))})))})),L=({item:e,versionIndex:t,changeIndex:a,customLogTypeColors:o,handleCategoryChange:l,handleChangeChange:r,handleRemoveChangeItem:c,isProChangeloger:i})=>(0,n.createElement)("p",{className:"rich-text-delete"},i?(0,n.createElement)(n.Fragment,null,(0,n.createElement)(V,{category:e.category,customLogTypeColors:o,onChange:e=>l(e,t,a),isProChangeloger:i})):(0,n.createElement)(V,{category:e.category,customLogTypeColors:o,isProChangeloger:i,isEditable:!1}),(0,n.createElement)("span",{className:"change"},i?(0,n.createElement)(n.Fragment,null,(0,n.createElement)(s.RichText,{tagName:"span",value:e.change,onChange:e=>r(e,t,a)}),(0,n.createElement)("button",{className:"rich-text-delete-btn",onClick:()=>c(t,a)},(0,n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",class:"bi bi-trash",viewBox:"0 0 16 16"},(0,n.createElement)("path",{d:"M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z"}),(0,n.createElement)("path",{d:"M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z"})))):(0,n.createElement)("span",{className:"change"},e.change))),I=({changes:e,versionIndex:t,customLogTypeColors:a,handleCategoryChange:o,handleChangeChange:l,handleRemoveChangeItem:r,isProChangeloger:s})=>(0,n.createElement)(n.Fragment,null,e.map((e,c)=>(0,n.createElement)(L,{key:c,item:e,versionIndex:t,changeIndex:c,customLogTypeColors:a,handleCategoryChange:o,handleChangeChange:l,handleRemoveChangeItem:r,isProChangeloger:s}))),S=({onClick:e,label:t="Add New Item"})=>(0,n.createElement)("button",{className:"changeloger-add-item",onClick:e},(0,n.createElement)("span",null,(0,n.createElement)("svg",{height:"24",width:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,n.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),(0,n.createElement)("path",{d:"M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z",fill:"currentColor"})),t)),B=function(e){const[t,a]=(0,r.useState)(!1),{action:o,currentLinks:s,customLinks:c,setAttributes:g,version:h}=e;return!(0,m.isEmpty)(o)&&(0,n.createElement)("div",{className:"changeloger-link-item"},(0,n.createElement)("a",{className:"changeloger-custom-link",href:"#",onClick:e=>(e=>{e.preventDefault(),a(!0)})(e)},!(0,m.isEmpty)(o.icon)&&(0,n.createElement)("span",{className:"changeloger-custom-link-icon",style:{WebkitMaskImage:`url(${o.icon})`}}),o.name),t&&(0,n.createElement)(i.Modal,{title:"Customise Link",onRequestClose:()=>a(!1),shouldCloseOnClickOutside:!1},(0,n.createElement)(i.TextControl,{label:(0,l.__)("Text","changeloger"),value:o?.name,onChange:t=>g({customLinks:{...c,[h]:s.map((a,n)=>n!==e.index?a:{...a,name:t})}})}),(0,n.createElement)(i.TextControl,{label:(0,l.__)("Link","changeloger"),value:o?.link,onChange:t=>g({customLinks:{...c,[h]:s.map((a,n)=>n!==e.index?a:{...a,link:t})}})}),(0,n.createElement)(i.FormFileUpload,{variant:"secondary",accept:"image/*",onChange:t=>(t=>{const n=new FileReader;n.onload=t=>{const n=t.target.result;let o="data:image/svg+xml;base64,"+window.btoa(n);g({customLinks:{...c,[h]:s.map((t,a)=>a!==e.index?t:{...t,icon:o})}}),a(!1)},n.readAsText(t.target.files[0])})(t)},(0,l.__)("Upload Icon","changeloger")),(0,n.createElement)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"20px"}},(0,n.createElement)(i.Button,{style:{marginRight:"10px"},isDestructive:!0,onClick:()=>{g({customLinks:{...c,[h]:s.filter((t,a)=>a!==e.index)}}),a(!1)}},(0,l.__)("Delete","changeloger")),(0,n.createElement)(i.Button,{variant:"primary",onClick:()=>a(!1)},(0,l.__)("Save","changeloger")))))},H=({item:e,versionIndex:t,customLinks:a,versionName:o,changelogLayout:l,customLogTypeColors:s,uniqueId:c,handleDateChange:g,handleVersionChange:h,handleCategoryChange:p,handleChangeChange:d,handleAddChangeItem:u,handleRemoveChangeItem:E,handleRemoveVersion:C,setAttributes:v,isProChangeloger:f})=>{const{date:b,version:_,changes:y}=e,N=(0,m.get)(a,_,[]),x=[...new Set(y.map(e=>e.category.toLowerCase()))],[k,T]=(0,r.useState)(!1);return(0,n.createElement)("div",{className:"changelog-info-item","data-filter":x.join(" ")},(0,n.createElement)(P,{date:b,version:_,versionName:o,versionIndex:t,handleDateChange:g,handleVersionChange:h,handleRemoveVersion:C,setAttributes:v,isProChangeloger:f}),(0,n.createElement)("div",{className:"content"},"grouped"===l&&f?(0,n.createElement)(F,{changes:y,versionIndex:t,customLogTypeColors:s,handleCategoryChange:p,handleChangeChange:d,isProChangeloger:f}):(0,n.createElement)(I,{changes:y,versionIndex:t,customLogTypeColors:s,handleCategoryChange:p,handleChangeChange:d,handleRemoveChangeItem:E,isProChangeloger:f}),f?(0,n.createElement)(S,{onClick:()=>u(t)}):(0,n.createElement)(n.Fragment,null,(0,n.createElement)(S,{onClick:()=>T(!0)}),(0,n.createElement)(w,{isOpen:k,onClose:()=>T(!1)})),N&&N.length>0&&(0,n.createElement)("div",{className:"changeloger-link-wrapper"},N.map((e,t)=>(0,n.createElement)(B,{key:t,action:e,index:t,customLinks:a,currentLinks:N,setAttributes:v,version:_})),(0,n.createElement)(i.Button,{isSmall:!0,isPressed:!0,icon:D,label:"Add Link",onClick:()=>v({customLinks:{...a,[_]:[...N,{name:"Link",link:`${c}#`,icon:""}]}})}))))},M=({onClick:e})=>(0,n.createElement)("div",{className:"timeline-add-version-wrapper"},(0,n.createElement)("div",{className:"timeline-line-extension"}),(0,n.createElement)("button",{className:"timeline-circle-btn",onClick:e},(0,n.createElement)("svg",{height:"24",width:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,n.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),(0,n.createElement)("path",{d:"M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z",fill:"currentColor"})),(0,n.createElement)("span",{className:"btn-text"},"Add New Version"))),O=({enablePagination:e,paginationType:t,paginationLoadMoreText:a,paginationTextColor:o,paginationBgColor:l,setAttributes:r,isProChangeloger:c})=>e&&c?(0,n.createElement)("div",{className:"changeloger-pagination-wrapper"},"load-more"===t&&(0,n.createElement)("div",{className:"wp-block-button"},(0,n.createElement)(s.RichText,{tagName:"button",style:{color:o,backgroundColor:l},className:"changeloger-pagination-button wp-block-button__link wp-element-button",value:a,onChange:e=>r({paginationLoadMoreText:e})})),"numbered"===t&&(0,n.createElement)("div",{className:"changeloger-pagination-inner-wrapper"},(0,n.createElement)("span",{className:"changeloger-prev-button page-navigator"},"« Previous"),(0,n.createElement)("span",{className:"page-numbers current"},"1"),(0,n.createElement)("span",{className:"page-numbers"},"2"),(0,n.createElement)("span",{className:"page-numbers"},"3"),(0,n.createElement)("span",{className:"changeloger-next-button page-navigator"},"Next »"))):null,R=JSON.parse('{"UU":"cha/changeloger"}');(0,o.registerBlockType)(R.UU,{icon:{src:(0,n.createElement)("svg",{width:"20",height:"20",viewBox:"0 0 77 77",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.createElement)("path",{d:"M70.9 76.2455H5.34545C2.3939 76.2455 0 73.8516 0 70.9V5.34545C0 2.3939 2.3939 0 5.34545 0H70.9C73.8516 0 76.2455 2.3939 76.2455 5.34545V70.9C76.2455 73.8516 73.8516 76.2455 70.9 76.2455Z",fill:"#29235C"}),(0,n.createElement)("path",{d:"M44.0745 14.8029H28.1813C27.8623 14.8029 27.6011 14.5442 27.6011 14.2227V12.3437C27.6011 12.0247 27.8598 11.7635 28.1813 11.7635H44.0745C44.3935 11.7635 44.6548 12.0222 44.6548 12.3437V14.2227C44.6523 14.5442 44.3935 14.8029 44.0745 14.8029Z",fill:"url(#paint0_linear_1355_1437)"}),(0,n.createElement)("path",{d:"M66.8228 21.1105H28.1813C27.8623 21.1105 27.6011 20.8518 27.6011 20.5303V18.6513C27.6011 18.3323 27.8598 18.071 28.1813 18.071H66.8228C67.1418 18.071 67.4031 18.3298 67.4031 18.6513V20.5303C67.4005 20.8493 67.1418 21.1105 66.8228 21.1105Z",fill:"url(#paint1_linear_1355_1437)"}),(0,n.createElement)("path",{d:"M61.1659 27.4155H28.1813C27.8623 27.4155 27.6011 27.1567 27.6011 26.8352V24.9563C27.6011 24.6373 27.8598 24.376 28.1813 24.376H61.1659C61.4849 24.376 61.7461 24.6347 61.7461 24.9563V26.8352C61.7461 27.1567 61.4874 27.4155 61.1659 27.4155Z",fill:"url(#paint2_linear_1355_1437)"}),(0,n.createElement)("path",{d:"M55.5542 33.7206H28.1813C27.8623 33.7206 27.6011 33.4618 27.6011 33.1403V31.2614C27.6011 30.9423 27.8598 30.6811 28.1813 30.6811H55.5542C55.8732 30.6811 56.1344 30.9398 56.1344 31.2614V33.1403C56.1344 33.4618 55.8757 33.7206 55.5542 33.7206Z",fill:"url(#paint3_linear_1355_1437)"}),(0,n.createElement)("path",{d:"M44.0745 45.562H28.1813C27.8623 45.562 27.6011 45.3032 27.6011 44.9817V43.1028C27.6011 42.7837 27.8598 42.5225 28.1813 42.5225H44.0745C44.3935 42.5225 44.6548 42.7812 44.6548 43.1028V44.9817C44.6523 45.3007 44.3935 45.562 44.0745 45.562Z",fill:"url(#paint4_linear_1355_1437)"}),(0,n.createElement)("path",{d:"M66.8228 51.867H28.1813C27.8623 51.867 27.6011 51.6083 27.6011 51.2868V49.4078C27.6011 49.0888 27.8598 48.8275 28.1813 48.8275H66.8228C67.1418 48.8275 67.4031 49.0863 67.4031 49.4078V51.2868C67.4005 51.6083 67.1418 51.867 66.8228 51.867Z",fill:"url(#paint5_linear_1355_1437)"}),(0,n.createElement)("path",{d:"M61.1659 58.1721H28.1813C27.8623 58.1721 27.6011 57.9134 27.6011 57.5918V55.7129C27.6011 55.3939 27.8598 55.1326 28.1813 55.1326H61.1659C61.4849 55.1326 61.7461 55.3914 61.7461 55.7129V57.5918C61.7461 57.9134 61.4874 58.1721 61.1659 58.1721Z",fill:"url(#paint6_linear_1355_1437)"}),(0,n.createElement)("path",{d:"M55.5542 64.4771H28.1813C27.8623 64.4771 27.6011 64.2183 27.6011 63.8968V62.0179C27.6011 61.6988 27.8598 61.4376 28.1813 61.4376H55.5542C55.8732 61.4376 56.1344 61.6963 56.1344 62.0179V63.8968C56.1344 64.2183 55.8757 64.4771 55.5542 64.4771Z",fill:"url(#paint7_linear_1355_1437)"}),(0,n.createElement)("path",{d:"M9.6586 11.766H23.6778C24.1275 11.766 24.4917 12.1302 24.4917 12.5798V14.5166C24.4917 14.9662 24.1275 15.3304 23.6778 15.3304H9.6586C9.20896 15.3304 8.84473 14.9662 8.84473 14.5166V12.5798C8.84473 12.1327 9.20896 11.766 9.6586 11.766Z",fill:"#DADADA"}),(0,n.createElement)("path",{d:"M13.2108 16.9808H24.0273C24.2835 16.9808 24.492 17.1893 24.492 17.4455V18.6965C24.492 18.9527 24.2835 19.1612 24.0273 19.1612H13.2108C12.9546 19.1612 12.7461 18.9527 12.7461 18.6965V17.4455C12.7461 17.1893 12.9546 16.9808 13.2108 16.9808Z",fill:"#DADADA"}),(0,n.createElement)("path",{d:"M9.6586 42.525H23.6778C24.1275 42.525 24.4917 42.8892 24.4917 43.3388V45.2756C24.4917 45.7252 24.1275 46.0894 23.6778 46.0894H9.6586C9.20896 46.0894 8.84473 45.7252 8.84473 45.2756V43.3388C8.84473 42.8892 9.20896 42.525 9.6586 42.525Z",fill:"#DADADA"}),(0,n.createElement)("path",{d:"M13.2108 47.7399H24.0273C24.2835 47.7399 24.492 47.9484 24.492 48.2046V49.4556C24.492 49.7118 24.2835 49.9203 24.0273 49.9203H13.2108C12.9546 49.9203 12.7461 49.7118 12.7461 49.4556V48.2046C12.7461 47.9484 12.9546 47.7399 13.2108 47.7399Z",fill:"#DADADA"}),(0,n.createElement)("defs",null,(0,n.createElement)("linearGradient",{id:"paint0_linear_1355_1437",x1:"27.6018",y1:"13.2854",x2:"44.6527",y2:"13.2854",gradientUnits:"userSpaceOnUse"},(0,n.createElement)("stop",{"stop-color":"#DADADA"}),(0,n.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,n.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,n.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,n.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,n.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,n.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,n.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,n.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,n.createElement)("linearGradient",{id:"paint1_linear_1355_1437",x1:"27.6018",y1:"19.5913",x2:"67.4014",y2:"19.5913",gradientUnits:"userSpaceOnUse"},(0,n.createElement)("stop",{"stop-color":"#DADADA"}),(0,n.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,n.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,n.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,n.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,n.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,n.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,n.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,n.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,n.createElement)("linearGradient",{id:"paint2_linear_1355_1437",x1:"27.6018",y1:"25.8971",x2:"61.7464",y2:"25.8971",gradientUnits:"userSpaceOnUse"},(0,n.createElement)("stop",{"stop-color":"#DADADA"}),(0,n.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,n.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,n.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,n.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,n.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,n.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,n.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,n.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,n.createElement)("linearGradient",{id:"paint3_linear_1355_1437",x1:"27.6018",y1:"32.203",x2:"56.1342",y2:"32.203",gradientUnits:"userSpaceOnUse"},(0,n.createElement)("stop",{"stop-color":"#DADADA"}),(0,n.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,n.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,n.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,n.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,n.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,n.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,n.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,n.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,n.createElement)("linearGradient",{id:"paint4_linear_1355_1437",x1:"27.6018",y1:"44.0424",x2:"44.6527",y2:"44.0424",gradientUnits:"userSpaceOnUse"},(0,n.createElement)("stop",{"stop-color":"#DADADA"}),(0,n.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,n.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,n.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,n.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,n.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,n.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,n.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,n.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,n.createElement)("linearGradient",{id:"paint5_linear_1355_1437",x1:"27.6018",y1:"50.3483",x2:"67.4014",y2:"50.3483",gradientUnits:"userSpaceOnUse"},(0,n.createElement)("stop",{"stop-color":"#DADADA"}),(0,n.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,n.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,n.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,n.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,n.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,n.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,n.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,n.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,n.createElement)("linearGradient",{id:"paint6_linear_1355_1437",x1:"27.6018",y1:"56.6542",x2:"61.7464",y2:"56.6542",gradientUnits:"userSpaceOnUse"},(0,n.createElement)("stop",{"stop-color":"#DADADA"}),(0,n.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,n.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,n.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,n.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,n.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,n.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,n.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,n.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,n.createElement)("linearGradient",{id:"paint7_linear_1355_1437",x1:"27.6018",y1:"62.96",x2:"56.1342",y2:"62.96",gradientUnits:"userSpaceOnUse"},(0,n.createElement)("stop",{"stop-color":"#DADADA"}),(0,n.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,n.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,n.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,n.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,n.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,n.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,n.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,n.createElement)("stop",{offset:"1","stop-color":"#DADADA"}))))},edit:function(e){const[t,a]=(0,r.useState)(!1),{attributes:o,setAttributes:l}=e,{uniqueId:c,changelog:i,customLinks:m,newTagColor:h,versionName:p,showTextArea:E,fixedTagColor:C,paginationType:v,enableVersions:f,updateTagColor:b,tweakedTagColor:_,showPlaceholder:D,enablePagination:A,versionsPosition:P,paginationBgColor:V,improvementTagColor:F,paginationTextColor:L,customLogTypeColors:I,paginationLoadMoreText:S,paginationActiveBgColor:B,paginationActiveTextColor:R,paginationHoverBgColor:U,paginationHoverTextColor:$,enableFilter:j,enableSearch:q,changelogLayout:z,filterPosition:G}=o;let{parsedChangelog:Z,handleChangeChange:W,handleCategoryChange:J,handleDateChange:Y,handleVersionChange:X,handleAddChangeItem:K,handleAddVersion:Q,handleRemoveChangeItem:ee,handleRemoveVersion:te}=e;if(!Z){const e=new g(i);Z=e.parse()}const ae=new g(i);W||(W=(e,t,a)=>{const n=[...Z];n[t].changes[a].change=e;const o=ae.convertToPlainText(n);l({changelog:o})}),J||(J=(e,t,a)=>{const n=[...Z];n[t].changes[a].category=e;const o=ae.convertToPlainText(n);l({changelog:o})}),Y||(Y=(e,t)=>{const a=[...Z];a[t].date=e;const n=ae.convertToPlainText(a);l({changelog:n})}),X||(X=(e,t)=>{const a=[...Z];a[t].version=e;const n=ae.convertToPlainText(a);l({changelog:n})}),K||(K=e=>{const t=[...Z];t[e].changes||(t[e].changes=[]),t[e].changes.push({category:"NEW",change:"Added a new feature"});const a=ae.convertToPlainText(t);l({changelog:a})}),Q||(Q=()=>{const e=[...Z],t={version:"1.0.0",date:(new Date).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}),changes:[{category:"NEW",change:"Added a new feature"}]};e.unshift(t);const a=ae.convertToPlainText(e);l({changelog:a})}),ee||(ee=(e,t)=>{const a=[...Z];a[e].changes.splice(t,1);const n=ae.convertToPlainText(a);l({changelog:n})}),te||(te=e=>{const t=[...Z];t.splice(e,1);const a=ae.convertToPlainText(t);l({changelog:a})});const ne=(0,s.useBlockProps)({className:"changeloger-container",style:{"--changeloger-pagination-text-color":L,"--changeloger-pagination-bg-color":V,"--changeloger-pagination-active-text-color":R,"--changeloger-pagination-active-bg-color":B,"--changeloger-pagination-hover-text-color":$,"--changeloger-pagination-hover-bg-color":U,"--changeloger-improvement-tag-bg-color":F,"--changeloger-new-tag-bg-color":h,"--changeloger-update-tag-bg-color":b,"--changeloger-fixed-tag-bg-color":C,"--changeloger-tweaked-tag-bg-color":_}}),oe=ae.getVersions(),le=f&&"left"===P,re=f&&"right"===P;return(0,r.useEffect)(()=>{if(!c){const e=Math.floor(Date.now()/1e3),t=Math.random().toString(36).substr(2,6);l({uniqueId:`cha-${e}-${t}`})}},[]),(0,n.createElement)("div",{...ne,id:c},(0,n.createElement)(T,{uniqueId:c,enableSearch:q,isProChangeloger:d}),!D&&!E&&(0,n.createElement)(n.Fragment,null,j&&d&&(0,n.createElement)("div",{className:`changeloger-action-alignment align-${G}`},(0,n.createElement)(k,{...e,parsedChangelog:Z})),(0,n.createElement)("div",{className:"changelog-wrapper"},le&&(0,n.createElement)("div",{className:"changeloger-version-list-container changeloger-version-list-position-left"},(0,n.createElement)("h6",{className:"version-title"},"Versions"),(0,n.createElement)(x,{versions:oe,uniqueId:c})),(0,n.createElement)("div",{className:"changeloger-info-inner-wrapper"},(0,n.createElement)("div",{className:"changeloger-items"},d?(0,n.createElement)(M,{onClick:Q}):(0,n.createElement)(n.Fragment,null,(0,n.createElement)("div",{className:"timeline-add-version-wrapper"},(0,n.createElement)("button",{className:"timeline-circle-btn",onClick:()=>a(!0)},(0,n.createElement)("svg",{height:"24",width:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,n.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),(0,n.createElement)("path",{d:"M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z",fill:"currentColor"})),(0,n.createElement)("span",{className:"btn-text"},"Add New Version")),(0,n.createElement)(w,{isOpen:t,onClose:()=>a(!1)}))),Z.map((e,t)=>(0,n.createElement)(H,{key:t,item:e,versionIndex:t,customLinks:m,versionName:p,changelogLayout:z,customLogTypeColors:I,uniqueId:c,handleDateChange:Y,handleVersionChange:X,handleCategoryChange:J,handleChangeChange:W,handleAddChangeItem:K,handleRemoveChangeItem:ee,handleRemoveVersion:te,setAttributes:l,isProChangeloger:d})))),re&&(0,n.createElement)("div",{className:"changeloger-version-list-container changeloger-version-list-position-right"},(0,n.createElement)("h6",{className:"version-title"},"Versions"),(0,n.createElement)(x,{versions:oe,uniqueId:c}))),(0,n.createElement)(O,{enablePagination:A,paginationType:v,paginationLoadMoreText:S,paginationTextColor:L,paginationBgColor:V,setAttributes:l,isProChangeloger:d})),(0,n.createElement)(u,{...e}),(0,n.createElement)(y,{...e}),(0,n.createElement)(N,{...e}))},save:function(e){const{uniqueId:t,customLinks:a,newTagColor:o,versionName:r,fixedTagColor:c,paginationType:i,updateTagColor:h,tweakedTagColor:p,enablePagination:u,paginationBgColor:E,improvementTagColor:C,paginationTextColor:v,customLogTypeColors:f,paginationLoadMoreText:b,paginationActiveBgColor:_,paginationActiveTextColor:w,paginationHoverBgColor:y,paginationHoverTextColor:N,enableFilter:T,enableVersions:D,versionsPosition:A,perPage:P,enableSearch:V,changelogLayout:F,filterPosition:L,enableSubscription:I,subscriptionProductName:S,emailEndingMessage:B,searchPlaceholder:H}=e.attributes,M=s.useBlockProps.save({className:"changeloger-container",style:{"--changeloger-pagination-text-color":v,"--changeloger-pagination-bg-color":E,"--changeloger-pagination-active-text-color":w,"--changeloger-pagination-active-bg-color":_,"--changeloger-pagination-hover-text-color":N,"--changeloger-pagination-hover-bg-color":y,"--changeloger-improvement-tag-bg-color":C,"--changeloger-new-tag-bg-color":o,"--changeloger-update-tag-bg-color":h,"--changeloger-fixed-tag-bg-color":c,"--changeloger-tweaked-tag-bg-color":p}}),O=new g(e.attributes.changelog);let R=O.parse();!d&&R.length>20&&(R=R.slice(0,20));const U=O.getVersions(),$=D&&"left"===A,j=D&&"right"===A;return(0,n.createElement)("div",{...M,id:t},V&&d&&(0,n.createElement)("div",{className:"changelog_form_inner"},(0,n.createElement)("div",{className:"changelog_form_group"},(0,n.createElement)("input",{type:"search","data-searchTarget":t,className:"changelog-search-control changelog_form_control noEnterSubmit",placeholder:H||"Search your changelog...",checked:V})),(0,n.createElement)("span",{id:"changelog-search-help-block",className:"help-block"})),d&&(I||T)&&(0,n.createElement)("div",{className:`changeloger-action-alignment align-${L}`},I&&(0,n.createElement)("div",{className:"cha-subscription-button-container","data-product-name":S,"data-ending-message":B,"data-block-id":t}),T&&(0,n.createElement)(k,{...e,parsedChangelog:R})),(0,n.createElement)("div",{className:"changelog-wrapper"},$&&(0,n.createElement)("div",{className:"changeloger-version-list-container changeloger-version-list-position-left"},(0,n.createElement)("h6",{className:"version-title"},"Versions"),(0,n.createElement)(x,{versions:U,uniqueId:t})),(0,n.createElement)("span",{"data-changeloger-content":"start"}),(0,n.createElement)("div",{className:"changeloger-info-inner-wrapper"},(0,n.createElement)("div",{className:"changeloger-items"},R&&R.length>0?R.map(e=>{const{date:o,version:c,changes:i}=e,g=(0,m.get)(a,c,[]),h=[...new Set(i.map(e=>e.category.toLowerCase()))];return(0,n.createElement)("div",{key:e.version,id:t+"-"+e.version,className:"changelog-info-item","data-filter":h.join(" ")},(0,n.createElement)("div",{className:"date"},(0,n.createElement)("span",null,o),r&&r[c]&&(0,n.createElement)(s.RichText.Content,{tagName:"span",className:"changeloger-version-name",placeholder:(0,l.__)("Version Name","changeloger"),value:r[c]})),(0,n.createElement)("div",{className:"version"},(0,n.createElement)("span",{className:"version-tag"},c),(0,n.createElement)("span",{className:"line"})),(0,n.createElement)("div",{className:"content"},"grouped"===F&&d?function(e){const t={};return e.forEach(e=>{const a=e.category.toLowerCase();t[a]||(t[a]={category:e.category,changes:[]}),t[a].changes.push(e)}),Object.values(t)}(i).map(e=>{const t=e.category.toLowerCase(),a=(0,m.has)(f,t);return(0,n.createElement)("div",{key:t,className:"changelog-category-group"},(0,n.createElement)("span",{style:a?{backgroundColor:(0,m.get)(f,t)}:{},className:`tag ${t.toLowerCase().replace(/\s/g,"-")}`},e.category),(0,n.createElement)("ul",{className:"changelog-items-list"},e.changes.map((e,t)=>(0,n.createElement)("li",{key:t,className:"change"},e.change))))}):i.map(e=>{const t=e.category.toLowerCase(),a=(0,m.has)(f,t);return(0,n.createElement)("p",null,(0,n.createElement)("span",{style:a?{backgroundColor:(0,m.get)(f,t)}:{},className:`tag ${t.toLowerCase().replace(/\s/g,"-")}`},e.category),(0,n.createElement)("span",{className:"change"},e.change))}),g&&g.length>0&&(0,n.createElement)("div",{className:"changeloger-link-wrapper"},g.map(e=>(0,n.createElement)("a",{href:e.link,className:"changeloger-custom-link",target:"_blank"},e.icon&&(0,n.createElement)("span",{className:"changeloger-custom-link-icon",style:{WebkitMaskImage:`url(${e.icon})`}}),e.name)))))}):(0,n.createElement)("p",null,(0,l.__)("No changelog data available","changeloger")))),(0,n.createElement)("span",{"data-changeloger-content":"end"}),j&&(0,n.createElement)("div",{className:"changeloger-version-list-container changeloger-version-list-position-right"},(0,n.createElement)("h6",{className:"version-title"},"Versions"),(0,n.createElement)("span",{"data-changeloger-version":"start"}),(0,n.createElement)(x,{versions:U,uniqueId:t}),(0,n.createElement)("span",{"data-changeloger-version":"end"}))),u&&d&&(0,n.createElement)("div",{className:"changeloger-pagination-wrapper","data-per-page":P},"load-more"===i&&(0,n.createElement)("div",{className:"wp-block-button"},(0,n.createElement)(s.RichText.Content,{tagName:"button",style:{color:v,backgroundColor:E},className:"changeloger-pagination-button wp-block-button__link wp-element-button",value:b})),"numbered"===i&&d&&(0,n.createElement)("div",{className:"changeloger-pagination-inner-wrapper"},(0,n.createElement)("span",{className:"changeloger-prev-button page-navigator"},"« Previous"),(0,n.createElement)("span",{className:"page-numbers current"},"1"),(0,n.createElement)("span",{className:"page-numbers"},"2"),(0,n.createElement)("span",{className:"page-numbers"},"3"),(0,n.createElement)("span",{className:"changeloger-next-button page-navigator"},"Next »"))))},deprecated:[{attributes:{changelog:{type:"string",default:""},enablePagination:{type:"boolean",default:!1},paginationLoadMoreText:{type:"string",default:"Load More"},perPage:{type:"number",default:10},paginationType:{type:"string",default:"load-more"},showPlaceholder:{type:"boolean",default:!0},showTextArea:{type:"boolean",default:!1},paginationTextColor:{type:"string",default:"#ffffff"},paginationBgColor:{type:"string",default:"#000000"},paginationActiveTextColor:{type:"string",default:"#000000"},paginationActiveBgColor:{type:"string",default:"#f5f5f5"},paginationHoverTextColor:{type:"string",default:"#ffffff"},paginationHoverBgColor:{type:"string",default:"#333333"},customLogTypeColors:{type:"object",default:{}},customLinks:{type:"object",default:{}},versionName:{type:"object",default:{}},enableVersions:{type:"boolean",default:!1},versionsPosition:{type:"string",default:"right"},enableFilter:{type:"boolean",default:!1},filterPosition:{type:"string",default:"right"},enableSearch:{type:"boolean",default:!1},changelogLayout:{type:"string",default:"individual"},enableSubscription:{type:"boolean",default:!1},subscriptionProductName:{type:"string",default:""},emailEndingMessage:{type:"string",default:""}},isValid:()=>!1,migrate:e=>({...e,uniqueId:e.uniqueId||`changeloger-${Date.now()}`,searchPlaceholder:e.searchPlaceholder||"Search your changelog...",textUrl:e.textUrl||""}),save:function(e){const{uniqueId:t,customLinks:a,newTagColor:o,versionName:r,fixedTagColor:c,paginationType:i,updateTagColor:h,tweakedTagColor:p,enablePagination:u,paginationBgColor:E,improvementTagColor:C,paginationTextColor:v,customLogTypeColors:f,paginationLoadMoreText:b,paginationActiveBgColor:_,paginationActiveTextColor:w,paginationHoverBgColor:y,paginationHoverTextColor:N,enableFilter:T,enableVersions:D,versionsPosition:A,perPage:P,enableSearch:V,changelogLayout:F,filterPosition:L,enableSubscription:I,subscriptionProductName:S,emailEndingMessage:B,searchPlaceholder:H}=e.attributes,M=s.useBlockProps.save({className:"changeloger-container",style:{"--changeloger-pagination-text-color":v,"--changeloger-pagination-bg-color":E,"--changeloger-pagination-active-text-color":w,"--changeloger-pagination-active-bg-color":_,"--changeloger-pagination-hover-text-color":N,"--changeloger-pagination-hover-bg-color":y,"--changeloger-improvement-tag-bg-color":C,"--changeloger-new-tag-bg-color":o,"--changeloger-update-tag-bg-color":h,"--changeloger-fixed-tag-bg-color":c,"--changeloger-tweaked-tag-bg-color":p}}),O=new g(e.attributes.changelog),R=O.parse(),U=O.getVersions(),$=D&&"left"===A,j=D&&"right"===A;return(0,n.createElement)("div",{...M,id:t},V&&d&&(0,n.createElement)("div",{className:"changelog_form_inner"},(0,n.createElement)("div",{className:"changelog_form_group"},(0,n.createElement)("input",{type:"search","data-searchTarget":t,className:"changelog-search-control changelog_form_control noEnterSubmit",placeholder:"Search your changelog...",checked:V})),(0,n.createElement)("span",{id:"changelog-search-help-block",className:"help-block"})),T&&d&&(0,n.createElement)(k,{...e,parsedChangelog:R}),(0,n.createElement)("div",{className:"changelog-wrapper"},$&&(0,n.createElement)("div",{className:"changeloger-version-list-container changeloger-version-list-position-left"},(0,n.createElement)("h6",{className:"version-title"},"Versions"),(0,n.createElement)(x,{versions:U,uniqueId:t})),(0,n.createElement)("span",{"data-changeloger-content":"start"}),(0,n.createElement)("div",{className:"changeloger-info-inner-wrapper"},(0,n.createElement)("div",{className:"changeloger-items"},R.map(e=>{const{date:o,version:c,changes:i}=e,g=(0,m.get)(a,c,[]),h=[...new Set(i.map(e=>e.category.toLowerCase()))];return(0,n.createElement)("div",{key:e.version,id:t+"-"+e.version,className:"changelog-info-item","data-filter":h.join(" ")},(0,n.createElement)("div",{className:"date"},(0,n.createElement)("span",null,o),(0,n.createElement)(s.RichText.Content,{tagName:"span",className:"changeloger-version-name",placeholder:(0,l.__)("Version Name","changeloger"),value:r[c]})),(0,n.createElement)("div",{className:"version"},(0,n.createElement)("span",{className:"version-tag"},c),(0,n.createElement)("span",{className:"line"})),(0,n.createElement)("div",{className:"content"},"grouped"===F&&d?function(e){const t={};return e.forEach(e=>{const a=e.category.toLowerCase();t[a]||(t[a]={category:e.category,changes:[]}),t[a].changes.push(e)}),Object.values(t)}(i).map(e=>{const t=e.category.toLowerCase(),a=(0,m.has)(f,t);return(0,n.createElement)("div",{key:t,className:"changelog-category-group"},(0,n.createElement)("span",{style:a?{backgroundColor:(0,m.get)(f,t)}:{},className:`tag ${t.toLowerCase().replace(/\s/g,"-")}`},e.category),(0,n.createElement)("ul",{className:"changelog-items-list"},e.changes.map((e,t)=>(0,n.createElement)("li",{key:t,className:"change"},e.change))))}):i.map(e=>{const t=e.category.toLowerCase(),a=(0,m.has)(f,t);return(0,n.createElement)("p",null,(0,n.createElement)("span",{style:a?{backgroundColor:(0,m.get)(f,t)}:{},className:`tag ${t.toLowerCase().replace(/\s/g,"-")}`},e.category),(0,n.createElement)("span",{className:"change"},e.change))}),(0,n.createElement)("div",{className:"changeloger-link-wrapper"},g.map(e=>(0,n.createElement)("a",{href:e.link,className:"changeloger-custom-link",target:"_blank"},e.icon&&(0,n.createElement)("span",{className:"changeloger-custom-link-icon",style:{WebkitMaskImage:`url(${e.icon})`}}),e.name)))))}))),(0,n.createElement)("span",{"data-changeloger-content":"end"}),j&&(0,n.createElement)("div",{className:"changeloger-version-list-container changeloger-version-list-position-right"},(0,n.createElement)("h6",{className:"version-title"},"Versions"),(0,n.createElement)(x,{versions:U,uniqueId:t}))),u&&d&&(0,n.createElement)("div",{className:"changeloger-pagination-wrapper","data-per-page":P},"load-more"===i&&(0,n.createElement)("div",{className:"wp-block-button"},(0,n.createElement)(s.RichText.Content,{tagName:"button",style:{color:v,backgroundColor:E},className:"changeloger-pagination-button wp-block-button__link wp-element-button",value:b})),"numbered"===i&&d&&(0,n.createElement)("div",{className:"changeloger-pagination-inner-wrapper"},(0,n.createElement)("span",{className:"changeloger-prev-button page-navigator"},"« Previous"),(0,n.createElement)("span",{className:"page-numbers current"},"1"),(0,n.createElement)("span",{className:"page-numbers"},"2"),(0,n.createElement)("span",{className:"page-numbers"},"3"),(0,n.createElement)("span",{className:"changeloger-next-button page-navigator"},"Next »"))))}}]})},609:e=>{e.exports=window.React},848:(e,t,a)=>{e.exports=a(20)}},a={};function n(e){var o=a[e];if(void 0!==o)return o.exports;var l=a[e]={exports:{}};return t[e](l,l.exports,n),l.exports}n.m=t,e=[],n.O=(t,a,o,l)=>{if(!a){var r=1/0;for(g=0;g<e.length;g++){for(var[a,o,l]=e[g],s=!0,c=0;c<a.length;c++)(!1&l||r>=l)&&Object.keys(n.O).every(e=>n.O[e](a[c]))?a.splice(c--,1):(s=!1,l<r&&(r=l));if(s){e.splice(g--,1);var i=o();void 0!==i&&(t=i)}}return t}l=l||0;for(var g=e.length;g>0&&e[g-1][2]>l;g--)e[g]=e[g-1];e[g]=[a,o,l]},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={391:0,423:0};n.O.j=t=>0===e[t];var t=(t,a)=>{var o,l,[r,s,c]=a,i=0;if(r.some(t=>0!==e[t])){for(o in s)n.o(s,o)&&(n.m[o]=s[o]);if(c)var g=c(n)}for(t&&t(a);i<r.length;i++)l=r[i],n.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return n.O(g)},a=globalThis.webpackChunkchangeloger=globalThis.webpackChunkchangeloger||[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))})();var o=n.O(void 0,[423],()=>n(221));o=n.O(o)})();
     2//# sourceMappingURL=index.js.map
  • changeloger/trunk/build/tabbed-changeloger/index.asset.php

    r3419755 r3443916  
    1 <?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '68323e1fbdc65f19d2aa');
     1<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '6a7a727904e6567b9f53');
  • changeloger/trunk/build/tabbed-changeloger/index.js

    r3419755 r3443916  
    1 (()=>{"use strict";var e,t={20:(e,t,o)=>{var l=o(609),r=Symbol.for("react.element"),n=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),a=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,o){var l,c={},p=null,i=null;for(l in void 0!==o&&(p=""+o),void 0!==t.key&&(p=""+t.key),void 0!==t.ref&&(i=t.ref),t)n.call(t,l)&&!s.hasOwnProperty(l)&&(c[l]=t[l]);if(e&&e.defaultProps)for(l in t=e.defaultProps)void 0===c[l]&&(c[l]=t[l]);return{$$typeof:r,type:e,key:p,ref:i,props:c,_owner:a.current}}},609:e=>{e.exports=window.React},848:(e,t,o)=>{e.exports=o(20)},860:(e,t,o)=>{var l=o(609);const r=window.wp.blocks,n=window.wp.blockEditor,a=window.wp.element,s=window.wp.components,c=window.wp.primitives;var p=o(848);const i=(0,p.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,p.jsx)(c.Path,{d:"M13 5.5H4V4h9v1.5Zm7 7H4V11h16v1.5Zm-7 7H4V18h9v1.5Z"})}),f=(0,p.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,p.jsx)(c.Path,{d:"M7.5 5.5h9V4h-9v1.5Zm-3.5 7h16V11H4v1.5Zm3.5 7h9V18h-9v1.5Z"})}),m=(0,p.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,p.jsx)(c.Path,{d:"M11.111 5.5H20V4h-8.889v1.5ZM4 12.5h16V11H4v1.5Zm7.111 7H20V18h-8.889v1.5Z"})}),E=(0,p.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,p.jsx)(c.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})}),D=(0,p.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,p.jsx)(c.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})}),d=window.wp.i18n,h=JSON.parse('{"UU":"cha/tabbed-changeloger"}');(0,r.registerBlockType)(h.UU,{icon:{src:(0,l.createElement)("svg",{width:"20",height:"20",viewBox:"0 0 77 77",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)("path",{d:"M70.9 76.2455H5.34545C2.3939 76.2455 0 73.8516 0 70.9V5.34545C0 2.3939 2.3939 0 5.34545 0H70.9C73.8516 0 76.2455 2.3939 76.2455 5.34545V70.9C76.2455 73.8516 73.8516 76.2455 70.9 76.2455Z",fill:"#29235C"}),(0,l.createElement)("path",{d:"M44.0745 14.8029H28.1813C27.8623 14.8029 27.6011 14.5442 27.6011 14.2227V12.3437C27.6011 12.0247 27.8598 11.7635 28.1813 11.7635H44.0745C44.3935 11.7635 44.6548 12.0222 44.6548 12.3437V14.2227C44.6523 14.5442 44.3935 14.8029 44.0745 14.8029Z",fill:"url(#paint0_linear_1355_1437)"}),(0,l.createElement)("path",{d:"M66.8228 21.1105H28.1813C27.8623 21.1105 27.6011 20.8518 27.6011 20.5303V18.6513C27.6011 18.3323 27.8598 18.071 28.1813 18.071H66.8228C67.1418 18.071 67.4031 18.3298 67.4031 18.6513V20.5303C67.4005 20.8493 67.1418 21.1105 66.8228 21.1105Z",fill:"url(#paint1_linear_1355_1437)"}),(0,l.createElement)("path",{d:"M61.1659 27.4155H28.1813C27.8623 27.4155 27.6011 27.1567 27.6011 26.8352V24.9563C27.6011 24.6373 27.8598 24.376 28.1813 24.376H61.1659C61.4849 24.376 61.7461 24.6347 61.7461 24.9563V26.8352C61.7461 27.1567 61.4874 27.4155 61.1659 27.4155Z",fill:"url(#paint2_linear_1355_1437)"}),(0,l.createElement)("path",{d:"M55.5542 33.7206H28.1813C27.8623 33.7206 27.6011 33.4618 27.6011 33.1403V31.2614C27.6011 30.9423 27.8598 30.6811 28.1813 30.6811H55.5542C55.8732 30.6811 56.1344 30.9398 56.1344 31.2614V33.1403C56.1344 33.4618 55.8757 33.7206 55.5542 33.7206Z",fill:"url(#paint3_linear_1355_1437)"}),(0,l.createElement)("path",{d:"M44.0745 45.562H28.1813C27.8623 45.562 27.6011 45.3032 27.6011 44.9817V43.1028C27.6011 42.7837 27.8598 42.5225 28.1813 42.5225H44.0745C44.3935 42.5225 44.6548 42.7812 44.6548 43.1028V44.9817C44.6523 45.3007 44.3935 45.562 44.0745 45.562Z",fill:"url(#paint4_linear_1355_1437)"}),(0,l.createElement)("path",{d:"M66.8228 51.867H28.1813C27.8623 51.867 27.6011 51.6083 27.6011 51.2868V49.4078C27.6011 49.0888 27.8598 48.8275 28.1813 48.8275H66.8228C67.1418 48.8275 67.4031 49.0863 67.4031 49.4078V51.2868C67.4005 51.6083 67.1418 51.867 66.8228 51.867Z",fill:"url(#paint5_linear_1355_1437)"}),(0,l.createElement)("path",{d:"M61.1659 58.1721H28.1813C27.8623 58.1721 27.6011 57.9134 27.6011 57.5918V55.7129C27.6011 55.3939 27.8598 55.1326 28.1813 55.1326H61.1659C61.4849 55.1326 61.7461 55.3914 61.7461 55.7129V57.5918C61.7461 57.9134 61.4874 58.1721 61.1659 58.1721Z",fill:"url(#paint6_linear_1355_1437)"}),(0,l.createElement)("path",{d:"M55.5542 64.4771H28.1813C27.8623 64.4771 27.6011 64.2183 27.6011 63.8968V62.0179C27.6011 61.6988 27.8598 61.4376 28.1813 61.4376H55.5542C55.8732 61.4376 56.1344 61.6963 56.1344 62.0179V63.8968C56.1344 64.2183 55.8757 64.4771 55.5542 64.4771Z",fill:"url(#paint7_linear_1355_1437)"}),(0,l.createElement)("path",{d:"M9.6586 11.766H23.6778C24.1275 11.766 24.4917 12.1302 24.4917 12.5798V14.5166C24.4917 14.9662 24.1275 15.3304 23.6778 15.3304H9.6586C9.20896 15.3304 8.84473 14.9662 8.84473 14.5166V12.5798C8.84473 12.1327 9.20896 11.766 9.6586 11.766Z",fill:"#DADADA"}),(0,l.createElement)("path",{d:"M13.2108 16.9808H24.0273C24.2835 16.9808 24.492 17.1893 24.492 17.4455V18.6965C24.492 18.9527 24.2835 19.1612 24.0273 19.1612H13.2108C12.9546 19.1612 12.7461 18.9527 12.7461 18.6965V17.4455C12.7461 17.1893 12.9546 16.9808 13.2108 16.9808Z",fill:"#DADADA"}),(0,l.createElement)("path",{d:"M9.6586 42.525H23.6778C24.1275 42.525 24.4917 42.8892 24.4917 43.3388V45.2756C24.4917 45.7252 24.1275 46.0894 23.6778 46.0894H9.6586C9.20896 46.0894 8.84473 45.7252 8.84473 45.2756V43.3388C8.84473 42.8892 9.20896 42.525 9.6586 42.525Z",fill:"#DADADA"}),(0,l.createElement)("path",{d:"M13.2108 47.7399H24.0273C24.2835 47.7399 24.492 47.9484 24.492 48.2046V49.4556C24.492 49.7118 24.2835 49.9203 24.0273 49.9203H13.2108C12.9546 49.9203 12.7461 49.7118 12.7461 49.4556V48.2046C12.7461 47.9484 12.9546 47.7399 13.2108 47.7399Z",fill:"#DADADA"}),(0,l.createElement)("defs",null,(0,l.createElement)("linearGradient",{id:"paint0_linear_1355_1437",x1:"27.6018",y1:"13.2854",x2:"44.6527",y2:"13.2854",gradientUnits:"userSpaceOnUse"},(0,l.createElement)("stop",{"stop-color":"#DADADA"}),(0,l.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,l.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,l.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,l.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,l.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,l.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,l.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,l.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,l.createElement)("linearGradient",{id:"paint1_linear_1355_1437",x1:"27.6018",y1:"19.5913",x2:"67.4014",y2:"19.5913",gradientUnits:"userSpaceOnUse"},(0,l.createElement)("stop",{"stop-color":"#DADADA"}),(0,l.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,l.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,l.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,l.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,l.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,l.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,l.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,l.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,l.createElement)("linearGradient",{id:"paint2_linear_1355_1437",x1:"27.6018",y1:"25.8971",x2:"61.7464",y2:"25.8971",gradientUnits:"userSpaceOnUse"},(0,l.createElement)("stop",{"stop-color":"#DADADA"}),(0,l.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,l.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,l.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,l.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,l.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,l.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,l.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,l.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,l.createElement)("linearGradient",{id:"paint3_linear_1355_1437",x1:"27.6018",y1:"32.203",x2:"56.1342",y2:"32.203",gradientUnits:"userSpaceOnUse"},(0,l.createElement)("stop",{"stop-color":"#DADADA"}),(0,l.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,l.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,l.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,l.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,l.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,l.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,l.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,l.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,l.createElement)("linearGradient",{id:"paint4_linear_1355_1437",x1:"27.6018",y1:"44.0424",x2:"44.6527",y2:"44.0424",gradientUnits:"userSpaceOnUse"},(0,l.createElement)("stop",{"stop-color":"#DADADA"}),(0,l.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,l.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,l.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,l.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,l.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,l.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,l.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,l.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,l.createElement)("linearGradient",{id:"paint5_linear_1355_1437",x1:"27.6018",y1:"50.3483",x2:"67.4014",y2:"50.3483",gradientUnits:"userSpaceOnUse"},(0,l.createElement)("stop",{"stop-color":"#DADADA"}),(0,l.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,l.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,l.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,l.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,l.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,l.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,l.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,l.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,l.createElement)("linearGradient",{id:"paint6_linear_1355_1437",x1:"27.6018",y1:"56.6542",x2:"61.7464",y2:"56.6542",gradientUnits:"userSpaceOnUse"},(0,l.createElement)("stop",{"stop-color":"#DADADA"}),(0,l.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,l.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,l.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,l.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,l.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,l.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,l.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,l.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,l.createElement)("linearGradient",{id:"paint7_linear_1355_1437",x1:"27.6018",y1:"62.96",x2:"56.1342",y2:"62.96",gradientUnits:"userSpaceOnUse"},(0,l.createElement)("stop",{"stop-color":"#DADADA"}),(0,l.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,l.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,l.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,l.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,l.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,l.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,l.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,l.createElement)("stop",{offset:"1","stop-color":"#DADADA"}))))},edit:function({attributes:e,setAttributes:t,clientId:o}){const{activeTab:r,tabs:c,tabAlignment:p}=e,[h,g]=(0,a.useState)(r||0);(0,a.useEffect)(()=>{c&&0!==c.length||t({tabs:[{title:"Tab 1",id:"tab-1"}]})},[]),(0,a.useEffect)(()=>{t({activeTab:h})},[h]);const C=c.map(()=>["cha/changeloger",{}]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(n.InspectorControls,null,(0,l.createElement)(s.PanelBody,{title:"Tab Settings",initialOpen:!0},(0,l.createElement)("div",{style:{marginBottom:"16px"}},(0,l.createElement)(s.__experimentalToggleGroupControl,{isBlock:!0,value:p,onChange:e=>{t({tabAlignment:e})},label:(0,d.__)("Tab Alignment","changeloger")},(0,l.createElement)(s.__experimentalToggleGroupControlOptionIcon,{value:"left",icon:i,label:"Align Left"}),(0,l.createElement)(s.__experimentalToggleGroupControlOptionIcon,{value:"center",icon:f,label:"Align Center"}),(0,l.createElement)(s.__experimentalToggleGroupControlOptionIcon,{value:"right",icon:m,label:"Align Right"}))))),(0,l.createElement)("div",{...(0,n.useBlockProps)()},(0,l.createElement)("div",{className:"changeloger-tabs-editor"},(0,l.createElement)("div",{className:`tabs-header ${(()=>{switch(p){case"center":return"center-aligned";case"right":return"right-aligned";default:return"left-aligned"}})()}`},c.map((e,o)=>(0,l.createElement)("div",{key:e.id,className:"tab-item"},(0,l.createElement)("button",{className:"tab-button "+(h===o?"active":""),onClick:()=>(e=>{g(e)})(o),type:"button"},(0,l.createElement)("span",{className:"tab-title"},e.title),c.length>1&&(0,l.createElement)(s.Button,{icon:E,onClick:e=>((e,o)=>{if(o.stopPropagation(),c.length<=1)return;const l=c[e].title||`Tab ${e+1}`;if(!window.confirm(`Are you sure you want to delete the '${l}' tab?`))return;const r=c.filter((t,o)=>o!==e);t({tabs:r}),h>=r.length?g(r.length-1):h===e&&g(0)})(o,e),className:"remove-tab-button-inline",isDestructive:!0,size:"small",title:"Remove Tab"})),(0,l.createElement)("div",{className:"tab-controls"},(0,l.createElement)(s.TextControl,{value:e.title,onChange:e=>((e,o)=>{const l=[...c];l[e]={...l[e],title:o},t({tabs:l})})(o,e),className:"tab-title-input",placeholder:"Tab Title"})))),(0,l.createElement)(s.Button,{icon:D,onClick:()=>{const e=c.length+1,o={title:`Tab ${e}`,id:`tab-${e}-${Date.now()}`},l=[...c,o];t({tabs:l}),g(l.length-1)},className:"add-tab-button",variant:"secondary",size:"small",title:"Add New Tab"},"Add Tab")),(0,l.createElement)("div",{className:"tabs-content"},(0,l.createElement)(n.InnerBlocks,{allowedBlocks:["cha/changeloger"],template:C,templateLock:"all",renderAppender:!1})),(0,l.createElement)("style",null,`\n\t\t\t\t\t\t\t.changeloger-tabs-editor .tabs-content .wp-block-cha-changeloger {\n\t\t\t\t\t\t\t\tdisplay: none;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t.changeloger-tabs-editor .tabs-content .wp-block-cha-changeloger:nth-child(${h+1}) {\n\t\t\t\t\t\t\t\tdisplay: block;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t`))))},save:function({attributes:e}){const{activeTab:t,tabs:o,tabAlignment:r}=e;return(0,l.createElement)("div",{...n.useBlockProps.save()},(0,l.createElement)("div",{className:"changeloger-tabs-frontend","data-active-tab":t||0},(0,l.createElement)("div",{className:`tabs-header ${(()=>{switch(r){case"center":return"center-aligned";case"right":return"right-aligned";default:return"left-aligned"}})()}`},o&&o.map((e,o)=>(0,l.createElement)("button",{key:e.id,className:"tab-button "+(o===(t||0)?"active":""),"data-tab-index":o,type:"button"},e.title))),(0,l.createElement)("div",{className:"tabs-content"},(0,l.createElement)(n.InnerBlocks.Content,null))))}})}},o={};function l(e){var r=o[e];if(void 0!==r)return r.exports;var n=o[e]={exports:{}};return t[e](n,n.exports,l),n.exports}l.m=t,e=[],l.O=(t,o,r,n)=>{if(!o){var a=1/0;for(i=0;i<e.length;i++){for(var[o,r,n]=e[i],s=!0,c=0;c<o.length;c++)(!1&n||a>=n)&&Object.keys(l.O).every(e=>l.O[e](o[c]))?o.splice(c--,1):(s=!1,n<a&&(a=n));if(s){e.splice(i--,1);var p=r();void 0!==p&&(t=p)}}return t}n=n||0;for(var i=e.length;i>0&&e[i-1][2]>n;i--)e[i]=e[i-1];e[i]=[o,r,n]},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={184:0,264:0};l.O.j=t=>0===e[t];var t=(t,o)=>{var r,n,[a,s,c]=o,p=0;if(a.some(t=>0!==e[t])){for(r in s)l.o(s,r)&&(l.m[r]=s[r]);if(c)var i=c(l)}for(t&&t(o);p<a.length;p++)n=a[p],l.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return l.O(i)},o=globalThis.webpackChunkchangeloger=globalThis.webpackChunkchangeloger||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();var r=l.O(void 0,[264],()=>l(860));r=l.O(r)})();
     1(()=>{"use strict";var e,t={20:(e,t,o)=>{var l=o(609),a=Symbol.for("react.element"),r=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),n=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,o){var l,c={},i=null,p=null;for(l in void 0!==o&&(i=""+o),void 0!==t.key&&(i=""+t.key),void 0!==t.ref&&(p=t.ref),t)r.call(t,l)&&!s.hasOwnProperty(l)&&(c[l]=t[l]);if(e&&e.defaultProps)for(l in t=e.defaultProps)void 0===c[l]&&(c[l]=t[l]);return{$$typeof:a,type:e,key:i,ref:p,props:c,_owner:n.current}}},609:e=>{e.exports=window.React},724:(e,t,o)=>{var l=o(609);const a=window.wp.blocks,r=window.wp.blockEditor,n=window.wp.element,s=window.wp.components,c=window.wp.primitives;var i=o(848);const p=(0,i.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,i.jsx)(c.Path,{d:"M13 5.5H4V4h9v1.5Zm7 7H4V11h16v1.5Zm-7 7H4V18h9v1.5Z"})}),m=(0,i.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,i.jsx)(c.Path,{d:"M7.5 5.5h9V4h-9v1.5Zm-3.5 7h16V11H4v1.5Zm3.5 7h9V18h-9v1.5Z"})}),f=(0,i.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,i.jsx)(c.Path,{d:"M11.111 5.5H20V4h-8.889v1.5ZM4 12.5h16V11H4v1.5Zm7.111 7H20V18h-8.889v1.5Z"})}),E=(0,i.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,i.jsx)(c.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})}),d=(0,i.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,i.jsx)(c.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})}),D=window.wp.i18n,h=JSON.parse('{"UU":"cha/tabbed-changeloger"}');(0,a.registerBlockType)(h.UU,{icon:{src:(0,l.createElement)("svg",{width:"20",height:"20",viewBox:"0 0 77 77",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)("path",{d:"M70.9 76.2455H5.34545C2.3939 76.2455 0 73.8516 0 70.9V5.34545C0 2.3939 2.3939 0 5.34545 0H70.9C73.8516 0 76.2455 2.3939 76.2455 5.34545V70.9C76.2455 73.8516 73.8516 76.2455 70.9 76.2455Z",fill:"#29235C"}),(0,l.createElement)("path",{d:"M44.0745 14.8029H28.1813C27.8623 14.8029 27.6011 14.5442 27.6011 14.2227V12.3437C27.6011 12.0247 27.8598 11.7635 28.1813 11.7635H44.0745C44.3935 11.7635 44.6548 12.0222 44.6548 12.3437V14.2227C44.6523 14.5442 44.3935 14.8029 44.0745 14.8029Z",fill:"url(#paint0_linear_1355_1437)"}),(0,l.createElement)("path",{d:"M66.8228 21.1105H28.1813C27.8623 21.1105 27.6011 20.8518 27.6011 20.5303V18.6513C27.6011 18.3323 27.8598 18.071 28.1813 18.071H66.8228C67.1418 18.071 67.4031 18.3298 67.4031 18.6513V20.5303C67.4005 20.8493 67.1418 21.1105 66.8228 21.1105Z",fill:"url(#paint1_linear_1355_1437)"}),(0,l.createElement)("path",{d:"M61.1659 27.4155H28.1813C27.8623 27.4155 27.6011 27.1567 27.6011 26.8352V24.9563C27.6011 24.6373 27.8598 24.376 28.1813 24.376H61.1659C61.4849 24.376 61.7461 24.6347 61.7461 24.9563V26.8352C61.7461 27.1567 61.4874 27.4155 61.1659 27.4155Z",fill:"url(#paint2_linear_1355_1437)"}),(0,l.createElement)("path",{d:"M55.5542 33.7206H28.1813C27.8623 33.7206 27.6011 33.4618 27.6011 33.1403V31.2614C27.6011 30.9423 27.8598 30.6811 28.1813 30.6811H55.5542C55.8732 30.6811 56.1344 30.9398 56.1344 31.2614V33.1403C56.1344 33.4618 55.8757 33.7206 55.5542 33.7206Z",fill:"url(#paint3_linear_1355_1437)"}),(0,l.createElement)("path",{d:"M44.0745 45.562H28.1813C27.8623 45.562 27.6011 45.3032 27.6011 44.9817V43.1028C27.6011 42.7837 27.8598 42.5225 28.1813 42.5225H44.0745C44.3935 42.5225 44.6548 42.7812 44.6548 43.1028V44.9817C44.6523 45.3007 44.3935 45.562 44.0745 45.562Z",fill:"url(#paint4_linear_1355_1437)"}),(0,l.createElement)("path",{d:"M66.8228 51.867H28.1813C27.8623 51.867 27.6011 51.6083 27.6011 51.2868V49.4078C27.6011 49.0888 27.8598 48.8275 28.1813 48.8275H66.8228C67.1418 48.8275 67.4031 49.0863 67.4031 49.4078V51.2868C67.4005 51.6083 67.1418 51.867 66.8228 51.867Z",fill:"url(#paint5_linear_1355_1437)"}),(0,l.createElement)("path",{d:"M61.1659 58.1721H28.1813C27.8623 58.1721 27.6011 57.9134 27.6011 57.5918V55.7129C27.6011 55.3939 27.8598 55.1326 28.1813 55.1326H61.1659C61.4849 55.1326 61.7461 55.3914 61.7461 55.7129V57.5918C61.7461 57.9134 61.4874 58.1721 61.1659 58.1721Z",fill:"url(#paint6_linear_1355_1437)"}),(0,l.createElement)("path",{d:"M55.5542 64.4771H28.1813C27.8623 64.4771 27.6011 64.2183 27.6011 63.8968V62.0179C27.6011 61.6988 27.8598 61.4376 28.1813 61.4376H55.5542C55.8732 61.4376 56.1344 61.6963 56.1344 62.0179V63.8968C56.1344 64.2183 55.8757 64.4771 55.5542 64.4771Z",fill:"url(#paint7_linear_1355_1437)"}),(0,l.createElement)("path",{d:"M9.6586 11.766H23.6778C24.1275 11.766 24.4917 12.1302 24.4917 12.5798V14.5166C24.4917 14.9662 24.1275 15.3304 23.6778 15.3304H9.6586C9.20896 15.3304 8.84473 14.9662 8.84473 14.5166V12.5798C8.84473 12.1327 9.20896 11.766 9.6586 11.766Z",fill:"#DADADA"}),(0,l.createElement)("path",{d:"M13.2108 16.9808H24.0273C24.2835 16.9808 24.492 17.1893 24.492 17.4455V18.6965C24.492 18.9527 24.2835 19.1612 24.0273 19.1612H13.2108C12.9546 19.1612 12.7461 18.9527 12.7461 18.6965V17.4455C12.7461 17.1893 12.9546 16.9808 13.2108 16.9808Z",fill:"#DADADA"}),(0,l.createElement)("path",{d:"M9.6586 42.525H23.6778C24.1275 42.525 24.4917 42.8892 24.4917 43.3388V45.2756C24.4917 45.7252 24.1275 46.0894 23.6778 46.0894H9.6586C9.20896 46.0894 8.84473 45.7252 8.84473 45.2756V43.3388C8.84473 42.8892 9.20896 42.525 9.6586 42.525Z",fill:"#DADADA"}),(0,l.createElement)("path",{d:"M13.2108 47.7399H24.0273C24.2835 47.7399 24.492 47.9484 24.492 48.2046V49.4556C24.492 49.7118 24.2835 49.9203 24.0273 49.9203H13.2108C12.9546 49.9203 12.7461 49.7118 12.7461 49.4556V48.2046C12.7461 47.9484 12.9546 47.7399 13.2108 47.7399Z",fill:"#DADADA"}),(0,l.createElement)("defs",null,(0,l.createElement)("linearGradient",{id:"paint0_linear_1355_1437",x1:"27.6018",y1:"13.2854",x2:"44.6527",y2:"13.2854",gradientUnits:"userSpaceOnUse"},(0,l.createElement)("stop",{"stop-color":"#DADADA"}),(0,l.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,l.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,l.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,l.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,l.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,l.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,l.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,l.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,l.createElement)("linearGradient",{id:"paint1_linear_1355_1437",x1:"27.6018",y1:"19.5913",x2:"67.4014",y2:"19.5913",gradientUnits:"userSpaceOnUse"},(0,l.createElement)("stop",{"stop-color":"#DADADA"}),(0,l.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,l.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,l.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,l.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,l.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,l.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,l.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,l.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,l.createElement)("linearGradient",{id:"paint2_linear_1355_1437",x1:"27.6018",y1:"25.8971",x2:"61.7464",y2:"25.8971",gradientUnits:"userSpaceOnUse"},(0,l.createElement)("stop",{"stop-color":"#DADADA"}),(0,l.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,l.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,l.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,l.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,l.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,l.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,l.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,l.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,l.createElement)("linearGradient",{id:"paint3_linear_1355_1437",x1:"27.6018",y1:"32.203",x2:"56.1342",y2:"32.203",gradientUnits:"userSpaceOnUse"},(0,l.createElement)("stop",{"stop-color":"#DADADA"}),(0,l.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,l.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,l.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,l.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,l.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,l.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,l.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,l.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,l.createElement)("linearGradient",{id:"paint4_linear_1355_1437",x1:"27.6018",y1:"44.0424",x2:"44.6527",y2:"44.0424",gradientUnits:"userSpaceOnUse"},(0,l.createElement)("stop",{"stop-color":"#DADADA"}),(0,l.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,l.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,l.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,l.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,l.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,l.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,l.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,l.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,l.createElement)("linearGradient",{id:"paint5_linear_1355_1437",x1:"27.6018",y1:"50.3483",x2:"67.4014",y2:"50.3483",gradientUnits:"userSpaceOnUse"},(0,l.createElement)("stop",{"stop-color":"#DADADA"}),(0,l.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,l.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,l.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,l.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,l.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,l.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,l.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,l.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,l.createElement)("linearGradient",{id:"paint6_linear_1355_1437",x1:"27.6018",y1:"56.6542",x2:"61.7464",y2:"56.6542",gradientUnits:"userSpaceOnUse"},(0,l.createElement)("stop",{"stop-color":"#DADADA"}),(0,l.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,l.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,l.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,l.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,l.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,l.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,l.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,l.createElement)("stop",{offset:"1","stop-color":"#DADADA"})),(0,l.createElement)("linearGradient",{id:"paint7_linear_1355_1437",x1:"27.6018",y1:"62.96",x2:"56.1342",y2:"62.96",gradientUnits:"userSpaceOnUse"},(0,l.createElement)("stop",{"stop-color":"#DADADA"}),(0,l.createElement)("stop",{offset:"0.3421","stop-color":"#DCDCDC"}),(0,l.createElement)("stop",{offset:"0.5082","stop-color":"#E4E4E4"}),(0,l.createElement)("stop",{offset:"0.636","stop-color":"#F1F1F1"}),(0,l.createElement)("stop",{offset:"0.7235","stop-color":"white"}),(0,l.createElement)("stop",{offset:"0.7538","stop-color":"#F5F5F5"}),(0,l.createElement)("stop",{offset:"0.8164","stop-color":"#E6E6E6"}),(0,l.createElement)("stop",{offset:"0.8899","stop-color":"#DDDDDD"}),(0,l.createElement)("stop",{offset:"1","stop-color":"#DADADA"}))))},edit:function({attributes:e,setAttributes:t,clientId:o}){const{activeTab:a,tabs:c,tabAlignment:i}=e,[h,u]=(0,n.useState)(a||0);(0,n.useEffect)(()=>{c&&0!==c.length||t({tabs:[{title:"Tab 1",id:"tab-1"}]})},[]),(0,n.useEffect)(()=>{t({activeTab:h})},[h]);const g=c.map(()=>["cha/changeloger",{}]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(r.InspectorControls,null,(0,l.createElement)(s.PanelBody,{title:"Tab Settings",initialOpen:!0},(0,l.createElement)("div",{style:{marginBottom:"16px"}},(0,l.createElement)(s.__experimentalToggleGroupControl,{isBlock:!0,value:i,onChange:e=>{t({tabAlignment:e})},label:(0,D.__)("Tab Alignment","changeloger")},(0,l.createElement)(s.__experimentalToggleGroupControlOptionIcon,{value:"left",icon:p,label:"Align Left"}),(0,l.createElement)(s.__experimentalToggleGroupControlOptionIcon,{value:"center",icon:m,label:"Align Center"}),(0,l.createElement)(s.__experimentalToggleGroupControlOptionIcon,{value:"right",icon:f,label:"Align Right"}))))),(0,l.createElement)("div",{...(0,r.useBlockProps)()},(0,l.createElement)("div",{className:"changeloger-tabs-editor"},(0,l.createElement)("div",{className:`tabs-header ${(()=>{switch(i){case"center":return"center-aligned";case"right":return"right-aligned";default:return"left-aligned"}})()}`},c.map((e,o)=>(0,l.createElement)("div",{key:e.id,className:"tab-item"},(0,l.createElement)("button",{className:"tab-button "+(h===o?"active":""),onClick:()=>(e=>{u(e)})(o),type:"button"},(0,l.createElement)("span",{className:"tab-title"},e.title),c.length>1&&(0,l.createElement)(s.Button,{icon:E,onClick:e=>((e,o)=>{if(o.stopPropagation(),c.length<=1)return;const l=c[e].title||`Tab ${e+1}`;if(!window.confirm(`Are you sure you want to delete the '${l}' tab?`))return;const a=c.filter((t,o)=>o!==e);t({tabs:a}),h>=a.length?u(a.length-1):h===e&&u(0)})(o,e),className:"remove-tab-button-inline",isDestructive:!0,size:"small",title:"Remove Tab"})),(0,l.createElement)("div",{className:"tab-controls"},(0,l.createElement)(s.TextControl,{value:e.title,onChange:e=>((e,o)=>{const l=[...c];l[e]={...l[e],title:o},t({tabs:l})})(o,e),className:"tab-title-input",placeholder:"Tab Title"})))),(0,l.createElement)(s.Button,{icon:d,onClick:()=>{const e=c.length+1,o={title:`Tab ${e}`,id:`tab-${e}-${Date.now()}`},l=[...c,o];t({tabs:l}),u(l.length-1)},className:"add-tab-button",variant:"secondary",size:"small",title:"Add New Tab"},"Add Tab")),(0,l.createElement)("div",{className:"tabs-content"},(0,l.createElement)(r.InnerBlocks,{allowedBlocks:["cha/changeloger"],template:g,templateLock:"all",renderAppender:!1})),(0,l.createElement)("style",null,`\n\t\t\t\t\t\t\t.changeloger-tabs-editor .tabs-content .wp-block-cha-changeloger {\n\t\t\t\t\t\t\t\tdisplay: none;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t.changeloger-tabs-editor .tabs-content .wp-block-cha-changeloger:nth-child(${h+1}) {\n\t\t\t\t\t\t\t\tdisplay: block;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t`))))},save:function({attributes:e}){const{activeTab:t,tabs:o,tabAlignment:a}=e;return(0,l.createElement)("div",{...r.useBlockProps.save()},(0,l.createElement)("div",{className:"changeloger-tabs-frontend","data-active-tab":t||0},(0,l.createElement)("div",{className:`tabs-header ${(()=>{switch(a){case"center":return"center-aligned";case"right":return"right-aligned";default:return"left-aligned"}})()}`},o&&o.map((e,o)=>(0,l.createElement)("button",{key:e.id,className:"tab-button "+(o===(t||0)?"active":""),"data-tab-index":o,type:"button"},e.title))),(0,l.createElement)("div",{className:"tabs-content"},(0,l.createElement)(r.InnerBlocks.Content,null))))},deprecated:[{attributes:{activeTab:{type:"number",default:0},tabs:{type:"array",default:[{title:"Tab 1",id:"tab-1"}]}},isValid:()=>!1,migrate:e=>({...e,tabAlignment:e.tabAlignment||"left"}),save:function({attributes:e}){const{activeTab:t,tabs:o}=e;return(0,l.createElement)("div",{...r.useBlockProps.save()},(0,l.createElement)("div",{className:"changeloger-tabs-frontend","data-active-tab":t||0},(0,l.createElement)("div",{className:"tabs-header"},o&&o.map((e,o)=>(0,l.createElement)("button",{key:e.id,className:"tab-button "+(o===(t||0)?"active":""),"data-tab-index":o,type:"button"},e.title))),(0,l.createElement)("div",{className:"tabs-content"},(0,l.createElement)(r.InnerBlocks.Content,null))))}}]})},848:(e,t,o)=>{e.exports=o(20)}},o={};function l(e){var a=o[e];if(void 0!==a)return a.exports;var r=o[e]={exports:{}};return t[e](r,r.exports,l),r.exports}l.m=t,e=[],l.O=(t,o,a,r)=>{if(!o){var n=1/0;for(p=0;p<e.length;p++){for(var[o,a,r]=e[p],s=!0,c=0;c<o.length;c++)(!1&r||n>=r)&&Object.keys(l.O).every(e=>l.O[e](o[c]))?o.splice(c--,1):(s=!1,r<n&&(n=r));if(s){e.splice(p--,1);var i=a();void 0!==i&&(t=i)}}return t}r=r||0;for(var p=e.length;p>0&&e[p-1][2]>r;p--)e[p]=e[p-1];e[p]=[o,a,r]},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={184:0,264:0};l.O.j=t=>0===e[t];var t=(t,o)=>{var a,r,[n,s,c]=o,i=0;if(n.some(t=>0!==e[t])){for(a in s)l.o(s,a)&&(l.m[a]=s[a]);if(c)var p=c(l)}for(t&&t(o);i<n.length;i++)r=n[i],l.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return l.O(p)},o=globalThis.webpackChunkchangeloger=globalThis.webpackChunkchangeloger||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();var a=l.O(void 0,[264],()=>l(724));a=l.O(a)})();
     2//# sourceMappingURL=index.js.map
  • changeloger/trunk/changeloger.php

    r3419755 r3443916  
    55 * Description: A Gutenberg block to display changelog
    66 * Author: spider-themes
     7 * Author URI: https://spider-themes.net/
    78 * Requires at least: 6.0
    8  * Tested up to: 6.7.2
     9 * Tested up to: 6.9
    910 * Requires PHP: 7.4
    10  * Version: 1.3.0
     11 * Version: 1.4.0
    1112 * License: GPLv2 or later
    1213 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1314 * Text domain: changeloger
    1415 * Domain Path: /languages
    15  *
    16  *
    17  */
    18 if ( !defined( 'ABSPATH' ) ) {
    19     exit;
    20     // Exit if accessed directly.
    21 }
    22 if ( !function_exists( 'cha_fs' ) ) {
     16 */
     17
     18if (! defined('ABSPATH')) {
     19    exit; // Exit if accessed directly.
     20}
     21
     22if (! function_exists('cha_fs')) {
    2323    // Create a helper function for easy SDK access.
    24     function cha_fs() {
     24    function cha_fs()
     25    {
    2526        global $cha_fs;
    26         if ( !isset( $cha_fs ) ) {
     27
     28        if (! isset($cha_fs)) {
    2729            // Include Freemius SDK.
    28             require_once dirname( __FILE__ ) . '/vendor/autoload.php';
    29             $cha_fs = fs_dynamic_init( array(
     30            require_once dirname(__FILE__) . '/vendor/autoload.php';
     31            $cha_fs = fs_dynamic_init(array(
    3032                'id'                  => '18274',
    3133                'slug'                => 'changeloger',
     
    4042                'menu'                => array(
    4143                    'slug'       => 'changeloger',
    42                     'first-path' => 'plugins.php',
     44                    'first-path' => 'admin.php?page=changeloger',
    4345                    'contact'    => false,
    4446                    'support'    => false,
     
    4648                'parallel_activation' => array(
    4749                    'enabled'                  => true,
    48                     'premium_version_basename' => 'changeloger-pro/changeloger.php',
     50                    'premium_version_basename' => 'changeloger-pro/changeloger-pro.php',
    4951                ),
    50                 'is_live'             => true,
    51             ) );
    52         }
     52            ));
     53        }
     54
    5355        return $cha_fs;
    5456    }
     
    5658    // Init Freemius.
    5759    cha_fs();
     60
    5861    // Add filter to hide the Freemius badge from the plugin page.
    59     add_filter( 'hide_freemius_powered_by', '__return_true' );
     62    add_filter('hide_freemius_powered_by', '__return_true');
     63
    6064    // Signal that SDK was initiated.
    61     do_action( 'cha_fs_loaded' );
    62 }
    63 if ( !class_exists( 'CHANGELOGER_BLOCKS_CLASS' ) ) {
    64     final class CHANGELOGER_BLOCKS_CLASS {
     65    do_action('cha_fs_loaded');
     66}
     67
     68/**
     69 * Check if the pro plugin and plan is active
     70 *
     71 * Following EazyDocs pattern: checks both license AND pro class existence
     72 *
     73 * @return bool
     74 */
     75if (! function_exists('cha_is_premium')) {
     76    function cha_is_premium()
     77    {
     78        return function_exists('cha_fs')
     79            && cha_fs()->can_use_premium_code__premium_only()
     80            && class_exists('Changeloger_Pro');
     81    }
     82}
     83
     84if (! class_exists('CHANGELOGER_BLOCKS_CLASS')) {
     85    final class CHANGELOGER_BLOCKS_CLASS
     86    {
    6587        private $enqueue_assets;
    66 
    6788        private $register_blocks;
    6889
     
    7495         * @return void
    7596         */
    76         public function __construct() {
     97        public function __construct()
     98        {
     99            $this->define_constants();
     100
    77101            $this->core_includes();
     102
    78103            $this->register_blocks = new Changeloger_Block_Register();
    79             add_action( 'init', [$this->register_blocks, 'changeloger_create_block_init'] );
     104            add_action('init', [$this->register_blocks, 'changeloger_create_block_init']);
     105
    80106            $this->enqueue_assets = new Changeloger_Block_Assets();
    81107            // Add migration filter for block name change from 'block/changeloger' to 'cha/changeloger'.
    82             add_filter( 'content_save_pre', [$this, 'migrate_block_name'] );
    83             add_filter( 'the_post', [$this, 'migrate_block_name_in_post'] );
    84             add_action( 'init', [$this, 'disable_premium_cron'] );
     108            add_filter('content_save_pre', [$this, 'migrate_block_name']);
     109            add_filter('the_post', [$this, 'migrate_block_name_in_post']);
     110            if (!cha_is_premium()) {
     111                add_action('init', [$this, 'disable_premium_cron']);
     112            }
     113        }
     114
     115        /**
     116         * Define the plugin constants
     117         */
     118        private function define_constants()
     119        {
     120            define('CHANGELOGER_VERSION', '1.4.0');
     121            define('CHANGELOGER_URL', plugin_dir_url(__FILE__));
     122            define('CHANGELOGER_ASSETS', CHANGELOGER_URL . 'assets/');
     123            define('CHANGELOGER_PLUGIN_FILE', __FILE__);
    85124        }
    86125
     
    88127         * Disable premium cron jobs if not on premium version
    89128         */
    90         public function disable_premium_cron() {
    91             $cron_timestamp = wp_next_scheduled( 'cha_daily_version_check' );
    92             if ( $cron_timestamp ) {
    93                 wp_unschedule_event( $cron_timestamp, 'cha_daily_version_check' );
    94                 wp_clear_scheduled_hook( 'cha_daily_version_check' );
     129        public function disable_premium_cron()
     130        {
     131            $cron_timestamp = wp_next_scheduled('cha_daily_version_check');
     132            if ($cron_timestamp) {
     133                wp_unschedule_event($cron_timestamp, 'cha_daily_version_check');
     134                wp_clear_scheduled_hook('cha_daily_version_check');
    95135            }
    96136        }
     
    103143         * @return string The migrated post content.
    104144         */
    105         public function migrate_block_name( $content ) : string {
    106             if ( !is_string( $content ) || empty( $content ) ) {
     145        public function migrate_block_name($content): string
     146        {
     147            if (! is_string($content) || empty($content)) {
    107148                return $content;
    108149            }
     150
    109151            // Replace old block comment with new block name.
    110152            // Pattern: <!-- wp:block/changeloger ... --> becomes <!-- wp:cha/changeloger ... -->
    111             return preg_replace( '/<!-- wp:block\\/changeloger/', '<!-- wp:cha/changeloger', $content );
     153            return preg_replace(
     154                '/<!-- wp:block\/changeloger/',
     155                '<!-- wp:cha/changeloger',
     156                $content
     157            );
    112158        }
    113159
     
    119165         * @return WP_Post The post object with migrated content.
    120166         */
    121         public function migrate_block_name_in_post( $post ) {
    122             if ( !isset( $post->post_content ) || empty( $post->post_content ) ) {
     167        public function migrate_block_name_in_post($post)
     168        {
     169            if (! isset($post->post_content) || empty($post->post_content)) {
    123170                return $post;
    124171            }
     172
    125173            // Apply the same migration to the post_content.
    126             $post->post_content = $this->migrate_block_name( $post->post_content );
     174            $post->post_content = $this->migrate_block_name($post->post_content);
     175
    127176            return $post;
    128177        }
     
    131180         * Initialize the plugin
    132181         */
    133         public static function init() {
     182        public static function init()
     183        {
    134184            static $instance = false;
    135             if ( !$instance ) {
     185            if (! $instance) {
    136186                $instance = new self();
    137187            }
     188
    138189            return $instance;
    139190        }
     
    144195         * @return void
    145196         */
    146         public function core_includes() : void {
     197        public function core_includes(): void
     198        {
    147199            require_once __DIR__ . '/includes/enqueue-assets.php';
    148200            require_once __DIR__ . '/includes/register-blocks.php';
    149201            require_once __DIR__ . '/includes/rest-api.php';
    150202            require_once __DIR__ . '/includes/class-changelog-renderer.php';
     203            require_once __DIR__ . '/includes/post-types.php';
     204            require_once __DIR__ . '/includes/meta.php';
     205            require_once __DIR__ . '/includes/frontend.php';
    151206            require_once __DIR__ . '/admin/class-changeloger-admin.php';
    152         }
    153 
    154     }
    155 
    156 }
     207            require_once __DIR__ . '/includes/class-changeloger-demo-importer.php';
     208
     209            // Load CSF files on after_setup_theme hook (following EazyDocs pattern)
     210            add_action('after_setup_theme', [$this, 'load_csf_files'], 20);
     211
     212            // Remote Notice Integration
     213            require_once __DIR__ . '/includes/class-remote-notice-client.php';
     214
     215            add_action('admin_init', function () {
     216                if (function_exists('cha_is_premium') && cha_is_premium()) {
     217                    Remote_Notice_Client::disable('Changeloger');
     218                    return;
     219                }
     220
     221                Remote_Notice_Client::init('Changeloger', [
     222                    'api_url' => 'https://spider-themes.net/wp-json/html-notice-widget/v1/content/changeloger',
     223                ]);
     224            });
     225        }
     226
     227        /**
     228         * Load CSF framework and settings files
     229         * This must be called on after_setup_theme hook for proper timing
     230         *
     231         * @return void
     232         */
     233        public function load_csf_files(): void
     234        {
     235            // Load CSF Framework (loads setup.class.php which initializes CSF)
     236            if (file_exists(__DIR__ . '/libs/codestar-framework/classes/setup.class.php')) {
     237                require_once __DIR__ . '/libs/codestar-framework/classes/setup.class.php';
     238            }
     239
     240            // Load settings options file (calls CSF::createOptions and CSF::createSection)
     241            require_once __DIR__ . '/includes/options/settings-options.php';
     242        }
     243    }
     244}
     245
    157246/**
    158247 * Plugin activation hook
    159248 */
    160 register_activation_hook( __FILE__, function () {
    161     if ( function_exists( 'cha_schedule_version_check_cron' ) ) {
     249register_activation_hook(__FILE__, function () {
     250    if (function_exists('cha_schedule_version_check_cron')) {
    162251        cha_schedule_version_check_cron();
    163252    }
    164 } );
     253
     254    // Create default feedback categories on activation.
     255    if (class_exists('Changeloger_Post_Types')) {
     256        // First register the taxonomy so we can add terms to it.
     257        Changeloger_Post_Types::register_taxonomies();
     258        Changeloger_Post_Types::create_default_feedback_categories();
     259    }
     260});
     261
    165262/**
    166263 * Plugin deactivation hook
    167264 */
    168 register_deactivation_hook( __FILE__, function () {
    169     if ( function_exists( 'cha_unschedule_version_check_cron' ) ) {
    170         cha_unschedule_version_check_cron();
    171     }
    172 } );
     265register_deactivation_hook(__FILE__, function () {
     266    Remote_Notice_Client::disable( 'Changeloger' );
     267});
     268
    173269/**
    174270 * Kickoff
    175271 */
    176272CHANGELOGER_BLOCKS_CLASS::init();
     273
     274
     275
     276if (! defined('CHANGELOGER_PATH')) {
     277    define('CHANGELOGER_PATH', plugin_dir_path(__FILE__));
     278}
  • changeloger/trunk/includes/class-changelog-renderer.php

    r3419755 r3443916  
    7070        $version      = trim( $version_match[1] );
    7171        $content_rows = array_slice( $rows, 1 );
     72       
     73        // Extract title (## line) and description (** line) if present
     74        $title       = '';
     75        $description = '';
     76        $start_index = 0;
     77       
     78        foreach ( $content_rows as $idx => $row ) {
     79            $trimmed = trim( $row );
     80           
     81            // Check for title: ## title
     82            if ( preg_match( '/^##\s*(.+)$/', $trimmed, $title_match ) ) {
     83                $title = trim( $title_match[1] );
     84                $start_index = $idx + 1;
     85                continue;
     86            }
     87           
     88            // Check for description: ** description ** or **description**
     89            if ( preg_match( '/^\*\*\s*(.+?)\s*\*\*$/', $trimmed, $desc_match ) ) {
     90                $description = trim( $desc_match[1] );
     91                $start_index = $idx + 1;
     92                continue;
     93            }
     94           
     95            // If we hit a change line (has : or starts with - or *), stop looking
     96            if ( strpos( $trimmed, ':' ) !== false || preg_match( '/^[-*]/', $trimmed ) ) {
     97                break;
     98            }
     99        }
     100       
     101        // Get remaining rows for changes
     102        $change_rows = array_slice( $content_rows, $start_index );
    72103
    73104        return [
    74                 'version' => $version,
    75                 'date'    => ! empty( $date_match ) ? $date_match[0] : null,
    76                 'changes' => $this->parse_changes( $content_rows ),
     105                'version'     => $version,
     106                'date'        => ! empty( $date_match ) ? $date_match[0] : null,
     107                'title'       => $title,
     108                'description' => $description,
     109                'changes'     => $this->parse_changes( $change_rows ),
    77110        ];
    78111    }
  • changeloger/trunk/includes/enqueue-assets.php

    r3419755 r3443916  
    11<?php
     2/**
     3 * Changeloger Block Assets
     4 *
     5 * Registers core block assets for the free plugin
     6 *
     7 * @package Changeloger
     8 */
    29
     10if ( ! defined( 'ABSPATH' ) ) {
     11    exit;
     12}
     13
     14/**
     15 * Class Changeloger_Block_Assets
     16 */
    317class Changeloger_Block_Assets {
    4     public function __construct() {
    5         add_action( 'enqueue_block_editor_assets', function () {
    6             wp_register_style(
    7                 'changeloger',
    8                 plugins_url( '/', __FILE__ ) . '../build/changeloger/style-index.css',
    9                 array(),
    10                 'initial'
    11             );
    12             wp_register_style(
    13                 'tabbed-changeloger',
    14                 plugins_url( '/', __FILE__ ) . '../build/tabbed-changeloger/style-index.css',
    15                 array(),
    16                 'initial'
    17             );
    18         } );
    19         add_action( 'enqueue_block_assets', [$this, 'external_libraries'] );
    20     }
    2118
    22     public function external_libraries() : void {
    23         global $post;
    24         wp_register_script(
    25             'tabbed-changeloger-frontend',
    26             plugins_url( '/', __FILE__ ) . '../assets/js/tabbed-frontend.js',
    27             array('jquery'),
    28             uniqid(),
    29             true
    30         );
    31         wp_register_script(
    32             'changeloger-frontend',
    33             plugins_url( '/', __FILE__ ) . '../assets/js/frontend.js',
    34             array('jquery'),
    35             uniqid(),
    36             true
    37         );
    38         $licensing = array(
    39             'can_use_premium_code' => cha_fs()->can_use_premium_code(),
    40         );
    41         wp_localize_script( 'jquery', 'changeloger_local_object', array(
    42             'ajax_url'  => admin_url( 'admin-ajax.php' ),
    43             'nonce'     => wp_create_nonce( 'changeloger_nonce' ),
    44             'licensing' => $licensing['can_use_premium_code'],
    45             'post_id'   => $post->ID ?? 0,
    46         ) );
    47     }
     19    /**
     20     * Constructor
     21     */
     22    public function __construct() {
     23        add_action( 'enqueue_block_editor_assets', [ $this, 'register_editor_assets' ] );
     24        add_action( 'enqueue_block_assets', [ $this, 'register_block_assets' ] );
     25    }
    4826
     27    /**
     28     * Register block editor assets
     29     */
     30    public function register_editor_assets() {
     31        wp_register_style(
     32            'changeloger',
     33            plugins_url( 'build/changeloger/style-index.css', dirname( __FILE__ ) ),
     34            [],
     35            CHANGELOGER_VERSION
     36        );
     37
     38        wp_register_style(
     39            'tabbed-changeloger',
     40            plugins_url( 'build/tabbed-changeloger/style-index.css', dirname( __FILE__ ) ),
     41            [],
     42            CHANGELOGER_VERSION
     43        );
     44    }
     45
     46    /**
     47     * Register frontend block assets
     48     */
     49    public function register_block_assets() {
     50        global $post;
     51
     52        // Tabbed changeloger frontend script
     53        wp_register_script(
     54            'tabbed-changeloger-frontend',
     55            plugins_url( 'assets/js/tabbed-frontend.js', dirname( __FILE__ ) ),
     56            [ 'jquery' ],
     57            CHANGELOGER_VERSION,
     58            true
     59        );
     60
     61        // Changeloger frontend script
     62        wp_register_script(
     63            'changeloger-frontend',
     64            plugins_url( 'assets/js/frontend.js', dirname( __FILE__ ) ),
     65            [ 'jquery' ],
     66            CHANGELOGER_VERSION,
     67            true
     68        );
     69
     70        /**
     71         * Action hook for pro plugin to register additional assets
     72         *
     73         * Pro plugin can hook into this to register:
     74         * - changeloger-filter (filter.js)
     75         * - mark (jquery.mark.min.js)
     76         * - cha-subscription (subscription.css + subscription.js)
     77         */
     78        do_action( 'changeloger_register_block_assets' );
     79
     80        // Localize script with common data
     81        $licensing = [ 'can_use_premium_code__premium_only' => function_exists( 'cha_fs' ) && cha_fs()->can_use_premium_code__premium_only() ];
     82        wp_localize_script( 'jquery', 'changeloger_local_object', [
     83            'ajax_url'  => admin_url( 'admin-ajax.php' ),
     84            'nonce'     => wp_create_nonce( 'changeloger_nonce' ),
     85            'licensing' => $licensing['can_use_premium_code__premium_only'],
     86            'post_id'   => $post->ID ?? 0,
     87        ] );
     88    }
    4989}
     90
     91// Initialize
     92new Changeloger_Block_Assets();
  • changeloger/trunk/includes/register-blocks.php

    r3419755 r3443916  
    2020        wp_register_style('changeloger', plugins_url('/', __FILE__) . '../build/changeloger/style-index.css');
    2121
    22         if (cha_fs()->is__premium_only() &&
     22        if (cha_is_premium() &&
    2323            (
    2424                $attributes['enablePagination'] == '1' ||
     
    2929            wp_enqueue_script('changeloger-filter');
    3030        }
    31         if ($attributes['enableSearch'] == '1'&& cha_fs()->is__premium_only()) {
     31        if ($attributes['enableSearch'] == '1'&& cha_is_premium()) {
    3232            wp_enqueue_script('mark');
    3333        }
    34         if ($attributes['enableSubscription'] == '1' &&  cha_fs()->is__premium_only())  {
     34        if ($attributes['enableSubscription'] == '1' &&  cha_is_premium())  {
    3535            wp_enqueue_script('cha-subscription');
    3636            wp_enqueue_style('cha-subscription');
  • changeloger/trunk/includes/rest-api.php

    r3419755 r3443916  
    11<?php
    2 
     2/**
     3 * Changeloger REST API
     4 *
     5 * Core REST API endpoints for Releases and Products (Free Plugin)
     6 *
     7 * @package Changeloger
     8 */
     9
     10if ( ! defined( 'ABSPATH' ) ) {
     11    exit;
     12}
     13
     14/**
     15 * Class Changeloger_REST_API
     16 */
    317class Changeloger_REST_API {
     18
     19    /**
     20     * Constructor
     21     */
    422    public function __construct() {
    523        add_action( 'rest_api_init', [ $this, 'register_routes' ] );
    624    }
    725
    8 
     26    /**
     27     * Register REST API routes
     28     */
    929    public function register_routes() {
    10         // Track Version Endpoint (Version Tracking & Notification)
    11         register_rest_route( 'changeloger/v1', '/track-version', [
    12             'methods' => 'POST',
    13             'callback' => [ $this, 'track_version_callback' ],
    14             'permission_callback' => [ $this, 'check_edit_posts_nonce' ],
    15         ] );
    16 
    17         // Cron Status Endpoint
    18         register_rest_route( 'changeloger/v1', '/diagnostics/cron-status', [
    19             'methods' => 'GET',
    20             'callback' => [ $this, 'diagnostics_cron_status_callback' ],
     30        // ========== Utility Endpoints ==========
     31        register_rest_route( 'changeloger/v1', '/fetch-txt', [
     32            'methods'             => 'GET',
     33            'callback'            => [ $this, 'fetch_txt_callback' ],
     34            'permission_callback' => '__return_true',
     35        ] );
     36
     37        // Preview URL Endpoint
     38        register_rest_route( 'changeloger/v1', '/preview-url', [
     39            'methods'             => WP_REST_Server::READABLE,
     40            'callback'            => [ $this, 'get_preview_url' ],
    2141            'permission_callback' => [ $this, 'check_manage_options' ],
    22         ] );
    23 
    24         register_rest_route('changeloger/v1', '/fetch-txt', [
    25             'methods' => 'GET',
    26             'callback' => [$this, 'fetch_txt_callback'],
    27             'permission_callback' => '__return_true',
    28         ]);
     42            'args'                => [
     43                'product_id' => [
     44                    'default'           => 0,
     45                    'sanitize_callback' => 'absint',
     46                ],
     47            ],
     48        ] );
     49
     50        // Create Release Page Endpoint
     51        register_rest_route( 'changeloger/v1', '/create-release-page', [
     52            'methods'             => WP_REST_Server::CREATABLE,
     53            'callback'            => [ $this, 'create_release_page' ],
     54            'permission_callback' => [ $this, 'check_manage_options' ],
     55            'args'                => [
     56                'product_id' => [
     57                    'required'          => true,
     58                    'sanitize_callback' => 'absint',
     59                ],
     60                'tab' => [
     61                    'default'           => 'releases',
     62                    'sanitize_callback' => 'sanitize_text_field',
     63                ],
     64            ],
     65        ] );
     66
     67        // ========== Releases API Endpoints ==========
     68        register_rest_route( 'changeloger/v1', '/releases', [
     69            [
     70                'methods'             => WP_REST_Server::READABLE,
     71                'callback'            => [ $this, 'get_releases' ],
     72                'permission_callback' => [ $this, 'check_manage_options' ],
     73                'args'                => [
     74                    'status' => [
     75                        'default'           => 'any',
     76                        'sanitize_callback' => 'sanitize_text_field',
     77                    ],
     78                    'search' => [
     79                        'default'           => '',
     80                        'sanitize_callback' => 'sanitize_text_field',
     81                    ],
     82                    'product' => [
     83                        'default'           => '',
     84                        'sanitize_callback' => 'absint',
     85                    ],
     86                    'per_page' => [
     87                        'default'           => 20,
     88                        'sanitize_callback' => 'absint',
     89                    ],
     90                    'page' => [
     91                        'default'           => 1,
     92                        'sanitize_callback' => 'absint',
     93                    ],
     94                ],
     95            ],
     96            [
     97                'methods'             => WP_REST_Server::CREATABLE,
     98                'callback'            => [ $this, 'create_release' ],
     99                'permission_callback' => [ $this, 'check_manage_options' ],
     100            ],
     101        ] );
     102
     103        register_rest_route( 'changeloger/v1', '/releases/(?P<id>\d+)', [
     104            [
     105                'methods'             => WP_REST_Server::READABLE,
     106                'callback'            => [ $this, 'get_release' ],
     107                'permission_callback' => [ $this, 'check_manage_options' ],
     108            ],
     109            [
     110                'methods'             => WP_REST_Server::EDITABLE,
     111                'callback'            => [ $this, 'update_release' ],
     112                'permission_callback' => [ $this, 'check_manage_options' ],
     113            ],
     114            [
     115                'methods'             => WP_REST_Server::DELETABLE,
     116                'callback'            => [ $this, 'delete_release' ],
     117                'permission_callback' => [ $this, 'check_manage_options' ],
     118            ],
     119        ] );
     120
     121        register_rest_route( 'changeloger/v1', '/releases/stats', [
     122            'methods'             => WP_REST_Server::READABLE,
     123            'callback'            => [ $this, 'get_releases_stats' ],
     124            'permission_callback' => [ $this, 'check_manage_options' ],
     125            'args'                => [
     126                'product' => [
     127                    'default'           => '',
     128                    'sanitize_callback' => 'absint',
     129                ],
     130            ],
     131        ] );
     132
     133        // ========== Products API Endpoints ==========
     134        register_rest_route( 'changeloger/v1', '/products', [
     135            [
     136                'methods'             => WP_REST_Server::READABLE,
     137                'callback'            => [ $this, 'get_products' ],
     138                'permission_callback' => [ $this, 'check_manage_options' ],
     139            ],
     140            [
     141                'methods'             => WP_REST_Server::CREATABLE,
     142                'callback'            => [ $this, 'create_product' ],
     143                'permission_callback' => [ $this, 'check_manage_options' ],
     144            ],
     145        ] );
     146
     147        register_rest_route( 'changeloger/v1', '/products/(?P<id>\d+)', [
     148            [
     149                'methods'             => WP_REST_Server::EDITABLE,
     150                'callback'            => [ $this, 'update_product' ],
     151                'permission_callback' => [ $this, 'check_manage_options' ],
     152            ],
     153            [
     154                'methods'             => WP_REST_Server::DELETABLE,
     155                'callback'            => [ $this, 'delete_product' ],
     156                'permission_callback' => [ $this, 'check_manage_options' ],
     157            ],
     158        ] );
     159
     160        // Import changelog endpoint
     161        register_rest_route( 'changeloger/v1', '/import', [
     162            'methods'             => WP_REST_Server::CREATABLE,
     163            'callback'            => [ $this, 'import_changelog' ],
     164            'permission_callback' => [ $this, 'check_manage_options' ],
     165        ] );
     166
     167        // Demo Import Endpoint
     168        register_rest_route( 'changeloger/v1', '/import-sample', [
     169            'methods'             => WP_REST_Server::CREATABLE,
     170            'callback'            => function() {
     171                if ( class_exists( 'Changeloger_Demo_Importer' ) ) {
     172                    return Changeloger_Demo_Importer::import_demo_data();
     173                }
     174                return new WP_Error( 'class_missing', 'Importer class missing', [ 'status' => 500 ] );
     175            },
     176            'permission_callback' => [ $this, 'check_manage_options' ],
     177        ] );
    29178    }
    30179
    31180    // ========== Permission Callbacks ==========
    32181
    33     public function check_manage_options() {
    34         return current_user_can( 'manage_options' );
    35     }
    36 
    37     public function check_edit_posts_nonce( $request ) {
    38         return current_user_can( 'edit_posts' ) || wp_verify_nonce( $request->get_header( 'X-WP-Nonce' ), 'changeloger_nonce' );
    39     }
    40 
    41     // ========== Track Version Endpoint ==========
    42 
    43     public function track_version_callback( $request ) {
    44         $params = $request->get_json_params();
    45         $post_id = isset( $params['post_id'] ) ? absint( $params['post_id'] ) : 0;
    46         $unique_id = isset( $params['unique_id'] ) ? sanitize_text_field( $params['unique_id'] ) : '';
    47         $parsed_changelog = isset( $params['parsed_changelog'] ) ? $params['parsed_changelog'] : array();
    48         $is_pro = isset( $params['is_pro'] ) ? (bool) $params['is_pro'] : false;
    49         $url = isset( $params['url'] ) ? esc_url_raw( $params['url'] ) : '';
    50 
    51         if ( ! $post_id || ! $unique_id || ! is_array( $parsed_changelog ) ) {
    52             return new WP_REST_Response( [
    53                 'success' => false,
    54                 'message' => __( 'Invalid parameters', 'changeloger' )
    55             ], 400 );
    56         }
    57 
    58         // Check if premium version tracker is available
    59         if ( ! class_exists( 'Changeloger_Version_Tracker' ) ) {
    60             return new WP_REST_Response( [
    61                 'success' => true,
    62                 'message' => __( 'Changelog saved successfully (Premium features not available)', 'changeloger' ),
    63                 'new_version_detected' => false
     182    /**
     183     * Check manage_options capability
     184     */
     185    public function check_manage_options( $request = null ) {
     186        if ( current_user_can( 'manage_options' ) ) {
     187            return true;
     188        }
     189
     190        if ( $request ) {
     191            $nonce = $request->get_header( 'X-WP-Nonce' );
     192            if ( $nonce && wp_verify_nonce( $nonce, 'wp_rest' ) ) {
     193                wp_set_current_user( get_current_user_id() );
     194                return current_user_can( 'manage_options' );
     195            }
     196        }
     197
     198        return false;
     199    }
     200
     201    // ========== Utility Callbacks ==========
     202
     203    /**
     204     * Fetch .txt file content from URL
     205     */
     206    public function fetch_txt_callback( $request ) {
     207        $url = $request->get_param( 'url' );
     208
     209        if ( ! $url ) {
     210            return new WP_Error( 'no_url', 'No URL provided', [ 'status' => 400 ] );
     211        }
     212
     213        $response = wp_remote_get( $url );
     214
     215        if ( is_wp_error( $response ) ) {
     216            return new WP_Error( 'fetch_failed', 'Failed to fetch the file', [ 'status' => 500 ] );
     217        }
     218
     219        $status = wp_remote_retrieve_response_code( $response );
     220        if ( $status !== 200 ) {
     221            return new WP_Error( 'not_found', 'URL returned ' . $status, [ 'status' => 404 ] );
     222        }
     223
     224        $content_type = wp_remote_retrieve_header( $response, 'content-type' );
     225
     226        if ( strpos( $content_type, 'text/plain' ) === false ) {
     227            return new WP_Error( 'invalid_type', 'This is not a .txt file', [ 'status' => 400 ] );
     228        }
     229
     230        $body = wp_remote_retrieve_body( $response );
     231
     232        if ( trim( $body ) === '' ) {
     233            return new WP_Error( 'empty_file', 'The file is empty', [ 'status' => 400 ] );
     234        }
     235
     236        return rest_ensure_response( [ 'content' => $body ] );
     237    }
     238
     239    /**
     240     * Get preview URL for release-hub page
     241     */
     242    public function get_preview_url( WP_REST_Request $request ) {
     243        $product_id = $request->get_param( 'product_id' );
     244        $preview_url = Changeloger_Frontend::get_release_hub_page_url( $product_id );
     245
     246        return rest_ensure_response( [
     247            'url'        => $preview_url,
     248            'product_id' => $product_id,
     249        ] );
     250    }
     251
     252    /**
     253     * Create a page with release-hub block for a product
     254     */
     255    public function create_release_page( WP_REST_Request $request ) {
     256        $product_id = $request->get_param( 'product_id' );
     257        $tab        = $request->get_param( 'tab' );
     258
     259        $product = get_term( $product_id, Changeloger_Post_Types::TAXONOMY_PRODUCT );
     260        if ( ! $product || is_wp_error( $product ) ) {
     261            return new WP_Error( 'invalid_product', __( 'Invalid product ID.', 'changeloger' ), [ 'status' => 400 ] );
     262        }
     263
     264        $product_name = $product->name;
     265
     266        $block_content = sprintf(
     267            '<!-- wp:cha/release-hub {"productId":%d} /-->',
     268            $product_id
     269        );
     270
     271        $page_data = [
     272            'post_title'   => sprintf( __( '%s - Changelog', 'changeloger' ), $product_name ),
     273            'post_content' => $block_content,
     274            'post_status'  => 'publish',
     275            'post_type'    => 'page',
     276            'meta_input'   => [
     277                '_wp_page_template' => 'changelog-template.php',
     278            ],
     279        ];
     280
     281        $page_id = wp_insert_post( $page_data, true );
     282
     283        if ( is_wp_error( $page_id ) ) {
     284            return new WP_Error( 'create_failed', $page_id->get_error_message(), [ 'status' => 500 ] );
     285        }
     286
     287        $page_url = get_permalink( $page_id );
     288
     289        return rest_ensure_response( [
     290            'success'    => true,
     291            'page_id'    => $page_id,
     292            'page_url'   => $page_url . '#' . $tab,
     293            'product_id' => $product_id,
     294        ] );
     295    }
     296
     297    // ========== Releases API Callbacks ==========
     298
     299    /**
     300     * Get releases list
     301     */
     302    public function get_releases( WP_REST_Request $request ) {
     303        $status   = $request->get_param( 'status' );
     304        $search   = $request->get_param( 'search' );
     305        $product  = $request->get_param( 'product' );
     306        $per_page = $request->get_param( 'per_page' );
     307        $page     = $request->get_param( 'page' );
     308
     309        $args = [
     310            'post_type'      => Changeloger_Post_Types::POST_TYPE,
     311            'posts_per_page' => $per_page,
     312            'paged'          => $page,
     313            'orderby'        => 'date',
     314            'order'          => 'DESC',
     315        ];
     316
     317        if ( $status && $status !== 'any' ) {
     318            $args['post_status'] = $status;
     319        } else {
     320            $args['post_status'] = [ 'publish', 'draft' ];
     321        }
     322
     323        if ( $search ) {
     324            $args['s'] = $search;
     325        }
     326
     327        if ( $product ) {
     328            $args['tax_query'] = [
     329                [
     330                    'taxonomy' => Changeloger_Post_Types::TAXONOMY_PRODUCT,
     331                    'field'    => 'term_id',
     332                    'terms'    => $product,
     333                ],
     334            ];
     335        }
     336
     337        $query = new WP_Query( $args );
     338        $releases = [];
     339
     340        foreach ( $query->posts as $post ) {
     341            $releases[] = $this->format_release( $post );
     342        }
     343
     344        return rest_ensure_response( [
     345            'releases'    => $releases,
     346            'total'       => $query->found_posts,
     347            'total_pages' => $query->max_num_pages,
     348            'page'        => $page,
     349        ] );
     350    }
     351
     352    /**
     353     * Get single release
     354     */
     355    public function get_release( WP_REST_Request $request ) {
     356        $id   = $request->get_param( 'id' );
     357        $post = get_post( $id );
     358
     359        if ( ! $post || $post->post_type !== Changeloger_Post_Types::POST_TYPE ) {
     360            return new WP_Error( 'not_found', __( 'Release not found.', 'changeloger' ), [ 'status' => 404 ] );
     361        }
     362
     363        return rest_ensure_response( $this->format_release( $post ) );
     364    }
     365
     366    /**
     367     * Create release
     368     */
     369    public function create_release( WP_REST_Request $request ) {
     370        $data = $request->get_json_params();
     371
     372        $post_data = [
     373            'post_type'    => Changeloger_Post_Types::POST_TYPE,
     374            'post_title'   => sanitize_text_field( $data['title'] ?? '' ),
     375            'post_content' => wp_kses_post( $data['notes'] ?? '' ),
     376            'post_status'  => sanitize_text_field( $data['status'] ?? 'draft' ),
     377        ];
     378
     379        $post_id = wp_insert_post( $post_data );
     380
     381        if ( is_wp_error( $post_id ) ) {
     382            return $post_id;
     383        }
     384
     385        // Save meta
     386        if ( isset( $data['version'] ) ) {
     387            update_post_meta( $post_id, Changeloger_Release_Meta::META_VERSION, sanitize_text_field( $data['version'] ) );
     388        }
     389        if ( isset( $data['release_type'] ) ) {
     390            update_post_meta( $post_id, Changeloger_Release_Meta::META_RELEASE_TYPE, sanitize_text_field( $data['release_type'] ) );
     391        }
     392        if ( isset( $data['release_date'] ) ) {
     393            update_post_meta( $post_id, Changeloger_Release_Meta::META_RELEASE_DATE, sanitize_text_field( $data['release_date'] ) );
     394        }
     395        if ( isset( $data['change_items'] ) ) {
     396            update_post_meta( $post_id, Changeloger_Release_Meta::META_CHANGE_ITEMS, $this->sanitize_change_items( $data['change_items'] ) );
     397        }
     398
     399        // Set product
     400        if ( isset( $data['product'] ) && $data['product'] ) {
     401            wp_set_object_terms( $post_id, absint( $data['product'] ), Changeloger_Post_Types::TAXONOMY_PRODUCT );
     402        }
     403
     404        $post = get_post( $post_id );
     405        return rest_ensure_response( $this->format_release( $post ) );
     406    }
     407
     408    /**
     409     * Update release
     410     */
     411    public function update_release( WP_REST_Request $request ) {
     412        $id   = $request->get_param( 'id' );
     413        $data = $request->get_json_params();
     414        $post = get_post( $id );
     415
     416        if ( ! $post || $post->post_type !== Changeloger_Post_Types::POST_TYPE ) {
     417            return new WP_Error( 'not_found', __( 'Release not found.', 'changeloger' ), [ 'status' => 404 ] );
     418        }
     419
     420        $post_data = [ 'ID' => $id ];
     421
     422        if ( isset( $data['title'] ) ) {
     423            $post_data['post_title'] = sanitize_text_field( $data['title'] );
     424        }
     425        if ( isset( $data['notes'] ) ) {
     426            $post_data['post_content'] = wp_kses_post( $data['notes'] );
     427        }
     428        if ( isset( $data['status'] ) ) {
     429            $post_data['post_status'] = sanitize_text_field( $data['status'] );
     430        }
     431
     432        wp_update_post( $post_data );
     433
     434        // Update meta
     435        if ( isset( $data['version'] ) ) {
     436            update_post_meta( $id, Changeloger_Release_Meta::META_VERSION, sanitize_text_field( $data['version'] ) );
     437        }
     438        if ( isset( $data['release_type'] ) ) {
     439            update_post_meta( $id, Changeloger_Release_Meta::META_RELEASE_TYPE, sanitize_text_field( $data['release_type'] ) );
     440        }
     441        if ( isset( $data['release_date'] ) ) {
     442            update_post_meta( $id, Changeloger_Release_Meta::META_RELEASE_DATE, sanitize_text_field( $data['release_date'] ) );
     443        }
     444        if ( isset( $data['change_items'] ) ) {
     445            update_post_meta( $id, Changeloger_Release_Meta::META_CHANGE_ITEMS, $this->sanitize_change_items( $data['change_items'] ) );
     446        }
     447
     448        // Update product
     449        if ( isset( $data['product'] ) ) {
     450            if ( $data['product'] ) {
     451                wp_set_object_terms( $id, absint( $data['product'] ), Changeloger_Post_Types::TAXONOMY_PRODUCT );
     452            } else {
     453                wp_set_object_terms( $id, [], Changeloger_Post_Types::TAXONOMY_PRODUCT );
     454            }
     455        }
     456
     457        $post = get_post( $id );
     458        return rest_ensure_response( $this->format_release( $post ) );
     459    }
     460
     461    /**
     462     * Delete release
     463     */
     464    public function delete_release( WP_REST_Request $request ) {
     465        $id   = $request->get_param( 'id' );
     466        $post = get_post( $id );
     467
     468        if ( ! $post || $post->post_type !== Changeloger_Post_Types::POST_TYPE ) {
     469            return new WP_Error( 'not_found', __( 'Release not found.', 'changeloger' ), [ 'status' => 404 ] );
     470        }
     471
     472        wp_delete_post( $id, true );
     473
     474        return rest_ensure_response( [ 'deleted' => true, 'id' => $id ] );
     475    }
     476
     477    /**
     478     * Get stats
     479     */
     480    public function get_releases_stats() {
     481        $post_type = Changeloger_Post_Types::POST_TYPE;
     482
     483        $total = wp_count_posts( $post_type );
     484        $total_count     = ( $total->publish ?? 0 ) + ( $total->draft ?? 0 );
     485        $published_count = $total->publish ?? 0;
     486        $draft_count     = $total->draft ?? 0;
     487
     488        // Get latest version
     489        $latest_args = [
     490            'post_type'      => $post_type,
     491            'posts_per_page' => 1,
     492            'post_status'    => 'publish',
     493            'orderby'        => 'date',
     494            'order'          => 'DESC',
     495        ];
     496        $latest_query   = new WP_Query( $latest_args );
     497        $latest_version = '—';
     498        $latest_product = '';
     499
     500        if ( $latest_query->have_posts() ) {
     501            $latest_post    = $latest_query->posts[0];
     502            $latest_version = get_post_meta( $latest_post->ID, Changeloger_Release_Meta::META_VERSION, true ) ?: '—';
     503
     504            $terms = wp_get_post_terms( $latest_post->ID, Changeloger_Post_Types::TAXONOMY_PRODUCT );
     505            if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
     506                $latest_product = $terms[0]->name;
     507            }
     508        }
     509
     510        return rest_ensure_response( [
     511            'total'          => $total_count,
     512            'published'      => $published_count,
     513            'drafts'         => $draft_count,
     514            'latest_version' => $latest_version,
     515            'latest_product' => $latest_product,
     516        ] );
     517    }
     518
     519    /**
     520     * Format release for response
     521     */
     522    private function format_release( $post ) {
     523        $terms = wp_get_post_terms( $post->ID, Changeloger_Post_Types::TAXONOMY_PRODUCT );
     524        $product = null;
     525        if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
     526            $product = [
     527                'id'   => $terms[0]->term_id,
     528                'name' => $terms[0]->name,
     529                'slug' => $terms[0]->slug,
     530            ];
     531        }
     532
     533        return [
     534            'id'           => $post->ID,
     535            'title'        => $post->post_title,
     536            'notes'        => $post->post_content,
     537            'status'       => $post->post_status,
     538            'version'      => get_post_meta( $post->ID, Changeloger_Release_Meta::META_VERSION, true ),
     539            'release_type' => get_post_meta( $post->ID, Changeloger_Release_Meta::META_RELEASE_TYPE, true ),
     540            'release_date' => get_post_meta( $post->ID, Changeloger_Release_Meta::META_RELEASE_DATE, true ),
     541            'change_items' => get_post_meta( $post->ID, Changeloger_Release_Meta::META_CHANGE_ITEMS, true ) ?: [],
     542            'product'      => $product,
     543            'permalink'    => get_permalink( $post->ID ),
     544            'created_at'   => $post->post_date,
     545            'modified_at'  => $post->post_modified,
     546        ];
     547    }
     548
     549    /**
     550     * Sanitize change items
     551     */
     552    private function sanitize_change_items( $items ) {
     553        if ( ! is_array( $items ) ) {
     554            return [];
     555        }
     556
     557        $sanitized = [];
     558        foreach ( $items as $item ) {
     559            if ( isset( $item['group'] ) && isset( $item['items'] ) && is_array( $item['items'] ) ) {
     560                $sanitized[] = [
     561                    'group' => sanitize_text_field( $item['group'] ),
     562                    'items' => array_map( 'sanitize_text_field', $item['items'] ),
     563                ];
     564            }
     565        }
     566
     567        return $sanitized;
     568    }
     569
     570    // ========== Products API Callbacks ==========
     571
     572    /**
     573     * Get products list
     574     */
     575    public function get_products( WP_REST_Request $request ) {
     576        $terms = get_terms( [
     577            'taxonomy'   => Changeloger_Post_Types::TAXONOMY_PRODUCT,
     578            'hide_empty' => false,
     579            'orderby'    => 'name',
     580            'order'      => 'ASC',
     581        ] );
     582
     583        if ( is_wp_error( $terms ) ) {
     584            return rest_ensure_response( [] );
     585        }
     586
     587        global $wpdb;
     588
     589        // Optimization: Batch count query to avoid N+1 problem
     590        // We need to count posts with status 'publish' OR 'draft' for each product term
     591        $sql = $wpdb->prepare(
     592            "SELECT tr.term_taxonomy_id, COUNT(p.ID) as count
     593             FROM {$wpdb->term_relationships} tr
     594             INNER JOIN {$wpdb->posts} p ON p.ID = tr.object_id
     595             WHERE p.post_type = %s
     596             AND p.post_status IN ('publish', 'draft')
     597             GROUP BY tr.term_taxonomy_id",
     598            Changeloger_Post_Types::POST_TYPE
     599        );
     600
     601        $counts = $wpdb->get_results( $sql, OBJECT_K );
     602
     603        $products = [];
     604        foreach ( $terms as $term ) {
     605            $term_id = $term->term_id;
     606            // For simple taxonomies, term_id often equals term_taxonomy_id, but we should be careful.
     607            // However, standard WP get_terms returns objects where term_id is the ID.
     608            // In standard WP usage, we group by term_taxonomy_id (which is unique per term per tax).
     609            // We can map via term_taxonomy_id if available on $term object, or assume standard setup.
     610
     611            // get_terms returns WP_Term objects which have term_taxonomy_id
     612            $tt_id = $term->term_taxonomy_id;
     613
     614            $count = isset( $counts[ $tt_id ] ) ? (int) $counts[ $tt_id ]->count : 0;
     615
     616            $products[] = [
     617                'id'    => $term->term_id,
     618                'name'  => $term->name,
     619                'slug'  => $term->slug,
     620                'count' => $count,
     621            ];
     622        }
     623
     624        return rest_ensure_response( $products );
     625    }
     626
     627    /**
     628     * Create product
     629     */
     630    public function create_product( WP_REST_Request $request ) {
     631        // Check product limit for free users
     632        $is_premium = function_exists( 'cha_is_premium' ) && cha_is_premium();
     633
     634        if ( ! $is_premium ) {
     635            $existing_products = get_terms( [
     636                'taxonomy'   => Changeloger_Post_Types::TAXONOMY_PRODUCT,
     637                'hide_empty' => false,
     638                'fields'     => 'count',
    64639            ] );
    65         }
    66 
    67         // Build block_attrs array for the save_initial_changelog function
    68         $block_attrs = array(
    69             'unique_id' => $unique_id,
    70             'enableVersions' => isset( $params['enableVersions'] ) ? (bool) $params['enableVersions'] : false,
    71         );
    72 
    73         // Convert parsed_changelog to raw text format
    74         $parser_class = 'Changeloger_Parser';
    75         if ( class_exists( $parser_class ) ) {
    76             $raw_changelog = call_user_func( array( $parser_class, 'convertToPlainText' ), $parsed_changelog );
    77         } else {
    78             $raw_changelog = '';
    79         }
    80 
    81         // Render the changelog info wrapper and version tree
    82         $changelog_renderer_class = 'Changeloger_Changelog_Renderer';
    83         $rendered_info_wrapper = '';
    84         $rendered_version_tree = '';
    85 
    86         if ( class_exists( $changelog_renderer_class ) ) {
    87             $rendered_info_wrapper = call_user_func( array( $changelog_renderer_class, 'render_info_wrapper' ), $parsed_changelog );
    88             if ( isset( $block_attrs['enableVersions'] ) && $block_attrs['enableVersions'] ) {
    89                 $rendered_version_tree = call_user_func( array( $changelog_renderer_class, 'render_version_tree' ), $parsed_changelog );
    90             }
    91         }
    92 
    93         $save_result = Changeloger_Version_Tracker::save_initial_changelog(
    94             $post_id,
    95             $block_attrs,
    96             $raw_changelog,
    97             $rendered_info_wrapper,
    98             $rendered_version_tree,
    99             $is_pro,
    100             $url
    101         );
    102 
    103         if ( is_wp_error( $save_result ) ) {
    104             return new WP_REST_Response( [
    105                 'success' => false,
    106                 'message' => $save_result->get_error_message()
    107             ], 500 );
    108         }
    109 
    110         $version_check = Changeloger_Version_Tracker::check_for_new_version( $post_id, $unique_id, $parsed_changelog, $is_pro );
    111 
    112         if ( $version_check['has_new_version'] && $version_check['new_version'] ) {
    113             // Only track the version, don't send emails here
    114             // The cron job will handle email notifications
    115             Changeloger_Version_Tracker::update_last_seen_version( $post_id, $unique_id, $version_check['new_version'] );
    116             Changeloger_Version_Tracker::add_to_version_history( $post_id, $unique_id, $version_check['new_version'], [
    117                 'old_version' => $version_check['old_version'],
    118                 'source' => 'manual_save',
    119             ] );
    120 
    121             return new WP_REST_Response( [
    122                 'success' => true,
    123                 'message' => sprintf( __( 'New version %s detected! Subscribers will be notified on the next scheduled cron check (daily).', 'changeloger' ), $version_check['new_version'] ),
    124                 'new_version_detected' => true,
    125                 'version' => $version_check['new_version'],
    126                 'notification_scheduled' => true
    127             ] );
    128         }
    129 
    130         return new WP_REST_Response( [
    131             'success' => true,
    132             'message' => __( 'Changelog tracked successfully', 'changeloger' ),
    133             'new_version_detected' => false
    134         ] );
    135     }
    136 
    137     // ========== Track Version Endpoint ==========
    138     public function fetch_txt_callback($request) {
    139         $url = $request->get_param('url');
    140 
    141         if (!$url) {
    142             return new WP_Error('no_url', 'No URL provided', ['status' => 400]);
    143         }
    144 
    145         $response = wp_remote_get($url);
    146 
    147         if (is_wp_error($response)) {
    148             return new WP_Error('fetch_failed', 'Failed to fetch the file', ['status' => 500]);
    149         }
    150 
    151         $status = wp_remote_retrieve_response_code($response);
    152         if ($status !== 200) {
    153             return new WP_Error('not_found', 'URL returned ' . $status, ['status' => 404]);
    154         }
    155 
    156         $content_type = wp_remote_retrieve_header($response, 'content-type');
    157 
    158         if (strpos($content_type, 'text/plain') === false) {
    159             return new WP_Error('invalid_type', 'This is not a .txt file', ['status' => 400]);
    160         }
    161 
    162         $body = wp_remote_retrieve_body($response);
    163 
    164         if (trim($body) === "") {
    165             return new WP_Error('empty_file', 'The file is empty', ['status' => 400]);
    166         }
    167 
    168         return rest_ensure_response([
    169             'content' => $body
    170         ]);
    171 
    172     }
    173 
    174     /**
    175      * Get detailed cron status information
    176      */
    177     public function diagnostics_cron_status_callback( $request ): array {
    178         // Get cron timestamp
    179         $cron_timestamp = wp_next_scheduled( 'cha_daily_version_check' );
    180 
    181         // Get cron schedules
    182         $crons = _get_cron_array();
    183         $cron_interval = 'Not scheduled';
    184 
    185         if ( ! empty( $crons ) ) {
    186             foreach ( $crons as $time => $cron ) {
    187                 if ( isset( $cron['cha_daily_version_check'] ) ) {
    188                     foreach ( $cron['cha_daily_version_check'] as $data ) {
    189                         $cron_interval = isset( $data['schedule'] ) ? $data['schedule'] : 'Unknown';
     640
     641            $product_count = is_wp_error( $existing_products ) ? 0 : (int) $existing_products;
     642
     643            if ( $product_count >= 1 ) {
     644                return new WP_Error(
     645                    'product_limit_reached',
     646                    __( 'Free version is limited to 1 product. Upgrade to Pro for unlimited products.', 'changeloger' ),
     647                    [
     648                        'status'      => 403,
     649                        'upgrade_url' => function_exists( 'cha_fs' ) ? cha_fs()->get_upgrade_url() : '',
     650                        'limit'       => 1,
     651                        'current'     => $product_count,
     652                    ]
     653                );
     654            }
     655        }
     656
     657        $name = sanitize_text_field( $request->get_param( 'name' ) );
     658        $slug = sanitize_title( $request->get_param( 'slug' ) ?: $name );
     659
     660        if ( empty( $name ) ) {
     661            return new WP_Error( 'missing_name', __( 'Product name is required.', 'changeloger' ), [ 'status' => 400 ] );
     662        }
     663
     664        $result = wp_insert_term( $name, Changeloger_Post_Types::TAXONOMY_PRODUCT, [
     665            'slug' => $slug,
     666        ] );
     667
     668        if ( is_wp_error( $result ) ) {
     669            return new WP_Error( 'create_failed', $result->get_error_message(), [ 'status' => 400 ] );
     670        }
     671
     672        $term = get_term( $result['term_id'], Changeloger_Post_Types::TAXONOMY_PRODUCT );
     673
     674        return rest_ensure_response( [
     675            'id'    => $term->term_id,
     676            'name'  => $term->name,
     677            'slug'  => $term->slug,
     678            'count' => $term->count,
     679        ] );
     680    }
     681
     682    /**
     683     * Update product
     684     */
     685    public function update_product( WP_REST_Request $request ) {
     686        $id   = absint( $request->get_param( 'id' ) );
     687        $name = sanitize_text_field( $request->get_param( 'name' ) );
     688        $slug = sanitize_title( $request->get_param( 'slug' ) );
     689
     690        $term = get_term( $id, Changeloger_Post_Types::TAXONOMY_PRODUCT );
     691        if ( ! $term || is_wp_error( $term ) ) {
     692            return new WP_Error( 'not_found', __( 'Product not found.', 'changeloger' ), [ 'status' => 404 ] );
     693        }
     694
     695        $args = [];
     696        if ( $name ) {
     697            $args['name'] = $name;
     698        }
     699        if ( $slug ) {
     700            $args['slug'] = $slug;
     701        }
     702
     703        $result = wp_update_term( $id, Changeloger_Post_Types::TAXONOMY_PRODUCT, $args );
     704
     705        if ( is_wp_error( $result ) ) {
     706            return new WP_Error( 'update_failed', $result->get_error_message(), [ 'status' => 400 ] );
     707        }
     708
     709        $term = get_term( $id, Changeloger_Post_Types::TAXONOMY_PRODUCT );
     710
     711        return rest_ensure_response( [
     712            'id'    => $term->term_id,
     713            'name'  => $term->name,
     714            'slug'  => $term->slug,
     715            'count' => $term->count,
     716        ] );
     717    }
     718
     719    /**
     720     * Delete product and all associated posts
     721     */
     722    public function delete_product( WP_REST_Request $request ) {
     723        $id = absint( $request->get_param( 'id' ) );
     724
     725        $term = get_term( $id, Changeloger_Post_Types::TAXONOMY_PRODUCT );
     726        if ( ! $term || is_wp_error( $term ) ) {
     727            return new WP_Error( 'not_found', __( 'Product not found.', 'changeloger' ), [ 'status' => 404 ] );
     728        }
     729
     730        // Get all post types that use this taxonomy
     731        $post_types = [
     732            Changeloger_Post_Types::POST_TYPE,
     733            Changeloger_Post_Types::POST_TYPE_FEEDBACK,
     734            Changeloger_Post_Types::POST_TYPE_ROADMAP,
     735        ];
     736
     737        $deleted_counts = [
     738            'releases' => 0,
     739            'feedback' => 0,
     740            'roadmap'  => 0,
     741            'pages'    => 0,
     742        ];
     743
     744        // Delete associated release-hub pages for this product
     745        $pages = get_posts( [
     746            'post_type'      => 'page',
     747            'posts_per_page' => -1,
     748            'post_status'    => 'any',
     749        ] );
     750
     751        foreach ( $pages as $page ) {
     752            // Check if page contains release-hub block with this product ID
     753            if ( has_block( 'cha/release-hub', $page ) ) {
     754                // Parse blocks to check productId attribute
     755                $blocks = parse_blocks( $page->post_content );
     756                foreach ( $blocks as $block ) {
     757                    if ( 'cha/release-hub' === $block['blockName'] ) {
     758                        $block_product_id = isset( $block['attrs']['productId'] ) ? (int) $block['attrs']['productId'] : 0;
     759                        if ( $block_product_id === $id ) {
     760                            wp_delete_post( $page->ID, true );
     761                            $deleted_counts['pages']++;
     762                            break;
     763                        }
    190764                    }
    191765                }
     
    193767        }
    194768
    195         // Check loopback capability
    196         $loopback_test = wp_remote_get( home_url( 'wp-cron.php' ), array(
    197             'blocking' => false,
    198             'sslverify' => apply_filters( 'https_local_ssl_verify', false ),
    199         ) );
    200         $loopback_works = ! is_wp_error( $loopback_test );
    201 
    202         // Get last run time from transient
    203         $last_run = get_transient( 'cha_cron_last_run_time' );
    204 
    205         // Get last summary
    206         $last_summary = get_option( 'cha_cron_last_summary', array() );
    207 
    208         return array(
    209             'scheduled' => ! empty( $cron_timestamp ),
    210             'next_run_timestamp' => $cron_timestamp,
    211             'next_run_human' => $cron_timestamp ? human_time_diff( $cron_timestamp, time() ) . ' from now' : 'Not scheduled',
    212             'interval' => $cron_interval,
    213             'loopback_working' => $loopback_works,
    214             'fallback_heartbeat_active' => true,
    215             'last_fallback_run' => $last_run ? gmdate( 'Y-m-d H:i:s', $last_run ) : 'Never',
    216             'alternate_wp_cron_enabled' => defined( 'ALTERNATE_WP_CRON' ) && ALTERNATE_WP_CRON,
    217             'last_summary' => is_array( $last_summary ) ? $last_summary : maybe_unserialize( $last_summary ),
    218         );
     769        // Delete all associated posts for each post type
     770        foreach ( $post_types as $post_type ) {
     771            $posts = get_posts( [
     772                'post_type'      => $post_type,
     773                'posts_per_page' => -1,
     774                'post_status'    => 'any',
     775                'fields'         => 'ids',
     776                'tax_query'      => [
     777                    [
     778                        'taxonomy' => Changeloger_Post_Types::TAXONOMY_PRODUCT,
     779                        'field'    => 'term_id',
     780                        'terms'    => $id,
     781                    ],
     782                ],
     783            ] );
     784
     785            foreach ( $posts as $post_id ) {
     786                wp_delete_post( $post_id, true );
     787
     788                if ( Changeloger_Post_Types::POST_TYPE === $post_type ) {
     789                    $deleted_counts['releases']++;
     790                } elseif ( Changeloger_Post_Types::POST_TYPE_FEEDBACK === $post_type ) {
     791                    $deleted_counts['feedback']++;
     792                } else {
     793                    $deleted_counts['roadmap']++;
     794                }
     795            }
     796        }
     797
     798        $result = wp_delete_term( $id, Changeloger_Post_Types::TAXONOMY_PRODUCT );
     799
     800        if ( is_wp_error( $result ) ) {
     801            return new WP_Error( 'delete_failed', $result->get_error_message(), [ 'status' => 400 ] );
     802        }
     803
     804        return rest_ensure_response( [
     805            'deleted' => true,
     806            'counts'  => $deleted_counts,
     807        ] );
     808    }
     809
     810    /**
     811     * Import changelog from raw text
     812     */
     813    public function import_changelog( WP_REST_Request $request ) {
     814        $changelog_text = $request->get_param( 'changelog_text' );
     815        $product_id     = absint( $request->get_param( 'product_id' ) );
     816
     817        if ( empty( $changelog_text ) ) {
     818            return new WP_Error( 'missing_text', __( 'Changelog text is required.', 'changeloger' ), [ 'status' => 400 ] );
     819        }
     820
     821        // Include and use the changelog renderer
     822        require_once plugin_dir_path( __FILE__ ) . 'class-changelog-renderer.php';
     823        $renderer = new Changelog_Renderer();
     824        $parsed   = $renderer->parse( $changelog_text );
     825
     826        if ( empty( $parsed ) ) {
     827            return new WP_Error( 'parse_failed', __( 'Could not parse any versions from the changelog.', 'changeloger' ), [ 'status' => 400 ] );
     828        }
     829
     830        $imported = 0;
     831
     832        // Category mapping
     833        $category_map = [
     834            'added'        => 'improvements',
     835            'new'          => 'improvements',
     836            'changed'      => 'improvements',
     837            'updated'      => 'improvements',
     838            'improved'     => 'improvements',
     839            'improvement'  => 'improvements',
     840            'improvements' => 'improvements',
     841            'update'       => 'improvements',
     842            'enhance'      => 'improvements',
     843            'enhanced'     => 'improvements',
     844            'feature'      => 'improvements',
     845            'removed'      => 'patches',
     846            'deprecated'   => 'patches',
     847            'tweaked'      => 'patches',
     848            'tweak'        => 'patches',
     849            'patches'      => 'patches',
     850            'patch'        => 'patches',
     851            'patched'      => 'patches',
     852            'fixed'        => 'fixes',
     853            'fixes'        => 'fixes',
     854            'fix'          => 'fixes',
     855            'bug'          => 'fixes',
     856            'bugfix'       => 'fixes',
     857            'security'     => 'fixes',
     858            'general'      => 'fixes',
     859        ];
     860
     861        $base_timestamp = current_time( 'timestamp' );
     862        $index = 0;
     863        $total_items = count( $parsed );
     864
     865        foreach ( $parsed as $version_data ) {
     866            $version     = $version_data['version'] ?? '';
     867            $date        = $version_data['date'] ?? '';
     868            $changes     = $version_data['changes'] ?? [];
     869            $title       = $version_data['title'] ?? '';
     870            $description = $version_data['description'] ?? '';
     871
     872            if ( empty( $version ) ) {
     873                continue;
     874            }
     875
     876            $release_date = '';
     877            $post_date_timestamp = null;
     878            if ( ! empty( $date ) ) {
     879                $timestamp = strtotime( $date );
     880                if ( $timestamp !== false ) {
     881                    $release_date = gmdate( 'Y-m-d', $timestamp );
     882                    $post_date_timestamp = $timestamp + ( ( $total_items - $index ) * 60 );
     883                }
     884            }
     885
     886            if ( ! $post_date_timestamp ) {
     887                $post_date_timestamp = $base_timestamp - ( $index * 60 );
     888            }
     889
     890            $release_type = '';
     891            $version_lower = strtolower( $version );
     892            if ( strpos( $version_lower, 'beta' ) !== false || strpos( $version_lower, 'alpha' ) !== false ) {
     893                $release_type = 'patch';
     894            }
     895
     896            $change_items = [];
     897            foreach ( $changes as $change ) {
     898                $category     = strtolower( trim( $change['category'] ?? 'general' ) );
     899                $change_text  = $change['change'] ?? '';
     900                $mapped_group = $category_map[ $category ] ?? 'fixes';
     901
     902                if ( ! isset( $change_items[ $mapped_group ] ) ) {
     903                    $change_items[ $mapped_group ] = [];
     904                }
     905                $change_items[ $mapped_group ][] = wp_strip_all_tags( $change_text );
     906            }
     907
     908            $formatted_items = [];
     909            foreach ( $change_items as $group => $items ) {
     910                $formatted_items[] = [
     911                    'group' => $group,
     912                    'items' => $items,
     913                ];
     914            }
     915
     916            $post_title = ! empty( $title ) ? sanitize_text_field( $title ) : sprintf( __( 'Version %s', 'changeloger' ), $version );
     917            $publish_posts = $request->get_param( 'publish_posts' );
     918            $post_status   = $publish_posts ? 'publish' : 'draft';
     919
     920            $post_data = [
     921                'post_type'     => Changeloger_Post_Types::POST_TYPE,
     922                'post_title'    => $post_title,
     923                'post_content'  => ! empty( $description ) ? wp_kses_post( $description ) : '',
     924                'post_status'   => $post_status,
     925                'post_author'   => get_current_user_id(),
     926                'post_date'     => gmdate( 'Y-m-d H:i:s', $post_date_timestamp ),
     927                'post_date_gmt' => gmdate( 'Y-m-d H:i:s', $post_date_timestamp ),
     928            ];
     929
     930            $post_id = wp_insert_post( $post_data );
     931
     932            if ( is_wp_error( $post_id ) ) {
     933                continue;
     934            }
     935
     936            update_post_meta( $post_id, Changeloger_Release_Meta::META_VERSION, sanitize_text_field( $version ) );
     937            if ( $release_date ) {
     938                update_post_meta( $post_id, Changeloger_Release_Meta::META_RELEASE_DATE, $release_date );
     939            }
     940            if ( $release_type ) {
     941                update_post_meta( $post_id, Changeloger_Release_Meta::META_RELEASE_TYPE, $release_type );
     942            }
     943            update_post_meta( $post_id, Changeloger_Release_Meta::META_CHANGE_ITEMS, $formatted_items );
     944
     945            if ( $product_id ) {
     946                wp_set_object_terms( $post_id, $product_id, Changeloger_Post_Types::TAXONOMY_PRODUCT );
     947            }
     948
     949            $imported++;
     950            $index++;
     951        }
     952
     953        return rest_ensure_response( [
     954            'success'  => true,
     955            'imported' => $imported,
     956            'message'  => sprintf( __( '%d releases imported successfully.', 'changeloger' ), $imported ),
     957        ] );
    219958    }
    220959}
    221960
     961// Initialize
    222962new Changeloger_REST_API();
    223 
    224 
    225 
  • changeloger/trunk/readme.txt

    r3441560 r3443916  
    11=== Changeloger - Release Notes & Changelog Manager ===
    2 Contributors: mdjwel, spiderdevs , muaz404, freemius
     2Contributors: mdjwel, spiderdevs , muaz404
    33Tags: changelogs, changelog, release, version, history
    4 Stable tag: 1.3.0
     4Stable tag: 1.4.0
    55Requires at least: 6.0
    6 Tested up to: 6.7.2
     6Tested up to: 6.9
    77Requires PHP: 7.4
    88License: GPLv2 or later
     
    1313== Description ==
    1414
    15 Introducing Changeloger, the ultimate WordPress plugin designed to effortlessly transform plain text changelogs into visually stunning representations within the WordPress block editor. Gone are the days of mundane changelogs that users struggle to interpret. With Changeloger, software developers, product managers, and website owners can now present their updates and changes in a captivating, user-friendly format.
    16 
    17 Changeloger streamlines the process of conveying complex updates by enabling users to upload their changelog text files directly into the plugin. Once uploaded, Changeloger instantly converts the plain text content into an eye-catching and visually designed changelog. Users can bid farewell to tedious manual formatting and focus on delivering the most crucial information to their audience.
    18 
    19 ### Video Overview / How to Use Changeloger: ###
    20 [youtube https://youtu.be/U9CsttxXifs]
     15Introducing Changeloger, the ultimate WordPress plugin designed to transform plain text changelogs into visually stunning representations and provide a complete release management solution. With powerful admin builders for releases, feedback collection, and public roadmaps, Changeloger goes beyond simple changelog display to become your all-in-one product update hub.
     16
     17Changeloger streamlines the entire release communication workflow - from creating structured releases in the admin builder, to collecting user feedback and feature requests, to sharing your product roadmap publicly. Whether you paste plain text, upload files, or use the visual admin interface, Changeloger makes it effortless to keep your users informed and engaged.
    2118
    2219### Key Features: ###
     
    4239**Free Version Includes:**
    4340
    44 **Sidebar Versions** – Displays all changelog versions in a sidebar, allowing users to quickly switch between different releases.
    45 
    46 **Upload Changelog URL** – Allows users to import changelog content directly from a public URL and instantly load it into the editor.
    47 
    48 **Upload Changelog (.txt file)** – Enables uploading a plain .txt file to automatically populate the changelog editor with its contents.
    49 
    50 
    51 ### PRO Features
    52 
    53 - **Pagination:** Breaks long changelogs into multiple pages, making navigation easier and preventing long scrolling.
    54 
    55 - **Filter:** Lets users filter changelog items by categories such as New, Fixed, Updated, or Improved for quick access.
    56 
    57 - **Search:** Enables keyword-based search inside the changelog so users can instantly find specific updates or fixes.
    58 
    59 - **Changelog Layout:** Offers additional layout styles to organize changelog items in a cleaner, more professional visual structure.
    60 
    61 - **Visual Editing:** Easily manage changelogs with visual controls to add new versions, insert or remove items, and delete old entries without touching any code.
    62 
    63 - **Email Subscription:** Allow users to subscribe to changelog updates and receive automatic email notifications whenever a new version is released.
    64 
    65 
    66 [See All Features](#)
     41***Gutenberg Blocks***
     42
     43- **Changeloger Block** – Display beautiful changelogs with plain text input or file upload
     44- **Tabbed Changeloger Block** – Organize multiple changelogs in a tabbed interface
     45- **Release Hub Block** – Unified display of releases, feedback, and roadmap
     46- **Sidebar Versions** – Quick navigation with left or right sidebar version list
     47- **Log Tags & Color Management** – Categorize entries with customizable colored badges (New, Fixed, Updated, Improved, etc.)
     48
     49***Admin Release Builder***
     50
     51- **Product Management** – Create and manage your product (1 product limit in free version)
     52- **Release Creator** – Visual interface to create releases with version numbers and dates
     53- **Change Items** – Add categorized change items (Features, Fixes, Improvements, etc.)
     54- **Draft/Publish Workflow** – Save drafts and publish when ready
     55- **Import Sample Data** – Load demo releases to see how it works
     56- **File Import** – Upload plain .txt changelog files to auto-create releases
     57- **Bulk Actions** – Publish, draft, or delete multiple releases at once
     58- **Release Preview** – View how your releases look on the frontend
     59
     60### PRO Features:
     61
     62***Advanced Changelog Features***
     63
     64- **Upload Changelog URL** – Import changelog content directly from public URLs (GitHub, etc.)
     65- **Visual Editing** – Add, edit, and delete versions and items with visual controls
     66- **Pagination** – Break long changelogs into pages with "Load More" or numbered navigation
     67- **Filter Component** – Let users filter by category (New, Fixed, Updated, Improved)
     68- **Search Option** – Enable keyword search within changelog content
     69- **Layout Switch** – Multiple layout styles for organized display
     70- **Unlimited Products** – Create and manage unlimited products (vs 1 in free)
     71
     72***Email Subscription System***
     73
     74- **Subscription Form** – Display email subscription form on changelog
     75- **Email Notifications** – Automatically notify subscribers of new releases
     76- **Auto Version Tracking** – Monitors changelog for new versions and sends emails
     77- **Custom Email Templates** – Customize from name, from email, and subject with placeholders
     78- **Double Opt-in** – Confirmation email for new subscribers
     79
     80***Feedback Manager***
     81
     82- **Feedback Collection** – Frontend form for users to submit feature requests and bug reports
     83- **Feedback Dashboard** – Dedicated admin page to view and manage all feedback
     84- **Voting System** – Let users upvote/downvote feedback items
     85- **Comment Threads** – Allow discussions on feedback items
     86- **Status Management** – Track feedback through workflow (Open, Under Review, Planned, In Progress, Completed, Closed)
     87- **Category Organization** – Organize feedback with categories (Feature Request, Bug Report, Improvement, Question)
     88- **User Authentication** – Require login or allow guest submissions
     89- **Google Login** – Enable Google OAuth for easy sign-in
     90
     91***Roadmap Builder***
     92
     93- **Public Roadmap** – Share your product roadmap as a beautiful Kanban board
     94- **Kanban Board** – Visual columns for different statuses (Under Review, Planned, In Progress, Done)
     95- **Roadmap Items** – Create and manage roadmap items with titles, descriptions, and priorities
     96- **Feedback Integration** – Link roadmap items to user feedback
     97- **Vote Display** – Show vote counts on roadmap items (optional)
     98- **Drag & Drop** – Move items between columns to update status
     99- **Priority Levels** – Set Low, Medium, or High priority on items
     100
     101***Additional Pro Features***
     102
     103- **Version Tracking** – Auto-detect new versions and notify subscribers
     104- **Google Authentication** – Set up Google OAuth for user login
     105- **Advanced Statistics** – View detailed stats for releases, feedback, and roadmap
    67106
    68107== Installation ==
     
    112151
    113152== Screenshots ==
    114 1. Changeloger block initial screen in the WordPress block editor. You can choose between upload file and Paste plain text options.
    115 2. Plain text changelogs in the Changeloger block editor. You can edit/modify the existing changelog content.
    116 3. Changeloger block editor with a preview of the visually designed changelog. You can customize the design and layout options.
     153
     1541. Dashboard - Manage all changelogs and releases from one central dashboard.
     1552. Release Builder - Create structured and professional release notes step by step.
     1563. Release Hub View - View all releases together in a clean organized layout.
     1574. Release Hub Editor - Edit and update release content quickly using an intuitive editor.
     1585. Visual Changelog - Display changelogs in a visually engaging and user friendly way.
     1596. Tabbed Changelog - Organize changelogs into clean and easy to navigate tabs.
     1607. Changeloger File Upload - Upload and attach files directly to your changelog entries.
    117161
    118162== Changelog ==
    119163
     164= 1.4.0 (21 January 2026) =
     165New: Admin Release Builder - Visual interface to create and manage releases with version numbers, dates, and change items
     166New: Product Management - Create and manage your product (1 product in free version)
     167New: Change Items - Add categorized change items (Features, Fixes, Improvements, etc.) to releases
     168New: Draft/Publish Workflow - Save drafts and publish releases when ready
     169New: Import Sample Data - Load demo releases to see how the Release Builder works
     170New: File Import - Upload plain .txt changelog files to auto-create releases
     171New: Bulk Actions - Publish, draft, or delete multiple releases at once
     172New: Release Preview - View how your releases look on the frontend
     173New: Release Hub Block - Unified display of releases (Feedback and Roadmap available in Pro)
     174Improved: Overall UI/UX with modern, clean design
     175Improved: Performance optimizations for better loading times
     176Fixed: Various minor bugs and stability improvements
    120177
    121178= 1.3.0 (24 November 2025) =
  • changeloger/trunk/vendor/composer/installed.php

    r3419755 r3443916  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '2a204014599cfa41309f2879da0b20beb153a193',
     6        'reference' => '2136973eb203f7bfc5f128ba8b46ef215f186803',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => '2a204014599cfa41309f2879da0b20beb153a193',
     16            'reference' => '2136973eb203f7bfc5f128ba8b46ef215f186803',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.