{"html":"<div id=\"wrapper{{uc_id}}\">\n  \n  <div id=\"{{uc_id}}\" style=\"display:none;\" class=\"uc-items-wrapper{{uc_filtering_addclass}}\" data-custom-sethtml=\"true\" {{uc_filtering_attributes|raw}}>\n    {{put_items()}}\n  <\/div>\n  \n  {% if enable_pagination == \"true\" and multisource != \"posts\" %}\n    <div class=\"uc_post_grid_style_one_prev_button_pagination\">\n      <div class=\"uc_post_grid_style_one_prev_button_pagination_wrap\">\n        {% if show_prev_next_page_button == \"true\" %}<button class=\"uc_post_grid_style_one_prev_button uc_post_grid_style_one_pagination_button\" aria-label=\"prev-btn\">{{prev_icon_html|raw}}<\/button>{% endif %}\n        <div class=\"uc_post_grid_style_one_pagination_numbers\"><\/div>\n        {% if show_prev_next_page_button == \"true\" %}<button class=\"uc_post_grid_style_one_next_button uc_post_grid_style_one_pagination_button\" aria-label=\"next-btn\">{{next_icon_html|raw}}<\/button>{% endif %}\n      <\/div>{# end uc_post_grid_style_one_prev_button_pagination_wrap #}{##}\n    <\/div>{# end uc_post_grid_style_one_prev_button_pagination #}{##}\n  {% endif %}{# end show_pagination #}{##}\n  \n<\/div>","html_item":"{{ucfunc(\"put_unite_gallery_item\",item.images)}}","css":"#{{uc_id}}{\n  margin:0 auto;\n  {% if uc_inside_editor == \"no\" %}\n    display: none;\n  {% endif %}\n}\n\n#wrapper{{uc_id}}{\n  min-height:1px;  \n}\n\n{% if lightbox_type == \"none\" %}\n  #{{uc_id}} .ug-thumb-wrapper.ug-tile{\n      pointer-events: none;\n  }\n{% endif %}\n\n\/* pagination *\/\n#wrapper{{uc_id}} .uc_post_grid_style_one_prev_button_pagination{\n  display: flex;\n  align-items: center;\n}\n\n#wrapper{{uc_id}} .uc_post_grid_style_one_pagination_button,\n#wrapper{{uc_id}} .uc_post_grid_style_one_pagination_number{\n  padding: 0;\n  justify-content: center;\n  align-items: center;\n  transition: all .3s ease;\n  margin: 0;\n}\n\n#wrapper{{uc_id}} .uc_post_grid_style_one_pagination_number:last-child,\n#wrapper{{uc_id}} .uc_post_grid_style_one_pagination_number:first-child{\n  display: inline-flex;\n  position: relative;\n}\n\n#wrapper{{uc_id}} .ue-hidden{\n  display: none;\n}\n\n#wrapper{{uc_id}} .ue-disabled{\n  opacity: .5;\n  pointer-events: none;\n}\n\n#wrapper{{uc_id}} .uc_post_grid_style_one_pagination_number.ue-visible{\n  display: inline-flex;\n}\n\n#wrapper{{uc_id}} .uc_post_grid_style_one_pagination_numbers{\n  display: flex;\n  flex-wrap: wrap;\n}\n\n#wrapper{{uc_id}} .uc_post_grid_style_one_prev_button_pagination_wrap{\n  display: flex;\n}\n\/* end pagination *\/","js":"{{ ucfunc(\"put_docready_start\") }}\n\t\t\n  var objWrapper = jQuery(\"#{{uc_id}}\");\n  var options = {\n      \n      gallery_theme:\"tiles\",\n      gallery_width:\"{{gallery_width}}\",\n      \n      tiles_type: \"{{gallery_type}}\",   \n      tiles_align:\"{{tiles_align}}\",\n      tiles_col_width:{{tiles_col_width_nounit}},\n      tiles_justified_space_between:{{tiles_space_between_cols_nounit}},                                 \n      tiles_space_between_cols:{{tiles_space_between_cols_nounit}},\n      tiles_space_between_cols_mobile: {{tiles_space_between_cols_mobile_nounit}},\n      tile_as_link: {{tile_as_link}},\n      tile_link_newpage: {{tile_link_newpage}},\n      tiles_min_columns: {{tiles_min_columns_nounit}},\n      tile_overlay_opacity: {{tile_overlay_opacity_nounit}},\n      tile_overlay_color: \"{{tile_overlay_color}}\",   \n      tile_background_color: \"{{tile_background_color}}\",                               \n      slider_video_autoplay:{{autoplay_video_in_lightbox}},\n      \n      \n      {% if tile_enable_border == \"true\" %}\n      tile_enable_border:{{tile_enable_border}},\n      tile_border_color:\"{{tile_border_color}}\",\n      tile_border_width:{{tile_border_width_nounit}},\n      tile_border_radius:{{tile_border_radius_nounit}}, \n      \n      {% endif %}\t\n      \n      {% if tile_enable_shadow == \"true\" %}\n      tile_enable_shadow:{{tile_enable_shadow}},\n      tile_shadow_color:\"{{tile_shadow_color}}\",\n      tile_shadow_h:{{tile_shadow_h_nounit}},\t\t\t\t\t\n      tile_shadow_v:{{tile_shadow_v_nounit}},\t\t\t\t\t\n      tile_shadow_blur:{{tile_shadow_blur_nounit}},\t\t\t\t\t\n      tile_shadow_spread:{{tile_shadow_spread_nounit}},\n      {% endif %}                               \n      \n      {% if tile_enable_image_effect == \"true\" %}\n      tile_enable_image_effect:{{tile_enable_image_effect}},\n      tile_image_effect_type: \"{{tile_image_effect_type}}\",\n      tile_image_effect_reverse: {{tile_image_effect_reverse}},\n      {% endif %}   \n      \n      tile_enable_textpanel:{{tile_enable_textpanel}},\n      tile_textpanel_source:\"{{text_panel_source}}\",\n      tile_textpanel_always_on: {{tile_textpanel_always_on}},\n      tile_textpanel_appear_type: \"{{tile_textpanel_appear_type}}\",\n      tile_textpanel_position:\"{{tile_textpanel_position}}\",\n      tile_textpanel_padding_top:{{tile_textpanel_padding_nounit}},\t\t \t\n      tile_textpanel_padding_bottom:{{tile_textpanel_padding_nounit}},\t \t\n      tile_textpanel_padding_right: {{tile_textpanel_padding_nounit}},\t \t\n      tile_textpanel_padding_left: {{tile_textpanel_padding_nounit}},\n      tile_textpanel_bg_color:\"{{tile_textpanel_bg_color}}\",\n      tile_textpanel_bg_opacity:{{tile_textpanel_bg_opacity_nounit}},\n      tile_textpanel_title_text_align:\"{{tile_textpanel_title_text_align}}\",\n      tile_textpanel_title_color:\"{{tile_textpanel_title_color}}\",\n      \n      lightbox_type: \"{{lightbox_type}}\",\n      lightbox_hide_arrows_onvideoplay: {{lightbox_hide_arrows_onvideoplay}},\n      lightbox_arrows_position: \"{{lightbox_arrows_position}}\",                                \n      lightbox_overlay_color:\"{{lightbox_overlay_color}}\",\n      lightbox_overlay_opacity:{{lightbox_overlay_opacity_nounit}},\t\n      lightbox_show_numbers: {{lightbox_show_numbers}},\n      lightbox_show_textpanel: {{lightbox_show_textpanel}},\n      lightbox_slider_control_swipe:{{lightbox_slider_control_swipe}},\n      lightbox_slider_control_zoom:{{lightbox_slider_control_zoom}},\n      lightbox_textpanel_title_text_align:\"{{lightbox_textpanel_title_text_align}}\",\n      \n      lightbox_slider_image_border: {{lightbox_slider_image_border}},\n      lightbox_slider_image_border_width: {{lightbox_slider_image_border_width_nounit}},\n      lightbox_slider_image_border_color: \"{{lightbox_slider_image_border_color}}\",\n      lightbox_slider_image_border_radius: {{lightbox_slider_image_border_radius_nounit}},\n      lightbox_close_icon_type: \"{{lightbox_close_icon_type}}\",        \/\/close icon type: default, custom\n      lightbox_close_icon_color: \"{{lightbox_close_icon_color_default}}\",        \/\/close icon color\n      lightbox_close_icon_color_custom: \"{{lightbox_close_icon_color_custom}}\",  \n      lightbox_close_icon_custom: `{{lightbox_close_icon_custom_html|ucsafe|raw}}`,        \/\/close icon custom html  \n      lightbox_close_icon_size_custom: \"{{lightbox_close_icon_size_custom_nounit}}\",\n      lightbox_arrows_type: \"{{lightbox_arrows_icon_type}}\",        \/\/arrow type: default, custom\n      lightbox_arrows_color: \"{{lightbox_arrows_icon_color_default}}\",        \/\/arrow color\n      lightbox_arrows_color_custom: \"{{lightbox_arrows_icon_color_custom}}\",        \/\/arrow color\n      lightbox_arrow_next_custom: `{{lightbox_arrows_icon_next_html|ucsafe|raw}}`,        \/\/arrow html\n      lightbox_arrow_prev_custom: `{{lightbox_arrows_icon_prev_html|ucsafe|raw}}`,        \/\/arrow html\n      lightbox_arrows_size_custom: {{lightbox_arrows_icon_size_custom_nounit}},        \/\/arrow size custom\n      slider_video_muted: {{mute_video}},   \n      \n      tile_enable_icons: {{tile_enable_icons}},\n      tile_icon_type: \"{{tile_icons_type}}\",\t\t\t\t\/\/tile icon type: default \/ custom\n      tile_zoom_icon_color: \"{{zoom_icon_color_def}}\",      \/\/tile icon color\n      tile_play_icon_color: \"{{play_icon_color_def}}\",      \/\/tile icon color\n      tile_link_icon_color: \"{{link_icon_color_def}}\",      \/\/tile icon color\n      tile_zoom_icon_custom: `{{tile_zoom_icon_custom_html|ucsafe|raw}}`,\t\t\t\t\/\/tile zoom icon type: default \/ custom\n      tile_play_icon_custom: `{{tile_play_icon_custom_html|ucsafe|raw}}`,\t\t\t\t\/\/tile play icon type: default \/ custom\n      tile_link_icon_custom: `{{tile_link_icon_custom_html|ucsafe|raw}}`,\t\t\t\t\/\/tile link icon type: default \/ custom        \n    }\n    \n    var api = objWrapper.unitegallery(options);\n    \n    objWrapper.on(\"uc_ajax_sethtml\",function(event, htmlItems, isAppend){      \n      if(isAppend == true)\n        api.addItems(htmlItems);         \n      else\n      api.changeItems(htmlItems);  \n      \n      if(!htmlItems)\n        api.showMessageReplaceGallery(\"{{empty_message|ucsafe|raw}}\");      \n    });\n    \n    \/\/native pagination feature\n    var objContentGrid = jQuery('#wrapper{{uc_id}}');\n    var objItems = objContentGrid.find(\".ug-thumb-wrapper\");\n    var objPaginationNumbers = objContentGrid.find(\".uc_post_grid_style_one_pagination_numbers\");\n    var pobjPaginatedList = objContentGrid.find(\".uc_post_grid_style_one_wrap\");\n    var objNextButton = objContentGrid.find(\".uc_post_grid_style_one_next_button\");\n    var objPrevButton = objContentGrid.find(\".uc_post_grid_style_one_prev_button\");\n    var itemsPerPage = Number(\"{{items_number_per_page}}\");\n    var totalItems = objItems.length;\n    var pageCount = Math.ceil(totalItems \/ itemsPerPage);\n    var currentPage = 1;\n    var isPagesEnabled = \"{{enable_pagination}}\";\n    \n    var classActive = \"ue-active\";\n    var classVisible = \"ue-visible\";\n    var classDisabled = \"ue-disabled\";\n    var classHidden = \"ue-hidden\";\n    var classSelected = \"ue-selected\";\n    var classPageNumber = \"uc_post_grid_style_one_pagination_number\";\n    \n    var strJson = {{put_items_json()}};\n    var arrItems = JSON.parse(strJson);   \n    \n    \/**\n    * scroll to top\n    *\/\n    function scrollToTop(obj, num){\n      var offsetTop = obj.offset().top;\n      \n      jQuery(\"html\").animate({ scrollTop: (offsetTop + num) }, 500);\n    }\n    \n    \/**\n    * disable button\n    *\/\n    function disableButton(objButton){\n      objButton.addClass(classDisabled);\n    }\n    \n    \/**\n    * enable button\n    *\/\n    function enableButton(objButton){\n      objButton.removeClass(classDisabled);\n    }\n    \n    \/**\n    * handle status\n    *\/\n    function handlePageButtonsStatus(){\n      if (currentPage === 1) {\n        disableButton(objPrevButton);\n      } else {\n        enableButton(objPrevButton);\n      }\n      \n      if (pageCount === currentPage) {\n        disableButton(objNextButton);\n      } else {\n        enableButton(objNextButton);\n      }\n      \n      setTimeout(function(){\n        var objPages = objContentGrid.find(\".\"+classPageNumber);\n        \n        if(!objPages || objPages.length == 0){\n          disableButton(objPrevButton);\n          disableButton(objNextButton);\n        } \n      },300);      \n    }\n    \n    \/**\n    * handle active state\n    *\/\n    function handleActivePageNumber(){\n      const pagesNum = document.querySelectorAll(\".\"+classPageNumber).length;\n      \n      document.querySelectorAll(\".\"+classPageNumber).forEach((button) => {\n        button.classList.remove(classActive);\n        button.classList.remove(classVisible); \n        \n        const pageIndex = Number(button.getAttribute(\"page-index\"));\n        \n        if (pageIndex == currentPage) {\n          button.classList.add(classActive);        \n        }        \n      });\n    }\n    \n    \/*\n    ** append nums\n    *\/\n    function appendPageNumber(index){\n      const pageNumber = document.createElement(\"button\");\n      pageNumber.className = classPageNumber;\n      pageNumber.innerHTML = index;\n      pageNumber.setAttribute(\"page-index\", index);\n      pageNumber.setAttribute(\"aria-label\", \"Page \" + index);\n      \n      objPaginationNumbers[0].appendChild(pageNumber);\n    }\n    \n    \/**\n    * returns pages num\n    *\/\n    function setPaginationNumbers(){\n      for (let i = 1; i <= pageCount; i++) {\n        appendPageNumber(i);\n      }\n    }\n    \n    \/**\n    * get current item by index\n    *\/\n    function getCurrentItem(item){\n      var obj = jQuery(item);\n      var objImg = obj.find(\"img\"); \n      var index = obj.index();\n      var lightboxImageSrc = arrItems[index].images.image;\n      var dataTitle = arrItems[index].images.title;\n      var dataDescr = arrItems[index].images.description;\n      var dataType = arrItems[index].images.type;\n      var dataMP4 = arrItems[index].images.url_mp4;\n      var dataVideoID = arrItems[index].images.videoid;\n      \n      var src = objImg.attr(\"src\");\n      var htmlToAdd = `<a href=\"\"\/><img src=\"${src}\" data-image=\"${lightboxImageSrc}\" data-title=\"${dataTitle}\" data-description=\"${dataDescr}\" data-type=\"${dataType}\" data-videomp4=\"${dataMP4}\" data-videoid=\"${dataVideoID}\" alt=\"\" \/>`;\n      \n      return(htmlToAdd);\n    }\n    \n    \/**\n    * sets current page\n    *\/\n    function setCurrentPage(pageNum, isFiltered, isScrollToTop){\n      currentPage = Number(pageNum);\n      \n      handleActivePageNumber();\n      handlePageButtonsStatus();\n      \n      const prevRange = (pageNum - 1) * itemsPerPage;\n      const currRange = pageNum * itemsPerPage;\n      \n      \/\/ Get the filtered items if isFiltered is true\n      let itemsToDisplay;\n      \n      if (isFiltered) {\n        itemsToDisplay = objItems.filter('.'+classSelected);\n      } else {\n        itemsToDisplay = objItems;\n      }\n      \n      \/\/ Calculate total number of filtered items\n      const totalFilteredItems = itemsToDisplay.length;\n      \n      \/\/ Hide all items first\n      objItems.each(function(index, item) {\n        item.classList.add(classHidden);\n      });      \n      \n      \/\/ Show filtered items if available\n      if (isFiltered && totalFilteredItems > 0) {\n        itemsToDisplay.each(function(index, item) {\n          \/\/ Check if the index falls within the current page range\n          if (index >= prevRange && index < currRange) {\n            item.classList.remove(classHidden); \/\/ Show the item if it's in range            \n          }\n        });\n      } else {\n        var galleryItems = [];\n        \n        \/\/ If no filtering or no filtered items, show all items in range\n        objItems.each(function(index, item) {\n          \n          if (index >= prevRange && index < currRange) {\n            item.classList.remove(classHidden); \/\/ Show the item if it's in range\n            \n            galleryItems += getCurrentItem(item);\n          }\n        });\n        \n        api.changeItems(galleryItems); \/\/resizes the widget\n      }\n      \n      if(isScrollToTop)\n        scrollToTop(objContentGrid, -80, false);\n    }; \n    \n    \/**\n    * get all gallery items\n    *\/\n    function getAllGalleryItems(){\n      var allGalleryItems;\n      \n      objItems.each(function(){\n        var obj = jQuery(this);\n        var objImg = obj.find(\"img\");\n        var src = objImg.attr(\"src\");\n        var htmlToAdd = `<a href=\"\"\/><img src=\"${src}\" \/>`\n        \n        allGalleryItems+=htmlToAdd;\n      });\n      \n      return(allGalleryItems);\n    }   \n    \n    if(isPagesEnabled == \"true\" && `{{multisource}}` != \"posts\"){\n      \n      setTimeout(function(){\n        setPaginationNumbers();\n        setCurrentPage(1, true, false);\n        var htmlVisibleItems = objContentGrid.find(\".ug-thumb-wrapper:not(.ue-hidden)\");\n        \n        \/\/init events\n        objPrevButton.on(\"click\", function(){\n          setCurrentPage(currentPage - 1, true, true);\n        });\n        \n        objNextButton.on(\"click\", function(){\n          setCurrentPage(currentPage + 1, true, true);\n          \n        });\n        \n        objContentGrid.on(\"click\", \".\"+classPageNumber, function(){\n          var objButton = jQuery(this);\n          var pageIndex = objButton.attr(\"page-index\");\n          \n          if(pageIndex){\n            setCurrentPage(pageIndex, true, true);\n          }\n        });     \n      },500)\n    }\n    \t\n{{ ucfunc(\"put_docready_end\") }}"}