jQuery((function(t){!function(){"use strict";var a={},i=null;function e(){if(null!==i||1>Object.keys(a).length)return!1;cancelAnimationFrame(i);var e=dittyVars.updateInterval?parseInt(dittyVars.updateInterval):60,d=Date.now();i=requestAnimationFrame((function s(){var o,n=Date.now();Math.floor((n-d)/1e3)>=e&&(d=n,o={action:"ditty_live_updates",live_ids:a,security:dittyVars.security},t.post(dittyVars.ajaxurl,o,(function(i){i.updated_items&&t.each(i.updated_items,(function(i,e){!function(a,i){t('.ditty[data-id="'+a+'"]').each((function(){var e=t(this).data("type");"development"===dittyVars.mode&&window.console&&console.log(`LIVE UPDATE: ${a}`),t(this)[`ditty_${e}`]("loadItems",i,"static")}))}(i,e),a[i].timestamp=Math.floor(t.now()/1e3)}))}),"json")),i=requestAnimationFrame(s)}))}t.each(dittyVars.globals,(function(a,i){var e=t(i.selector);if(i.ditty&&void 0!==e[0]){var d=i.edit_links?i.edit_links:"",s=t('<div class="ditty" data-id="'+i.ditty+'" data-ajax_load="1">'+d+"</div>");switch(i.display&&""!==i.display&&s.attr("data-display",i.display),i.live_updates&&"1"===String(i.live_updates)&&s.attr("data-live_updates","1"),i.custom_id&&""!==i.custom_id&&s.attr("id",i.custom_id),i.custom_classes&&""!==i.custom_classes&&s.addClass(i.custom_classes),i.position){case"prepend":t(e[0]).prepend(s);break;case"before":t(e[0]).before(s);break;case"after":t(e[0]).after(s);break;default:t(e[0]).append(s)}}})),t(".ditty").each((function(){var i=t(this),d=!!i.data("ajax_load")&&i.data("ajax_load"),s=!!i.data("live_updates")&&i.data("live_updates"),o=!!i.data("display_settings")&&i.data("display_settings"),n=!!i.data("layout_settings")&&i.data("layout_settings"),l=!!i.data("show_editor")&&i.data("show_editor");if(d){var r={action:"ditty_init",id:!!i.data("id")&&i.data("id"),uniqid:!!i.data("uniqid")&&i.data("uniqid"),display:i.data("display")?i.data("display"):"",display_settings:o,layout_settings:n,editor:l,security:dittyVars.security};t.post(dittyVars.ajaxurl,r,(function(d){if(!d.display_type||"function"!=typeof i["ditty_"+d.display_type])return window.console&&console.log("Ditty Display type not loaded:",d.display_type),!1;i["ditty_"+d.display_type](d.args),!l&&s&&(a[i.data("id")]={timestamp:Math.floor(t.now()/1e3),layout_settings:n},e())}),"json")}else!l&&s&&(a[i.data("id")]={timestamp:Math.floor(t.now()/1e3),layout_settings:n},e())}))}()}));