"use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["652"],{62372:function(e,t,r){r.d(t,{Eh:()=>V,XI:()=>F,sJ:()=>A});var n,o,i=r(98661);function s(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function p(e){var t=(0,i.useRef)(null);return function(r){r&&r!==t.current&&(t.current=r,e(r))}}var d="undefined"!=typeof window?i.useLayoutEffect:i.useEffect;function h(e){return parseFloat(e.replace("px",""))}function g(e,t,r){return er?r:e}function v(){for(var e=arguments.length,t=Array(e),r=0;r=0})}},{key:"negativeSides",get:function(){var e=this;return Object.fromEntries(P.filter(function(t){return e[t]<0}).map(function(t){return[t,e[t]]}))}}]),e}();function k(){for(var e=arguments.length,t=Array(e),r=0;rv?v-b:0;p[r.prop]=g(b+e+w,h,v),p[r.opposite.prop]=p[r.prop]+r.factor(i[l])}p.width=p.right-p.left,p.height=p.bottom-p.top;var C=T.create(p);return 0===e&&(this._cachedLayerBounds=C),C},t.getLayerCollisionBounds=function(){var e=this.offsets.container;return this.getLayerBounds().mapSides(function(t,r){return r-t.factor(e)}).merge(function(t){return{width:t.width+2*e,height:t.height+2*e}})},t.getContainerOffsets=function(e){if(this._cachedContainerOffsets&&!e)return this._cachedContainerOffsets;var t=this.subjectsBounds.merge({layer:e||this.getLayerCollisionBounds()}),r=B.mergeSmallestSides(t.layerOffsetsToScrollContainers);return e||(this._cachedContainerOffsets=r),r},u(e,[{key:"type",get:function(){return this.primary.prop+"-"+("center"===this.secondary.prop?"center":["bottom","right"].includes(this.secondary.prop)?"end":"start")}},{key:"triggerIsBigger",get:function(){var e=this.secondary.isHorizontal,t=this.subjectsBounds,r=t.triggerHasBiggerWidth,n=t.triggerHasBiggerHeight;return e&&r||!e&&n}},{key:"fitsContainer",get:function(){return this.getContainerOffsets().allSidesArePositive}},{key:"visibleSurface",get:function(){var e=this.getLayerBounds(),t=this.getContainerOffsets(e).negativeSides;for(var r in t)t[r]=-t[r];return e.substract(t).surface}},{key:"secondaryOffsetSide",get:function(){var e,t,r=this;return(null!=(e=null==(t=Object.entries(this.getContainerOffsets().negativeSides).map(function(e){var t=e[0],r=e[1];return[O[t],r]}).filter(function(e){var t=e[0];return r.primary.isOppositeDirection(t)}).sort(function(e,t){var r=e[1];return t[1]-r}))?void 0:t[0])?e:[])[0]||null}}]),e}(),R=function(e){function t(){return e.apply(this,arguments)||this}return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,l(t,e),t.prototype.getLayerBounds=function(){var e=this.subjectsBounds,t=e.trigger,r=e.layer,n=T.empty();return n.top=t.top+t.height/2-r.height/2,n.bottom=n.top+r.height,n.left=t.left+t.width/2-r.width/2,n.right=n.left+r.width,n.width=n.right-n.left,n.height=n.bottom-n.top,n},t}(H),z={position:"absolute",willChange:"top, left",left:null,right:null,top:null,bottom:null},I=function(){function e(e,t,r){this.placements=void 0,this.config=void 0,this.subjectsBounds=void 0,this.placements=e,this.config=t,this.subjectsBounds=r}e.getSidesFromPlacementType=function(e){var t,r=e.split("-"),n=r[0],o=r[1],i=O[n];return t="center"===o?E.center:i.isHorizontal?"start"===o?E.top:E.bottom:"start"===o?E.left:E.right,[i,t]},e.create=function(t,r){var n={arrow:r.arrowOffset,container:r.containerOffset,trigger:r.triggerOffset};function o(o){void 0===o&&(o=r.placement);var i=e.getSidesFromPlacementType(o),s=i[0],u=i[1],a=O[s.isHorizontal?r.preferY:r.preferX],l=!s.isHorizontal&&t.triggerHasBiggerWidth||s.isHorizontal&&t.triggerHasBiggerHeight;function c(e,o){return new H(e,o,t,r.layerDimensions,n)}var f=[];return f[0]=c(s,u),f[1]=c(s,u.isCenter?a:E.center),f[2]=c(s,E[(u.opposite.isCenter?a.opposite:u.opposite).prop]),f[3]=c(a,l?s:E[s.opposite.prop]),f[4]=c(a,E.center),f[5]=c(a,l?E[s.opposite.prop]:s),f[6]=c(O[a.opposite.prop],l?s:E[s.opposite.prop]),f[7]=c(O[a.opposite.prop],E.center),f[8]=c(O[a.opposite.prop],l?E[s.opposite.prop]:s),f[9]=c(O[s.opposite.prop],u),f[10]=c(O[s.opposite.prop],u.isCenter?a:E.center),f[11]=c(O[s.opposite.prop],E[(u.opposite.isCenter?a.opposite:u.opposite).prop]),f=f.filter(function(e){return e.type===r.placement||r.possiblePlacements.includes(e.type)})}return"center"===r.placement?new e([new R(E.center,E.center,t,r.layerDimensions,n)].concat(o(r.preferY+"-"+r.preferX)),r,t):new e(o(),r,t)};var t=e.prototype;return t.filterPlacementsBySide=function(e){return this.placements.filter(function(t){return t.primary===e})},t.findFirstPlacementThatFits=function(){return this.placements.find(function(e){return e.fitsContainer})},t.placementWithBiggestVisibleSurface=function(){return this.placements.map(function(e){return{placement:e,surface:e.visibleSurface}}).sort(function(e,t){return t.surface-e.surface})[0].placement},t.findSuitablePlacement=function(){return this.config.auto?this.findFirstPlacementThatFits()||this.placementWithBiggestVisibleSurface():this.placements[0]},t.getSecondaryOffset=function(e){var t,r=this.config,n=r.auto,o=r.snap;if(!n||o||e instanceof R)return 0;var i=this.filterPlacementsBySide(e.primary);if(0===i.indexOf(e)&&e.fitsContainer)return 0;var s=i.find(function(e){return!e.fitsContainer});if(!s)return 0;var u=s.secondaryOffsetSide;if(!u)return 0;var a=e.getContainerOffsets(),l=e.secondary;return t=e.triggerIsBigger||s===e?u.isPush?-1:1:l===E.left||[E.top,E.center].includes(l)&&u.isPush?-1:1,a[u.prop]*t},t.getStyles=function(e,t,r,n){var o={willChange:"top, left, width, height"};return{arrow:function(e,t,r){if(t.primary.isCenter)return z;var n,o,i,s,u,l,c,f,p,d,h=e.layer,v=e.trigger,m=e.arrow,y=t.primary.oppositeSizeProp,b=v[y]>h[y],w=r+m[y]/2,C=h[y]-m[y]/2-r,S=(n=e.layer,o=e.trigger,i=e.arrow,s=t.primary.oppositeSizeProp,l=(u=t.primary.isHorizontal?["top","bottom"]:["left","right"])[0],c=u[1],((f=n[l]+n[s]/2-o[l]-i[s]/2-r)<0?-f:0)+((p=n[c]-n[s]/2-o[c]+i[s]/2+r)>0?-p:0)),O=t.primary.prop,E=t.primary.oppositeCssProp,P=b?h[y]/2+S:v[E]+v[y]/2-h[E];return a({},z,((d={})[O]="100%",d[E]=g(P,w,C),d))}(this.subjectsBounds.merge({layer:e}),t,this.config.arrowOffset),layer:this.config.overflowContainer?a({},o,{position:"fixed",top:e.top,left:e.left}):a({},o,{position:"absolute",top:e.top-this.subjectsBounds.parent.top+r.top-n.top,left:e.left-this.subjectsBounds.parent.left+r.left-n.left})}},t.getHasDisappeared=function(e){var t=this.config.overflowContainer?this.subjectsBounds.trigger:e,r=B.mergeSmallestSides(this.subjectsBounds.offsetsToScrollContainers(t,!0));return Object.entries(r.negativeSides).some(function(e){var r=e[0];return e[1]<=-t[O[r].sizeProp]})?"full":r.allSidesArePositive?null:"partial"},t.result=function(e,t){var r=this.findSuitablePlacement(),n=this.getSecondaryOffset(r),o=r.getLayerBounds(n);return{styles:this.getStyles(o,r,e,t),layerSide:r.primary.prop,placement:r,layerBounds:o,hasDisappeared:this.getHasDisappeared(o)}},e}(),M=function(){function e(e,t){this.overflowContainer=void 0,this.trigger=void 0,this.layer=void 0,this.arrow=void 0,this.parent=void 0,this.window=void 0,this.scrollContainers=void 0,this.overflowContainer=t,Object.assign(this,e)}e.create=function(t,r,n,o,i,s,u,a){var l=T.fromWindow(t);return new e({layer:T.fromElement(r,{environment:t,withTransform:!1}),trigger:a?T.create(j(a())):T.fromElement(n),arrow:i?T.fromElement(i):T.empty(),parent:o?T.fromElement(o):l,window:l,scrollContainers:[l].concat(s.map(function(e){return T.fromElement(e,{withScrollbars:!1})}))},u)};var t=e.prototype;return t.merge=function(t){return new e(a({},this,t),this.overflowContainer)},t.offsetsToScrollContainers=function(e,t){return void 0===t&&(t=!1),(this.overflowContainer&&!t?[this.window]:this.scrollContainers).map(function(t){return t.offsetsTo(e)})},u(e,[{key:"layerOffsetsToScrollContainers",get:function(){return this.offsetsToScrollContainers(this.layer)}},{key:"triggerHasBiggerWidth",get:function(){return this.trigger.width>this.layer.width}},{key:"triggerHasBiggerHeight",get:function(){return this.trigger.height>this.layer.height}}]),e}(),x={auto:!1,arrowOffset:0,containerOffset:10,triggerOffset:0,overflowContainer:!0,placement:"top-center",possiblePlacements:["bottom-start","bottom-end","bottom-center","top-start","top-center","top-end","left-end","left-center","left-start","right-end","right-center","right-start","center"],preferX:"right",preferY:"bottom",snap:!1,container:void 0};function A(e){var t,r,n,o,s,u,l,c,g,w,C,S,O,E,P,B,k,j,L,T,H,R,z,A,W,Y,N,_,X,V,F,G,Z,J,U,$,q,K,Q=e.isOpen,ee=void 0!==Q&&Q,et=e.overflowContainer,er=void 0===et?x.overflowContainer:et,en=e.environment,eo=void 0===en?"undefined"!=typeof window?window:void 0:en,ei=e.ResizeObserver,es=e.placement,eu=void 0===es?x.placement:es,ea=e.possiblePlacements,el=void 0===ea?x.possiblePlacements:ea,ec=e.preferX,ef=void 0===ec?x.preferX:ec,ep=e.preferY,ed=void 0===ep?x.preferY:ep,eh=e.auto,eg=void 0===eh?x.auto:eh,ev=e.snap,em=void 0===ev?x.snap:ev,ey=e.triggerOffset,eb=void 0===ey?x.triggerOffset:ey,ew=e.containerOffset,eC=void 0===ew?x.containerOffset:ew,eS=e.arrowOffset,eO=void 0===eS?x.arrowOffset:eS,eE=e.container,eP=void 0===eE?x.container:eE,eB=e.layerDimensions,ek=void 0===eB?null:eB,ej=e.onDisappear,eL=e.onOutsideClick,eT=e.onParentClose,eH=e.trigger,eR=(0,i.useState)(function(){return{layerSide:"center"===eu?"center":I.getSidesFromPlacementType(eu)[0].prop,styles:{layer:{position:er?"fixed":"absolute",top:0,left:0},arrow:{position:"absolute",top:0,left:0}}}}),ez=eR[0],eI=eR[1],eM=(0,i.useRef)(null),ex=(t=(0,i.useRef)(ez),ee?t.current=ez:t.current=null,t),eA=(0,i.useRef)({cancelled:!1});(0,i.useEffect)(function(){return function(){eA.current.cancelled=!0}},[]);var eD=(0,i.useCallback)(function(e,t,r){var n=e.arrow,o=e.layer,i=e.scrollContainers,s=e.trigger,u=i[0],a=M.create(eo,o,s,u,n,i,er,null==eH?void 0:eH.getBounds),l=I.create(a,{placement:eu,possiblePlacements:el,auto:eg,layerDimensions:ek,arrowOffset:eO,containerOffset:eC,triggerOffset:eb,preferX:ef,preferY:ed,snap:em,overflowContainer:er}).result(t,r),c=l.hasDisappeared,f={layerSide:l.layerSide,styles:l.styles};if(!ex.current||function(e,t){if(e.layerSide!==t.layerSide)return!0;for(var r=0,n=["position","top","left","right","bottom"];r0},removeAllEventSubscriptions:function(){for(var e,t=f(k.current);!(e=t()).done;)(0,e.value)();k.current=[]},addEventSubscription:function(e){k.current.push(e)}}},[])).hasEventSubscriptions,T=j.addEventSubscription,H=j.removeAllEventSubscriptions,R=(0,i.useCallback)(function(){var e=P(),t=e.layer,r=e.trigger,n=e.scrollContainers,i=n[0];if(!t)throw Error(m("layer"));if(!r&&!C)throw Error(m("trigger"));var u={top:0,left:0};if(i){var a=i.scrollLeft;u={top:i.scrollTop,left:a}}else{var l=s.scrollX;u={top:s.scrollY,left:l}}var c={left:0,top:0};if(i){var f=s.getComputedStyle(i),p=f.borderLeftWidth,d=f.borderTopWidth;c={left:h(p)||0,top:h(d)||0}}o({layer:t,trigger:r,scrollContainers:n,arrow:w.current},u,c)},[P,o,s,w,C]),z=(0,i.useCallback)(function(){var e=P(),t=e.trigger,r=e.layer,n=e.scrollContainers;if(!r)throw Error(m("layer"));if(!t&&!C)throw Error(m("trigger"));if(g){for(var o=!1,i=new g(function(){if(!o){o=!0;return}R()}),u=0,a=[t,r,document.body];u=0||(o[r]=e[r]);return o}(e,W);if("center"===I)return null;var A=O[I],D=2*X(B,E),V=Math.max(E,D);return(0,i.createElement)("svg",a({ref:t},x,{style:a({},void 0===M?{}:M,{transform:"translate"+(A.isHorizontal?"Y":"X")+"(-50%)"}),width:V,height:V,preserveAspectRatio:A.isPush?"xMinYMin":"xMaxYMax",viewBox:((r={})[N]="0 "+-j+" "+D+" "+E,r.top="0 0 "+D+" "+(E+j),r[_]=-j+" 0 "+E+" "+D,r[Y]="0 0 "+(E+j)+" "+D,r)[A.prop]}),(0,i.createElement)("path",{fill:R,strokeWidth:j,stroke:void 0===L?"black":L,d:(u=(void 0===T?0:T)/10*E*2,l=((n={})[N]=[0,E],n.top=[0,0],n[_]=[E,D],n[Y]=[0,D],n)[A.prop].join(" "),c=A.isHorizontal?"V 0":"H "+D,f=D/2,p=D/2+X(B,E/8),d=E/8,h=((o={})[N]=["C",p,d,f+u,0,f,0],o.top=["C",p,E-d,f+u,E,f,E],o[_]=["C",d,D-p,0,f-u,0,f],o[Y]=["C",E-d,D-p,E,f-u,E,f],o)[A.prop].join(" "),g=D/2-X(B,E/8),v=E/8,m=((s={})[N]=["C",f-u,0,g,v,l],s.top=["C",f-u,E,g,E-v,l],s[_]=["C",0,f+u,v,D-g,l],s[Y]=["C",E,f+u,E-v,D-g,l],s)[A.prop].join(" "),["M",l,c,h,m].join(" "))}),(0,i.createElement)("path",{fill:R,d:(y=X(B,j),w=(b=A.isPush?[0,j]:[E,E-j])[0],C=b[1],A.isHorizontal?["M",w,j,"V",D-j,"L",C,D-j-y,"V",y+j,"Z"].join(" "):["M",j,w,"H",D-j,"L",D-j-y,C,"H",y+j,"Z"].join(" "))}))});function F(e){var t=void 0===e?{}:e,r=t.delayEnter,n=void 0===r?0:r,s=t.delayLeave,u=void 0===s?0:s,a=t.hideOnScroll,l=void 0===a||a,c=(0,i.useState)(!1),f=c[0],p=c[1],d=(0,i.useRef)(null),h=(0,i.useRef)(o.IDLE),g=(0,i.useRef)(!1),v=(0,i.useCallback)(function(){clearTimeout(d.current),d.current=null,h.current=o.IDLE},[]);function m(e,t){if(h.current===o.ENTERING&&d.current&&v(),f){if(t){p(!1),d.current=null,h.current=o.IDLE;return}h.current=o.LEAVING,d.current=window.setTimeout(function(){p(!1),d.current=null,h.current=o.IDLE},u)}}return(0,i.useEffect)(function(){function e(){f&&l&&(v(),p(!1))}return window.addEventListener("scroll",e,!0),function(){window.removeEventListener("scroll",e,!0),d.current&&clearTimeout(d.current)}},[f,l,v]),[f,{onMouseEnter:function(){h.current===o.LEAVING&&d.current&&v(),!f&&(h.current=o.ENTERING,d.current=window.setTimeout(function(){p(!0),d.current=null,h.current=o.IDLE},n))},onMouseLeave:m,onTouchStart:function(){g.current=!1},onTouchMove:function(){g.current=!0},onTouchEnd:function(){g.current||f||p(!0),g.current=!1}},function(){return m(null,!0)}]}(n=o||(o={}))[n.ENTERING=0]="ENTERING",n[n.LEAVING=1]="LEAVING",n[n.IDLE=2]="IDLE"}}]);