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

//# sourceMappingURL=https://sourcemaps.squarespace.net/universal/scripts-compressed/sourcemaps/9ad1e5bed01cf3853befb457ca0eba59/simple-liking-4ef11503ebc255d049e5-min.en-US.js.map