!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"substack@538433c"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="5f11248a-32e9-4c91-b894-4f1946b323f3",e._sentryDebugIdIdentifier="sentry-dbid-5f11248a-32e9-4c91-b894-4f1946b323f3")}catch(e){}}();"use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["94551"],{49054:function(e,t,n){n.d(t,{AO:()=>C,Kr:()=>A});var r='input:not([inert]),select:not([inert]),textarea:not([inert]),a[href]:not([inert]),button:not([inert]),[tabindex]:not(slot):not([inert]),audio[controls]:not([inert]),video[controls]:not([inert]),[contenteditable]:not([contenteditable="false"]):not([inert]),details>summary:first-of-type:not([inert]),details:not([inert])',o="undefined"==typeof Element,u=o?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,l=!o&&Element.prototype.getRootNode?function(e){var t;return null==e||null==(t=e.getRootNode)?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},i=function e(t,n){void 0===n&&(n=!0);var r,o=null==t||null==(r=t.getAttribute)?void 0:r.call(t,"inert");return""===o||"true"===o||n&&t&&e(t.parentNode)},c=function(e){var t,n=null==e||null==(t=e.getAttribute)?void 0:t.call(e,"contenteditable");return""===n||"true"===n},a=function(e,t,n){if(i(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(r));return t&&u.call(e,r)&&o.unshift(e),o=o.filter(n)},s=function e(t,n,o){for(var l=[],c=Array.from(t);c.length;){var a=c.shift();if(!i(a,!1))if("SLOT"===a.tagName){var s=a.assignedElements(),f=e(s.length?s:a.children,!0,o);o.flatten?l.push.apply(l,f):l.push({scopeParent:a,candidates:f})}else{u.call(a,r)&&o.filter(a)&&(n||!t.includes(a))&&l.push(a);var d=a.shadowRoot||"function"==typeof o.getShadowRoot&&o.getShadowRoot(a),v=!i(d,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(a));if(d&&v){var p=e(!0===d?a.children:d.children,!0,o);o.flatten?l.push.apply(l,p):l.push({scopeParent:a,candidates:p})}else c.unshift.apply(c,a.children)}}return l},f=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},d=function(e){if(!e)throw Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||c(e))&&!f(e)?0:e.tabIndex},v=function(e,t){var n=d(e);return n<0&&t&&!f(e)?0:n},p=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},m=function(e){return"INPUT"===e.tagName},g=function(e,t){for(var n=0;nsummary:first-of-type")?e.parentElement:e;if(u.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return E(e)}else{if("function"==typeof r){for(var i=e;e;){var c=e.parentElement,a=l(e);if(c&&!c.shadowRoot&&!0===r(c))return E(e);e=e.assignedSlot?e.assignedSlot:c||a===e.ownerDocument?c:a.host}e=i}if(y(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},R=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;nd(t))&&!!x(e,t)},L=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!isNaN(t)||!!(t>=0)},S=function e(t){var n=[],r=[];return t.forEach(function(t,o){var u=!!t.scopeParent,l=u?t.scopeParent:t,i=v(l,u),c=u?e(t.candidates):l;0===i?u?n.push.apply(n,c):n.push(l):r.push({documentOrder:o,tabIndex:i,item:t,isScope:u,content:c})}),r.sort(p).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(n)},A=function(e,t){return S((t=t||{}).getShadowRoot?s([e],t.includeContainer,{filter:k.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:L}):a(e,t.includeContainer,k.bind(null,t)))},C=function(e,t){if(t=t||{},!e)throw Error("No node provided");return!1!==u.call(e,r)&&k(t,e)}},38314:function(e,t,n){n.d(t,{s3:()=>ev,we:()=>eb,DL:()=>eS,iQ:()=>ey,s9:()=>eh,XF:()=>eu,Mk:()=>K,bv:()=>ex});var r=n(17402),o=n(43859);function u(e){let t=e.activeElement;for(;(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function l(e,t){if(!e||!t)return!1;let n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&(0,o.Ng)(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function i(){let e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function c(){let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(e=>{let{brand:t,version:n}=e;return t+"/"+n}).join(" "):navigator.userAgent}function a(e){return!c().includes("jsdom/")&&(!f()&&0===e.width&&0===e.height||f()&&1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"===e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail&&"touch"===e.pointerType)}function s(){return/apple/i.test(navigator.vendor)}function f(){let e=/android/i;return e.test(i())||e.test(c())}function d(e,t){let n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function v(e){return(null==e?void 0:e.ownerDocument)||document}function p(e,t){return null!=t&&("composedPath"in e?e.composedPath().includes(t):null!=e.target&&t.contains(e.target))}function m(e){return"composedPath"in e?e.composedPath()[0]:e.target}let g=/^(47582|70581|78893|89623)$/.test(n.j)?null:"input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function h(e){return(0,o.sb)(e)&&e.matches(g)}function b(e){e.preventDefault(),e.stopPropagation()}var y=n(4006),E=n(49054),w=n(67535);let R={...r},x=R.useInsertionEffect||(e=>e());function k(e){let t=r.useRef(()=>{});return x(()=>{t.current=e}),r.useCallback(function(){for(var e=arguments.length,n=Array(e),r=0;r"floating-ui-"+Math.random().toString(36).slice(2,6)+A++,M=R.useId||function(){let[e,t]=r.useState(()=>S?C():void 0);return L(()=>{null==e&&t(C())},[]),r.useEffect(()=>{S=!0},[]),e},T=r.createContext(null),I=r.createContext(null),N=()=>{var e;return(null==(e=r.useContext(T))?void 0:e.id)||null};function D(e){return"data-floating-ui-"+e}function O(e){-1!==e.current&&(clearTimeout(e.current),e.current=-1)}function P(e){let t=(0,r.useRef)(e);return L(()=>{t.current=e}),t}let q=D("safe-polygon");function F(e,t,n){return n&&!d(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}function K(e,t){void 0===t&&(t={});let{open:n,onOpenChange:u,dataRef:i,events:c,elements:a}=e,{enabled:s=!0,delay:f=0,handleClose:p=null,mouseOnly:m=!1,restMs:g=0,move:h=!0}=t,b=r.useContext(I),y=N(),E=P(p),w=P(f),R=P(n),x=r.useRef(),S=r.useRef(-1),A=r.useRef(),C=r.useRef(-1),M=r.useRef(!0),T=r.useRef(!1),D=r.useRef(()=>{}),K=r.useRef(!1),_=r.useCallback(()=>{var e;let t=null==(e=i.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t},[i]);r.useEffect(()=>{if(s)return c.on("openchange",e),()=>{c.off("openchange",e)};function e(e){let{open:t}=e;t||(O(S),O(C),M.current=!0,K.current=!1)}},[s,c]),r.useEffect(()=>{if(!s||!E.current||!n)return;function e(e){_()&&u(!1,e,"hover")}let t=v(a.floating).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}},[a.floating,n,u,s,E,_]);let Y=r.useCallback(function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n="hover");let r=F(w.current,"close",x.current);r&&!A.current?(O(S),S.current=window.setTimeout(()=>u(!1,e,n),r)):t&&(O(S),u(!1,e,n))},[w,u]),j=k(()=>{D.current(),A.current=void 0}),W=k(()=>{if(T.current){let e=v(a.floating).body;e.style.pointerEvents="",e.removeAttribute(q),T.current=!1}}),B=k(()=>!!i.current.openEvent&&["click","mousedown"].includes(i.current.openEvent.type));r.useEffect(()=>{if(s&&(0,o.vq)(a.domReference)){var e;let o=a.domReference;return n&&o.addEventListener("mouseleave",c),null==(e=a.floating)||e.addEventListener("mouseleave",c),h&&o.addEventListener("mousemove",t,{once:!0}),o.addEventListener("mouseenter",t),o.addEventListener("mouseleave",r),()=>{var e;n&&o.removeEventListener("mouseleave",c),null==(e=a.floating)||e.removeEventListener("mouseleave",c),h&&o.removeEventListener("mousemove",t),o.removeEventListener("mouseenter",t),o.removeEventListener("mouseleave",r)}}function t(e){if(O(S),M.current=!1,m&&!d(x.current)||g>0&&!F(w.current,"open"))return;let t=F(w.current,"open",x.current);t?S.current=window.setTimeout(()=>{R.current||u(!0,e,"hover")},t):n||u(!0,e,"hover")}function r(e){if(B())return;D.current();let t=v(a.floating);if(O(C),K.current=!1,E.current&&i.current.floatingContext){n||O(S),A.current=E.current({...i.current.floatingContext,tree:b,x:e.clientX,y:e.clientY,onClose(){W(),j(),B()||Y(e,!0,"safe-polygon")}});let r=A.current;t.addEventListener("mousemove",r),D.current=()=>{t.removeEventListener("mousemove",r)};return}"touch"===x.current&&l(a.floating,e.relatedTarget)||Y(e)}function c(e){B()||i.current.floatingContext&&(null==E.current||E.current({...i.current.floatingContext,tree:b,x:e.clientX,y:e.clientY,onClose(){W(),j(),B()||Y(e)}})(e))}},[a,s,e,m,g,h,Y,j,W,u,n,R,b,w,E,i,B]),L(()=>{var e,t;if(s&&n&&null!=(e=E.current)&&e.__options.blockPointerEvents&&_()){T.current=!0;let e=a.floating;if((0,o.vq)(a.domReference)&&e){let n=v(a.floating).body;n.setAttribute(q,"");let r=a.domReference,o=null==b||null==(t=b.nodesRef.current.find(e=>e.id===y))||null==(t=t.context)?void 0:t.elements.floating;return o&&(o.style.pointerEvents=""),n.style.pointerEvents="none",r.style.pointerEvents="auto",e.style.pointerEvents="auto",()=>{n.style.pointerEvents="",r.style.pointerEvents="",e.style.pointerEvents=""}}}},[s,n,y,a,b,E,_]),L(()=>{n||(x.current=void 0,K.current=!1,j(),W())},[n,j,W]),r.useEffect(()=>()=>{j(),O(S),O(C),W()},[s,a.domReference,j,W]);let X=r.useMemo(()=>{function e(e){x.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e;function r(){M.current||R.current||u(!0,t,"hover")}m&&!d(x.current)||n||0===g||K.current&&e.movementX**2+e.movementY**2<2||(O(C),"touch"===x.current?r():(K.current=!0,C.current=window.setTimeout(r,g)))}}},[m,u,n,R,g]),$=r.useMemo(()=>({onMouseEnter(){O(S)},onMouseLeave(e){B()||Y(e.nativeEvent,!1)}}),[Y,B]);return r.useMemo(()=>s?{reference:X,floating:$}:{},[s,X,$])}let _=0;function Y(e,t){void 0===t&&(t={});let{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(_);let u=()=>null==e?void 0:e.focus({preventScroll:n});o?u():_=requestAnimationFrame(u)}function j(e,t){var n;let r=[],o=null==(n=e.find(e=>e.id===t))?void 0:n.parentId;for(;o;){let t=e.find(e=>e.id===o);o=null==t?void 0:t.parentId,t&&(r=r.concat(t))}return r}function W(e,t){let n=e.filter(e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)}),r=n;for(;r.length;)r=e.filter(e=>{var t;return null==(t=r)?void 0:t.some(t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)})}),n=n.concat(r);return n}let B=new WeakMap,X=new WeakSet,$=/^(23133|90887)$/.test(n.j)?{}:null,z=0,H=e=>e&&(e.host||H(e.parentNode));function U(e,t,n){var r,u;let l,i,c,a,s,f,d;void 0===t&&(t=!1),void 0===n&&(n=!1);let p=v(e[0]).body;return r=e.concat(Array.from(p.querySelectorAll("[aria-live]"))),u=t,l="data-floating-ui-inert",i=n?"inert":u?"aria-hidden":null,c=r.map(e=>{if(p.contains(e))return e;let t=H(e);return p.contains(t)?t:null}).filter(e=>null!=e),a=new Set,s=new Set(c),f=[],$[l]||($[l]=new WeakMap),d=$[l],c.forEach(function e(t){!(!t||a.has(t))&&(a.add(t),t.parentNode&&e(t.parentNode))}),function e(t){!t||s.has(t)||[].forEach.call(t.children,t=>{if("script"!==(0,o.mq)(t))if(a.has(t))e(t);else{let e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,r=B.get(t)||0,o=i?r+1:r,u=(d.get(t)||0)+1;B.set(t,o),d.set(t,u),f.push(t),1===o&&n&&X.add(t),1===u&&t.setAttribute(l,""),!n&&i&&t.setAttribute(i,"true")}})}(p),a.clear(),z++,()=>{f.forEach(e=>{let t=B.get(e)||0,n=i?t-1:t,r=(d.get(e)||0)-1;B.set(e,n),d.set(e,r),n||(!X.has(e)&&i&&e.removeAttribute(i),X.delete(e)),r||e.removeAttribute(l)}),--z||(B=new WeakMap,B=new WeakMap,X=new WeakSet,$={})}}let V=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Z(e,t){let n=(0,E.Kr)(e,V());"prev"===t&&n.reverse();let r=n.indexOf(u(v(e)));return n.slice(r+1)[0]}function G(){return Z(document.body,"next")}function Q(){return Z(document.body,"prev")}function J(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!l(n,r)}function ee(e){e.querySelectorAll("[data-tabindex]").forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")})}let et={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},en=r.forwardRef(function(e,t){let[n,o]=r.useState();L(()=>{s()&&o("button")},[]);let u={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[D("focus-guard")]:"",style:et};return(0,y.Y)("span",{...e,...u})}),er=r.createContext(null),eo=D("portal");function eu(e){let{children:t,id:n,root:u,preserveTabOrder:l=!0}=e,i=function(e){void 0===e&&(e={});let{id:t,root:n}=e,u=M(),l=el(),[i,c]=r.useState(null),a=r.useRef(null);return L(()=>()=>{null==i||i.remove(),queueMicrotask(()=>{a.current=null})},[i]),L(()=>{if(!u||a.current)return;let e=t?document.getElementById(t):null;if(!e)return;let n=document.createElement("div");n.id=u,n.setAttribute(eo,""),e.appendChild(n),a.current=n,c(n)},[t,u]),L(()=>{if(null===n||!u||a.current)return;let e=n||(null==l?void 0:l.portalNode);e&&!(0,o.vq)(e)&&(e=e.current),e=e||document.body;let r=null;t&&((r=document.createElement("div")).id=t,e.appendChild(r));let i=document.createElement("div");i.id=u,i.setAttribute(eo,""),(e=r||e).appendChild(i),a.current=i,c(i)},[t,n,u,l]),i}({id:n,root:u}),[c,a]=r.useState(null),s=r.useRef(null),f=r.useRef(null),d=r.useRef(null),v=r.useRef(null),p=null==c?void 0:c.modal,m=null==c?void 0:c.open,g=!!c&&!c.modal&&c.open&&l&&!!(u||i);return r.useEffect(()=>{if(i&&l&&!p)return i.addEventListener("focusin",e,!0),i.addEventListener("focusout",e,!0),()=>{i.removeEventListener("focusin",e,!0),i.removeEventListener("focusout",e,!0)};function e(e){i&&J(e)&&("focusin"===e.type?ee:function(e){(0,E.Kr)(e,V()).forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")})})(i)}},[i,l,p]),r.useEffect(()=>{!i||m||ee(i)},[m,i]),(0,y.FD)(er.Provider,{value:r.useMemo(()=>({preserveTabOrder:l,beforeOutsideRef:s,afterOutsideRef:f,beforeInsideRef:d,afterInsideRef:v,portalNode:i,setFocusManagerState:a}),[l,i]),children:[g&&i&&(0,y.Y)(en,{"data-type":"outside",ref:s,onFocus:e=>{if(J(e,i)){var t;null==(t=d.current)||t.focus()}else{let e=Q()||(null==c?void 0:c.domReference);null==e||e.focus()}}}),g&&i&&(0,y.Y)("span",{"aria-owns":i.id,style:et}),i&&r.createPortal(t,i),g&&i&&(0,y.Y)(en,{"data-type":"outside",ref:f,onFocus:e=>{if(J(e,i)){var t;null==(t=v.current)||t.focus()}else{let t=G()||(null==c?void 0:c.domReference);null==t||t.focus(),(null==c?void 0:c.closeOnFocusOut)&&(null==c||c.onOpenChange(!1,e.nativeEvent,"focus-out"))}}})]})}let el=()=>r.useContext(er),ei="data-floating-ui-focusable";function ec(e){return e?e.hasAttribute(ei)?e:e.querySelector("["+ei+"]")||e:null}function ea(e){return r.useMemo(()=>t=>{e.forEach(e=>{e&&(e.current=t)})},e)}let es=/^(23133|90887)$/.test(n.j)?[]:null;function ef(){return es.slice().reverse().find(e=>e.isConnected)}let ed=/^(23133|90887)$/.test(n.j)?r.forwardRef(function(e,t){return(0,y.Y)("button",{...e,type:"button",ref:t,tabIndex:-1,style:et})}):null;function ev(e){let{context:t,children:n,disabled:i=!1,order:c=["content"],guards:s=!0,initialFocus:d=0,returnFocus:p=!0,restoreFocus:g=!1,modal:w=!0,visuallyHiddenDismiss:R=!1,closeOnFocusOut:x=!0,outsideElementsInert:S=!1}=e,{open:A,onOpenChange:C,events:M,dataRef:T,elements:{domReference:N,floating:O}}=t,q=k(()=>{var e;return null==(e=T.current.floatingContext)?void 0:e.nodeId}),F="number"==typeof d&&d<0,K=!!N&&"combobox"===N.getAttribute("role")&&h(N)&&F,_="undefined"!=typeof HTMLElement&&"inert"in HTMLElement.prototype,B=!_||s,X=!B||_&&S,$=P(c),z=P(d),H=P(p),Z=r.useContext(I),ee=el(),er=r.useRef(null),eo=r.useRef(null),eu=r.useRef(!1),ei=r.useRef(!1),ev=r.useRef(-1),ep=null!=ee,em=ec(O),eg=k(function(e){return void 0===e&&(e=em),e?(0,E.Kr)(e,V()):[]}),eh=k(e=>{let t=eg(e);return $.current.map(e=>N&&"reference"===e?N:em&&"floating"===e?em:t).filter(Boolean).flat()});r.useEffect(()=>{if(i||!w)return;function e(e){if("Tab"===e.key){l(em,u(v(em)))&&0===eg().length&&!K&&b(e);let t=eh(),n=m(e);"reference"===$.current[0]&&n===N&&(b(e),e.shiftKey?Y(t[t.length-1]):Y(t[1])),"floating"===$.current[1]&&n===em&&e.shiftKey&&(b(e),Y(t[0]))}}let t=v(em);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}},[i,N,em,w,$,K,eg,eh]),r.useEffect(()=>{if(!i&&O)return O.addEventListener("focusin",e),()=>{O.removeEventListener("focusin",e)};function e(e){let t=m(e),n=eg().indexOf(t);-1!==n&&(ev.current=n)}},[i,O,eg]),r.useEffect(()=>{if(!i&&x&&O&&(0,o.sb)(N))return N.addEventListener("focusout",t),N.addEventListener("pointerdown",e),O.addEventListener("focusout",t),()=>{N.removeEventListener("focusout",t),N.removeEventListener("pointerdown",e),O.removeEventListener("focusout",t)};function e(){ei.current=!0,setTimeout(()=>{ei.current=!1})}function t(e){let t=e.relatedTarget;queueMicrotask(()=>{let n=q(),r=!(l(N,t)||l(O,t)||l(t,O)||l(null==ee?void 0:ee.portalNode,t)||null!=t&&t.hasAttribute(D("focus-guard"))||Z&&(W(Z.nodesRef.current,n).find(e=>{var n,r;return l(null==(n=e.context)?void 0:n.elements.floating,t)||l(null==(r=e.context)?void 0:r.elements.domReference,t)})||j(Z.nodesRef.current,n).find(e=>{var n,r,o;return[null==(n=e.context)?void 0:n.elements.floating,ec(null==(r=e.context)?void 0:r.elements.floating)].includes(t)||(null==(o=e.context)?void 0:o.elements.domReference)===t})));if(g&&r&&u(v(em))===v(em).body){(0,o.sb)(em)&&em.focus();let e=ev.current,t=eg(),n=t[e]||t[t.length-1]||em;(0,o.sb)(n)&&n.focus()}(K||!w)&&t&&r&&!ei.current&&t!==ef()&&(eu.current=!0,C(!1,e,"focus-out"))})}},[i,N,O,em,w,Z,ee,C,x,g,eg,K,q]);let eb=r.useRef(null),ey=r.useRef(null),eE=ea([eb,null==ee?void 0:ee.beforeInsideRef]),ew=ea([ey,null==ee?void 0:ee.afterInsideRef]);function eR(e){return!i&&R&&w?(0,y.Y)(ed,{ref:"start"===e?er:eo,onClick:e=>C(!1,e.nativeEvent),children:"string"==typeof R?R:"Dismiss"}):null}r.useEffect(()=>{var e;if(i||!O)return;let t=[O,...Array.from((null==ee||null==(e=ee.portalNode)?void 0:e.querySelectorAll("["+D("portal")+"]"))||[]),...Z&&!w?j(null==Z?void 0:Z.nodesRef.current,q()).map(e=>{var t;return null==(t=e.context)?void 0:t.elements.floating}):[],er.current,eo.current,eb.current,ey.current,null==ee?void 0:ee.beforeOutsideRef.current,null==ee?void 0:ee.afterOutsideRef.current,$.current.includes("reference")||K?N:null].filter(e=>null!=e),n=w||K?U(t,!X,X):U(t);return()=>{n()}},[i,N,O,w,$,ee,K,B,X,Z,q]),L(()=>{if(i||!(0,o.sb)(em))return;let e=u(v(em));queueMicrotask(()=>{let t=eh(em),n=z.current,r=("number"==typeof n?t[n]:n.current)||em,o=l(em,e);F||o||!A||Y(r,{preventScroll:r===em})})},[i,A,em,F,eh,z]),L(()=>{if(i||!em)return;let e=!1,t=!1,n=v(em),r=u(n),c=T.current.openEvent;function s(n){let{open:r,reason:o,event:u,nested:l}=n;if(r&&(c=u),"escape-key"===o&&(t=!0),["hover","safe-polygon"].includes(o)&&"mouseleave"===u.type&&(eu.current=!0),"outside-press"===o)if(l)eu.current=!1,e=!0;else if(0===u.mozInputSource&&u.isTrusted||(f()&&u.pointerType?"click"===u.type&&1===u.buttons:0===u.detail&&!u.pointerType)||a(u))eu.current=!1;else{let t=!1;document.createElement("div").focus({get preventScroll(){return t=!0,!1}}),t?(eu.current=!1,e=!0):eu.current=!0}}es=es.filter(e=>e.isConnected),r&&"body"!==(0,o.mq)(r)&&(es.push(r),es.length>20&&(es=es.slice(-20))),M.on("openchange",s);let d=n.createElement("span");return d.setAttribute("tabindex","-1"),d.setAttribute("aria-hidden","true"),Object.assign(d.style,et),ep&&N&&N.insertAdjacentElement("afterend",d),()=>{M.off("openchange",s);let r=u(n),i=l(O,r)||Z&&W(Z.nodesRef.current,q()).some(e=>{var t;return l(null==(t=e.context)?void 0:t.elements.floating,r)});(i||c&&["click","mousedown"].includes(c.type))&&(t=!0);let a="boolean"==typeof H.current?t&&N?N:ef()||d:H.current.current||d;queueMicrotask(()=>{let t,u=(t=V(),(0,E.AO)(a,t)?a:(0,E.Kr)(a,t)[0]||a);H.current&&!eu.current&&(0,o.sb)(u)&&(u===r||r===n.body||i)&&u.focus({preventScroll:e}),d.remove()})}},[i,O,em,H,T,M,Z,ep,N,q]),r.useEffect(()=>{queueMicrotask(()=>{eu.current=!1})},[i]),L(()=>{if(!i&&ee)return ee.setFocusManagerState({modal:w,closeOnFocusOut:x,open:A,onOpenChange:C,domReference:N}),()=>{ee.setFocusManagerState(null)}},[i,ee,w,A,C,x,N]),L(()=>{if(i||!em||"function"!=typeof MutationObserver||F)return;let e=()=>{let e=em.getAttribute("tabindex"),t=eg(),n=u(v(O)),r=t.indexOf(n);-1!==r&&(ev.current=r),$.current.includes("floating")||n!==N&&0===t.length?"0"!==e&&em.setAttribute("tabindex","0"):"-1"!==e&&em.setAttribute("tabindex","-1")};e();let t=new MutationObserver(e);return t.observe(em,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}},[i,O,em,N,$,eg,F]);let ex=!i&&B&&(!w||!K)&&(ep||w);return(0,y.FD)(y.FK,{children:[ex&&(0,y.Y)(en,{"data-type":"inside",ref:eE,onFocus:e=>{if(w){let e=eh();Y("reference"===c[0]?e[0]:e[e.length-1])}else if(null!=ee&&ee.preserveTabOrder&&ee.portalNode)if(eu.current=!1,J(e,ee.portalNode)){let e=G()||N;null==e||e.focus()}else{var t;null==(t=ee.beforeOutsideRef.current)||t.focus()}}}),!K&&eR("start"),n,eR("end"),ex&&(0,y.Y)(en,{"data-type":"inside",ref:ew,onFocus:e=>{if(w)Y(eh()[0]);else if(null!=ee&&ee.preserveTabOrder&&ee.portalNode)if(x&&(eu.current=!0),J(e,ee.portalNode)){let e=Q()||N;null==e||e.focus()}else{var t;null==(t=ee.afterOutsideRef.current)||t.focus()}}})]})}let ep={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},em={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},eg=e=>{var t,n;return{escapeKey:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePress:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}};function eh(e,t){void 0===t&&(t={});let{open:n,onOpenChange:u,elements:i,dataRef:c}=e,{enabled:a=!0,escapeKey:s=!0,outsidePress:f=!0,outsidePressEvent:d="pointerdown",referencePress:g=!1,referencePressEvent:h="pointerdown",ancestorScroll:b=!1,bubbles:y,capture:E}=t,w=r.useContext(I),R=k("function"==typeof f?f:()=>!1),x="function"==typeof f?R:f,L=r.useRef(!1),S=r.useRef(!1),{escapeKey:A,outsidePress:C}=eg(y),{escapeKey:M,outsidePress:T}=eg(E),N=r.useRef(!1),O=k(e=>{var t;if(!n||!a||!s||"Escape"!==e.key||N.current)return;let r=null==(t=c.current.floatingContext)?void 0:t.nodeId,o=w?W(w.nodesRef.current,r):[];if(!A&&(e.stopPropagation(),o.length>0)){let e=!0;if(o.forEach(t=>{var n;if(null!=(n=t.context)&&n.open&&!t.context.dataRef.current.__escapeKeyBubbles){e=!1;return}}),!e)return}u(!1,"nativeEvent"in e?e.nativeEvent:e,"escape-key")}),P=k(e=>{var t;let n=()=>{var t;O(e),null==(t=m(e))||t.removeEventListener("keydown",n)};null==(t=m(e))||t.addEventListener("keydown",n)}),q=k(e=>{var t;let n=L.current;L.current=!1;let r=S.current;if(S.current=!1,"click"===d&&r||n||"function"==typeof x&&!x(e))return;let a=m(e),s="["+D("inert")+"]",f=v(i.floating).querySelectorAll(s),g=(0,o.vq)(a)?a:null;for(;g&&!(0,o.eu)(g);){let e=(0,o.$4)(g);if((0,o.eu)(e)||!(0,o.vq)(e))break;g=e}if(f.length&&(0,o.vq)(a)&&!a.matches("html,body")&&!l(a,i.floating)&&Array.from(f).every(e=>!l(g,e)))return;if((0,o.sb)(a)&&_){let t=(0,o.eu)(a),n=(0,o.L9)(a),r=/auto|scroll/,u=t||r.test(n.overflowX),l=t||r.test(n.overflowY),i=u&&a.clientWidth>0&&a.scrollWidth>a.clientWidth,c=l&&a.clientHeight>0&&a.scrollHeight>a.clientHeight,s="rtl"===n.direction,f=c&&(s?e.offsetX<=a.offsetWidth-a.clientWidth:e.offsetX>a.clientWidth),d=i&&e.offsetY>a.clientHeight;if(f||d)return}let h=null==(t=c.current.floatingContext)?void 0:t.nodeId,b=w&&W(w.nodesRef.current,h).some(t=>{var n;return p(e,null==(n=t.context)?void 0:n.elements.floating)});if(p(e,i.floating)||p(e,i.domReference)||b)return;let y=w?W(w.nodesRef.current,h):[];if(y.length>0){let e=!0;if(y.forEach(t=>{var n;if(null!=(n=t.context)&&n.open&&!t.context.dataRef.current.__outsidePressBubbles){e=!1;return}}),!e)return}u(!1,e,"outside-press")}),F=k(e=>{var t;let n=()=>{var t;q(e),null==(t=m(e))||t.removeEventListener(d,n)};null==(t=m(e))||t.addEventListener(d,n)});r.useEffect(()=>{if(!n||!a)return;c.current.__escapeKeyBubbles=A,c.current.__outsidePressBubbles=C;let e=-1;function t(e){u(!1,e,"ancestor-scroll")}function r(){window.clearTimeout(e),N.current=!0}function l(){e=window.setTimeout(()=>{N.current=!1},5*!!(0,o.Tc)())}let f=v(i.floating);s&&(f.addEventListener("keydown",M?P:O,M),f.addEventListener("compositionstart",r),f.addEventListener("compositionend",l)),x&&f.addEventListener(d,T?F:q,T);let p=[];return b&&((0,o.vq)(i.domReference)&&(p=(0,o.v9)(i.domReference)),(0,o.vq)(i.floating)&&(p=p.concat((0,o.v9)(i.floating))),!(0,o.vq)(i.reference)&&i.reference&&i.reference.contextElement&&(p=p.concat((0,o.v9)(i.reference.contextElement)))),(p=p.filter(e=>{var t;return e!==(null==(t=f.defaultView)?void 0:t.visualViewport)})).forEach(e=>{e.addEventListener("scroll",t,{passive:!0})}),()=>{s&&(f.removeEventListener("keydown",M?P:O,M),f.removeEventListener("compositionstart",r),f.removeEventListener("compositionend",l)),x&&f.removeEventListener(d,T?F:q,T),p.forEach(e=>{e.removeEventListener("scroll",t)}),window.clearTimeout(e)}},[c,i,s,x,d,n,u,b,a,A,C,O,M,P,q,T,F]),r.useEffect(()=>{L.current=!1},[x,d]);let K=r.useMemo(()=>({onKeyDown:O,...g&&{[ep[h]]:e=>{u(!1,e.nativeEvent,"reference-press")},..."click"!==h&&{onClick(e){u(!1,e.nativeEvent,"reference-press")}}}}),[O,u,g,h]),_=r.useMemo(()=>({onKeyDown:O,onMouseDown(){S.current=!0},onMouseUp(){S.current=!0},[em[d]]:()=>{L.current=!0}}),[O,d]);return r.useMemo(()=>a?{reference:K,floating:_}:{},[a,K,_])}function eb(e){void 0===e&&(e={});let{nodeId:t}=e,n=function(e){let{open:t=!1,onOpenChange:n,elements:o}=e,u=M(),l=r.useRef({}),[i]=r.useState(()=>{let e;return e=new Map,{emit(t,n){var r;null==(r=e.get(t))||r.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter(e=>e!==n))||[])}}}),c=null!=N(),[a,s]=r.useState(o.reference),f=k((e,t,r)=>{l.current.openEvent=e?t:void 0,i.emit("openchange",{open:e,event:t,reason:r,nested:c}),null==n||n(e,t,r)}),d=r.useMemo(()=>({setPositionReference:s}),[]),v=r.useMemo(()=>({reference:a||o.reference||null,floating:o.floating||null,domReference:o.reference}),[a,o.reference,o.floating]);return r.useMemo(()=>({dataRef:l,open:t,onOpenChange:f,elements:v,events:i,floatingId:u,refs:d}),[t,f,v,i,u,d])}({...e,elements:{reference:null,floating:null,...e.elements}}),u=e.rootContext||n,l=u.elements,[i,c]=r.useState(null),[a,s]=r.useState(null),f=(null==l?void 0:l.domReference)||i,d=r.useRef(null),v=r.useContext(I);L(()=>{f&&(d.current=f)},[f]);let p=(0,w.we)({...e,elements:{...l,...a&&{reference:a}}}),m=r.useCallback(e=>{let t=(0,o.vq)(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;s(t),p.refs.setReference(t)},[p.refs]),g=r.useCallback(e=>{((0,o.vq)(e)||null===e)&&(d.current=e,c(e)),((0,o.vq)(p.refs.reference.current)||null===p.refs.reference.current||null!==e&&!(0,o.vq)(e))&&p.refs.setReference(e)},[p.refs]),h=r.useMemo(()=>({...p.refs,setReference:g,setPositionReference:m,domReference:d}),[p.refs,g,m]),b=r.useMemo(()=>({...p.elements,domReference:f}),[p.elements,f]),y=r.useMemo(()=>({...p,...u,refs:h,elements:b,nodeId:t}),[p,h,b,t,u]);return L(()=>{u.dataRef.current.floatingContext=y;let e=null==v?void 0:v.nodesRef.current.find(e=>e.id===t);e&&(e.context=y)}),r.useMemo(()=>({...p,context:y,refs:h,elements:b}),[p,h,b,y])}function ey(e,t){void 0===t&&(t={});let{open:n,onOpenChange:c,events:f,dataRef:d,elements:p}=e,{enabled:g=!0,visibleOnly:b=!0}=t,y=r.useRef(!1),E=r.useRef(-1),w=r.useRef(!0);r.useEffect(()=>{if(!g)return;let e=(0,o.zk)(p.domReference);function t(){!n&&(0,o.sb)(p.domReference)&&p.domReference===u(v(p.domReference))&&(y.current=!0)}function r(){w.current=!0}return e.addEventListener("blur",t),e.addEventListener("keydown",r,!0),()=>{e.removeEventListener("blur",t),e.removeEventListener("keydown",r,!0)}},[p.domReference,n,g]),r.useEffect(()=>{if(g)return f.on("openchange",e),()=>{f.off("openchange",e)};function e(e){let{reason:t}=e;("reference-press"===t||"escape-key"===t)&&(y.current=!0)}},[f,g]),r.useEffect(()=>()=>{O(E)},[]);let R=r.useMemo(()=>({onPointerDown(e){a(e.nativeEvent)||(w.current=!1)},onMouseLeave(){y.current=!1},onFocus(e){if(y.current)return;let t=m(e.nativeEvent);if(b&&(0,o.vq)(t))try{if(s()&&i().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints)throw Error();if(!t.matches(":focus-visible"))return}catch(e){if(!w.current&&!h(t))return}c(!0,e.nativeEvent,"focus")},onBlur(e){y.current=!1;let t=e.relatedTarget,n=e.nativeEvent,r=(0,o.vq)(t)&&t.hasAttribute(D("focus-guard"))&&"outside"===t.getAttribute("data-type");E.current=window.setTimeout(()=>{var e;let o=u(p.domReference?p.domReference.ownerDocument:document);!t&&o===p.domReference||l(null==(e=d.current.floatingContext)?void 0:e.refs.floating.current,o)||l(p.domReference,o)||r||c(!1,n,"focus")})}}),[d,p.domReference,c,b]);return r.useMemo(()=>g?{reference:R}:{},[g,R])}let eE="active",ew="selected";function eR(e,t,n){let r=new Map,o="item"===n,u=e;if(o&&e){let{[eE]:t,[ew]:n,...r}=e;u=r}return{..."floating"===n&&{tabIndex:-1,[ei]:""},...u,...t.map(t=>{let r=t?t[n]:null;return"function"==typeof r?e?r(e):null:r}).concat(e).reduce((e,t)=>(t&&Object.entries(t).forEach(t=>{let[n,u]=t;if(!(o&&[eE,ew].includes(n)))if(0===n.indexOf("on")){if(r.has(n)||r.set(n,[]),"function"==typeof u){var l;null==(l=r.get(n))||l.push(u),e[n]=function(){for(var e,t=arguments.length,o=Array(t),u=0;ue(...o)).find(e=>void 0!==e)}}}else e[n]=u}),e),{})}}function ex(e){void 0===e&&(e=[]);let t=e.map(e=>null==e?void 0:e.reference),n=e.map(e=>null==e?void 0:e.floating),o=e.map(e=>null==e?void 0:e.item),u=r.useCallback(t=>eR(t,e,"reference"),t),l=r.useCallback(t=>eR(t,e,"floating"),n),i=r.useCallback(t=>eR(t,e,"item"),o);return r.useMemo(()=>({getReferenceProps:u,getFloatingProps:l,getItemProps:i}),[u,l,i])}let ek=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?"-":"")+e.toLowerCase());function eL(e,t){return"function"==typeof e?e(t):e}function eS(e,t){void 0===t&&(t={});let{initial:n={opacity:0},open:o,close:u,common:l,duration:i=250}=t,c=e.placement,a=c.split("-")[0],s=r.useMemo(()=>({side:a,placement:c}),[a,c]),f="number"==typeof i,d=(f?i:i.open)||0,v=(f?i:i.close)||0,[p,m]=r.useState(()=>({...eL(l,s),...eL(n,s)})),{isMounted:g,status:h}=function(e,t){void 0===t&&(t={});let{open:n,elements:{floating:o}}=e,{duration:u=250}=t,l=("number"==typeof u?u:u.close)||0,[i,c]=r.useState("unmounted"),a=function(e,t){let[n,o]=r.useState(e);return e&&!n&&o(!0),r.useEffect(()=>{if(!e&&n){let e=setTimeout(()=>o(!1),t);return()=>clearTimeout(e)}},[e,n,t]),n}(n,l);return a||"close"!==i||c("unmounted"),L(()=>{if(o){if(n){c("initial");let e=requestAnimationFrame(()=>{c("open")});return()=>{cancelAnimationFrame(e)}}c("close")}},[n,o]),{isMounted:a,status:i}}(e,{duration:i}),b=P(n),y=P(o),E=P(u),w=P(l);return L(()=>{let e=eL(b.current,s),t=eL(E.current,s),n=eL(w.current,s),r=eL(y.current,s)||Object.keys(e).reduce((e,t)=>(e[t]="",e),{});if("initial"===h&&m(t=>({transitionProperty:t.transitionProperty,...n,...e})),"open"===h&&m({transitionProperty:Object.keys(r).map(ek).join(","),transitionDuration:d+"ms",...n,...r}),"close"===h){let r=t||e;m({transitionProperty:Object.keys(r).map(ek).join(","),transitionDuration:v+"ms",...n,...r})}},[v,E,b,y,w,d,h,s]),{isMounted:g,styles:p}}}}]);