jQuery(document).ready(function(a){"use strict";[{name:"instagram",selector:".wpsr-ig-feed-wrapper"},{name:"facebook_feed",selector:".wpsr-fb-feed-wrapper"},{name:"tiktok",selector:".wpsr-tiktok-feed-wrapper"},{name:"youtube",selector:".wpsr-yt-feed-wrapper"}].forEach(e=>{var r=a(e.selector);if(0!==r.length){var s=e.name;r.each(function(){var e="#"+a(this).attr("id"),r=e.replace(/#wpsr-(fb-feed|tiktok-feed|yt-feed|ig-feed)-/,""),i=window.wpsr_ajax_params.upload_url,t={action:"wpsr_resize_images",id:r,platform:s,nonce:window.wpsr_ajax_params&&window.wpsr_ajax_params.wpsr_nonce?window.wpsr_ajax_params.wpsr_nonce:""},o={instagram:"ig",facebook_feed:"fb",tiktok:"tt",youtube:"yt"}[s]||"";a.ajax({url:window.wpsr_ajax_params.ajax_url,type:"post",data:t}).then(t=>{if(t){if(window.wpsr_optimized_feed_ids)window.wpsr_optimized_feed_ids[r]=t;else{var d={[r]:t};window.wpsr_optimized_feed_ids=d}var n=t.match(/({[^{}]+})/g),p=JSON.parse(n),w=(c=window.wpsr_ajax_params&&window.wpsr_ajax_params.image_settings&&window.wpsr_ajax_params.image_settings.image_format?window.wpsr_ajax_params.image_settings.image_format:"",["jpg","webp"].includes(c)?c:"jpg");p.account_id&&a(e).find(".wpsr-ig-header-logo").each(function(e){var r=a(this).data("account_id");if(r&&(r=r.toString())===p.account_id){var s=i+"/instagram/"+r+"."+w;a(this).find("img").attr("src",s)}}),p.images_data&&a(e).find(".wpsr-".concat(o,"-post")).each(function(e){var r=a(this),t=r.attr("data-post_id"),d=r.data("image_size");if(t){t=t.toString();var n=r.attr("data-user_name");if(n&&p.images_data.includes(t)){var c=i+"/"+s+"/"+n+"/"+t+"_"+d+"."+w;r.find(".wpsr-".concat(o,"-feed-image")).removeClass("wpsr-animated-background"),r.find(".wpsr-".concat(o,"-feed-video-preview")).removeClass("wpsr-animated-background"),r.find(".wpsr-".concat(o,"-feed-image")).css("height","auto"),r.find(".wpsr-".concat(o,"-feed-image")).removeClass("wpsr-hide"),r.find(".wpsr-".concat(o,"-post-img")).attr("src",c),r.find(".wpsr-".concat(o,"-post-img")).addClass("wpsr-show"),r.find(".wpsr-".concat(o,"-post-img")).removeClass("wpsr-hide"),r.find(".wpsr-".concat(o,"-post-img")).removeClass("wpsr-animated-background"),r.find(".wpsr-".concat(o,"-post-media")).removeClass("wpsr-animated-background"),r.find(".wpsr-".concat(o,"-feed-video-preview")).removeClass("wpsr-animated-background")}}})}var c}).catch(a=>{console.error(a)})})}})});