WebOrbiton

Code

FlatlyPage

A modern CMS for building landing pages.

Version history

Version 3.1.0.0 2026-11-19

Browse files
Files changed14
Lines added+1747
Lines removed-75
admin/ai-helper-lib.php Modified

Not shown (binary file or too large to diff).

admin/dashboard.php Modified +176 -71
⋮ 2103 unchanged lines ⋮
                          <h4>Blog Hero</h4>
                          <p>An article header with a title, short intro and image</p>
                      </div>
-                     <div class="block-type-card" onclick="addBlock('stats')">
+                     <div class="block-type-card" onclick="addBlock('text')">
                          <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
-                             <line x1="18" y1="20" x2="18" y2="10" />
-                             <line x1="12" y1="20" x2="12" y2="4" />
-                             <line x1="6" y1="20" x2="6" y2="14" />
+                             <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
+                             <polyline points="14 2 14 8 20 8" />
+                             <line x1="16" y1="13" x2="8" y2="13" />
+                             <line x1="16" y1="17" x2="8" y2="17" />
                          </svg>
-                         <h4>Stats</h4>
-                         <p>A row of numbers, like results or facts</p>
+                         <h4>Text</h4>
+                         <p>Headings and paragraphs</p>
                      </div>
+                     <div class="block-type-card" onclick="addBlock('image-text')">
+                         <svg class="w-6 h-6 flex-shrink-0 mt-1" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
+                             <rect x="3" y="3" width="18" height="10" rx="2" />
+                             <path d="M3 10l4-3 4 3 6-4 4 3" />
+                             <line x1="5" y1="16" x2="19" y2="16" />
+                             <line x1="5" y1="19" x2="15" y2="19" />
+                         </svg>
+                         <h4>Image + Text</h4>
+                         <p>An image next to some text</p>
+                     </div>
+                     <div class="block-type-card" onclick="addBlock('image')">
+                         <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
+                             <rect x="3" y="3" width="18" height="18" rx="2" />
+                             <circle cx="8.5" cy="8.5" r="1.5" />
+                             <polyline points="21 15 16 10 5 21" />
+                         </svg>
+                         <h4>Image</h4>
+                         <p>One large image</p>
+                     </div>
                      <div class="block-type-card" onclick="addBlock('features')">
                          <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
                              <rect x="3" y="3" width="7" height="7" />
⋮ 4 unchanged lines ⋮
                          <h4>Features</h4>
                          <p>Cards that show what you offer</p>
                      </div>
-                     <div class="block-type-card" onclick="addBlock('testimonials')">
+                     <div class="block-type-card" onclick="addBlock('stats')">
                          <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
-                             <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
+                             <line x1="18" y1="20" x2="18" y2="10" />
+                             <line x1="12" y1="20" x2="12" y2="4" />
+                             <line x1="6" y1="20" x2="6" y2="14" />
                          </svg>
-                         <h4>Testimonials</h4>
-                         <p>What your customers say</p>
+                         <h4>Stats</h4>
+                         <p>A row of numbers, like results or facts</p>
                      </div>
                      <div class="block-type-card" onclick="addBlock('pricing')">
                          <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
⋮ 3 unchanged lines ⋮
                          <h4>Pricing</h4>
                          <p>Your plans and prices</p>
                      </div>
-                     <div class="block-type-card" onclick="addBlock('cta')">
-                         <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
-                             <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14" />
-                             <polyline points="22 4 12 14.01 9 11.01" />
-                         </svg>
-                         <h4>CTA</h4>
-                         <p>A short section with a button that asks visitors to act</p>
-                     </div>
-                     <div class="block-type-card" onclick="addBlock('text')">
-                         <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
-                             <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
-                             <polyline points="14 2 14 8 20 8" />
-                             <line x1="16" y1="13" x2="8" y2="13" />
-                             <line x1="16" y1="17" x2="8" y2="17" />
-                         </svg>
-                         <h4>Text</h4>
-                         <p>Headings and paragraphs</p>
-                     </div>
-                     <div class="block-type-card" onclick="addBlock('image')">
-                         <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
-                             <rect x="3" y="3" width="18" height="18" rx="2" />
-                             <circle cx="8.5" cy="8.5" r="1.5" />
-                             <polyline points="21 15 16 10 5 21" />
-                         </svg>
-                         <h4>Image</h4>
-                         <p>One large image</p>
-                     </div>
-                     <div class="block-type-card" onclick="addBlock('image-text')">
-                         <svg class="w-6 h-6 flex-shrink-0 mt-1" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
-                             <rect x="3" y="3" width="18" height="10" rx="2" />
-                             <path d="M3 10l4-3 4 3 6-4 4 3" />
-                             <line x1="5" y1="16" x2="19" y2="16" />
-                             <line x1="5" y1="19" x2="15" y2="19" />
-                         </svg>
-                         <h4>Image + Text</h4>
-                         <p>An image next to some text</p>
-                     </div>
                      <div class="block-type-card" onclick="addBlock('product-cards')">
                          <svg class="w-6 h-6 flex-shrink-0 mt-1" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
                              <path d="M3 7v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2z" />
⋮ 4 unchanged lines ⋮
                          <h4>Product Cards</h4>
                          <p>A grid of your products</p>
                      </div>
-                     <div class="block-type-card" onclick="addBlock('video')">
+                     <div class="block-type-card" onclick="addBlock('testimonials')">
                          <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
-                             <polygon points="23 7 16 12 23 17 23 7" />
-                             <rect x="1" y="5" width="15" height="14" rx="2" />
+                             <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
                          </svg>
-                         <h4>Video</h4>
-                         <p>A video from a link, YouTube or Facebook</p>
+                         <h4>Testimonials</h4>
+                         <p>What your customers say</p>
                      </div>
-                     <div class="block-type-card" onclick="addBlock('gallery')">
+                     <div class="block-type-card" onclick="addBlock('team')">
                          <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
-                             <rect x="3" y="3" width="7" height="9" rx="1" />
-                             <rect x="14" y="3" width="7" height="5" rx="1" />
-                             <rect x="14" y="12" width="7" height="9" rx="1" />
-                             <rect x="3" y="16" width="7" height="5" rx="1" />
+                             <path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" />
+                             <circle cx="9" cy="7" r="4" />
+                             <path d="M23 21v-2a4 4 0 0 0-3-3.87" />
+                             <path d="M16 3.13a4 4 0 0 1 0 7.75" />
                          </svg>
-                         <h4>Gallery</h4>
-                         <p>A grid of images</p>
+                         <h4>Team</h4>
+                         <p>The people on your team</p>
                      </div>
                      <div class="block-type-card" onclick="addBlock('faq')">
                          <svg class="w-6 h-6 flex-shrink-0 mt-1" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" viewBox="0 0 24 24">
⋮ 4 unchanged lines ⋮
                          <h4>FAQ</h4>
                          <p>Common questions and answers</p>
                      </div>
-                     <div class="block-type-card" onclick="addBlock('team')">
+                     <div class="block-type-card" onclick="addBlock('gallery')">
                          <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
-                             <path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" />
-                             <circle cx="9" cy="7" r="4" />
-                             <path d="M23 21v-2a4 4 0 0 0-3-3.87" />
-                             <path d="M16 3.13a4 4 0 0 1 0 7.75" />
+                             <rect x="3" y="3" width="7" height="9" rx="1" />
+                             <rect x="14" y="3" width="7" height="5" rx="1" />
+                             <rect x="14" y="12" width="7" height="9" rx="1" />
+                             <rect x="3" y="16" width="7" height="5" rx="1" />
                          </svg>
-                         <h4>Team</h4>
-                         <p>The people on your team</p>
+                         <h4>Gallery</h4>
+                         <p>A grid of images</p>
                      </div>
+                     <div class="block-type-card" onclick="addBlock('video')">
+                         <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
+                             <polygon points="23 7 16 12 23 17 23 7" />
+                             <rect x="1" y="5" width="15" height="14" rx="2" />
+                         </svg>
+                         <h4>Video</h4>
+                         <p>A video from a link, YouTube or Facebook</p>
+                     </div>
                      <div class="block-type-card" onclick="addBlock('audio')">
                          <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
                              <path d="M9 18V5l12-2v13" />
⋮ 3 unchanged lines ⋮
                          <h4>Audio</h4>
                          <p>An audio player with a link to the music</p>
                      </div>
-                     <div class="block-type-card" onclick="addBlock('countdown')">
+                     <div class="block-type-card" onclick="addBlock('cta')">
                          <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
-                             <circle cx="12" cy="12" r="10" />
-                             <polyline points="12 6 12 12 16 14" />
+                             <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14" />
+                             <polyline points="22 4 12 14.01 9 11.01" />
                          </svg>
-                         <h4>Countdown</h4>
-                         <p>A timer counting down to a date</p>
+                         <h4>CTA</h4>
+                         <p>A short section with a button that asks visitors to act</p>
                      </div>
                      <div class="block-type-card" onclick="addBlock('newsletter')">
                          <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
⋮ 3 unchanged lines ⋮
                          <h4>Newsletter</h4>
                          <p>A form to sign up by email</p>
                      </div>
+                     <div class="block-type-card" onclick="addBlock('countdown')">
+                         <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
+                             <circle cx="12" cy="12" r="10" />
+                             <polyline points="12 6 12 12 16 14" />
+                         </svg>
+                         <h4>Countdown</h4>
+                         <p>A timer counting down to a date</p>
+                     </div>
+                     <div class="block-type-card" onclick="addBlock('announcement')">
+                         <svg fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24">
+                             <path d="M3 11l18-5v12L3 14v-3z" />
+                             <path d="M11.6 16.8a3 3 0 1 1-5.8-1.6" />
+                         </svg>
+                         <h4>Announcement Bar</h4>
+                         <p>A short message strip visitors can close</p>
+                     </div>
+                     <div class="block-type-card" onclick="addBlock('logo-cloud')">
+                         <svg fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24">
+                             <rect x="2" y="8" width="5" height="8" rx="1" />
+                             <rect x="9.5" y="8" width="5" height="8" rx="1" />
+                             <rect x="17" y="8" width="5" height="8" rx="1" />
+                         </svg>
+                         <h4>Logo Cloud</h4>
+                         <p>Logos of your clients or partners</p>
+                     </div>
+                     <div class="block-type-card" onclick="addBlock('steps')">
+                         <svg fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24">
+                             <circle cx="5" cy="12" r="2.5" />
+                             <circle cx="12" cy="12" r="2.5" />
+                             <circle cx="19" cy="12" r="2.5" />
+                             <line x1="7.5" y1="12" x2="9.5" y2="12" />
+                             <line x1="14.5" y1="12" x2="16.5" y2="12" />
+                         </svg>
+                         <h4>Steps / Timeline</h4>
+                         <p>A process in steps or a timeline</p>
+                     </div>
+                     <div class="block-type-card" onclick="addBlock('comparison')">
+                         <svg fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24">
+                             <rect x="3" y="3" width="18" height="18" rx="2" />
+                             <line x1="3" y1="9" x2="21" y2="9" />
+                             <line x1="9" y1="3" x2="9" y2="21" />
+                             <polyline points="12.5 15 14 16.5 17 13.5" />
+                         </svg>
+                         <h4>Comparison Table</h4>
+                         <p>Compare plans or products feature by feature</p>
+                     </div>
+                     <div class="block-type-card" onclick="addBlock('tabs')">
+                         <svg fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24">
+                             <path d="M3 8V5a1 1 0 0 1 1-1h5a1 1 0 0 1 1 1v3" />
+                             <path d="M10 8V6h5v2" />
+                             <rect x="3" y="8" width="18" height="12" rx="1" />
+                         </svg>
+                         <h4>Tabs</h4>
+                         <p>Content split into clickable tabs</p>
+                     </div>
+                     <div class="block-type-card" onclick="addBlock('carousel')">
+                         <svg fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24">
+                             <rect x="5" y="5" width="14" height="11" rx="1.5" />
+                             <polyline points="3 9 1.5 10.5 3 12" />
+                             <polyline points="21 9 22.5 10.5 21 12" />
+                             <circle cx="9" cy="20" r="0.8" fill="currentColor" />
+                             <circle cx="12" cy="20" r="0.8" fill="currentColor" />
+                             <circle cx="15" cy="20" r="0.8" fill="currentColor" />
+                         </svg>
+                         <h4>Carousel</h4>
+                         <p>An image slider with arrows and dots</p>
+                     </div>
+                     <div class="block-type-card" onclick="addBlock('quote')">
+                         <svg fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24">
+                             <path d="M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z" />
+                             <path d="M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z" />
+                         </svg>
+                         <h4>Quote</h4>
+                         <p>One large quote with its author</p>
+                     </div>
+                     <div class="block-type-card" onclick="addBlock('contact-info')">
+                         <svg fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24">
+                             <path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z" />
+                             <circle cx="12" cy="10" r="3" />
+                         </svg>
+                         <h4>Contact Info + Map</h4>
+                         <p>Address, phone, email, hours and a map</p>
+                     </div>
+                     <div class="block-type-card" onclick="addBlock('downloads')">
+                         <svg fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24">
+                             <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
+                             <polyline points="7 10 12 15 17 10" />
+                             <line x1="12" y1="15" x2="12" y2="3" />
+                         </svg>
+                         <h4>Downloads</h4>
+                         <p>Files to download, like PDFs or ZIPs</p>
+                     </div>
+                     <div class="block-type-card" onclick="addBlock('social-follow')">
+                         <svg fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24">
+                             <circle cx="18" cy="5" r="3" />
+                             <circle cx="6" cy="12" r="3" />
+                             <circle cx="18" cy="19" r="3" />
+                             <line x1="8.59" y1="13.51" x2="15.42" y2="17.49" />
+                             <line x1="15.41" y1="6.51" x2="8.59" y2="10.49" />
+                         </svg>
+                         <h4>Social Follow</h4>
+                         <p>Buttons that link to your social profiles</p>
+                     </div>
+                     <div class="block-type-card" onclick="addBlock('spacer')">
+                         <svg fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24">
+                             <line x1="3" y1="12" x2="21" y2="12" />
+                             <polyline points="9 6 12 3 15 6" />
+                             <polyline points="9 18 12 21 15 18" />
+                         </svg>
+                         <h4>Spacer / Divider</h4>
+                         <p>Empty space or a line between blocks</p>
+                     </div>
                      <div class="block-type-card" onclick="addBlock('html')">
                          <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
                              <polyline points="16 18 22 12 16 6" />
