var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,d,b){a instanceof String&&(a=String(a));for(var c=a.length,h=0;h<c;h++){var e=a[h];if(d.call(b,e,h,a))return{i:h,v:e}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,d,b){a!=Array.prototype&&a!=Object.prototype&&(a[d]=b.value)};
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,d,b,c){if(d){b=$jscomp.global;a=a.split(".");for(c=0;c<a.length-1;c++){var h=a[c];h in b||(b[h]={});b=b[h]}a=a[a.length-1];c=b[a];d=d(c);d!=c&&null!=d&&$jscomp.defineProperty(b,a,{configurable:!0,writable:!0,value:d})}};
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,b){return $jscomp.findInternal(this,a,b).v}},"es6","es3");
jQuery(document).ready(function(a){a(".grw-admin-page a.nav-tab").on("click",function(b){var d=a(this),c=d.attr("href");a(c).show().siblings(".tab-content").hide();d.addClass("nav-tab-active").siblings().removeClass("nav-tab-active");b.preventDefault()});var d=a("#grw-rate_us");if(d.length){var b=function(){setTimeout(function(){d.addClass("grw-flash-gout");d.removeClass("grw-flash-visible");d.removeClass("grw-flash-gout")},1E3)},c=a("#grw-rate_us-feedback"),h=a("#grw-rate_us-feedback-stars");grw_svg_init();
-1<window.location.href.indexOf("grw_feed_new=1")&&d.addClass("grw-flash-visible");a(".wp-star",d).click(function(){var d=a(this).index()+1;3<d?(a.post({url:ajaxurl,type:"POST",dataType:"json",data:{action:"grw_rateus_ajax",rate:d},success:function(a){console.log(a)}}),d=0<(1*Math.random()).toFixed(0)?"https://g.page/r/CZac_S7-Dh2NEBM/review":"https://wordpress.org/support/plugin/widget-google-reviews/reviews/?rate="+d+"#new-post",window.open(d,"_blank"),b()):(h.attr("data-rate",d),h.html(grw_stars(d,
"#fb8e28",24)),c.dialog({modal:!0,width:"50%",maxWidth:"600px"}),a(".ui-widget-overlay").bind("click",function(){c.dialog("close")}))});a(".grw-rate_us-cancel").click(function(){c.dialog("close")});a(".grw-rate_us-send").click(function(){a.post({url:ajaxurl,type:"POST",dataType:"json",data:{action:"grw_rateus_ajax_feedback",rate:h.attr("data-rate"),email:a("input",c).val(),msg:a("textarea",c).val()},success:function(a){c.dialog({title:"Feedback sent"});c.html('<b style="color:#4cc74b">Thank you for your feedback!<br>We received it and will investigate your suggestions.</b>');
b();setTimeout(function(){c.fadeOut(500,function(){c.dialog("close")})},1500)}})})}if(a("#grw-overview-rating").length){var e=function(b,d){var c={action:"grw_overview_ajax"};b&&(c.place_id=b);jQuery.post({url:ajaxurl,type:"POST",dataType:"json",data:c,success:function(c){if(c){var e=1<c.places.length?c.places.find(function(a){return a.id==b}):c.places[0],h=null;if(c.stats_minmax.length)for(var f={},q=0,n=((new Date).getTime()/1E3).toFixed(0),l=0;l<c.stats_minmax.length;l++){var t=c.stats_minmax[l],
r=t.google_place_id;q=!q||t.time<q?t.time:q;f[r]?(f[r]={time:parseInt(n-f[r].time),rating:parseFloat((t.rating-f[r].rating).toFixed(1)),review_count:parseInt(t.review_count-f[r].review_count)},h=h?{time:f[r].time,rating:h.rating+f[r].rating,review_count:h.review_count+f[r].review_count}:f[r],delete f[r]):f[r]={time:q,rating:t.rating,review_count:t.review_count}}f=a("#grw-overview-stats");f.html("Not calculated yet");h&&(q=h.rating,n=h.review_count,f.html('<div class="grw-overview-h">While using the plugin</div><div>Usage time: <span class="grw-stat-val grw-stat-up">'+
grw_s2dmy(h.time)+'</span></div><div>Rating up: <span class="grw-stat-val grw-stat-'+(0>q?"down":0<q?"up":"")+'">'+q+'</span></div><div>Reviews up: <span class="grw-stat-val grw-stat-'+(0>n?"down":0<n?"up":"")+'">'+n+"</span></div>"));u.html('<div class="wp-gr"><div class="grw-overview-h">'+e.name+'</div><div><span class="wp-google-rating">'+c.rating+'</span><span class="wp-google-stars">'+grw_stars(c.rating,"#fb8e28",20)+'</span></div><div class="wp-google-powered">Based on '+c.review_count+" reviews</div>"+
(e.updated?'<div class="wp-google-powered">Last updated: <span class="wp-google-time">'+WPacTime.getTime(parseInt(e.updated),_rplg_lang(),"ago")+"</span></div>":"")+"</div>");var w="";a.each(c.reviews,function(a,b){w+=grw_review(b)});x.html('<div class="wp-gr wpac"><div class="wp-google-reviews">'+w+"</div></div>");_rplg_timeago(document.querySelectorAll(".wpac [data-time]"));_rplg_read_more();a(".wp-review-hide",x).unbind("click").click(function(){grw_review_hide(a(this));return!1});h={};for(e=0;e<
c.stats.length;e++)f=c.stats[e],q=f.google_place_id,h[q]=h[q]||[],h[q].push({time:parseInt(f.time),rating:parseFloat(f.rating),review_count:parseInt(f.review_count)});e=parseInt((c.stats[0].time-c.stats[c.stats.length-1].time)/2592E3);q=4<e?k:e||1;e={};n=new Date;for(l=0;l<q;l++)for(g in f=new Date(n.getFullYear(),n.getMonth()-l,1),t=(new Date(n.getFullYear(),n.getMonth()+1-l,0)).getTime(),r=f.toLocaleString("default",{month:"short"})+" "+f.getFullYear().toString().slice(-2),e[r]=e[r]||{},h){var y=
0,z=h[g];do{f=z[y++];var A=1E3*f.time;e[r][g]=e[r][g]||{};e[r][g].count=parseInt(f.review_count)}while(A>t&&y<z.length)}h=[];f=[];q=[];n={};for(m in e){l=0;for(p in e[m])l+=e[m][p].count,t=c.places.find(function(a){return a.id==p}),n[t.name]=n[t.name]||{},n[t.name].data=n[t.name].data||[],n[t.name].data.unshift(e[m][p].count);h.unshift(m);f.unshift(l)}for(tt in n)q.push({name:tt,data:n[tt].data});e={series:[{name:"Reviews",data:f}],chart:{height:350,type:"bar"},plotOptions:{bar:{dataLabels:{position:"top"}}},
dataLabels:{enabled:!0,offsetY:-20,style:{fontSize:"12px",colors:["#304758"]}},tooltip:{enabled:!0,intersect:!1,custom:function(){return""}},xaxis:{categories:h,axisBorder:{show:!1},axisTicks:{show:!1},tooltip:{enabled:!0}},yaxis:{axisBorder:{show:!1},axisTicks:{show:!1}},title:{text:"Monthly reviews count",align:"center",style:{color:"#444"}}};v?v.updateOptions({series:[{name:"Reviews",data:f}],xaxis:{categories:h}}):(v=new ApexCharts(document.querySelector("#chart"),e),v.render());d&&d(c)}else window.location.href=
GRW_VARS.builderUrl}})},k=6,f=a("#grw-overview-places"),l=a("#grw-overview-months"),u=a("#grw-overview-rating"),x=a("#grw-overview-reviews"),v=null;grw_svg_init();f.change(function(){e(this.value)});l.change(function(){k=this.value;e(f.val())});e(0,function(b){a.each(b.places,function(b,c){f.append(a("<option>",{value:c.id,text:c.name}))})})}});function grw_svg_init(){var a=document.createElement("span");a.style.display="none";a.innerHTML=grw_svg();document.body.appendChild(a)}
function grw_svg(){return'<svg><defs><g id="rp-star" width="17" height="17"><path d="M1728 647q0 22-26 48l-363 354 86 500q1 7 1 20 0 21-10.5 35.5t-30.5 14.5q-19 0-40-12l-449-236-449 236q-22 12-40 12-21 0-31.5-14.5t-10.5-35.5q0-6 2-20l86-500-364-354q-25-27-25-48 0-37 56-46l502-73 225-455q19-41 49-41t49 41l225 455 502 73q56 9 56 46z"></path></g><g id="rp-star-half" width="17" height="17"><path d="M1250 957l257-250-356-52-66-10-30-60-159-322v963l59 31 318 168-60-355-12-66zm452-262l-363 354 86 500q5 33-6 51.5t-34 18.5q-17 0-40-12l-449-236-449 236q-23 12-40 12-23 0-34-18.5t-6-51.5l86-500-364-354q-32-32-23-59.5t54-34.5l502-73 225-455q20-41 49-41 28 0 49 41l225 455 502 73q45 7 54 34.5t-24 59.5z"></path></g><g id="rp-star-o" width="17" height="17"><path d="M1201 1004l306-297-422-62-189-382-189 382-422 62 306 297-73 421 378-199 377 199zm527-357q0 22-26 48l-363 354 86 500q1 7 1 20 0 50-41 50-19 0-40-12l-449-236-449 236q-22 12-40 12-21 0-31.5-14.5t-10.5-35.5q0-6 2-20l86-500-364-354q-25-27-25-48 0-37 56-46l502-73 225-455q19-41 49-41t49 41l225 455 502 73q56 9 56 46z" fill="#ccc"></path></g><g id="rp-logo-g" height="44" width="44" fill="none" fill-rule="evenodd"><path d="M482.56 261.36c0-16.73-1.5-32.83-4.29-48.27H256v91.29h127.01c-5.47 29.5-22.1 54.49-47.09 71.23v59.21h76.27c44.63-41.09 70.37-101.59 70.37-173.46z" fill="#4285f4"></path><path d="M256 492c63.72 0 117.14-21.13 156.19-57.18l-76.27-59.21c-21.13 14.16-48.17 22.53-79.92 22.53-61.47 0-113.49-41.51-132.05-97.3H45.1v61.15c38.83 77.13 118.64 130.01 210.9 130.01z" fill="#34a853"></path><path d="M123.95 300.84c-4.72-14.16-7.4-29.29-7.4-44.84s2.68-30.68 7.4-44.84V150.01H45.1C29.12 181.87 20 217.92 20 256c0 38.08 9.12 74.13 25.1 105.99l78.85-61.15z" fill="#fbbc05"></path><path d="M256 113.86c34.65 0 65.76 11.91 90.22 35.29l67.69-67.69C373.03 43.39 319.61 20 256 20c-92.25 0-172.07 52.89-210.9 130.01l78.85 61.15c18.56-55.78 70.59-97.3 132.05-97.3z" fill="#ea4335"></path><path d="M20 20h472v472H20V20z"></path></g></defs></svg>'}
function grw_stars(a,d,b){for(var c="",h=1;6>h;h++){var e=a-h;c=0<=e?c+grw_star("",d,b):-1<e&&0>e?-.75>e?c+grw_star("-o","#ccc",b):-.25<e?c+grw_star("",d,b):c+grw_star("-half",d,b):c+grw_star("-o","#ccc",b)}return c}function grw_star(a,d,b){return'<span class="wp-star"><svg viewBox="0 0 1792 1792" width="'+b+'" height="'+b+'"><use xlink:href="#rp-star'+a+'" fill="'+d+'"/></svg></span>'}
function grw_review(a){return'<div class="wp-google-review'+(""==a.hide?"":" wp-review-hidden")+'"><div class="wp-google-right"><a href="'+a.author_url+'" class="wp-google-name" target="_blank" rel="nofollow noopener">'+a.author_name+'</a><div class="wp-google-time" data-time="'+a.time+'"></div><div class="wp-google-feedback"><span class="wp-google-stars">'+grw_stars(a.rating,"#fb8e28",16)+'</span><span class="wp-google-text">'+grw_trimtext(a.text,50)+'</span></div><a href="#" class="wp-review-hide" data-id="'+
a.id+'">'+(""==a.hide?"Hide":"Show")+" review</a></div></div>"}function grw_trimtext(a,d){if(d&&a&&a.length>d){var b=a.substring(0,d).indexOf(" ")+1;if(1>b||d-b>d/2)b=d;var c=d="";0<b&&(d=a.substring(0,b-1),c=a.substring(b-1,a.length));return d+(c?'<span>... </span><span class="wp-more">'+c+'</span><span class="wp-more-toggle">read more</span>':"")}return a}function grw_s2dmy(a){a=(a/86400).toFixed(0);return 30<a?365<a?Math.round(a/365)+" years":Math.round(a/30)+" months":a+" days"}
var GRW_AUTOSAVE_KEYUP_TIMEOUT=1500,GRW_AUTOSAVE_TIMEOUT=null,GRW_LANGS=[["ar","Arabic"],["bg","Bulgarian"],["bn","Bengali"],["ca","Catalan"],["cs","Czech"],["da","Danish"],["de","German"],["el","Greek"],["en","English"],["es","Spanish"],["eu","Basque"],["eu","Basque"],["fa","Farsi"],["fi","Finnish"],["fil","Filipino"],["fr","French"],["gl","Galician"],["gu","Gujarati"],["hi","Hindi"],["hr","Croatian"],["hu","Hungarian"],["id","Indonesian"],["it","Italian"],["iw","Hebrew"],["ja","Japanese"],["kn",
"Kannada"],["ko","Korean"],["lt","Lithuanian"],["lv","Latvian"],["ml","Malayalam"],["mr","Marathi"],["nl","Dutch"],["no","Norwegian"],["pl","Polish"],["pt","Portuguese"],["pt-BR","Portuguese (Brazil)"],["pt-PT","Portuguese (Portugal)"],["ro","Romanian"],["ru","Russian"],["sk","Slovak"],["sl","Slovenian"],["sr","Serbian"],["sv","Swedish"],["ta","Tamil"],["te","Telugu"],["th","Thai"],["tl","Tagalog"],["tr","Turkish"],["uk","Ukrainian"],["vi","Vietnamese"],["zh","Chinese (Simplified)"],["zh-Hant","Chinese (Traditional)"]],
GRW_HTML_CONTENT='<div class="grw-builder-platforms grw-builder-inside"><div class="grw-builder-connect grw-connect-google">Google Connection</div><div id="grw-connect-wizard" title="Easy steps to connect Google Reviews" style="display:none;"><p><span>1</span> Find your Google place on the map below (<u class="grw-wiz-arr">Enter a location</u>) and copy found <u><b>Place ID</b></u></p><iframe src="https://geo-devrel-javascript-samples.web.app/samples/places-placeid-finder/app/dist" loading="lazy" style="width:100%;height:250px"></iframe><small style="font-size:13px;color:#555">If you can\'t find your place on this map, please read <a href="'+
GRW_VARS.supportUrl+'&grw_tab=fig#place_id" target="_blank">this manual how to find any Google Place ID</a>.</small><p><span>2</span> Paste copied <u><b>Place ID</b></u> in this field and select language if needed</p><p><input type="text" class="grw-connect-id" value="" placeholder="Place ID" /><select class="grw-connect-lang"><option value="" selected="selected">Choose language if needed</option><option value="ar">Arabic</option><option value="bg">Bulgarian</option><option value="bn">Bengali</option><option value="ca">Catalan</option><option value="cs">Czech</option><option value="da">Danish</option><option value="de">German</option><option value="el">Greek</option><option value="en">English</option><option value="es">Spanish</option><option value="eu">Basque</option><option value="eu">Basque</option><option value="fa">Farsi</option><option value="fi">Finnish</option><option value="fil">Filipino</option><option value="fr">French</option><option value="gl">Galician</option><option value="gu">Gujarati</option><option value="hi">Hindi</option><option value="hr">Croatian</option><option value="hu">Hungarian</option><option value="id">Indonesian</option><option value="it">Italian</option><option value="iw">Hebrew</option><option value="ja">Japanese</option><option value="kn">Kannada</option><option value="ko">Korean</option><option value="lt">Lithuanian</option><option value="lv">Latvian</option><option value="ml">Malayalam</option><option value="mr">Marathi</option><option value="nl">Dutch</option><option value="no">Norwegian</option><option value="pl">Polish</option><option value="pt">Portuguese</option><option value="pt-BR">Portuguese (Brazil)</option><option value="pt-PT">Portuguese (Portugal)</option><option value="ro">Romanian</option><option value="ru">Russian</option><option value="sk">Slovak</option><option value="sl">Slovenian</option><option value="sr">Serbian</option><option value="sv">Swedish</option><option value="ta">Tamil</option><option value="te">Telugu</option><option value="th">Thai</option><option value="tl">Tagalog</option><option value="tr">Turkish</option><option value="uk">Ukrainian</option><option value="vi">Vietnamese</option><option value="zh">Chinese (Simplified)</option><option value="zh-Hant">Chinese (Traditional)</option></select></p><p><span>3</span> Click CONNECT GOOGLE button</p><button class="grw-connect-btn">Connect Google</button><small class="grw-connect-error"></small></div><div class="grw-connections"></div></div><div class="grw-connect-options"><div class="grw-builder-inside"><div class="grw-builder-option">Layout<select id="view_mode" name="view_mode"><option value="slider" selected="selected">Slider</option><option value="grid">Grid</option><option value="list">List</option></select></div></div><div class="grw-builder-top grw-toggle">Common Options</div><div class="grw-builder-inside" style="display:none"><div class="grw-builder-option">Pagination<input type="text" name="pagination" value=""></div><div class="grw-builder-option">Maximum characters before \'read more\' link<input type="text" name="text_size" value=""></div><div class="grw-builder-option"><label><input type="checkbox" name="header_center" value="">Show rating by center</label></div><div class="grw-builder-option"><label><input type="checkbox" name="header_hide_photo" value="">Hide business photo</label></div><div class="grw-builder-option"><label><input type="checkbox" name="header_hide_name" value="">Hide business name</label></div><div class="grw-builder-option"><label><input type="checkbox" name="hide_based_on" value="">Hide \'Based on ... reviews\'</label></div><div class="grw-builder-option"><label><input type="checkbox" name="hide_writereview" value="">Hide \'review us on G\' button</label></div><div class="grw-builder-option"><label><input type="checkbox" name="header_hide_social" value="">Hide rating header, leave only reviews</label></div><div class="grw-builder-option"><label><input type="checkbox" name="hide_reviews" value="">Hide reviews, leave only rating header</label></div></div><div class="grw-builder-top grw-toggle">Slider Options</div><div class="grw-builder-inside" style="display:none"><div class="grw-builder-option">Speed in second<input type="text" name="slider_speed" value="" placeholder="Default: 5"></div><div class="grw-builder-option">Text height<input type="text" name="slider_text_height" value="" placeholder="Default: 100px"></div><div class="grw-builder-option"><label><input type="checkbox" name="slider_autoplay" value="" checked>Auto-play</label></div><div class="grw-builder-option"><label><input type="checkbox" name="slider_hide_prevnext" value="">Hide prev & next buttons</label></div><div class="grw-builder-option"><label><input type="checkbox" name="slider_hide_dots" value="">Hide dots</label></div></div><div class="grw-builder-top grw-toggle">Style Options</div><div class="grw-builder-inside" style="display:none"><div class="grw-builder-option"><label><input type="checkbox" name="dark_theme">Dark background</label></div><div class="grw-builder-option"><label><input type="checkbox" name="hide_backgnd" value="">Hide reviews background</label></div><div class="grw-builder-option"><label><input type="checkbox" name="show_round" value="">Round reviews borders</label></div><div class="grw-builder-option"><label><input type="checkbox" name="show_shadow" value="">Show reviews shadow</label></div><div class="grw-builder-option"><label><input type="checkbox" name="centered" value="">Place by center (only if max-width is set)</label></div><div class="grw-builder-option">Container max-width<input type="text" name="max_width" value="" placeholder="for instance: 300px"><small>Be careful: this will make reviews unresponsive</small></div><div class="grw-builder-option">Container max-height<input type="text" name="max_height" value="" placeholder="for instance: 500px"></div></div><div class="grw-builder-top grw-toggle">Advance Options</div><div class="grw-builder-inside" style="display:none"><div class="grw-builder-option"><label><input type="checkbox" name="lazy_load_img" checked>Lazy load images</label></div><div class="grw-builder-option"><label><input type="checkbox" name="google_def_rev_link">Use default Google reviews link</label><span class="grw-quest grw-quest-top grw-toggle" title="Click to help">?</span><div class="grw-quest-help" style="display:none;">If the direct link to all reviews <b>https://search.google.com/local/reviews?placeid=&lt;PLACE_ID&gt;</b> does not work with your Google place (leads to 404), please use this option to use the default reviews link to Google map.</div></div><div class="grw-builder-option"><label><input type="checkbox" name="open_link" checked>Open links in new Window</label></div><div class="grw-builder-option"><label><input type="checkbox" name="nofollow_link" checked>Use no follow links</label></div><div class="grw-builder-option">Reviewer avatar size<select name="reviewer_avatar_size"><option value="56" selected="selected">Small: 56px</option><option value="128">Medium: 128px</option><option value="256">Large: 256px</option></select></div><div class="grw-builder-option">Cache data<select name="cache"><option value="1">1 Hour</option><option value="3">3 Hours</option><option value="6">6 Hours</option><option value="12" selected="selected">12 Hours</option><option value="24">1 Day</option><option value="48">2 Days</option><option value="168">1 Week</option><option value="">Disable (NOT recommended)</option></select></div><div class="grw-builder-option">Reviews limit<input type="text" name="reviews_limit" value=""></div></div></div>';
function grw_builder_init(a,d){var b=document.querySelector(d.el);if(b){b.innerHTML=GRW_HTML_CONTENT;var c=a("#grw-connect-wizard");d.conns&&d.conns.connections&&d.conns.connections.length?grw_deserialize_connections(a,b,d):(a(".grw-connect-google").hide(),c.dialog({modal:!0,width:"50%",maxWidth:"600px",closeOnEscape:!1,open:function(){a(".ui-dialog-titlebar-close").hide()}}));grw_connection(a,c[0],"google",d.authcode);a('.grw-connect-options input[type="text"],.grw-connect-options textarea').keyup(function(){clearTimeout(GRW_AUTOSAVE_TIMEOUT);
GRW_AUTOSAVE_TIMEOUT=setTimeout(grw_serialize_connections,GRW_AUTOSAVE_KEYUP_TIMEOUT)});a('.grw-connect-options input[type="checkbox"],.grw-connect-options select').change(function(){grw_serialize_connections()});a(".grw-toggle",b).unbind("click").click(function(){a(this).toggleClass("toggled");a(this).next().slideToggle()});a(".grw-builder-connect.grw-connect-google").click(function(){c.dialog({modal:!0,width:"50%",maxWidth:"600px"})});a(".grw-connections").sortable&&(a(".grw-connections").sortable({stop:function(a,
b){grw_serialize_connections()}}),a(".grw-connections").disableSelection());a(".wp-review-hide").click(function(){grw_review_hide(a(this));return!1});a("#grw_save").click(function(){grw_serialize_connections();return!1});window.addEventListener("beforeunload",function(a){if(GRW_AUTOSAVE_TIMEOUT)return(a||window.event).returnValue="It looks like you have been editing something. If you leave before saving, your changes will be lost."})}}
function grw_feed_save_ajax(){if(!window.grw_title.value)return window.grw_title.focus(),!1;window.grw_save.innerText="Auto save, wait";window.grw_save.disabled=!0;jQuery.post(ajaxurl,{post_id:window.grw_post_id.value,title:window.grw_title.value,content:document.getElementById("grw-builder-connection").value,action:"grw_feed_save_ajax",grw_nonce:jQuery("#grw_nonce").val()},function(a){for(var d=document.querySelectorAll(".wp-gr"),b=0;b<d.length;b++)d[b].parentNode.removeChild(d[b]);window.grw_collection_preview.innerHTML=
a;jQuery(".wp-review-hide").unbind("click").click(function(){grw_review_hide(jQuery(this));return!1});window.grw_post_id.value?(a=jQuery("#grw-rate_us"),a.length&&!a.hasClass("grw-flash-visible")&&a.addClass("grw-flash-visible")):(a=document.querySelector(".wp-gr").getAttribute("data-id"),window.grw_post_id.value=a,window.location.href=window.location.href+"&grw_feed_id="+a+"&grw_feed_new=1");window.grw_save.innerText="Save & Update";window.grw_save.disabled=!1;GRW_AUTOSAVE_TIMEOUT=null})}
function grw_feed_save(){if(!window.grw_title.value)return window.grw_title.focus(),!1;var a=document.getElementById("grw-builder-connection").value;if(a&&(a=JSON.parse(a))&&a.connections&&a.connections.length)return!0;alert("Please click 'CONNECT GOOGLE' and connect your Google reviews then save this widget");return!1}
function grw_review_hide(a){jQuery.post(ajaxurl,{id:a.attr("data-id"),feed_id:jQuery('input[name="grw_feed[post_id]"]').val(),grw_wpnonce:jQuery("#grw_nonce").val(),action:"grw_hide_review"},function(d){var b=a.parent().parent();d.hide?(a.text("show review"),b.addClass("wp-review-hidden")):(a.text("hide review"),b.removeClass("wp-review-hidden"))},"json")}
function grw_connection(a,d,b,c){var h=d.querySelector(".grw-connect-btn");a(h).click(function(){var e=d.querySelector(".grw-connect-id");if(!e.value)return e.focus(),!1;e="yelp"==b?/.+\/biz\/(.*?)(\?|\/|$)/.exec(e.value)[1]:e.value;var k=d.querySelector(".grw-connect-lang").value;h.innerHTML="Please wait...";h.disabled=!0;grw_connect_ajax(a,d,{id:e,lang:k,platform:b,local_img:!0},c,1);return!1})}
function grw_connect_ajax(a,d,b,c,h){var e=b.platform,k=d.querySelector(".grw-connect-btn");window.grw_save.innerText="Auto save, wait";window.grw_save.disabled=!0;a.post(ajaxurl,{id:decodeURIComponent(b.id),lang:b.lang,local_img:b.local_img,feed_id:a('input[name="grw_feed[post_id]"]').val(),grw_wpnonce:a("#grw_nonce").val(),action:"grw_connect_google",v:(new Date).getTime()},function(f){console.log("grw_connect_debug:",f);k.innerHTML="Connect "+(e.charAt(0).toUpperCase()+e.slice(1));k.disabled=!1;
var l=d.querySelector(".grw-connect-error");if("success"==f.status){l.innerHTML="";try{a("#grw-connect-wizard").dialog("close")}catch(u){}grw_connection_add(a,d,{id:f.result.id,lang:b.lang,name:f.result.name,photo:f.result.photo,refresh:!0,local_img:b.local_img,platform:e,props:{default_photo:f.result.photo}},c);grw_serialize_connections()}else switch(f.result.error_message){case "usage_limit":a("#dialog").dialog({width:"50%",maxWidth:"600px"});break;case "bot_check":if(1<h)break;grw_popup("https://app.richplugins.com/gpaw/botcheck?authcode="+
c,640,480,function(){grw_connect_ajax(a,d,b,c,h+1)});break;default:0<=f.result.error_message.indexOf("The provided Place ID is no longer valid")?l.innerHTML='It seems Google place which you are trying to connect does not have a physical address (it\'s virtual or service area), unfortunately, Google Places API does not support such locations, it\'s a limitation of Google, not the plugin.<br><br>However, you can try to connect your Google reviews in our new cloud service <a href="https://trust.reviews" target="_blank">Trust.Reviews</a> and show it on your WordPress site through universal <b>HTML/JavaScript</b> code.':
l.innerHTML="<b>Error</b>: "+f.result.error_message}},"json")}
function grw_connection_add(a,d,b,c,h){var e=grw_connection_id(b),k=a("#"+e);k.length||(k=a('<div class="grw-connection"></div>')[0],k.id=e,void 0!=b.lang&&k.setAttribute("data-lang",b.lang),k.setAttribute("data-platform",b.platform),k.innerHTML=grw_connection_render(b,h),a(".grw-connections")[0].appendChild(k),jQuery(".grw-toggle",k).unbind("click").click(function(){jQuery(this).toggleClass("toggled");jQuery(this).next().slideToggle()}),jQuery(".grw-connect-photo-change",k).on("click",function(a){a.preventDefault();
grw_upload_photo(k,void 0,function(){grw_serialize_connections()});return!1}),jQuery(".grw-connect-photo-default",k).on("click",function(a){grw_change_photo(k,b.props.default_photo);grw_serialize_connections();return!1}),a('input[type="text"]',k).keyup(function(){clearTimeout(GRW_AUTOSAVE_TIMEOUT);GRW_AUTOSAVE_TIMEOUT=setTimeout(grw_serialize_connections,GRW_AUTOSAVE_KEYUP_TIMEOUT)}),a('input[type="checkbox"]',k).click(function(){grw_serialize_connections()}),a("select.grw-connect-lang",k).change(function(){b.lang=
this.value;k.id=grw_connection_id(b);k.setAttribute("data-lang",this.value);grw_connect_ajax(a,d,b,c,1);return!1}),a('input[name="local_img"]',k).unbind("click").click(function(){b.local_img=this.checked;grw_connect_ajax(a,d,b,c,1)}),a(".grw-connect-reconnect",k).click(function(){grw_connect_ajax(a,d,b,c,1);return!1}),a(".grw-connect-delete",k).click(function(){confirm("Are you sure to delete this business?")&&(a(k).remove(),grw_serialize_connections());return!1}))}
function grw_connection_id(a){var d="grw-"+a.platform+"-"+a.id.replace(/\//g,"");null!=a.lang&&(d+=a.lang);return d}
function grw_connection_render(a,d){var b=a.name;a.lang&&(b+=" ("+a.lang+")");a.photo=a.photo||"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";var c=document.createElement("option");c.value="google"==a.platform&&a.props&&a.props.place_id?a.props.place_id:a.id;c.text=grw_capitalize(a.platform)+": "+a.name;d='<div class="grw-toggle grw-builder-connect grw-connect-business"><input type="checkbox" class="grw-connect-select" onclick="event.stopPropagation();" '+(d?"checked":
"")+" /> "+b+(a.address?" ("+a.address+")":"")+'</div><div style="display:none">';b=a.props;c="";for(prop in b)"platform"!=prop&&Object.prototype.hasOwnProperty.call(b,prop)&&(c+='<input type="hidden" name="'+prop+'" value="'+b[prop]+'" class="grw-connect-prop" readonly />');return d+c+'<input type="hidden" name="id" value="'+a.id+'" readonly />'+(a.address?'<input type="hidden" name="address" value="'+a.address+'" readonly />':"")+(a.access_token?'<input type="hidden" name="access_token" value="'+
a.access_token+'" readonly />':"")+'<div class="grw-builder-option"><img src="'+a.photo+'" alt="'+a.name+'" class="grw-connect-photo"><a href="#" class="grw-connect-photo-change">Change</a><a href="#" class="grw-connect-photo-default">Default</a><input type="hidden" name="photo" class="grw-connect-photo-hidden" value="'+a.photo+'" tabindex="2"/></div><div class="grw-builder-option"><input type="text" name="name" value="'+a.name+'" /></div>'+(void 0!=a.website?'<div class="grw-builder-option"><input type="text" name="website" value="'+
a.website+'" /></div>':"")+(void 0!=a.lang?'<div class="grw-builder-option">'+grw_lang("Show all connected languages",a.lang)+"</div>":"")+(void 0!=a.review_count?'<div class="grw-builder-option"><input type="text" name="review_count" value="'+a.review_count+'" placeholder="Total number of reviews" /><span class="grw-quest grw-toggle" title="Click to help">?</span><div class="grw-quest-help">Google return only 5 most helpful reviews and does not return information about total number of reviews and you can type here it manually.</div></div>':
"")+(void 0!=a.refresh?'<div class="grw-builder-option"><label><input type="checkbox" name="refresh" '+(a.refresh?"checked":"")+'>Update reviews daily</label><span class="grw-quest grw-quest-top grw-toggle" title="Click to help">?</span><div class="grw-quest-help">'+("google"==a.platform?"The plugin uses the Google Places API to get your reviews. <b>The API only returns the 5 most helpful reviews (it's a limitation of Google, not the plugin)</b>. This option calls the Places API once in 24 hours (to keep the plugin's free and avoid a Google Billing) to check for a new reviews and if there are, adds to the plugin. Thus slowly building up a database of reviews.<br><br>Also if you see the new reviews on Google map, but after some time it's not added to the plugin, it means that Google does not include these reviews to the API and the plugin can't get this.<br><br>If you need to show <b>all reviews</b>, please use <a href=\"https://richplugins.com/business-reviews-bundle-wordpress-plugin?promo=GRGROW23\" target=\"_blank\">Business plugin</a> which uses a Google My Business API without API key and billing.":
"")+("yelp"==a.platform?"The plugin uses the Yelp API to get your reviews. <b>The API only returns the 3 most helpful reviews without sorting possibility.</b> When Yelp changes the 3 most helpful the plugin will automatically add the new one to your database. Thus slowly building up a database of reviews.":"")+"</div></div>":"")+'<div class="grw-builder-option"><label><input type="checkbox" name="local_img" '+(a.local_img?"checked":"")+'>Save images locally (GDPR)</label></div><div class="grw-builder-option"><button class="grw-connect-reconnect">Reconnect</button></div><div class="grw-builder-option"><button class="grw-connect-delete">Delete connection</button></div></div>'}
function grw_serialize_connections(){var a=[],d=document.querySelectorAll(".grw-connection");for(l in d)if(Object.prototype.hasOwnProperty.call(d,l)){var b=d[l].querySelector(".grw-connect-select");if(!b||grw_is_hidden(b)||b.checked){var c={};b=d[l].getAttribute("data-lang");var h=d[l].getAttribute("data-platform"),e=d[l].querySelectorAll("input");void 0!=b&&(c.lang=b);for(var k in e)if(Object.prototype.hasOwnProperty.call(e,k)){b=e[k];var f=b.getAttribute("name");f&&("grw-connect-prop"==b.className?
(c.props=c.props||{},c.props[f]=b.value):c[f]="checkbox"==b.type?b.checked:b.value)}c.platform=h;a.push(c)}}d={};var l=document.querySelector(".grw-connect-options").querySelectorAll("input[name],select,textarea");for(var u in l)Object.prototype.hasOwnProperty.call(l,u)&&(b=l[u],f=b.getAttribute("name"),"checkbox"==b.type?d[f]=b.checked:void 0!=b.value&&(d[f]="textarea"==b.type||"word_filter"==f||"word_exclude"==f?encodeURIComponent(b.value):b.value));document.getElementById("grw-builder-connection").value=
JSON.stringify({connections:a,options:d});a.length&&(a=a[0],window.grw_title.value||(window.grw_title.value=a.name),grw_feed_save_ajax())}
function grw_deserialize_connections(a,d,b){var c=b.conns,h=c.options;if(Array.isArray(c.connections))c=c.connections;else{var e=[];if(Array.isArray(c.google)){for(var k=0;k<c.google.length;k++)c.google[k].platform="google";e=e.concat(c.google)}if(Array.isArray(c.facebook)){for(k=0;k<c.facebook.length;k++)c.facebook[k].platform="facebook";e=e.concat(c.facebook)}if(Array.isArray(c.yelp)){for(k=0;k<c.yelp.length;k++)c.yelp[k].platform="yelp";e=e.concat(c.yelp)}c=e}for(e=0;e<c.length;e++)grw_connection_add(a,
d.querySelector(".grw-builder-platforms"),c[e],b.authcode,!0);for(var f in h)Object.prototype.hasOwnProperty.call(h,f)&&(a=d.querySelector('input[name="'+f+'"],select[name="'+f+'"],textarea[name="'+f+'"]'))&&(b=a.getAttribute("name"),"boolean"===typeof h[f]?a.checked=h[f]:(a.value="textarea"==a.type||"word_filter"==b||"word_exclude"==b?decodeURIComponent(h[f]):h[f],-1<f.indexOf("_photo")&&a.value&&(a.parentNode.querySelector("img").src=a.value)))}
function grw_upload_photo(a,d,b){d||(d=wp.media.frames.file_frame=wp.media({title:jQuery(this).data("uploader_title"),button:{text:jQuery(this).data("uploader_button_text")},multiple:!1}),d.on("select",function(){var c=d.state().get("selection").first().toJSON();grw_change_photo(a,c.url);b&&b(c.url)}));d.open()}function grw_change_photo(a,d){var b=jQuery(".grw-connect-photo-hidden",a);a=jQuery(".grw-connect-photo",a);b.val(d);a.attr("src",d);a.show();grw_serialize_connections()}
function grw_popup(a,d,b,c){function h(){f&&0==f.closed?setTimeout(h,100):c()}var e=e||screen.height/2-b/2,k=k||screen.width/2-d/2,f=window.open(a,"","location=1,status=1,resizable=yes,width="+d+",height="+b+",top="+e+",left="+k);setTimeout(h,100)}function grw_randstr(a){for(var d="",b=0;b<a;b++)d+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(62*Math.random()));return d}function grw_is_hidden(a){return null===a.offsetParent}
function grw_capitalize(a){return a.charAt(0).toUpperCase()+a.slice(1)}function grw_lang(a,d){for(var b="",c=0;c<GRW_LANGS.length;c++)b+='<option value="'+GRW_LANGS[c][0]+'"'+(d==GRW_LANGS[c][0]?' selected="selected"':"")+">"+GRW_LANGS[c][1]+"</option>";return'<select class="grw-connect-lang" name="lang"><option value=""'+(d?"":' selected="selected"')+">"+a+"</option>"+b+"</select>"};