var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{
let window = _____WB$wombat$assign$function_____("window");
let self = _____WB$wombat$assign$function_____("self");
let document = _____WB$wombat$assign$function_____("document");
let location = _____WB$wombat$assign$function_____("location");
let top = _____WB$wombat$assign$function_____("top");
let parent = _____WB$wombat$assign$function_____("parent");
let frames = _____WB$wombat$assign$function_____("frames");
let opens = _____WB$wombat$assign$function_____("opens");
(self.webpackChunkextract_css=self.webpackChunkextract_css||[]).push([[77751],{781962:function(o,l,s){"use strict";var u=s(942265)},942265:function(o,l,s){"use strict";s.r(l);var u=s(364546),g=s.n(u),m=s(401815),E=s(367806),f=s.n(E),d=s(562554),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",null,{project:"scripts-v6-root"}),TEXT_LIKE_VERB_SINGULAR:(0,u.t)("Like",null,{project:"scripts-v6-root"}),TEXT_LIKE_VERB_PLURAL:(0,u.t)("Likes",null,{project:"scripts-v6-root"}),TEXT_LIKE_ACTIVATED:(0,u.t)("You like this",null,{project:"scripts-v6-root"}),TEXT_LIKE_SUGGEST:(0,u.t)("Click to like",null,{project:"scripts-v6-root"}),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 v=parseInt(r.getAttribute("data-like-count"),10);r.setAttribute("data-like-count",v+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.",null,{project:"scripts-v6-root"})))}).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(),v=0;v<i;++v)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"]})},562554:function(o){o.exports={}},367806:function(o){o.exports={}},401815: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(298895));function g(e){return e&&e.__esModule?e:{default:e}}var m=",",E=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:E,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(781962)});var s=o.O()}]);

//# sourceMappingURL=https://sourcemaps.squarespace.net/universal/scripts-compressed/sourcemaps/1666132fc1c023f44b7ea6d1047dea78/simple-liking-49479f72be6f5e9f28e6-min.en-US.js.map
}