⋮ 74 unchanged lines ⋮
          });
      </script>
  
+     <script src="/assets/js/admin-blocks.js?v=<?= filemtime(__DIR__ . '/../assets/js/admin-blocks.js') ?>"></script>
      <script src="/assets/js/admin-editor.js?v=<?= filemtime(__DIR__ . '/../assets/js/admin-editor.js') ?>"></script>
      <?php if (!empty(get_system_settings()['translator_enabled'])): ?>
      <script src="/assets/js/translate.js?v=<?= filemtime(__DIR__ . '/../assets/js/translate.js') ?>"></script>
⋮ 70 unchanged lines ⋮
admin/scripts.php Modified +10 -0
⋮ 7 unchanged lines ⋮
      const PREVIEW_FONT_NAME = <?php echo json_encode($preview_font); ?>;
      const PREVIEW_FONT_HEAD = <?php echo json_encode(font_head_html(site_all_fonts($site_settings))); ?>;
      const PREVIEW_HEADINGS_CSS = <?php echo json_encode(site_fonts_css($site_settings)); ?>;
+     const SOCIAL_ICON_SVGS = <?php
+         $social_icon_map = [];
+         foreach (array_keys(social_platform_labels()) as $social_platform) {
+             if (IconRegistry::isSocialAllowed($social_platform)) {
+                 $social_icon_map[$social_platform] = get_social_icon_svg($social_platform);
+             }
+         }
+         echo json_encode($social_icon_map, JSON_HEX_TAG | JSON_HEX_AMP | JSON_UNESCAPED_SLASHES);
+     ?>;
+     const BLOCK_TIMEZONES =<?php echo json_encode(function_exists('get_publish_timezone_list') ? get_publish_timezone_list() : timezone_identifiers_list()); ?>;
      
      let navLinks = <?php echo json_encode($site_settings['nav_links'] ?? []); ?>;
      let navButtons = <?php echo json_encode($site_settings['nav_buttons'] ?? []); ?>;
