"use strict";(globalThis.webpackChunkextract_css=globalThis.webpackChunkextract_css||[]).push([["90246"],{692853:function(r){r.exports={}},664350:function(r){r.exports={}},420335:function(r,_,s){var c=s(673080)},673080:function(r,_,s){var c=s(247496),u=s(148919),g=s(664350),f=s.n(g),d=s(692853),h=s.n(d),L=s(37842);YUI.add("squarespace-simple-liking",function(i){var m=i.config.win.Static;i.Squarespace.SimpleLike={TEXT_LIKE_VERB_NONE:(0,c.t)("No Likes",null,{project:"scripts-v6-root"}),TEXT_LIKE_VERB_SINGULAR:(0,c.t)("Like",null,{project:"scripts-v6-root"}),TEXT_LIKE_VERB_PLURAL:(0,c.t)("Likes",null,{project:"scripts-v6-root"}),TEXT_LIKE_ACTIVATED:(0,c.t)("You like this",null,{project:"scripts-v6-root"}),TEXT_LIKE_SUGGEST:(0,c.t)("Click to like",null,{project:"scripts-v6-root"}),attached:!1,attach:function(){if(!this.attached){this.attached=!0;var e;try{localStorage&&(e=i.JSON.parse(localStorage.getItem("squarespace-likes")),e||(e={}),localStorage.setItem("squarespace-likes",i.JSON.stringify(e)))}catch{e={}}this.eventHandlers=[];var t=i.delegate("click",function(a){var o=a.currentTarget,l=o.getAttribute("data-item-id");if(l){for(var k=0;k<5;++k)i.Squarespace.SimpleLike.burst(o);o.hasClass("clicked")||o.hasClass("float")||u.Z.like(l).then(function(p){if(p.commited===!0){if(o&&o.getDOMNode()){var E=parseInt(o.getAttribute("data-like-count"),10);o.setAttribute("data-like-count",E+1),i.Squarespace.SimpleLike.renderLikeCount(o),o.addClass("clicked")}try{localStorage&&(e[l]=!0,localStorage.setItem("squarespace-likes",i.JSON.stringify(e)))}catch(v){console.warn("Unable to save like to local storage: ",v)}}p.error&&((0,L.z)()||i.config.win.alert((0,c.t)("You need to enable cookies to be able to like something.",null,{project:"scripts-v6-root"})))}).catch(function(p){})}},"body",".sqs-simple-like");this.eventHandlers.push(t),i.all(".sqs-simple-like").each(function(n){var a=n.getAttribute("data-item-id");a&&(m.SQUARESPACE_CONTEXT.websiteSettings.simpleLikingEnabled||n.remove(),e[a]&&n.addClass("clicked"),u.Z.getLikeCount(a).then(function(l){n.setAttribute("data-like-count",l),i.Squarespace.SimpleLike.renderLikeCount(n)}).catch(function(){i.Squarespace.SimpleLike.renderLikeCount(n)}))})}},detach:function(){this.attached=!1,this.eventHandlers.forEach(function(e){e.detach()})},renderLikeCount:function(t){var n=t&&t.getDOMNode?t.getDOMNode():t;if(!(!n||!n.ownerDocument||!n.ownerDocument.defaultView)){var a=t.getAttribute("data-item-id"),o=t.getAttribute("data-like-count"),l=t.one(".like-count");!a||!l||l.setContent(this.formatLikeText(o))}},formatLikeText:function(e){return e===0?i.Squarespace.SimpleLike.TEXT_LIKE_VERB_NONE:e===1?"1 "+i.Squarespace.SimpleLike.TEXT_LIKE_VERB_SINGULAR:e+" "+i.Squarespace.SimpleLike.TEXT_LIKE_VERB_PLURAL},burst:function(e){var t=e.cloneNode(!0);t.one(".like-count")&&t.one(".like-count").remove();var n=e.one(".like-icon");(!n||n.getStyle("display")==="none")&&(n=e),t.setStyles({position:"absolute",left:n.getX()+"px",top:n.getY()+"px"}),i.one(i.config.doc.body).append(t);var a=new i.Anim({node:t,duration:2,easing:i.Easing.easeOut});a.set("to",{curve:i.Squarespace.SimpleLike.randomCurve(t)}),a.on("end",function(){this.get("node").remove()}),a.run(),t.removeClass("clicked"),t.addClass("float")},randomCurve:function(e){for(var t=[],n=3,a=30,o=Math.floor(Math.random()*2)?1:-1,l=Math.floor(Math.random()*2)?1:-1,k=e.getX(),p=e.getY(),E=0;E<n;++E)k+=Math.floor(Math.random()*a)*o,p+=Math.floor(Math.random()*a)*l,t.push([k,p]);return t}},i.config.win.Squarespace.onInitialize(i,function(){m.SQUARESPACE_CONTEXT.websiteSettings.simpleLikingEnabled&&i.Squarespace.SimpleLike.attach()}),i.config.win.Squarespace.onDestroy(i,function(){i.Squarespace.SimpleLike.attached===!0&&i.Squarespace.SimpleLike.detach()})},"1.0",{requires:["anim","json","node","squarespace-util"]})},148919:function(r,_,s){s.d(_,{Z:()=>m});var c=s(456903);const u=",",g=e=>c.default.post("/api/content-items/"+e+"/sentiment/like").then(t=>{let{data:n}=t;return n});let f=[],d=null;const h=()=>{const e=f.map(t=>t.itemId).join(u);c.default.get(`/api/blog-like-count/${e}`).then(t=>{let{data:n}=t;f.forEach(a=>{if(n.hasOwnProperty(a.itemId)){a.resolve(n[a.itemId]);return}a.reject()}),f=[],d=null})},L=e=>new Promise((t,n)=>{f.push({itemId:e,resolve:t,reject:n}),d!==null&&clearTimeout(d),d=setTimeout(h,100)}),m={like:g,getLikeCount:e=>L(e)}},37842:function(r,_,s){s.d(_,{z:()=>c});function c(){try{if(!("cookie"in document))return!1;const u="_testCookieName";return document.cookie=u,document.cookie.includes(u)}catch{return!1}}},392338:function(r){r.exports=void 0}},function(r){var _=function(c){return r(r.s=c)};r.O(0,["96135","98338"],function(){return _(420335)});var s=r.O()}]);

//# sourceMappingURL=https://sourcemaps.squarespace.net/universal/scripts-compressed/sourcemaps/f8e65d3ee30661f9/simple-liking-2085f67ddae09517-min.en-US.js.map