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

//# sourceMappingURL=https://sourcemaps.squarespace.net/universal/scripts-compressed/sourcemaps/291dd197d35807ca/simple-liking-0ce9c692006369a3-min.en-US.js.map
}