⋮ 19 unchanged lines ⋮
assets/js/admin-blocks.js Added +1263 -0
+ const BLOCK_UI_ICONS = {
+     check: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><polyline points="20 6 9 17 4 12"/></svg>',
+     cross: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',
+     close: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',
+     prev: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><polyline points="15 18 9 12 15 6"/></svg>',
+     next: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><polyline points="9 18 15 12 9 6"/></svg>',
+     pin: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/></svg>',
+     phone: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.34 1.85.57 2.81.7A2 2 0 0 1 22 16.92z"/></svg>',
+     mail: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/><polyline points="22,6 12,13 2,6"/></svg>',
+     clock: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>',
+     info: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>',
+     success: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>',
+     warning: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>',
+     accent: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>',
+     download: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>',
+     file: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>',
+     quote: '<svg viewBox="0 0 32 32" fill="currentColor" aria-hidden="true" focusable="false"><path d="M9.3 26C5.4 26 3 23 3 19.3 3 12.6 7.6 7.3 13.7 6l1 2.4c-3.6 1.3-6 4.2-6.3 7.3.5-.2 1.1-.3 1.8-.3 3 0 5.2 2.2 5.2 5.2S13 26 9.3 26zm15.7 0c-3.9 0-6.3-3-6.3-6.7 0-6.7 4.6-12 10.7-13.3l1 2.4c-3.6 1.3-6 4.2-6.3 7.3.5-.2 1.1-.3 1.8-.3 3 0 5.2 2.2 5.2 5.2S28.7 26 25 26z"/></svg>'
+ };
+ 
+ const BLOCK_EDITOR_ICONS = {
+     up: '<svg fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" width="14" height="14"><polyline points="18 15 12 9 6 15"/></svg>',
+     down: '<svg fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" width="14" height="14"><polyline points="6 9 12 15 18 9"/></svg>',
+     plus: '<svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" width="16" height="16"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>',
+     trash: '<svg fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" width="14" height="14"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/></svg>'
+ };
+ 
+ const COMPARISON_YES = ['yes', 'y', 'true', 'tak', 'ja', 'oui', 'sí', 'si', 'sim', 'да', '✓', '✔', '�
+ ', '+'];
+ const COMPARISON_NO = ['no', 'n', 'false', 'nie', 'nein', 'non', 'não', 'нет', '✗', '✕', '✘', 'x', '❌'];
+ const COMPARISON_DASH = ['', '-', '–', '—'];
+ 
+ function bEsc(value) {
+     if (value === null || value === undefined) return '';
+     return String(value)
+         .replace(/&/g, '&amp;')
+         .replace(/</g, '&lt;')
+         .replace(/>/g, '&gt;')
+         .replace(/"/g, '&quot;')
+         .replace(/'/g, '&#39;');
+ }
+ 
+ function bText(value) {
+     if (value === null || value === undefined || typeof value === 'object') return '';
+     return String(value).trim();
+ }
+ 
+ function bLines(value) {
+     return bEsc(bText(value)).replace(/\r\n|\r|\n/g, '<br>');
+ }
+ 
+ function bList(value) {
+     return Array.isArray(value) ? value.filter(item => item && typeof item === 'object' && !Array.isArray(item)) : [];
+ }
+ 
+ function bChoice(value, allowed, fallback) {
+     return allowed.includes(value) ? value : fallback;
+ }
+ 
+ function bInt(value, min, max, fallback) {
+     const number = typeof value === 'number' ? value : (/^-?\d+$/.test(String(value ?? '').trim()) ? parseInt(value, 10) : NaN);
+     if (!Number.isFinite(number)) return fallback;
+     return Math.max(min, Math.min(max, Math.round(number)));
+ }
+ 
+ function bFlag(data, key, fallback) {
+     if (!data || !(key in data)) return fallback;
+     const value = data[key];
+     if (typeof value === 'string') return !['', '0', 'false', 'no', 'off'].includes(value.trim().toLowerCase());
+     return !!value;
+ }
+ 
+ function bIsExternal(url) {
+     return /^(?:https?:)?\/\//i.test(bText(url));
+ }
+ 
+ function bTarget(url) {
+     return bIsExternal(url) ? ' target="_blank" rel="noopener"' : '';
+ }
+ 
+ function bHeader(d) {
+     const title = bText(d.title);
+     const subtitle = bText(d.subtitle);
+     if (!title && !subtitle) return '';
+     return `<div class="section-header">${title ? `<h2>${bEsc(title)}</h2>` : ''}${subtitle ? `<p>${bLines(subtitle)}</p>` : ''}</div>`;
+ }
+ 
+ function blockPlatformLabel(platform) {
+     const found = (typeof SOCIAL_PLATFORMS !== 'undefined' ? SOCIAL_PLATFORMS : []).find(entry => entry[0] === platform);
+     if (platform === 'twitter') return 'X';
+     return found ? found[1] : platform;
+ }
+ 
+ function defaultBlockTimezone() {
+     const zones = typeof BLOCK_TIMEZONES !== 'undefined' && Array.isArray(BLOCK_TIMEZONES) ? BLOCK_TIMEZONES : [];
+     try {
+         const local = Intl.DateTimeFormat().resolvedOptions().timeZone;
+         if (local && zones.includes(local)) return local;
+     } catch (e) {}
+     return zones.includes('Europe/Warsaw') ? 'Europe/Warsaw' : 'UTC';
+ }
+ 
+ function zonedTimeToUtc(date, time, timezone) {
+     const d = /^(\d{4})-(\d{2})-(\d{2})$/.exec(date || '');
+     if (!d) return null;
+     const t = /^([01]\d|2[0-3]):([0-5]\d)(?::([0-5]\d))?$/.exec(time || '') || [null, '00', '00', '00'];
+     const guess = Date.UTC(+d[1], +d[2] - 1, +d[3], +t[1], +t[2], +(t[3] || 0));
+     let formatter;
+     try {
+         formatter = new Intl.DateTimeFormat('en-US', {
+             timeZone: timezone || 'UTC', hourCycle: 'h23',
+             year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit'
+         });
+     } catch (e) {
+         return guess;
+     }
+     const offset = stamp => {
+         const parts = {};
+         formatter.formatToParts(new Date(stamp)).forEach(part => { parts[part.type] = part.value; });
+         return Date.UTC(+parts.year, +parts.month - 1, +parts.day, +parts.hour % 24, +parts.minute, +parts.second) - stamp;
+     };
+     const first = guess - offset(guess);
+     return guess - offset(first);
+ }
+ 
+ function bfLabel(text) {
+     return `<label class="block-field-label">${text}</label>`;
+ }
+ 
+ function bfRow(...cells) {
+     return `<div class="form-row">${cells.join('')}</div>`;
+ }
+ 
+ function bfHint(text) {
+     return `<p class="block-field-hint">${text}</p>`;
+ }
+ 
+ function bfInput(bi, key, label, value, extra = '') {
+     return `<div class="block-field">${bfLabel(label)}<input type="text" class="block-field-input" value="${bEsc(value)}" ${extra} oninput="updateBlockData(${bi}, '${key}', this.value)"></div>`;
+ }
+ 
+ function bfTextarea(bi, key, label, value, extra = '', rich = true) {
+     return `<div class="block-field">${bfLabel(label)}<textarea ${rich ? 'data-rich="1" ' : ''}class="block-field-input block-field-textarea" ${extra} oninput="updateBlockData(${bi}, '${key}', this.value)">${bEsc(value)}</textarea></div>`;
+ }
+ 
+ function bfNumber(bi, key, label, value, min, max, step = 1) {
+     return `<div class="block-field">${bfLabel(label)}<input type="number" class="block-field-input" data-no-translate value="${bEsc(value)}" min="${min}" max="${max}" step="${step}" oninput="updateBlockData(${bi}, '${key}', this.value === '' ? '' : Number(this.value))"></div>`;
+ }
+ 
+ function bfSelect(bi, key, label, value, options, rerender = false) {
+     return `<div class="block-field">${bfLabel(label)}<select class="block-field-input" onchange="updateBlockData(${bi}, '${key}', this.value)${rerender ? '; renderBlocks()' : ''}">${options.map(([optionValue, optionLabel]) => `<option value="${bEsc(optionValue)}" ${String(value) === String(optionValue) ? 'selected' : ''}>${bEsc(optionLabel)}</option>`).join('')}</select></div>`;
+ }
+ 
+ function bfCheck(bi, key, label, checked, rerender = false) {
+     return `<div class="block-field"><label class="block-field-label block-field-check"><input type="checkbox" ${checked ? 'checked' : ''} onchange="updateBlockData(${bi}, '${key}', this.checked)${rerender ? '; renderBlocks()' : ''}">${label}</label></div>`;
+ }
+ 
+ function bfMedia(bi, key, label, value, kind, placeholder = 'https://...') {
+     return `<div class="block-field">${bfLabel(label)}<input type="text" data-media="${kind}" class="block-field-input" value="${bEsc(value)}" placeholder="${bEsc(placeholder)}" oninput="updateBlockData(${bi}, '${key}', this.value)"></div>`;
+ }
+ 
+ function bfLink(bi, key, label, value) {
+     return `<div class="block-field">${bfLabel(label)}${renderLinkInput(value || '', `updateBlockData(${bi}, '${key}', VALUE)`)}</div>`;
+ }
+ 
+ function rfInput(bi, list, i, key, label, value, extra = '') {
+     return `<div class="block-field">${bfLabel(label)}<input type="text" class="block-field-input" value="${bEsc(value)}" ${extra} oninput="updateRepeaterItem(${bi}, '${list}', ${i}, '${key}', this.value)"></div>`;
+ }
+ 
+ function rfTextarea(bi, list, i, key, label, value, extra = '') {
+     return `<div class="block-field">${bfLabel(label)}<textarea data-rich="1" class="block-field-input block-field-textarea" ${extra} oninput="updateRepeaterItem(${bi}, '${list}', ${i}, '${key}', this.value)">${bEsc(value)}</textarea></div>`;
+ }
+ 
+ function rfMedia(bi, list, i, key, label, value, kind, placeholder = 'https://...') {
+     return `<div class="block-field">${bfLabel(label)}<input type="text" data-media="${kind}" class="block-field-input" value="${bEsc(value)}" placeholder="${bEsc(placeholder)}" oninput="updateRepeaterItem(${bi}, '${list}', ${i}, '${key}', this.value)"></div>`;
+ }
+ 
+ function rfLink(bi, list, i, key, label, value) {
+     return `<div class="block-field">${bfLabel(label)}${renderLinkInput(value || '', `updateRepeaterItem(${bi}, '${list}', ${i}, '${key}', VALUE)`)}</div>`;
+ }
+ 
+ function rfSelect(bi, list, i, key, label, value, options) {
+     return `<div class="block-field">${bfLabel(label)}<select class="block-field-input" onchange="updateRepeaterItem(${bi}, '${list}', ${i}, '${key}', this.value); renderBlocks()">${options.map(([optionValue, optionLabel]) => `<option value="${bEsc(optionValue)}" ${String(value) === String(optionValue) ? 'selected' : ''}>${bEsc(optionLabel)}</option>`).join('')}</select></div>`;
+ }
+ 
+ function bfRepeater(bi, list, items, options) {
+     const count = items.length;
+     return `
+         <div class="block-field">
+             ${bfLabel(options.label)}
+             <div class="repeater-items" data-key="${list}">
+                 ${items.map((item, i) => `
+                     <div class="repeater-item">
+                         <div class="repeater-item-header" onclick="this.parentElement.classList.toggle('expanded')">
+                             <span class="repeater-item-title">${bEsc(options.itemTitle(item, i))}</span>
+                             <div class="repeater-item-actions">
+                                 <button type="button" class="btn btn-ghost btn-sm repeater-move" title="Move up" ${i === 0 ? 'disabled' : ''} onclick="event.stopPropagation(); moveRepeaterItem(${bi}, '${list}', ${i}, -1)">${BLOCK_EDITOR_ICONS.up}</button>
+                                 <button type="button" class="btn btn-ghost btn-sm repeater-move" title="Move down" ${i >= count - 1 ? 'disabled' : ''} onclick="event.stopPropagation(); moveRepeaterItem(${bi}, '${list}', ${i}, 1)">${BLOCK_EDITOR_ICONS.down}</button>
+                                 <button type="button" class="btn btn-ghost btn-sm" onclick="event.stopPropagation(); removeRepeaterItem(${bi}, '${list}', ${i})" style="color: var(--error);">Remove</button>
+                             </div>
+                         </div>
+                         <div class="repeater-item-content">${options.fields(item, i)}</div>
+                     </div>`).join('')}
+             </div>
+             <button type="button" class="repeater-add" onclick="addRepeaterItem(${bi}, '${list}', ${bEsc(JSON.stringify(options.defaults))})">${BLOCK_EDITOR_ICONS.plus} ${options.addLabel}</button>
+         </div>`;
+ }
+ 
+ function bfSectionHeader(bi, d) {
+     return bfRow(
+         bfInput(bi, 'title', 'Section Title', d.title || ''),
+         bfInput(bi, 'subtitle', 'Section Subtitle', d.subtitle || '')
+     );
+ }
+ 
+ function moveRepeaterItem(blockIndex, key, itemIndex, dir) {
+     const list = blocks[blockIndex]?.data?.[key];
+     const target = itemIndex + dir;
+     if (!Array.isArray(list) || target < 0 || target >= list.length) return;
+     [list[itemIndex], list[target]] = [list[target], list[itemIndex]];
+     renderBlocks();
+     schedulePreviewUpdate();
+ }
+ 
+ function comparisonData(blockIndex) {
+     const data = blocks[blockIndex].data || (blocks[blockIndex].data = {});
+     if (!Array.isArray(data.columns)) data.columns = [];
+     if (!Array.isArray(data.rows)) data.rows = [];
+     return data;
+ }
+ 
+ function updateComparisonColumn(blockIndex, columnIndex, value) {
+     const data = comparisonData(blockIndex);
+     data.columns[columnIndex] = value;
+     const block = document.querySelector(`.block-item[data-index="${blockIndex}"]`);
+     if (block) {
+         block.querySelectorAll(`[data-cmp-col="${columnIndex}"]`).forEach(el => { el.textContent = value || 'Column ' + (columnIndex + 1); });
+     }
+     schedulePreviewUpdate();
+ }
+ 
+ function addComparisonColumn(blockIndex) {
+     const data = comparisonData(blockIndex);
+     data.columns.push('');
+     data.rows.forEach(row => {
+         if (!Array.isArray(row.values)) row.values = [];
+         while (row.values.length < data.columns.length) row.values.push('');
+     });
+     renderBlocks();
+     schedulePreviewUpdate();
+     const inputs = document.querySelectorAll(`.block-item[data-index="${blockIndex}"] .cmp-column-input`);
+     if (inputs.length) inputs[inputs.length - 1].focus();
+ }
+ 
+ function removeComparisonColumn(blockIndex, columnIndex) {
+     const data = comparisonData(blockIndex);
+     data.columns.splice(columnIndex, 1);
+     data.rows.forEach(row => {
+         if (Array.isArray(row.values)) row.values.splice(columnIndex, 1);
+     });
+     const highlight = bInt(data.highlight, -1, 99, -1);
+     if (highlight === columnIndex) data.highlight = -1;
+     else if (highlight > columnIndex) data.highlight = highlight - 1;
+     renderBlocks();
+     schedulePreviewUpdate();
+ }
+ 
+ function moveComparisonColumn(blockIndex, columnIndex, dir) {
+     const data = comparisonData(blockIndex);
+     const target = columnIndex + dir;
+     if (target < 0 || target >= data.columns.length) return;
+     const swap = list => {
+         while (list.length <= Math.max(columnIndex, target)) list.push('');
+         [list[columnIndex], list[target]] = [list[target], list[columnIndex]];
+     };
+     swap(data.columns);
+     data.rows.forEach(row => {
+         if (!Array.isArray(row.values)) row.values = [];
+         swap(row.values);
+     });
+     const highlight = bInt(data.highlight, -1, 99, -1);
+     if (highlight === columnIndex) data.highlight = target;
+     else if (highlight === target) data.highlight = columnIndex;
+     renderBlocks();
+     schedulePreviewUpdate();
+ }
+ 
+ function updateComparisonValue(blockIndex, rowIndex, columnIndex, value) {
+     const data = comparisonData(blockIndex);
+     const row = data.rows[rowIndex] || (data.rows[rowIndex] = { feature: '', values: [] });
+     if (!Array.isArray(row.values)) row.values = [];
+     while (row.values.length <= columnIndex) row.values.push('');
+     row.values[columnIndex] = value;
+     schedulePreviewUpdate();
+ }
+ 
+ function comparisonCellPreview(value, yesText, noText) {
+     const raw = bText(value);
+     const key = raw.toLowerCase();
+     if (COMPARISON_YES.includes(key)) return `<span class="cmp-mark cmp-yes" title="${bEsc(yesText)}">${BLOCK_UI_ICONS.check}<span class="visually-hidden">${bEsc(yesText)}</span></span>`;
+     if (COMPARISON_NO.includes(key)) return `<span class="cmp-mark cmp-no" title="${bEsc(noText)}">${BLOCK_UI_ICONS.cross}<span class="visually-hidden">${bEsc(noText)}</span></span>`;
+     if (COMPARISON_DASH.includes(key)) return '<span class="cmp-dash" aria-hidden="true">—</span>';
+     return `<span class="cmp-text">${bEsc(raw)}</span>`;
+ }
+ 
+ function contactPhoneHref(phone) {
+     let digits = bText(phone).replace(/[^0-9+]/g, '');
+     if (!digits) return '';
+     let plus = digits[0] === '+';
+     digits = digits.replace(/\+/g, '');
+     if (!plus && digits.startsWith('00')) {
+         plus = true;
+         digits = digits.slice(2);
+     }
+     return digits ? 'tel:' + (plus ? '+' : '') + digits : '';
+ }
+ 
+ function contactMapEmbed(d) {
+     const provider = bChoice(d.map_provider, ['none', 'osm', 'google'], 'none');
+     const zoom = bInt(d.map_zoom, 3, 19, 15);
+     if (provider === 'osm') {
+         const latText = bText(d.map_lat);
+         const lngText = bText(d.map_lng);
+         if (latText === '' || lngText === '' || isNaN(Number(latText)) || isNaN(Number(lngText))) return null;
+         const lat = Number(latText);
+         const lng = Number(lngText);
+         if (lat < -85 || lat > 85 || lng < -180 || lng > 180) return null;
+         const lngSpan = 900 / Math.pow(2, zoom);
+         const latSpan = lngSpan * Math.max(0.2, Math.cos(lat * Math.PI / 180)) * 0.6;
+         const bbox = [lng - lngSpan / 2, lat - latSpan / 2, lng + lngSpan / 2, lat + latSpan / 2].map(n => n.toFixed(6)).join(',');
+         return {
+             src: `https://www.openstreetmap.org/export/embed.html?bbox=${encodeURIComponent(bbox)}&layer=mapnik&marker=${encodeURIComponent(lat.toFixed(6) + ',' + lng.toFixed(6))}`,
+             link: `https://www.openstreetmap.org/?mlat=${lat.toFixed(6)}&mlon=${lng.toFixed(6)}#map=${zoom}/${lat.toFixed(6)}/${lng.toFixed(6)}`
+         };
+     }
+     if (provider === 'google') {
+         const query = bText(d.map_query) || bText(d.address).replace(/\s*\n\s*/g, ', ');
+         if (!query) return null;
+         return {
+             src: `https://www.google.com/maps?q=${encodeURIComponent(query)}&z=${zoom}&output=embed`,
+             link: `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(query)}`
+         };
+     }
+     return null;
+ }
+ 
+ const BLOCK_EXTENSIONS = {
+     countdown: {
+         title: block => block.data?.title || 'Countdown Timer',
+         defaults: () => ({
+             title: 'Coming Soon', subtitle: '', target_date: '', target_time: '00:00', timezone: defaultBlockTimezone(),
+             label_days: 'Days', label_hours: 'Hours', label_minutes: 'Minutes', label_seconds: 'Seconds',
+             expired_action: 'zeros', expired_text: ''
+         }),
+         fields(block, bi) {
+             const d = block.data || {};
+             const zones = typeof BLOCK_TIMEZONES !== 'undefined' && Array.isArray(BLOCK_TIMEZONES) ? BLOCK_TIMEZONES : ['UTC'];
+             const timezone = d.timezone && zones.includes(d.timezone) ? d.timezone : 'UTC';
+             const action = bChoice(d.expired_action, ['zeros', 'message', 'hide'], 'zeros');
+             return bfSectionHeader(bi, d) +
+                 `<div class="form-row-3">
+                     <div class="block-field">${bfLabel('Target Date')}<input type="date" class="block-field-input" value="${bEsc(d.target_date || '')}" oninput="updateBlockData(${bi}, 'target_date', this.value)"></div>
+                     <div class="block-field">${bfLabel('Target Time')}<input type="time" class="block-field-input" value="${bEsc(d.target_time || '00:00')}" oninput="updateBlockData(${bi}, 'target_time', this.value)"></div>
+                     ${bfSelect(bi, 'timezone', 'Timezone', timezone, zones.map(zone => [zone, zone]))}
+                 </div>` +
+                 bfHint('The timer ends at this date and time in the chosen timezone, the same moment for every visitor.') +
+                 `<div class="form-row-4">
+                     ${bfInput(bi, 'label_days', 'Days label', d.label_days ?? 'Days')}
+                     ${bfInput(bi, 'label_hours', 'Hours label', d.label_hours ?? 'Hours')}
+                     ${bfInput(bi, 'label_minutes', 'Minutes label', d.label_minutes ?? 'Minutes')}
+                     ${bfInput(bi, 'label_seconds', 'Seconds label', d.label_seconds ?? 'Seconds')}
+                 </div>` +
+                 bfSelect(bi, 'expired_action', 'When the countdown ends', action, [['zeros', 'Show 00:00:00:00'], ['message', 'Show a message'], ['hide', 'Hide the whole block']], true) +
+                 (action === 'message' ? bfTextarea(bi, 'expired_text', 'Message after the end', d.expired_text || '') : '');
+         },
+         preview(d, id) {
+             if (!/^\d{4}-\d{2}-\d{2}$/.test(d.target_date || '')) return '';
+             const zones = typeof BLOCK_TIMEZONES !== 'undefined' && Array.isArray(BLOCK_TIMEZONES) ? BLOCK_TIMEZONES : ['UTC'];
+             const timezone = d.timezone && zones.includes(d.timezone) ? d.timezone : 'UTC';
+             const target = zonedTimeToUtc(d.target_date, d.target_time || '00:00', timezone);
+             if (target === null) return '';
+             let action = bChoice(d.expired_action, ['zeros', 'message', 'hide'], 'zeros');
+             const message = bText(d.expired_text);
+             if (action === 'message' && !message) action = 'zeros';
+             const labels = [
+                 ['days', bText(d.label_days) || 'Days'],
+                 ['hours', bText(d.label_hours) || 'Hours'],
+                 ['minutes', bText(d.label_minutes) || 'Minutes'],
+                 ['seconds', bText(d.label_seconds) || 'Seconds']
+             ];
+             const expired = target <= Date.now();
+             const showMessage = expired && action === 'message';
+             return `<section class="countdown-section"${id} data-countdown data-target="${target}" data-expired="${action}">
+                 <div class="container">
+                     ${bHeader(d)}
+                     <div class="countdown-timer" role="timer"${showMessage ? ' hidden' : ''}>
+                         ${labels.map(([unit, label]) => `<div class="countdown-item"><div class="countdown-value" data-${unit}>00</div><div class="countdown-label">${bEsc(label)}</div></div>`).join('')}
+                     </div>
+                     ${action === 'message' ? `<p class="countdown-expired"${showMessage ? '' : ' hidden'}>${bLines(message)}</p>` : ''}
+                 </div>
+             </section>`;
+         }
+     },
+ 
+     'logo-cloud': {
+         title: block => block.data?.title || 'Logo Cloud',
+         defaults: () => ({
+             title: 'Trusted by teams everywhere', subtitle: '', layout: 'grid', grayscale: true,
+             logos: [1, 2, 3, 4, 5].map(n => ({ image: `https://placehold.co/200x80?text=Logo+${n}`, alt: `Logo ${n}`, url: '' }))
+         }),
+         fields(block, bi) {
+             const d = block.data || {};
+             return bfSectionHeader(bi, d) +
+                 bfRow(
+                     bfSelect(bi, 'layout', 'Layout', bChoice(d.layout, ['grid', 'marquee'], 'grid'), [['grid', 'Grid'], ['marquee', 'Scrolling row']]),
+                     bfCheck(bi, 'grayscale', 'Show logos in grey, in color on hover', bFlag(d, 'grayscale', true))
+                 ) +
+                 bfRepeater(bi, 'logos', bList(d.logos), {
+                     label: 'Logos',
+                     addLabel: 'Add Logo',
+                     defaults: { image: '', alt: '', url: '' },
+                     itemTitle: (item, i) => item.alt || 'Logo ' + (i + 1),
+                     fields: (item, i) =>
+                         rfMedia(bi, 'logos', i, 'image', 'Logo image', item.image || '', 'image') +
+                         bfRow(
+                             rfInput(bi, 'logos', i, 'alt', 'Company name (alt text)', item.alt || ''),
+                             rfLink(bi, 'logos', i, 'url', 'Link (optional)', item.url || '')
+                         )
+                 });
+         },
+         preview(d, id) {
+             const logos = bList(d.logos).filter(logo => bText(logo.image));
+             if (!logos.length) return '';
+             const layout = bChoice(d.layout, ['grid', 'marquee'], 'grid');
+             const muted = bFlag(d, 'grayscale', true);
+             const item = (logo, decorative) => {
+                 const img = `<img src="${bEsc(bText(logo.image))}" alt="${decorative ? '' : bEsc(bText(logo.alt))}" loading="lazy" decoding="async">`;
+                 const url = bText(logo.url);
+                 if (!url || url === '#') return `<span class="logo-cloud-item"${decorative ? ' aria-hidden="true"' : ''}>${img}</span>`;
+                 return `<a class="logo-cloud-item" href="${bEsc(url)}"${bTarget(url)}${decorative ? ' tabindex="-1" aria-hidden="true"' : ''}>${img}</a>`;
+             };
+             let inner;
+             if (layout === 'marquee') {
+                 const repeat = Math.max(1, Math.ceil(8 / logos.length));
+                 const duration = Math.max(18, logos.length * repeat * 3);
+                 let groups = '';
+                 for (let group = 0; group < 2; group++) {
+                     let items = '';
+                     for (let r = 0; r < repeat; r++) logos.forEach(logo => { items += item(logo, group > 0 || r > 0); });
+                     groups += `<div class="logo-marquee-group"${group > 0 ? ' aria-hidden="true"' : ''}>${items}</div>`;
+                 }
+                 inner = `<div class="logo-marquee" style="--logo-duration: ${duration}s"><div class="logo-marquee-track">${groups}</div></div>`;
+             } else {
+                 inner = `<div class="logo-cloud-grid">${logos.map(logo => item(logo, false)).join('')}</div>`;
+             }
+             return `<section class="logo-cloud logo-cloud-${layout}${muted ? ' logo-cloud-muted' : ''}"${id}><div class="container">${bHeader(d)}${inner}</div></section>`;
+         }
+     },
+ 
+     steps: {
+         title: block => block.data?.title || 'Steps',
+         defaults: () => ({
+             title: 'How it works', subtitle: '', layout: 'horizontal', items: [
+                 { label: '', title: 'Sign up', description: 'Create your account in less than a minute.' },
+                 { label: '', title: 'Set it up', description: 'Pick a template and add your content.' },
+                 { label: '', title: 'Go live', description: 'Publish your site and share it with the world.' }
+             ]
+         }),
+         fields(block, bi) {
+             const d = block.data || {};
+             return bfSectionHeader(bi, d) +
+                 bfSelect(bi, 'layout', 'Layout', bChoice(d.layout, ['horizontal', 'vertical'], 'horizontal'), [['horizontal', 'Steps in a row'], ['vertical', 'Vertical timeline']]) +
+                 bfRepeater(bi, 'items', bList(d.items), {
+                     label: 'Steps',
+                     addLabel: 'Add Step',
+                     defaults: { label: '', title: '', description: '' },
+                     itemTitle: (item, i) => item.title || 'Step ' + (i + 1),
+                     fields: (item, i) =>
+                         bfRow(
+                             rfInput(bi, 'items', i, 'title', 'Title', item.title || ''),
+                             rfInput(bi, 'items', i, 'label', 'Marker (optional)', item.label || '', 'placeholder="Empty = 01, 02, 03… or type a date"')
+                         ) +
+                         rfTextarea(bi, 'items', i, 'description', 'Description', item.description || '')
+                 });
+         },
+         preview(d, id) {
+             const items = bList(d.items).filter(item => bText(item.title) || bText(item.description));
+             if (!items.length) return '';
+             const layout = bChoice(d.layout, ['horizontal', 'vertical'], 'horizontal');
+             const cols = Math.min(4, items.length);
+             return `<section class="steps-section"${id}><div class="container">${bHeader(d)}
+                 <ol class="steps-list steps-${layout} steps-cols-${cols}">
+                     ${items.map((item, i) => `<li class="step-item">
+                         <div class="step-marker" aria-hidden="true">${bEsc(bText(item.label) || String(i + 1).padStart(2, '0'))}</div>
+                         <div class="step-body"><span class="step-eyebrow">${bEsc(bText(item.label) || String(i + 1).padStart(2, '0'))}</span>${bText(item.title) ? `<h3>${bEsc(bText(item.title))}</h3>` : ''}${bText(item.description) ? `<p>${bLines(item.description)}</p>` : ''}</div>
+                     </li>`).join('')}
+                 </ol></div></section>`;
+         }
+     },
+ 
+     comparison: {
+         title: block => block.data?.title || 'Comparison Table',
+         defaults: () => ({
+             title: 'Compare plans', subtitle: '', feature_label: 'Features', columns: ['Free', 'Pro', 'Business'], highlight: 1,
+             yes_text: 'Included', no_text: 'Not included', rows: [
+                 { feature: 'Projects', values: ['1', '10', 'Unlimited'] },
+                 { feature: 'Custom domain', values: ['no', 'yes', 'yes'] },
+                 { feature: 'Priority support', values: ['no', 'no', 'yes'] }
+             ]
+         }),
+         fields(block, bi) {
+             const d = block.data || {};
+             const columns = Array.isArray(d.columns) ? d.columns : [];
+             const highlight = bInt(d.highlight, -1, Math.max(-1, columns.length - 1), -1);
+             const columnName = (name, ci) => bText(name) || 'Column ' + (ci + 1);
+             return bfSectionHeader(bi, d) +
+                 `<div class="form-row-3">
+                     ${bfInput(bi, 'feature_label', 'First column heading', d.feature_label || '')}
+                     ${bfInput(bi, 'yes_text', 'Screen reader text for ✓', d.yes_text ?? 'Included')}
+                     ${bfInput(bi, 'no_text', 'Screen reader text for ✗', d.no_text ?? 'Not included')}
+                 </div>` +
+                 `<div class="block-field">
+                     ${bfLabel('Columns')}
+                     <div class="cmp-columns-editor">
+                         ${columns.map((name, ci) => `<div class="cmp-column-row">
+                             <input type="text" class="block-field-input cmp-column-input" value="${bEsc(name)}" placeholder="Column ${ci + 1}" oninput="updateComparisonColumn(${bi}, ${ci}, this.value)">
+                             <button type="button" class="btn btn-ghost btn-sm repeater-move" title="Move left" ${ci === 0 ? 'disabled' : ''} onclick="moveComparisonColumn(${bi}, ${ci}, -1)">${BLOCK_EDITOR_ICONS.up}</button>
+                             <button type="button" class="btn btn-ghost btn-sm repeater-move" title="Move right" ${ci >= columns.length - 1 ? 'disabled' : ''} onclick="moveComparisonColumn(${bi}, ${ci}, 1)">${BLOCK_EDITOR_ICONS.down}</button>
+                             <button type="button" class="btn btn-ghost btn-sm" style="color: var(--error);" onclick="removeComparisonColumn(${bi}, ${ci})">Remove</button>
+                         </div>`).join('')}
+                     </div>
+                     <button type="button" class="repeater-add" onclick="addComparisonColumn(${bi})">${BLOCK_EDITOR_ICONS.plus} Add Column</button>
+                 </div>` +
+                 `<div class="block-field">${bfLabel('Highlighted column')}<select class="block-field-input" onchange="updateBlockData(${bi}, 'highlight', parseInt(this.value, 10))">
+                     <option value="-1" ${highlight === -1 ? 'selected' : ''}>None</option>
+                     ${columns.map((name, ci) => `<option value="${ci}" ${highlight === ci ? 'selected' : ''} data-cmp-col="${ci}">${bEsc(columnName(name, ci))}</option>`).join('')}
+                 </select></div>` +
+                 bfRepeater(bi, 'rows', bList(d.rows), {
+                     label: 'Rows',
+                     addLabel: 'Add Row',
+                     defaults: { feature: '', values: columns.map(() => '') },
+                     itemTitle: (row, i) => row.feature || 'Row ' + (i + 1),
+                     fields: (row, i) =>
+                         rfInput(bi, 'rows', i, 'feature', 'Feature', row.feature || '') +
+                         (columns.length ? `<div class="cmp-values-grid">${columns.map((name, ci) => `<div class="block-field">
+                             <label class="block-field-label" data-cmp-col="${ci}">${bEsc(columnName(name, ci))}</label>
+                             <input type="text" class="block-field-input" value="${bEsc(Array.isArray(row.values) ? (row.values[ci] ?? '') : '')}" placeholder="yes / no / text" oninput="updateComparisonValue(${bi}, ${i}, ${ci}, this.value)">
+                         </div>`).join('')}</div>` + bfHint('Type yes for ✓, no for ✗, leave empty for —, or write any text.') : bfHint('Add a column first.'))
+                 });
+         },
+         preview(d, id) {
+             const columns = (Array.isArray(d.columns) ? d.columns : []).map(bText);
+             while (columns.length && columns[columns.length - 1] === '') columns.pop();
+             if (!columns.length) return '';
+             const rows = bList(d.rows).map(row => ({ feature: bText(row.feature), values: Array.isArray(row.values) ? row.values : [] }))
+                 .filter(row => row.feature || row.values.some(value => bText(value)));
+             if (!rows.length) return '';
+             const highlight = bInt(d.highlight, -1, columns.length - 1, -1);
+             const yes = bText(d.yes_text) || 'Included';
+             const no = bText(d.no_text) || 'Not included';
+             const regionLabel = bText(d.title) || 'Comparison';
+             const featureLabel = bText(d.feature_label);
+             const hl = ci => ci === highlight ? ' class="is-highlight"' : '';
+             return `<section class="comparison-section"${id}><div class="container">${bHeader(d)}
+                 <div class="comparison-scroll" role="region" aria-label="${bEsc(regionLabel)}" tabindex="0">
+                     <table class="comparison-table">
+                         <thead><tr><th scope="col" class="cmp-feature-head">${featureLabel ? bEsc(featureLabel) : `<span class="visually-hidden">${bEsc(regionLabel)}</span>`}</th>${columns.map((name, ci) => `<th scope="col"${hl(ci)}>${bEsc(name)}</th>`).join('')}</tr></thead>
+                         <tbody>${rows.map(row => `<tr><th scope="row">${bEsc(row.feature)}</th>${columns.map((name, ci) => `<td${hl(ci)}>${comparisonCellPreview(row.values[ci], yes, no)}</td>`).join('')}</tr>`).join('')}</tbody>
+                     </table>
+                 </div></div></section>`;
+         }
+     },
+ 
+     'contact-info': {
+         title: block => block.data?.title || 'Contact Info',
+         defaults: () => ({
+             title: 'Get in touch', subtitle: '', address: '', phone: '', email: '', hours: '',
+             label_address: 'Address', label_phone: 'Phone', label_email: 'Email', label_hours: 'Opening hours',
+             map_provider: 'none', map_lat: '', map_lng: '', map_zoom: 15, map_query: '', map_link_text: 'Open larger map'
+         }),
+         fields(block, bi) {
+             const d = block.data || {};
+             const provider = bChoice(d.map_provider, ['none', 'osm', 'google'], 'none');
+             let map = bfSelect(bi, 'map_provider', 'Map', provider, [['none', 'No map'], ['osm', 'OpenStreetMap (no cookies)'], ['google', 'Google Maps']], true);
+             if (provider === 'osm') {
+                 map += `<div class="form-row-3">
+                     ${bfInput(bi, 'map_lat', 'Latitude', d.map_lat ?? '', 'data-no-translate placeholder="52.229676"')}
+                     ${bfInput(bi, 'map_lng', 'Longitude', d.map_lng ?? '', 'data-no-translate placeholder="21.012229"')}
+                     ${bfNumber(bi, 'map_zoom', 'Zoom (3–19)', d.map_zoom ?? 15, 3, 19)}
+                 </div>` + bfHint('Find the coordinates by right-clicking the place on openstreetmap.org and choosing "Show address".');
+             } else if (provider === 'google') {
+                 map += bfRow(
+                     bfInput(bi, 'map_query', 'Place to show', d.map_query || '', 'placeholder="Empty = use the address above"'),
+                     bfNumber(bi, 'map_zoom', 'Zoom (3–19)', d.map_zoom ?? 15, 3, 19)
+                 ) + bfHint('Google Maps can set cookies in your visitors\' browsers.');
+             }
+             if (provider !== 'none') map += bfInput(bi, 'map_link_text', 'Map link text', d.map_link_text ?? 'Open larger map');
+             return bfSectionHeader(bi, d) +
+                 bfTextarea(bi, 'address', 'Address', d.address || '', 'rows="3"', false) +
+                 bfRow(
+                     bfInput(bi, 'phone', 'Phone', d.phone || '', 'data-no-translate placeholder="+48 123 456 789"'),
+                     bfInput(bi, 'email', 'Email', d.email || '', 'data-no-translate placeholder="hello@example.com"')
+                 ) +
+                 bfTextarea(bi, 'hours', 'Opening hours (one per line)', d.hours || '', 'rows="3" placeholder="Mon–Fri: 9:00–17:00"', false) +
+                 `<div class="form-row-4">
+                     ${bfInput(bi, 'label_address', 'Address label', d.label_address ?? 'Address')}
+                     ${bfInput(bi, 'label_phone', 'Phone label', d.label_phone ?? 'Phone')}
+                     ${bfInput(bi, 'label_email', 'Email label', d.label_email ?? 'Email')}
+                     ${bfInput(bi, 'label_hours', 'Hours label', d.label_hours ?? 'Opening hours')}
+                 </div>` + map;
+         },
+         preview(d, id) {
+             const address = bText(d.address);
+             const phone = bText(d.phone);
+             const email = bText(d.email);
+             const hours = bText(d.hours).split(/\r\n|\r|\n/).map(line => line.trim()).filter(Boolean);
+             const map = contactMapEmbed(d);
+             if (!address && !phone && !email && !hours.length && !map) return '';
+             const labels = {
+                 address: bText(d.label_address) || 'Address',
+                 phone: bText(d.label_phone) || 'Phone',
+                 email: bText(d.label_email) || 'Email',
+                 hours: bText(d.label_hours) || 'Opening hours'
+             };
+             const phoneHref = contactPhoneHref(phone);
+             const emailValid = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
+             const row = (icon, label, value) => `<li class="contact-info-item"><span class="contact-info-icon">${BLOCK_UI_ICONS[icon]}</span><div><span class="contact-info-label">${bEsc(label)}</span>${value}</div></li>`;
+             let list = '';
+             if (address) list += row('pin', labels.address, `<address class="contact-info-value">${bLines(address)}</address>`);
+             if (phone) list += row('phone', labels.phone, phoneHref ? `<a class="contact-info-value" href="${bEsc(phoneHref)}">${bEsc(phone)}</a>` : `<span class="contact-info-value">${bEsc(phone)}</span>`);
+             if (email) list += row('mail', labels.email, emailValid ? `<a class="contact-info-value" href="mailto:${bEsc(email)}">${bEsc(email)}</a>` : `<span class="contact-info-value">${bEsc(email)}</span>`);
+             if (hours.length) {
+                 list += row('clock', labels.hours, `<ul class="contact-hours">${hours.map(line => {
+                     const match = /^(.*?):\s+(.*)$/.exec(line);
+                     return match
+                         ? `<li class="contact-hours-row"><span class="contact-hours-day">${bEsc(match[1])}</span><span class="contact-hours-time">${bEsc(match[2])}</span></li>`
+                         : `<li class="contact-hours-row"><span class="contact-hours-time">${bEsc(line)}</span></li>`;
+                 }).join('')}</ul>`);
+             }
+             const mapHtml = map ? `<div class="contact-map"><iframe src="${bEsc(map.src)}" title="${bEsc(bText(d.title) || labels.address)}" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe><a class="contact-map-link" href="${bEsc(map.link)}" target="_blank" rel="noopener">${bEsc(bText(d.map_link_text) || 'Open larger map')}</a></div>` : '';
+             return `<section class="contact-info-section"${id}><div class="container">${bHeader(d)}
+                 <div class="contact-info-grid${map ? ' has-map' : ''}">${list ? `<ul class="contact-info-list">${list}</ul>` : ''}${mapHtml}</div>
+             </div></section>`;
+         }
+     },
+ 
+     tabs: {
+         title: block => block.data?.title || 'Tabs',
+         defaults: () => ({
+             title: '', subtitle: '', items: [
+                 { label: 'Overview', content: 'Describe the main idea here.', image: '', image_alt: '' },
+                 { label: 'Details', content: 'Add more information in this tab.', image: '', image_alt: '' }
+             ]
+         }),
+         fields(block, bi) {
+             const d = block.data || {};
+             return bfSectionHeader(bi, d) +
+                 bfRepeater(bi, 'items', bList(d.items), {
+                     label: 'Tabs',
+                     addLabel: 'Add Tab',
+                     defaults: { label: '', content: '', image: '', image_alt: '' },
+                     itemTitle: (item, i) => item.label || 'Tab ' + (i + 1),
+                     fields: (item, i) =>
+                         rfInput(bi, 'items', i, 'label', 'Tab name', item.label || '') +
+                         rfTextarea(bi, 'items', i, 'content', 'Content', item.content || '', 'style="min-height: 140px;"') +
+                         bfRow(
+                             rfMedia(bi, 'items', i, 'image', 'Image (optional)', item.image || '', 'image'),
+                             rfInput(bi, 'items', i, 'image_alt', 'Image alt text', item.image_alt || '')
+                         )
+                 });
+         },
+         preview(d, id) {
+             const items = bList(d.items).filter(item => bText(item.label) || bText(item.content) || bText(item.image));
+             if (!items.length) return '';
+             const uid = 'tabs-preview-' + Math.random().toString(36).slice(2, 9);
+             const label = (item, i) => bText(item.label) || 'Tab ' + (i + 1);
+             return `<section class="tabs-section"${id}><div class="container">${bHeader(d)}
+                 <div class="tabs-block" data-tabs>
+                     <div class="tabs-list" role="tablist" aria-label="${bEsc(bText(d.title) || 'Tabs')}">
+                         ${items.map((item, i) => `<button type="button" class="tabs-tab${i === 0 ? ' is-active' : ''}" role="tab" id="${uid}-tab-${i}" aria-controls="${uid}-panel-${i}" aria-selected="${i === 0}" tabindex="${i === 0 ? 0 : -1}">${bEsc(label(item, i))}</button>`).join('')}
+                     </div>
+                     ${items.map((item, i) => `<div class="tabs-panel${i === 0 ? ' is-active' : ''}" role="tabpanel" id="${uid}-panel-${i}" aria-labelledby="${uid}-tab-${i}" tabindex="0">
+                         <h3 class="tabs-panel-title">${bEsc(label(item, i))}</h3>
+                         <div class="tabs-panel-body${bText(item.image) ? ' has-image' : ''}">
+                             ${bText(item.content) ? `<div class="text-content">${bLines(item.content)}</div>` : ''}
+                             ${bText(item.image) ? `<img src="${bEsc(bText(item.image))}" alt="${bEsc(bText(item.image_alt))}" loading="lazy">` : ''}
+                         </div>
+                     </div>`).join('')}
+                 </div></div></section>`;
+         }
+     },
+ 
+     carousel: {
+         title: block => block.data?.title || 'Carousel',
+         defaults: () => ({
+             title: '', subtitle: '', ratio: '16-9', autoplay: false, interval: 5,
+             slides: [1, 2, 3].map(n => ({ image: `https://placehold.co/1600x900?text=Slide+${n}`, alt: `Slide ${n}`, caption: '', url: '' }))
+         }),
+         fields(block, bi) {
+             const d = block.data || {};
+             const autoplay = bFlag(d, 'autoplay', false);
+             return bfSectionHeader(bi, d) +
+                 `<div class="form-row-3">
+                     ${bfSelect(bi, 'ratio', 'Image shape', bChoice(d.ratio, ['16-9', '21-9', '4-3', '3-2', '1-1'], '16-9'), [['16-9', 'Wide 16:9'], ['21-9', 'Panorama 21:9'], ['4-3', 'Classic 4:3'], ['3-2', 'Photo 3:2'], ['1-1', 'Square 1:1']])}
+                     ${bfCheck(bi, 'autoplay', 'Play automatically', autoplay, true)}
+                     ${autoplay ? bfNumber(bi, 'interval', 'Seconds per slide', d.interval ?? 5, 2, 30) : ''}
+                 </div>` +
+                 bfRepeater(bi, 'slides', bList(d.slides), {
+                     label: 'Slides',
+                     addLabel: 'Add Slide',
+                     defaults: { image: '', alt: '', caption: '', url: '' },
+                     itemTitle: (item, i) => item.caption || item.alt || 'Slide ' + (i + 1),
+                     fields: (item, i) =>
+                         rfMedia(bi, 'slides', i, 'image', 'Image', item.image || '', 'image') +
+                         bfRow(
+                             rfInput(bi, 'slides', i, 'alt', 'Alt text', item.alt || ''),
+                             rfInput(bi, 'slides', i, 'caption', 'Caption (optional)', item.caption || '')
+                         ) +
+                         rfLink(bi, 'slides', i, 'url', 'Link (optional)', item.url || '')
+                 });
+         },
+         preview(d, id) {
+             const slides = bList(d.slides).filter(slide => bText(slide.image));
+             if (!slides.length) return '';
+             const ratio = bChoice(d.ratio, ['16-9', '21-9', '4-3', '3-2', '1-1'], '16-9');
+             const autoplay = slides.length > 1 && bFlag(d, 'autoplay', false);
+             const interval = bInt(d.interval, 2, 30, 5);
+             const total = slides.length;
+             return `<section class="carousel-section"${id}><div class="container">${bHeader(d)}
+                 <div class="carousel carousel-ratio-${ratio}" data-carousel data-autoplay="${autoplay ? 1 : 0}" data-interval="${interval * 1000}" role="region" aria-roledescription="carousel" aria-label="${bEsc(bText(d.title) || 'Image carousel')}">
+                     <ul class="carousel-track" aria-live="${autoplay ? 'off' : 'polite'}">
+                         ${slides.map((slide, i) => {
+                             const img = `<img src="${bEsc(bText(slide.image))}" alt="${bEsc(bText(slide.alt))}"${i === 0 ? '' : ' loading="lazy"'} decoding="async">`;
+                             const url = bText(slide.url);
+                             return `<li class="carousel-slide" role="group" aria-roledescription="slide" aria-label="${i + 1} / ${total}"><figure>
+                                 ${url && url !== '#' ? `<a class="carousel-media" href="${bEsc(url)}"${bTarget(url)}>${img}</a>` : `<div class="carousel-media">${img}</div>`}
+                                 ${bText(slide.caption) ? `<figcaption>${bEsc(bText(slide.caption))}</figcaption>` : ''}
+                             </figure></li>`;
+                         }).join('')}
+                     </ul>
+                     ${total > 1 ? `<button type="button" class="carousel-btn carousel-prev" data-carousel-prev aria-label="Previous slide">${BLOCK_UI_ICONS.prev}</button>
+                     <button type="button" class="carousel-btn carousel-next" data-carousel-next aria-label="Next slide">${BLOCK_UI_ICONS.next}</button>
+                     <div class="carousel-dots">${slides.map((slide, i) => `<button type="button" class="carousel-dot${i === 0 ? ' is-active' : ''}" data-carousel-dot="${i}" aria-label="Slide ${i + 1}"${i === 0 ? ' aria-current="true"' : ''}></button>`).join('')}</div>` : ''}
+                 </div></div></section>`;
+         }
+     },
+ 
+     announcement: {
+         title: block => bText(block.data?.text).slice(0, 60) || 'Announcement Bar',
+         defaults: () => ({ style: 'info', text: 'Free shipping on all orders this week.', link_text: 'Learn more', link_url: '#', dismissible: true, close_label: 'Dismiss' }),
+         fields(block, bi) {
+             const d = block.data || {};
+             const dismissible = bFlag(d, 'dismissible', true);
+             return bfSelect(bi, 'style', 'Style', bChoice(d.style, ['info', 'success', 'warning', 'accent'], 'info'), [['info', 'Info (blue)'], ['success', 'Success (green)'], ['warning', 'Warning (amber)'], ['accent', 'Accent (site colors)']]) +
+                 bfTextarea(bi, 'text', 'Message', d.text || '', 'rows="2"') +
+                 bfRow(
+                     bfInput(bi, 'link_text', 'Link text (optional)', d.link_text || ''),
+                     bfLink(bi, 'link_url', 'Link URL', d.link_url || '')
+                 ) +
+                 bfRow(
+                     bfCheck(bi, 'dismissible', 'Visitors can close it', dismissible, true),
+                     dismissible ? bfInput(bi, 'close_label', 'Close button label (for screen readers)', d.close_label ?? 'Dismiss') : ''
+                 ) +
+                 (dismissible ? bfHint('A closed bar stays hidden for that visitor until you change the message.') : '') +
+                 bfHint('Place it first on the page to show it right under the menu.');
+         },
+         preview(d, id) {
+             const text = bText(d.text);
+             if (!text) return '';
+             const style = bChoice(d.style, ['info', 'success', 'warning', 'accent'], 'info');
+             const linkText = bText(d.link_text);
+             const linkUrl = bText(d.link_url);
+             const dismissible = bFlag(d, 'dismissible', true);
+             return `<div class="announcement-bar announcement-${style}"${id}${dismissible ? ' data-announcement="preview"' : ''}>
+                 <div class="container announcement-inner">
+                     <span class="announcement-icon">${BLOCK_UI_ICONS[style]}</span>
+                     <p class="announcement-text"><span>${bEsc(text)}</span>${linkText && linkUrl ? ` <a class="announcement-link" href="${bEsc(linkUrl)}"${bTarget(linkUrl)}>${bEsc(linkText)}</a>` : ''}</p>
+                     ${dismissible ? `<button type="button" class="announcement-close" data-announcement-close aria-label="${bEsc(bText(d.close_label) || 'Dismiss')}">${BLOCK_UI_ICONS.close}</button>` : ''}
+                 </div>
+             </div>`;
+         }
+     },
+ 
+     quote: {
+         title: block => block.data?.author || 'Quote',
+         defaults: () => ({ quote: 'Design is not just what it looks like and feels like. Design is how it works.', author: 'Author Name', role: 'Role, Company', image: '', align: 'center', size: 'large' }),
+         fields(block, bi) {
+             const d = block.data || {};
+             return bfTextarea(bi, 'quote', 'Quote', d.quote || '', 'style="min-height: 120px;"') +
+                 bfRow(
+                     bfInput(bi, 'author', 'Author', d.author || ''),
+                     bfInput(bi, 'role', 'Role or company', d.role || '')
+                 ) +
+                 bfMedia(bi, 'image', 'Author photo (optional)', d.image || '', 'image') +
+                 bfRow(
+                     bfSelect(bi, 'align', 'Alignment', bChoice(d.align, ['center', 'left'], 'center'), [['center', 'Centered'], ['left', 'Left']]),
+                     bfSelect(bi, 'size', 'Text size', bChoice(d.size, ['large', 'medium'], 'large'), [['large', 'Large'], ['medium', 'Medium']])
+                 );
+         },
+         preview(d, id) {
+             const quote = bText(d.quote);
+             if (!quote) return '';
+             const author = bText(d.author);
+             const role = bText(d.role);
+             const image = bText(d.image);
+             const align = bChoice(d.align, ['center', 'left'], 'center');
+             const size = bChoice(d.size, ['large', 'medium'], 'large');
+             return `<section class="quote-section"${id}><div class="container">
+                 <figure class="quote-figure quote-${align} quote-${size}">
+                     <span class="quote-mark">${BLOCK_UI_ICONS.quote}</span>
+                     <blockquote class="quote-text"><p>${bLines(quote)}</p></blockquote>
+                     ${author || role ? `<figcaption class="quote-author">
+                         ${image ? `<img class="quote-avatar" src="${bEsc(image)}" alt="" width="56" height="56">` : ''}
+                         <span class="quote-author-text">${author ? `<cite class="quote-name">${bEsc(author)}</cite>` : ''}${role ? `<span class="quote-role">${bEsc(role)}</span>` : ''}</span>
+                     </figcaption>` : ''}
+                 </figure></div></section>`;
+         }
+     },
+ 
+     downloads: {
+         title: block => block.data?.title || 'Downloads',
+         defaults: () => ({ title: 'Downloads', subtitle: '', button_text: 'Download', files: [] }),
+         fields(block, bi) {
+             const d = block.data || {};
+             return bfSectionHeader(bi, d) +
+                 bfInput(bi, 'button_text', 'Button text', d.button_text ?? 'Download') +
+                 bfRepeater(bi, 'files', bList(d.files), {
+                     label: 'Files',
+                     addLabel: 'Add File',
+                     defaults: { url: '', name: '', description: '' },
+                     itemTitle: (item, i) => item.name || bText(item.url).split('/').pop() || 'File ' + (i + 1),
+                     fields: (item, i) =>
+                         rfMedia(bi, 'files', i, 'url', 'File', item.url || '', 'document', 'Upload a file or paste a link') +
+                         bfRow(
+                             rfInput(bi, 'files', i, 'name', 'Display name', item.name || '', 'placeholder="Empty = file name"'),
+                             rfInput(bi, 'files', i, 'description', 'Short description (optional)', item.description || '')
+                         )
+                 }) +
+                 bfHint('The file type and size are shown automatically for files uploaded here.');
+         },
+         preview(d, id) {
+             const files = bList(d.files).map(file => {
+                 const url = bText(file.url);
+                 if (!url || url === '#' || /^\s*(javascript|vbscript|data|file):/i.test(url)) return null;
+                 const path = url.split('#')[0].split('?')[0];
+                 let base = path.split('/').pop() || '';
+                 try { base = decodeURIComponent(base); } catch (e) {}
+                 const extMatch = /\.([a-z0-9]{1,5})$/i.exec(base);
+                 const ext = extMatch ? extMatch[1].toLowerCase() : '';
+                 return {
+                     url,
+                     ext,
+                     name: bText(file.name) || base.replace(/-[a-f0-9]{8}(\.[a-z0-9]+)$/i, '$1'),
+                     description: bText(file.description),
+                     local: !bIsExternal(url)
+                 };
+             }).filter(Boolean);
+             if (!files.length) return '';
+             const button = bText(d.button_text) || 'Download';
+             return `<section class="downloads-section"${id}><div class="container">${bHeader(d)}
+                 <ul class="downloads-list">${files.map(file => `<li>
+                     <a class="download-item" href="${bEsc(file.url)}"${file.local ? ' download' : ' target="_blank" rel="noopener"'}>
+                         <span class="download-icon">${BLOCK_UI_ICONS.file}${file.ext ? `<span class="download-ext">${bEsc(file.ext.toUpperCase().slice(0, 4))}</span>` : ''}</span>
+                         <span class="download-info">
+                             <span class="download-name">${bEsc(file.name)}</span>
+                             ${file.description ? `<span class="download-desc">${bEsc(file.description)}</span>` : ''}
+                             ${file.ext ? `<span class="download-meta">${bEsc(file.ext.toUpperCase())}</span>` : ''}
+                         </span>
+                         <span class="download-action">${BLOCK_UI_ICONS.download}<span>${bEsc(button)}</span></span>
+                     </a>
+                 </li>`).join('')}</ul></div></section>`;
+         }
+     },
+ 
+     'social-follow': {
+         title: block => block.data?.title || 'Social Follow',
+         defaults: () => ({
+             title: 'Follow us', subtitle: '', style: 'buttons', links: [
+                 { platform: 'instagram', url: '', label: '' },
+                 { platform: 'facebook', url: '', label: '' },
+                 { platform: 'youtube', url: '', label: '' }
+             ]
+         }),
+         fields(block, bi) {
+             const d = block.data || {};
+             const platforms = (typeof SOCIAL_PLATFORMS !== 'undefined' ? SOCIAL_PLATFORMS : []).filter(([value]) => typeof SOCIAL_ICON_SVGS === 'undefined' || SOCIAL_ICON_SVGS[value]);
+             return bfSectionHeader(bi, d) +
+                 bfSelect(bi, 'style', 'Style', bChoice(d.style, ['buttons', 'icons'], 'buttons'), [['buttons', 'Buttons with names'], ['icons', 'Icons only']]) +
+                 bfRepeater(bi, 'links', bList(d.links), {
+                     label: 'Profiles',
+                     addLabel: 'Add Profile',
+                     defaults: { platform: 'twitter', url: '', label: '' },
+                     itemTitle: (item, i) => item.label || blockPlatformLabel(item.platform) || 'Profile ' + (i + 1),
+                     fields: (item, i) =>
+                         bfRow(
+                             rfSelect(bi, 'links', i, 'platform', 'Platform', item.platform || 'twitter', platforms),
+                             rfInput(bi, 'links', i, 'url', 'Profile URL', item.url || '', 'placeholder="https://"')
+                         ) +
+                         rfInput(bi, 'links', i, 'label', 'Button text (optional)', item.label || '', `placeholder="${bEsc(blockPlatformLabel(item.platform || 'twitter'))}"`)
+                 }) +
+                 bfHint('Profiles without a URL are not shown on the site.');
+         },
+         preview(d, id) {
+             const icons = typeof SOCIAL_ICON_SVGS !== 'undefined' ? SOCIAL_ICON_SVGS : {};
+             const links = bList(d.links).map(link => {
+                 const platform = bText(link.platform).toLowerCase().replace(/[^a-z_-]/g, '');
+                 const url = bText(link.url);
+                 if (!platform || !icons[platform] || !url || url === '#' || /^\s*(javascript|vbscript|data|file):/i.test(url)) return null;
+                 return { platform, url, label: bText(link.label) || blockPlatformLabel(platform) };
+             }).filter(Boolean);
+             if (!links.length) return '';
+             const style = bChoice(d.style, ['buttons', 'icons'], 'buttons');
+             return `<section class="social-follow-section"${id}><div class="container">${bHeader(d)}
+                 <ul class="social-follow-list social-follow-${style}">${links.map(link => `<li>
+                     <a class="social-follow-link social-${link.platform}" href="${bEsc(link.url)}" target="_blank" rel="noopener me"${style === 'icons' ? ` aria-label="${bEsc(link.label)}" title="${bEsc(link.label)}"` : ''}>
+                         <span class="social-follow-icon">${icons[link.platform]}</span>${style === 'buttons' ? `<span class="social-follow-label">${bEsc(link.label)}</span>` : ''}
+                     </a>
+                 </li>`).join('')}</ul></div></section>`;
+         }
+     },
+ 
+     spacer: {
+         title: block => {
+             const height = bInt(block.data?.height, 0, 400, 64);
+             const divider = bChoice(block.data?.divider, ['none', 'line', 'dashed', 'dotted', 'wave'], 'none');
+             return `Spacer · ${height}px${divider !== 'none' ? ' · ' + divider : ''}`;
+         },
+         defaults: () => ({ height: 64, divider: 'none' }),
+         fields(block, bi) {
+             const d = block.data || {};
+             return bfRow(
+                 bfNumber(bi, 'height', 'Height in pixels (0–400)', d.height ?? 64, 0, 400, 4),
+                 bfSelect(bi, 'divider', 'Divider', bChoice(d.divider, ['none', 'line', 'dashed', 'dotted', 'wave'], 'none'), [['none', 'None, just space'], ['line', 'Line'], ['dashed', 'Dashed line'], ['dotted', 'Dotted line'], ['wave', 'Wave']])
+             );
+         },
+         preview(d, id) {
+             const height = bInt(d.height, 0, 400, 64);
+             const divider = bChoice(d.divider, ['none', 'line', 'dashed', 'dotted', 'wave'], 'none');
+             let inner = '';
+             if (divider === 'wave') {
+                 inner = '<svg class="spacer-wave" viewBox="0 0 1200 24" preserveAspectRatio="none" focusable="false"><path d="M0 12 C 50 0, 100 0, 150 12 S 250 24, 300 12 S 400 0, 450 12 S 550 24, 600 12 S 700 0, 750 12 S 850 24, 900 12 S 1000 0, 1050 12 S 1150 24, 1200 12" fill="none" stroke="currentColor" stroke-width="2" vector-effect="non-scaling-stroke"/></svg>';
+             } else if (divider !== 'none') {
+                 inner = '<div class="container"><hr class="spacer-line"></div>';
+             }
+             return `<div class="spacer-block spacer-${divider}"${id} style="--spacer-height: ${height}px" aria-hidden="true">${inner}</div>`;
+         }
+     }
+ };
+ 
+ const BLOCK_CLIPBOARD_KEY = 'flatly-block-clipboard';
+ 
+ function blockTypeExists(type) {
+     return typeof type === 'string' && (BLOCK_EXTENSIONS[type] !== undefined || ['hero', 'blog-hero', 'stats', 'features', 'testimonials', 'pricing', 'cta', 'text', 'image', 'image-text', 'product-cards', 'video', 'gallery', 'faq', 'team', 'audio', 'newsletter', 'html'].includes(type));
+ }
+ 
+ function readBlockClipboard() {
+     try {
+         const raw = localStorage.getItem(BLOCK_CLIPBOARD_KEY);
+         if (!raw) return null;
+         const parsed = JSON.parse(raw);
+         if (!parsed || !parsed.block || !blockTypeExists(parsed.block.type)) return null;
+         return parsed;
+     } catch (e) {
+         return null;
+     }
+ }
+ 
+ function showEditorToast(message, type = 'success') {
+     let toast = document.getElementById('editorToast');
+     if (!toast) {
+         toast = document.createElement('div');
+         toast.id = 'editorToast';
+         toast.className = 'editor-toast';
+         toast.setAttribute('role', 'status');
+         toast.setAttribute('aria-live', 'polite');
+         document.body.appendChild(toast);
+     }
+     toast.textContent = message;
+     toast.className = 'editor-toast visible ' + type;
+     clearTimeout(toast._timer);
+     toast._timer = setTimeout(() => { toast.className = 'editor-toast ' + type; }, 2600);
+ }
+ 
+ function copyBlock(index) {
+     const block = blocks[index];
+     if (!block) return;
+     const payload = {
+         version: 1,
+         copiedAt: Date.now(),
+         title: getBlockTitle(block),
+         block: { type: block.type, data: JSON.parse(JSON.stringify(block.data || {})) }
+     };
+     try {
+         localStorage.setItem(BLOCK_CLIPBOARD_KEY, JSON.stringify(payload));
+     } catch (e) {
+         showEditorToast("Couldn't copy the block. Your browser blocked local storage.", 'error');
+         return;
+     }
+     refreshPasteButtons();
+     showEditorToast(`Copied "${payload.title}". Open any page and click "Paste block".`);
+ }
+ 
+ function pasteBlock() {
+     const clip = readBlockClipboard();
+     if (!clip) {
+         refreshPasteButtons();
+         showEditorToast('There is no copied block to paste.', 'error');
+         return;
+     }
+     const type = clip.block.type;
+     blocks.push({ id: getDefaultBlockId(type), type, data: JSON.parse(JSON.stringify(clip.block.data || {})) });
+     renderBlocks();
+     schedulePreviewUpdate();
+     setTimeout(() => {
+         const items = document.querySelectorAll('.block-item');
+         const last = items[items.length - 1];
+         if (last) {
+             last.classList.add('expanded');
+             last.scrollIntoView({ behavior: 'smooth', block: 'center' });
+         }
+     }, 50);
+     showEditorToast(`Pasted "${clip.title || type}".`);
+ }
+ 
+ function clearBlockClipboard() {
+     try { localStorage.removeItem(BLOCK_CLIPBOARD_KEY); } catch (e) {}
+     refreshPasteButtons();
+ }
+ 
+ function refreshPasteButtons() {
+     const clip = readBlockClipboard();
+     document.querySelectorAll('.paste-block-wrap').forEach(wrap => {
+         wrap.hidden = !clip;
+         const label = wrap.querySelector('.paste-block-name');
+         if (label && clip) label.textContent = clip.title || clip.block.type;
+     });
+ }
+ 
+ function toggleBlockHidden(index) {
+     const block = blocks[index];
+     if (!block) return;
+     if (block.hidden) {
+         delete block.hidden;
+     } else {
+         block.hidden = true;
+     }
+     renderBlocks();
+     schedulePreviewUpdate();
+ }
+ 
+ document.addEventListener('DOMContentLoaded', () => {
+     document.querySelectorAll('.add-block-btn').forEach(button => {
+         if (button.parentElement.querySelector('.paste-block-wrap')) return;
+         const wrap = document.createElement('div');
+         wrap.className = 'paste-block-wrap';
+         wrap.hidden = true;
+         wrap.innerHTML = `
+             <button type="button" class="add-block-btn paste-block-btn" onclick="pasteBlock()">
+                 <svg fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" width="18" height="18"><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/><rect x="8" y="2" width="8" height="4" rx="1"/></svg>
+                 Paste block: <span class="paste-block-name"></span>
+             </button>
+             <button type="button" class="paste-block-clear" title="Forget the copied block" aria-label="Forget the copied block" onclick="clearBlockClipboard()">${BLOCK_UI_ICONS.close}</button>`;
+         button.insertAdjacentElement('afterend', wrap);
+     });
+     refreshPasteButtons();
+ });
+ 
+ const BLOCK_SEARCH_KEYWORDS = {
+     hero: 'header banner intro top headline main nagłówek baner wstęp',
+     'blog-hero': 'article post blog header cover artykuł wpis okładka',
+     text: 'paragraph content copy article write tekst akapit treść',
+     'image-text': 'media split picture photo side zdjęcie obraz obok',
+     image: 'picture photo media figure zdjęcie obraz grafika',
+     features: 'benefits services cards grid icons usługi zalety funkcje karty',
+     stats: 'numbers counters facts results metrics liczby statystyki wyniki',
+     pricing: 'plans prices packages subscription cost cennik ceny plany pakiety',
+     'product-cards': 'shop store items catalog products sklep produkty katalog',
+     testimonials: 'reviews opinions feedback clients social proof opinie recenzje klienci',
+     team: 'people staff members about us employees zespół ludzie pracownicy',
+     faq: 'questions answers help accordion pytania odpowiedzi pomoc',
+     gallery: 'photos images grid portfolio galeria zdjęcia',
+     video: 'youtube facebook movie film clip media wideo',
+     audio: 'music podcast sound player muzyka dźwięk',
+     cta: 'call to action button signup convert wezwanie przycisk',
+     newsletter: 'email subscribe signup mailing list form zapis subskrypcja',
+     countdown: 'timer clock launch event deadline sale odliczanie licznik zegar',
+     announcement: 'banner alert notice message bar promo info ogłoszenie komunikat pasek',
+     'logo-cloud': 'logos clients partners brands trusted sponsors loga klienci partnerzy marki',
+     steps: 'timeline process how it works roadmap history kroki proces oś czasu historia',
+     comparison: 'table compare plans features matrix versus tabela porównanie',
+     tabs: 'tabbed switcher sections panels zakładki karty',
+     carousel: 'slider slideshow images gallery swipe karuzela suwak pokaz slajdów',
+     quote: 'citation testimonial blockquote saying cytat',
+     'contact-info': 'address phone email map location hours opening kontakt adres telefon mapa godziny',
+     downloads: 'files pdf documents attachments zip pliki dokumenty do pobrania',
+     'social-follow': 'social media instagram facebook twitter follow profiles społecznościowe obserwuj',
+     spacer: 'divider gap space line separator break odstęp linia separator przerwa',
+     html: 'code embed custom script iframe kod osadzenie'
+ };
+ 
+ function normalizeBlockSearch(text) {
+     return String(text || '')
+         .toLowerCase()
+         .replace(/ł/g, 'l')
+         .normalize('NFD')
+         .replace(/[̀-ͯ]/g, '')
+         .replace(/\s+/g, ' ')
+         .trim();
+ }
+ 
+ function blockSearchCards() {
+     return Array.from(document.querySelectorAll('#addBlockModal .block-type-card'));
+ }
+ 
+ function blockCardType(card) {
+     const match = /addBlock\('([^']+)'\)/.exec(card.getAttribute('onclick') || '');
+     return match ? match[1] : '';
+ }
+ 
+ function visibleBlockCards() {
+     return blockSearchCards()
+         .filter(card => !card.hidden)
+         .sort((a, b) => (parseInt(a.style.order, 10) || 0) - (parseInt(b.style.order, 10) || 0));
+ }
+ 
+ function filterBlockTypes(query) {
+     const terms = normalizeBlockSearch(query).split(' ').filter(Boolean);
+     let shown = 0;
+ 
+     blockSearchCards().forEach(card => {
+         if (!terms.length) {
+             card.hidden = false;
+             card.style.order = '';
+             shown++;
+             return;
+         }
+ 
+         const title = card.dataset.searchTitle || '';
+         const haystack = card.dataset.search || '';
+         const matches = terms.every(term => haystack.startsWith(term) || haystack.includes(' ' + term));
+         card.hidden = !matches;
+         if (!matches) return;
+ 
+         shown++;
+         const first = terms[0];
+         let score = 3;
+         if (title.startsWith(first) || (card.dataset.searchType || '').startsWith(first)) score = 0;
+         else if (title.split(' ').some(word => word.startsWith(first))) score = 1;
+         else if (title.includes(first)) score = 2;
+         card.style.order = String(score);
+     });
+ 
+     const empty = document.getElementById('blockSearchEmpty');
+     if (empty) {
+         empty.hidden = shown > 0;
+         const label = empty.querySelector('[data-block-search-query]');
+         if (label) label.textContent = query.trim();
+     }
+ 
+     const count = document.getElementById('blockSearchCount');
+     if (count) count.textContent = terms.length ? (shown === 1 ? '1 block' : shown + ' blocks') : '';
+ 
+     const body = document.querySelector('#addBlockModal .modal-body');
+     if (body) body.scrollTop = 0;
+ }
+ 
+ function resetBlockSearch(focus) {
+     const input = document.getElementById('blockSearchInput');
+     if (!input) return;
+     input.value = '';
+     filterBlockTypes('');
+     if (focus) setTimeout(() => input.focus({ preventScroll: true }), 30);
+ }
+ 
+ function moveBlockCardFocus(current, step) {
+     const cards = visibleBlockCards();
+     const index = cards.indexOf(current);
+     const target = index + step;
+     if (target < 0) {
+         document.getElementById('blockSearchInput')?.focus();
+         return;
+     }
+     if (cards[target]) cards[target].focus();
+ }
+ 
+ function initBlockSearch() {
+     const modal = document.getElementById('addBlockModal');
+     const grid = modal ? modal.querySelector('.block-types-grid') : null;
+     const body = modal ? modal.querySelector('.modal-body') : null;
+     if (!grid || !body || document.getElementById('blockSearchInput')) return;
+ 
+     const bar = document.createElement('div');
+     bar.className = 'block-search';
+     bar.innerHTML = `
+         <svg class="block-search-icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
+         <input type="search" id="blockSearchInput" class="block-search-input" placeholder="Search blocks, e.g. map, slider, pricing" aria-label="Search blocks" aria-controls="blockTypesGrid" autocomplete="off" spellcheck="false" data-no-translate>
+         <span class="block-search-count" id="blockSearchCount" aria-live="polite"></span>
+         <kbd class="block-search-hint">Enter</kbd>`;
+     body.parentNode.insertBefore(bar, body);
+ 
+     grid.id = 'blockTypesGrid';
+     const empty = document.createElement('div');
+     empty.id = 'blockSearchEmpty';
+     empty.className = 'block-search-empty';
+     empty.hidden = true;
+     empty.innerHTML = 'No blocks match “<span data-block-search-query></span>”. Try another word, or use <strong>Custom HTML</strong>.';
+     grid.insertAdjacentElement('afterend', empty);
+ 
+     blockSearchCards().forEach(card => {
+         const type = blockCardType(card);
+         const title = card.querySelector('h4')?.textContent || '';
+         const description = card.querySelector('p')?.textContent || '';
+         card.dataset.searchType = normalizeBlockSearch(type.replace(/-/g, ' '));
+         card.dataset.searchTitle = normalizeBlockSearch(title);
+         card.dataset.search = normalizeBlockSearch([type, type.replace(/-/g, ' '), title, description, BLOCK_SEARCH_KEYWORDS[type] || ''].join(' '));
+         card.tabIndex = 0;
+         card.setAttribute('role', 'button');
+         card.setAttribute('aria-label', 'Add ' + title + ' block');
+         card.addEventListener('keydown', event => {
+             if (event.key === 'Enter' || event.key === ' ') {
+                 event.preventDefault();
+                 card.click();
+             } else if (event.key === 'ArrowRight' || event.key === 'ArrowDown') {
+                 event.preventDefault();
+                 moveBlockCardFocus(card, event.key === 'ArrowDown' ? blockGridColumns(grid) : 1);
+             } else if (event.key === 'ArrowLeft' || event.key === 'ArrowUp') {
+                 event.preventDefault();
+                 moveBlockCardFocus(card, event.key === 'ArrowUp' ? -blockGridColumns(grid) : -1);
+             } else if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
+                 const input = document.getElementById('blockSearchInput');
+                 input.focus();
+             }
+         });
+     });
+ 
+     const input = document.getElementById('blockSearchInput');
+     input.addEventListener('input', () => filterBlockTypes(input.value));
+     input.addEventListener('keydown', event => {
+         if (event.key === 'Enter') {
+             event.preventDefault();
+             const first = visibleBlockCards()[0];
+             if (first && input.value.trim()) first.click();
+         } else if (event.key === 'ArrowDown') {
+             event.preventDefault();
+             visibleBlockCards()[0]?.focus();
+         } else if (event.key === 'Escape' && input.value) {
+             event.preventDefault();
+             event.stopPropagation();
+             resetBlockSearch(true);
+         }
+     });
+ }
+ 
+ function blockGridColumns(grid) {
+     const columns = getComputedStyle(grid).gridTemplateColumns.split(' ').filter(Boolean).length;
+     return Math.max(1, columns);
+ }
+ 
+ document.addEventListener('DOMContentLoaded', initBlockSearch);
+ 
+ window.addEventListener('storage', event => {
+     if (event.key === BLOCK_CLIPBOARD_KEY || event.key === null) refreshPasteButtons();
+ });
+ 
assets/js/admin-editor.js Modified

Not shown (binary file or too large to diff).

assets/js/blocks.js Added +272 -0
+ (function () {
+     'use strict';
+ 
+     var isPreview = document.documentElement.hasAttribute('data-flatly-preview');
+     var reducedMotion = window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : { matches: false };
+ 
+     function storageGet(key) {
+         try { return window.localStorage.getItem(key); } catch (e) { return null; }
+     }
+ 
+     function storageSet(key, value) {
+         try { window.localStorage.setItem(key, value); } catch (e) {}
+     }
+ 
+     function once(el, name) {
+         var flag = 'flatly' + name + 'Ready';
+         if (el.dataset[flag]) return false;
+         el.dataset[flag] = '1';
+         return true;
+     }
+ 
+     function initTabs(root) {
+         if (!once(root, 'Tabs')) return;
+ 
+         var tabs = Array.prototype.slice.call(root.querySelectorAll('[role="tab"]'));
+         var panels = tabs.map(function (tab) {
+             return document.getElementById(tab.getAttribute('aria-controls'));
+         });
+         if (!tabs.length) return;
+ 
+         function activate(index, focus) {
+             tabs.forEach(function (tab, i) {
+                 var active = i === index;
+                 tab.classList.toggle('is-active', active);
+                 tab.setAttribute('aria-selected', active ? 'true' : 'false');
+                 tab.tabIndex = active ? 0 : -1;
+                 if (panels[i]) {
+                     panels[i].classList.toggle('is-active', active);
+                     panels[i].hidden = !active;
+                 }
+             });
+             if (focus) tabs[index].focus();
+         }
+ 
+         tabs.forEach(function (tab, index) {
+             tab.addEventListener('click', function () {
+                 activate(index, false);
+             });
+             tab.addEventListener('keydown', function (event) {
+                 var target = null;
+                 if (event.key === 'ArrowRight' || event.key === 'ArrowDown') target = (index + 1) % tabs.length;
+                 if (event.key === 'ArrowLeft' || event.key === 'ArrowUp') target = (index - 1 + tabs.length) % tabs.length;
+                 if (event.key === 'Home') target = 0;
+                 if (event.key === 'End') target = tabs.length - 1;
+                 if (target === null) return;
+                 event.preventDefault();
+                 activate(target, true);
+             });
+         });
+ 
+         var initial = tabs.findIndex(function (tab) { return tab.getAttribute('aria-selected') === 'true'; });
+         activate(initial < 0 ? 0 : initial, false);
+         root.classList.add('is-ready');
+     }
+ 
+     function initCarousel(root) {
+         if (!once(root, 'Carousel')) return;
+ 
+         var track = root.querySelector('.carousel-track');
+         if (!track) return;
+         var slides = Array.prototype.slice.call(track.children);
+         var dots = Array.prototype.slice.call(root.querySelectorAll('[data-carousel-dot]'));
+         var prev = root.querySelector('[data-carousel-prev]');
+         var next = root.querySelector('[data-carousel-next]');
+         var autoplay = root.getAttribute('data-autoplay') === '1' && slides.length > 1;
+         var interval = Math.max(2000, parseInt(root.getAttribute('data-interval'), 10) || 5000);
+         var current = 0;
+         var timer = 0;
+         var paused = false;
+         var visible = true;
+         var scrollFrame = 0;
+ 
+         function indexFromScroll() {
+             var width = track.clientWidth || 1;
+             return Math.max(0, Math.min(slides.length - 1, Math.round(track.scrollLeft / width)));
+         }
+ 
+         function sync(index) {
+             current = index;
+             dots.forEach(function (dot, i) {
+                 var active = i === index;
+                 dot.classList.toggle('is-active', active);
+                 if (active) {
+                     dot.setAttribute('aria-current', 'true');
+                 } else {
+                     dot.removeAttribute('aria-current');
+                 }
+             });
+             slides.forEach(function (slide, i) {
+                 slide.setAttribute('aria-hidden', i === index ? 'false' : 'true');
+                 Array.prototype.forEach.call(slide.querySelectorAll('a, button'), function (el) {
+                     if (i === index) {
+                         el.removeAttribute('tabindex');
+                     } else {
+                         el.setAttribute('tabindex', '-1');
+                     }
+                 });
+             });
+         }
+ 
+         function goTo(index) {
+             var total = slides.length;
+             var target = ((index % total) + total) % total;
+             track.scrollTo({ left: target * track.clientWidth, behavior: reducedMotion.matches ? 'auto' : 'smooth' });
+             sync(target);
+         }
+ 
+         function stop() {
+             window.clearTimeout(timer);
+             timer = 0;
+         }
+ 
+         function schedule() {
+             stop();
+             if (!autoplay || paused || !visible || document.hidden || reducedMotion.matches) return;
+             timer = window.setTimeout(function () {
+                 goTo(current + 1);
+                 schedule();
+             }, interval);
+         }
+ 
+         if (prev) prev.addEventListener('click', function () { goTo(current - 1); schedule(); });
+         if (next) next.addEventListener('click', function () { goTo(current + 1); schedule(); });
+         dots.forEach(function (dot) {
+             dot.addEventListener('click', function () {
+                 goTo(parseInt(dot.getAttribute('data-carousel-dot'), 10) || 0);
+                 schedule();
+             });
+         });
+ 
+         root.addEventListener('keydown', function (event) {
+             if (event.target.closest && event.target.closest('input, textarea, select')) return;
+             if (event.key === 'ArrowLeft') { event.preventDefault(); goTo(current - 1); schedule(); }
+             if (event.key === 'ArrowRight') { event.preventDefault(); goTo(current + 1); schedule(); }
+         });
+ 
+         track.addEventListener('scroll', function () {
+             if (scrollFrame) return;
+             scrollFrame = window.requestAnimationFrame(function () {
+                 scrollFrame = 0;
+                 var index = indexFromScroll();
+                 if (index !== current) sync(index);
+             });
+         }, { passive: true });
+ 
+         root.addEventListener('mouseenter', function () { paused = true; stop(); });
+         root.addEventListener('mouseleave', function () { paused = false; schedule(); });
+         root.addEventListener('focusin', function () { paused = true; stop(); });
+         root.addEventListener('focusout', function (event) {
+             if (!root.contains(event.relatedTarget)) {
+                 paused = false;
+                 schedule();
+             }
+         });
+         track.addEventListener('pointerdown', function () { stop(); });
+         track.addEventListener('pointerup', function () { schedule(); });
+         document.addEventListener('visibilitychange', schedule);
+         if (reducedMotion.addEventListener) reducedMotion.addEventListener('change', schedule);
+ 
+         window.addEventListener('resize', function () {
+             track.scrollTo({ left: current * track.clientWidth, behavior: 'auto' });
+         });
+ 
+         if ('IntersectionObserver' in window) {
+             new IntersectionObserver(function (entries) {
+                 visible = entries[0] ? entries[0].isIntersecting : true;
+                 schedule();
+             }, { threshold: 0.25 }).observe(root);
+         }
+ 
+         sync(0);
+         root.classList.add('is-ready');
+         schedule();
+     }
+ 
+     function initAnnouncement(bar) {
+         if (!once(bar, 'Announcement')) return;
+ 
+         var key = 'flatly-announcement:' + bar.getAttribute('data-announcement');
+         if (!isPreview && storageGet(key)) {
+             bar.hidden = true;
+             return;
+         }
+ 
+         var close = bar.querySelector('[data-announcement-close]');
+         if (!close) return;
+         close.addEventListener('click', function () {
+             bar.hidden = true;
+             if (!isPreview) storageSet(key, String(Date.now()));
+         });
+     }
+ 
+     function pad(value) {
+         return value < 10 ? '0' + value : String(value);
+     }
+ 
+     function initCountdown(section) {
+         if (!once(section, 'Countdown')) return;
+ 
+         var target = parseInt(section.getAttribute('data-target'), 10);
+         if (!isFinite(target)) return;
+ 
+         var action = section.getAttribute('data-expired') || 'zeros';
+         var timer = section.querySelector('.countdown-timer');
+         var message = section.querySelector('.countdown-expired');
+         var fields = {
+             days: section.querySelector('[data-days]'),
+             hours: section.querySelector('[data-hours]'),
+             minutes: section.querySelector('[data-minutes]'),
+             seconds: section.querySelector('[data-seconds]')
+         };
+         var handle = 0;
+ 
+         function write(days, hours, minutes, seconds) {
+             if (fields.days) fields.days.textContent = pad(days);
+             if (fields.hours) fields.hours.textContent = pad(hours);
+             if (fields.minutes) fields.minutes.textContent = pad(minutes);
+             if (fields.seconds) fields.seconds.textContent = pad(seconds);
+         }
+ 
+         function finish() {
+             window.clearInterval(handle);
+             write(0, 0, 0, 0);
+             if (action === 'hide' && !isPreview) {
+                 section.hidden = true;
+             } else if (action === 'message' && message) {
+                 if (timer) timer.hidden = true;
+                 message.hidden = false;
+             }
+         }
+ 
+         function tick() {
+             var distance = target - Date.now();
+             if (distance <= 0) {
+                 finish();
+                 return;
+             }
+             var total = Math.floor(distance / 1000);
+             write(Math.floor(total / 86400), Math.floor((total % 86400) / 3600), Math.floor((total % 3600) / 60), total % 60);
+         }
+ 
+         tick();
+         if (target > Date.now()) handle = window.setInterval(tick, 1000);
+     }
+ 
+     function init(scope) {
+         var root = scope || document;
+         Array.prototype.forEach.call(root.querySelectorAll('[data-tabs]'), initTabs);
+         Array.prototype.forEach.call(root.querySelectorAll('[data-carousel]'), initCarousel);
+         Array.prototype.forEach.call(root.querySelectorAll('[data-announcement]'), initAnnouncement);
+         Array.prototype.forEach.call(root.querySelectorAll('[data-countdown]'), initCountdown);
+     }
+ 
+     window.FlatlyBlocks = { init: init };
+ 
+     if (document.readyState === 'loading') {
+         document.addEventListener('DOMContentLoaded', function () { init(document); });
+     } else {
+         init(document);
+     }
+ })();
+ 
config.php Modified +19 -0
⋮ 250 unchanged lines ⋮
              'flac' => ['audio/flac', 'audio/x-flac'],
              'weba' => ['audio/webm', 'video/webm'],
          ],
+         'document' => [
+             'pdf' => ['application/pdf', 'application/x-pdf'],
+             'txt' => ['text/plain'],
+             'csv' => ['text/csv', 'text/plain', 'application/csv', 'text/x-csv'],
+             'rtf' => ['text/rtf', 'application/rtf'],
+             'doc' => ['application/msword', 'application/vnd.ms-office', 'application/CDFV2', 'application/x-ole-storage'],
+             'docx' => ['application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip'],
+             'xls' => ['application/vnd.ms-excel', 'application/vnd.ms-office', 'application/CDFV2', 'application/x-ole-storage'],
+             'xlsx' => ['application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip'],
+             'ppt' => ['application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/CDFV2', 'application/x-ole-storage'],
+             'pptx' => ['application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/zip'],
+             'odt' => ['application/vnd.oasis.opendocument.text', 'application/zip'],
+             'ods' => ['application/vnd.oasis.opendocument.spreadsheet', 'application/zip'],
+             'odp' => ['application/vnd.oasis.opendocument.presentation', 'application/zip'],
+             'epub' => ['application/epub+zip', 'application/zip'],
+             'zip' => ['application/zip', 'application/x-zip-compressed', 'application/x-zip'],
+             '7z' => ['application/x-7z-compressed'],
+             'rar' => ['application/vnd.rar', 'application/x-rar-compressed', 'application/x-rar'],
+         ],
      ];
  }
  
⋮ 620 unchanged lines ⋮
contact.php Modified +2 -1
⋮ 50 unchanged lines ⋮
  $has_newsletter = false;
  
  foreach ($blocks as $block) {
-     if (($block['type'] ?? '') === 'newsletter') {
+     if (($block['type'] ?? '') === 'newsletter' && empty($block['hidden'])) {
          $has_newsletter = true;
          break;
      }
⋮ 360 unchanged lines ⋮
      <?php if ($has_newsletter): ?>
          <script src="/newsletter/newsletter-form.js"></script>
      <?php endif; ?>
+     <?= render_structured_data() ?>
      <?= flatly_custom_html('body_end') ?>
      <?= flatly_custom_js() ?>
  </body>
⋮ 2 unchanged lines ⋮
css/admin.css Modified

Not shown (binary file or too large to diff).

css/styles.css Modified

Not shown (binary file or too large to diff).

engine/renderion.php Modified

Not shown (binary file or too large to diff).

index.php Modified +2 -1
⋮ 34 unchanged lines ⋮
  $has_newsletter = false;
  
  foreach ($blocks as $block) {
-     if (($block['type'] ?? '') === 'newsletter') {
+     if (($block['type'] ?? '') === 'newsletter' && empty($block['hidden'])) {
          $has_newsletter = true;
          break;
      }
⋮ 337 unchanged lines ⋮
      <?php if ($has_newsletter): ?>
          <script src="/newsletter/newsletter-form.js?v=<?= date('YmdH') ?>"></script>
      <?php endif; ?>
+     <?= render_structured_data() ?>
      <?= flatly_custom_html('body_end') ?>
      <?= flatly_custom_js() ?>
  </body>
⋮ 2 unchanged lines ⋮
page.php Modified +2 -1
⋮ 57 unchanged lines ⋮
  $has_newsletter = false;
  
  foreach ($blocks as $block) {
-     if (($block['type'] ?? '') === 'newsletter') {
+     if (($block['type'] ?? '') === 'newsletter' && empty($block['hidden'])) {
          $has_newsletter = true;
          break;
      }
⋮ 277 unchanged lines ⋮
      <?php if ($has_newsletter): ?>
          <script src="/newsletter/newsletter-form.js?v=<?= date('YmdH') ?>"></script>
      <?php endif; ?>
+     <?= render_structured_data() ?>
      <?= flatly_custom_html('body_end') ?>
      <?= flatly_custom_js() ?>
  </body>
⋮ 2 unchanged lines ⋮
version.txt Modified +1 -1
- 3.0.0.2
+ 3.1.0.0